microsoft / microsoft/WinAppVSCE
Explore PE header-based architecture detection for pack command
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13
- Forks
- 3
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 11
Description
Summary
The current architecture mismatch detection in the pack command uses folder path RID segments (e.g., win-x64, win-arm64) as a heuristic. A more authoritative approach would be to read the PE header (IMAGE_FILE_HEADER.Machine field) of the .exe in the build output folder.
Background
Three possible sources for determining build output architecture were evaluated:
| Source | Reliability | Always present? |
|---|---|---|
| PE header of the .exe | Definitive — binary declares its own arch | Yes (in build output) |
Manifest ProcessorArchitecture |
Authoritative when set | No — defaults to "neutral" |
| Folder path RID segments | Heuristic | No — depends on build system |
The manifest's ProcessorArchitecture attribute is optional and defaults to "neutral", making it unreliable as a sole source. The PE header is the most reliable option since the .exe is always present and unambiguously declares its target architecture.
Proposal
- Read the first
.exefound in the selected build output folder - Parse the PE header at the fixed offset to read
IMAGE_FILE_HEADER.Machine - Map machine constants to architecture strings:
0x8664→ x640xAA64→ arm640x014C→ x86
- Use this as the primary detection method, with path-based as fallback
Considerations
- Requires binary file I/O (reading ~64 bytes from the .exe)
- Need to handle the case where multiple
.exefiles exist in the folder - Should gracefully fall back to path detection if PE parsing fails
Related
- PR #93 introduced the current path-based detection
- Issue #81 tracks ancestor-path false positive edge cases (which PE detection would also resolve)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the current path-based architecture detection in the pack command, introduced by PR #93, and review issue #81 for related edge cases. Done means the selected output folder's first .exe is checked for x64, arm64, or x86 via its PE Machine value, with path detection as a fallback and multiple-executable behavior addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100