ADsGetLastError
Retrieves the calling thread's last-error code value. This function acts in the same manner as the Win32 function GetLastError.
HRESULT ADsGetLastError(
  LPDWORD lpError,      //Indirect pointer to error code
  LPWSTR lpErrorBuf,    //Indirect pointer to error string
  DWORD dwErrorBufLen,  //Max length of ErrorBuf
  LPWSTR lpNameBuf,     //Indirect pointer to provider name
  DWORD dwNameBufLen    //Max length of NameBuf
);
 
Parameters
- 
lpError
- 
[out] Pointer to the location that receives the error code.
- 
lpErrorBuf
- 
[out] Pointer to the location that receives the null-terminated string describing the error.
- 
dwErrorBufLen
- 
[in] Size (in characters) of the lpErrorBuf buffer. If the buffer is too small to receive the error string, the string is truncated, but still null-terminated. A buffer of at least 256 bytes is recommended.
- 
lpNameBuf
- 
[out] Pointer to the location that receives the null-terminated string describing the name of the provider that raised the error.
- 
dwNameBufLen
- 
[in] Size (in characters) of the lpNameBuf buffer. If the buffer is too small to receive the error string, the string is truncated, but still null-terminated.
Return Values
- 
S_OK
- 
The last error was retrieved successfully.
- 
E_POINTER
- 
One or more of the parameters passed in is bad.
- 
ERROR_BAD_DEVICE
- 
The threadID for the current thread could not be found in that table anywhere. This should never happen.
Remarks
The ADsEnumerateNext helper function populates a VARIANT array with elements fetched from an enumerator object. The number of elements retrieved can be smaller than the number requested.
QuickInfo
  Windows NT:  Use version 4.0 and later. 
  Windows CE:  Unsupported.
See Also
ADsBuildEnumerator, ADsFreeEnumerator