Skip to content

Commit

Permalink
Move exe check above create reg keys
Browse files Browse the repository at this point in the history
  • Loading branch information
MolotovCherry committed Jan 14, 2025
1 parent 6e0308a commit 4f297bd
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions crates/autostart-installer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,9 @@ const R_BG3: &str = r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Ex
const R_BG3_DX11: &str = r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\bg3_dx11.exe";

fn install() -> io::Result<()> {
let (bg3_key, _) = HKLM.create_subkey(R_BG3)?;
let (bg3_dx11_key, _) = HKLM.create_subkey(R_BG3_DX11)?;

let cur_exe = {
let mut c = env::current_exe()?;
c.pop();

c.join("bg3_autostart.exe")
};

Expand All @@ -78,6 +74,9 @@ fn install() -> io::Result<()> {
);
}

let (bg3_key, _) = HKLM.create_subkey(R_BG3)?;
let (bg3_dx11_key, _) = HKLM.create_subkey(R_BG3_DX11)?;

bg3_key.set_value("debugger", &&*cur_exe.to_string_lossy())?;
bg3_dx11_key.set_value("debugger", &&*cur_exe.to_string_lossy())?;

Expand Down

0 comments on commit 4f297bd

Please sign in to comment.