CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 15

Threaded View

  1. #1
    Join Date
    Jul 2012
    Posts
    5

    Re: Passing UDT from VB 6.0 to C++ DLL

    I have the same problem as this topic.

    here is the DLL info.

    Code:
    extern "C" __declspec(dllexport) int GetHash(HASHINFO*);
    Code:
    typedef struct {
            unsigned char* pHash;      // Address of buffer for saving hash
            unsigned char* szPassword; // Password
            int nPasswordLen;          // Password length
            unsigned char* szSalt;     // Salt
            int nSaltLen;              // Salt length
            unsigned char* szName;     // User name
            int nNameLen;              // User name length
            DWORD dwFlags;             // Flags
    } HASHINFO;
    Here is the VB

    Code:
    Private Type HASHINFO
       hash As String
       szPassword As String * 10
       nPasswordLen As Long
       szSalt As String * 10
       nSaltLen As Long
       szName As String * 10
       nNameLen As Long
       dwFlags As Long
    End Type
    
    Private Declare Sub GetHash Lib "c:\md5\md5.dll" (ByRef pudt As HASHINFO)
    Code:
    Private Sub Command1_Click()
    Dim udt As HASHINFO
       udt.hash = vbNullString
       udt.szPassword = "test" & Chr(0)
       udt.nNameLen = 4
       udt.szSalt = "test" & Chr(0)
       udt.nSaltLen = 4
       udt.szName = "test" & Chr(0)
       udt.nNameLen = 4
       udt.dwFlags = 0
    Call GetHash(udt)
    End Sub
    I just get a crash.

    Anyone out there to help me?
    Last edited by GremlinSA; July 10th, 2012 at 03:58 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured