Computing.Net > Forums > Programming > Active Directory and Visual C++

Active Directory and Visual C++

Reply to Message Icon

Original Message
Name: Infinite Recursion
Date: January 9, 2004 at 07:29:17 Pacific
Subject: Active Directory and Visual C++
OS: na
CPU/Ram: na
Comment:

I am in the midst of about a 900 line visual C++ program that interacts with an active directory based on Windows 2000 (which will also have to work with Windows 2003).

Currently, the program is binding to the domain and inserting data (for single users)just fine. However when I pass in a * for user objects to search for and update, it stops on the Administrator account. The reason is, the Administrator does not have a full name supplied. I assume that Users would be the specified container for the Administrator so what would be the reason it is comming up in my processing first, ahead of a few accounts that are alphabetically first?

I've tried everything that I can think of to skip past the accounts that do not contain sufficient user information. If the bind to the user object fails, I release the current user object and grab the next one.

Here is a bit of code... (if it gets blasted apart in transit I will repost)

hr = FindUserByName(pDS, //Container to search
pszBuffer, //Name of user to find.
&pObject); //Return a pointer to the user

if ( SUCCEEDED(hr) )
{
IADsUser *pUser = NULL;
hr = pObject->QueryInterface( IID_IADsUser, (void**) &pUser );

if ( SUCCEEDED(hr) )
{
// grabbing user properties
hr = GetUserPropertyMethods(pUser);
if ( FAILED(hr) )
{
LOG("Unable to obtain sufficient user properties. Skipped....\n");
//pUser->Release();
//pUser = NULL;
continue;
}

-----------------------
A portion of the code where it hangs in the HRESULT GetUserPropertyMethods( IADsUser *pUser ) function...

---------------
hr = pUser->get_FullName( &bstr );

//pUser->get_Schema();

if ( SUCCEEDED (hr) )
{
wprintf(L"Full Name: %s\n", bstr);
EVENT("Full Name: ");
EVENT(bstr);
}
else
{
EVENT("ERROR: Unable to obtain full name from user object."); return 3;
}
---------------


Report Offensive Message For Removal








Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Active Directory and Visual C++

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge