From 626370f6aa922dd0da3abdf19e590fa8cb95f5f0 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Sat, 1 Oct 2005 12:50:16 +0000 Subject: [PATCH] check for and write new lines as ascii only in copy /A, regardless of whether cmd was compiled as unicode or ansi svn path=/trunk/; revision=18188 --- reactos/subsys/system/cmd/copy.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/reactos/subsys/system/cmd/copy.c b/reactos/subsys/system/cmd/copy.c index 20c5f50ada1..afde0173e52 100644 --- a/reactos/subsys/system/cmd/copy.c +++ b/reactos/subsys/system/cmd/copy.c @@ -240,7 +240,8 @@ int copy (TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFl { for (i = 0; i < dwRead; i++) { - if (((LPTSTR)buffer)[i] == 0x1A) + /* we're dealing with ASCII files! */ + if (((LPSTR)buffer)[i] == 0x1A) { bEof = TRUE; break; @@ -273,12 +274,13 @@ int copy (TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFl if (lpdwFlags & COPY_ASCII) { - ((LPTSTR)buffer)[0] = 0x1A; - ((LPTSTR)buffer)[1] = _T('\0'); + /* we're dealing with ASCII files! */ + ((LPSTR)buffer)[0] = 0x1A; + ((LPSTR)buffer)[1] = '\0'; #ifdef _DEBUG DebugPrintf (_T("appending ^Z\n")); #endif - WriteFile (hFileDest, buffer, sizeof(TCHAR), &dwWritten, NULL); + WriteFile (hFileDest, buffer, sizeof(CHAR), &dwWritten, NULL); } free (buffer);