#If VBA7 Then
Public Declare PtrSafe Function NetServerEnum Lib "netapi32" _
(ByVal servername As LongPtr, _
ByVal level As LongPtr, _
buf As Any, _
ByVal prefmaxlen As LongPtr, _
entriesread As Long, _
totalentries As Long, _
ByVal servertype As Long, _
ByVal domain As LongPtr, _
resume_handle As Long) As Long
Public Declare PtrSafe Function NetApiBufferFree Lib "netapi32" _
(ByVal Buffer As LongPtr) As LongPtr
Public Declare PtrSafe Sub CopyMemory Lib "kernel32" _
Alias "RtlMoveMemory" _
(pTo As Any, uFrom As Any, _
ByVal lSize As LongPtr)
Public Declare PtrSafe Function lstrlenW Lib "kernel32" _
(ByVal lpString As LongPtr) As Long
Public Type SERVER_INFO_100
sv100_platform_id As LongPtr
sv100_name As LongPtr
End Type
Private ResultAddress As LongPtr
Public Function GetPointerToByteStringW(ByVal dwData As LongPtr) As String
Dim tmp() As Byte
Dim tmplen As Long
If dwData <> 0 Then
tmplen = lstrlenW(dwData) * 2
If tmplen <> 0 Then
ReDim tmp(0 To (tmplen - 1)) As Byte
CopyMemory tmp(0), ByVal dwData, tmplen
GetPointerToByteStringW = tmp
End If
End If
End Function
#Else
#End If