Einzelnen Beitrag anzeigen

Assarbad
(Gast)

n/a Beiträge
 
#4

Re: bei neuem prozess ereignis aufrufen

  Alt 20. Aug 2003, 22:29
Hiho, das ist etwas zu aufwendig (wie gesagt, mit Treiber um die Native APIs zu hooken - also nix mit Delphi). Such mal folgendes:
Bei Google suchenDetours
Bei Google suchenAPI Hook EliCZ

EliCZ' Beispiel könnte u.U. systemweit funktionieren. Ich weiß es aber nicht und befürchte, daß dem nicht so ist. Suche mal im Inet nach Bei Google suchenNT process notification o.ä.

Hier ein Beispiel, welches ich gefunden habe:
http://www.codeproject.com/threads/procmon.asp
(Funktioniert nur mit Treiber!
The control application register the kernel mode driver under HKLM\SYSTEM\CurrentControlSet\Services and dynamically loads it. The kernel driver then creates a named event object that is used to signal the user-mode application when new event has been fired (i.e. process starts or ends up). The control application opens the same event object and creates a listening thread that waits on this event. Next, the user mode application sends a request to the driver to start monitoring. The driver invokes PsSetCreateProcessNotifyRoutine(), which accepts two parameters. One of them specifies the entry point of a caller-supplied callback routine, responsible for receiving all notifications from Windows. Upon a notification, that takes place in the callback, the driver signals that event in order to inform the user-mode application that something has happened. The control application then gets the data for that particular event from the driver and stores it in a special queue container for further processing. If there is no need for detecting process execution anymore the user mode application sends a request to the driver to stop monitoring. The driver then deactivates the observing mechanism. Later the control mode application can unload the driver and un-register it.)

Und da ist auch der Name der API die ich nicht mehr gefunden habe:
Bei Google suchenPsSetCreateProcessNotifyRoutine

Das Problem dieser API ist, daß es eine Kernel Mode API ist (in NTOSKRNL.EXE implementiert - es muß also ein Treiber zur Kommunikation mit deinem Programm existieren. Du kannst allerdings den Treiber aus obiger Quelle mißbrauchen

IN ALLEN FÄLLEN wird es nur mit Administrator-Privs funktionieren. Außer SYSTEM und Administratoren darf kein Benutzerkontext Treiber installieren. Oder schleich dich durch ein Loch wie MSBlast ein

Nachtrag: Wenn schon Treiber, dann würde ich logischerweise auch die bereits bekannte API mißbrauchen, anstatt mit API-Hooking zu spielen.
Systemweites Hooking von APIs wird im Buch "Undocumented Windows 2000 Secrets - A Programmer's Cookbook" von Sven B. Schreiber sehr gut beschrieben. Auf der CD gibt es auch Beispiele (mit C-Source).
  Mit Zitat antworten Zitat