Catastrophic failure from Security.Policy.PEFileEvidenceFactory.GetLocationEvidence

  • Thread starter Thread starter daaboots
  • Start date Start date
D

daaboots

Guest
This only occurs on a Windows Server 2012 OS. The code works great on all other OSs. A call is made from a 3rd pary component that were using that eventually makes its way down to

System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile,SecurityZone& zone, StringHandleOnStack retUrl)

This fails with:

System.Runtime.InteropServices.COMException: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))


Right before the call to the 3rd pary control is made, I impersonate a user using the following code:

#region DLL Imports

// All import code taken from http://msdn.microsoft.com/en-us/library/chf6fbt4.aspx

[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern bool LogonUser(String lpszUsername, String lpszDomain, String lpszPassword, int dwLogonType, int dwLogonProvider, out SafeTokenHandle phToken);

[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public extern static bool CloseHandle(IntPtr handle);

private const int LOGON32_PROVIDER_DEFAULT = 0;
private const int LOGON32_LOGON_INTERACTIVE = 2;

#endregion

//...

SafeTokenHandle safeTokenHandle = null;
WindowsImpersonationContext impersonatedUser = null;

LogonUser(userName, domainName, password, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, out safeTokenHandle)

impersonatedUser = WindowsIdentity.Impersonate(safeTokenHandle.DangerousGetHandle());

//...
// call 3rd pary control



Im completly at a loss why this is failing. Any help would be great!

Continue reading...
 
Back
Top