because I trapped once more in this trap, I'd like to share my experiences :)

if I use a local structure, f.e.

sub esp, sizeof TBBUTTON
mov lpButton, esp

and it is not 4 byte aligned, then I get wired errors under NT.
Some functions or messages fail in some strange ways.

If I add this:

sub esp, sizeof TBBUTTON + 2
mov lpButton, esp

no problem.

Until now I found only a few structures in the windows API:

Had anybody else this problem? Some more known strctures?
In my assembler (WASM) I cannot use structures in the local
statement (f.e. LOCAL rcWindow:RECT) - is this possible with

Posted on 2001-08-02 04:06:23 by beaster

i'm using masm in windows 2000 , and i dont have any problems with local structures

like LOCAL rcWindow:RECT

Posted on 2001-08-02 04:38:00 by eko
Change difinition of the struct to:
iBitmap DWORD ?
idCommand DWORD ?
fsState BYTE ?
fsStyle BYTE ?
_wPad1 WORD ?
dwData DWORD ?
iString DWORD ?

MASM32 users don't know the problem 'cause they usally use
WINDOWS.INC supplied with the packege
It has corrected deffinition.
The Svin.
Posted on 2001-08-02 04:49:20 by The Svin
As you can see in the following masm listing

main proc c a1:dword,a2:dword
local bFlag:BYTE
mov bFlag,TRUE
Listing file:
00000000 main proc c a1:dword,a2:dword

local bFlag:BYTE

00000000 55 * push ebp
00000001 8B EC * mov ebp, esp
00000003 83 C4 FC * add esp, 0FFFFFFFCh
00000006 C6 45 FF 01 mov bFlag,TRUE

masm always does align esp to dword. bflag is located at . If you do explicitely "add esp,3", the program will fail.
Posted on 2001-08-02 06:27:10 by japheth
thanks a lot for the good answers.

Seems that WASM is here second-rate quality :)
I fixed my
Posted on 2001-08-02 07:55:40 by beaster