|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 6/6] Discover cmd.exe using GetSystemDirectory
Don't assume that the system directory is always c:\windows\system32.
Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
src/tty/tty.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/tty/tty.c b/src/tty/tty.c
index 00ecb76..b8629d5 100644
--- a/src/tty/tty.c
+++ b/src/tty/tty.c
@@ -102,7 +102,8 @@ CreateChild(
)
{
PTTY_CONTEXT Context = &TtyContext;
- CHAR CommandLine[] = "c:\\windows\\system32\\cmd.exe /q
/a";
+ CHAR SystemDir[MAX_PATH];
+ CHAR CommandLine[MAX_PATH];
PVOID Environment;
PROFILEINFOA ProfileInfo;
DWORD Size;
@@ -110,6 +111,15 @@ CreateChild(
STARTUPINFOA StartupInfo;
BOOL Success;
+ if (!GetSystemDirectoryA(SystemDir, sizeof(SystemDir)))
+ return FALSE;
+
+ if (!SUCCEEDED(StringCchPrintfA(CommandLine,
+ sizeof(CommandLine),
+ "%s\\cmd.exe /q /a",
+ SystemDir)))
+ return FALSE;
+
Success = CreateEnvironmentBlock(&Environment,
Context->Token,
FALSE);
--
2.53.0.windows.2
--
Ngoc Tu Dinh | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |