Skip to content

Commit bc82653

Browse files
committed
[MODE] Use ConUtils functions for printing to screen.
1 parent 22bf169 commit bc82653

File tree

1 file changed

+21
-21
lines changed
  • base/applications/cmdutils/mode

1 file changed

+21
-21
lines changed

base/applications/cmdutils/mode/mode.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ int QueryDevices(VOID)
8282
if (Buffer == NULL)
8383
{
8484
/* We failed, bail out */
85-
wprintf(L"ERROR: Not enough memory\n");
85+
ConPuts(StdErr, L"ERROR: Not enough memory\n");
8686
return 0;
8787
}
8888

@@ -95,7 +95,7 @@ int QueryDevices(VOID)
9595
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
9696
{
9797
/* We failed, bail out */
98-
wprintf(L"ERROR: QueryDosDeviceW(...) failed: 0x%lx\n", GetLastError());
98+
ConPrintf(StdErr, L"ERROR: QueryDosDeviceW(...) failed: 0x%lx\n", GetLastError());
9999
HeapFree(GetProcessHeap(), 0, Buffer);
100100
return 0;
101101
}
@@ -106,7 +106,7 @@ int QueryDevices(VOID)
106106
if (ptr == NULL)
107107
{
108108
/* We failed, bail out */
109-
wprintf(L"ERROR: Not enough memory\n");
109+
ConPuts(StdErr, L"ERROR: Not enough memory\n");
110110
HeapFree(GetProcessHeap(), 0, Buffer);
111111
return 0;
112112
}
@@ -167,12 +167,12 @@ int ShowParallelStatus(INT nPortNum)
167167
}
168168
else
169169
{
170-
wprintf(L" QueryDosDeviceW(%s) returned unrecognised form %s.\n", szPortName, buffer);
170+
ConPrintf(StdErr, L" QueryDosDeviceW(%s) returned unrecognised form %s.\n", szPortName, buffer);
171171
}
172172
}
173173
else
174174
{
175-
wprintf(L"ERROR: QueryDosDeviceW(%s) failed: 0x%lx\n", szPortName, GetLastError());
175+
ConPrintf(StdErr, L"ERROR: QueryDosDeviceW(%s) failed: 0x%lx\n", szPortName, GetLastError());
176176
}
177177

178178
return 1;
@@ -187,7 +187,7 @@ int SetParallelState(INT nPortNum)
187187
swprintf(szTargetPath, L"COM%d", nPortNum);
188188
if (!DefineDosDeviceW(DDD_REMOVE_DEFINITION, szPortName, szTargetPath))
189189
{
190-
wprintf(L"SetParallelState(%d) - DefineDosDevice(%s) failed: 0x%lx\n", nPortNum, szPortName, GetLastError());
190+
ConPrintf(StdErr, L"SetParallelState(%d) - DefineDosDevice(%s) failed: 0x%lx\n", nPortNum, szPortName, GetLastError());
191191
}
192192

193193
ShowParallelStatus(nPortNum);
@@ -408,12 +408,12 @@ int SetConsoleStateOld(IN PCWSTR ArgStr)
408408
Quit:
409409
ClearScreen(hConOut, &csbi);
410410
if (!ResizeTextConsole(hConOut, &csbi, Resolution))
411-
wprintf(L"The screen cannot be set to the number of lines and columns specified.\n");
411+
ConPuts(StdErr, L"The screen cannot be set to the number of lines and columns specified.\n");
412412

413413
return 0;
414414

415415
invalid_parameter:
416-
wprintf(L"Invalid parameter - %s\n", ArgStr);
416+
ConPrintf(StdErr, L"Invalid parameter - %s\n", ArgStr);
417417
return 1;
418418
}
419419

@@ -486,7 +486,7 @@ int SetConsoleState(IN PCWSTR ArgStr)
486486
else
487487
{
488488
invalid_parameter:
489-
wprintf(L"Invalid parameter - %s\n", ArgStr);
489+
ConPrintf(StdErr, L"Invalid parameter - %s\n", ArgStr);
490490
return 1;
491491
}
492492
}
@@ -495,7 +495,7 @@ int SetConsoleState(IN PCWSTR ArgStr)
495495
{
496496
ClearScreen(hConOut, &csbi);
497497
if (!ResizeTextConsole(hConOut, &csbi, Resolution))
498-
wprintf(L"The screen cannot be set to the number of lines and columns specified.\n");
498+
ConPuts(StdErr, L"The screen cannot be set to the number of lines and columns specified.\n");
499499
}
500500
else if (kbdMode)
501501
{
@@ -537,7 +537,7 @@ int SetConsoleCPState(IN PCWSTR ArgStr)
537537
else
538538
{
539539
invalid_parameter:
540-
wprintf(L"Invalid parameter - %s\n", ArgStr);
540+
ConPrintf(StdErr, L"Invalid parameter - %s\n", ArgStr);
541541
return 1;
542542
}
543543

@@ -570,24 +570,24 @@ SerialPortQuery(INT nPortNum, LPDCB pDCB, LPCOMMTIMEOUTS pCommTimeouts, BOOL bWr
570570

571571
if (hPort == INVALID_HANDLE_VALUE)
572572
{
573-
wprintf(L"Illegal device name - %s\n", szPortName);
574-
wprintf(L"Last error = 0x%lx\n", GetLastError());
573+
ConPrintf(StdErr, L"Illegal device name - %s\n", szPortName);
574+
ConPrintf(StdErr, L"Last error = 0x%lx\n", GetLastError());
575575
return FALSE;
576576
}
577577

578578
Success = bWrite ? SetCommState(hPort, pDCB)
579579
: GetCommState(hPort, pDCB);
580580
if (!Success)
581581
{
582-
wprintf(L"Failed to %s the status for device COM%d:\n", bWrite ? L"set" : L"get", nPortNum);
582+
ConPrintf(StdErr, L"Failed to %s the status for device COM%d:\n", bWrite ? L"set" : L"get", nPortNum);
583583
goto Quit;
584584
}
585585

586586
Success = bWrite ? SetCommTimeouts(hPort, pCommTimeouts)
587587
: GetCommTimeouts(hPort, pCommTimeouts);
588588
if (!Success)
589589
{
590-
wprintf(L"Failed to %s timeout status for device COM%d:\n", bWrite ? L"set" : L"get", nPortNum);
590+
ConPrintf(StdErr, L"Failed to %s timeout status for device COM%d:\n", bWrite ? L"set" : L"get", nPortNum);
591591
goto Quit;
592592
}
593593

@@ -619,12 +619,12 @@ int ShowSerialStatus(INT nPortNum)
619619
}
620620
if (dcb.Parity >= ARRAYSIZE(parity_strings))
621621
{
622-
wprintf(L"ERROR: Invalid value for Parity Bits %d:\n", dcb.Parity);
622+
ConPrintf(StdErr, L"ERROR: Invalid value for Parity Bits %d:\n", dcb.Parity);
623623
dcb.Parity = 0;
624624
}
625625
if (dcb.StopBits >= ARRAYSIZE(stopbit_strings))
626626
{
627-
wprintf(L"ERROR: Invalid value for Stop Bits %d:\n", dcb.StopBits);
627+
ConPrintf(StdErr, L"ERROR: Invalid value for Stop Bits %d:\n", dcb.StopBits);
628628
dcb.StopBits = 0;
629629
}
630630

@@ -1087,7 +1087,7 @@ int SetSerialState(INT nPortNum, IN PCWSTR ArgStr)
10871087

10881088
if (!Success)
10891089
{
1090-
wprintf(L"Invalid parameter - %s\n", ArgStr);
1090+
ConPrintf(StdErr, L"Invalid parameter - %s\n", ArgStr);
10911091
return 1;
10921092
}
10931093

@@ -1165,7 +1165,7 @@ int wmain(int argc, WCHAR* argv[])
11651165
ArgStr = HeapAlloc(GetProcessHeap(), 0, (ArgStrSize + 1) * sizeof(WCHAR));
11661166
if (ArgStr == NULL)
11671167
{
1168-
wprintf(L"ERROR: Not enough memory\n");
1168+
ConPuts(StdErr, L"ERROR: Not enough memory\n");
11691169
return 1;
11701170
}
11711171

@@ -1215,7 +1215,7 @@ int wmain(int argc, WCHAR* argv[])
12151215
if (!*argStr || _wcsnicmp(argStr, L"/STA", 4) == 0)
12161216
ret = ShowParallelStatus(nPortNum);
12171217
else
1218-
wprintf(L"ERROR: LPT port redirection is not implemented!\n");
1218+
ConPuts(StdErr, L"ERROR: LPT port redirection is not implemented!\n");
12191219
// TODO: Implement setting LPT port redirection using SetParallelState().
12201220
goto Quit;
12211221
}
@@ -1282,7 +1282,7 @@ int wmain(int argc, WCHAR* argv[])
12821282
goto Quit;
12831283

12841284
invalid_parameter:
1285-
wprintf(L"Invalid parameter - %s\n", ArgStr);
1285+
ConPrintf(StdErr, L"Invalid parameter - %s\n", ArgStr);
12861286
goto Quit;
12871287

12881288
Quit:

0 commit comments

Comments
 (0)