From 9f1c61f06b05afe252d526d40f5d04a9a9576f53 Mon Sep 17 00:00:00 2001
From: SuchAFuriousDeath <48620541+SuchAFuriousDeath@users.noreply.github.com>
Date: Sun, 12 Jan 2025 15:52:50 +0100
Subject: [PATCH] Implements open_dir and write_data_root for Windows. (#1243)
---
.vscode/tasks.json | 3 ++
gui/Cargo.toml | 5 +++
gui/src/setup/windows.rs | 71 +++++++++++++++++++++++++++++-----
gui/src/ui/windows/dialogs.rs | 72 ++++++++++++++++++++++++++++++++++-
4 files changed, 140 insertions(+), 11 deletions(-)
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 03aa350b7..fadcb70a5 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -29,6 +29,9 @@
"osx": {
"command": "${workspaceFolder}/dist/Obliteration.app/Contents/MacOS/Obliteration"
},
+ "windows": {
+ "command": "${workspaceFolder}/dist/obliteration.exe"
+ },
"args": [
"--debug",
"127.0.0.1:1234"
diff --git a/gui/Cargo.toml b/gui/Cargo.toml
index 7ed6fc73b..adbdad72e 100644
--- a/gui/Cargo.toml
+++ b/gui/Cargo.toml
@@ -75,11 +75,16 @@ windows-sys = { version = "0.59.0", features = [
"Win32_Foundation",
"Win32_Security",
"Win32_System",
+ "Win32_System_Com",
"Win32_System_Hypervisor",
"Win32_System_Memory",
"Win32_System_Registry",
"Win32_System_SystemInformation",
"Win32_UI",
+ "Win32_UI_Controls",
+ "Win32_UI_Controls_Dialogs",
+ "Win32_UI_Shell",
+ "Win32_UI_Shell_Common",
"Win32_UI_WindowsAndMessaging",
] }
diff --git a/gui/src/setup/windows.rs b/gui/src/setup/windows.rs
index fe9a4941e..4cc2d625a 100644
--- a/gui/src/setup/windows.rs
+++ b/gui/src/setup/windows.rs
@@ -3,10 +3,12 @@ use thiserror::Error;
use windows_sys::w;
use windows_sys::Win32::Foundation::{ERROR_FILE_NOT_FOUND, ERROR_SUCCESS};
use windows_sys::Win32::System::Registry::{
- RegCloseKey, RegCreateKeyExW, RegQueryValueExW, HKEY, HKEY_CURRENT_USER, KEY_ALL_ACCESS,
- REG_OPTION_NON_VOLATILE, REG_SZ,
+ RegCloseKey, RegCreateKeyExW, RegQueryValueExW, RegSetValueExW, HKEY, HKEY_CURRENT_USER,
+ KEY_ALL_ACCESS, REG_OPTION_NON_VOLATILE, REG_SZ,
};
+const FQVN: &str = "HKEY_CURRENT_USER\\Software\\OBHQ\\Obliteration\\DataRoot";
+
pub fn read_data_root() -> Result