I need A pointer to a structure of type LINEINITIALIZEEXPARAMS for TAPI. I found it as a C++ version.(but don't knowC++) Here it is: typedef struct lineinitializeexparams_tag { DWORD dwTotalSize; DWORD dwNeededSize; DWORD dwUsedSize; DWORD dwOptions; union { HANDLE hEvent; HANDLE hCompletionPort; } Handles; DWORD dwCompletionKey; } LINEINITIALIZEEXPARAMS, FAR *LPLINEINITIALIZEEXPARAMS; Is this a correct translation: HANDLES STRUCT hEvent DWORD ? hCompletionPort DWORD ? HANDLES ENDS LINEINITIALIZEEXPARAMS STRUCT dwTotalSize DWORD ? dwNeededSize DWORD ? dwUsedSize DWORD ? dwOptions DWORD ? Handles HANDLES <> dwCompletionKey DWORD ? LINEINITIALIZEEXPARAMS ENDS so that I could declare LOCAL LP:LINEINITIALIZEEXPARAMS in my program?
Posted on 2001-01-11 13:01:00 by me
Almost :) Unions in C allow you to access the same area of memory as any of the types in the union e.g. UNION { char a byte b } myunion; myunion.b = 65 //the ASCII value of 'A' then this means: (myunion.a == 'A') evaluates to true But ASM only has the most basic type definitions it is not important! Just remember that its your responsibility to deal with it! LINEINITIALIZEEXPARAMS STRUCT dwTotalSize DWORD ? dwNeededSize DWORD ? dwUsedSize DWORD ? dwOptions DWORD ? Handles DWORD ? ;was HANDLES <> dwCompletionKey DWORD ? LINEINITIALIZEEXPARAMS ENDS In your struct the variables in Handles occupied separate memory! Hope this clears things up (I'm not a very good at explaining things) Mirno
Posted on 2001-01-11 13:28:00 by Mirno
Thanks Mirno it does.
Posted on 2001-01-12 11:11:00 by me
MASM does too support UNIONS. How else can it build all that C code? ;-D Try this (ignore the dots, they are there to preserve "whitespace"): LINEINITIALIZEEXPARAMS STRUCT 2t ....dwTotalSize..............DWORD ? ....dwNeededSize..........DWORD ? ....dwUsedSize..............DWORD ? ....dwOptions................DWORD ? ....UNION ........hEvent...................DWORD ? ........hCompletionPort....DWORD ? ....ENDS ....dwCompletionKey.....DWORD ? LINEINITIALIZEEXPARAMS ENDS (now the 'dotless' version) LINEINITIALIZEEXPARAMS STRUCT 2t dwTotalSize DWORD ? dwNeededSize DWORD ? dwUsedSize DWORD ? dwOptions DWORD ? UNION hEvent DWORD ? hCompletionPort DWORD ? ENDS dwCompletionKey DWORD ? LINEINITIALIZEEXPARAMS ENDS
Posted on 2001-01-13 16:50:00 by Ernie