I need to access Windows API NetShareEnum. It is working fine in the post
Win98 version but the Win98 function is returning me error number 87
(Invalid parameters)
Whats I am doing wrong ?
Following is my code
Thanks
Jean-Marc St-Hilaire
-----------------------------------
<StructLayout(L ayoutKind.Seque ntial)> _
Private Structure SHARE_INFO_50
<MarshalAs(Syst em.Runtime.Inte ropServices.Unm anagedType.LPWS tr)> _
Dim netname As String
Dim type As Integer
Dim flags As Int32
<MarshalAs(Syst em.Runtime.Inte ropServices.Unm anagedType.LPWS tr)> _
Dim remark As String
<MarshalAs(Syst em.Runtime.Inte ropServices.Unm anagedType.LPWS tr)> _
Dim path As String
<MarshalAs(Syst em.Runtime.Inte ropServices.Unm anagedType.LPWS tr)> _
Dim rw_password As String
<MarshalAs(Syst em.Runtime.Inte ropServices.Unm anagedType.LPWS tr)> _
Dim ro_password As String
End Structure
Private Declare Ansi Function NetShareEnum98 Lib "svrapi.dll " Alias
"NetShareEn um" ( _
ByRef ServerName As String, _
ByVal level As Integer, _
ByRef BufPtr As IntPtr, _
ByRef cBuffer As Integer, _
ByRef entriesread As Integer, _
ByRef totalentries As Integer _
) As Integer
Dim bServer As String
Dim level As Integer
Dim bufptr As IntPtr
Dim buffer As Integer
Dim dwEntriesRead As Integer = 0
Dim dwTotalEntries As Integer = 0
bufptr = Marshal.AllocHG lobal(buffer)
level = 50
structSize = Marshal.SizeOf( GetType(SHARE_I NFO_50))
buffer = structSize * 20
bServer = ""
erreurLvl = NetShareEnum98( _
bServer, _
level, _
bufptr, _
buffer, _
dwEntriesRead, _
dwTotalEntries)
Win98 version but the Win98 function is returning me error number 87
(Invalid parameters)
Whats I am doing wrong ?
Following is my code
Thanks
Jean-Marc St-Hilaire
-----------------------------------
<StructLayout(L ayoutKind.Seque ntial)> _
Private Structure SHARE_INFO_50
<MarshalAs(Syst em.Runtime.Inte ropServices.Unm anagedType.LPWS tr)> _
Dim netname As String
Dim type As Integer
Dim flags As Int32
<MarshalAs(Syst em.Runtime.Inte ropServices.Unm anagedType.LPWS tr)> _
Dim remark As String
<MarshalAs(Syst em.Runtime.Inte ropServices.Unm anagedType.LPWS tr)> _
Dim path As String
<MarshalAs(Syst em.Runtime.Inte ropServices.Unm anagedType.LPWS tr)> _
Dim rw_password As String
<MarshalAs(Syst em.Runtime.Inte ropServices.Unm anagedType.LPWS tr)> _
Dim ro_password As String
End Structure
Private Declare Ansi Function NetShareEnum98 Lib "svrapi.dll " Alias
"NetShareEn um" ( _
ByRef ServerName As String, _
ByVal level As Integer, _
ByRef BufPtr As IntPtr, _
ByRef cBuffer As Integer, _
ByRef entriesread As Integer, _
ByRef totalentries As Integer _
) As Integer
Dim bServer As String
Dim level As Integer
Dim bufptr As IntPtr
Dim buffer As Integer
Dim dwEntriesRead As Integer = 0
Dim dwTotalEntries As Integer = 0
bufptr = Marshal.AllocHG lobal(buffer)
level = 50
structSize = Marshal.SizeOf( GetType(SHARE_I NFO_50))
buffer = structSize * 20
bServer = ""
erreurLvl = NetShareEnum98( _
bServer, _
level, _
bufptr, _
buffer, _
dwEntriesRead, _
dwTotalEntries)
Comment