mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-20 01:45:12 -04:00
[misc] fix application closing when terminating console, when -g is used
* Closes #1243 * Closes #1244
This commit is contained in:
parent
08019ea67c
commit
2ba62fa891
2 changed files with 18 additions and 20 deletions
28
src/rufus.c
Normal file → Executable file
28
src/rufus.c
Normal file → Executable file
|
@ -2694,7 +2694,7 @@ static void PrintUsage(char* appname)
|
||||||
printf(" This usage guide.\n");
|
printf(" This usage guide.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static HANDLE SetHogger(BOOL attached_console, BOOL disable_hogger)
|
static HANDLE SetHogger(void)
|
||||||
{
|
{
|
||||||
INPUT* input;
|
INPUT* input;
|
||||||
BYTE* hog_data;
|
BYTE* hog_data;
|
||||||
|
@ -2702,12 +2702,9 @@ static HANDLE SetHogger(BOOL attached_console, BOOL disable_hogger)
|
||||||
HANDLE hogmutex = NULL, hFile = NULL;
|
HANDLE hogmutex = NULL, hFile = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!attached_console)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
hog_data = GetResource(hMainInstance, MAKEINTRESOURCEA(IDR_XT_HOGGER),
|
hog_data = GetResource(hMainInstance, MAKEINTRESOURCEA(IDR_XT_HOGGER),
|
||||||
_RT_RCDATA, cmdline_hogger, &hog_size, FALSE);
|
_RT_RCDATA, cmdline_hogger, &hog_size, FALSE);
|
||||||
if ((hog_data != NULL) && (!disable_hogger)) {
|
if (hog_data != NULL) {
|
||||||
// Create our synchronisation mutex
|
// Create our synchronisation mutex
|
||||||
hogmutex = CreateMutexA(NULL, TRUE, "Global/Rufus_CmdLine");
|
hogmutex = CreateMutexA(NULL, TRUE, "Global/Rufus_CmdLine");
|
||||||
|
|
||||||
|
@ -2806,15 +2803,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||||
|
|
||||||
uprintf("*** " APPLICATION_NAME " init ***\n");
|
uprintf("*** " APPLICATION_NAME " init ***\n");
|
||||||
|
|
||||||
// Reattach the console, if we were started from commandline
|
|
||||||
if (AttachConsole(ATTACH_PARENT_PROCESS) != 0) {
|
|
||||||
attached_console = TRUE;
|
|
||||||
IGNORE_RETVAL(freopen("CONIN$", "r", stdin));
|
|
||||||
IGNORE_RETVAL(freopen("CONOUT$", "w", stdout));
|
|
||||||
IGNORE_RETVAL(freopen("CONOUT$", "w", stderr));
|
|
||||||
_flushall();
|
|
||||||
}
|
|
||||||
|
|
||||||
// We have to process the arguments before we acquire the lock and process the locale
|
// We have to process the arguments before we acquire the lock and process the locale
|
||||||
PF_INIT(__wgetmainargs, Msvcrt);
|
PF_INIT(__wgetmainargs, Msvcrt);
|
||||||
if (pf__wgetmainargs != NULL) {
|
if (pf__wgetmainargs != NULL) {
|
||||||
|
@ -2843,7 +2831,17 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||||
ini_flags[0] = 'a';
|
ini_flags[0] = 'a';
|
||||||
|
|
||||||
// Now enable the hogger before processing the rest of the arguments
|
// Now enable the hogger before processing the rest of the arguments
|
||||||
hogmutex = SetHogger(attached_console, disable_hogger);
|
if (!disable_hogger) {
|
||||||
|
// Reattach the console, if we were started from commandline
|
||||||
|
if (AttachConsole(ATTACH_PARENT_PROCESS) != 0) {
|
||||||
|
attached_console = TRUE;
|
||||||
|
IGNORE_RETVAL(freopen("CONIN$", "r", stdin));
|
||||||
|
IGNORE_RETVAL(freopen("CONOUT$", "w", stdout));
|
||||||
|
IGNORE_RETVAL(freopen("CONOUT$", "w", stderr));
|
||||||
|
_flushall();
|
||||||
|
hogmutex = SetHogger();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while ((opt = getopt_long(argc, argv, "?xghf:i:w:l:", long_options, &option_index)) != EOF) {
|
while ((opt = getopt_long(argc, argv, "?xghf:i:w:l:", long_options, &option_index)) != EOF) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
EXSTYLE WS_EX_ACCEPTFILES
|
EXSTYLE WS_EX_ACCEPTFILES
|
||||||
CAPTION "Rufus 3.4.1422"
|
CAPTION "Rufus 3.4.1423"
|
||||||
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
||||||
|
@ -392,8 +392,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 3,4,1422,0
|
FILEVERSION 3,4,1423,0
|
||||||
PRODUCTVERSION 3,4,1422,0
|
PRODUCTVERSION 3,4,1423,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -411,13 +411,13 @@ BEGIN
|
||||||
VALUE "Comments", "https://akeo.ie"
|
VALUE "Comments", "https://akeo.ie"
|
||||||
VALUE "CompanyName", "Akeo Consulting"
|
VALUE "CompanyName", "Akeo Consulting"
|
||||||
VALUE "FileDescription", "Rufus"
|
VALUE "FileDescription", "Rufus"
|
||||||
VALUE "FileVersion", "3.4.1422"
|
VALUE "FileVersion", "3.4.1423"
|
||||||
VALUE "InternalName", "Rufus"
|
VALUE "InternalName", "Rufus"
|
||||||
VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)"
|
VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)"
|
||||||
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
|
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
|
||||||
VALUE "OriginalFilename", "rufus-3.4.exe"
|
VALUE "OriginalFilename", "rufus-3.4.exe"
|
||||||
VALUE "ProductName", "Rufus"
|
VALUE "ProductName", "Rufus"
|
||||||
VALUE "ProductVersion", "3.4.1422"
|
VALUE "ProductVersion", "3.4.1423"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue