Skip to content

Commit

Permalink
re-add static linking + fix crash for dui unloading
Browse files Browse the repository at this point in the history
  • Loading branch information
wiktorwiktor12 committed Jun 29, 2024
1 parent a8fc4d8 commit a78f8fe
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 30 deletions.
6 changes: 3 additions & 3 deletions ConsoleLogonHook/ConsoleLogonHook.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{6cc17286-2fe3-4bcb-899b-76d1eacd3469}</ProjectGuid>
<RootNamespace>ConsoleLogonHook</RootNamespace>
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
Expand Down Expand Up @@ -118,7 +118,7 @@
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<AdditionalIncludeDirectories>$(ProjectDir);detours;imgui;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -142,7 +142,7 @@
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<AdditionalIncludeDirectories>$(ProjectDir);detours;imgui;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
9 changes: 9 additions & 0 deletions ConsoleLogonHook/util/memory_man.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace memory
{
inline const int VersionNumber = 104;
inline const std::string offsetCacheFileName = "ConsoleLogonHookOffsetCache.txt";

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

std::ofstream file(offsetCacheFileName);

file << "VersionNumber" << ":" << VersionNumber << "\n";

for (int i = 0; i < offsetCache.size(); ++i)
{
file << offsetCache[i].first << ":" << offsetCache[i].second << "\n";
Expand Down Expand Up @@ -231,6 +234,12 @@ namespace memory

static void CheckCache()
{
uintptr_t savedVersion = FindInOffsetCache("VersionNumber");
if (savedVersion != VersionNumber)
{
offsetCache.clear();
SPDLOG_INFO("Version Number does not match! clearing offset cache");
}
//return;
//auto SecurityOptionsView__RuntimeClassIntialise = (uint8_t*)(baseaddress + 0x36EB4);
auto SecurityOptionsView__RuntimeClassIntialise = FindPatternCached<uint8_t*>("SecurityOptionsViewRuntimeClassIntialise", { "55 56 57 41 56 41 57 48 8B EC 48 83 EC 30" });
Expand Down
6 changes: 3 additions & 3 deletions ConsoleLogonUI/ConsoleLogonUI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{e624c20f-a41a-4bc5-b312-257ed4aecfb9}</ProjectGuid>
<RootNamespace>ConsoleLogonUI</RootNamespace>
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
Expand Down Expand Up @@ -115,7 +115,7 @@
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -137,7 +137,7 @@
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
25 changes: 1 addition & 24 deletions ConsoleLogonUI/ui/dui_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,30 +183,7 @@ void duiManager::UnloadDUI()
auto pDuiManager = Get();

UnregisterHotKey(pDuiManager->pWndHost->GetHWND(), hotkeyid);

if (pDuiManager->pUIElement)
{
pDuiManager->pUIElement->DestroyAll(true);
}
if (pDuiManager->pWndElement)
{
pDuiManager->pWndElement->DestroyAll(true);

}
if (pDuiManager->pWndHost)
{
pDuiManager->pWndHost->DestroyWindow();
pDuiManager->pWndHost->Destroy();
}
if (pDuiManager->pParser)
pDuiManager->pParser->Destroy();

pDuiManager->pParser = NULL;
pDuiManager->pWndHost = NULL;
pDuiManager->pUIElement = NULL;
pDuiManager->pWndElement = NULL;
pDuiManager->pageContainerElement = NULL;

pDuiManager->pWndHost->DestroyWindow();

DirectUI::UnInitThread();
DirectUI::UnInitProcessPriv(0);
Expand Down

0 comments on commit a78f8fe

Please sign in to comment.