Fungus Posted March 20, 2008 Posted March 20, 2008 Does anyone have an asm example of how to use CreateToolhelp32Snapshot and ProcessFirst, ProcessNext etc? Please, thanks
diablo2oo2 Posted March 20, 2008 Posted March 20, 2008 .constPROCESS_HANDLE equ 0PROCESS_ID equ 1.codealign 16FindProcessByName proc uses ebx ecx edx esi edi _exename:dword,_returntype:dword LOCAL Process :PROCESSENTRY32 lea esi,Process assume esi:ptr PROCESSENTRY32 mov [esi].dwSize, sizeof PROCESSENTRY32 invoke CreateToolhelp32Snapshot,TH32CS_SNAPPROCESS,0 mov edi,eax invoke Process32First,edi,esi .while eax!=FALSE lea eax,[esi].szExeFile invoke lstrcmpi,eax,_exename .if eax==0 ;---found process--- mov eax,[esi].th32ProcessID jmp @return .endif invoke Process32Next,edi,esi .endw @return: assume esi:nothing push eax invoke CloseHandle,edi pop eax .if _returntype==PROCESS_HANDLE invoke OpenProcess,PROCESS_ALL_ACCESS,0,eax;return hProcess .endif retFindProcessByName endp
Nacho_dj Posted March 20, 2008 Posted March 20, 2008 Do you know pupe tool? It comes in a zip file with sources in asm, and of course that function appears there...Get it here:/>http://www.terra.es/personal/guillet/archivos/pupe2002.zipCheersNacho_dj
Fungus Posted March 21, 2008 Author Posted March 21, 2008 Thanks much guys.I also found a nice example on winasm forum called EzProcess. Very nicely done small tool. Check it out. =)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now