figure out how to programmatically make .rtext writable

This commit is contained in:
beerpiss 2024-06-27 02:44:04 +07:00
parent cd3c1a9fcd
commit 2296f79908
2 changed files with 11 additions and 2 deletions

View File

@ -8,5 +8,15 @@ pub fn main() -> Result<(), Whatever> {
.git_branch()
.emit()
.with_whatever_context(|_| "Could not emit version information")?;
// This makes it possible to write function pointers to the .rtext section.
// Otherwise, the hook crashes. This is obviously MSVC specific, but who uses
// i686-pc-windows-gnu anyways.
if std::env::var("TARGET").unwrap().ends_with("msvc") {
println!("cargo::rustc-link-arg=/SECTION:.rtext,RW");
} else {
println!("cargo::warning=You're not using MSVC. The hook's .rtext section will not be writable, which will cause a crash when performing a self-update.");
}
Ok(())
}

View File

@ -12,5 +12,4 @@ if (!(Test-Path ./saekawa.pfx)) {
}
signtool sign -f saekawa.pfx -p "saekawa" -fd SHA256 -t http://timestamp.comodoca.com/authenticode -v target/i686-pc-windows-msvc/release/saekawa.dll
Write-Output "Remember to make the .rtext section writable for auto-updates! I have fuck all idea how to do it in Rust itself, so it's manual from here. The DLL has already been signed."
sha256sum target/i686-pc-windows-msvc/release/saekawa.dll