[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 6/6] Discover cmd.exe using GetSystemDirectory


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Tu Dinh" <ngoc-tu.dinh@xxxxxxxxxx>
  • Date: Tue, 14 Apr 2026 11:44:29 +0000
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=mte1 header.d=mandrillapp.com header.i="@mandrillapp.com" header.h="From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:Date:MIME-Version:Content-Type:Content-Transfer-Encoding"; dkim=pass header.s=mte1 header.d=vates.tech header.i="ngoc-tu.dinh@xxxxxxxxxx" header.h="From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:Date:MIME-Version:Content-Type:Content-Transfer-Encoding"
  • Cc: "Tu Dinh" <ngoc-tu.dinh@xxxxxxxxxx>, "Owen Smith" <owen.smith@xxxxxxxxxx>
  • Delivery-date: Tue, 14 Apr 2026 11:44:33 +0000
  • Feedback-id: 30504962:30504962.20260414:md
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

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 a04c2ea..be6815c 100644
--- a/src/tty/tty.c
+++ b/src/tty/tty.c
@@ -141,7 +141,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;
@@ -149,6 +150,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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.