File tree Expand file tree Collapse file tree 7 files changed +16
-192
lines changed
Core/Libraries/Source/WWVegas/WWLib Expand file tree Collapse file tree 7 files changed +16
-192
lines changed Original file line number Diff line number Diff line change @@ -103,8 +103,6 @@ set(WWLIB_SRC
103103 #regexpr.cpp
104104 #regexpr.h
105105 #search.h
106- ScopedFileRenamer.cpp
107- ScopedFileRenamer.h
108106 sharebuf.h
109107 Signaler.h
110108 simplevec.h
Original file line number Diff line number Diff line change 2222
2323
2424DbgHelpGuard::DbgHelpGuard ()
25+ : m_hasLoaded(false )
2526{
26- deactivate ();
27+ activate ();
2728}
2829
2930DbgHelpGuard::~DbgHelpGuard ()
3031{
31- reactivate ();
32+ deactivate ();
3233}
3334
34- void DbgHelpGuard::deactivate ()
35+ void DbgHelpGuard::activate ()
3536{
36- DbgHelpLoader::blockLoad ();
37-
3837 if (DbgHelpLoader::isLoadedFromSystem ())
3938 {
4039 // This is ok. Do nothing.
4140 }
4241 else if (DbgHelpLoader::isLoaded ())
4342 {
44- DbgHelpLoader::unload ();
45- m_requiresLoad = true ;
46- m_dbgHelpRenamer.rename (" dbghelp.dll" , " dbghelp.dll.bak" );
43+ // This is maybe not ok. But do nothing until this becomes a user facing problem.
4744 }
4845 else
4946 {
50- m_dbgHelpRenamer.rename (" dbghelp.dll" , " dbghelp.dll.bak" );
47+ // Front load the DLL now to prevent other code from loading the potentially wrong DLL.
48+ m_hasLoaded = DbgHelpLoader::load ();
5149 }
5250}
5351
54- void DbgHelpGuard::reactivate ()
52+ void DbgHelpGuard::deactivate ()
5553{
56- m_dbgHelpRenamer.revert ();
57- DbgHelpLoader::unblockLoad ();
58-
59- if (m_requiresLoad)
54+ if (m_hasLoaded)
6055 {
61- DbgHelpLoader::load ();
62- m_requiresLoad = false ;
56+ DbgHelpLoader::unload ();
57+ m_hasLoaded = false ;
6358 }
6459}
Original file line number Diff line number Diff line change 2020
2121#include " always.h"
2222
23- #include " ScopedFileRenamer.h"
2423
25-
26- // This class temporarily unloads dbghelp.dll and prevents it from loading during its lifetime .
24+ // This class temporarily loads and unloads dbghelp.dll from the desired location to prevent
25+ // other code from potentially loading it from an undesired location .
2726// This helps avoid crashing on boot using recent AMD/ATI drivers, which attempt to load and use
2827// dbghelp.dll from the game install directory but are unable to do so correctly because
2928// the dbghelp.dll that ships with the game is very old and the AMD/ATI code does not handle
30- // that correctly. This workaround is not required if the dbghelp.dll was loaded from the system
31- // directory.
29+ // that correctly.
3230
3331class DbgHelpGuard
3432{
@@ -37,11 +35,10 @@ class DbgHelpGuard
3735 DbgHelpGuard ();
3836 ~DbgHelpGuard ();
3937
38+ void activate ();
4039 void deactivate ();
41- void reactivate ();
4240
4341private:
4442
45- ScopedFileRenamer m_dbgHelpRenamer;
46- bool m_requiresLoad;
43+ bool m_hasLoaded;
4744};
Original file line number Diff line number Diff line change 1919#include " DbgHelpLoader.h"
2020
2121
22- int DbgHelpLoader::BlockLoadCounter = 0 ;
2322DbgHelpLoader* DbgHelpLoader::Inst = NULL ;
2423
2524DbgHelpLoader::DbgHelpLoader ()
@@ -53,21 +52,8 @@ bool DbgHelpLoader::isLoadedFromSystem()
5352 return Inst != NULL && Inst->m_loadedFromSystem ;
5453}
5554
56- void DbgHelpLoader::blockLoad ()
57- {
58- ++BlockLoadCounter;
59- }
60-
61- bool DbgHelpLoader::unblockLoad ()
62- {
63- return --BlockLoadCounter == 0 ;
64- }
65-
6655bool DbgHelpLoader::load ()
6756{
68- if (BlockLoadCounter > 0 )
69- return false ;
70-
7157 if (Inst == NULL )
7258 {
7359 // Cannot use new/delete here when this is loaded during game memory initialization.
Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ class DbgHelpLoader
3333{
3434private:
3535
36- static int BlockLoadCounter;
3736 static DbgHelpLoader* Inst; // Is singleton class
3837
3938 DbgHelpLoader ();
@@ -47,12 +46,6 @@ class DbgHelpLoader
4746 // Returns whether dbghelp.dll is loaded from the system directory
4847 static bool isLoadedFromSystem ();
4948
50- // Blocks loading a dbghelp.dll
51- static void blockLoad ();
52-
53- // Unblocks loading a dbghelp.dll. Returns true if unblocked.
54- static bool unblockLoad ();
55-
5649 static bool load ();
5750 static bool reload ();
5851 static void unload ();
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments