Al di là del fatto che la corretta dichiarazione sarebbe questa
codice:
Private Declare Auto Function GetVolumePathName Lib "Kernel32.dll" (ByVal lpszFileName As String, ByVal lpszVolumePathName As Text.StringBuilder, ByVal cchBufferLength As Integer) As Integer
e questo il corretto modo di richiamarla
codice:
Dim buffer As New Text.StringBuilder(255)
If Not GetVolumePathName("z:\", buffer, buffer.Capacity) Then
Console.WriteLine(buffer.ToString())
End If
. In ogni caso la GetVolumePathName non va bene per quello che devi fare, credo che potrebbe andare bene invece la WNetGetConnection.