I am having trouble finding documentation that is clear about the proper method of organizing/defining structures that are used in a x86 application and passed to a x64 kernel driver.
I am thinking if the struct has members of various byte sizes we need to account for unused bytes in the application with place holders when in the x86 application? The kernel would then have a different define of the struct without the place holders. My main concern is pointers. I do not think I can redefine them to work in x86 app and the x64 kernel.
How about an example and anyone can tell me if I am on the right track or if I need a redirect.
For the User side code in x86 compile
typedef struct EXAMPLE_STRUCT_32B
DWORD dwPlaceholder; //4 bytes in x86 and x64
PVOID phwHandle; //4 bytes in x86, 8 bytes in x64
DWORD dwAddress; //4 bytes in x86 and x64
WORD wFlag; //2 bytes in x86 and x64
WORD wLock; //2 bytes in x86 and x64
UINT64 unData; //8 bytes in x86 and x64
For kernel side in x64 compile
typedef struct EXAMPLE_STRUCT
PVOID phwHandle; //8 bytes in x64
DWORD dwAddress; //4 bytes in x64
WORD wFlag; //2 bytes in x64
WORD wLock; //2 bytes in x64
UINT64 unData; //8 bytes in x64
Another question: what is the proper way to order members? Is it large to small grouped in 8 byte boundaries if possible? Thanks for your help.