Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
felikcat committed Dec 11, 2024
1 parent de3c621 commit 5be64a4
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 181 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[package]
name = "W11Boost"
version = "1.4.1"
version = "1.4.2"
edition = "2024"
build = "build.rs"
authors = ["felikcat"]

[package.metadata.winres]
CompanyName = "felikcat"
FileDescription = "https://github.com/felikcat/W11Boost"
FileVersion = "1.4.1.0"
FileVersion = "1.4.2.0"
LegalCopyright = "© 2024 felikcat, AGPL3 License"
OriginalFilename = "W11Boost.exe"
ProductName = "W11Boost"
ProductVersion = "1.4.1.0"
ProductVersion = "1.4.2.0"

# Optimize for size.
[profile.release]
Expand All @@ -24,7 +24,7 @@ codegen-units = 1
[dependencies]
fltk-theme = "0.7.3"
curl = "0.4.47"
chrono = "0.4.38"
chrono = "0.4.39"
widestring = "1.1.0"

[dependencies.winsafe]
Expand Down Expand Up @@ -55,7 +55,7 @@ features = [
]

[dependencies.fltk]
version = "^1.4.36"
version = "^1.5"
features = [
"use-ninja"
]
Expand Down
Binary file modified Images/W11Boost_GUI.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions src/common.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
use chrono::{Datelike, Timelike, Utc};
use fltk::app;
use windows_sys::Win32::System::SystemServices::MAXIMUM_ALLOWED;
use windows_sys::Win32::System::Threading::{OpenProcess, OpenProcessToken};
use std::error::Error;
use std::os::raw::c_void;
use std::fs::{self, OpenOptions};
use std::io::Write;
use std::path::PathBuf;
use std::ptr::null_mut;
use windows::Win32::Foundation::ERROR_SUCCESS;
use windows::Win32::System::Registry::{REG_DWORD, REG_SZ, RegCreateKeyW, RegSetValueExW};
use windows_sys::Win32::Foundation::INVALID_HANDLE_VALUE;
use windows_sys::Win32::Security::{
DuplicateTokenEx, SECURITY_ATTRIBUTES, SecurityImpersonation,
TOKEN_ALL_ACCESS, TOKEN_DUPLICATE, TokenImpersonation,
};
use windows::core::PCWSTR;
use windows::{
Win32::System::{
Expand Down Expand Up @@ -345,3 +354,31 @@ pub fn save_registry_gpo(

Ok(())
}

pub fn create_access_token_from_pid(process_id: u32) -> Result<*mut c_void, Box<dyn Error>> {
let mut dup_token = INVALID_HANDLE_VALUE;
unsafe {
let process = OpenProcess(MAXIMUM_ALLOWED, 0, process_id);
if !process.is_null() {
let mut token = INVALID_HANDLE_VALUE;
OpenProcessToken(process, TOKEN_DUPLICATE, &mut token);

let attributes = SECURITY_ATTRIBUTES {
nLength: size_of::<SECURITY_ATTRIBUTES>() as u32,
lpSecurityDescriptor: null_mut(),
bInheritHandle: 0,
};

DuplicateTokenEx(
token,
TOKEN_ALL_ACCESS,
&attributes,
SecurityImpersonation,
TokenImpersonation,
&mut dup_token,
);
}
}

Ok(dup_token)
}
Loading

0 comments on commit 5be64a4

Please sign in to comment.