Platform SDK: Active Directory, ADSI, and Directory Services |
The ReallocADsMem function resizes an existing block of memroy.
LPVOID ReallocADsMem( LPVOID pOldMem, DWORD cbOld, DWORD cbNew );
When successful, the function returns a pointer to the newly allocated memory. Otherwise it returns NULL.
If cbNew is less than cbOld, the existing memory is truncated to fit the new memory size. The following code snippet illustrates how to use ReallocADsMem to enlarge a string.
LPWSTR path = (LPWSTR)AllocADsMem(9*sizeof(WCHAR)); wcscpy(path, L"WinNT://"); // path becomes "WinNT://" printf("path = %$\n",path); path = (LPWSTR)ReallocADsMem(path, 9*sizeof(WCHAR), 18*sizeof(WCHAR)); // path is still "WinNT://" wcscat(path, L"localhost"); printf("path = %S\n",path); // path is "WinNT://localhost"
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.