#179 hook GetDiskFreeSpaceA
This commit is contained in:
parent
c648d46f4c
commit
1170d0dd12
5 changed files with 58 additions and 0 deletions
|
@ -372,6 +372,8 @@ static void cfg_create_ini()
|
|||
"allow_wmactivate=false\n"
|
||||
"dinputhook=false\n"
|
||||
"flipclear=false\n"
|
||||
"limit_disk_space=false\n"
|
||||
"fixmousehook=false\n"
|
||||
"bpp=0\n"
|
||||
"\n"
|
||||
"\n"
|
||||
|
@ -733,10 +735,12 @@ static void cfg_create_ini()
|
|||
"; Fallout\n"
|
||||
"[falloutw]\n"
|
||||
"dinputhook=true\n"
|
||||
"limit_disk_space=true\n"
|
||||
"\n"
|
||||
"; Fallout 2\n"
|
||||
"[FALLOUT2]\n"
|
||||
"dinputhook=true\n"
|
||||
"limit_disk_space=true\n"
|
||||
"\n"
|
||||
"; Fairy Tale About Father Frost, Ivan and Nastya\n"
|
||||
"[mrazik]\n"
|
||||
|
|
|
@ -49,6 +49,7 @@ LOADLIBRARYAPROC real_LoadLibraryA = LoadLibraryA;
|
|||
LOADLIBRARYWPROC real_LoadLibraryW = LoadLibraryW;
|
||||
LOADLIBRARYEXAPROC real_LoadLibraryExA = LoadLibraryExA;
|
||||
LOADLIBRARYEXWPROC real_LoadLibraryExW = LoadLibraryExW;
|
||||
GETDISKFREESPACEAPROC real_GetDiskFreeSpaceA = GetDiskFreeSpaceA;
|
||||
COCREATEINSTANCEPROC real_CoCreateInstance = CoCreateInstance;
|
||||
|
||||
static HOOKLIST g_hooks[] =
|
||||
|
@ -576,6 +577,7 @@ void hook_early_init()
|
|||
hook_patch_iat(GetModuleHandle(NULL), FALSE, "user32.dll", "ClipCursor", (PROC)fake_ClipCursor); //NexusTK
|
||||
hook_patch_iat(GetModuleHandle("AcGenral"), FALSE, "user32.dll", "SetWindowsHookExA", (PROC)fake_SetWindowsHookExA);
|
||||
hook_patch_iat(GetModuleHandle(NULL), FALSE, "user32.dll", "SetWindowsHookExA", (PROC)fake_SetWindowsHookExA);
|
||||
hook_patch_iat(GetModuleHandle(NULL), FALSE, "kernel32.dll", "GetDiskFreeSpaceA", (PROC)fake_GetDiskFreeSpaceA);
|
||||
}
|
||||
|
||||
void hook_exit()
|
||||
|
@ -633,4 +635,5 @@ void hook_exit()
|
|||
hook_patch_iat(GetModuleHandle(NULL), TRUE, "user32.dll", "ClipCursor", (PROC)fake_ClipCursor); //NexusTK
|
||||
hook_patch_iat(GetModuleHandle("AcGenral"), TRUE, "user32.dll", "SetWindowsHookExA", (PROC)fake_SetWindowsHookExA);
|
||||
hook_patch_iat(GetModuleHandle(NULL), TRUE, "user32.dll", "SetWindowsHookExA", (PROC)fake_SetWindowsHookExA);
|
||||
hook_patch_iat(GetModuleHandle(NULL), TRUE, "kernel32.dll", "GetDiskFreeSpaceA", (PROC)fake_GetDiskFreeSpaceA);
|
||||
}
|
||||
|
|
|
@ -776,6 +776,39 @@ HMODULE WINAPI fake_LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dw
|
|||
return hmod;
|
||||
}
|
||||
|
||||
BOOL WINAPI fake_GetDiskFreeSpaceA(
|
||||
LPCSTR lpRootPathName,
|
||||
LPDWORD lpSectorsPerCluster,
|
||||
LPDWORD lpBytesPerSector,
|
||||
LPDWORD lpNumberOfFreeClusters,
|
||||
LPDWORD lpTotalNumberOfClusters)
|
||||
{
|
||||
BOOL result =
|
||||
real_GetDiskFreeSpaceA(
|
||||
lpRootPathName,
|
||||
lpSectorsPerCluster,
|
||||
lpBytesPerSector,
|
||||
lpNumberOfFreeClusters,
|
||||
lpTotalNumberOfClusters);
|
||||
|
||||
if (cfg_get_bool("limit_disk_space", FALSE))
|
||||
{
|
||||
if (lpSectorsPerCluster)
|
||||
*lpSectorsPerCluster = 0x00000040;
|
||||
|
||||
if (lpBytesPerSector)
|
||||
*lpBytesPerSector = 0x00000200;
|
||||
|
||||
if (lpNumberOfFreeClusters)
|
||||
*lpNumberOfFreeClusters = 0x0000FFF6;
|
||||
|
||||
if (lpTotalNumberOfClusters)
|
||||
*lpTotalNumberOfClusters = 0x0000FFF6;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL WINAPI fake_DestroyWindow(HWND hWnd)
|
||||
{
|
||||
BOOL result = real_DestroyWindow(hWnd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue