Jump to content
Sign in to follow this  
bittware

How can I combine bytes into array and...

Recommended Posts

bittware

Hello experts,

I want to combine several BYTEs(e.g. 0x55) and WORDs(e.g. 0xAAAA) into single data array and assign it to following function parameter $data_array

$re_stat = DllCall($hDll, "int:cdecl", "sub_sdio_transfer", "ptr", $hSubHandle, "byte*", $data_array, "byte*", 0, "int", 3, "int", 0, "int", $SS_CONF)

How can I achieve this?

Thanks in advance!

BRs,

bittware

Edited by bittware

Share this post


Link to post
Share on other sites
trancexx

$tDataArray = DllStructCreate("align 1;byte SomeBytes[4];" & _
        "word SomeUnsigned;" & _
        "short SignedValue;" & _
        "dword DwordValue;" & _
        "byte MoreBytes[3];")

$pDataArray = DllStructGetPtr($tDataArray)

DllCall($hDll, "int:cdecl", "sub_sdio_transfer", "ptr", ..., "ptr", $pDataArray, ...)

I added align primarily to confuse you further.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
bittware

$tDataArray = DllStructCreate("align 1;byte SomeBytes[4];" & _
        "word SomeUnsigned;" & _
        "short SignedValue;" & _
        "dword DwordValue;" & _
        "byte MoreBytes[3];")

$pDataArray = DllStructGetPtr($tDataArray)

DllCall($hDll, "int:cdecl", "sub_sdio_transfer", "ptr", ..., "ptr", $pDataArray, ...)

I added align primarily to confuse you further.

You are awesome!

Must take my hat off.

Share this post


Link to post
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
Sign in to follow this  

×