Question: How to Hook DirectDrawCreateEx?

c++ / delphi package - dll injection and api hooking
Post Reply
amumy
Posts: 1
Joined: Sat Oct 30, 2004 5:51 pm

Question: How to Hook DirectDrawCreateEx?

Post by amumy »

Code: Select all

int (WINAPI *oDirectDrawCreateEx)( GUID FAR * lpGuid, LPVOID  *lplpDD, REFIID  iid,IUnknown FAR *pUnkOuter );
int WINAPI cDirectDrawCreateEx( GUID FAR * lpGuid, LPVOID  *lplpDD, REFIID  iid,IUnknown FAR *pUnkOuter )
{
	HRESULT hr = oDirectDrawCreateEx(lpGuid,lplpDD,iid,pUnkOuter);
	MessageBeep(-1);//[color=red]no sound???!!!![/color]
	return hr;
}
............

HookAPI("ddraw.dll","DirectDrawCreateEx",cDirectDrawCreateEx,(PVOID *)&oDirectDrawCreateEx);
.............

g_hhook = ::SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)KeyboardProc, theApp.m_hInstance, thid);
I want hooking DirectDrawCreateEx,SetCooperativeLevel and SetDisplayMode.Should how do?

My English is not good, pleasing everyone's understanding!!

Thanks!!!!!
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Check out the HookDirect3D demo in madCodeHook's "Demos" folder.
Post Reply