@@ -187,9 +187,9 @@ static int strip_prefix(LPWSTR str, int *len, LPCWSTR prefix)
187
187
static int configure_via_resource (LPWSTR basename , LPWSTR exepath , LPWSTR exep ,
188
188
LPWSTR * prefix_args , int * prefix_args_len ,
189
189
int * is_git_command , LPWSTR * working_directory , int * full_path ,
190
- int * skip_arguments , int * allocate_console )
190
+ int * skip_arguments , int * allocate_console , int * show_console )
191
191
{
192
- int id , minimal_search_path , needs_a_console , wargc ;
192
+ int id , minimal_search_path , needs_a_console , no_hide , wargc ;
193
193
LPWSTR * wargv ;
194
194
195
195
#define BUFSIZE 65536
@@ -199,6 +199,7 @@ static int configure_via_resource(LPWSTR basename, LPWSTR exepath, LPWSTR exep,
199
199
for (id = 0 ; ; id ++ ) {
200
200
minimal_search_path = 0 ;
201
201
needs_a_console = 0 ;
202
+ no_hide = 0 ;
202
203
len = LoadString (NULL , id , buf , BUFSIZE );
203
204
204
205
if (!len ) {
@@ -221,6 +222,8 @@ static int configure_via_resource(LPWSTR basename, LPWSTR exepath, LPWSTR exep,
221
222
minimal_search_path = 1 ;
222
223
else if (strip_prefix (buf , & len , L"ALLOC_CONSOLE=1 " ))
223
224
needs_a_console = 1 ;
225
+ else if (strip_prefix (buf , & len , L"SHOW_CONSOLE=1 " ))
226
+ no_hide = 1 ;
224
227
else
225
228
break ;
226
229
}
@@ -303,6 +306,8 @@ static int configure_via_resource(LPWSTR basename, LPWSTR exepath, LPWSTR exep,
303
306
* full_path = 0 ;
304
307
if (needs_a_console )
305
308
* allocate_console = 1 ;
309
+ if (no_hide )
310
+ * show_console = 1 ;
306
311
LocalFree (wargv );
307
312
308
313
return 1 ;
@@ -312,7 +317,7 @@ int main(void)
312
317
{
313
318
int r = 1 , wait = 1 , prefix_args_len = -1 , needs_env_setup = 1 ,
314
319
is_git_command = 1 , full_path = 1 , skip_arguments = 0 ,
315
- allocate_console = 0 ;
320
+ allocate_console = 0 , show_console = 0 ;
316
321
WCHAR exepath [MAX_PATH ], exe [MAX_PATH ];
317
322
LPWSTR cmd = NULL , exep = exe , prefix_args = NULL , basename ;
318
323
LPWSTR working_directory = NULL ;
@@ -332,7 +337,8 @@ int main(void)
332
337
if (configure_via_resource (basename , exepath , exep ,
333
338
& prefix_args , & prefix_args_len ,
334
339
& is_git_command , & working_directory ,
335
- & full_path , & skip_arguments , & allocate_console )) {
340
+ & full_path , & skip_arguments , & allocate_console ,
341
+ & show_console )) {
336
342
/* do nothing */
337
343
}
338
344
else if (!wcsicmp (basename , L"git-gui.exe" )) {
@@ -445,7 +451,7 @@ int main(void)
445
451
ZeroMemory (& si , sizeof (STARTUPINFO ));
446
452
si .cb = sizeof (STARTUPINFO );
447
453
448
- if (allocate_console )
454
+ if (allocate_console | show_console )
449
455
creation_flags |= CREATE_NEW_CONSOLE ;
450
456
else if ((console_handle = CreateFile (L"CONOUT$" , GENERIC_WRITE ,
451
457
FILE_SHARE_WRITE , NULL , OPEN_EXISTING ,
@@ -462,6 +468,10 @@ int main(void)
462
468
463
469
creation_flags |= CREATE_NO_WINDOW ;
464
470
}
471
+ if (show_console ) {
472
+ si .dwFlags |= STARTF_USESHOWWINDOW ;
473
+ si .wShowWindow = SW_SHOW ;
474
+ }
465
475
br = CreateProcess (/* module: null means use command line */
466
476
exep ,
467
477
cmd , /* modified command line */
0 commit comments