dotnet / pinvoke

A library containing all P/Invoke code so you don't have to import it every time. Maintained and updated to support the latest Windows OS.
MIT License
2.12k stars 222 forks source link

UWP: Process initialization failed with status 0xc0000139 #377

Closed AArnott closed 6 years ago

AArnott commented 6 years ago

From @CIPop on January 31, 2018 2:1

A very simple UWP application using SDK 16299 will fail if compiled (AOT) with the following error when the binary is loaded: "Process initialization failed with status 0xc0000139"

Activating "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/show-loader-snaps" then running the app in a debugger shows the following issue:

1725 3de8:3df4 @ 00384546 - LdrpProcessWork - ERROR: Unable to load DLL: "NTASN1.dll", Parent Module: "C:\WINDOWS\SYSTEM32\ncrypt.dll", Status: 0xc0000139

Copied from original issue: AArnott/PCLCrypto#137

AArnott commented 6 years ago

This looks like a Windows OS bug to me. ncrypt.dll can't load another DLL it depends on sounds like a UWP sandboxing problem, perhaps. Not sure what PCLCrypto can do about it.

AArnott commented 6 years ago

We may be able to workaround this by specifying explicit entry points for A/W methods such as FindFirstFileEx and FormatMessage.