2018-08-02 16:28:30 -07:00
|
|
|
From 9d6b3e42916fbbd52a3fe9920c329dbe3d20330b Mon Sep 17 00:00:00 2001
|
2015-09-01 21:28:05 -07:00
|
|
|
From: Qian Hong <qhong@codeweavers.com>
|
|
|
|
Date: Sun, 26 Jul 2015 17:55:01 +0800
|
2018-05-09 15:26:38 -07:00
|
|
|
Subject: [PATCH] kernel32: Fallback to default comspec when %COMSPEC% is not
|
|
|
|
set.
|
2015-09-01 21:28:05 -07:00
|
|
|
|
|
|
|
---
|
|
|
|
dlls/kernel32/process.c | 6 +++++-
|
|
|
|
programs/cmd/wcmdmain.c | 10 ++++++++++
|
|
|
|
2 files changed, 15 insertions(+), 1 deletion(-)
|
|
|
|
|
|
|
|
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
|
2018-08-02 16:28:30 -07:00
|
|
|
index d9673d7..f568022 100644
|
2015-09-01 21:28:05 -07:00
|
|
|
--- a/dlls/kernel32/process.c
|
|
|
|
+++ b/dlls/kernel32/process.c
|
2018-08-02 16:28:30 -07:00
|
|
|
@@ -2325,6 +2325,7 @@ static BOOL create_cmd_process( LPCWSTR filename, LPWSTR cmd_line, LPVOID env, L
|
2015-09-01 21:28:05 -07:00
|
|
|
|
|
|
|
{
|
|
|
|
static const WCHAR comspecW[] = {'C','O','M','S','P','E','C',0};
|
|
|
|
+ static const WCHAR cmdW[] = {'\\','c','m','d','.','e','x','e',0};
|
2018-05-09 15:26:38 -07:00
|
|
|
static const WCHAR slashscW[] = {' ','/','s','/','c',' ',0};
|
|
|
|
static const WCHAR quotW[] = {'"',0};
|
2015-09-01 21:28:05 -07:00
|
|
|
WCHAR comspec[MAX_PATH];
|
2018-08-02 16:28:30 -07:00
|
|
|
@@ -2332,7 +2333,10 @@ static BOOL create_cmd_process( LPCWSTR filename, LPWSTR cmd_line, LPVOID env, L
|
2015-09-01 21:28:05 -07:00
|
|
|
BOOL ret;
|
|
|
|
|
2018-08-02 16:28:30 -07:00
|
|
|
if (!GetEnvironmentVariableW( comspecW, comspec, ARRAY_SIZE( comspec )))
|
2015-09-01 21:28:05 -07:00
|
|
|
- return FALSE;
|
|
|
|
+ {
|
|
|
|
+ GetSystemDirectoryW( comspec, (sizeof(comspec) - sizeof(cmdW))/sizeof(WCHAR) );
|
|
|
|
+ strcatW( comspec, cmdW );
|
|
|
|
+ }
|
|
|
|
if (!(newcmdline = HeapAlloc( GetProcessHeap(), 0,
|
2018-05-09 15:26:38 -07:00
|
|
|
(strlenW(comspec) + 7 + strlenW(cmd_line) + 2) * sizeof(WCHAR))))
|
2015-09-01 21:28:05 -07:00
|
|
|
return FALSE;
|
|
|
|
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
|
2018-08-02 16:28:30 -07:00
|
|
|
index 8fe2d57..3573885 100644
|
2015-09-01 21:28:05 -07:00
|
|
|
--- a/programs/cmd/wcmdmain.c
|
|
|
|
+++ b/programs/cmd/wcmdmain.c
|
2018-08-02 16:28:30 -07:00
|
|
|
@@ -2348,10 +2348,20 @@ int wmain (int argc, WCHAR *argvW[])
|
2015-09-01 21:28:05 -07:00
|
|
|
static const WCHAR offW[] = {'O','F','F','\0'};
|
|
|
|
static const WCHAR promptW[] = {'P','R','O','M','P','T','\0'};
|
|
|
|
static const WCHAR defaultpromptW[] = {'$','P','$','G','\0'};
|
|
|
|
+ static const WCHAR comspecW[] = {'C','O','M','S','P','E','C',0};
|
|
|
|
+ static const WCHAR cmdW[] = {'\\','c','m','d','.','e','x','e',0};
|
|
|
|
+ WCHAR comspec[MAX_PATH];
|
|
|
|
CMD_LIST *toExecute = NULL; /* Commands left to be executed */
|
|
|
|
OSVERSIONINFOW osv;
|
|
|
|
char osver[50];
|
|
|
|
|
|
|
|
+ if (!GetEnvironmentVariableW(comspecW, comspec, sizeof(comspec)/sizeof(WCHAR)))
|
|
|
|
+ {
|
|
|
|
+ GetSystemDirectoryW(comspec, (sizeof(comspec) - sizeof(cmdW))/sizeof(WCHAR));
|
|
|
|
+ strcatW(comspec, cmdW);
|
|
|
|
+ SetEnvironmentVariableW(comspecW, comspec);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
srand(time(NULL));
|
|
|
|
|
|
|
|
/* Get the windows version being emulated */
|
|
|
|
--
|
2018-05-09 15:26:38 -07:00
|
|
|
1.9.1
|
2015-09-01 21:28:05 -07:00
|
|
|
|