hle(host_posix): the calls that tell a title what it is running on (version, VerifyVersionInfo, interrupt time, system times, RAM) are stubs #624

Closed
opened 2026-11-28 15:56:49 +00:00 by AnastasisKon · 3 comments
AnastasisKon commented 2026-11-28 15:56:49 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T15:56:49Z.


Summary

Six calls that tell a title what it is running on were unimplemented in host_posix/system.rs, so they answered through the loader's import stub:

Call What the stub did
RtlGetVersion, GetVersionExW nothing: the version structure keeps the caller's zeros
VerifyVersionInfoW nothing: every comparison reads as "no"
QueryUnbiasedInterruptTime nothing: a frame-timing loop reading it sees a clock stuck at 0
GetSystemTimes nothing: the process's CPU time never moves
GetPhysicallyInstalledSystemMemory nothing: the machine has no RAM

A version check that fails is the risky one: a title without a manifest asks "am I on Windows 10 or later", gets no, and takes the Windows 7 path it still carries for its launcher — a path this host does not serve.

What the change does

  • RtlGetVersion and GetVersionExW fill either OSVERSIONINFOW or OSVERSIONINFOEXW, by the size the caller wrote, as Windows 10 build 19041 with no service pack. GetVersionExW refuses a size that is neither, as Windows does; RtlGetVersion always succeeds. Shortcut, written down: the console reports its own build, and this is the build the GDK's own headers target.
  • VerifyVersionInfoW reads the CONDITION_VECTOR and answers the operator in the high byte of type_mask (EQUAL, GREATER, GREATER_EQUAL, LESS, LESS_EQUAL, AND, OR) for every field the low byte selects, ERROR_OLD_WIN_VERSION when one does not hold.
  • QueryUnbiasedInterruptTime is 100 ns units from the host's own counter.
  • GetSystemTimes gives the process's own kernel and user time from getrusage and no idle time, which is the honest answer here: this host does not account for another process's idling and a title only subtracts two readings.
  • GetPhysicallyInstalledSystemMemory is hw.memsize in KiB.
  • ntdll.dll is now served by the same table as kernel32, because the Rtl* names live there and a title imports them from there.

Tests

Three new ones in system.rs: the version is filled in both forms and a wrong size is refused; the comparison answers with the operator it was given, including two fields at once; and the interrupt time moves, the process has used CPU time with no idle time, and the RAM is a Mac's.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6667779608 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/624). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T15:56:49Z. --- ## Summary Six calls that tell a title what it is running on were unimplemented in `host_posix/system.rs`, so they answered through the loader's import stub: | Call | What the stub did | |---|---| | `RtlGetVersion`, `GetVersionExW` | nothing: the version structure keeps the caller's zeros | | `VerifyVersionInfoW` | nothing: every comparison reads as "no" | | `QueryUnbiasedInterruptTime` | nothing: a frame-timing loop reading it sees a clock stuck at 0 | | `GetSystemTimes` | nothing: the process's CPU time never moves | | `GetPhysicallyInstalledSystemMemory` | nothing: the machine has no RAM | A version check that fails is the risky one: a title without a manifest asks "am I on Windows 10 or later", gets no, and takes the Windows 7 path it still carries for its launcher — a path this host does not serve. ## What the change does - `RtlGetVersion` and `GetVersionExW` fill either `OSVERSIONINFOW` or `OSVERSIONINFOEXW`, by the size the caller wrote, as Windows 10 build 19041 with no service pack. `GetVersionExW` refuses a size that is neither, as Windows does; `RtlGetVersion` always succeeds. Shortcut, written down: the console reports its own build, and this is the build the GDK's own headers target. - `VerifyVersionInfoW` reads the `CONDITION_VECTOR` and answers the operator in the high byte of `type_mask` (`EQUAL`, `GREATER`, `GREATER_EQUAL`, `LESS`, `LESS_EQUAL`, `AND`, `OR`) for every field the low byte selects, `ERROR_OLD_WIN_VERSION` when one does not hold. - `QueryUnbiasedInterruptTime` is 100 ns units from the host's own counter. - `GetSystemTimes` gives the process's own kernel and user time from `getrusage` and no idle time, which is the honest answer here: this host does not account for another process's idling and a title only subtracts two readings. - `GetPhysicallyInstalledSystemMemory` is `hw.memsize` in KiB. - `ntdll.dll` is now served by the same table as `kernel32`, because the `Rtl*` names live there and a title imports them from there. ## Tests Three new ones in `system.rs`: the version is filled in both forms and a wrong size is refused; the comparison answers with the operator it was given, including two fields at once; and the interrupt time moves, the process has used CPU time with no idle time, and the RAM is a Mac's.
AnastasisKon commented 2026-11-28 15:57:05 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T15:57:05Z.


/claim

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7241860466 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/624#issuecomment-7241860466). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T15:57:05Z. --- /claim
github-actions[bot] commented 2026-11-28 15:57:14 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T15:57:14Z.


Claimed by @AnastasisKon. Open a draft pull request with Refs #624 in its description within 24 hours, or the claim expires.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7241862402 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/624#issuecomment-7241862402). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T15:57:14Z. --- Claimed by @AnastasisKon. Open a draft pull request with `Refs #624` in its description within 24 hours, or the claim expires.
AnastasisKon commented 2026-11-28 16:31:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T16:31:53Z.


Merged with the PR that serves these calls; closing.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7242313534 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/624#issuecomment-7242313534). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T16:31:53Z. --- Merged with the PR that serves these calls; closing.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
LakshanSivakumar/Native-Victory-macOS#624
No description provided.