Last active
April 23, 2017 07:15
-
-
Save Maxcloud/aebcf575b0f2a867ea9ac92ef2225d8f to your computer and use it in GitHub Desktop.
Simple hook to remove the file check error.
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
#include "stdafx.h" | |
#include <detourxs.h> | |
#pragma comment(lib, "detourxs.lib") | |
typedef HANDLE (WINAPI *_FindFirstFileA)(LPCTSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData); | |
_FindFirstFileA __FindFirstFileA; | |
HANDLE WINAPI Detour_FindFirstFileA(LPCTSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData); | |
HANDLE WINAPI Detour_FindFirstFileA(LPCTSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData) | |
{ | |
if (lpFileName[0] == '*') | |
return INVALID_HANDLE_VALUE; | |
return __FindFirstFileA(lpFileName, lpFindFileData); | |
} | |
BOOL APIENTRY DllMain( HMODULE hModule, | |
DWORD ul_reason_for_call, | |
LPVOID lpReserved | |
) | |
{ | |
switch (ul_reason_for_call) | |
{ | |
case DLL_PROCESS_ATTACH: | |
__FindFirstFileA = (_FindFirstFileA)DetourCreate("kernel32.dll", "FindFirstFileA", &Detour_FindFirstFileA, DETOUR_TYPE_JMP); | |
case DLL_THREAD_ATTACH: | |
case DLL_THREAD_DETACH: | |
case DLL_PROCESS_DETACH: | |
break; | |
} | |
return TRUE; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment