diff --git a/reactos/subsys/system/cmd/cmd.c b/reactos/subsys/system/cmd/cmd.c index d97f56d207a..60a7a9ffc72 100644 --- a/reactos/subsys/system/cmd/cmd.c +++ b/reactos/subsys/system/cmd/cmd.c @@ -643,6 +643,8 @@ DoCommand (LPTSTR line) } } } + /* Just in case a CTRL+C slipped through a command */ + bCtrlBreak = FALSE; free(com); } diff --git a/reactos/subsys/system/cmd/copy.c b/reactos/subsys/system/cmd/copy.c index afde0173e52..a8dbbf53e2f 100644 --- a/reactos/subsys/system/cmd/copy.c +++ b/reactos/subsys/system/cmd/copy.c @@ -51,7 +51,12 @@ enum #define BUFF_SIZE 16384 /* 16k = max buffer size */ -int copy (TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch) +INT +copy (TCHAR source[MAX_PATH], + TCHAR dest[MAX_PATH], + INT append, + DWORD lpdwFlags, + BOOL bTouch) { TCHAR szMsg[RC_STRING_MAX_SIZE]; FILETIME srctime,NewFileTime; @@ -68,6 +73,9 @@ int copy (TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFl TCHAR * FileName; SYSTEMTIME CurrentTime; + /* Check Breaker */ + if(CheckCtrlBreak(BREAK_INPUT)) + return 0; #ifdef _DEBUG DebugPrintf (_T("checking mode\n")); @@ -235,6 +243,7 @@ int copy (TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFl do { + ReadFile (hFileSrc, buffer, BUFF_SIZE, &dwRead, NULL); if (lpdwFlags & COPY_ASCII) { @@ -254,14 +263,14 @@ int copy (TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFl break; WriteFile (hFileDest, buffer, dwRead, &dwWritten, NULL); - if (dwWritten != dwRead) + if (dwWritten != dwRead || CheckCtrlBreak(BREAK_INPUT)) { ConOutResPuts(STRING_COPY_ERROR3); free (buffer); CloseHandle (hFileDest); CloseHandle (hFileSrc); - nErrorLevel = 1; + nErrorLevel = 1; return 0; } } @@ -731,6 +740,12 @@ INT cmd_copy (LPTSTR cmd, LPTSTR param) do { + /* Check Breaker */ + if(CheckCtrlBreak(BREAK_INPUT)) + { + freep(arg); + return 1; + } /* Set the override to yes each new file */ nOverwrite = 1; diff --git a/reactos/subsys/system/cmd/del.c b/reactos/subsys/system/cmd/del.c index 9fd64892ec0..8d5afb2a9e9 100644 --- a/reactos/subsys/system/cmd/del.c +++ b/reactos/subsys/system/cmd/del.c @@ -107,7 +107,8 @@ RemoveFile (LPTSTR lpFileName, DWORD dwFlags, WIN32_FIND_DATA* f) /*This function is called by CommandDelete and does the actual process of deleting the single file*/ - + if(CheckCtrlBreak(BREAK_INPUT)) + return 1; /*check to see if it is read only and if this is done based on /A if it is done by file name, access is denied. However, if it is done diff --git a/reactos/subsys/system/cmd/dir.c b/reactos/subsys/system/cmd/dir.c index 345584404fd..233fca01f75 100644 --- a/reactos/subsys/system/cmd/dir.c +++ b/reactos/subsys/system/cmd/dir.c @@ -2027,7 +2027,7 @@ CommandDir(LPTSTR first, LPTSTR rest) } /* read the parameters */ - if (!DirReadParam(rest, ¶ms, &entries, &stFlags)) + if (!DirReadParam(rest, ¶ms, &entries, &stFlags) || CheckCtrlBreak(BREAK_INPUT)) { nErrorLevel = 1; return 1; @@ -2044,7 +2044,7 @@ CommandDir(LPTSTR first, LPTSTR rest) for(loop = 0; loop < entries; loop++) { /* parse the directory info */ - if (DirParsePathspec (params[loop], szPath, szFilespec)) + if (DirParsePathspec (params[loop], szPath, szFilespec) || CheckCtrlBreak(BREAK_INPUT)) { nErrorLevel = 1; return 1;