这是我的程序。我无法绑定。我不知道是什么问题。我认为连接字符串有问题。如何找到 LDAP 连接字符串?
#include <iostream>
#include <conio.h>
#include <wchar.h>
#include <objbase.h>
#include <activeds.h>
#include <AdsHlp.h>
using namespace std;
const IID IID_IADs = {0xFD8256D0, 0xFD15, 0x11CE, {0xAB,0xC4,0x02,0x60,0x8C,0x9E,0x75,0x53}};
int main(int argc, CHAR* argv[])
{
IADs *pObject;
HRESULT hr;
::CoInitialize(NULL);
hr = ADsOpenObject(L"ldap://server1",L"cn=Manager,dc=maxcrc,dc=com",L"secret",
ADS_SECURE_AUTHENTICATION,
IID_IADs,
(void**)&pObject);
if(SUCCEEDED(hr))
{
cout<<"Success";
pObject->Release();
}
else
cout<<"Unsuccessful";
CoUninitialize();
getch();
return 0;
}