Hi akyprian,
First of all i would like to thank you for your good work. WinAsm is - indeed - a very good IDE.

Within your Version 3.0.0.1 it should be possible to display structure members by pressing ".", but it seems not to work correctly:

-> If i use the structurename (e.g. PROCESSENTRY32) and press ".", it works.


PROCESSENTRY32. -> the memberlist appears (but that's not the goal)


-> These examples didn't work:


.data?
myProcess PROCESSENTRY32 <>
...
.code
...
lea esi, myProcess
assume esi:ptr PROCESSENTRY32
mov [esi]. -> nothing appears

OR

mov eax, myProcess. -> nothing appears


During coding, i found some constants etc. that where missing. Here are the "updates"

FILE: MasmApiConst.vaa (INSERT)

dwFreeType'=MEM_DECOMMIT,MEM_RELEASE

dwFlags''=TH32CS_INHERIT,TH32CS_SNAPALL,TH32CS_SNAPHEAPLIST,TH32CS_SNAPMODULE,TH32CS_SNAPPROCESS,TH32CS_SNAPTHREAD

flAllocationType'=MEM_COMMIT,MEM_RESERVE,MEM_RESET,MEM_TOP_DOWN

flProtect'=PAGE_READONLY,PAGE_READWRITE,PAGE_EXECUTE,PAGE_EXECUTE_READ,PAGE_EXECUTE_READWRITE,PAGE_GUARD,PAGE_NOACCESS,PAGE_NOCACHE

flNewProtect'=PAGE_READONLY,PAGE_READWRITE,PAGE_EXECUTE,PAGE_EXECUTE_READ,PAGE_EXECUTE_READWRITE,PAGE_GUARD,PAGE_NOACCESS,PAGE_NOCACHE


FILE: MasmApiCall.vaa (CHANGE)

OLD: CreateToolhelp32Snapshot,dwFlags,th32ProcessID
NEW: CreateToolhelp32Snapshot,dwFlags'',th32ProcessID

OLD: VirtualAlloc,lpAddress,dwSize,flAllocationType,flProtect
NEW: VirtualAlloc,lpAddress,dwSize,flAllocationType',flProtect'

OLD: VirtualAllocEx,hProcess,lpAddress,dwSize,flAllocationType,flProtect
NEW: VirtualAllocEx,hProcess,lpAddress,dwSize,flAllocationType',flProtect'

OLD: VirtualFree,lpAddress,dwSize,dwFreeType
NEW: VirtualFree,lpAddress,dwSize,dwFreeType'

OLD: VirtualFreeEx,hProcess,lpAddress,dwSize,dwFreeType
NEW: VirtualFreeEx,hProcess,lpAddress,dwSize,dwFreeType'

OLD: VirtualProtect,lpAddress,dwSize,flNewProtect,lpflOldProtect
NEW: VirtualProtect,lpAddress,dwSize,flNewProtect',lpflOldProtect

OLD: VirtualProtectEx,hProcess,lpAddress,dwSize,flNewProtect,lpflOldProtect
NEW: VirtualProtectEx,hProcess,lpAddress,dwSize,flNewProtect',lpflOldProtect


FILE: MasmApiStruct.vaa (INSERT)

HICON ; in the end of this file

As told already in masmforum, the ThreadEnvironmentBlock has the wrong size in windows.inc. The correct size is 34h (NT AND 9X!) Here are the correct structures (for implementation in windows.inc):


;-----------------------------------------------------------------------------
;-- Thread Environment Block (TEB aka TIB)
;-- OS: Windows NT/2K/XP/2K3
;-----------------------------------------------------------------------------
NT_THREADENVIRONMENTBLOCK struct ; size = 34h
ExceptionList DWORD ? ; 00h end of SEH chain
StackBase DWORD ? ; 04h
StackLimit DWORD ? ; 08h
SubSystemTIB DWORD ? ; 0Ch
FiberData DWORD ? ; 10h
ArbitraryUser DWORD ? ; 14h
pSelf DWORD ? ; 18h pointer to TEB (7FFDE000h)
pEnvironmentPtr DWORD ? ; 1Ch
ProcessID DWORD ? ; 20h (see Taskmanager!)
ThreadID DWORD ? ; 24h
pRPCHandle DWORD ? ; 28h
TLSStorage DWORD ? ; 2Ch
PEBAddress DWORD ? ; 30h pointer to PEB (7FFDF000h)
NT_THREADENVIRONMENTBLOCK ends

;-----------------------------------------------------------------------------
;-- Thread Environment Block (TEB aka TIB)
;-- OS: Windows 95/98/98SE/ME
;-----------------------------------------------------------------------------
WX_THREADINFORMATIONBLOCK struct ; size = 34h
ExceptionList DWORD ? ; 00h end of SEH chain
StackBase DWORD ? ; 04h
StackLimit DWORD ? ; 08h max stack value
pTDB WORD ? ; 0Ch
pThunkSS WORD ? ; 0Eh
Unknown DWORD ? ; 10h
ArbitraryUser DWORD ? ; 14h
pSelf DWORD ? ; 18h pointer to TIB
TIBFlags WORD ? ; 1Ch
Win16MutexCount WORD ? ; 1Eh
DebugContext DWORD ? ; 20h
pCurrentPriority DWORD ? ; 24h
pQueue DWORD ? ; 28h
TLSStorage DWORD ? ; 2Ch
pProcess DWORD ? ; 30h pointer to process database
WX_THREADINFORMATIONBLOCK ends


To use this structures in WinASM;
FILE: MasmApiStruct.vaa (INSERT)

NT_THREADENVIRONMENTBLOCK,ExceptionList,StackBase,StackLimit,SubSystemTIB,FiberData,ArbitraryUser,pSelf,pEnvironmentPtr,ProcessID,ThreadIS,pRPCHandle,TLSStorage,PEBAddress

WX_THREADENVIRONMENTBLOCK,ExceptionList,StackBase,StackLimit,pTDB,pThunkSS,Unknown,ArbitraryUser,pSelf,TIBFlags,Win16MutexCount,DebugContext,pCurrentPriority,pQueue,TLSStorage,pProcess

Regards, Pegasus
Posted on 2004-02-04 09:40:01 by cu.Pegasus
Hi cu.Pegasus,


First of all i would like to thank you for your good work. WinAsm is - indeed - a very good IDE.

Thanks for your good words. With constructive feedback it can only get better


Within your Version 3.0.0.1 it should be possible to display structure members by pressing ".", but it seems not to work correctly:

It does work as intended to do. There are some cases (like the ones you mention below) that I haven't considered YET.


-> If i use the structurename (e.g. PROCESSENTRY32) and press ".", it works.


PROCESSENTRY32. -> the memberlist appears (but that's not the goal)


It is one of the goals. Why not?


-> These examples didn't work:


.data?
myProcess PROCESSENTRY32 <>
...
.code
...
lea esi, myProcess
assume esi:ptr PROCESSENTRY32
mov [esi]. -> nothing appears

OR

mov eax, myProcess. -> nothing appears


As already said these two cases are not bugs. I haven't implemented them yet. Will take care of them soon. Thanks very much. Just a small note(just in case you didn't know): If myProcess is a local (and not a global ), your second example works.

I also want to thank you very much for the update suggestions of MasmApiConst.vaa, MasmApiCall.vaa and MasmApiStruct.vaa

This is a very useful kind of feedback,

akyprian
Posted on 2004-02-04 15:17:49 by akyprian