mirror of
https://github.com/tiennm99/time-mocker.git
synced 2026-10-16 12:15:58 +00:00
Creating a `Global\TimeMocker_<pid>` mapping requires `SeCreateGlobalPrivilege`, which an unelevated token (e.g. debug `cargo run` where the UAC manifest is intentionally skipped) does not have, so `CreateFileMappingW` returned NULL with `ERROR_ACCESS_DENIED` and the auto-inject scanner spammed `create MMF Global\TimeMocker_<pid>` for every enumerated PID. The UI now tries `Global\` first and falls back to `Local\` on access denied, with a one-shot log warning so the auto-inject loop doesn't flood. The hook DLL probes both names on attach so the IPC pairs up symmetrically. Release builds keep their elevated `Global\` cross-session reach; debug builds work against same-session targets without admin. Also adds a dedicated `time-mocker-test-target` crate — a small console binary that prints all 5 hooked time APIs every second with its own PID banner, so dev verification can inject into a controlled harness instead of arbitrary running processes.
23 lines
645 B
TOML
23 lines
645 B
TOML
[package]
|
|
name = "time-mocker-test-target"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
authors.workspace = true
|
|
repository.workspace = true
|
|
rust-version.workspace = true
|
|
description = "Dedicated injection target — prints all 5 hooked time APIs in a loop so you can verify the hook DLL without touching arbitrary running processes"
|
|
|
|
[[bin]]
|
|
name = "time_mocker_test_target"
|
|
path = "src/main.rs"
|
|
|
|
[dependencies]
|
|
windows-sys = { workspace = true, features = [
|
|
"Win32_Foundation",
|
|
"Win32_System_LibraryLoader",
|
|
"Win32_System_SystemInformation",
|
|
"Win32_System_Threading",
|
|
"Win32_System_Time",
|
|
] }
|