Skip to content

Commit a78f8fe

Browse files
re-add static linking + fix crash for dui unloading
1 parent a8fc4d8 commit a78f8fe

File tree

4 files changed

+16
-30
lines changed

4 files changed

+16
-30
lines changed

ConsoleLogonHook/ConsoleLogonHook.vcxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<Keyword>Win32Proj</Keyword>
2424
<ProjectGuid>{6cc17286-2fe3-4bcb-899b-76d1eacd3469}</ProjectGuid>
2525
<RootNamespace>ConsoleLogonHook</RootNamespace>
26-
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
26+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
2727
</PropertyGroup>
2828
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2929
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -118,7 +118,7 @@
118118
<LanguageStandard>stdcpplatest</LanguageStandard>
119119
<LanguageStandard_C>stdc17</LanguageStandard_C>
120120
<AdditionalIncludeDirectories>$(ProjectDir);detours;imgui;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
121-
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
121+
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
122122
</ClCompile>
123123
<Link>
124124
<SubSystem>Windows</SubSystem>
@@ -142,7 +142,7 @@
142142
<LanguageStandard>stdcpplatest</LanguageStandard>
143143
<LanguageStandard_C>stdc17</LanguageStandard_C>
144144
<AdditionalIncludeDirectories>$(ProjectDir);detours;imgui;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
145-
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
145+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
146146
</ClCompile>
147147
<Link>
148148
<SubSystem>Windows</SubSystem>

ConsoleLogonHook/util/memory_man.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace memory
1313
{
14+
inline const int VersionNumber = 104;
1415
inline const std::string offsetCacheFileName = "ConsoleLogonHookOffsetCache.txt";
1516

1617
inline std::vector<std::pair<std::string, uintptr_t>> offsetCache;
@@ -53,6 +54,8 @@ namespace memory
5354

5455
std::ofstream file(offsetCacheFileName);
5556

57+
file << "VersionNumber" << ":" << VersionNumber << "\n";
58+
5659
for (int i = 0; i < offsetCache.size(); ++i)
5760
{
5861
file << offsetCache[i].first << ":" << offsetCache[i].second << "\n";
@@ -231,6 +234,12 @@ namespace memory
231234

232235
static void CheckCache()
233236
{
237+
uintptr_t savedVersion = FindInOffsetCache("VersionNumber");
238+
if (savedVersion != VersionNumber)
239+
{
240+
offsetCache.clear();
241+
SPDLOG_INFO("Version Number does not match! clearing offset cache");
242+
}
234243
//return;
235244
//auto SecurityOptionsView__RuntimeClassIntialise = (uint8_t*)(baseaddress + 0x36EB4);
236245
auto SecurityOptionsView__RuntimeClassIntialise = FindPatternCached<uint8_t*>("SecurityOptionsViewRuntimeClassIntialise", { "55 56 57 41 56 41 57 48 8B EC 48 83 EC 30" });

ConsoleLogonUI/ConsoleLogonUI.vcxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<Keyword>Win32Proj</Keyword>
2424
<ProjectGuid>{e624c20f-a41a-4bc5-b312-257ed4aecfb9}</ProjectGuid>
2525
<RootNamespace>ConsoleLogonUI</RootNamespace>
26-
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
26+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
2727
</PropertyGroup>
2828
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2929
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -115,7 +115,7 @@
115115
<LanguageStandard>stdcpplatest</LanguageStandard>
116116
<LanguageStandard_C>stdc17</LanguageStandard_C>
117117
<AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
118-
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
118+
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
119119
</ClCompile>
120120
<Link>
121121
<SubSystem>Windows</SubSystem>
@@ -137,7 +137,7 @@
137137
<LanguageStandard>stdcpplatest</LanguageStandard>
138138
<LanguageStandard_C>stdc17</LanguageStandard_C>
139139
<AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
140-
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
140+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
141141
</ClCompile>
142142
<Link>
143143
<SubSystem>Windows</SubSystem>

ConsoleLogonUI/ui/dui_manager.cpp

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -183,30 +183,7 @@ void duiManager::UnloadDUI()
183183
auto pDuiManager = Get();
184184

185185
UnregisterHotKey(pDuiManager->pWndHost->GetHWND(), hotkeyid);
186-
187-
if (pDuiManager->pUIElement)
188-
{
189-
pDuiManager->pUIElement->DestroyAll(true);
190-
}
191-
if (pDuiManager->pWndElement)
192-
{
193-
pDuiManager->pWndElement->DestroyAll(true);
194-
195-
}
196-
if (pDuiManager->pWndHost)
197-
{
198-
pDuiManager->pWndHost->DestroyWindow();
199-
pDuiManager->pWndHost->Destroy();
200-
}
201-
if (pDuiManager->pParser)
202-
pDuiManager->pParser->Destroy();
203-
204-
pDuiManager->pParser = NULL;
205-
pDuiManager->pWndHost = NULL;
206-
pDuiManager->pUIElement = NULL;
207-
pDuiManager->pWndElement = NULL;
208-
pDuiManager->pageContainerElement = NULL;
209-
186+
pDuiManager->pWndHost->DestroyWindow();
210187

211188
DirectUI::UnInitThread();
212189
DirectUI::UnInitProcessPriv(0);

0 commit comments

Comments
 (0)