flat assembler
Message board for the users of flat assembler.
Index
> Windows > Need help with CreateToolhelp32Snapshot |
Author |
|
wisepenguin 07 Apr 2008, 17:19
hello,
the struct macro does not need "." character in. have a good day |
|||
07 Apr 2008, 17:19 |
|
wisepenguin 07 Apr 2008, 17:19
ps.
Code:
struct PROCESSENTRY32
dwSize dd ?
cntUsage dd ?
th32ProcessID dd ?
th32DefaultHeapID dd ?
th32ModuleID dd ?
cntThreads dd ?
th32ParentProcessID dd ?
pcPriClassBase dd ?
dwFlags dd ?
szExeFile rb 260
ends
|
|||
07 Apr 2008, 17:19 |
|
CFJ0 07 Apr 2008, 17:28
Thanks
|
|||
07 Apr 2008, 17:28 |
|
DJ Mauretto 07 Apr 2008, 17:30
This compile fine
Code: format PE GUI 4.0 include '%inc%\win32ax.inc' struct PROCESSENTRY32 .dwSize dd ? .cntUsage dd ? .th32ProcessID dd ? .th32DefaultHeapID dd ? .th32ModuleID dd ? .cntThreads dd ? .th32ParentProcessID dd ? .pcPriClassBase dd ? .dwFlags dd ? .szExeFile rb 260 ends TH32CS_SNAPPROCESS = 0x2 ;------------------------------------------------ ;Declares ;------------------------------------------------ .data SnapHandle dd ? ProcessEntry PROCESSENTRY32 szProcessName db "explorer.exe", 0 .code Main: ;------------------------------------------------ ;Create Snapshot of Processes ;------------------------------------------------ mov dword [ProcessEntry..dwSize], sizeof.PROCESSENTRY32 invoke CreateToolhelp32Snapshot, TH32CS_SNAPPROCESS, 0 cmp eax, 0 je Exit mov dword [SnapHandle], eax invoke Process32First, dword [SnapHandle], ProcessEntry ;------------------------------------------------ ;Loop Through All Processes ;------------------------------------------------ NextProcess: cmp eax, 0 je Exit invoke lstrcmpi, ProcessEntry..szExeFile, szProcessName cmp eax, 0 je Found invoke Process32Next, dword [SnapHandle], ProcessEntry jmp NextProcess ;------------------------------------------------ ;Show a messagebox if found ;------------------------------------------------ Found: invoke MessageBox, 0, "Process Found!", szProcessName, MB_ICONQUESTION jmp Exit ;------------------------------------------------ ;Exit the loader when done ;------------------------------------------------ Exit: invoke ExitProcess, 0 .end Main |
|||
07 Apr 2008, 17:30 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.