The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ecube on March 05, 2008, 01:26:23 PM

Title: Data types for masm from c++
Post by: ecube on March 05, 2008, 01:26:23 PM
anyone know a good place I can find a list of data types from c++ to masm? for instance what wchar would be in masm?
Title: Re: Data types for masm from c++
Post by: ToutEnMasm on March 05, 2008, 04:32:55 PM

I am not sure to understand well what you need but see
http://www.masm32.com/board/index.php?topic=5428.msg40500#msg40500
All commons are translate in the zip files,see egales.txt
Title: Re: Data types for masm from c++
Post by: hutch-- on March 06, 2008, 12:28:09 AM
Cube,

WCHAR is a 2 byte character, a pointer to it is a 32 bit unsigned value like normal. Generally you allocate 2 bytes for each character in a unicode string (WCHAR) so if you have a 64 character long string INCLUDING the terminator you allocate 128 bytes to put it into.
Title: Re: Data types for masm from c++
Post by: thomas_remkus on March 06, 2008, 02:42:47 AM
I think of data less like types of data and more like the size that they occupy. So a DWORD is a DWORD. A CHAR is a BYTE and WCHAR is a WORD. A pointer of any kind is a DWORD in reality (32-bit protected mode). Other types that are like structs are basically the same thing here. You can create unions if you need.

Let's say you were looking for an RBG value. That's really just 4 BYTES which is really just a DWORD. You can reference it either way.
Title: Re: Data types for masm from c++
Post by: herge on March 06, 2008, 04:28:30 AM

Hi Hutch:

If you have 64 unicoide characters whuch is 128 bytes the terminating
Zero will Not be in the 128 byte buffer.
Title: Re: Data types for masm from c++
Post by: thomas_remkus on March 09, 2008, 10:40:58 PM
I'm not Hutch, but I believe that the null terminator of 128 BYTES in unicode will be in the 127th and 128th bytes (offset 126 and 127). You might check by 64 word offsets as well for the terminator.
Title: Re: Data types for masm from c++
Post by: hutch-- on March 10, 2008, 04:47:30 AM
 :bg

herge,

Quote
If you have 64 unicoide characters whuch is 128 bytes the terminating
Zero will Not be in the 128 byte buffer.

You did not read my posting properly.

Quote
so if you have a 64 character long string INCLUDING the terminator