Jump to content

Recommended Posts

Posted (edited)

EDIT: Wow, I just realized the struct I created was char instead of byte. Problem solved.

I have a DLL function that accepts a file as a binary char*. I can't seem to get it to show up correctly from the DLL's point of view..

Basically what this should do is read captcha.jpg as a binary and send it as a parameter, but what happens is the DLL receives it as a hex string. It literally outputs "0xFFEA028 ..." etc.

Here is the DLL function:

int WINAPI CCprotoPicture( int id, char *pict, int pict_size, char* text)

Here is my code:

Local $pictureFile = FileOpen("captcha.jpg", 16)
    Local $pictureBin = FileRead($pictureFile)
    Local $pictureSize = FileGetSize("captcha.jpg")
    Local $pictureStruct = DllStructCreate("char picture[" & $pictureSize & "]")
    Local $solutionStruct = DllStructCreate("char solution[255]")

    DllStructSetData($pictureStruct, "picture", $pictureBin)

    $r = DllCall($dll, "int", "CCprotoPicture", "int", $DLL_ID, "ptr", DllStructGetPtr($pictureStruct, "picture"), "int", $pictureSize, "ptr", DllStructGetPtr($solutionStruct, "solution"))

Am I missing something? Is there some way to convert AutoIt binary into a format this DLL can understand?

Edited by ryeguy
Posted

EDIT: Wow, I just realized the struct I created was char instead of byte. Problem solved.

I have a DLL function that accepts a file as a binary char*. I can't seem to get it to show up correctly from the DLL's point of view..

Basically what this should do is read captcha.jpg as a binary and send it as a parameter, but what happens is the DLL receives it as a hex string. It literally outputs "0xFFEA028 ..." etc.

Here is the DLL function:

int WINAPI CCprotoPicture( int id, char *pict, int pict_size, char* text)

Here is my code:

Local $pictureFile = FileOpen("captcha.jpg", 16)
    Local $pictureBin = FileRead($pictureFile)
    Local $pictureSize = FileGetSize("captcha.jpg")
    Local $pictureStruct = DllStructCreate("char picture[" & $pictureSize & "]")
    Local $solutionStruct = DllStructCreate("char solution[255]")

    DllStructSetData($pictureStruct, "picture", $pictureBin)

    $r = DllCall($dll, "int", "CCprotoPicture", "int", $DLL_ID, "ptr", DllStructGetPtr($pictureStruct, "picture"), "int", $pictureSize, "ptr", DllStructGetPtr($solutionStruct, "solution"))

Am I missing something? Is there some way to convert AutoIt binary into a format this DLL can understand?

$dll - what this?

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
  • Recently Browsing   0 members

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