I'm not sure if the connection string in C will be like in C++, but for C++ we have to set username and password in the connection string like this:
hr = ADsOpenObject(L"LDAP://CN=Manager,DC=maxcrc,DC=com",
"username",
"password",
ADS_SECURE_AUTHENTICATION,
IID_IADs,
(void**) &pObject);