Jump to content

Recommended Posts

I'm trying to work with the md5 functions in the crypto api, however, I cannot create a DLL struct that I need.

typedef struct {

ULONG i[2];

ULONG buf[4];

unsigned char in[64];

unsigned char digest[16];

} MD5_CTX;

What I have now is the following, however, it does not recognize the long datatype (though its listed on the DLLCall info page)

$Struct = DLLStructCreate("long[2];long[4];ubyte[64];ubyte[16]")
  if @error Then
      MsgBox(0,"","Error in DllStructCreate " & @error)

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to post
Share on other sites

That gets me some kind of return...but I guess I still need a little work with DLL calls and structs, as I'm not getting the return values expected

$hDLL = DLLOpen('Cryptdll.dll')
$Struct = DLLStructCreate("uint[2];uint[4];ubyte[64];ubyte[16]")
$Buffer = DLLStructCreate("char")
DLLStructSetData($Buffer, 1, 'a')
DLLCall($hDLL, 'none', 'MD5Init', 'ptr', DLLStructGetPtr($Struct))
DLLCall($hDLL, 'none', 'MD5Update', 'ptr', DLLStructGetPtr($Struct), 'ptr', DLLStructGetPtr($Buffer), 'int', '1')
DLLCall($hDLL, 'none', 'MD5Final', 'ptr', DLLStructGetPtr($Struct))
For $x = 1 to 16
    MsgBox(0, '', Chr(DLLStructGetData($Struct, 4, $x)))

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to post
Share on other sites

Well...that's what I was thinking when using Chr(). I switched the struct to char, and throws out negative numbers as well, where it will give the same output anyways as chr() converts it into a proper form.

I did a little research on the MSH (Monad), and the get-md5 function it has returns the same type of integers that mine is. I'm downloading beta 2 right now...maybe there's a way to convert the output to an acceptable alphanumeric string...

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...