News:

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

C to ASM

Started by dacid, September 05, 2008, 04:42:33 PM

Previous topic - Next topic

dacid

PSOMESTRUCT *AnyName = NULL;

Thx in advance.

Adamanteus

This is deal of your style, but by agreements of assembler syntax it could be so :

NULL        EQU                0
AnyName  PSOMESTRUCT  NULL

But for it is need ever to have special type, so possible it simplify by macros :

NULL     EQU           0
PC        TEXTEQU   <DD> ; определяет указатель на код
PD        TEXTEQU   <DD> ; определяет указатель на данные
AnyName  PD  NULL


dacid

PSOMESTRUCT *AnyName = NULL;

PSOMESTRUCT typedef ptr SOMESTRUCT

SOMESTRUCT STRUCT
..
value1 DWORD ?
value2 LPBYTE ?
....
value5 LPSTR ?
..
SOMESTRUCT ENDS

donkey

A simple way...

SOMESTRUCT STRUCT
..
value1 DWORD ?
value2 LPBYTE ?
....
value5 LPSTR ?
..
SOMESTRUCT ENDS

.data?
somestruct SOMESTRUCT <?>

.data
psomestruct dd offset somestruct


Type definitions in assembly language are not quite parallel with those in C, in reality the only real typedefs that exist are the width of the object in bytes (ie BYTE/WORD/DWORD/QWORD etc...) all others are simply equated to these in Windows.inc. Since parameter checking in MASM will only check the width of the parameter it makes little difference to do C typedefs other than those that deal specifically with width.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable