91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

魔獸寫屏代碼,具體見 http://blog.csdn.net/langyanduan/article/details/7337290

資源截圖

代碼片段和文件信息

#include?
#include?
#include?

#pragma?comment(lib?“detours.lib“)

//?globals
//?Our?hook?function
IDirect3D8*?__stdcall?hook_Direct3DCreate8(UINT?sdkVers);
HMODULE?WINAPI?LoadLibrary_Hook?(?LPCSTR?lpFileName?);
void?HookAPI();

//?CreateDevice
typedef?HRESULT?(APIENTRY?*CreateDevice_t)(
IDirect3D8*
UINTD3DDEVTYPE
HWNDDWORD
D3DPRESENT_PARAMETERS*
IDirect3DDevice8**);

CreateDevice_t?orig_CreateDevice;

HRESULT?APIENTRY?hook_CreateDevice(
IDirect3D8*?pInterface
UINT?Adapter
D3DDEVTYPE?DeviceType
HWND?hFocusWindow
DWORD?BehaviorFlags
D3DPRESENT_PARAMETERS*?pPresentationParameters
IDirect3DDevice8**?ppReturnedDeviceInterface);

//?The?original?to?call
typedef?IDirect3D8*?(__stdcall?*Direct3DCreate8_t)(UINT?SDKVersion);
Direct3DCreate8_t?orig_Direct3DCreate8;

//?Holds?address?that?we?get?in?our?LoadLibrary?hook?(used?for?detour)
PBYTE?pDirect3DCreate8;

typedef?HMODULE?(WINAPI?*LoadLibrary_t)(LPCSTR);
LoadLibrary_t?orig_LoadLibrary?=?LoadLibraryA;?//?holds?address?of?original?non-detoured?function


BOOL?APIENTRY?DllMain(?HMODULE?hModule?DWORD?ul_reason_for_call?LPVOID?lpReserved)
{
switch?(ul_reason_for_call)?{
case?DLL_PROCESS_ATTACH:
{
DisableThreadLibraryCalls(hModule);

DetourRestoreAfterWith();
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());

DetourAttach(&(PVOID&)orig_LoadLibrary?LoadLibrary_Hook);

DetourTransactionCommit();
}
}
return?TRUE;
}

//?Our?hooked?LoadLibrary
HMODULE?WINAPI?LoadLibrary_Hook?(?LPCSTR?lpFileName?)?
{
static?int?hooked?=?0;

HMODULE?hM?=?orig_LoadLibrary(?lpFileName?);
if?(?strcmp(?lpFileName?“d3d8.dll“?)?==?0)?
{
hooked++;

if?(hooked?==?3)?{
//?get?address?of?function?to?hook
pDirect3DCreate8?=?(PBYTE)GetProcAddress(hM?“Direct3DCreate8“);
HookAPI();
}
}

return?hM;
}

void?HookAPI()
{
//?simple?detour
orig_Direct3DCreate8?=?(Direct3DCreate8_t)pDirect3DCreate8;

DetourRestoreAfterWith();
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());

DetourAttach(&(PVOID&)orig_Direct3DCreate8?hook_Direct3DCreate8);

DetourTransactionCommit();

}

DWORD*?GetVtableAddress(void*?pobject)
{
//?The?first?4?bytes?of?the?object?is?a?pointer?to?the?vtable:
return?(DWORD*)*((DWORD*)pobject);
}

void?HookFunction(DWORD*?pVtable?void*?pHookProc?void*?pOldProc?int?iIndex)
{
//?Enable?writing?to?the?vtable?at?address?we?aquired
DWORD?lpflOldProtect;
VirtualProtect((void*)&pVtable[iIndex]?sizeof(DWORD)?PAGE_READWRITE?&lpflOldProtect);

//?Store?old?address
if?(pOldProc)?{
*(DWORD*)pOldProc?=?pVtable[iIndex];
}

//?Overwrite?original?address
pVtable[iIndex]?=?(DWORD)pHookProc;

//?Restore?protection
VirtualProtect(pVtable?sizeof(DWORD)?lpflOldProtect?&lpflOldProtect);
}

IDirect3D8*?__stdcall?hook_Direct3DCreate8(UINT?sdkVers)
{
IDirect3D8*?pD3d8?=?orig

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2012-03-09?16:12??Loader\
?????目錄???????????0??2012-03-09?16:12??Loader\dll\
?????文件????????4657??2012-03-06?14:10??Loader\dll\dll.vcxproj
?????文件?????????942??2012-03-03?00:58??Loader\dll\dll.vcxproj.filters
?????文件?????????143??2012-03-03?00:19??Loader\dll\dll.vcxproj.user
?????文件????????4039??2012-03-09?15:58??Loader\dll\main.cpp
?????目錄???????????0??2012-03-09?16:12??Loader\hooker\
?????文件????????4868??2012-03-06?14:10??Loader\hooker\hooker.vcxproj
?????文件?????????942??2012-03-06?12:05??Loader\hooker\hooker.vcxproj.filters
?????文件?????????143??2012-03-06?10:03??Loader\hooker\hooker.vcxproj.user
?????文件????????5621??2012-03-09?16:06??Loader\hooker\main.cpp
?????文件????????1268??2012-03-06?10:03??Loader\hooker\main.h
?????目錄???????????0??2012-03-09?16:12??Loader\Loader\
?????文件????????1790??2012-03-06?12:05??Loader\Loader.sln
?????文件???????15872??2012-03-09?16:11??Loader\Loader.suo
?????文件????????1184??2012-03-09?12:45??Loader\Loader\inject.cpp
?????文件?????????156??2012-03-09?12:44??Loader\Loader\inject.h
?????文件????????4025??2012-03-03?00:58??Loader\Loader\Loader.vcxproj
?????文件????????1151??2012-03-03?00:58??Loader\Loader\Loader.vcxproj.filters
?????文件?????????143??2012-03-03?00:08??Loader\Loader\Loader.vcxproj.user
?????文件????????1543??2012-03-09?13:31??Loader\Loader\main.cpp

評論

共有 條評論