microsoft / microsoft/WindowsAppSDK

Docs for making CreateProcess work on a packaged win32 exe could be improved

Open
#4,651 22 comments 0 reactions 0 assignees View on GitHub
area-Activation
Dominant language
C++
Stars
4.7k
Forks
471
Avg merge
3d 13h
Merged PRs (30d)
28

Description

### Describe the bug

I'm not sure this is the right repository, but I've seen @DrusTheAxe giving expert answers to related topics here, so I think bugs filed may reach the right people.

There are some aspects of making CreateProcess work correctly in an MSIX packaged app that aren't intuitive and there's a bug in Windows 10 that isn't documented. I had to work it out by trial and error.

On all versions of Windows if your main EXE attempts to execute an EXE that's included in your package as a helper, then it will mysteriously get ERROR_ACCESS_DENIED from CreateProcess ("Access is denied"). Nothing is logged when this happens 😢

The reason is that *all* EXEs, not just those started from the start menu or a %PATH% execution alias, *must* be listed in the AppX Manifest using `` elements even if the only thing that starts them is your own code. This isn't mentioned in the docs for `` nor the docs for `CreateProcess` (in fact the API docs for `CreateProcess` don't contain the word manifest anywhere).

On Win11 it is sufficient to create an entry for your helper EXEs in `AppxManifest.xml`. Unfortunately we must still work on Win10 where it requires more effort:

1. The EXE must have an embedded assembly manifest that contains [the `` tag](https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests#msix).
2. And it must have an `` element in the AppxManifest
3. *And* (this part is even less documented) it must also have an app execution alias!

In other words every EXE helper tool shipped in an MSIX packaged app must be added to the %PATH% if your runtime uses `CreateProcess` to invoke it, even if you don't actually invoke using that execution alias.

### Steps to reproduce the bug

1. Create an MSIX package with a main EXE (e.g. an Electron app) and a helper EXE.
2. Use `exec` from the `child_process` module to invoke the EXE.
3. Get "Access is denied" on stderr.

### Expected behavior

Everything should just work, obviously. Process creation is the sort of thing you don't expect to break just because of choice of packaging format.

### Screenshots

_No response_

### NuGet package version

None

### Packaging type

Packaged (MSIX)

### Windows version

Windows 11 version 22H2 (22621, 2022 Update), Windows 10 version 22H2 (19045, 2022 Update)

### IDE

_No response_

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the AppxManifest.xml Application documentation and the CreateProcess API documentation referenced in the issue, then review the linked MSIX application-manifest guidance. Document the helper-EXE requirements for Windows 10 and Windows 11, including the embedded msix manifest and execution alias, so the reported Access Denied case is explained.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop, documentation, operating-systems
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.