first let me thank you for your great package madshi :=)
i got a little problem.. im trying to make a program which can send keyboard input to the game DAoC, but the hook doesnt work since the game is running inside a dll (at least i think thats the reason, since it works fine on a few demo apps).
if you look at the code below.. none of the 2 msg boxes pop up so i think the problem starts here..
do i have to use any other api hooking method instead of madshi's to be able to hook in dlls?
if thats the case which one would be recommended?
some code examples would be nice
Code: Select all
var
DirectInputCreateANext : function (hinst: THandle;
dwVersion: DWORD;
out ppDI: IDirectInputA;
punkOuter: IUnknown): HResult; stdcall;
function DirectInputCreateACallback (hinst: THandle;
dwVersion: DWORD;
out ppDI: IDirectInputA;
punkOuter: IUnknown): HResult; stdcall;
begin
Result := DirectInputCreateANext(hinst, dwVersion, ppDI, punkOuter);
showmessage('ok');
if (Result = 0) and (@CreateDeviceNext = nil) then begin
if HookCode(GetInterfaceMethod(ppDI, 3), @CreateDeviceCallback, @CreateDeviceNext) = false then showmessage('cant hook2');
end;
end;
begin
if HookAPI('DINPUT.dll', 'DirectInputCreateA', @DirectInputCreateACallback, @DirectInputCreateANext) = false then showmessage('cant hook1');
end.
update:
i also wrote a wrapper dll now which exports DirectInputCreateA DirectInputCreateW DirectInputCreateEX
Code: Select all
begin
@p1 := GetProcAddress(loadlibrary('dinpu.dll'), 'DirectInputCreateA');
result := p1(hinst, dwVersion, ppDI, punkOuter);
if (Result = 0) and (@CreateDeviceNext = nil) then begin
if HookCode(GetInterfaceMethod(ppDI, 3), @CreateDeviceCallback, @CreateDeviceNext) = false then showmessage('cant hook2') else showmessage('kk');
end;
end;
exports DirectInputCreateA;
any ideas what im doing wrong?