Jump to content

Union support For DllStruct


Recommended Posts

how about support for unions so that we could easly make structs like this:

typedef union _TYPEX_HEADER
{
    TYPE0_HEADER Type0Hdr;  
    TYPE1_HEADER Type1Hdr;  
    TYPE2_HEADER Type2Hdr;  
    ULONG vulConfig[64];    

}TYPEX_HEADER, *PTYPEX_HEADER;
Link to comment
Share on other sites

You make e.g. raw structure in required size:

$tUNION_Raw = DllStructCreate("byte[4]")

Then depending on your needs interpret data the way you like it:

$tUNION_Dword = DllStructCreate("dword", DllStructGetPtr($tUNION_Raw))
$iDWORD = DllStructGetData($tUNION_Dword, 1)
$tUNION_Int = DllStructCreate("int", DllStructGetPtr($tUNION_Raw))
$iINT = DllStructGetData($tUNION_Int, 1)
$tUNION_Float = DllStructCreate("float", DllStructGetPtr($tUNION_Raw))
$nFLOAT = DllStructGetData($tUNION_Float, 1)

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...