Hi LDAP gurus!

We have a requirement to scan the network and identify a directory service.

I'm using the C++ library WinLDAP.h from Microsoft

to search for a directory service....this is the code that initially gets the - 'rootDSE'

HRESULT hr;
CComVariant vartest, var, var1;

hr = ADsGetObject( L"LDAP://rootDSE",IID_IADs,(void**)
&pObject ); if ( !SUCCEEDED(hr) )
{
return -1;
}

hr = pObject-Get(CComBSTR(L"defaultNamingContext"),&var);
if ( !SUCCEEDED(hr) )
{
return -1;
}

I have 3 questions

a) Is this code good enuf to actually ensure that
the network has a directory service?
b) We are querying Active directory, but we should be able to
look for directory services like IBM trivoli, etc too.
c) How do we identify if the directory service found is Ms Active Directory or IBM tivoli etc

Any response would be appreciated.