Created
July 5, 2014 17:33
-
-
Save ntddk/cbcf704b4e3262e2d937 to your computer and use it in GitHub Desktop.
昔のAPI hook
This file contains hidden or 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
// dllmain.cpp : Defines the entry point for the DLL application. | |
#include "stdafx.h" | |
#include <detours.h> | |
DETOUR_TRAMPOLINE(DWORD WINAPI RealGT(LPTIME_ZONE_INFORMATION lpTimeZone), GetTimeZoneInformation); | |
DETOUR_TRAMPOLINE(void WINAPI RealSysTime(LPSYSTEMTIME time), GetSystemTime); | |
DWORD WINAPI DetourGTZI(LPTIME_ZONE_INFORMATION lpTimeZone) | |
{ | |
DWORD ret = RealGT(lpTimeZone); | |
lpTimeZone->Bias = -480; | |
return ret; | |
} | |
void WINAPI DetourSysTime(LPSYSTEMTIME time) | |
{ | |
RealSysTime(time); | |
time->wDay = 14; | |
time->wDayOfWeek = 3; | |
time->wYear = 2012; | |
time->wMonth = 11; | |
} | |
__declspec(dllexport) BOOL APIENTRY DllMain( HMODULE hModule, | |
DWORD ul_reason_for_call, | |
LPVOID lpReserved | |
) | |
{ | |
DetourFunctionWithTrampoline((PBYTE)RealGT, (PBYTE)DetourGTZI); | |
DetourFunctionWithTrampoline((PBYTE)RealSysTime, (PBYTE)DetourSysTime); | |
return true; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment