mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 15:56:04 +00:00
cmd: replace static traces by dynamic ones
svn path=/trunk/; revision=33533
This commit is contained in:
parent
bc59a11cc8
commit
2f9c333ded
23 changed files with 91 additions and 271 deletions
|
@ -85,9 +85,7 @@ LPTSTR FindArg (INT n)
|
|||
{
|
||||
LPTSTR pp;
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("FindArg: (%d)\n"), n);
|
||||
#endif
|
||||
TRACE ("FindArg: (%d)\n", n);
|
||||
|
||||
if (bc == NULL)
|
||||
return NULL;
|
||||
|
@ -172,9 +170,7 @@ LPTSTR BatchParams (LPTSTR s1, LPTSTR s2)
|
|||
|
||||
VOID ExitBatch (LPTSTR msg)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("ExitBatch: (\'%s\')\n"), msg);
|
||||
#endif
|
||||
TRACE ("ExitBatch: (\'%s\')\n", msg);
|
||||
|
||||
if (bc != NULL)
|
||||
{
|
||||
|
@ -226,10 +222,8 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
|
|||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL |
|
||||
FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Batch: (\'%s\', \'%s\', \'%s\') hFile = %x\n"),
|
||||
TRACE ("Batch: (\'%s\', \'%s\', \'%s\') hFile = %x\n",
|
||||
fullname, firstword, param, hFile);
|
||||
#endif
|
||||
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
@ -298,9 +292,7 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Batch: returns TRUE\n"));
|
||||
#endif
|
||||
TRACE ("Batch: returns TRUE\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -339,9 +331,7 @@ LPTSTR ReadBatchLine (LPBOOL bLocalEcho)
|
|||
if (bc == NULL)
|
||||
return NULL;
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("ReadBatchLine ()\n"));
|
||||
#endif
|
||||
TRACE ("ReadBatchLine ()\n");
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
@ -435,9 +425,7 @@ LPTSTR ReadBatchLine (LPBOOL bLocalEcho)
|
|||
|
||||
if (!FileGetString (bc->hBatchFile, textline, sizeof (textline) / sizeof (textline[0])))
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("ReadBatchLine(): Reached EOF!\n"));
|
||||
#endif
|
||||
TRACE ("ReadBatchLine(): Reached EOF!\n");
|
||||
/* End of file.... */
|
||||
ExitBatch (NULL);
|
||||
|
||||
|
@ -446,9 +434,7 @@ LPTSTR ReadBatchLine (LPBOOL bLocalEcho)
|
|||
|
||||
continue;
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("ReadBatchLine(): textline: \'%s\'\n"), textline);
|
||||
#endif
|
||||
TRACE ("ReadBatchLine(): textline: \'%s\'\n", textline);
|
||||
|
||||
/* Strip leading spaces and trailing space/control chars */
|
||||
for (first = textline; _istspace (*first); first++)
|
||||
|
|
|
@ -44,9 +44,7 @@ INT cmd_call (LPTSTR cmd, LPTSTR param)
|
|||
{
|
||||
LPBATCH_CONTEXT n = NULL;
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("cmd_call: (\'%s\',\'%s\')\n"), cmd, param);
|
||||
#endif
|
||||
TRACE ("cmd_call: (\'%s\',\'%s\')\n", cmd, param);
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
{
|
||||
ConOutResPaging(TRUE,STRING_CALL_HELP);
|
||||
|
|
|
@ -260,9 +260,7 @@ CommandChoice (LPTSTR cmd, LPTSTR param)
|
|||
}
|
||||
|
||||
freep (arg);
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("ErrorLevel: %d\n"), nErrorLevel);
|
||||
#endif /* _DEBUG */
|
||||
TRACE ("ErrorLevel: %d\n", nErrorLevel);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -275,25 +273,19 @@ loop:
|
|||
switch (GCret)
|
||||
{
|
||||
case GC_TIMEOUT:
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("GC_TIMEOUT\n"));
|
||||
DebugPrintf (_T("elapsed %d msecs\n"), GetTickCount () - clk);
|
||||
#endif /* _DEBUG */
|
||||
TRACE ("GC_TIMEOUT\n");
|
||||
TRACE ("elapsed %d msecs\n", GetTickCount () - clk);
|
||||
break;
|
||||
|
||||
case GC_NOKEY:
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf(_T("GC_NOKEY\n"));
|
||||
DebugPrintf(_T("elapsed %d msecs\n"), GetTickCount () - clk);
|
||||
#endif /* _DEBUG */
|
||||
TRACE ("GC_NOKEY\n");
|
||||
TRACE ("elapsed %d msecs\n", GetTickCount () - clk);
|
||||
goto loop;
|
||||
|
||||
case GC_KEYREAD:
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf(_T("GC_KEYREAD\n"));
|
||||
DebugPrintf(_T("elapsed %d msecs\n"), GetTickCount () - clk);
|
||||
DebugPrintf(_T("read %c"), Ch);
|
||||
#endif /* _DEBUG */
|
||||
TRACE ("GC_KEYREAD\n");
|
||||
TRACE ("elapsed %d msecs\n", GetTickCount () - clk);
|
||||
TRACE ("read %c", Ch);
|
||||
if ((val=IsKeyInString(lpOptions,Ch,bCaseSensitive))==-1)
|
||||
{
|
||||
Beep (440, 50);
|
||||
|
@ -303,10 +295,8 @@ loop:
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf(_T("exiting wait loop after %d msecs\n"),
|
||||
TRACE ("exiting wait loop after %d msecs\n",
|
||||
GetTickCount () - clk);
|
||||
#endif /* _DEBUG */
|
||||
|
||||
val = IsKeyInString (lpOptions, cDefault, bCaseSensitive);
|
||||
ConOutPrintf (_T("%c\n"), lpOptions[val]);
|
||||
|
@ -315,9 +305,7 @@ loop:
|
|||
|
||||
freep (arg);
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("ErrorLevel: %d\n"), nErrorLevel);
|
||||
#endif /* _DEBUG */
|
||||
TRACE ("ErrorLevel: %d\n", nErrorLevel);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -243,9 +243,7 @@ static BOOL IsConsoleProcess(HANDLE Process)
|
|||
&Info, sizeof(PROCESS_BASIC_INFORMATION), NULL);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("NtQueryInformationProcess failed with status %08x\n"), Status);
|
||||
#endif
|
||||
WARN ("NtQueryInformationProcess failed with status %08x\n", Status);
|
||||
return TRUE;
|
||||
}
|
||||
Status = NtReadVirtualMemoryPtr (
|
||||
|
@ -253,9 +251,7 @@ static BOOL IsConsoleProcess(HANDLE Process)
|
|||
sizeof(PEB), &BytesRead);
|
||||
if (! NT_SUCCESS(Status) || sizeof(PEB) != BytesRead)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Couldn't read virt mem status %08x bytes read %lu\n"), Status, BytesRead);
|
||||
#endif
|
||||
WARN ("Couldn't read virt mem status %08x bytes read %lu\n", Status, BytesRead);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -287,37 +283,27 @@ static BOOL RunFile(LPTSTR filename)
|
|||
MYEX hShExt;
|
||||
HINSTANCE ret;
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("RunFile(%s)\n"), filename);
|
||||
#endif
|
||||
TRACE ("RunFile(%s)\n", filename);
|
||||
hShell32 = LoadLibrary(_T("SHELL32.DLL"));
|
||||
if (!hShell32)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("RunFile: couldn't load SHELL32.DLL!\n"));
|
||||
#endif
|
||||
WARN ("RunFile: couldn't load SHELL32.DLL!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hShExt = (MYEX)(FARPROC)GetProcAddress(hShell32, SHELLEXECUTETEXT);
|
||||
if (!hShExt)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("RunFile: couldn't find ShellExecuteA/W in SHELL32.DLL!\n"));
|
||||
#endif
|
||||
WARN ("RunFile: couldn't find ShellExecuteA/W in SHELL32.DLL!\n");
|
||||
FreeLibrary(hShell32);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("RunFile: ShellExecuteA/W is at %x\n"), hShExt);
|
||||
#endif
|
||||
TRACE ("RunFile: ShellExecuteA/W is at %x\n", hShExt);
|
||||
|
||||
ret = (hShExt)(NULL, _T("open"), filename, NULL, NULL, SW_SHOWNORMAL);
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("RunFile: ShellExecuteA/W returned %d\n"), (DWORD)ret);
|
||||
#endif
|
||||
TRACE ("RunFile: ShellExecuteA/W returned %d\n", (DWORD)ret);
|
||||
|
||||
FreeLibrary(hShell32);
|
||||
return (((DWORD)ret) > 32);
|
||||
|
@ -344,9 +330,7 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
|
|||
TCHAR szWindowTitle[MAX_PATH];
|
||||
DWORD dwExitCode = 0;
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Execute: \'%s\' \'%s\'\n"), first, rest);
|
||||
#endif
|
||||
TRACE ("Execute: \'%s\' \'%s\'\n", first, rest);
|
||||
|
||||
/* we need biger buffer that First, Rest, Full are already
|
||||
need rewrite some code to use cmd_realloc when it need instead
|
||||
|
@ -481,9 +465,7 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
|
|||
dot = _tcsrchr (szFullName, _T('.'));
|
||||
if (dot && (!_tcsicmp (dot, _T(".bat")) || !_tcsicmp (dot, _T(".cmd"))))
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("[BATCH: %s %s]\n"), szFullName, rest);
|
||||
#endif
|
||||
TRACE ("[BATCH: %s %s]\n", szFullName, rest);
|
||||
Batch (szFullName, first, rest);
|
||||
}
|
||||
else
|
||||
|
@ -492,9 +474,7 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
|
|||
PROCESS_INFORMATION prci;
|
||||
STARTUPINFO stui;
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("[EXEC: %s %s]\n"), full, rest);
|
||||
#endif
|
||||
TRACE ("[EXEC: %s %s]\n", full, rest);
|
||||
/* build command line for CreateProcess() */
|
||||
|
||||
/* fill startup info */
|
||||
|
@ -542,15 +522,11 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("[ShellExecute: %s]\n"), full);
|
||||
#endif
|
||||
TRACE ("[ShellExecute: %s]\n", full);
|
||||
// See if we can run this with ShellExecute() ie myfile.xls
|
||||
if (!RunFile(full))
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("[ShellExecute failed!: %s]\n"), full);
|
||||
#endif
|
||||
TRACE ("[ShellExecute failed!: %s]\n", full);
|
||||
error_bad_command ();
|
||||
nErrorLevel = 1;
|
||||
}
|
||||
|
@ -596,9 +572,7 @@ DoCommand (LPTSTR line)
|
|||
INT cl;
|
||||
LPCOMMAND cmdptr;
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("DoCommand: (\'%s\')\n"), line);
|
||||
#endif /* DEBUG */
|
||||
TRACE ("DoCommand: (\'%s\')\n", line);
|
||||
|
||||
com = cmd_alloc( (_tcslen(line) +512)*sizeof(TCHAR) );
|
||||
if (com == NULL)
|
||||
|
@ -733,9 +707,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
_tcscpy (cmdline, cmd);
|
||||
s = &cmdline[0];
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("ParseCommandLine: (\'%s\')\n"), s);
|
||||
#endif /* DEBUG */
|
||||
TRACE ("ParseCommandLine: (\'%s\')\n", s);
|
||||
|
||||
#ifdef FEATURE_ALIASES
|
||||
/* expand all aliases */
|
||||
|
@ -821,9 +793,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
ConErrPrintf(szMsg, in);
|
||||
return;
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Input redirected from: %s\n"), in);
|
||||
#endif
|
||||
TRACE ("Input redirected from: %s\n", in);
|
||||
}
|
||||
|
||||
/* Now do all but the last pipe command */
|
||||
|
@ -943,9 +913,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
if (GetFileType (hFile) == FILE_TYPE_DISK)
|
||||
SetFilePointer (hFile, 0, &lHighPos, FILE_END);
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Output redirected to: %s\n"), out);
|
||||
#endif
|
||||
TRACE ("Output redirected to: %s\n", out);
|
||||
}
|
||||
else if (hOldConOut != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
@ -966,9 +934,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
|
||||
if (!_tcscmp (err, out))
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Stdout and stderr will use the same file!!\n"));
|
||||
#endif
|
||||
TRACE ("Stdout and stderr will use the same file!!\n");
|
||||
DuplicateHandle (GetCurrentProcess (),
|
||||
GetStdHandle (STD_OUTPUT_HANDLE),
|
||||
GetCurrentProcess (),
|
||||
|
@ -1005,9 +971,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
if (GetFileType (hFile) == FILE_TYPE_DISK)
|
||||
SetFilePointer (hFile, 0, &lHighPos, FILE_END);
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Error redirected to: %s\n"), err);
|
||||
#endif
|
||||
TRACE ("Error redirected to: %s\n", err);
|
||||
}
|
||||
else if (hOldConErr != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
@ -1053,9 +1017,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Can't restore STDIN! Is invalid!!\n"), out);
|
||||
#endif
|
||||
WARN ("Can't restore STDIN! Is invalid!!\n", out);
|
||||
}
|
||||
#endif /* buggy implementation */
|
||||
|
||||
|
@ -1066,9 +1028,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
SetStdHandle (STD_INPUT_HANDLE, hOldConIn);
|
||||
if (hIn == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Previous STDIN is invalid!!\n"));
|
||||
#endif
|
||||
WARN ("Previous STDIN is invalid!!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1083,9 +1043,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("hFile[0] and hIn dont match!!!\n"));
|
||||
#endif
|
||||
WARN ("hFile[0] and hIn dont match!!!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1725,14 +1683,12 @@ Initialize (int argc, const TCHAR* argv[])
|
|||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("[command args:\n"));
|
||||
TRACE ("[command args:\n");
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
DebugPrintf (_T("%d. %s\n"), i, argv[i]);
|
||||
TRACE ("%d. %s\n", i, argv[i]);
|
||||
}
|
||||
DebugPrintf (_T("]\n"));
|
||||
#endif
|
||||
TRACE ("]\n");
|
||||
|
||||
InitLocale ();
|
||||
|
||||
|
|
|
@ -134,12 +134,6 @@ LPCTSTR GetParsedEnvVar ( LPCTSTR varName, UINT* varNameLen, BOOL ModeSetA );
|
|||
VOID SetScreenColor(WORD wArgColor, BOOL bFill);
|
||||
INT CommandColor (LPTSTR, LPTSTR);
|
||||
|
||||
|
||||
/* Prototypes for CONSOLE.C */
|
||||
#ifdef _DEBUG
|
||||
VOID DebugPrintf (LPTSTR, ...);
|
||||
#endif /* _DEBUG */
|
||||
|
||||
VOID ConInDummy (VOID);
|
||||
VOID ConInDisable (VOID);
|
||||
VOID ConInEnable (VOID);
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
<define name="ANONYMOUSUNIONS" />
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<library>cmd_base</library>
|
||||
<library>wine</library>
|
||||
<library>kernel32</library>
|
||||
<library>advapi32</library>
|
||||
<library>shell32</library>
|
||||
|
|
|
@ -55,10 +55,8 @@ VOID ConInDummy (VOID)
|
|||
INPUT_RECORD dummy;
|
||||
DWORD dwRead;
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (hInput == INVALID_HANDLE_VALUE)
|
||||
DebugPrintf (_T("Invalid input handle!!!\n"));
|
||||
#endif /* _DEBUG */
|
||||
WARN ("Invalid input handle!!!\n");
|
||||
ReadConsoleInput (hInput, &dummy, 1, &dwRead);
|
||||
}
|
||||
|
||||
|
@ -73,10 +71,8 @@ VOID ConInKey (PINPUT_RECORD lpBuffer)
|
|||
HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE);
|
||||
DWORD dwRead;
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (hInput == INVALID_HANDLE_VALUE)
|
||||
DebugPrintf (_T("Invalid input handle!!!\n"));
|
||||
#endif /* _DEBUG */
|
||||
WARN ("Invalid input handle!!!\n");
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -431,24 +427,6 @@ VOID ConErrPrintf (LPTSTR szFormat, ...)
|
|||
va_end (arg_ptr);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
VOID DebugPrintf (LPTSTR szFormat, ...)
|
||||
{
|
||||
va_list arg_ptr;
|
||||
|
||||
va_start (arg_ptr, szFormat);
|
||||
ConPrintf(szFormat, arg_ptr, STD_ERROR_HANDLE);
|
||||
va_end (arg_ptr);
|
||||
#if 0
|
||||
TCHAR szOut[OUTPUT_BUFFER_SIZE];
|
||||
va_start (arg_ptr, szFormat);
|
||||
_vstprintf (szOut, szFormat, arg_ptr);
|
||||
OutputDebugString (szOut);
|
||||
va_end (arg_ptr);
|
||||
#endif
|
||||
}
|
||||
#endif /* _DEBUG */
|
||||
|
||||
VOID SetCursorXY (SHORT x, SHORT y)
|
||||
{
|
||||
COORD coPos;
|
||||
|
|
|
@ -72,9 +72,7 @@ copy (TCHAR source[MAX_PATH],
|
|||
if(CheckCtrlBreak(BREAK_INPUT))
|
||||
return 0;
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("checking mode\n"));
|
||||
#endif
|
||||
TRACE ("checking mode\n");
|
||||
|
||||
if(bTouch)
|
||||
{
|
||||
|
@ -116,16 +114,12 @@ copy (TCHAR source[MAX_PATH],
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("getting time\n"));
|
||||
#endif
|
||||
TRACE ("getting time\n");
|
||||
|
||||
GetFileTime (hFileSrc, &srctime, NULL, NULL);
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("copy: flags has %s\n"),
|
||||
TRACE ("copy: flags has %s\n",
|
||||
lpdwFlags & COPY_ASCII ? "ASCII" : "BINARY");
|
||||
#endif
|
||||
|
||||
/* Check to see if /D or /Z are true, if so we need a middle
|
||||
man to copy the file too to allow us to use CopyFileEx later */
|
||||
|
@ -165,22 +159,16 @@ copy (TCHAR source[MAX_PATH],
|
|||
|
||||
if (!IsExistingFile (dest))
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("opening/creating\n"));
|
||||
#endif
|
||||
TRACE ("opening/creating\n");
|
||||
hFileDest =
|
||||
CreateFile (dest, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||
}
|
||||
else if (!append)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("SetFileAttributes (%s, FILE_ATTRIBUTE_NORMAL);\n"), dest);
|
||||
#endif
|
||||
TRACE ("SetFileAttributes (%s, FILE_ATTRIBUTE_NORMAL);\n", dest);
|
||||
SetFileAttributes (dest, FILE_ATTRIBUTE_NORMAL);
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("DeleteFile (%s);\n"), dest);
|
||||
#endif
|
||||
TRACE ("DeleteFile (%s);\n", dest);
|
||||
DeleteFile (dest);
|
||||
|
||||
hFileDest = CreateFile (dest, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||
|
@ -195,9 +183,7 @@ copy (TCHAR source[MAX_PATH],
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("opening/appending\n"));
|
||||
#endif
|
||||
TRACE ("opening/appending\n");
|
||||
SetFileAttributes (dest, FILE_ATTRIBUTE_NORMAL);
|
||||
|
||||
hFileDest =
|
||||
|
@ -258,18 +244,14 @@ copy (TCHAR source[MAX_PATH],
|
|||
}
|
||||
while (!bEof);
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("setting time\n"));
|
||||
#endif
|
||||
TRACE ("setting time\n");
|
||||
SetFileTime (hFileDest, &srctime, NULL, NULL);
|
||||
|
||||
if ((lpdwFlags & COPY_ASCII) && !bEof)
|
||||
{
|
||||
/* we're dealing with ASCII files! */
|
||||
buffer[0] = 0x1A;
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("appending ^Z\n"));
|
||||
#endif
|
||||
TRACE ("appending ^Z\n");
|
||||
WriteFile (hFileDest, buffer, sizeof(CHAR), &dwWritten, NULL);
|
||||
}
|
||||
|
||||
|
@ -277,9 +259,7 @@ copy (TCHAR source[MAX_PATH],
|
|||
CloseHandle (hFileDest);
|
||||
CloseHandle (hFileSrc);
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("setting mode\n"));
|
||||
#endif
|
||||
TRACE ("setting mode\n");
|
||||
SetFileAttributes (dest, dwAttrib);
|
||||
|
||||
/* Now finish off the copy if needed with CopyFileEx */
|
||||
|
|
|
@ -226,9 +226,7 @@ INT cmd_date (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
PrintDateString ();
|
||||
ConInString (s, 40);
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("\'%s\'\n"), s);
|
||||
#endif
|
||||
TRACE ("\'%s\'\n", s);
|
||||
while (*s && s[_tcslen (s) - 1] < _T(' '))
|
||||
s[_tcslen (s) - 1] = _T('\0');
|
||||
if (ParseDate (s))
|
||||
|
|
|
@ -34,9 +34,7 @@ INT CommandEcho (LPTSTR cmd, LPTSTR param)
|
|||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LPTSTR p1, p2;
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("CommandEcho '%s' : '%s'\n"), cmd, param);
|
||||
#endif
|
||||
TRACE ("CommandEcho '%s' : '%s'\n", cmd, param);
|
||||
|
||||
if (_tcsicmp (cmd, _T("echo.")) == 0)
|
||||
{
|
||||
|
@ -112,9 +110,7 @@ INT CommandEcho (LPTSTR cmd, LPTSTR param)
|
|||
INT CommandEchos (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("CommandEchos '%s' : '%s'\n"), cmd, param);
|
||||
#endif
|
||||
TRACE ("CommandEchos '%s' : '%s'\n", cmd, param);
|
||||
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
{
|
||||
|
@ -132,9 +128,7 @@ INT CommandEchos (LPTSTR cmd, LPTSTR param)
|
|||
INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("CommandEchoerr '%s' : '%s'\n"), cmd, param);
|
||||
#endif
|
||||
TRACE ("CommandEchoerr '%s' : '%s'\n", cmd, param);
|
||||
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
{
|
||||
|
@ -161,9 +155,7 @@ INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
|
|||
INT CommandEchoserr (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("CommandEchoserr '%s' : '%s'\n"), cmd, param);
|
||||
#endif
|
||||
TRACE ("CommandEchoserr '%s' : '%s'\n", cmd, param);
|
||||
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
{
|
||||
|
|
|
@ -54,9 +54,7 @@ INT cmd_for (LPTSTR cmd, LPTSTR param)
|
|||
TCHAR var;
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("cmd_for (\'%s\', \'%s\'\n"), cmd, param);
|
||||
#endif
|
||||
TRACE ("cmd_for (\'%s\', \'%s\'\n", cmd, param);
|
||||
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
{
|
||||
|
|
|
@ -42,9 +42,7 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param)
|
|||
LPTSTR tmp, tmp2;
|
||||
LONG lNewPosHigh = 0;
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("cmd_goto (\'%s\', \'%s\'\n"), cmd, param);
|
||||
#endif
|
||||
TRACE ("cmd_goto (\'%s\', \'%s\'\n", cmd, param);
|
||||
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
{
|
||||
|
|
|
@ -192,11 +192,9 @@ VOID del(LPHIST_ENTRY item)
|
|||
{
|
||||
if (item==NULL || item==Top || item==Bottom)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf(_T("del in ") _T(__FILE__) _T(": retrning\n")
|
||||
_T("item is 0x%08x (Bottom is0x%08x)\n"),
|
||||
TRACE ("del in " __FILE__ ": returning\n"
|
||||
"item is 0x%08x (Bottom is0x%08x)\n",
|
||||
item, Bottom);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,9 +41,7 @@ INT cmd_if (LPTSTR cmd, LPTSTR param)
|
|||
INT x_flag = 0; /* when set cause 'then' clause to be executed */
|
||||
LPTSTR pp;
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("cmd_if: (\'%s\', \'%s\')\n"), cmd, param);
|
||||
#endif
|
||||
TRACE ("cmd_if: (\'%s\', \'%s\')\n", cmd, param);
|
||||
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
{
|
||||
|
|
|
@ -191,9 +191,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
/* get destination */
|
||||
GetFullPathName (arg[argc - 1], MAX_PATH, szDestPath, NULL);
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Destination: %s\n"), szDestPath);
|
||||
#endif
|
||||
TRACE ("Destination: %s\n", szDestPath);
|
||||
|
||||
/* get source folder */
|
||||
GetDirectory(arg[argc - 2], szSrcDirPath, 1);
|
||||
|
@ -204,9 +202,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
|||
GetFullPathName(arg[argc - 2], MAX_PATH, szSrcPath, &pszFile);
|
||||
if (_tcscmp(szSrcDirPath,szSrcPath) == 0)
|
||||
szSrcDirPath[pszFile - szSrcPath] = _T('\0');
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Source Folder: %s\n"), szSrcDirPath);
|
||||
#endif
|
||||
TRACE ("Source Folder: %s\n", szSrcDirPath);
|
||||
|
||||
hFile = FindFirstFile (arg[argc - 2], &findBuffer);
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
|
@ -239,9 +235,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
|||
if(szSrcPath[_tcslen(szSrcPath) - 1] != _T('\\'))
|
||||
_tcscat (szSrcPath, _T("\\"));
|
||||
_tcscat(szSrcPath,findBuffer.cFileName);
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Source Path: %s\n"), szSrcPath);
|
||||
#endif
|
||||
TRACE ("Source Path: %s\n", szSrcPath);
|
||||
/* check if there can be found files as files have first priority */
|
||||
if (IsExistingFile(szSrcPath)) dwMoveStatusFlags |= MOVE_SOURCE_IS_FILE;
|
||||
else dwMoveStatusFlags |= MOVE_SOURCE_IS_DIR;
|
||||
|
@ -264,10 +258,8 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
|||
}
|
||||
FindClose(hFile);
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf(_T("Do we have only one file: %s\n"), OnlyOneFile ? _T("TRUE") : _T("FALSE"));
|
||||
#endif
|
||||
|
||||
TRACE ("Do we have only one file: %s\n", OnlyOneFile ? _T("TRUE") : _T("FALSE"));
|
||||
|
||||
/* we have to start again to be sure we don't miss any files or folders*/
|
||||
hFile = FindFirstFile (arg[argc - 2], &findBuffer);
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
|
@ -301,9 +293,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
|||
/* move it */
|
||||
do
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Found file/directory: %s\n"), findBuffer.cFileName);
|
||||
#endif
|
||||
TRACE ("Found file/directory: %s\n", findBuffer.cFileName);
|
||||
nOverwrite = 1;
|
||||
dwMoveFlags = 0;
|
||||
dwMoveStatusFlags &= ~MOVE_DEST_IS_FILE &
|
||||
|
@ -325,9 +315,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
|||
dwMoveStatusFlags |= MOVE_SRC_CURRENT_IS_DIR; /* source is file but at the current round we found a directory */
|
||||
continue;
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Source is dir: %s\n"), szSrcPath);
|
||||
#endif
|
||||
TRACE ("Source is dir: %s\n", szSrcPath);
|
||||
dwMoveFlags = MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH | MOVEFILE_COPY_ALLOWED;
|
||||
}
|
||||
|
||||
|
@ -336,9 +324,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
|||
if (IsExistingDirectory(szDestPath))
|
||||
{
|
||||
/* destination is existing directory */
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Destination is directory: %s\n"), szDestPath);
|
||||
#endif
|
||||
TRACE ("Destination is directory: %s\n", szDestPath);
|
||||
|
||||
dwMoveStatusFlags |= MOVE_DEST_IS_DIR;
|
||||
|
||||
|
@ -358,9 +344,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
|||
if (IsExistingFile(szDestPath))
|
||||
{
|
||||
/* destination is a file */
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Destination is file: %s\n"), szDestPath);
|
||||
#endif
|
||||
TRACE ("Destination is file: %s\n", szDestPath);
|
||||
|
||||
dwMoveStatusFlags |= MOVE_DEST_IS_FILE | MOVE_DEST_EXISTS;
|
||||
_tcscpy (szFullDestPath, szDestPath);
|
||||
|
@ -369,9 +353,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf(_T("Move Status Flags: 0x%X\n"),dwMoveStatusFlags);
|
||||
#endif
|
||||
TRACE ("Move Status Flags: 0x%X\n",dwMoveStatusFlags);
|
||||
|
||||
if (dwMoveStatusFlags & MOVE_SOURCE_IS_DIR &&
|
||||
dwMoveStatusFlags & MOVE_DEST_IS_DIR &&
|
||||
|
|
|
@ -130,8 +130,6 @@ INT CommandMsgbox (LPTSTR cmd, LPTSTR param)
|
|||
prompt = param;
|
||||
|
||||
hWnd=GetConsoleWindow ();
|
||||
// DebugPrintf("FindWindow hWnd = %d\n",hWnd);
|
||||
// ConErrPrintf("FindWindow hWnd = %d\n",hWnd);
|
||||
|
||||
switch (MessageBox(hWnd, prompt, title, uType))
|
||||
{
|
||||
|
|
|
@ -37,9 +37,7 @@
|
|||
INT cmd_pause (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("cmd_pause: \'%s\' : \'%s\')\n"), cmd, param);
|
||||
#endif
|
||||
TRACE ("cmd_pause: \'%s\' : \'%s\')\n", cmd, param);
|
||||
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
{
|
||||
|
|
|
@ -36,4 +36,7 @@
|
|||
#include <reactos/buildno.h>
|
||||
#include <reactos/version.h>
|
||||
|
||||
#include <wine/debug.h>
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(cmd);
|
||||
|
||||
#endif /* __CMD_PRECOMP_H */
|
||||
|
|
|
@ -39,9 +39,7 @@
|
|||
INT cmd_shift (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("cmd_shift: (\'%s\', \'%s\')\n"), cmd, param);
|
||||
#endif
|
||||
TRACE ("cmd_shift: (\'%s\', \'%s\')\n", cmd, param);
|
||||
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
{
|
||||
|
|
|
@ -253,14 +253,10 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
|
|||
szFullCmdLine[_tcslen(szFullCmdLine)] = _T('\"');
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("[BATCH: %s %s]\n"), szFullName, rest);
|
||||
#endif
|
||||
TRACE ("[BATCH: %s %s]\n", szFullName, rest);
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("[EXEC: %s %s]\n"), szFullName, rest);
|
||||
#endif
|
||||
TRACE ("[EXEC: %s %s]\n", szFullName, rest);
|
||||
/* build command line for CreateProcess() */
|
||||
if (bBat == FALSE)
|
||||
{
|
||||
|
|
|
@ -177,9 +177,7 @@ INT cmd_time (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
ConInString (s, 40);
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("\'%s\'\n"), s);
|
||||
#endif
|
||||
TRACE ("\'%s\'\n", s);
|
||||
|
||||
while (*s && s[_tcslen (s) - 1] < _T(' '))
|
||||
s[_tcslen(s) - 1] = _T('\0');
|
||||
|
|
|
@ -37,9 +37,7 @@ PrintElapsedTime (DWORD time,INT format)
|
|||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
DWORD h,m,s,ms;
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf(_T("PrintTime(%d,%d)"),time,format);
|
||||
#endif
|
||||
TRACE ("PrintElapsedTime(%d,%d)",time,format);
|
||||
|
||||
switch (format)
|
||||
{
|
||||
|
|
|
@ -92,17 +92,13 @@ SearchForExecutableSingle (LPCTSTR pFileName, LPTSTR pFullName, LPTSTR pExtensio
|
|||
/* initialize full name buffer */
|
||||
*pFullName = _T('\0');
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("SearchForExecutableSingle: \'%s\' with ext: \'%s\'\n"), pFileName, pExtension);
|
||||
#endif
|
||||
TRACE ("SearchForExecutableSingle: \'%s\' with ext: \'%s\'\n", pFileName, pExtension);
|
||||
|
||||
/* Check if valid directly on specified path */
|
||||
if (_tcschr (pFileName, _T('\\')) != NULL)
|
||||
{
|
||||
LPTSTR pFilePart;
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Absolute or relative path is given.\n"));
|
||||
#endif
|
||||
TRACE ("Absolute or relative path is given.\n");
|
||||
|
||||
if (GetFullPathName (pFileName,
|
||||
CMDLINE_LENGTH,
|
||||
|
@ -118,9 +114,7 @@ SearchForExecutableSingle (LPCTSTR pFileName, LPTSTR pFullName, LPTSTR pExtensio
|
|||
|
||||
if (IsExistingFile (szPathBuffer))
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Found: \'%s\'\n"), szPathBuffer);
|
||||
#endif
|
||||
TRACE ("Found: \'%s\'\n", szPathBuffer);
|
||||
_tcscpy (pFullName, szPathBuffer);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -141,9 +135,7 @@ SearchForExecutableSingle (LPCTSTR pFileName, LPTSTR pFullName, LPTSTR pExtensio
|
|||
|
||||
if (IsExistingFile (szPathBuffer))
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Found: \'%s\'\n"), szPathBuffer);
|
||||
#endif
|
||||
TRACE ("Found: \'%s\'\n", szPathBuffer);
|
||||
_tcscpy (pFullName, szPathBuffer);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -191,9 +183,7 @@ SearchForExecutableSingle (LPCTSTR pFileName, LPTSTR pFullName, LPTSTR pExtensio
|
|||
|
||||
if (IsExistingFile (szPathBuffer))
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Found: \'%s\'\n"), szPathBuffer);
|
||||
#endif
|
||||
TRACE ("Found: \'%s\'\n", szPathBuffer);
|
||||
cmd_free (pszBuffer);
|
||||
_tcscpy (pFullName, szPathBuffer);
|
||||
return TRUE;
|
||||
|
@ -212,9 +202,7 @@ SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName)
|
|||
LPTSTR pCh;
|
||||
LPTSTR pExt;
|
||||
DWORD dwBuffer;
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("SearchForExecutable: \'%s\'\n"), pFileName);
|
||||
#endif
|
||||
TRACE ("SearchForExecutable: \'%s\'\n", pFileName);
|
||||
/* load environment varable PATHEXT */
|
||||
pszBuffer = (LPTSTR)cmd_alloc (ENV_BUFFER_SIZE * sizeof(TCHAR));
|
||||
dwBuffer = GetEnvironmentVariable (_T("PATHEXT"), pszBuffer, ENV_BUFFER_SIZE);
|
||||
|
@ -228,9 +216,7 @@ SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName)
|
|||
_tcscpy(pszBuffer, pszDefaultPathExt);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("SearchForExecutable(): Loaded PATHEXT: %s\n"), pszBuffer);
|
||||
#endif
|
||||
TRACE ("SearchForExecutable(): Loaded PATHEXT: %s\n", pszBuffer);
|
||||
|
||||
pExt = _tcsrchr(pFileName, _T('.'));
|
||||
if (pExt != NULL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue