hxysayhi
hxysayhi

Reputation: 1987

LsaLookupAuthenticationPackage returns 0xc00000fe

I'm implementing a credential provider, and inside the credential's method there is this function to look for the correct authentication package to use

 HRESULT RetrieveNegotiateAuthPackage(ULONG * pulAuthPackage)
  {
    HRESULT hr;
    HANDLE hLsa;
  
    NTSTATUS status = LsaConnectUntrusted(&hLsa);
    if (SUCCEEDED(HRESULT_FROM_NT(status)))
    {
  
      ULONG ulAuthPackage;
      LSA_STRING lsaszKerberosName;
      LsaInitString(&lsaszKerberosName, NEGOSSP_NAME);
  
      status = LsaLookupAuthenticationPackage(hLsa, &lsaszKerberosName, &ulAuthPackage);
      if (SUCCEEDED(HRESULT_FROM_NT(status)))
      {
        *pulAuthPackage = ulAuthPackage;
        hr = S_OK;
      }
      else
      {
        hr = HRESULT_FROM_NT(status);
      }
      LsaDeregisterLogonProcess(hLsa);
    }
    else
    {
      hr= HRESULT_FROM_NT(status);
    }
  
    return hr;
  }

When I call the API LsaLookupAuthenticationPackage, it returns 0xc00000fe (an error). Here is the values of the parameters I got from debugging:

hLsa (it can vary each time)     0x00391c60
lsaszKerberosName                L"Negotiate"

Does anyone know what possibly causes this? And what to do to fix it? Thanks :)

Upvotes: 0

Views: 2258

Answers (1)

csrenren
csrenren

Reputation: 38

according to ms api doc, the package name parameter is defined by the following macros:

MSV1_0_PACKAGE_NAME

MICROSOFT_KERBEROS_NAME_A

NEGOSSP_NAME_A

the macro defines the type of the authentication package that you want to use and furthermore, you must use the ascii type intead of unicode https://learn.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-lsalookupauthenticationpackage

Upvotes: 1

Related Questions