Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than ntdsapi, prefix the name with the module name and a period.
<DllImport("Ntdsapi.dll", CharSet := CharSet.Auto, SetLastError := True)> _
Friend Shared Function DsMapSchemaGuids(hDs As IntPtr, cGuids As UInteger, rGuids As Guid(), ByRef ppGuidMap As IntPtr) As UInteger
End Function
IntPtr phDS = new IntPtr(0);
IntPtr guidMap = new IntPtr(0);
uint result;
Guid[] myGuids = {
new Guid("{e0fa1e69-9b45-11d0-afdd-00c04fd930c9}"),
new Guid("{771727b1-31b8-4cdf-ae62-4fe39fadf89e}"),
new Guid("{d5eb2eb7-be4e-463b-a214-634a44d7392e}"),
new Guid("{e0fa1e8c-9b45-11d0-afdd-00c04fd930c9}")
};
//Result of 0 is successful.
result = DsBind(domainController, domain, out phDS);
if (result == 0)
{
result = DsMapSchemaGuids(phDS, (uint)myGuids.Length, myGuids, out guidMap);
DS_SCHEMA_GUID_MAP[] guidMapResult = parseGuids(guidMap, myGuids.Length, true);
for (int i = 0; i < guidMapResult.Length; i++)
{
Console.WriteLine("{0} = {1}", myGuids[i], guidMapResult[i].pName);
}
result = DsUnBind(phDS);
}
else
{
Console.WriteLine("Couldn't bind to the domain {0} on domain controller {1}.", domain, domainController);
}
Console.ReadKey();
private static DS_SCHEMA_GUID_MAP[] parseGuids(IntPtr guidMap, int numGuids, bool freePointer)
{
int typeSize = Marshal.SizeOf(typeof(DS_SCHEMA_GUID_MAP));
DS_SCHEMA_GUID_MAP[] schemaMap = new DS_SCHEMA_GUID_MAP[numGuids];
IntPtr guidPointer = guidMap;
for (int i = 0; i < numGuids; i++)
{
schemaMap[i] = (DS_SCHEMA_GUID_MAP)Marshal.PtrToStructure(
new IntPtr
(
(long)guidPointer + i * typeSize
),
typeof(DS_SCHEMA_GUID_MAP)
);
}
if (freePointer)
{
DsFreeSchemaGuidMap(guidPointer);
}
return schemaMap;
}
The DsBindWithCred function binds to a domain controller using the specified credentials.
4/19/2016 7:39:45 AM - stefan.cuypers@pandora.be-213.118.174.16
The DsUnBind function finds an RPC session with a domain controller and unbinds a handle to the directory service (DS).
4/19/2016 7:32:42 AM - stefan.cuypers@pandora.be-213.118.174.16
Frees memory allocated by DsMapSchemaGuids
5/2/2014 11:26:51 AM - austin.net@hotmail.com-65.89.28.232
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).