News:

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

RAS structures problem

Started by sonic, September 08, 2007, 10:01:49 PM

Previous topic - Next topic

sonic

The structures needs to be DWORD aligned but seems the RAS structures defined in masm32 aren't dword aligned? I want to connect  through RASDial so first i tried to enumerate connections through RasEnumEntries but it fails as the sizeof RASENTRYNAME as defined in masm is 105h but works when i change it to 108h?

evlncrn8

RASENTRYNAMEA STRUCT
    dwSize dd ?
    szEntryName db RAS_MaxEntryName + 1 dup(?)
.ALIGN 4
RASENTRYNAMEA ENDS

is probably whats required...

microsoft state this....

typedef struct _RASENTRYNAME {
  DWORD  dwSize;
  TCHAR  szEntryName[RAS_MaxEntryName + 1];
#if (WINVER >= 0x500)
  DWORD dwFlags;
  TCHAR  szPhonebookPath[MAX_PATH + 1];
#endif
} RASENTRYNAME;

so i think alignment / padding is definately needed

GregL

When in doubt, one trick is to see what a C compiler does with it.

Visual C++ says sizeof(RASENTRYNAME) = 264 (108h) bytes.

So, it looks like you are right.   Although .ALIGN is not going to work.  :bg


evlncrn8

okay, without the . then :)

MYMINISTRUCT struct

   data   BYTE ?
   crap   DWORD ?
   bytex   BYTE 'x'
   align 4
   bytey   BYTE 'y'
   crap2   DWORD ?

MYMINISTRUCT ends

.data

db 'crap crap crap'

littlestruct                     MYMINISTRUCT <>

---------------- hex edit of file --------------

.00442280:  00 63 72 61-70 20 63 72-61 70 20 63-72 61 70 00   crap crap crap
.00442290:  00 00 00 00-78 00 00 79-00 00 00 00-70 69 64 5F      x  y    pid_

looks like it worked :), so with a little tweaking im sure its possible