XLaunchXBE's descendant functions bugs

Open
#637 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c

Research direction

Start by reading the linked code in lib/hal/fileio.c (lines 94–99) and lib/hal/xbox.c (lines 69–86), then compare the reported path outputs with the related issue #500. The issue describes inconsistent path conversion and launch path handling, but leaves the desired behavior and scope of the proposed rework unsettled. Done means the expected behavior is defined and the reported cases are addressed.

Written by the indexing model from the issue text.

Description

I ran a test on:
https://github.com/XboxDev/nxdk/blob/500354ef264f35a46a31643876b06ed614b0aed8/lib/hal/fileio.c#L94-L99

And its output are:

d:\foo\bar.txt test output: \??\D:\foo\bar.txt
.\foo\bar.txt test output: \Device\Harddisk0\Partition1\foo\bar.txt
\foo\bar.txt test output: \Device\Harddisk0\Partition1\foo\bar.txt
foo\bar.txt test output: \Device\Harddisk0\Partition1\foo\bar.txt
\\.\D:\foo\bar.txt test output: \??\D:\foo\bar.txt
\??\d:\foo\bar.txt test output: \??\D:\foo\bar.txt

The more I look at output result... the more it doesn't make any sense to me. Retail console doesn't accept \??\D:\foo\bar.txt path when it should be absolute path. In my opinion, it warrant for rehaul work since nxdk is relying on its own partition table than retrieve full path by using NtOpenSymbolicLinkObject and NtQuerySymbolicLinkObject functions for any mounted drive letter had been done by the title itself. Plus title has the ability to choose which drive letter can be mount on any partitions and child directory.

Seems to be relative to #500 problem. If this whole information should be transfer to #500's post, then I'll transfer it. Below research was done first on a new ticket then realize there are more problems from internal functions.

Below is the original draft issue I made but turns out there are even more issues with nxdk's launch xbe's descendant functions.

If I read XLaunchXBEEx function correctly, it does not look right. From else statement below, it doesn't check for semicolon first incase title wish to set D:\ mount to a parent directory or above by default from reboot process just like retail titles compiled with XDK did. Having two or more semicolons will cause reboot to dashboard or error screen. (For me, it boots to dashboard.)

https://github.com/XboxDev/nxdk/blob/500354ef264f35a46a31643876b06ed614b0aed8/lib/hal/xbox.c#L69-L86

Beside above issue, I wasn't really sure if it must have semicolon until I ran another test again without any semicolon. The result return as:

LaunchDataPage->Header.szLaunchPath: \Device\Harddisk0\Partition1\Games\reboot\default.xbe
XeImageFileName: \Device\Harddisk0\Partition1\Games\reboot\default.xbe
\??\D: == \Device\Harddisk0\Partition1\Games\reboot\

vs unmodified nxdk:

LaunchDataPage->Header.szLaunchPath: \Device\Harddisk0\Partition1\Games\reboot;default.xbe
XeImageFileName: \Device\Harddisk0\Partition1\Games\reboot\default.xbe
\??\D: == \Device\Harddisk0\Partition1\Games\reboot

The only difference is without semicolon will include backslash whilst with will exclude backslash. But it doesn't affect D drive mounted to read/write contents since I can read the updated log files just fine. If a backslash existed at end of file, in xbox environment it is act as a directory than a "possible" file. Yet the xbox kernel knows to mount it as a directory than a file.


With that said, why semicolon character is a requirement if title doesn't set semicolon in its path to xbe? If I recall, it is entirely optional for title to choose alternative mount point for D drive letter on reboot process.

// if we couldn't find a trailing slash, the conversion to 
// the xbox path mustn't have worked, so we will return

In my opinion, this comment isn't correct. For example, you can have multiple xbes, or re-use the same xbe, from root directory without need to have semicolon character. However, it is also not a requirement as well for child directory wherever xbe file reside in too.

Dominant language
C
Stars
600
Forks
97
Avg merge
11h 48m
Merged PRs (30d)
2

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from XboxDev/nxdk

All issues in XboxDev/nxdk

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.