News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Recent posts

#51
The Campus / Re: process32first/next proble...
Last post by dedndave - May 22, 2012, 05:30:31 PM
that works - in the ANSI form

i added a structure definition for the UNICODE version

it works also...
#52
The Campus / Re: Terminate Process
Last post by dedndave - May 22, 2012, 05:19:48 PM
yes - for unicode, szExeFile should be defined with WCHAR's - not bytes
so - the structure size would be 556 bytes
#53
The Campus / Re: process32first/next proble...
Last post by xandaz - May 22, 2012, 05:17:19 PM
    I already made the changes for process32first/next but still doesn't enumerate. Only does so when i make that change in PROCESSENTRY32. The szExeFile from DB to DW. Can you garantee it works for you?
#54
The Campus / Re: process32first/next proble...
Last post by dedndave - May 22, 2012, 05:08:42 PM
while you're at it, the same problem exists in 2 include\lib pairs; kernel32 and kernl32p
and 4 functions; Module32First, Module32Next, Process32First, Process32Next
for a total of 8 fixes   :bg
#55
The Campus / Re: process32first/next proble...
Last post by dedndave - May 22, 2012, 05:06:16 PM
then - you probably want to look through the thread that Force linked and use Erol's tools to rebuild the lib
#56
The Campus / Re: process32first/next proble...
Last post by xandaz - May 22, 2012, 05:04:25 PM
 [TYPO]....thinking Masm had miscalculated...
#57
The Campus / Re: process32first/next proble...
Last post by xandaz - May 22, 2012, 05:03:49 PM
   i know dave.... i forgot to clear that when i submitted the file. I was just counting size by myself thinking had miscalculated it. Wrong count tho.
#58
The Campus / Re: process32first/next proble...
Last post by dedndave - May 22, 2012, 04:53:53 PM
i don't think that's his problem - at least not his only one (he could have the prototype/lib issue, as well)

his problem is related to the size of the PROCESSENTRY32 structure, which has not changed from v10 to v11
so - i don't know why one works and one doesn't - if that is the case

but - i do know that this is wrong...
process32       PROCESSENTRY32      <36+256,<>>
the correct size of the structure is 296 bytes - not 292 bytes
the reason for this is that MAX_PATH is 260 - not 256

in any event, i would not hard-wire the size of the structure with a numeric expression
if you want to do it, do it with the SIZEOF directive
process32       PROCESSENTRY32      <sizeof PROCESSENTRY32,<>>

i wouldn't do it that way, either   :bg

the size of the structure is 296 bytes
if you define it in the .DATA section, it adds 296 bytes (or more) to the size of the EXE

however, if you define it in the .DATA? section, and fill in the size with code, the EXE will be at least 287 bytes smaller
(assuming it takes ~9 bytes to fill in the structure size with code)
        .DATA?

process32       PROCESSENTRY32      <>

        .CODE

        mov     process32.dwSize,sizeof PROCESSENTRY32


in fact, i would use register base-index addressing because you can use the register twice, like so...
        invoke  CreateToolhelp32Snapshot,TH32CS_SNAPPROCESS+TH32CS_SNAPMODULE,0
        mov     hSnap,eax
        mov     edx,offset process32
        mov     [edx].PROCESSENTRY32.dwSize,sizeof PROCESSENTRY32
        invoke  Process32First,eax,edx

as it happens, the index is for the first member is 0, so it's really register base addressing   :bg
#59
The Campus / Re: Terminate Process
Last post by xandaz - May 22, 2012, 04:36:32 PM
   There seems to be yet another problem.
PROCESSENTRY32 STRUCT
    dwSize              DWORD ?
    cntUsage            DWORD ?
    th32ProcessID       DWORD ?
    th32DefaultHeapID   DWORD ?
    th32ModuleID        DWORD ?
    cntThreads          DWORD ?
    th32ParentProcessID DWORD ?
    pcPriClassBase      DWORD ?
    dwFlags             DWORD ?
    szExeFile           db MAX_PATH dup(?)
PROCESSENTRY32 ENDS


doesnt seem to work with unicode.
szExeFile dw MAX_PATH dup(?)...works tho.
    I don't know if everyone has this problem with their masm sdk...Thanks and later
#60
The Campus / Re: process32first/next proble...
Last post by Force - May 22, 2012, 04:08:01 PM
Hi
xandaz

We talked about Process32  problem earlier
http://www.masm32.com/board/index.php?topic=18850.0