Skip to content

startup-runtime: package opens fail when the console drive letter is another volume #1158

Backlog

Description

@rasptum

Problem

A console executable opens its package at a fixed drive letter. tools/startup/run.ps1 only sets the working directory (-DataDir), so the run works when the package sits at that drive's root and fails when the letter is another volume on the PC (or does not exist).

Measured on #1135 at e658fe2, Windows 10 22H2 (19045.6466), with the package in a folder on another drive: the first package open at the fixed letter returns "not found", no archive is mounted, and the run stops after 0.51 s on an access violation in a C runtime fill called by the executable (a table sized from data that was never loaded). subst cannot help when the letter is already a real volume.

Proposal

A launcher option (--map-drive G=<folder>[;S=<folder>], -MapDrive in run.ps1) that rewrites the path of file opens on those letters in the debugger's existing file hook. With it the same run mounts the package (185 opens redirected in 75 s) and the persistent-storage root can be a mapped letter too, as runtime_proxy.cpp expects.

Done when

The option exists, is documented in docs/startup-runtime.md, and a source-built consumer opens a file through a mapped letter under the launcher (plus a negative control without the option).

Context: docs/startup-runtime.md (#1135). Do not attach game files, dumps or logs that contain addresses or names from an executable; describe results in terms of the component tested.

AI-assisted (Claude Code).

Activity

  1. rasptum commented on Nov 24, 2026

    @rasptum
    ContributorAuthor

    Claiming this. I have the launcher option working locally (path rewrite in the debugger's file hook, -MapDrive in run.ps1); what is left is the source-built consumer check, the negative control and the doc row. Will open it against the #1135 branch or after it merges.

    AI-assisted (Claude Code).

  2. triggered02 commented on Nov 24, 2026

    @triggered02
    Contributor

    Implemented as PR #1251.

    Shape: debug_launch.py --map-drive LETTER=FOLDER[;...], exposed as
    un.ps1 -MapDrive. The rewrite happens inside the file hooks the launcher already installs, so it works whether or not the letter exists, and a real volume on that letter is untouched.

    Two details the proposal did not cover that the implementation had to:

    • A folder path is longer than a single letter, so the replacement does not fit the caller's UNICODE_STRING buffer. When it does not fit, the launcher allocates the name in the target process and repoints the UNICODE_STRING at it (the caller may keep the name while its handle is open, so the allocation is left to the process).
    • Opens arrive as NT paths with a \??\ prefix and optionally a [root ...] prefix; both are preserved, and separators are normalised because a build directory reaches the option with forward slashes and NT paths reject those.

    Covered by startup_map_drive with a source-built consumer: the rewrite makes an open on a letter that is not a volume succeed and read its content (trace shows the MAP line), the same open fails without the option, and an open on a letter that is not mapped is left alone. Documented in docs/startup-runtime.md under the run instructions, including the limit that only opens passing through the installed hooks are rewritten.

  3. rasptum commented on Nov 24, 2026

    @rasptum
    ContributorAuthor

    Releasing my claim: #1251 implements this.

    My local version (a path rewrite in the launcher's file hook, plus -MapDrive in run.ps1) has the same shape, so I won't open a competing PR. It has been in daily use for the runs reported on #1150 and #870, with G, D, S and T mapped to folders.

    AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions