diff options
| author | Ave | 2024-04-12 00:44:51 +0000 |
|---|---|---|
| committer | Ave | 2024-04-12 00:44:51 +0000 |
| commit | 044af0e99d40a449c855d989feb7ad8ff042783f (patch) | |
| tree | 7feb37ab1d5b6f5fb9bb18fbae15ccd913b08b15 /src/lib.rs | |
| parent | 6d7c85fb2ce657e8e5a79c3223dd981958176ff8 (diff) | |
| download | ohook-rs-main.zip | |
This affects the source code only, output binary hashes remain the same.
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -4,46 +4,46 @@ mod sppcs; mod win32; use core::{ffi::c_void, ptr::null_mut}; -use win32::{LocalFree, StrStrNIW, SL_LICENSING_STATUS}; -use win32::{SLGetLicensingStatusInformation, SLGetProductSkuInformation}; - -use windows_sys::{ - core::{GUID, PCWSTR}, - w, +use win32::{ + Guid, LocalFree, SLGetLicensingStatusInformation, SLGetProductSkuInformation, StrStrNIW, + SL_LICENSING_STATUS, }; -unsafe fn is_grace_period_product(hslc: *const c_void, pproductskuid: *const GUID) -> bool { +const GRACE: [u16; 6] = [0x47, 0x72, 0x61, 0x63, 0x65, 0x00]; +const NAME: [u16; 5] = [0x4e, 0x61, 0x6d, 0x65, 0x00]; + +unsafe fn is_grace_period_product(hslc: *const c_void, pproductskuid: *const Guid) -> bool { let mut p_buffer = null_mut(); let mut cb_size = 0; if SLGetProductSkuInformation( hslc, pproductskuid, - w!("Name"), + NAME.as_ptr(), null_mut(), &mut cb_size, &mut p_buffer, ) != 0 { - LocalFree(p_buffer as *mut c_void); + LocalFree(p_buffer.cast()); return false; } - if !StrStrNIW(p_buffer as *const u16, w!("Grace"), cb_size).is_null() { - LocalFree(p_buffer as *mut c_void); + if !StrStrNIW(p_buffer.cast(), GRACE.as_ptr(), cb_size).is_null() { + LocalFree(p_buffer.cast()); return true; } - LocalFree(p_buffer as *mut c_void); + LocalFree(p_buffer.cast()); false } #[no_mangle] unsafe extern "system" fn SLGetLicensingStatusInformationHook( hslc: *const c_void, - pappid: *const GUID, - pproductskuid: *const GUID, - pwszrightname: PCWSTR, + pappid: *const Guid, + pproductskuid: *const Guid, + pwszrightname: *const u16, pnstatuscount: *mut u32, pplicensingstatus: *mut *mut SL_LICENSING_STATUS, ) -> i32 { |
