3.2.2.1.7 Converting the LDAP results to HRESULT

The processing rules in this section are used to convert the returned LDAP result into an HRESULT (section 2.2.18), as specified in [MS-DTYP] section 2.2.18.

Input Parameters:

InputReturnStatus: An LDAP resultCode ([RFC2251] section 4.1.10) returned from the directory server in response to the request or an error indicating that the directory server could not be contacted or a timeout has occurred.

InputResultMessage: A list of LDAPMessage values ([RFC2251] section 4.1.1) which contains the response from the directory server.

Output Parameters:

OutputHRESULT: The returned HRESULT value.

Processing Rules:

  1. If the input parameter InputResultMessages is set to NULL (as in the case of the Bind task), use the InputReturnStatus input parameter. Convert this value to a Win32 error using the conversion specified in [MS-ERREF] section 2.4, and then convert the Win32 error to HRESULT using the conversion specified in [MS-ERREF] section 2.1.2. Set the output parameter OutputHRESULT equal to the returned HRESULT and exit.

  2. If the input parameter InputResultMessages.errorMessage is at least 8 bytes long:

    1. If each of the first 8 bytes is between '0' and '9' inclusive, or between 'a' and 'f' inclusive, or between 'A' and 'F' inclusive, then use this value as the hexadecimal representation of a Win32 error and then convert the Win32 error to HRESULT using the conversion specified in [MS-ERREF] section 2.1.2. Set output parameter OutputHRESULT equal to the returned HRESULT and exit.

    2. If each of the first 8 bytes is 0, use ERROR_DS_GENERIC_ERROR, as specified in [MS-ERREF] section 2.4, as the Win32 error and then convert the Win32 error to HRESULT using the conversion specified in [MS-ERREF] section 2.1.2. Set the output parameter OutputHRESULT equal to the returned HRESULT and exit.

  3. Otherwise, use the input InputResultMessages.resultCode. Convert it to a Win32 error using the conversion specified in [MS-ERREF] section 2.4, and then convert the Win32 error to HRESULT using the conversion specified in [MS-ERREF] section 2.1.2. Set the output parameter OutputHRESULT equal to the returned HRESULT and exit.