[saco] Implement UninstallFileSystemHooks()

* Updates `DllMain(...)`
This commit is contained in:
RD42 2024-02-16 22:20:59 +08:00
parent 29c3a8b351
commit 58263d0e96
3 changed files with 18 additions and 2 deletions

View File

@ -157,3 +157,19 @@ void InstallFileSystemHooks()
//---------------------------------------------------------- //----------------------------------------------------------
void UninstallFileSystemHooks()
{
if(bFileHooksInstalled) {
DetourRemove((PBYTE)Real_CreateFileA,(PBYTE)Arch_CreateFileA);
DetourRemove((PBYTE)Real_ReadFile,(PBYTE)Arch_ReadFile);
DetourRemove((PBYTE)Real_GetFileSize,(PBYTE)Arch_GetFileSize);
DetourRemove((PBYTE)Real_SetFilePointer,(PBYTE)Arch_SetFilePointer);
DetourRemove((PBYTE)Real_CloseHandle,(PBYTE)Arch_CloseHandle);
DetourRemove((PBYTE)Real_GetFileType,(PBYTE)Arch_GetFileType);
DetourRemove((PBYTE)Real_ShowCursor,(PBYTE)Arch_ShowCursor);
bFileHooksInstalled = FALSE;
}
}
//----------------------------------------------------------

View File

@ -3,6 +3,7 @@
void InstallShowCursorHook(); void InstallShowCursorHook();
void InstallFileSystemHooks(); void InstallFileSystemHooks();
void UninstallFileSystemHooks();
#define MAX_OPEN_ARCH_FILES 50 #define MAX_OPEN_ARCH_FILES 50

View File

@ -62,7 +62,6 @@ void LaunchMonitor(PVOID v)
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{ {
// TODO: DllMain
if(DLL_PROCESS_ATTACH==fdwReason) if(DLL_PROCESS_ATTACH==fdwReason)
{ {
hInstance = hinstDLL; hInstance = hinstDLL;
@ -97,7 +96,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
else if(DLL_PROCESS_DETACH==fdwReason) else if(DLL_PROCESS_DETACH==fdwReason)
{ {
if(tSettings.bDebug || tSettings.bPlayOnline) { if(tSettings.bDebug || tSettings.bPlayOnline) {
//sub_10062D90 UninstallFileSystemHooks();
} }
} }