Skip to content

Fix main image path letter case mismatch with the launch command line - #5729

Open
cssxn wants to merge 1 commit into
sandboxie-plus:masterfrom
cssxn:fix/image-path-letter-case
Open

cssxn wants to merge 1 commit into
sandboxie-plus:masterfrom
cssxn:fix/image-path-letter-case

Conversation

@cssxn

@cssxn cssxn commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

When SbieDll creates a process it derives the image name from a file handle (SbieDll_GetHandlePath), so the child's ImagePathName carries the on-disk spelling, while lpCommandLine is passed through and keeps the spelling the caller used. Ldr_FixImagePath() then writes that spelling into the LDR entry and into RTL_USER_PROCESS_PARAMETERS.ImagePathName.

The two strings denote the same file and Windows treats them as equal, but applications that compare GetModuleFileName() against argv[0] case sensitively conclude that a file is missing. Chromium FilePath::AppendRelativePath() (base/files/file_path.cc) compares every component strictly and only exempts the drive letter. WeChat 4.x WeChatAppEx.exe is such a case: it fails to locate its flue.dll and exits with code 7, which breaks the notes and official account views inside the sandbox.

When argv[0] is a drive absolute path that equals the boxed true path ignoring case, use its spelling instead. Everything else keeps the previous behaviour, so relative paths, short paths, symbolic links and forced processes are unaffected. The substituted string is identical apart from letter case, so no path redirection is possible.

Thank you for your contribution to the Sandboxie repository.

Please provide commit messages and pull request descriptions in English language.

Translators are encouraged to look at the localization notes and tips: #1123

For translation changes, follow the translation collaboration and attribution guidelines. Preserve existing credits unless a project maintainer explicitly approves an attribution change, and agree on substantial terminology changes or broad rewrites with the language maintainer and project maintainers first.

When SbieDll creates a process it derives the image name from a file handle
(SbieDll_GetHandlePath), so the child's ImagePathName carries the on-disk
spelling, while lpCommandLine is passed through and keeps the spelling the
caller used.  Ldr_FixImagePath() then writes that spelling into the LDR entry
and into RTL_USER_PROCESS_PARAMETERS.ImagePathName.

The two strings denote the same file and Windows treats them as equal, but
applications that compare GetModuleFileName() against argv[0] case sensitively
conclude that a file is missing.  Chromium FilePath::AppendRelativePath()
(base/files/file_path.cc) compares every component strictly and only exempts
the drive letter.  WeChat 4.x WeChatAppEx.exe is such a case: it fails to
locate its flue.dll and exits with code 7, which breaks the notes and
official account views inside the sandbox.

When argv[0] is a drive absolute path that equals the boxed true path ignoring
case, use its spelling instead.  Everything else keeps the previous behaviour,
so relative paths, short paths, symbolic links and forced processes are
unaffected.  The substituted string is identical apart from letter case, so no
path redirection is possible.
@haobinnan

Copy link
Copy Markdown

@DavidXanatos
It would be great if this patch could be merged into the main branch soon and make it into the next release. Thanks for your consideration!

@haobinnan haobinnan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidXanatos
It would be great if this patch could be merged into the main branch soon and make it into the next release. Thanks for your consideration!

@offhub offhub added the SbieDll Collection of SbieDll.dll issues label Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

SbieDll Collection of SbieDll.dll issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants