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
103
103
#regexpr.cpp
104
104
#regexpr.h
105
105
#search.h
106
- ScopedFileRenamer.cpp
107
- ScopedFileRenamer.h
108
106
sharebuf.h
109
107
Signaler.h
110
108
simplevec.h
Original file line number Diff line number Diff line change 22
22
23
23
24
24
DbgHelpGuard::DbgHelpGuard ()
25
+ : m_hasLoaded(false )
25
26
{
26
- deactivate ();
27
+ activate ();
27
28
}
28
29
29
30
DbgHelpGuard::~DbgHelpGuard ()
30
31
{
31
- reactivate ();
32
+ deactivate ();
32
33
}
33
34
34
- void DbgHelpGuard::deactivate ()
35
+ void DbgHelpGuard::activate ()
35
36
{
36
- DbgHelpLoader::blockLoad ();
37
-
38
37
if (DbgHelpLoader::isLoadedFromSystem ())
39
38
{
40
39
// This is ok. Do nothing.
41
40
}
42
41
else if (DbgHelpLoader::isLoaded ())
43
42
{
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.
47
44
}
48
45
else
49
46
{
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 ();
51
49
}
52
50
}
53
51
54
- void DbgHelpGuard::reactivate ()
52
+ void DbgHelpGuard::deactivate ()
55
53
{
56
- m_dbgHelpRenamer.revert ();
57
- DbgHelpLoader::unblockLoad ();
58
-
59
- if (m_requiresLoad)
54
+ if (m_hasLoaded)
60
55
{
61
- DbgHelpLoader::load ();
62
- m_requiresLoad = false ;
56
+ DbgHelpLoader::unload ();
57
+ m_hasLoaded = false ;
63
58
}
64
59
}
Original file line number Diff line number Diff line change 20
20
21
21
#include " always.h"
22
22
23
- #include " ScopedFileRenamer.h"
24
23
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 .
27
26
// This helps avoid crashing on boot using recent AMD/ATI drivers, which attempt to load and use
28
27
// dbghelp.dll from the game install directory but are unable to do so correctly because
29
28
// 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.
32
30
33
31
class DbgHelpGuard
34
32
{
@@ -37,11 +35,10 @@ class DbgHelpGuard
37
35
DbgHelpGuard ();
38
36
~DbgHelpGuard ();
39
37
38
+ void activate ();
40
39
void deactivate ();
41
- void reactivate ();
42
40
43
41
private:
44
42
45
- ScopedFileRenamer m_dbgHelpRenamer;
46
- bool m_requiresLoad;
43
+ bool m_hasLoaded;
47
44
};
Original file line number Diff line number Diff line change 19
19
#include " DbgHelpLoader.h"
20
20
21
21
22
- int DbgHelpLoader::BlockLoadCounter = 0 ;
23
22
DbgHelpLoader* DbgHelpLoader::Inst = NULL ;
24
23
25
24
DbgHelpLoader::DbgHelpLoader ()
@@ -53,21 +52,8 @@ bool DbgHelpLoader::isLoadedFromSystem()
53
52
return Inst != NULL && Inst->m_loadedFromSystem ;
54
53
}
55
54
56
- void DbgHelpLoader::blockLoad ()
57
- {
58
- ++BlockLoadCounter;
59
- }
60
-
61
- bool DbgHelpLoader::unblockLoad ()
62
- {
63
- return --BlockLoadCounter == 0 ;
64
- }
65
-
66
55
bool DbgHelpLoader::load ()
67
56
{
68
- if (BlockLoadCounter > 0 )
69
- return false ;
70
-
71
57
if (Inst == NULL )
72
58
{
73
59
// 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
33
33
{
34
34
private:
35
35
36
- static int BlockLoadCounter;
37
36
static DbgHelpLoader* Inst; // Is singleton class
38
37
39
38
DbgHelpLoader ();
@@ -47,12 +46,6 @@ class DbgHelpLoader
47
46
// Returns whether dbghelp.dll is loaded from the system directory
48
47
static bool isLoadedFromSystem ();
49
48
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
-
56
49
static bool load ();
57
50
static bool reload ();
58
51
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