Skip to content

Commit 4923f0c

Browse files
committed
Refactoring
1 parent d45ad81 commit 4923f0c

2 files changed

Lines changed: 0 additions & 37 deletions

File tree

msixbundle/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,3 @@ winreg = { version = "0.55", optional = true }
2323

2424
[dev-dependencies]
2525
tempfile = "3"
26-
27-
[target.'cfg(windows)'.dev-dependencies]
28-
windows-sys = { version = "0.59", features = ["Win32_Security", "Win32_System_Threading", "Win32_Foundation"] }

msixbundle/tests/integration.rs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,6 @@ use msixbundle::*;
44
use std::path::Path;
55
use tempfile::tempdir;
66

7-
fn is_elevated() -> bool {
8-
use std::mem;
9-
use windows_sys::Win32::Foundation::CloseHandle;
10-
use windows_sys::Win32::Security::{
11-
GetTokenInformation, OpenProcessToken, TokenElevation, TOKEN_ELEVATION, TOKEN_QUERY,
12-
};
13-
use windows_sys::Win32::System::Threading::GetCurrentProcess;
14-
15-
unsafe {
16-
let mut token = std::mem::zeroed();
17-
if OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &mut token) == 0 {
18-
return false;
19-
}
20-
21-
let mut elevation: TOKEN_ELEVATION = mem::zeroed();
22-
let mut size = mem::size_of::<TOKEN_ELEVATION>() as u32;
23-
24-
let result = GetTokenInformation(
25-
token,
26-
TokenElevation,
27-
&mut elevation as *mut _ as *mut _,
28-
size,
29-
&mut size,
30-
);
31-
32-
CloseHandle(token);
33-
result != 0 && elevation.TokenIsElevated != 0
34-
}
35-
}
36-
377
fn create_minimal_appx_content(dir: &Path) {
388
let manifest = r#"<?xml version="1.0" encoding="utf-8"?>
399
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
@@ -428,8 +398,6 @@ fn test_read_manifest_missing_version() {
428398

429399
#[test]
430400
fn test_validate_msix() {
431-
assert!(is_elevated(), "test requires admin elevation");
432-
433401
let tools = locate_sdk_tools().expect("locate SDK");
434402
assert!(tools.appcert.is_some(), "WACK not installed");
435403

@@ -445,8 +413,6 @@ fn test_validate_msix() {
445413

446414
#[test]
447415
fn test_validate_bundle() {
448-
assert!(is_elevated(), "test requires admin elevation");
449-
450416
let tools = locate_sdk_tools().expect("locate SDK");
451417
assert!(tools.appcert.is_some(), "WACK not installed");
452418

0 commit comments

Comments
 (0)