Posted March 20, 200817 yr Does anyone have an asm example of how to use CreateToolhelp32Snapshot and ProcessFirst, ProcessNext etc? Please, thanks
March 20, 200817 yr .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
March 20, 200817 yr 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
March 21, 200817 yr Author Thanks much guys.I also found a nice example on winasm forum called EzProcess. Very nicely done small tool. Check it out. =)
Create an account or sign in to comment