mirror of
https://github.com/reactos/reactos.git
synced 2025-05-02 12:15:23 +00:00
[MODE] Use ConUtils functions for printing to screen.
This commit is contained in:
parent
22bf169288
commit
bc826532e3
1 changed files with 21 additions and 21 deletions
|
@ -82,7 +82,7 @@ int QueryDevices(VOID)
|
||||||
if (Buffer == NULL)
|
if (Buffer == NULL)
|
||||||
{
|
{
|
||||||
/* We failed, bail out */
|
/* We failed, bail out */
|
||||||
wprintf(L"ERROR: Not enough memory\n");
|
ConPuts(StdErr, L"ERROR: Not enough memory\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ int QueryDevices(VOID)
|
||||||
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
||||||
{
|
{
|
||||||
/* We failed, bail out */
|
/* We failed, bail out */
|
||||||
wprintf(L"ERROR: QueryDosDeviceW(...) failed: 0x%lx\n", GetLastError());
|
ConPrintf(StdErr, L"ERROR: QueryDosDeviceW(...) failed: 0x%lx\n", GetLastError());
|
||||||
HeapFree(GetProcessHeap(), 0, Buffer);
|
HeapFree(GetProcessHeap(), 0, Buffer);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ int QueryDevices(VOID)
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
{
|
{
|
||||||
/* We failed, bail out */
|
/* We failed, bail out */
|
||||||
wprintf(L"ERROR: Not enough memory\n");
|
ConPuts(StdErr, L"ERROR: Not enough memory\n");
|
||||||
HeapFree(GetProcessHeap(), 0, Buffer);
|
HeapFree(GetProcessHeap(), 0, Buffer);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -167,12 +167,12 @@ int ShowParallelStatus(INT nPortNum)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wprintf(L" QueryDosDeviceW(%s) returned unrecognised form %s.\n", szPortName, buffer);
|
ConPrintf(StdErr, L" QueryDosDeviceW(%s) returned unrecognised form %s.\n", szPortName, buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wprintf(L"ERROR: QueryDosDeviceW(%s) failed: 0x%lx\n", szPortName, GetLastError());
|
ConPrintf(StdErr, L"ERROR: QueryDosDeviceW(%s) failed: 0x%lx\n", szPortName, GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -187,7 +187,7 @@ int SetParallelState(INT nPortNum)
|
||||||
swprintf(szTargetPath, L"COM%d", nPortNum);
|
swprintf(szTargetPath, L"COM%d", nPortNum);
|
||||||
if (!DefineDosDeviceW(DDD_REMOVE_DEFINITION, szPortName, szTargetPath))
|
if (!DefineDosDeviceW(DDD_REMOVE_DEFINITION, szPortName, szTargetPath))
|
||||||
{
|
{
|
||||||
wprintf(L"SetParallelState(%d) - DefineDosDevice(%s) failed: 0x%lx\n", nPortNum, szPortName, GetLastError());
|
ConPrintf(StdErr, L"SetParallelState(%d) - DefineDosDevice(%s) failed: 0x%lx\n", nPortNum, szPortName, GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowParallelStatus(nPortNum);
|
ShowParallelStatus(nPortNum);
|
||||||
|
@ -408,12 +408,12 @@ int SetConsoleStateOld(IN PCWSTR ArgStr)
|
||||||
Quit:
|
Quit:
|
||||||
ClearScreen(hConOut, &csbi);
|
ClearScreen(hConOut, &csbi);
|
||||||
if (!ResizeTextConsole(hConOut, &csbi, Resolution))
|
if (!ResizeTextConsole(hConOut, &csbi, Resolution))
|
||||||
wprintf(L"The screen cannot be set to the number of lines and columns specified.\n");
|
ConPuts(StdErr, L"The screen cannot be set to the number of lines and columns specified.\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
invalid_parameter:
|
invalid_parameter:
|
||||||
wprintf(L"Invalid parameter - %s\n", ArgStr);
|
ConPrintf(StdErr, L"Invalid parameter - %s\n", ArgStr);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ int SetConsoleState(IN PCWSTR ArgStr)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
invalid_parameter:
|
invalid_parameter:
|
||||||
wprintf(L"Invalid parameter - %s\n", ArgStr);
|
ConPrintf(StdErr, L"Invalid parameter - %s\n", ArgStr);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -495,7 +495,7 @@ invalid_parameter:
|
||||||
{
|
{
|
||||||
ClearScreen(hConOut, &csbi);
|
ClearScreen(hConOut, &csbi);
|
||||||
if (!ResizeTextConsole(hConOut, &csbi, Resolution))
|
if (!ResizeTextConsole(hConOut, &csbi, Resolution))
|
||||||
wprintf(L"The screen cannot be set to the number of lines and columns specified.\n");
|
ConPuts(StdErr, L"The screen cannot be set to the number of lines and columns specified.\n");
|
||||||
}
|
}
|
||||||
else if (kbdMode)
|
else if (kbdMode)
|
||||||
{
|
{
|
||||||
|
@ -537,7 +537,7 @@ int SetConsoleCPState(IN PCWSTR ArgStr)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
invalid_parameter:
|
invalid_parameter:
|
||||||
wprintf(L"Invalid parameter - %s\n", ArgStr);
|
ConPrintf(StdErr, L"Invalid parameter - %s\n", ArgStr);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,8 +570,8 @@ SerialPortQuery(INT nPortNum, LPDCB pDCB, LPCOMMTIMEOUTS pCommTimeouts, BOOL bWr
|
||||||
|
|
||||||
if (hPort == INVALID_HANDLE_VALUE)
|
if (hPort == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
wprintf(L"Illegal device name - %s\n", szPortName);
|
ConPrintf(StdErr, L"Illegal device name - %s\n", szPortName);
|
||||||
wprintf(L"Last error = 0x%lx\n", GetLastError());
|
ConPrintf(StdErr, L"Last error = 0x%lx\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,7 +579,7 @@ SerialPortQuery(INT nPortNum, LPDCB pDCB, LPCOMMTIMEOUTS pCommTimeouts, BOOL bWr
|
||||||
: GetCommState(hPort, pDCB);
|
: GetCommState(hPort, pDCB);
|
||||||
if (!Success)
|
if (!Success)
|
||||||
{
|
{
|
||||||
wprintf(L"Failed to %s the status for device COM%d:\n", bWrite ? L"set" : L"get", nPortNum);
|
ConPrintf(StdErr, L"Failed to %s the status for device COM%d:\n", bWrite ? L"set" : L"get", nPortNum);
|
||||||
goto Quit;
|
goto Quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,7 +587,7 @@ SerialPortQuery(INT nPortNum, LPDCB pDCB, LPCOMMTIMEOUTS pCommTimeouts, BOOL bWr
|
||||||
: GetCommTimeouts(hPort, pCommTimeouts);
|
: GetCommTimeouts(hPort, pCommTimeouts);
|
||||||
if (!Success)
|
if (!Success)
|
||||||
{
|
{
|
||||||
wprintf(L"Failed to %s timeout status for device COM%d:\n", bWrite ? L"set" : L"get", nPortNum);
|
ConPrintf(StdErr, L"Failed to %s timeout status for device COM%d:\n", bWrite ? L"set" : L"get", nPortNum);
|
||||||
goto Quit;
|
goto Quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,12 +619,12 @@ int ShowSerialStatus(INT nPortNum)
|
||||||
}
|
}
|
||||||
if (dcb.Parity >= ARRAYSIZE(parity_strings))
|
if (dcb.Parity >= ARRAYSIZE(parity_strings))
|
||||||
{
|
{
|
||||||
wprintf(L"ERROR: Invalid value for Parity Bits %d:\n", dcb.Parity);
|
ConPrintf(StdErr, L"ERROR: Invalid value for Parity Bits %d:\n", dcb.Parity);
|
||||||
dcb.Parity = 0;
|
dcb.Parity = 0;
|
||||||
}
|
}
|
||||||
if (dcb.StopBits >= ARRAYSIZE(stopbit_strings))
|
if (dcb.StopBits >= ARRAYSIZE(stopbit_strings))
|
||||||
{
|
{
|
||||||
wprintf(L"ERROR: Invalid value for Stop Bits %d:\n", dcb.StopBits);
|
ConPrintf(StdErr, L"ERROR: Invalid value for Stop Bits %d:\n", dcb.StopBits);
|
||||||
dcb.StopBits = 0;
|
dcb.StopBits = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1087,7 +1087,7 @@ int SetSerialState(INT nPortNum, IN PCWSTR ArgStr)
|
||||||
|
|
||||||
if (!Success)
|
if (!Success)
|
||||||
{
|
{
|
||||||
wprintf(L"Invalid parameter - %s\n", ArgStr);
|
ConPrintf(StdErr, L"Invalid parameter - %s\n", ArgStr);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1165,7 +1165,7 @@ int wmain(int argc, WCHAR* argv[])
|
||||||
ArgStr = HeapAlloc(GetProcessHeap(), 0, (ArgStrSize + 1) * sizeof(WCHAR));
|
ArgStr = HeapAlloc(GetProcessHeap(), 0, (ArgStrSize + 1) * sizeof(WCHAR));
|
||||||
if (ArgStr == NULL)
|
if (ArgStr == NULL)
|
||||||
{
|
{
|
||||||
wprintf(L"ERROR: Not enough memory\n");
|
ConPuts(StdErr, L"ERROR: Not enough memory\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1215,7 +1215,7 @@ int wmain(int argc, WCHAR* argv[])
|
||||||
if (!*argStr || _wcsnicmp(argStr, L"/STA", 4) == 0)
|
if (!*argStr || _wcsnicmp(argStr, L"/STA", 4) == 0)
|
||||||
ret = ShowParallelStatus(nPortNum);
|
ret = ShowParallelStatus(nPortNum);
|
||||||
else
|
else
|
||||||
wprintf(L"ERROR: LPT port redirection is not implemented!\n");
|
ConPuts(StdErr, L"ERROR: LPT port redirection is not implemented!\n");
|
||||||
// TODO: Implement setting LPT port redirection using SetParallelState().
|
// TODO: Implement setting LPT port redirection using SetParallelState().
|
||||||
goto Quit;
|
goto Quit;
|
||||||
}
|
}
|
||||||
|
@ -1282,7 +1282,7 @@ show_status:
|
||||||
goto Quit;
|
goto Quit;
|
||||||
|
|
||||||
invalid_parameter:
|
invalid_parameter:
|
||||||
wprintf(L"Invalid parameter - %s\n", ArgStr);
|
ConPrintf(StdErr, L"Invalid parameter - %s\n", ArgStr);
|
||||||
goto Quit;
|
goto Quit;
|
||||||
|
|
||||||
Quit:
|
Quit:
|
||||||
|
|
Loading…
Reference in a new issue