Virtual Disk Development Kit

 View Only
Expand all | Collapse all

Encountering an issue while using VixDiskLib_Connect

  • 1.  Encountering an issue while using VixDiskLib_Connect

    Posted Apr 02, 2024 10:25 AM

    I'm encountering an issue while attempting to connect to an ESXi host using this code

    [DllImport(VIXDISKLIB)]
    public static extern VixError VixDiskLib_Connect(ref VixDiskLibConnectParams connectParams, out IntPtr connection);

    private static VixError Connect(ConnectionInfo connectionInfo, out IntPtr connection)
    {
    try
    {
    VixDiskLibConnectParams connParams = new VixDiskLibConnectParams();
    connParams.CredType = (uint)VixDiskLibCredType.VIXDISKLIB_CRED_UID;
    connParams.VixCredentials = new VixDiskLibCreds();
    connParams.VixCredentials.Uid = new VixDiskLibUidPasswdCreds();
    connParams.ServerName = connectionInfo.Host;
    connParams.VixCredentials.Uid.UserName = connectionInfo.UserName;
    connParams.VixCredentials.Uid.Password = connectionInfo.Password;
    connParams.Port = (uint)connectionInfo.Port;

    return VixDiskLib.VixDiskLib_Connect(ref connParams, out connection);
    }
    catch (Exception)
    {
    throw;
    }
    }

    Upon execution, it returns the following error:

    Exception thrown at 0x00007FFE25270F50 (vcruntime140.dll) in Vm.Test.exe: 0xC0000005: Access violation reading location 0x0000000000000001.

    Any suggestions to fix this issue would be helpful.



  • 2.  RE: Encountering an issue while using VixDiskLib_Connect

    Posted Apr 08, 2024 07:17 AM

    Did you solve the problem?