Skip to content

Commit d4a1e0b

Browse files
committed
Enable start of Xming if Vcxsrv isn't installed
1 parent 30a7bd2 commit d4a1e0b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

BSCP/ConfigurableShell/ConfigurableShell.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,12 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
118118
WCHAR* xming_val = prov.pwszGetValueAt_sz(s_RegistryKey_Shell, TEXT("xming"), &cbXming, &ccXming);
119119
//execute shell command
120120
if (_wcsicmp(xming_val, TEXT("true")) == 0) {
121-
//char* x = "C:\\Program Files (x86)\\Xming\\Xming.exe :0 -clipboard -fullscreen";
122-
char* x = "C:\\Program Files\\VcXsrv\\vcxsrv.exe :0 -clipboard -fullscreen -wgl";
123-
WinExec(x, SW_SHOW);
121+
char* x = "\"C:\\Program Files\\VcXsrv\\vcxsrv.exe\" :0 -clipboard -fullscreen -wgl"; //first try with optimized Xming
122+
result = WinExec(x, SW_SHOW);
123+
if (result <= 31) { //Error state, try again
124+
char* y = "\"C:\\Program Files (x86)\\Xming\\Xming.exe\" :0 -clipboard -fullscreen";
125+
result = WinExec(y, SW_SHOW);
126+
}
124127
}
125128
result = prov.EnsureKeyValueSet_sz(s_WinlogonKey, s_WinLogonValue, TEXT("explorer.exe"), &length_logon_value);
126129
ShellExecute(NULL, TEXT("Open"), console_val, shell_val, NULL, SW_HIDE);

0 commit comments

Comments
 (0)