This commit is contained in:
beerpiss 2024-07-05 13:29:08 +07:00
parent 4fee755ab4
commit 82d4aec27c
3 changed files with 4 additions and 4 deletions

View File

@ -1,3 +1,4 @@
#![cfg(windows)]
mod config;
mod consts;
mod helpers;

View File

@ -18,7 +18,7 @@ pub static mut GET_PROCESS_HEAP_PTR: PROC = ptr::null_mut();
#[link_section = ".rtext"]
#[used]
pub static mut REPLCE_FILE_W_PTR: PROC = ptr::null_mut();
pub static mut REPLACE_FILE_W_PTR: PROC = ptr::null_mut();
#[link_section = ".rtext"]
#[used]
@ -59,7 +59,7 @@ pub unsafe extern "system" fn replace_with_new_library(parameter: *const c_void)
let GetModuleFileNameA =
std::mem::transmute::<PROC, GetModuleFileNameAFn>(GET_MODULE_FILE_NAME_A_PTR);
let GetProcessHeap = std::mem::transmute::<PROC, GetProcessHeapFn>(GET_PROCESS_HEAP_PTR);
let ReplaceFileW = std::mem::transmute::<PROC, ReplaceFileWFn>(REPLCE_FILE_W_PTR);
let ReplaceFileW = std::mem::transmute::<PROC, ReplaceFileWFn>(REPLACE_FILE_W_PTR);
let LoadLibraryW = std::mem::transmute::<PROC, LoadLibraryWFn>(LOAD_LIBRARY_W_PTR);
let HeapFree = std::mem::transmute::<PROC, HeapFreeFn>(HEAP_FREE_PTR);
let Sleep = std::mem::transmute::<PROC, SleepFn>(SLEEP_PTR);

View File

@ -235,7 +235,7 @@ pub fn self_update(module: &LibraryHandle) -> Result<bool, SelfUpdateError> {
external::GET_PROCESS_HEAP_PTR = kernel32.symbol("GetProcessHeap").unwrap();
external::HEAP_FREE_PTR = kernel32.symbol("HeapFree").unwrap();
external::LOAD_LIBRARY_W_PTR = kernel32.symbol("LoadLibraryW").unwrap();
external::REPLCE_FILE_W_PTR = kernel32.symbol("ReplaceFileW").unwrap();
external::REPLACE_FILE_W_PTR = kernel32.symbol("ReplaceFileW").unwrap();
external::SLEEP_PTR = kernel32.symbol("Sleep").unwrap();
debug!("Locating updater code...");
@ -303,7 +303,6 @@ pub fn self_update(module: &LibraryHandle) -> Result<bool, SelfUpdateError> {
&mut old_protect,
);
// 0x00007FFB13A63A14
if result == 0 {
return Err(SelfUpdateError::FailedVirtualProtect {
errno: GetLastError(),