Delphi-PRAXiS
Seite 1 von 3  1 23      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   SetWindowsHookEx ... geht systemweit auch ohne DLL ... ? (https://www.delphipraxis.net/155084-setwindowshookex-geht-systemweit-auch-ohne-dll.html)

Daniel 7. Okt 2010 18:13

SetWindowsHookEx ... geht systemweit auch ohne DLL ... ?
 
Moin,

vielleicht kann mir das ja einer erklären: Ich habe in meiner Delphi-Anwendung einen systemweiten Hook für Tastatur und Maus installiert. Klappt wunderbar und ich bekomme mit, wenn in anderen Anwendungen geklickt wird und welche Tasten in anderen Anwendungen gedrückt werden. Und das sogar zum Beispiel im 64bit-Internet Explorer.

Warum lese ich dann aber an allen relevanten Stellen, man müsse seinen Code in eine DLL auslagern, damit dieser in fremde Prozesse injiziert werden könne. ähm ... :gruebel: ... warum klappt das bei mir? Ich habe nur eine kleine schnuckelige EXE und das war's.

Vielleicht kann mir ja einer sagen, was ich gerade übersehe oder welche Vorteile ich hätte, wenn ich den Code in EXE und DLL splitten würde.

Luckie 7. Okt 2010 18:18

AW: SetWindowsHookEx ... geht systemweit auch ohne DLL ... ?
 
Und du installierst in ganz normal mit SetWindowsHookEx?

Daniel 7. Okt 2010 18:25

AW: SetWindowsHookEx ... geht systemweit auch ohne DLL ... ?
 
Ja, ganz trivial:
Delphi-Quellcode:
FHook:= SetWindowsHookEx( WH_MOUSE_LL, @FRawNotifierProc, HInstance, 0 );

Luckie 7. Okt 2010 18:27

AW: SetWindowsHookEx ... geht systemweit auch ohne DLL ... ?
 
Unter welchen Betriebssystemen hast du das bisher getestet?

Daniel 7. Okt 2010 18:34

AW: SetWindowsHookEx ... geht systemweit auch ohne DLL ... ?
 
Windows 7 x64, Windows XP x86 - letzteres in einer VM

Sir Rufo 7. Okt 2010 18:36

AW: SetWindowsHookEx ... geht systemweit auch ohne DLL ... ?
 
Schieb doch mal die Source rüber, das würde mich auch interessieren :)

Daniel 7. Okt 2010 18:38

AW: SetWindowsHookEx ... geht systemweit auch ohne DLL ... ?
 
Ich schaue mal, ob ich es heute noch schaffe, eine Demo-Anwendung zu erstellen. Den ganzen Source kann ich schlecht veröffentlichen.

Sir Rufo 7. Okt 2010 18:39

AW: SetWindowsHookEx ... geht systemweit auch ohne DLL ... ?
 
Weltherrschaftübernahmecode :mrgreen:

Luckie 7. Okt 2010 18:40

AW: SetWindowsHookEx ... geht systemweit auch ohne DLL ... ?
 
http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx
WH_MOUSE_LL Global only
Zitat:

The global hooks are a shared resource, and installing one affects all applications in the same desktop as the calling thread. All global hook functions must be in libraries.
:gruebel:

Keine Ahnung, was du da machst.

rollstuhlfahrer 7. Okt 2010 18:45

AW: SetWindowsHookEx ... geht systemweit auch ohne DLL ... ?
 
Wenn MSDN aktuell ist, dann sollte diese Möglichlkeit gar nicht erst funktionieren.
Zitat:

Zitat von MSDN
You must place a global hook procedure in a DLL separate from the application installing the hook procedure. (aus MSDN - Using Hooks (Windows))

Scheinbar tappen da aber alle Entwickler scheinbar im Dunkeln (siehe z.B. hier). Ist das jetzt ein Bug oder ein Feature?

Bernhard


Alle Zeitangaben in WEZ +1. Es ist jetzt 04:31 Uhr.
Seite 1 von 3  1 23      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz