VMware {code} Community
jeremyb
Contributor
Contributor

VixDiskLib_Open returns 16054 "VIX_E_DISK_INVALID_CONNECTION"

Trying to mount local VMDK file and getting 16054 error on VixDiskLib_Open. Any assistance would be greatly appreciated. Please see following code.

Dim vixError As Integer

Dim srcConnection As IntPtr
Dim diskHandle As IntPtr

Dim diskPath As String

Dim openFlags As Integer

Dim connectParams As New VixDiskLibConnectParams

Try
     vixError = VixDiskLib_Init(1, 0, Nothing, Nothing, Nothing, Nothing)

     ' DEBUG:
     MsgBox("VixDiskLib_Init: " & vixError)

     connectParams.serverName = ""
     connectParams.creds.uid.userName = ""
     connectParams.creds.uid.password = ""
     connectParams.port = Nothing

     srcConnection = Marshal.AllocHGlobal(8)

     vixError = VixDiskLib_Connect(connectParams, srcConnection)

     ' DEBUG:
     MsgBox("VixDiskLib_Connect: " & vixError)

     diskPath = "E:\vlab3vm05.vmdk"

     openFlags = VIXDISKLIB_FLAG_OPEN_READ_ONLY

     diskHandle = Marshal.AllocHGlobal(8)

     vixError = VixDiskLib_Open(srcConnection, diskPath, openFlags, diskHandle)

     ' DEBUG:
     MsgBox("VixDiskLib_Open: " & vixError)
Catch ex1 As Exception
     ' DEBUG:
     MsgBox("ex1: " & ex1.Message)

     Try
         vixError = VixDiskLib_Disconnect(srcConnection)

         ' DEBUG:

         MsgBox("VixDiskLib_Disconnect: " & vixError)
     Catch ex2 As Exception
         ' DEBUG:
         MsgBox("ex2: " & ex2.Message)
     End Try
End Try

0 Kudos
0 Replies