Platform SDK: Active Directory, ADSI, and Directory Services |
The AllocADsStr function makes a "deep" copy of an specified string. The memory allocated by this function must be released by FreeADsStr.
LPWSTR AllocADsStr( LPWSTR pStr );
The function returns a non-NULL pointer to the successfully allocated memory for the string. It returns NULL if the operation failed.
Use this function to create strings used in ADSI. For example,
#define LDAP 0 #define WINNT 1 LPWSTR namespace; int prov=0; . . . if (prov = WINNT) { namespace = AllocADsStr(L"WinNT://"); } else { namespace = AllocADsStr(L"LDAP://"); } . . . // when done with namespace, free the string FreeADsStr(namespace);
Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with DSClient).
Windows 95/98: Requires Windows 95 or later (with DSClient).
Header: Declared in Adshlp.h.
Library: Included as a resource in ActiveDs.dll.