Files
time-mocker/crates/time-mocker-ui/build.rs
T
tiennm99 001cf53c37 feat: initial Rust port of time-mocker
Rust workspace with three crates:
- time-mocker-core: shared MockTimeInfo + named MMF helper + FILETIME helpers
- time-mocker-hook: cdylib injected into targets; inline detours via retour
  on GetSystemTime / GetLocalTime / GetSystemTimeAsFileTime /
  GetSystemTimePreciseAsFileTime / NtQuerySystemTime
- time-mocker-ui: egui controller with process list, time picker, and
  glob/regex auto-inject rules; injects via dll-syringe; UAC manifest
  embedded in release builds

IPC: 8-byte MMF named TimeMocker_<pid> holding an i64 delta in FILETIME
ticks. Hook adds delta to the real FILETIME on every call. Note this
differs from the C# version's .NET-tick delta -- contracts are not
interoperable.

Requires nightly toolchain (retour uses unboxed_closures / tuple_trait);
pinned via rust-toolchain.toml.
2026-05-20 14:59:36 +07:00

22 lines
880 B
Rust

//! Embeds a Windows UAC manifest so the controller prompts for admin
//! elevation on launch (required for `CreateRemoteThread` into other users'
//! processes and for hooking system DLLs).
fn main() {
// Only embed the UAC manifest in release builds — otherwise `cargo test`
// and other dev workflows would fail with ERROR_ELEVATION_REQUIRED (740).
println!("cargo:rerun-if-changed=build.rs");
let profile = std::env::var("PROFILE").unwrap_or_default();
if profile != "release" {
return;
}
#[cfg(windows)]
{
use embed_manifest::manifest::ExecutionLevel;
use embed_manifest::{embed_manifest, new_manifest};
let manifest = new_manifest("TimeMocker.UI")
.requested_execution_level(ExecutionLevel::RequireAdministrator);
embed_manifest(manifest).expect("failed to embed UAC manifest");
}
}