address headers with their proper names

This commit is contained in:
DrFrugal 2023-07-16 19:31:38 +02:00
parent f2e1292e72
commit 143884f8b9
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "laa_toggle" name = "laa_toggle"
version = "0.1.1" version = "0.1.2"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -37,11 +37,11 @@ fn main() {
Err(error) => abort("Failed to open EXE in read/write mode", Some(&error)) Err(error) => abort("Failed to open EXE in read/write mode", Some(&error))
}; };
if let Err(error) = file.seek_read(&mut buffer4, 0x3C) { if let Err(error) = file.seek_read(&mut buffer4, 0x3C) {
abort("Failed to read e_lfanew of MS DOS stub", Some(&error)); abort("Failed to read e_lfanew of MS-DOS stub", Some(&error));
} }
let address_coff_characteristics = (u32::from_le_bytes(buffer4) + 0x4 + 0x12) as u64; // real data starts after "PE\0\0" string (first 4 Bytes) let address_coff_characteristics = (u32::from_le_bytes(buffer4) + 0x4 + 0x12) as u64; // real data starts after "PE\0\0" string (first 4 Bytes)
if let Err(error) = file.seek_read(&mut buffer2, address_coff_characteristics) { if let Err(error) = file.seek_read(&mut buffer2, address_coff_characteristics) {
abort("Failed to read Characteristics from PE header", Some(&error)); abort("Failed to read Characteristics from COFF file header", Some(&error));
} }
let is_laa_enabled = buffer2[0] & IMAGE_FILE_LARGE_ADDRESS_AWARE != 0; let is_laa_enabled = buffer2[0] & IMAGE_FILE_LARGE_ADDRESS_AWARE != 0;
println!("LAA currently enabled: {}\nDo you want to change that [y/n]?", is_laa_enabled); println!("LAA currently enabled: {}\nDo you want to change that [y/n]?", is_laa_enabled);