Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

Error 0xc0000409 occurs in updated crate (Win App SDK 1.1) during bootstrap if .exe does not have a manifest #43

Closed
kaivol opened this issue Jun 13, 2022 · 1 comment
Labels
blocked This issue is blocked on another issue external This issue is a result of some external dependency workaround-available This issue can be worked around

Comments

@kaivol
Copy link

kaivol commented Jun 13, 2022

Problem

I updated the project to version 1.1 of the Windows App SDK (https://github.com/kaivol/windows-app-rs/tree/was-1.1).

Running the samples without an (embedded) manifest results in a crash during the bootstrap process:
process didn't exit successfully: `target\debug\sample_xamlapp.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

WinDbg gives the following output:

D:\a\_work\1\s\dev\WindowsAppRuntime_BootstrapDLL\MddBootstrap.cpp(776)\Microsoft.WindowsAppRuntime.Bootstrap.dll!00007FFB67F3B0D9: (caller: 00007FFB67F39C2F) LogHr(2) tid(15a0) 80040010 Objekt ist nicht in einem der Inplace Active States.
    Msg:[Bootstrap.Intitialize: Scanning packages for Major.Minor=1.1, Tag=, MinVersion=0.0.0.0] CallContext:[\Initialize] 
D:\a\_work\1\s\dev\WindowsAppRuntime_BootstrapDLL\MddBootstrap.cpp(885)\Microsoft.WindowsAppRuntime.Bootstrap.dll!00007FFB67F3BB5E: (caller: 00007FFB67F39C2F) LogHr(3) tid(15a0) 80040012 Der Vorgang kann nicht ausgeführt werden, da dem Objekt kein Speicher zugewiesen wurde.
    Msg:[Bootstrap.Intitialize: Microsoft.WinAppRuntime.DDLM.1000.516.2156.0-x6_1000.516.2156.0_x64__8wekyb3d8bbwe is applicable (Major.Minor=1.1, Tag=, MinVersion=0.0.0.0)] CallContext:[\Initialize] 
D:\a\_work\1\s\dev\WindowsAppRuntime_BootstrapDLL\MddBootstrap.cpp(876)\Microsoft.WindowsAppRuntime.Bootstrap.dll!00007FFB67F3B9F8: (caller: 00007FFB67F39C2F) LogHr(4) tid(15a0) 80040011 Objekt kann nicht konvertiert werden.
    Msg:[Bootstrap.Intitialize: Microsoft.WinAppRuntime.DDLM.1000.516.2156.0-x8_1000.516.2156.0_x86__8wekyb3d8bbwe not applicable. Architecture doesn't match current architecture x64 (Major.Minor=1.1, Tag=, MinVersion=0.0.0.0)] CallContext:[\Initialize] 
D:\a\_work\1\s\dev\WindowsAppRuntime_BootstrapDLL\MddBootstrap.cpp(908)\Microsoft.WindowsAppRuntime.Bootstrap.dll!00007FFB67F3C486: (caller: 00007FFB67F39C2F) LogHr(5) tid(15a0) 80040013     Msg:[Bootstrap.Intitialize: Microsoft.WinAppRuntime.DDLM.1000.516.2156.0-x6_1000.516.2156.0_x64__8wekyb3d8bbwe best matches the criteria (Major.Minor=1.1, Tag=, MinVersion=0.0.0.0) of 99 packages scanned] CallContext:[\Initialize] 
D:\a\_work\1\s\dev\UndockedRegFreeWinRT\urfw.cpp(416)\Microsoft.WindowsAppRuntime.dll!00007FFABA89C3A7: (caller: 00007FFABA8AF7C2) ReturnHr(1) tid(15a0) 8007000E Failed to allocate necessary memory.
D:\a\_work\1\s\dev\WindowsAppRuntime_DLL\dllmain.cpp(30)\Microsoft.WindowsAppRuntime.dll!00007FFABA8AF9A3: (caller: 00007FFABA8BB59B) FailFast(1) tid(15a0) 8007000E Failed to allocate necessary memory.
(4a68.15a0): Security check failure or stack buffer overrun - code c0000409 (!!! second chance !!!)
Subcode: 0x7 FAST_FAIL_FATAL_APP_EXIT 
KERNELBASE!RaiseFailFastException+0x152:

But it is not actually an 0x8007000E E_OUTOFMEMORY error, the actual error occurs in UndockedRegFreeWinRT/urfw.cpp:

342    hActCtx = CreateActCtxW(&acw);
343    RETURN_LAST_ERROR_IF(!hActCtx);
344    if (hActCtx == INVALID_HANDLE_VALUE)
345    {
346        SetLastError(ERROR_OUTOFMEMORY);
347        return HRESULT_FROM_WIN32(GetLastError());
348    }

Here CreateActCtxW returns INVALID_HANDLE_VALUE and sets the Last-Error to

LastErrorValue: (Win32) 0x714 (1812) - The specified image file did not contain a resource section.
LastStatusValue: (NTSTATUS) 0xc0000089 - Indicates the specified image file did not contain a resource section.

which then gets overwritten with ERROR_OUTOFMEMORY.

I couldn't find a remark in the Windows App SDK documentation that says a manifest is required, so I'm not sure if I did an error while updating to version 1.1 or if this is a new requirement in version 1.1.

Steps to reproduce

  1. Get my updated version of the crate
  2. Install version 1.1 of the Windows App SDK
  3. Run cargo run -p sample_xamlapp without the line windows_app_deploy::embed_manifest(); in the associated build.rs

Notes

  • Output from cargo version: cargo 1.61.0 (a028ae42f 2022-04-29)
Output from rustup show
installed toolchains
--------------------

stable-x86_64-pc-windows-msvc (default)
beta-x86_64-pc-windows-msvc
nightly-2022-03-18-x86_64-pc-windows-msvc
nightly-x86_64-pc-windows-msvc

installed targets for active toolchain
--------------------------------------

thumbv7em-none-eabi
thumbv7em-none-eabihf
thumbv7m-none-eabi
x86_64-pc-windows-msvc

active toolchain
----------------

stable-x86_64-pc-windows-msvc (default)
rustc 1.61.0 (fe5b13d68 2022-05-18)
  • Output from rustup --version: rustup 1.24.3 (ce5817a94 2021-05-31)
  • Output from cmd /c ver: Microsoft Windows [Version 10.0.22621.1]
Output from get-appxpackage *winappruntime*
Name              : Microsoft.WindowsAppRuntime.1.1
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X64
ResourceId        :
Version           : 1000.516.2156.0
PackageFullName   : Microsoft.WindowsAppRuntime.1.1_1000.516.2156.0_x64__8wekyb3d8bbwe
InstallLocation   : C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1000.516.2156.0_x64__8wekyb3d8bbwe
IsFramework       : True
PackageFamilyName : Microsoft.WindowsAppRuntime.1.1_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
IsPartiallyStaged : False
SignatureKind     : Store
Status            : Ok

Name              : Microsoft.WindowsAppRuntime.1.1
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X86
ResourceId        :
Version           : 1000.516.2156.0
PackageFullName   : Microsoft.WindowsAppRuntime.1.1_1000.516.2156.0_x86__8wekyb3d8bbwe
InstallLocation   : C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1000.516.2156.0_x86__8wekyb3d8bbwe
IsFramework       : True
PackageFamilyName : Microsoft.WindowsAppRuntime.1.1_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
IsPartiallyStaged : False
SignatureKind     : Store
Status            : Ok

Name              : MicrosoftCorporationII.WinAppRuntime.Main.1.1
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X64
ResourceId        :
Version           : 1000.516.2156.0
PackageFullName   : MicrosoftCorporationII.WinAppRuntime.Main.1.1_1000.516.2156.0_x64__8wekyb3d8bbwe
InstallLocation   : C:\Program
                    Files\WindowsApps\MicrosoftCorporationII.WinAppRuntime.Main.1.1_1000.516.2156.0_x64__8wekyb3d8bbwe
IsFramework       : False
PackageFamilyName : MicrosoftCorporationII.WinAppRuntime.Main.1.1_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
Dependencies      : {Microsoft.WindowsAppRuntime.1.1_1000.516.2156.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind     : Store
Status            : Ok

Name              : MicrosoftCorporationII.WinAppRuntime.Singleton
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X64
ResourceId        :
Version           : 1000.516.2156.0
PackageFullName   : MicrosoftCorporationII.WinAppRuntime.Singleton_1000.516.2156.0_x64__8wekyb3d8bbwe
InstallLocation   : C:\Program
                    Files\WindowsApps\MicrosoftCorporationII.WinAppRuntime.Singleton_1000.516.2156.0_x64__8wekyb3d8bbwe
IsFramework       : False
PackageFamilyName : MicrosoftCorporationII.WinAppRuntime.Singleton_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
Dependencies      : {Microsoft.WindowsAppRuntime.1.1_1000.516.2156.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind     : Store
Status            : Ok

Name              : Microsoft.WinAppRuntime.DDLM.1000.516.2156.0-x6
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X64
ResourceId        :
Version           : 1000.516.2156.0
PackageFullName   : Microsoft.WinAppRuntime.DDLM.1000.516.2156.0-x6_1000.516.2156.0_x64__8wekyb3d8bbwe
InstallLocation   : C:\Program Files\WindowsApps\Microsoft.WinAppRuntime.DDLM.1000.516.2156.0-x6_1000.516.2156.0_x64__8
                    wekyb3d8bbwe
IsFramework       : False
PackageFamilyName : Microsoft.WinAppRuntime.DDLM.1000.516.2156.0-x6_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
Dependencies      : {Microsoft.WindowsAppRuntime.1.1_1000.516.2156.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind     : Developer
Status            : Ok

Name              : Microsoft.WinAppRuntime.DDLM.1000.516.2156.0-x8
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X86
ResourceId        :
Version           : 1000.516.2156.0
PackageFullName   : Microsoft.WinAppRuntime.DDLM.1000.516.2156.0-x8_1000.516.2156.0_x86__8wekyb3d8bbwe
InstallLocation   : C:\Program Files\WindowsApps\Microsoft.WinAppRuntime.DDLM.1000.516.2156.0-x8_1000.516.2156.0_x86__8
                    wekyb3d8bbwe
IsFramework       : False
PackageFamilyName : Microsoft.WinAppRuntime.DDLM.1000.516.2156.0-x8_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
Dependencies      : {Microsoft.WindowsAppRuntime.1.1_1000.516.2156.0_x86__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind     : Developer
Status            : Ok

Name              : Microsoft.WindowsAppRuntime.1.0
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X64
ResourceId        :
Version           : 3.469.1654.0
PackageFullName   : Microsoft.WindowsAppRuntime.1.0_3.469.1654.0_x64__8wekyb3d8bbwe
InstallLocation   : C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.0_3.469.1654.0_x64__8wekyb3d8bbwe
IsFramework       : True
PackageFamilyName : Microsoft.WindowsAppRuntime.1.0_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
IsPartiallyStaged : False
SignatureKind     : Store
Status            : Ok

Name              : Microsoft.WindowsAppRuntime.1.0
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X86
ResourceId        :
Version           : 3.469.1654.0
PackageFullName   : Microsoft.WindowsAppRuntime.1.0_3.469.1654.0_x86__8wekyb3d8bbwe
InstallLocation   : C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.0_3.469.1654.0_x86__8wekyb3d8bbwe
IsFramework       : True
PackageFamilyName : Microsoft.WindowsAppRuntime.1.0_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
IsPartiallyStaged : False
SignatureKind     : Store
Status            : Ok

Name              : MicrosoftCorporationII.WindowsAppRuntime.Main.1.0
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X64
ResourceId        :
Version           : 3.469.1654.0
PackageFullName   : MicrosoftCorporationII.WindowsAppRuntime.Main.1.0_3.469.1654.0_x64__8wekyb3d8bbwe
InstallLocation   : C:\Program
                    Files\WindowsApps\MicrosoftCorporationII.WindowsAppRuntime.Main.1.0_3.469.1654.0_x64__8wekyb3d8bbwe
IsFramework       : False
PackageFamilyName : MicrosoftCorporationII.WindowsAppRuntime.Main.1.0_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
Dependencies      : {Microsoft.WindowsAppRuntime.1.0_3.469.1654.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind     : Store
Status            : Ok

Name              : Microsoft.WindowsAppRuntime.Singleton
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X64
ResourceId        :
Version           : 3.469.1654.0
PackageFullName   : Microsoft.WindowsAppRuntime.Singleton_3.469.1654.0_x64__8wekyb3d8bbwe
InstallLocation   : C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.Singleton_3.469.1654.0_x64__8wekyb3d8bbwe
IsFramework       : False
PackageFamilyName : Microsoft.WindowsAppRuntime.Singleton_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
Dependencies      : {Microsoft.WindowsAppRuntime.1.0_3.469.1654.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind     : Store
Status            : Ok

Name              : Microsoft.WinAppRuntime.DDLM.3.469.1654.0-x6
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X64
ResourceId        :
Version           : 3.469.1654.0
PackageFullName   : Microsoft.WinAppRuntime.DDLM.3.469.1654.0-x6_3.469.1654.0_x64__8wekyb3d8bbwe
InstallLocation   : C:\Program
                    Files\WindowsApps\Microsoft.WinAppRuntime.DDLM.3.469.1654.0-x6_3.469.1654.0_x64__8wekyb3d8bbwe
IsFramework       : False
PackageFamilyName : Microsoft.WinAppRuntime.DDLM.3.469.1654.0-x6_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
Dependencies      : {Microsoft.WindowsAppRuntime.1.0_3.469.1654.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind     : Developer
Status            : Ok

Name              : Microsoft.WinAppRuntime.DDLM.3.469.1654.0-x8
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X86
ResourceId        :
Version           : 3.469.1654.0
PackageFullName   : Microsoft.WinAppRuntime.DDLM.3.469.1654.0-x8_3.469.1654.0_x86__8wekyb3d8bbwe
InstallLocation   : C:\Program
                    Files\WindowsApps\Microsoft.WinAppRuntime.DDLM.3.469.1654.0-x8_3.469.1654.0_x86__8wekyb3d8bbwe
IsFramework       : False
PackageFamilyName : Microsoft.WinAppRuntime.DDLM.3.469.1654.0-x8_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
Dependencies      : {Microsoft.WindowsAppRuntime.1.0_3.469.1654.0_x86__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind     : Developer
Status            : Ok
@riverar
Copy link
Collaborator

riverar commented Jun 21, 2022

Yep, known issue I ran into as well. Waiting for fix from Windows App SDK microsoft/WindowsAppSDK#2634

@riverar riverar added blocked This issue is blocked on another issue external This issue is a result of some external dependency workaround-available This issue can be worked around labels Jun 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked This issue is blocked on another issue external This issue is a result of some external dependency workaround-available This issue can be worked around
Projects
None yet
Development

No branches or pull requests

3 participants