mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-28 13:44:15 -04:00
[loc] fix crash when two Rufus applications are running
* Closes #261 * Also remove the need for a separate get_loc_data_file call to initialize the en-US messages * Also fix a possible issue with setLGP
This commit is contained in:
parent
83a9ec472c
commit
0f02284164
3 changed files with 29 additions and 34 deletions
10
src/rufus.c
10
src/rufus.c
|
@ -2064,7 +2064,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
{
|
||||
const char* old_wait_option = "/W";
|
||||
int i, opt, option_index = 0, argc = 0, si = 0, lcid = GetUserDefaultUILanguage();
|
||||
BOOL attached_console = FALSE, external_loc_file = FALSE;
|
||||
BOOL attached_console = FALSE, external_loc_file = FALSE, lgp_set = FALSE;
|
||||
BYTE* loc_data;
|
||||
DWORD loc_size, Size;
|
||||
char tmp_path[MAX_PATH], loc_file[MAX_PATH] = "", *tmp, *locale_name = NULL;
|
||||
|
@ -2215,10 +2215,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
|
||||
// We use local group policies rather than direct registry manipulation
|
||||
// 0x9e disables removable and fixed drive notifications
|
||||
SetLGP(FALSE, &existing_key, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", "NoDriveTypeAutorun", 0x9e);
|
||||
|
||||
// Populate the default locale (so that we can produce English messages in the log)
|
||||
get_loc_data_file(loc_file, NULL);
|
||||
lgp_set = SetLGP(FALSE, &existing_key, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", "NoDriveTypeAutorun", 0x9e);
|
||||
|
||||
relaunch:
|
||||
uprintf("localization: using locale '%s'\n", selected_locale->txt[0]);
|
||||
|
@ -2343,7 +2340,8 @@ out:
|
|||
for (i=0; i<argc; i++) safe_free(argv[i]);
|
||||
safe_free(argv);
|
||||
}
|
||||
SetLGP(TRUE, &existing_key, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", "NoDriveTypeAutorun", 0);
|
||||
if (lgp_set)
|
||||
SetLGP(TRUE, &existing_key, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", "NoDriveTypeAutorun", 0);
|
||||
if (attached_console)
|
||||
DetachConsole();
|
||||
CloseHandle(mutex);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue