Answer the question
In order to leave comments, you need to log in
LDAP request encoding: how?
Hello, this is the problem. There is a code:
hr = pADsys->get_UserName(&bstr);
if (hr!=S_OK)
{
string error= format_error(hr);
LPSTR error1 = const_cast<char *>(error.c_str());
PutInfotoFileLog(error1,"getDomainUserSAMAccountName:get_UserName",4);
return ConvertStdStringToAnsiBSTR(error1);
}//получаем полное имя пользователя в домене
IADs *pUsr=NULL; //контейнер
USES_CONVERSION; //Макросы преобразования
string strDesc = static_cast<CHAR*>(CW2A(bstr));//
string LDAP="LDAP://"; //
string path = LDAP + strDesc;
wstring wstr( path.begin(), path.end() ); //
LPCTSTR path2 = W2CT( wstr.c_str( ) ); //формирование корректного пути для создания объекта из AD и приведение типа std::string к LPCTSTR
hr = ADsGetObject( path2, IID_IADs,(void**)&pUsr);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question