Schönen Sonntag zusammen,
ich habe ein kleines Problem mit Windows 7 x64: Und zwar habe ich mal eine kleine DLL gefunden, mit der man Maus-und Tastatureingaben hooken kann. Das benötige ich, um ein System kurzeitige zu blockieren, um in der Firma Programmupdates durchzuführen (dass keiner dazwischen funkt). Unter Windowx 7 x86 hat das wunderbar funktioniert, seit x64 nicht mehr.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45:
| library Blocker;
uses WinTypes, WinProcs, Messages, Dialogs, SysUtils;
var HookHandle, MouseHandle: HHOOK;
function KeyHook(Code: integer; WParam: word; lParam: Longint): Longint; stdcall; begin Result:= CallNextHookEx(HookHandle, Code, 0, 0); end;
function MouseHook(Code: integer; WParam: word; lParam: Longint): Longint; stdcall; begin Result:= CallNextHookEx(MouseHandle, Code, 0, 0); end;
procedure SetKeyHook; export; begin HookHandle:=SetWindowsHookEx(WH_KEYBOARD, @KeyHook, hInstance, 0); MouseHandle:=SetWindowsHookEx(WH_MOUSE, @MouseHook, hInstance, 0); end;
procedure DelKeyHook; export; begin if HookHandle <> 0 then UnhookWindowsHookEx(HookHandle); HookHandle:=0; if MouseHandle <> 0 then UnhookWindowsHookEx(MouseHandle); MouseHandle:=0; HookHandle:=0; end;
exports SetKeyHook name 'SetKeyHook', DelKeyHook name 'DelKeyHook';
begin end. |
In den Funktionen KeyHook und MausHook fange ich die Eingabe einfach ab und sende eine "leere Nachricht" weiter. Das sniffen würde funktionieren, brauche ich aber nicht.
Hat jemand eine Idee, woran das liegt?
Viele Grüße
Littleben