Hook running programm..

Wohl das A & O in der Windows-Programmierung

Moderatoren: crack, Marwin, Krüsty

Alter Hase
Beiträge: 80
Registriert: Samstag 2. August 2003, 11:13

Beitrag von Ignat » Samstag 6. Dezember 2003, 23:14

Hi, everybody!
I need help!
How to make such system-hook: when you start some programm you make something operations..
I mean I want to hook event, when programm starts, and, for example, try to forbid running this programm.
Hm.. May be you know another way to forbid running some applications. The application may not have registry settings - just .EXE. I want to forbid running some EXE-files from my own programm..
Can you help me?
If the ship don't know where to go - it has no fair wind...

Alter Hase
Beiträge: 62
Registriert: Donnerstag 2. Oktober 2003, 17:17

Beitrag von CDW » Sonntag 7. Dezember 2003, 17:49

hm, here is some code to take a snapshot of all runnig progs:

Code: Alles auswählen

 invoke	CreateToolhelp32Snapshot, TH32CS_SNAPPROCESS, 0	
  mov hSnapshot,eax
  .if eax!=-1 
  	mov uProcess.dwSize, sizeof uProcess
  	invoke	Process32First, eax, ADDR uProcess
  	.while eax
    lea edi,[uProcess.szExeFile]
    invoke SendDlgItemMessage,hWin,ID_PROGRAM_LIST,LB_ADDSTRING,0,edi
    invoke SendDlgItemMessage,hWin,ID_PROGRAM_LIST,LB_SETITEMDATA,eax,uProcess.th32ProcessID
    invoke	Process32Next, [hSnapshot], ADDR uProcess    
i think you can search for names too (at the moment i dont have any WINAPI-References)
see msdn specially CreateToolhelp32Snapshot
PS: you can make a timer-procedure or thread so you check all 0.5-1 seconds for the "false" program