Jump to content

How can I combine bytes into array and...


Recommended Posts

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
Link to comment
Share on other sites

$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

Link to comment
Share on other sites

$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.

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...