Quote Originally Posted by user65536 View Post
Thanks for checking thigns out.

I'm pretty sure VB Long is 4 bytes, Double is 8 bytes.
you actually are right.. VB.NET Long = 8 bytes in VB6 = 4 bytes.. Havn't done VB6 in a long time..


Quote Originally Posted by user65536 View Post
I have tried this

Code:
Public Type HASHINFO
   pHash As String
   szPassword As String
   nPasswordLen As Long
   szSalt As String
   nSaltLen As Long
   szName As String
   nNameLen As Long
   dwFlags As Long
End Type

    Dim udt As HASHINFO

    udt.szPassword = "test"
    udt.nPasswordLen = 4
    udt.szSalt = "test"
    udt.nSaltLen = 4
    udt.szName = "test"
    udt.nNameLen = 4
    udt.dwFlags = &H0
    
test = GetHash(udt)

End Sub
I'm not sure if I need to specify something for udt.pHash, have tried various things and it still crashes.
You will need to assign the right amount of space for the Hash to be put in (32 Byte hash ?) as the C DLL cannot assign new/ more memory to the referenced Datatype.

You were on the right track with the Null (&H0) termination..

But something else i'm thinking is that VB stores stings in Unicode (2 bytes per char) and the char array in C is expecting one byte per char.. (this may need clarification from a C Expert) ...

in this case an array of byte may be better to use, and you load the ASCII val of each char in the string to the byte array..

You will have to play with it a little, if your Defs and Variable lengths are out by one, it will crash ...

try this for debugging
Code:
 Debug.print len(udt)
After you've assigned all the values and then see if it matches what you should have...