Catastrophic failure from Security.Policy.PEFileEvidenceFactory.GetLocationEvidence

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
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

<pre class="prettyprint System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile,SecurityZone& zone, StringHandleOnStack retUrl)[/code]
This fails with:
<pre class="prettyprint System.Runtime.InteropServices.COMException: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
[/code]
Right before the call to the 3rd pary control is made, I impersonate a user using the following code:
<pre class="prettyprint #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
[/code]
<br/>
Im completly at a loss why this is failing. Any help would be great!

View the full article
 
Back
Top