-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Hopefully help prevent false positives
- Loading branch information
Showing
5 changed files
with
73 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
|
||
# Set the project name | ||
project(ShimDll) | ||
|
||
# Specify the C++ standard | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED True) | ||
|
||
if (WIN32 AND NOT GITHUB_ACTION_BUILD) | ||
# debug output paths | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "C:/Program Files (x86)/Steam") | ||
set(LIBRARY_OUTPUT_DIRECTORY "C:/Program Files (x86)/Steam") | ||
elseif(UNIX AND NOT GITHUB_ACTION_BUILD) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "$ENV{HOME}/.millennium/") | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "$ENV{HOME}/.millennium/") | ||
endif() | ||
|
||
# Add the executable | ||
add_library(ShimDll SHARED main.cc) | ||
|
||
set_target_properties(ShimDll PROPERTIES OUTPUT_NAME "user32") | ||
set_target_properties(ShimDll PROPERTIES PREFIX "") | ||
set_target_properties(ShimDll PROPERTIES NO_EXPORT TRUE) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include <windows.h> | ||
|
||
const void ShutdownShim(HINSTANCE hinstDLL) | ||
{ | ||
// Unload current module | ||
FreeLibraryAndExitThread(hinstDLL, 0); | ||
} | ||
|
||
const void LoadMillennium(HINSTANCE hinstDLL) | ||
{ | ||
HMODULE hMillennium = LoadLibrary(TEXT("millennium.dll")); | ||
if (hMillennium == nullptr) { | ||
MessageBoxA(nullptr, "Failed to load millennium.dll", "Error", MB_ICONERROR); | ||
return; // Exit with error code | ||
} | ||
|
||
CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)ShutdownShim, hinstDLL, 0, nullptr); | ||
} | ||
|
||
BOOL WINAPI DllMain( | ||
HINSTANCE hinstDLL, // handle to DLL module | ||
DWORD fdwReason, // reason for calling function | ||
LPVOID lpvReserved ) // reserved | ||
{ | ||
switch (fdwReason) | ||
{ | ||
case DLL_PROCESS_ATTACH: | ||
{ | ||
LoadMillennium(hinstDLL); | ||
break; | ||
} | ||
case DLL_PROCESS_DETACH: | ||
{ | ||
// ShutdownShim(); | ||
break; | ||
} | ||
} | ||
|
||
return true; | ||
} |