Directory Services |
The AllocADsStr function creates a deep copy of a specified string. To release the memory allocated by this function, use FreeADsStr.
LPWSTR AllocADsStr( LPWSTR pStr );
Use the function in the following code example to create strings used in ADSI.
#define LDAP 0 #define WINNT 1 LPWSTR namespace = NULL; int prov=0; . . . if (prov == WINNT) { namespace = AllocADsStr(L"WinNT://"); } else { namespace = AllocADsStr(L"LDAP://"); } . . . // When finished with namespace, free the string. FreeADsStr(namespace);
Client: Included in Windows XP and
Windows 2000 Professional.
Server: Included in Windows Server 2003 and
Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension
on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Adshlp.h.
Library: Use ActiveDS.lib.