Reputation: 461
I looking for an API method that retrieve the info that "net view /domain" does. namely, I'm looking for a way to enumerate the visible domains within a forest, using win32api (in C environment)
thanks.
Update: it seems that DsEnumerateDomainTrusts can do what I need, however, it doesn't looks like net.exe importing it, so I'd still like to know of other options.
Update2: as it's name imply, the function only enumerate trusted domain, even when DS_DOMAIN_IN_FOREST is specified, so I'm in square 1.
Upvotes: 0
Views: 932
Reputation: 72670
I think that in your case the best way is to interrogate Active directory.
You will find in this answer the way to get all the domains in your directory, first requesting "rootDSE" to find the configuration naming context, second requesting for crossRef
with nETBIOSName
to retreive domain entries
As you are interested in how to interrogate active directory from native code, you may have a look to LDAP C-Binding API as discribed in RFC 1823 specifies, Microsoft support it, see MS Strategy for Lightweight Directory Access Protocol (LDAP). You'll find the using and reference manuals of the Microsoft API in Lightweight Directory Access Protocol.
Upvotes: 2