[PATCH] [bug9283] cmd.exe redirection for external programs broken

Jason Edmeades jason.edmeades at googlemail.com
Sun Aug 12 16:29:03 CDT 2007


This was broken by the conversion to unicode, where the msvcrt internal
io block calculation needs to remain using chars (not WCHARS).
---
 programs/cmd/wcmdmain.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index 775a553..8318590 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -839,13 +839,13 @@ static void init_msvcrt_io_block(STARTUPINFO* st)
          * to change those std handles (this depends on the way wcmd sets
          * it's new input & output handles)
          */
-        size_t sz = max(sizeof(unsigned) + (sizeof(WCHAR) + sizeof(HANDLE)) * 3, st_p.cbReserved2);
+        size_t sz = max(sizeof(unsigned) + (sizeof(char) + sizeof(HANDLE)) * 3, st_p.cbReserved2);
         BYTE* ptr = HeapAlloc(GetProcessHeap(), 0, sz);
         if (ptr)
         {
             unsigned num = *(unsigned*)st_p.lpReserved2;
-            WCHAR* flags = (WCHAR*)(ptr + sizeof(unsigned));
-            HANDLE* handles = (HANDLE*)(flags + num * sizeof(WCHAR));
+            char* flags = (char*)(ptr + sizeof(unsigned));
+            HANDLE* handles = (HANDLE*)(flags + num * sizeof(char));
 
             memcpy(ptr, st_p.lpReserved2, st_p.cbReserved2);
             st->cbReserved2 = sz;
-- 
1.5.0




More information about the wine-patches mailing list