I am trying to write an API function and was wondering if somebody can look it over and let me know what I am doing wrong. I am trying to return a handle and it just returns 0 every time. I have scoured the net but can't find any examples at all
Private Structure DS_SCHEMA_GUID_MAPA
Dim GUID As Guid
Dim GUIDType As Long
Dim pName As String
End Structure
Private Declare Function DsMapSchemaGuidsA Lib "ntdsapi" (ByVal hDS As Long, ByVal cGuids As Long, ByRef rGuids As Guid, ByRef ppGuidMap As DS_SCHEMA_GUID_MAPA) As Long
Private Declare Function DsBindA Lib "ntdsapi" (ByVal DomainControllerName As String, ByVal DnsDomainName As String, ByRef phDS As IntPtr) As Long
Private Sub testy()
Dim retVal As Long
Dim MyHost As String = System.Net.Dns.GetHostName
Dim handle As IntPtr
Dim t As New Guid("{2BEC133B-AE2B-4C32-
A3F5-03614
9C4E671}")
Dim temp As New DS_SCHEMA_GUID_MAPA
retVal = DsBindA(vbNull, vbNull, handle)
MsgBox(retVal.ToString)
MsgBox(handle.ToString)
DsMapSchemaGuidsA(handle, 0, t, temp)
MsgBox(temp.pName)
End Sub
retVal returns a code but this reference
http://msdn.microsoft.com/en-us/library/ms675931(VS.85).aspx does not say what events are which code? Where can I obtain this information?
Handle returns 0. Probably because I have an error code in retval but no way to tell whats being thrown back to me
Im a bit lost on this if somebody would please help me!!
Open in new window