invoke CreateToolhelp32Snapshot, TH32CS_SNAPPROCESS, NULL
mov hShot, eax
invoke Process32First, hShot, [pe]


error A2134: structure too large to pass with INVOKE : argument : 2

sorry for all the dumb/newbie questions recently. i know people get annoyed with them

anyways, why this error? i tried to CALL it, but same err.

thanks for the time
Posted on 2001-11-16 18:38:05 by lackluster
you'll want offset/addr pe, not
Posted on 2001-11-16 19:08:02 by f0dder
Actually, that was the first thing I tried but :

error A2114: INVOKE argument type mismatch : argument : 2

came out. i thought the second error using the [] was better than type mismatch.
Posted on 2001-11-17 02:05:19 by lackluster

You might forgot :

mov eax,SIZEOF PE
mov PE.dwSize,eax

invoke Process32First, hShot, addr PE

Posted on 2001-11-17 03:00:53 by Axial
Look at the attached exemple if you have any pbs
Posted on 2001-11-17 03:21:09 by Axial
Axial, why don't you set PE.dwSize directly?

mov [PE.dwSize], sizeof PE

Also, your code doesn't look too different from the line lackluster

lackluster, my guess is you do something wrong somewhere else -
post the entire code piece you're trying to get working.
Posted on 2001-11-17 08:15:34 by f0dder
I made this quick program just to get these concepts down, so don't be suprised to find sloppy coding. Eventually it will become part of a larger program.

invoke CreateToolhelp32Snapshot, TH32CS_SNAPPROCESS, NULL
mov hShot, eax
mov eax, SIZEOF pe
mov pe.dwSize, eax ; <-- tried doing directly, no help
invoke Process32First, hShot, addr pe

This is the entire chunk that is giving errors. It's actually on the WM_INITDIALOG message, if that matters. Uh...also I didn't find any protos for these APIs, so I defined them as:

CreateToolhelp32Snapshot proto :DWORD, :DWORD
Process32First proto :HANDLE, :PROCESSENTRY32

Thanks for the help.
Posted on 2001-11-17 10:04:21 by lackluster

Process32First proto :HANDLE, :PROCESSENTRY32

There you have your problem! If MASM does what I think it does,
and it probably does :), it will try pushing an entire struct when
you give it a struct parm. Declare both parms as :DWORD and you
should be fine (and perhaps look at th32.inc...). Btw, on my win2k,
the toolhelp functions are defined in kernel32.dll, and the platformsdk
libs also have process32first (and friends) in kernel32.lib.

I'm still puzzled why you can't set the struct size directly.
Posted on 2001-11-17 10:09:41 by f0dder

AH! The whole time all I needed was to include th32.inc. But at least now I know about invoke & structs. The struct size can be set directly, I just tried it one way then another, it works both ways. I feel stupid now, I should've just asked where these functions were defined.

Anyways, much thanks.

Posted on 2001-11-17 10:21:38 by lackluster