Author: hbelusca Date: Fri Oct 7 22:50:32 2016 New Revision: 72933
URL: http://svn.reactos.org/svn/reactos?rev=72933&view=rev Log: [DISKPART][NET][WLANCONF] Make those command tools use the console uilities library, aka. solve all those problems of wrong characters on the console... CORE-10584 #resolve
[CONUTILS]: Remove the now unneeded compatibility defines. CORE-10504
Modified: trunk/reactos/base/applications/network/net/CMakeLists.txt trunk/reactos/base/applications/network/net/cmdAccounts.c trunk/reactos/base/applications/network/net/cmdContinue.c trunk/reactos/base/applications/network/net/cmdHelpMsg.c trunk/reactos/base/applications/network/net/cmdLocalGroup.c trunk/reactos/base/applications/network/net/cmdPause.c trunk/reactos/base/applications/network/net/cmdStart.c trunk/reactos/base/applications/network/net/cmdStop.c trunk/reactos/base/applications/network/net/cmdUse.c trunk/reactos/base/applications/network/net/cmdUser.c trunk/reactos/base/applications/network/net/help.c trunk/reactos/base/applications/network/net/main.c trunk/reactos/base/applications/network/net/net.h trunk/reactos/base/applications/network/wlanconf/CMakeLists.txt trunk/reactos/base/applications/network/wlanconf/wlanconf.c trunk/reactos/base/system/diskpart/CMakeLists.txt trunk/reactos/base/system/diskpart/active.c trunk/reactos/base/system/diskpart/automount.c trunk/reactos/base/system/diskpart/break.c trunk/reactos/base/system/diskpart/diskpart.c trunk/reactos/base/system/diskpart/diskpart.h trunk/reactos/base/system/diskpart/help.c trunk/reactos/base/system/diskpart/interpreter.c trunk/reactos/base/system/diskpart/list.c trunk/reactos/base/system/diskpart/online.c trunk/reactos/base/system/diskpart/partlist.c trunk/reactos/base/system/diskpart/repair.c trunk/reactos/base/system/diskpart/rescan.c trunk/reactos/base/system/diskpart/select.c trunk/reactos/sdk/lib/conutils/conutils.h
Modified: trunk/reactos/base/applications/network/net/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/n... ============================================================================== --- trunk/reactos/base/applications/network/net/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/net/CMakeLists.txt [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -1,5 +1,7 @@
add_definitions(-D__USE_W32_SOCKETS) + +include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/conutils)
list(APPEND SOURCE main.c @@ -17,6 +19,7 @@
add_executable(net ${SOURCE} net.rc) set_module_type(net win32cui UNICODE) -add_importlibs(net advapi32 netapi32 msvcrt kernel32 user32 ntdll mpr) +target_link_libraries(net conutils ${PSEH_LIB}) +add_importlibs(net advapi32 netapi32 mpr msvcrt kernel32 ntdll) add_pch(net net.h SOURCE) add_cd_file(TARGET net DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/base/applications/network/net/cmdAccounts.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/n... ============================================================================== --- trunk/reactos/base/applications/network/net/cmdAccounts.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/net/cmdAccounts.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -36,20 +36,20 @@ if (_wcsicmp(argv[i], L"help") == 0) { /* Print short syntax help */ - PrintResourceString(IDS_ACCOUNTS_SYNTAX); + ConResPuts(StdOut, IDS_ACCOUNTS_SYNTAX); return 0; }
if (_wcsicmp(argv[i], L"/help") == 0) { /* Print full help text*/ - PrintResourceString(IDS_ACCOUNTS_HELP); + ConResPuts(StdOut, IDS_ACCOUNTS_HELP); return 0; }
if (_wcsicmp(argv[i], L"/domain") == 0) { - PrintResourceString(IDS_ERROR_OPTION_NOT_SUPPORTED, L"/DOMAIN"); + ConResPrintf(StdErr, IDS_ERROR_OPTION_NOT_SUPPORTED, L"/DOMAIN"); #if 0 Domain = TRUE; #endif @@ -75,7 +75,7 @@ value = wcstoul(p, &endptr, 10); if (*endptr != 0) { - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"/FORCELOGOFF"); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"/FORCELOGOFF"); result = 1; goto done; } @@ -90,7 +90,7 @@ value = wcstoul(p, &endptr, 10); if (*endptr != 0) { - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"/MINPWLEN"); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"/MINPWLEN"); result = 1; goto done; } @@ -112,7 +112,7 @@ value = wcstoul(p, &endptr, 10); if (*endptr != 0) { - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"/MAXPWLEN"); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"/MAXPWLEN"); result = 1; goto done; } @@ -127,7 +127,7 @@ value = wcstoul(p, &endptr, 10); if (*endptr != 0) { - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"/MINPWAGE"); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"/MINPWAGE"); result = 1; goto done; } @@ -141,7 +141,7 @@ value = wcstoul(p, &endptr, 10); if (*endptr != 0) { - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"/UNIQUEPW"); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"/UNIQUEPW"); result = 1; goto done; } @@ -171,61 +171,61 @@
PrintPaddedResourceString(IDS_ACCOUNTS_FORCE_LOGOFF, nPaddedLength); if (Info0->usrmod0_force_logoff == TIMEQ_FOREVER) - PrintResourceString(IDS_GENERIC_NEVER); - else - PrintResourceString(IDS_ACCOUNTS_LOGOFF_SECONDS, Info0->usrmod0_force_logoff); - PrintToConsole(L"\n"); + ConResPuts(StdOut, IDS_GENERIC_NEVER); + else + ConResPrintf(StdOut, IDS_ACCOUNTS_LOGOFF_SECONDS, Info0->usrmod0_force_logoff); + ConPuts(StdOut, L"\n");
PrintPaddedResourceString(IDS_ACCOUNTS_MIN_PW_AGE, nPaddedLength); - PrintToConsole(L"%lu\n", Info0->usrmod0_min_passwd_age / 86400); + ConPrintf(StdOut, L"%lu\n", Info0->usrmod0_min_passwd_age / 86400);
PrintPaddedResourceString(IDS_ACCOUNTS_MAX_PW_AGE, nPaddedLength); - PrintToConsole(L"%lu\n", Info0->usrmod0_max_passwd_age / 86400); + ConPrintf(StdOut, L"%lu\n", Info0->usrmod0_max_passwd_age / 86400);
PrintPaddedResourceString(IDS_ACCOUNTS_MIN_PW_LENGTH, nPaddedLength); - PrintToConsole(L"%lu\n", Info0->usrmod0_min_passwd_len); + ConPrintf(StdOut, L"%lu\n", Info0->usrmod0_min_passwd_len);
PrintPaddedResourceString(IDS_ACCOUNTS_PW_HIST_LENGTH, nPaddedLength); if (Info0->usrmod0_password_hist_len == 0) - PrintResourceString(IDS_GENERIC_NONE); - else - PrintToConsole(L"%lu", Info0->usrmod0_password_hist_len); - PrintToConsole(L"\n"); + ConResPuts(StdOut, IDS_GENERIC_NONE); + else + ConPrintf(StdOut, L"%lu", Info0->usrmod0_password_hist_len); + ConPuts(StdOut, L"\n");
PrintPaddedResourceString(IDS_ACCOUNTS_LOCKOUT_THRESHOLD, nPaddedLength); if (Info3->usrmod3_lockout_threshold == 0) - PrintResourceString(IDS_GENERIC_NEVER); - else - PrintToConsole(L"%lu", Info3->usrmod3_lockout_threshold); - PrintToConsole(L"\n"); + ConResPuts(StdOut, IDS_GENERIC_NEVER); + else + ConPrintf(StdOut, L"%lu", Info3->usrmod3_lockout_threshold); + ConPuts(StdOut, L"\n");
PrintPaddedResourceString(IDS_ACCOUNTS_LOCKOUT_DURATION, nPaddedLength); - PrintToConsole(L"%lu\n", Info3->usrmod3_lockout_duration / 60); + ConPrintf(StdOut, L"%lu\n", Info3->usrmod3_lockout_duration / 60);
PrintPaddedResourceString(IDS_ACCOUNTS_LOCKOUT_WINDOW, nPaddedLength); - PrintToConsole(L"%lu\n", Info3->usrmod3_lockout_observation_window / 60); + ConPrintf(StdOut, L"%lu\n", Info3->usrmod3_lockout_observation_window / 60);
PrintPaddedResourceString(IDS_ACCOUNTS_COMPUTER_ROLE, nPaddedLength); if (Info1->usrmod1_role == UAS_ROLE_PRIMARY) { if (ProductType == NtProductLanManNt) { - PrintResourceString(IDS_ACCOUNTS_PRIMARY_SERVER); + ConResPuts(StdOut, IDS_ACCOUNTS_PRIMARY_SERVER); } else if (ProductType == NtProductServer) { - PrintResourceString(IDS_ACCOUNTS_STANDALONE_SERVER); + ConResPuts(StdOut, IDS_ACCOUNTS_STANDALONE_SERVER); } else { - PrintResourceString(IDS_ACCOUNTS_WORKSTATION); - } - } - else - { - PrintResourceString(IDS_ACCOUNTS_BACKUP_SERVER); - } - PrintToConsole(L"\n"); + ConResPuts(StdOut, IDS_ACCOUNTS_WORKSTATION); + } + } + else + { + ConResPuts(StdOut, IDS_ACCOUNTS_BACKUP_SERVER); + } + ConPuts(StdOut, L"\n"); }
done:
Modified: trunk/reactos/base/applications/network/net/cmdContinue.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/n... ============================================================================== --- trunk/reactos/base/applications/network/net/cmdContinue.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/net/cmdContinue.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -19,7 +19,7 @@
if (argc != 3) { - PrintResourceString(IDS_CONTINUE_SYNTAX); + ConResPuts(StdOut, IDS_CONTINUE_SYNTAX); return 1; }
@@ -27,7 +27,7 @@ { if (_wcsicmp(argv[i], L"/help") == 0) { - PrintResourceString(IDS_CONTINUE_HELP); + ConResPuts(StdOut, IDS_CONTINUE_HELP); return 1; } } @@ -35,7 +35,7 @@ hManager = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ENUMERATE_SERVICE); if (hManager == NULL) { - printf("[OpenSCManager] Error: %ld\n", GetLastError()); + ConPrintf(StdErr, L"[OpenSCManager] Error: %ld\n", GetLastError()); nError = 1; goto done; } @@ -43,14 +43,14 @@ hService = OpenService(hManager, argv[2], SERVICE_PAUSE_CONTINUE); if (hService == NULL) { - printf("[OpenService] Error: %ld\n", GetLastError()); + ConPrintf(StdErr, L"[OpenService] Error: %ld\n", GetLastError()); nError = 1; goto done; }
if (!ControlService(hService, SERVICE_CONTROL_CONTINUE, &status)) { - printf("[ControlService] Error: %ld\n", GetLastError()); + ConPrintf(StdErr, L"[ControlService] Error: %ld\n", GetLastError()); nError = 1; }
Modified: trunk/reactos/base/applications/network/net/cmdHelpMsg.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/n... ============================================================================== --- trunk/reactos/base/applications/network/net/cmdHelpMsg.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/net/cmdHelpMsg.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -13,14 +13,15 @@
INT cmdHelpMsg(INT argc, WCHAR **argv) { + INT i; + LONG errNum; LPWSTR endptr; + // DWORD dwLength = 0; LPWSTR lpBuffer; - LONG errNum; - INT i;
if (argc < 3) { - PrintResourceString(IDS_HELPMSG_SYNTAX); + ConResPuts(StdOut, IDS_HELPMSG_SYNTAX); return 1; }
@@ -28,7 +29,7 @@ { if (_wcsicmp(argv[i], L"/help") == 0) { - PrintResourceString(IDS_HELPMSG_HELP); + ConResPuts(StdOut, IDS_HELPMSG_HELP); return 1; } } @@ -36,25 +37,27 @@ errNum = wcstol(argv[2], &endptr, 10); if (*endptr != 0) { - PrintResourceString(IDS_HELPMSG_SYNTAX); + ConResPuts(StdOut, IDS_HELPMSG_SYNTAX); return 1; }
- /* Unicode printing is not supported in ReactOS yet */ - if (FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - errNum, - LANG_USER_DEFAULT, - (LPWSTR)&lpBuffer, - 0, - NULL)) + /* Retrieve the message string without appending extra newlines */ + // dwLength = + FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK, + NULL, + errNum, + LANG_USER_DEFAULT, + (LPWSTR)&lpBuffer, + 0, NULL); + if (lpBuffer /* && dwLength */) { - PrintToConsole(L"\n%s\n", lpBuffer); + ConPrintf(StdOut, L"\n%s\n", lpBuffer); LocalFree(lpBuffer); } else { - PrintToConsole(L"Unrecognized error code: %ld\n", errNum); + ConPrintf(StdOut, L"Unrecognized error code: %ld\n", errNum); }
return 0;
Modified: trunk/reactos/base/applications/network/net/cmdLocalGroup.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/n... ============================================================================== --- trunk/reactos/base/applications/network/net/cmdLocalGroup.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/net/cmdLocalGroup.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -38,11 +38,11 @@ if (Status != NERR_Success) return Status;
- PrintToConsole(L"\n"); - PrintResourceString(IDS_LOCALGROUP_ALIASES, pServer->sv100_name); - PrintToConsole(L"\n\n"); + ConPuts(StdOut, L"\n"); + ConResPrintf(StdOut, IDS_LOCALGROUP_ALIASES, pServer->sv100_name); + ConPuts(StdOut, L"\n\n"); PrintPadding(L'-', 79); - PrintToConsole(L"\n"); + ConPuts(StdOut, L"\n");
NetApiBufferFree(pServer);
@@ -64,7 +64,7 @@ for (i = 0; i < dwRead; i++) { if (pBuffer[i].lgrpi0_name) - PrintToConsole(L"*%s\n", pBuffer[i].lgrpi0_name); + ConPrintf(StdOut, L"*%s\n", pBuffer[i].lgrpi0_name); }
NetApiBufferFree(pBuffer); @@ -132,23 +132,23 @@ }
PrintPaddedResourceString(IDS_LOCALGROUP_ALIAS_NAME, nPaddedLength); - PrintToConsole(L"%s\n", pGroupInfo->lgrpi1_name); + ConPrintf(StdOut, L"%s\n", pGroupInfo->lgrpi1_name);
PrintPaddedResourceString(IDS_LOCALGROUP_COMMENT, nPaddedLength); - PrintToConsole(L"%s\n", pGroupInfo->lgrpi1_comment); - - PrintToConsole(L"\n"); - - PrintResourceString(IDS_LOCALGROUP_MEMBERS); - PrintToConsole(L"\n\n"); + ConPrintf(StdOut, L"%s\n", pGroupInfo->lgrpi1_comment); + + ConPuts(StdOut, L"\n"); + + ConResPuts(StdOut, IDS_LOCALGROUP_MEMBERS); + ConPuts(StdOut, L"\n\n");
PrintPadding(L'-', 79); - PrintToConsole(L"\n"); + ConPuts(StdOut, L"\n");
for (i = 0; i < dwRead; i++) { if (pNames[i]) - PrintToConsole(L"%s\n", pNames[i]); + ConPrintf(StdOut, L"%s\n", pNames[i]); }
done: @@ -192,13 +192,13 @@ if (argc == 2) { Status = EnumerateLocalGroups(); - printf("Status: %lu\n", Status); + ConPrintf(StdOut, L"Status: %lu\n", Status); return 0; } else if (argc == 3) { Status = DisplayLocalGroup(argv[2]); - printf("Status: %lu\n", Status); + ConPrintf(StdOut, L"Status: %lu\n", Status); return 0; }
@@ -217,7 +217,7 @@ dwMemberCount++; }
- printf("Member count: %lu\n", dwMemberCount); + ConPrintf(StdOut, L"Member count: %lu\n", dwMemberCount);
if (dwMemberCount > 0) { @@ -242,7 +242,7 @@ { if (_wcsicmp(argv[i], L"/help") == 0) { - PrintResourceString(IDS_LOCALGROUP_HELP); + ConResPuts(StdOut, IDS_LOCALGROUP_HELP); return 0; } else if (_wcsicmp(argv[i], L"/add") == 0) @@ -259,7 +259,7 @@ } else if (_wcsicmp(argv[i], L"/domain") == 0) { - PrintResourceString(IDS_ERROR_OPTION_NOT_SUPPORTED, L"/DOMAIN"); + ConResPrintf(StdErr, IDS_ERROR_OPTION_NOT_SUPPORTED, L"/DOMAIN"); #if 0 bDomain = TRUE; #endif @@ -284,18 +284,18 @@ }
#if 0 - printf("Group:\n %S\n", lpGroupName); + ConPrintf(StdOut, L"Group:\n %s\n", lpGroupName);
if (lpMembers != NULL) { - printf("\nMembers:\n"); + ConPuts(StdOut, L"\nMembers:\n"); for (i = 0; i < dwMemberCount; i++) - printf(" %S\n", lpMembers[i].lgrmi3_domainandname); + ConPrintf(StdOut, L" %s\n", lpMembers[i].lgrmi3_domainandname); }
if (lpComment != NULL) { - printf("\nComment:\n %S\n", lpComment); + ConPrintf(StdOut, L"\nComment:\n %s\n", lpComment); } #endif
@@ -310,7 +310,7 @@ 1002, (LPBYTE)&Info1002, NULL); - printf("Status: %lu\n", Status); + ConPrintf(StdOut, L"Status: %lu\n", Status); } else if (bAdd && !bDelete) { @@ -329,14 +329,14 @@ (lpComment == NULL) ? 0 : 1, (lpComment == NULL) ? (LPBYTE)&Info0 : (LPBYTE)&Info1, NULL); - printf("Status: %lu\n", Status); + ConPrintf(StdOut, L"Status: %lu\n", Status); } else if (!bAdd && bDelete && lpComment == NULL) { /* Delete the group */ Status = NetLocalGroupDel(NULL, lpGroupName); - printf("Status: %lu\n", Status); + ConPrintf(StdOut, L"Status: %lu\n", Status); } else { @@ -353,7 +353,7 @@ 3, (LPBYTE)lpMembers, dwMemberCount); - printf("Status: %lu\n", Status); + ConPrintf(StdOut, L"Status: %lu\n", Status); } else if (!bAdd && bDelete && lpComment == NULL) { @@ -363,7 +363,7 @@ 3, (LPBYTE)lpMembers, dwMemberCount); - printf("Status: %lu\n", Status); + ConPrintf(StdOut, L"Status: %lu\n", Status); } else { @@ -376,7 +376,7 @@ RtlFreeHeap(RtlGetProcessHeap(), 0, lpMembers);
if (result != 0) - PrintResourceString(IDS_LOCALGROUP_SYNTAX); + ConResPuts(StdOut, IDS_LOCALGROUP_SYNTAX);
return result; }
Modified: trunk/reactos/base/applications/network/net/cmdPause.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/n... ============================================================================== --- trunk/reactos/base/applications/network/net/cmdPause.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/net/cmdPause.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -19,7 +19,7 @@
if (argc != 3) { - PrintResourceString(IDS_PAUSE_SYNTAX); + ConResPuts(StdOut, IDS_PAUSE_SYNTAX); return 1; }
@@ -27,7 +27,7 @@ { if (_wcsicmp(argv[i], L"/help") == 0) { - PrintResourceString(IDS_PAUSE_HELP); + ConResPuts(StdOut, IDS_PAUSE_HELP); return 1; } } @@ -35,7 +35,7 @@ hManager = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ENUMERATE_SERVICE); if (hManager == NULL) { - printf("[OpenSCManager] Error: %ld\n", GetLastError()); + ConPrintf(StdErr, L"[OpenSCManager] Error: %ld\n", GetLastError()); nError = 1; goto done; } @@ -43,14 +43,14 @@ hService = OpenService(hManager, argv[2], SERVICE_PAUSE_CONTINUE); if (hService == NULL) { - printf("[OpenService] Error: %ld\n", GetLastError()); + ConPrintf(StdErr, L"[OpenService] Error: %ld\n", GetLastError()); nError = 1; goto done; }
if (!ControlService(hService, SERVICE_CONTROL_PAUSE, &status)) { - printf("[ControlService] Error: %ld\n", GetLastError()); + ConPrintf(StdErr, L"[ControlService] Error: %ld\n", GetLastError()); }
done:
Modified: trunk/reactos/base/applications/network/net/cmdStart.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/n... ============================================================================== --- trunk/reactos/base/applications/network/net/cmdStart.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/net/cmdStart.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -19,7 +19,7 @@ DWORD dwBufferSize = 0; DWORD dwServiceCount; DWORD dwResumeHandle = 0; - LPENUM_SERVICE_STATUS lpServiceBuffer = NULL; + LPENUM_SERVICE_STATUSW lpServiceBuffer = NULL; INT i; INT nError = 0; DWORD dwError = ERROR_SUCCESS; @@ -57,11 +57,11 @@ &dwServiceCount, &dwResumeHandle)) { - PrintToConsole(L"The following services hav been started:\n\n"); + ConPuts(StdOut, L"The following services hav been started:\n\n");
for (i = 0; i < dwServiceCount; i++) { - PrintToConsole(L" %s\n", lpServiceBuffer[i].lpDisplayName); + ConPrintf(StdOut, L" %s\n", lpServiceBuffer[i].lpDisplayName); } }
@@ -79,7 +79,7 @@ if (dwError != ERROR_SUCCESS) { /* FIXME: Print proper error message */ - printf("Error: %lu\n", dwError); + ConPrintf(StdErr, L"Error: %lu\n", dwError); }
return nError; @@ -153,7 +153,7 @@ if (dwError != ERROR_SUCCESS) { /* FIXME: Print proper error message */ - printf("Error: %lu\n", dwError); + ConPrintf(StdErr, L"Error: %lu\n", dwError); }
return nError; @@ -173,7 +173,7 @@ { if (_wcsicmp(argv[i], L"/help") == 0) { - PrintResourceString(IDS_START_HELP); + ConResPuts(StdOut, IDS_START_HELP); return 1; } }
Modified: trunk/reactos/base/applications/network/net/cmdStop.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/n... ============================================================================== --- trunk/reactos/base/applications/network/net/cmdStop.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/net/cmdStop.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -20,7 +20,7 @@
if (argc != 3) { - PrintResourceString(IDS_STOP_SYNTAX); + ConResPuts(StdOut, IDS_STOP_SYNTAX); return 1; }
@@ -28,7 +28,7 @@ { if (_wcsicmp(argv[i], L"/help") == 0) { - PrintResourceString(IDS_STOP_HELP); + ConResPuts(StdOut, IDS_STOP_HELP); return 1; } } @@ -70,7 +70,7 @@ if (dwError != ERROR_SUCCESS) { /* FIXME: Print proper error message */ - printf("Error: %lu\n", dwError); + ConPrintf(StdErr, L"Error: %lu\n", dwError); }
return nError;
Modified: trunk/reactos/base/applications/network/net/cmdUse.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/n... ============================================================================== --- trunk/reactos/base/applications/network/net/cmdUse.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/net/cmdUse.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -22,7 +22,7 @@ DWORD dCount = -1; LPNETRESOURCE lpCur;
- printf("%S\t\t\t%S\t\t\t\t%S\n", L"Local", L"Remote", L"Provider"); + ConPrintf(StdOut, L"%s\t\t\t%s\t\t\t\t%s\n", L"Local", L"Remote", L"Provider");
dRet = WNetOpenEnum(RESOURCE_CONNECTED, RESOURCETYPE_DISK, 0, NULL, &hEnum); if (dRet != WN_SUCCESS) @@ -51,7 +51,7 @@ { if (!Local || wcsicmp(lpCur->lpLocalName, Local) == 0) { - printf("%S\t\t\t%S\t\t%S\n", lpCur->lpLocalName, lpCur->lpRemoteName, lpCur->lpProvider); + ConPrintf(StdOut, L"%s\t\t\t%s\t\t%s\n", lpCur->lpLocalName, lpCur->lpRemoteName, lpCur->lpProvider); }
lpCur++; @@ -75,7 +75,7 @@ if (argc == 2) { Status = EnumerateConnections(NULL); - printf("Status: %lu\n", Status); + ConPrintf(StdOut, L"Status: %lu\n", Status); return 0; } else if (argc == 3) @@ -83,38 +83,38 @@ Len = wcslen(argv[2]); if (Len != 2) { - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); return 1; }
if (!iswalpha(argv[2][0]) || argv[2][1] != L':') { - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); return 1; }
Status = EnumerateConnections(argv[2]); - printf("Status: %lu\n", Status); + ConPrintf(StdOut, L"Status: %lu\n", Status); return 0; }
Len = wcslen(argv[2]); if (Len != 1 && Len != 2) { - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); - printf("Len: %lu\n", Len); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); + ConPrintf(StdOut, L"Len: %lu\n", Len); return 1; }
if (Len == 2 && argv[2][1] != L':') { - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); return 1; }
if (argv[2][0] != L'*' && !iswalpha(argv[2][0])) { - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); return 1; }
@@ -122,7 +122,7 @@ { if (argv[2][0] == L'*') { - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); return 1; }
@@ -138,13 +138,13 @@ Len = wcslen(argv[3]); if (Len < 4) { - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"Name"); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"Name"); return 1; }
if (argv[3][0] != L'\' || argv[3][1] != L'\') { - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"Name"); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"Name"); return 1; }
@@ -175,7 +175,7 @@ else { HeapFree(GetProcessHeap(), 0, Cpy); - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"Persistent"); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"Persistent"); return 1; } } @@ -192,7 +192,7 @@
Status = WNetUseConnection(NULL, &lpNet, NULL, NULL, CONNECT_REDIRECT | (Persist ? CONNECT_UPDATE_PROFILE : 0), Access, &Size, &OutFlags); if (argv[2][0] == L'*' && Status == NO_ERROR && OutFlags == CONNECT_LOCALDRIVE) - printf("%S is now connected to %S\n", argv[3], Access); + ConPrintf(StdOut, L"%s is now connected to %s\n", argv[3], Access);
return Status; }
Modified: trunk/reactos/base/applications/network/net/cmdUser.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/n... ============================================================================== --- trunk/reactos/base/applications/network/net/cmdUser.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/net/cmdUser.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -38,11 +38,11 @@ if (Status != NERR_Success) return Status;
- PrintToConsole(L"\n"); - PrintResourceString(IDS_USER_ACCOUNTS, pServer->sv100_name); - PrintToConsole(L"\n\n"); + ConPuts(StdOut, L"\n"); + ConResPrintf(StdOut, IDS_USER_ACCOUNTS, pServer->sv100_name); + ConPuts(StdOut, L"\n\n"); PrintPadding(L'-', 79); - PrintToConsole(L"\n"); + ConPuts(StdOut, L"\n");
NetApiBufferFree(pServer);
@@ -67,7 +67,7 @@ for (i = 0; i < dwRead; i++) { if (pBuffer[i].usri0_name) - PrintToConsole(L"%s\n", pBuffer[i].usri0_name); + ConPrintf(StdOut, L"%s\n", pBuffer[i].usri0_name); }
NetApiBufferFree(pBuffer); @@ -109,7 +109,7 @@ TimeBuffer, 80);
- PrintToConsole(L"%s %s", DateBuffer, TimeBuffer); + ConPrintf(StdOut, L"%s %s", DateBuffer, TimeBuffer); }
@@ -181,35 +181,35 @@ goto done;
PrintPaddedResourceString(IDS_USER_NAME, nPaddedLength); - PrintToConsole(L"%s\n", pUserInfo->usri4_name); + ConPrintf(StdOut, L"%s\n", pUserInfo->usri4_name);
PrintPaddedResourceString(IDS_USER_FULL_NAME, nPaddedLength); - PrintToConsole(L"%s\n", pUserInfo->usri4_full_name); + ConPrintf(StdOut, L"%s\n", pUserInfo->usri4_full_name);
PrintPaddedResourceString(IDS_USER_COMMENT, nPaddedLength); - PrintToConsole(L"%s\n", pUserInfo->usri4_comment); + ConPrintf(StdOut, L"%s\n", pUserInfo->usri4_comment);
PrintPaddedResourceString(IDS_USER_USER_COMMENT, nPaddedLength); - PrintToConsole(L"%s\n", pUserInfo->usri4_usr_comment); + ConPrintf(StdOut, L"%s\n", pUserInfo->usri4_usr_comment);
PrintPaddedResourceString(IDS_USER_COUNTRY_CODE, nPaddedLength); - PrintToConsole(L"%03ld ()\n", pUserInfo->usri4_country_code); + ConPrintf(StdOut, L"%03ld ()\n", pUserInfo->usri4_country_code);
PrintPaddedResourceString(IDS_USER_ACCOUNT_ACTIVE, nPaddedLength); if (pUserInfo->usri4_flags & UF_ACCOUNTDISABLE) - PrintResourceString(IDS_GENERIC_NO); + ConResPuts(StdOut, IDS_GENERIC_NO); else if (pUserInfo->usri4_flags & UF_LOCKOUT) - PrintResourceString(IDS_GENERIC_LOCKED); + ConResPuts(StdOut, IDS_GENERIC_LOCKED); else - PrintResourceString(IDS_GENERIC_YES); - PrintToConsole(L"\n"); + ConResPuts(StdOut, IDS_GENERIC_YES); + ConPuts(StdOut, L"\n");
PrintPaddedResourceString(IDS_USER_ACCOUNT_EXPIRES, nPaddedLength); if (pUserInfo->usri4_acct_expires == TIMEQ_FOREVER) - PrintResourceString(IDS_GENERIC_NEVER); + ConResPuts(StdOut, IDS_GENERIC_NEVER); else PrintDateTime(pUserInfo->usri4_acct_expires); - PrintToConsole(L"\n\n"); + ConPuts(StdOut, L"\n\n");
PrintPaddedResourceString(IDS_USER_PW_LAST_SET, nPaddedLength); dwLastSet = GetTimeInSeconds() - pUserInfo->usri4_password_age; @@ -217,51 +217,51 @@
PrintPaddedResourceString(IDS_USER_PW_EXPIRES, nPaddedLength); if ((pUserInfo->usri4_flags & UF_DONT_EXPIRE_PASSWD) || pUserModals->usrmod0_max_passwd_age == TIMEQ_FOREVER) - PrintResourceString(IDS_GENERIC_NEVER); + ConResPuts(StdOut, IDS_GENERIC_NEVER); else PrintDateTime(dwLastSet + pUserModals->usrmod0_max_passwd_age); - PrintToConsole(L"\n"); + ConPuts(StdOut, L"\n");
PrintPaddedResourceString(IDS_USER_PW_CHANGEABLE, nPaddedLength); PrintDateTime(dwLastSet + pUserModals->usrmod0_min_passwd_age);
PrintPaddedResourceString(IDS_USER_PW_REQUIRED, nPaddedLength); - PrintResourceString((pUserInfo->usri4_flags & UF_PASSWD_NOTREQD) ? IDS_GENERIC_NO : IDS_GENERIC_YES); - PrintToConsole(L"\n"); + ConResPuts(StdOut, (pUserInfo->usri4_flags & UF_PASSWD_NOTREQD) ? IDS_GENERIC_NO : IDS_GENERIC_YES); + ConPuts(StdOut, L"\n");
PrintPaddedResourceString(IDS_USER_CHANGE_PW, nPaddedLength); - PrintResourceString((pUserInfo->usri4_flags & UF_PASSWD_CANT_CHANGE) ? IDS_GENERIC_NO : IDS_GENERIC_YES); - PrintToConsole(L"\n\n"); + ConResPuts(StdOut, (pUserInfo->usri4_flags & UF_PASSWD_CANT_CHANGE) ? IDS_GENERIC_NO : IDS_GENERIC_YES); + ConPuts(StdOut, L"\n\n");
PrintPaddedResourceString(IDS_USER_WORKSTATIONS, nPaddedLength); if (pUserInfo->usri4_workstations == NULL || wcslen(pUserInfo->usri4_workstations) == 0) - PrintResourceString(IDS_GENERIC_ALL); + ConResPuts(StdOut, IDS_GENERIC_ALL); else - PrintToConsole(L"%s", pUserInfo->usri4_workstations); - PrintToConsole(L"\n"); + ConPrintf(StdOut, L"%s", pUserInfo->usri4_workstations); + ConPuts(StdOut, L"\n");
PrintPaddedResourceString(IDS_USER_LOGON_SCRIPT, nPaddedLength); - PrintToConsole(L"%s\n", pUserInfo->usri4_script_path); + ConPrintf(StdOut, L"%s\n", pUserInfo->usri4_script_path);
PrintPaddedResourceString(IDS_USER_PROFILE, nPaddedLength); - PrintToConsole(L"%s\n", pUserInfo->usri4_profile); + ConPrintf(StdOut, L"%s\n", pUserInfo->usri4_profile);
PrintPaddedResourceString(IDS_USER_HOME_DIR, nPaddedLength); - PrintToConsole(L"%s\n", pUserInfo->usri4_home_dir); + ConPrintf(StdOut, L"%s\n", pUserInfo->usri4_home_dir);
PrintPaddedResourceString(IDS_USER_LAST_LOGON, nPaddedLength); if (pUserInfo->usri4_last_logon == 0) - PrintResourceString(IDS_GENERIC_NEVER); + ConResPuts(StdOut, IDS_GENERIC_NEVER); else PrintDateTime(pUserInfo->usri4_last_logon); - PrintToConsole(L"\n\n"); + ConPuts(StdOut, L"\n\n");
PrintPaddedResourceString(IDS_USER_LOGON_HOURS, nPaddedLength); if (pUserInfo->usri4_logon_hours == NULL) - PrintResourceString(IDS_GENERIC_ALL); - PrintToConsole(L"\n\n"); - - PrintToConsole(L"\n"); + ConResPuts(StdOut, IDS_GENERIC_ALL); + ConPuts(StdOut, L"\n\n"); + + ConPuts(StdOut, L"\n"); PrintPaddedResourceString(IDS_USER_LOCAL_GROUPS, nPaddedLength); if (dwLocalGroupTotal != 0 && pLocalGroupInfo != NULL) { @@ -269,12 +269,12 @@ { if (i != 0) PrintPadding(L' ', nPaddedLength); - PrintToConsole(L"*%s\n", pLocalGroupInfo[i].lgrui0_name); + ConPrintf(StdOut, L"*%s\n", pLocalGroupInfo[i].lgrui0_name); } } else { - PrintToConsole(L"\n"); + ConPuts(StdOut, L"\n"); }
PrintPaddedResourceString(IDS_USER_GLOBAL_GROUPS, nPaddedLength); @@ -284,12 +284,12 @@ { if (i != 0) PrintPadding(L' ', nPaddedLength); - PrintToConsole(L"*%s\n", pGroupInfo[i].grui0_name); + ConPrintf(StdOut, L"*%s\n", pGroupInfo[i].grui0_name); } } else { - PrintToConsole(L"\n"); + ConPuts(StdOut, L"\n"); }
done: @@ -323,13 +323,13 @@
while (TRUE) { - PrintResourceString(IDS_USER_ENTER_PASSWORD1); + ConResPuts(StdOut, IDS_USER_ENTER_PASSWORD1); ReadFromConsole(szPassword1, PWLEN + 1, FALSE); - PrintToConsole(L"\n"); - - PrintResourceString(IDS_USER_ENTER_PASSWORD2); + ConPuts(StdOut, L"\n"); + + ConResPuts(StdOut, IDS_USER_ENTER_PASSWORD2); ReadFromConsole(szPassword2, PWLEN + 1, FALSE); - PrintToConsole(L"\n"); + ConPuts(StdOut, L"\n");
if (wcslen(szPassword1) == wcslen(szPassword2) && wcscmp(szPassword1, szPassword2) == 0) @@ -347,9 +347,9 @@ } else { - PrintToConsole(L"\n"); - PrintResourceString(IDS_USER_NO_PASSWORD_MATCH); - PrintToConsole(L"\n"); + ConPuts(StdOut, L"\n"); + ConResPuts(StdOut, IDS_USER_NO_PASSWORD_MATCH); + ConPuts(StdOut, L"\n"); *lpPassword = NULL; } } @@ -381,13 +381,13 @@ if (argc == 2) { Status = EnumerateUsers(); - printf("Status: %lu\n", Status); + ConPrintf(StdOut, L"Status: %lu\n", Status); return 0; } else if (argc == 3) { Status = DisplayUser(argv[2]); - printf("Status: %lu\n", Status); + ConPrintf(StdOut, L"Status: %lu\n", Status); return 0; }
@@ -395,14 +395,14 @@ if (argv[i][0] != L'/') { lpUserName = argv[i]; -// printf("User: %S\n", lpUserName); +// ConPrintf(StdOut, L"User: %s\n", lpUserName); i++; }
if (argv[i][0] != L'/') { lpPassword = argv[i]; -// printf("Password: %S\n", lpPassword); +// ConPrintf(StdOut, L"Password: %s\n", lpPassword); i++; }
@@ -410,7 +410,7 @@ { if (_wcsicmp(argv[j], L"/help") == 0) { - PrintResourceString(IDS_USER_HELP); + ConResPuts(StdOut, IDS_USER_HELP); return 0; } else if (_wcsicmp(argv[j], L"/add") == 0) @@ -423,7 +423,7 @@ } else if (_wcsicmp(argv[j], L"/domain") == 0) { - PrintResourceString(IDS_ERROR_OPTION_NOT_SUPPORTED, L"/DOMAIN"); + ConResPrintf(StdErr, IDS_ERROR_OPTION_NOT_SUPPORTED, L"/DOMAIN"); #if 0 bDomain = TRUE; #endif @@ -452,7 +452,7 @@ (LPBYTE*)&pUserInfo); if (Status != NERR_Success) { - printf("Status: %lu\n", Status); + ConPrintf(StdOut, L"Status: %lu\n", Status); result = 1; goto done; } @@ -484,7 +484,7 @@ } else { - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"/ACTIVE"); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"/ACTIVE"); result = 1; goto done; } @@ -499,7 +499,7 @@ value = wcstoul(p, &endptr, 10); if (*endptr != 0) { - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"/COUNTRYCODE"); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"/COUNTRYCODE"); result = 1; goto done; } @@ -518,7 +518,7 @@ else { /* FIXME: Parse the date */ - PrintResourceString(IDS_ERROR_OPTION_NOT_SUPPORTED, L"/EXPIRES"); + ConResPrintf(StdErr, IDS_ERROR_OPTION_NOT_SUPPORTED, L"/EXPIRES"); } } else if (_wcsnicmp(argv[j], L"/fullname:", 10) == 0) @@ -542,7 +542,7 @@ } else { - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"/PASSWORDCHG"); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"/PASSWORDCHG"); result = 1; goto done; } @@ -560,7 +560,7 @@ } else { - PrintResourceString(IDS_ERROR_INVALID_OPTION_VALUE, L"/PASSWORDREQ"); + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"/PASSWORDREQ"); result = 1; goto done; } @@ -576,7 +576,7 @@ else if (_wcsnicmp(argv[j], L"/times:", 7) == 0) { /* FIXME */ - PrintResourceString(IDS_ERROR_OPTION_NOT_SUPPORTED, L"/TIMES"); + ConResPrintf(StdErr, IDS_ERROR_OPTION_NOT_SUPPORTED, L"/TIMES"); } else if (_wcsnicmp(argv[j], L"/usercomment:", 13) == 0) { @@ -585,7 +585,7 @@ else if (_wcsnicmp(argv[j], L"/workstations:", 14) == 0) { /* FIXME */ - PrintResourceString(IDS_ERROR_OPTION_NOT_SUPPORTED, L"/WORKSTATIONS"); + ConResPrintf(StdErr, IDS_ERROR_OPTION_NOT_SUPPORTED, L"/WORKSTATIONS"); } }
@@ -597,7 +597,7 @@ 4, (LPBYTE)pUserInfo, NULL); - printf("Status: %lu\n", Status); + ConPrintf(StdOut, L"Status: %lu\n", Status); } else if (bAdd && !bDelete) { @@ -606,14 +606,14 @@ 4, (LPBYTE)pUserInfo, NULL); - printf("Status: %lu\n", Status); + ConPrintf(StdOut, L"Status: %lu\n", Status); } else if (!bAdd && bDelete) { /* Delete the user */ Status = NetUserDel(NULL, lpUserName); - printf("Status: %lu\n", Status); + ConPrintf(StdOut, L"Status: %lu\n", Status); }
done: @@ -624,7 +624,7 @@ NetApiBufferFree(pUserInfo);
if (result != 0) - PrintResourceString(IDS_USER_SYNTAX); + ConResPuts(StdOut, IDS_USER_SYNTAX);
return result; }
Modified: trunk/reactos/base/applications/network/net/help.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/n... ============================================================================== --- trunk/reactos/base/applications/network/net/help.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/net/help.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -13,133 +13,133 @@ { if (argc != 3) { - PrintResourceString(IDS_HELP_SYNTAX); + ConResPuts(StdOut, IDS_HELP_SYNTAX); return 0; }
if (_wcsicmp(argv[2],L"ACCOUNTS") == 0) { - PrintResourceString(IDS_ACCOUNTS_HELP); + ConResPuts(StdOut, IDS_ACCOUNTS_HELP); return 0; }
if (_wcsicmp(argv[2],L"COMPUTER") == 0) { - PrintResourceString(IDS_COMPUTER_HELP); + ConResPuts(StdOut, IDS_COMPUTER_HELP); return 0; }
if (_wcsicmp(argv[2],L"CONFIG") == 0) { - PrintResourceString(IDS_CONFIG_HELP); + ConResPuts(StdOut, IDS_CONFIG_HELP); return 0; }
if (_wcsicmp(argv[2],L"CONTINUE") == 0) { - PrintResourceString(IDS_CONTINUE_HELP); + ConResPuts(StdOut, IDS_CONTINUE_HELP); return 0; }
if (_wcsicmp(argv[2],L"FILE") == 0) { - PrintResourceString(IDS_FILE_HELP); + ConResPuts(StdOut, IDS_FILE_HELP); return 0; }
if (_wcsicmp(argv[2],L"GROUP") == 0) { - PrintResourceString(IDS_GROUP_HELP); + ConResPuts(StdOut, IDS_GROUP_HELP); return 0; }
if (_wcsicmp(argv[2],L"HELPMSG") == 0) { - PrintResourceString(IDS_HELPMSG_HELP); + ConResPuts(StdOut, IDS_HELPMSG_HELP); return 0; }
if (_wcsicmp(argv[2],L"LOCALGROUP") == 0) { - PrintResourceString(IDS_LOCALGROUP_HELP); + ConResPuts(StdOut, IDS_LOCALGROUP_HELP); return 0; }
if (_wcsicmp(argv[2],L"NAME") == 0) { - PrintResourceString(IDS_NAME_HELP); + ConResPuts(StdOut, IDS_NAME_HELP); return 0; }
if (_wcsicmp(argv[2],L"PAUSE") == 0) { - PrintResourceString(IDS_PAUSE_HELP); + ConResPuts(StdOut, IDS_PAUSE_HELP); return 0; }
if (_wcsicmp(argv[2],L"PRINT") == 0) { - PrintResourceString(IDS_PRINT_HELP); + ConResPuts(StdOut, IDS_PRINT_HELP); return 0; }
if (_wcsicmp(argv[2],L"SEND") == 0) { - PrintResourceString(IDS_SEND_HELP); + ConResPuts(StdOut, IDS_SEND_HELP); return 0; }
if (_wcsicmp(argv[2],L"SESSION") == 0) { - PrintResourceString(IDS_SESSION_HELP); + ConResPuts(StdOut, IDS_SESSION_HELP); return 0; }
if (_wcsicmp(argv[2],L"SHARE") == 0) { - PrintResourceString(IDS_SHARE_HELP); + ConResPuts(StdOut, IDS_SHARE_HELP); return 0; }
if (_wcsicmp(argv[2],L"START") == 0) { - PrintResourceString(IDS_START_HELP); + ConResPuts(StdOut, IDS_START_HELP); return 0; }
if (_wcsicmp(argv[2],L"STATISTICS") == 0) { - PrintResourceString(IDS_STATISTICS_HELP); + ConResPuts(StdOut, IDS_STATISTICS_HELP); return 0; }
if (_wcsicmp(argv[2],L"STOP") == 0) { - PrintResourceString(IDS_STOP_HELP); + ConResPuts(StdOut, IDS_STOP_HELP); return 0; }
if (_wcsicmp(argv[2],L"TIME") == 0) { - PrintResourceString(IDS_TIME_HELP); + ConResPuts(StdOut, IDS_TIME_HELP); return 0; }
if (_wcsicmp(argv[2],L"USE") == 0) { - PrintResourceString(IDS_USE_HELP); + ConResPuts(StdOut, IDS_USE_HELP); return 0; }
if (_wcsicmp(argv[2],L"USER") == 0) { - PrintResourceString(IDS_USER_HELP); + ConResPuts(StdOut, IDS_USER_HELP); return 0; }
if (_wcsicmp(argv[2],L"VIEW") == 0) { - PrintResourceString(IDS_VIEW_HELP); + ConResPuts(StdOut, IDS_VIEW_HELP); return 0; }
@@ -155,7 +155,7 @@ } #endif
- PrintResourceString(IDS_HELP_SYNTAX); + ConResPuts(StdOut, IDS_HELP_SYNTAX);
return 0; }
Modified: trunk/reactos/base/applications/network/net/main.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/n... ============================================================================== --- trunk/reactos/base/applications/network/net/main.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/net/main.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -46,41 +46,17 @@ };
-VOID -PrintResourceString( - INT resID, - ...) -{ - WCHAR szMsgBuffer[MAX_BUFFER_SIZE]; - WCHAR szOutBuffer[MAX_BUFFER_SIZE]; - va_list arg_ptr; - - va_start(arg_ptr, resID); - LoadStringW(GetModuleHandle(NULL), resID, szMsgBuffer, MAX_BUFFER_SIZE); - _vsnwprintf(szOutBuffer, MAX_BUFFER_SIZE, szMsgBuffer, arg_ptr); - va_end(arg_ptr); - - WriteToConsole(szOutBuffer); -} -
VOID PrintPaddedResourceString( - INT resID, + UINT uID, INT nPaddedLength) { - WCHAR szMsgBuffer[MAX_BUFFER_SIZE]; - INT nLength, i; + INT nLength;
- nLength = LoadStringW(GetModuleHandle(NULL), resID, szMsgBuffer, MAX_BUFFER_SIZE); + nLength = ConResPuts(StdOut, uID); if (nLength < nPaddedLength) - { - for (i = nLength; i < nPaddedLength; i++) - szMsgBuffer[i] = L' '; - szMsgBuffer[nPaddedLength] = UNICODE_NULL; - } - - WriteToConsole(szMsgBuffer); + PrintPadding(L' ', nPaddedLength - nLength); }
@@ -89,68 +65,14 @@ WCHAR chr, INT nPaddedLength) { + INT i; WCHAR szMsgBuffer[MAX_BUFFER_SIZE]; - INT i;
for (i = 0; i < nPaddedLength; i++) szMsgBuffer[i] = chr; szMsgBuffer[nPaddedLength] = UNICODE_NULL;
- WriteToConsole(szMsgBuffer); -} - - -VOID -PrintToConsole( - LPWSTR lpFormat, - ...) -{ - WCHAR szBuffer[MAX_BUFFER_SIZE]; - va_list arg_ptr; - - va_start(arg_ptr, lpFormat); - _vsnwprintf(szBuffer, MAX_BUFFER_SIZE, lpFormat, arg_ptr); - va_end(arg_ptr); - - WriteToConsole(szBuffer); -} - - -VOID -WriteToConsole( - LPWSTR lpString) -{ - CHAR szOemBuffer[MAX_BUFFER_SIZE * 2]; - HANDLE hOutput; - DWORD dwLength; - - dwLength = wcslen(lpString); - - hOutput = GetStdHandle(STD_OUTPUT_HANDLE); - if ((GetFileType(hOutput) & ~FILE_TYPE_REMOTE) == FILE_TYPE_CHAR) - { - WriteConsoleW(hOutput, - lpString, - dwLength, - &dwLength, - NULL); - } - else - { - dwLength = WideCharToMultiByte(CP_OEMCP, - 0, - lpString, - dwLength, - szOemBuffer, - MAX_BUFFER_SIZE * 2, - NULL, - NULL); - WriteFile(hOutput, - szOemBuffer, - dwLength, - &dwLength, - NULL); - } + ConPuts(StdOut, szMsgBuffer); }
@@ -195,9 +117,12 @@ { PCOMMAND cmdptr;
+ /* Initialize the Console Standard Streams */ + ConInitStdStreams(); + if (argc < 2) { - PrintResourceString(IDS_NET_SYNTAX); + ConResPuts(StdOut, IDS_NET_SYNTAX); return 1; }
@@ -210,13 +135,13 @@ } }
- PrintResourceString(IDS_NET_SYNTAX); + ConResPuts(StdOut, IDS_NET_SYNTAX);
return 1; }
INT unimplemented(INT argc, WCHAR **argv) { - puts("This command is not implemented yet"); + ConPuts(StdOut, L"This command is not implemented yet\n"); return 1; }
Modified: trunk/reactos/base/applications/network/net/net.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/n... ============================================================================== --- trunk/reactos/base/applications/network/net/net.h [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/net/net.h [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -7,48 +7,34 @@ #ifndef _NET_PCH_ #define _NET_PCH_
-#define WIN32_NO_STATUS - +#include <stdio.h> +#include <stdlib.h> +#include <limits.h> #include <stdarg.h>
+#define WIN32_NO_STATUS #include <windef.h> #include <winbase.h> #include <winnls.h> #include <wincon.h> -#include <winuser.h> #include <winsvc.h> #include <winnetwk.h> -#include <stdio.h> -#include <stdlib.h> -#include <limits.h> #include <lm.h> #include <ndk/rtlfuncs.h> + +#include <conutils.h>
#include "resource.h"
VOID -PrintResourceString( - INT resID, - ...); - -VOID PrintPaddedResourceString( - INT resID, + UINT uID, INT nPaddedLength);
VOID PrintPadding( WCHAR chr, INT nPaddedLength); - -VOID -PrintToConsole( - LPWSTR lpFormat, - ...); - -VOID -WriteToConsole( - LPWSTR lpString);
VOID ReadFromConsole(
Modified: trunk/reactos/base/applications/network/wlanconf/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/w... ============================================================================== --- trunk/reactos/base/applications/network/wlanconf/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/wlanconf/CMakeLists.txt [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -3,7 +3,10 @@ BEFORE include ${REACTOS_SOURCE_DIR}/sdk/include/reactos/drivers/ndisuio)
+include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/conutils) + add_executable(wlanconf wlanconf.c wlanconf.rc) set_module_type(wlanconf win32cui UNICODE) -add_importlibs(wlanconf msvcrt user32 iphlpapi kernel32) +target_link_libraries(wlanconf conutils ${PSEH_LIB}) +add_importlibs(wlanconf msvcrt iphlpapi kernel32) add_cd_file(TARGET wlanconf DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/base/applications/network/wlanconf/wlanconf.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/w... ============================================================================== --- trunk/reactos/base/applications/network/wlanconf/wlanconf.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/wlanconf/wlanconf.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -6,21 +6,20 @@ * COPYRIGHT: Copyright 2012 Cameron Gutman (cameron.gutman@reactos.org) */
+#include <stdio.h> #include <stdarg.h> +#include <tchar.h> + #include <windef.h> #include <winbase.h> -#include <winuser.h> #include <devioctl.h> -#include <tchar.h> -#include <stdio.h> #include <ntddndis.h> #include <nuiouser.h> #include <iphlpapi.h>
+#include <conutils.h> + #include "resource.h" - -#define COUNT_OF(a) (sizeof(a) / sizeof(a[0])) -#define MAX_BUFFER_SIZE 5024
BOOL bScan = FALSE;
@@ -31,45 +30,13 @@
BOOL bDisconnect = FALSE;
-/* This takes strings from a resource stringtable and outputs it to -the command prompt. */ -VOID PrintResourceString(INT resID, ...) -{ - WCHAR szMsgBuf[MAX_BUFFER_SIZE]; - va_list arg_ptr; - - va_start(arg_ptr, resID); - LoadStringW(GetModuleHandle(NULL), resID, szMsgBuf, MAX_BUFFER_SIZE); - vwprintf(szMsgBuf, arg_ptr); - va_end(arg_ptr); -} - -DWORD DoFormatMessage(DWORD ErrorCode) -{ - LPVOID lpMsgBuf; - DWORD RetVal; - - if ((RetVal = FormatMessageW( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - ErrorCode, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ - (LPWSTR) &lpMsgBuf, - 0, - NULL ))) - { - printf("%S", (LPWSTR)lpMsgBuf); - - LocalFree(lpMsgBuf); - - /* return number of WCHAR's stored in output buffer - * excluding '\0' - as FormatMessage does*/ - return RetVal; - } - else - return 0; +VOID DoFormatMessage(DWORD ErrorCode) +{ + if (ErrorCode == ERROR_SUCCESS) + return; + + ConMsgPuts(StdErr, FORMAT_MESSAGE_FROM_SYSTEM, + NULL, ErrorCode, LANG_USER_DEFAULT); }
HANDLE @@ -279,7 +246,7 @@ if (!bSuccess) return FALSE;
- PrintResourceString(IDS_SUCCESS); + ConResPuts(StdOut, IDS_SUCCESS); return TRUE; }
@@ -355,13 +322,13 @@ NULL); if (SsidInfo->SsidLength == 0 || !bSuccess) { - PrintResourceString(IDS_WLAN_DISCONNECT); + ConResPuts(StdOut, IDS_WLAN_DISCONNECT); HeapFree(GetProcessHeap(), 0, QueryOid); return TRUE; } else { - PrintResourceString(IDS_MSG_CURRENT_WIRELESS); + ConResPuts(StdOut, IDS_MSG_CURRENT_WIRELESS); }
printf("SSID: %s\n", SsidBuffer); @@ -400,11 +367,11 @@ return FALSE; }
- LoadStringW(GetModuleHandle(NULL), - *(PUINT)QueryOid->Data == Ndis802_11IBSS ? IDS_ADHOC : IDS_INFRASTRUCTURE, - szMsgBuf, - COUNT_OF(szMsgBuf)); - PrintResourceString(IDS_MSG_NETWORK_MODE, szMsgBuf); + K32LoadStringW(GetModuleHandle(NULL), + *(PUINT)QueryOid->Data == Ndis802_11IBSS ? IDS_ADHOC : IDS_INFRASTRUCTURE, + szMsgBuf, + ARRAYSIZE(szMsgBuf)); + ConResPrintf(StdOut, IDS_MSG_NETWORK_MODE, szMsgBuf);
QueryOid->Oid = OID_802_11_WEP_STATUS;
@@ -422,11 +389,11 @@ return FALSE; }
- LoadStringW(GetModuleHandle(NULL), - *(PUINT)QueryOid->Data == Ndis802_11WEPEnabled ? IDS_YES : IDS_NO, - szMsgBuf, - COUNT_OF(szMsgBuf)); - PrintResourceString(IDS_MSG_WEP_ENABLED, szMsgBuf); + K32LoadStringW(GetModuleHandle(NULL), + *(PUINT)QueryOid->Data == Ndis802_11WEPEnabled ? IDS_YES : IDS_NO, + szMsgBuf, + ARRAYSIZE(szMsgBuf)); + ConResPrintf(StdOut, IDS_MSG_WEP_ENABLED, szMsgBuf);
printf("\n"); QueryOid->Oid = OID_802_11_RSSI; @@ -458,7 +425,7 @@ if (bSuccess) { /* This OID is optional */ - PrintResourceString(IDS_MSG_TRANSMISSION_POWER, *(PUINT)QueryOid->Data); + ConResPrintf(StdOut, IDS_MSG_TRANSMISSION_POWER, *(PUINT)QueryOid->Data); }
printf("\n"); @@ -476,7 +443,7 @@ if (bSuccess) { /* This OID is optional */ - PrintResourceString(IDS_MSG_ANTENNA_COUNT, *(PUINT)QueryOid->Data); + ConResPrintf(StdOut, IDS_MSG_ANTENNA_COUNT, *(PUINT)QueryOid->Data); }
QueryOid->Oid = OID_802_11_TX_ANTENNA_SELECTED; @@ -494,9 +461,9 @@ UINT TransmitAntenna = *(PUINT)QueryOid->Data;
if (TransmitAntenna != 0xFFFFFFFF) - PrintResourceString(IDS_MSG_TRANSMIT_ANTENNA, TransmitAntenna); + ConResPrintf(StdOut, IDS_MSG_TRANSMIT_ANTENNA, TransmitAntenna); else - PrintResourceString(IDS_MSG_TRANSMIT_ANTENNA_ANY); + ConResPuts(StdOut, IDS_MSG_TRANSMIT_ANTENNA_ANY); }
QueryOid->Oid = OID_802_11_RX_ANTENNA_SELECTED; @@ -514,9 +481,9 @@ UINT ReceiveAntenna = *(PUINT)QueryOid->Data;
if (ReceiveAntenna != 0xFFFFFFFF) - PrintResourceString(IDS_MSG_RECEIVE_ANTENNA, ReceiveAntenna); + ConResPrintf(StdOut, IDS_MSG_RECEIVE_ANTENNA, ReceiveAntenna); else - PrintResourceString(IDS_MSG_RECEIVE_ANTENNA_ANY); + ConResPuts(StdOut, IDS_MSG_RECEIVE_ANTENNA_ANY); }
printf("\n"); @@ -534,7 +501,7 @@ if (bSuccess) { /* This OID is optional */ - PrintResourceString(IDS_MSG_FRAGMENT_THRESHOLD, *(PUINT)QueryOid->Data); + ConResPrintf(StdOut, IDS_MSG_FRAGMENT_THRESHOLD, *(PUINT)QueryOid->Data); }
QueryOid->Oid = OID_802_11_RTS_THRESHOLD; @@ -550,7 +517,7 @@ if (bSuccess) { /* This OID is optional */ - PrintResourceString(IDS_MSG_RTS_THRESHOLD, *(PUINT)QueryOid->Data); + ConResPrintf(StdOut, IDS_MSG_RTS_THRESHOLD, *(PUINT)QueryOid->Data); }
HeapFree(GetProcessHeap(), 0, QueryOid); @@ -725,7 +692,7 @@ if (!bSuccess) return FALSE;
- PrintResourceString(IDS_SUCCESS); + ConResPuts(StdOut, IDS_SUCCESS); return TRUE; }
@@ -802,7 +769,7 @@
if (BssidList->NumberOfItems == 0) { - PrintResourceString(IDS_NO_NETWORK); + ConResPuts(StdOut, IDS_NO_NETWORK); } else { @@ -833,18 +800,18 @@ } printf("\n");
- LoadStringW(GetModuleHandle(NULL), - BssidInfo->Privacy == 0 ? IDS_NO : IDS_YES, - szMsgBuf, - COUNT_OF(szMsgBuf)); - PrintResourceString(IDS_MSG_ENCRYPTED, szMsgBuf); - LoadStringW(GetModuleHandle(NULL), - NetworkType == Ndis802_11IBSS ? IDS_ADHOC : IDS_INFRASTRUCTURE, - szMsgBuf, - COUNT_OF(szMsgBuf)); - PrintResourceString(IDS_MSG_NETWORK_TYPE, szMsgBuf); - PrintResourceString(IDS_MSG_RSSI, (int)Rssi); - PrintResourceString(IDS_MSG_SUPPORT_RATE); + K32LoadStringW(GetModuleHandle(NULL), + BssidInfo->Privacy == 0 ? IDS_NO : IDS_YES, + szMsgBuf, + ARRAYSIZE(szMsgBuf)); + ConResPrintf(StdOut, IDS_MSG_ENCRYPTED, szMsgBuf); + K32LoadStringW(GetModuleHandle(NULL), + NetworkType == Ndis802_11IBSS ? IDS_ADHOC : IDS_INFRASTRUCTURE, + szMsgBuf, + ARRAYSIZE(szMsgBuf)); + ConResPrintf(StdOut, IDS_MSG_NETWORK_TYPE, szMsgBuf); + ConResPrintf(StdOut, IDS_MSG_RSSI, (int)Rssi); + ConResPuts(StdOut, IDS_MSG_SUPPORT_RATE);
for (j = 0; j < NDIS_802_11_LENGTH_RATES; j++) { @@ -898,7 +865,7 @@ case L'c': if (i == argc - 1) { - PrintResourceString(IDS_USAGE); + ConResPuts(StdOut, IDS_USAGE); return FALSE; } bConnect = TRUE; @@ -907,7 +874,7 @@ case L'w': if (i == argc - 1) { - PrintResourceString(IDS_USAGE); + ConResPuts(StdOut, IDS_USAGE); return FALSE; } sWepKey = argv[++i]; @@ -916,14 +883,14 @@ bAdhoc = TRUE; break; default : - PrintResourceString(IDS_USAGE); + ConResPuts(StdOut, IDS_USAGE); return FALSE; }
} else { - PrintResourceString(IDS_USAGE); + ConResPuts(StdOut, IDS_USAGE); return FALSE; } } @@ -936,12 +903,15 @@ HANDLE hAdapter; IP_ADAPTER_INDEX_MAP IpInfo;
+ /* Initialize the Console Standard Streams */ + ConInitStdStreams(); + if (!ParseCmdline(argc, argv)) return -1;
if (!OpenWlanAdapter(&hAdapter, &IpInfo)) { - PrintResourceString(IDS_NO_WLAN_ADAPTER); + ConResPuts(StdOut, IDS_NO_WLAN_ADAPTER); return -1; }
Modified: trunk/reactos/base/system/diskpart/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/diskpart/CMakeL... ============================================================================== --- trunk/reactos/base/system/diskpart/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/base/system/diskpart/CMakeLists.txt [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -1,3 +1,5 @@ + +include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/conutils)
list(APPEND SOURCE active.c @@ -43,7 +45,8 @@
add_executable(diskpart ${SOURCE} diskpart.rc) set_module_type(diskpart win32cui UNICODE) -add_importlibs(diskpart user32 advapi32 msvcrt kernel32 ntdll) +target_link_libraries(diskpart conutils ${PSEH_LIB}) +add_importlibs(diskpart advapi32 msvcrt kernel32 ntdll)
if(MSVC) add_importlibs(diskpart ntdll)
Modified: trunk/reactos/base/system/diskpart/active.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/diskpart/active... ============================================================================== --- trunk/reactos/base/system/diskpart/active.c [iso-8859-1] (original) +++ trunk/reactos/base/system/diskpart/active.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -10,7 +10,6 @@
BOOL active_main(INT argc, LPWSTR *argv) { - printf("\nActive\n"); - + ConPuts(StdOut, L"\nActive\n"); return TRUE; }
Modified: trunk/reactos/base/system/diskpart/automount.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/diskpart/automo... ============================================================================== --- trunk/reactos/base/system/diskpart/automount.c [iso-8859-1] (original) +++ trunk/reactos/base/system/diskpart/automount.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -10,6 +10,6 @@
BOOL automount_main(INT argc, LPWSTR *argv) { - printf("Automount\n"); + ConPuts(StdOut, L"Automount\n"); return TRUE; }
Modified: trunk/reactos/base/system/diskpart/break.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/diskpart/break.... ============================================================================== --- trunk/reactos/base/system/diskpart/break.c [iso-8859-1] (original) +++ trunk/reactos/base/system/diskpart/break.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -10,7 +10,6 @@
BOOL break_main(INT argc, LPWSTR *argv) { - printf("\nTODO: Add code later since Win 7 Home Premium doesn't have this feature.\n"); - + ConPuts(StdOut, L"\nTODO: Add code later since Win 7 Home Premium doesn't have this feature.\n"); return TRUE; }
Modified: trunk/reactos/base/system/diskpart/diskpart.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/diskpart/diskpa... ============================================================================== --- trunk/reactos/base/system/diskpart/diskpart.c [iso-8859-1] (original) +++ trunk/reactos/base/system/diskpart/diskpart.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -10,24 +10,7 @@
#include "diskpart.h"
-#include <stdlib.h> -#include <winbase.h> -#include <wincon.h> -#include <winuser.h> - /* FUNCTIONS ******************************************************************/ - -VOID -PrintResourceString(INT resID, ...) -{ - WCHAR szMsg[3072]; - va_list arg_ptr; - - va_start(arg_ptr, resID); - LoadStringW(GetModuleHandle(NULL), resID, szMsg, 3072); - vwprintf(szMsg, arg_ptr); - va_end(arg_ptr); -}
VOID ShowHeader(VOID) @@ -39,14 +22,14 @@ GetComputerNameW(szComputerName, &comp_size);
/* TODO: Remove this section of code when program becomes stable enough for production use. */ - wprintf(L"\n*WARNING*: This program is incomplete and may not work properly.\n"); + ConPuts(StdOut, L"\n*WARNING*: This program is incomplete and may not work properly.\n");
/* Print the header information */ - wprintf(L"\n"); - PrintResourceString(IDS_APP_HEADER); - wprintf(L"\n"); - PrintResourceString(IDS_APP_LICENSE); - PrintResourceString(IDS_APP_CURR_COMPUTER, szComputerName); + ConPuts(StdOut, L"\n"); + ConResPuts(StdOut, IDS_APP_HEADER); + ConPuts(StdOut, L"\n"); + ConResPuts(StdOut, IDS_APP_LICENSE); + ConResPrintf(StdOut, IDS_APP_CURR_COMPUTER, szComputerName); }
/* @@ -65,7 +48,7 @@ if (script == NULL) { /* if there was problems opening the file */ - PrintResourceString(IDS_ERROR_MSG_NO_SCRIPT, filename); + ConResPrintf(StdErr, IDS_ERROR_MSG_NO_SCRIPT, filename); return FALSE; /* if there is no script, exit the program */ }
@@ -97,10 +80,13 @@ int index, timeout; int result = EXIT_SUCCESS;
+ /* Initialize the Console Standard Streams */ + ConInitStdStreams(); + /* Sets the title of the program so the user will have an easier time determining the current program, especially if diskpart is running a script */ - LoadStringW(GetModuleHandle(NULL), IDS_APP_HEADER, (LPWSTR)appTitle, 50); + K32LoadStringW(GetModuleHandle(NULL), IDS_APP_HEADER, appTitle, ARRAYSIZE(appTitle)); SetConsoleTitleW(appTitle);
/* Sets the timeout value to 0 just in case the user doesn't @@ -129,7 +115,7 @@ else { /* If there is no flag, then return an error */ - PrintResourceString(IDS_ERROR_MSG_BAD_ARG, argv[index]); + ConResPrintf(StdErr, IDS_ERROR_MSG_BAD_ARG, argv[index]); result = EXIT_FAILURE; goto done; } @@ -138,7 +124,7 @@ exits as soon as the usage list is shown. */ if (_wcsicmp(tmpBuffer, L"?") == 0) { - PrintResourceString(IDS_APP_USAGE); + ConResPuts(StdOut, IDS_APP_USAGE); result = EXIT_SUCCESS; goto done; } @@ -168,7 +154,7 @@ else { /* Assume that the flag doesn't exist. */ - PrintResourceString(IDS_ERROR_MSG_BAD_ARG, tmpBuffer); + ConResPrintf(StdErr, IDS_ERROR_MSG_BAD_ARG, tmpBuffer); result = EXIT_FAILURE; goto done; } @@ -194,14 +180,14 @@ else { /* Exit failure since the user wanted to run a script */ - PrintResourceString(IDS_ERROR_MSG_NO_SCRIPT, script); + ConResPrintf(StdErr, IDS_ERROR_MSG_NO_SCRIPT, script); result = EXIT_FAILURE; goto done; } }
/* Let the user know the program is exiting */ - PrintResourceString(IDS_APP_LEAVING); + ConResPuts(StdOut, IDS_APP_LEAVING);
done: DestroyPartitionList();
Modified: trunk/reactos/base/system/diskpart/diskpart.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/diskpart/diskpa... ============================================================================== --- trunk/reactos/base/system/diskpart/diskpart.h [iso-8859-1] (original) +++ trunk/reactos/base/system/diskpart/diskpart.h [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -18,8 +18,9 @@ #include <windef.h> #include <winbase.h> #include <winreg.h> -#include <winuser.h> #include <wincon.h> + +#include <conutils.h>
/* #define NTOS_MODE_USER @@ -223,7 +224,6 @@ BOOL detail_main(INT argc, LPWSTR *argv);
/* diskpart.c */ -VOID PrintResourceString(INT resID, ...);
/* expand.c */ BOOL expand_main(INT argc, LPWSTR *argv);
Modified: trunk/reactos/base/system/diskpart/help.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/diskpart/help.c... ============================================================================== --- trunk/reactos/base/system/diskpart/help.c [iso-8859-1] (original) +++ trunk/reactos/base/system/diskpart/help.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -17,14 +17,14 @@ PCOMMAND cmdptr;
/* Print the header information */ - PrintResourceString(IDS_APP_HEADER); - printf("\n"); + ConResPuts(StdOut, IDS_APP_HEADER); + ConPuts(StdOut, L"\n");
- /* lists all the commands and the basic descriptions */ - for(cmdptr = cmds; cmdptr->name; cmdptr++) - PrintResourceString(cmdptr->help_desc); + /* List all the commands and the basic descriptions */ + for (cmdptr = cmds; cmdptr->name; cmdptr++) + ConResPuts(StdOut, cmdptr->help_desc);
- printf("\n"); + ConPuts(StdOut, L"\n"); }
/* help_main(char *arg): @@ -43,9 +43,9 @@ /* Scan internal command table */ for (cmdptr = cmds; cmdptr->name; cmdptr++) { - if(_wcsicmp(argv[1], cmdptr->name) == 0) + if (_wcsicmp(argv[1], cmdptr->name) == 0) { - PrintResourceString(cmdptr->help); + ConResPuts(StdOut, cmdptr->help); return TRUE; } }
Modified: trunk/reactos/base/system/diskpart/interpreter.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/diskpart/interp... ============================================================================== --- trunk/reactos/base/system/diskpart/interpreter.c [iso-8859-1] (original) +++ trunk/reactos/base/system/diskpart/interpreter.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -152,10 +152,10 @@ args_count = 0; memset(args_vector, 0, sizeof(args_vector));
- /* shown just before the input where the user places commands */ - PrintResourceString(IDS_APP_PROMPT); + /* Shown just before the input where the user places commands */ + ConResPuts(StdOut, IDS_APP_PROMPT);
- /* gets input from the user. */ + /* Get input from the user. */ fgetws(input_line, MAX_STRING_SIZE, stdin);
ptr = input_line; @@ -178,7 +178,7 @@ ptr++; }
- /* sends the string to find the command */ + /* Send the string to find the command */ bRun = InterpretCmd(args_count, args_vector); } }
Modified: trunk/reactos/base/system/diskpart/list.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/diskpart/list.c... ============================================================================== --- trunk/reactos/base/system/diskpart/list.c [iso-8859-1] (original) +++ trunk/reactos/base/system/diskpart/list.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -35,8 +35,8 @@ LPWSTR lpFreeUnit;
/* Header labels */ - PrintResourceString(IDS_LIST_DISK_HEAD); - PrintResourceString(IDS_LIST_DISK_LINE); + ConResPuts(StdOut, IDS_LIST_DISK_HEAD); + ConResPuts(StdOut, IDS_LIST_DISK_LINE);
Entry = DiskListHead.Flink; while (Entry != &DiskListHead) @@ -63,21 +63,21 @@ FreeSize = 0; lpFreeUnit = L"B";
- PrintResourceString(IDS_LIST_DISK_FORMAT, - (CurrentDisk == DiskEntry) ? L'*': ' ', - DiskEntry->DiskNumber, - L"Online", - DiskSize, - lpSizeUnit, - FreeSize, - lpFreeUnit, - L" ", - L" "); + ConResPrintf(StdOut, IDS_LIST_DISK_FORMAT, + (CurrentDisk == DiskEntry) ? L'*': ' ', + DiskEntry->DiskNumber, + L"Online", + DiskSize, + lpSizeUnit, + FreeSize, + lpFreeUnit, + L" ", + L" ");
Entry = Entry->Flink; }
- wprintf(L"\n\n"); + ConPuts(StdOut, L"\n\n"); }
static @@ -94,13 +94,13 @@
if (CurrentDisk == NULL) { - PrintResourceString(IDS_LIST_PARTITION_NO_DISK); + ConResPuts(StdOut, IDS_LIST_PARTITION_NO_DISK); return; }
/* Header labels */ - PrintResourceString(IDS_LIST_PARTITION_HEAD); - PrintResourceString(IDS_LIST_PARTITION_LINE); + ConResPuts(StdOut, IDS_LIST_PARTITION_HEAD); + ConResPuts(StdOut, IDS_LIST_PARTITION_LINE);
Entry = CurrentDisk->PrimaryPartListHead.Flink; while (Entry != &CurrentDisk->PrimaryPartListHead) @@ -145,14 +145,14 @@ lpOffsetUnit = L"KB"; }
- PrintResourceString(IDS_LIST_PARTITION_FORMAT, - (CurrentPartition == PartEntry) ? L'*': ' ', - PartNumber++, - IsContainerPartition(PartEntry->PartitionType) ? L"Extended" : L"Primary", - PartSize, - lpSizeUnit, - PartOffset, - lpOffsetUnit); + ConResPrintf(StdOut, IDS_LIST_PARTITION_FORMAT, + (CurrentPartition == PartEntry) ? L'*': ' ', + PartNumber++, + IsContainerPartition(PartEntry->PartitionType) ? L"Extended" : L"Primary", + PartSize, + lpSizeUnit, + PartOffset, + lpOffsetUnit); }
Entry = Entry->Flink; @@ -201,34 +201,34 @@ lpOffsetUnit = L"KB"; }
- PrintResourceString(IDS_LIST_PARTITION_FORMAT, - (CurrentPartition == PartEntry) ? L'*': ' ', - PartNumber++, - L"Logical", - PartSize, - lpSizeUnit, - PartOffset, - lpOffsetUnit); + ConResPrintf(StdOut, IDS_LIST_PARTITION_FORMAT, + (CurrentPartition == PartEntry) ? L'*': ' ', + PartNumber++, + L"Logical", + PartSize, + lpSizeUnit, + PartOffset, + lpOffsetUnit); }
Entry = Entry->Flink; }
- wprintf(L"\n"); + ConPuts(StdOut, L"\n"); }
static VOID ListVolume(VOID) { - PrintResourceString(IDS_LIST_VOLUME_HEAD); + ConResPuts(StdOut, IDS_LIST_VOLUME_HEAD); }
static VOID ListVdisk(VOID) { - printf("List VDisk!!\n"); + ConPuts(StdOut, L"List VDisk!!\n"); }
BOOL @@ -239,7 +239,7 @@ /* gets the first word from the string */ if (argc == 1) { - PrintResourceString(IDS_HELP_CMD_LIST); + ConResPuts(StdOut, IDS_HELP_CMD_LIST); return TRUE; }
@@ -253,7 +253,7 @@ else if (!wcsicmp(argv[1], L"vdisk")) ListVdisk(); else - PrintResourceString(IDS_HELP_CMD_LIST); + ConResPuts(StdOut, IDS_HELP_CMD_LIST);
return TRUE; }
Modified: trunk/reactos/base/system/diskpart/online.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/diskpart/online... ============================================================================== --- trunk/reactos/base/system/diskpart/online.c [iso-8859-1] (original) +++ trunk/reactos/base/system/diskpart/online.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -10,7 +10,6 @@
BOOL online_main(INT argc, LPWSTR *argv) { - PrintResourceString(IDS_HELP_CMD_ONLINE); - + ConResPuts(StdOut, IDS_HELP_CMD_ONLINE); return TRUE; }
Modified: trunk/reactos/base/system/diskpart/partlist.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/diskpart/partli... ============================================================================== --- trunk/reactos/base/system/diskpart/partlist.c [iso-8859-1] (original) +++ trunk/reactos/base/system/diskpart/partlist.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -9,12 +9,6 @@ /* INCLUDES *******************************************************************/
#include "diskpart.h" - -#include <stdlib.h> -#include <winbase.h> -#include <wincon.h> -#include <winuser.h> - #include <ntddscsi.h>
#define NDEBUG
Modified: trunk/reactos/base/system/diskpart/repair.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/diskpart/repair... ============================================================================== --- trunk/reactos/base/system/diskpart/repair.c [iso-8859-1] (original) +++ trunk/reactos/base/system/diskpart/repair.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -10,7 +10,6 @@
BOOL repair_main(INT argc, LPWSTR *argv) { - printf("\nTODO: Add code later since Win 7 Home Premium doesn't have this feature.\n"); - + ConPuts(StdOut, L"\nTODO: Add code later since Win 7 Home Premium doesn't have this feature.\n"); return TRUE; }
Modified: trunk/reactos/base/system/diskpart/rescan.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/diskpart/rescan... ============================================================================== --- trunk/reactos/base/system/diskpart/rescan.c [iso-8859-1] (original) +++ trunk/reactos/base/system/diskpart/rescan.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -10,10 +10,10 @@
BOOL rescan_main(INT argc, LPWSTR *argv) { - PrintResourceString(IDS_RESCAN_START); + ConResPuts(StdOut, IDS_RESCAN_START); DestroyPartitionList(); CreatePartitionList(); - PrintResourceString(IDS_RESCAN_END); + ConResPuts(StdOut, IDS_RESCAN_END);
return TRUE; }
Modified: trunk/reactos/base/system/diskpart/select.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/diskpart/select... ============================================================================== --- trunk/reactos/base/system/diskpart/select.c [iso-8859-1] (original) +++ trunk/reactos/base/system/diskpart/select.c [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -28,16 +28,16 @@
if (argc > 3) { - PrintResourceString(IDS_ERROR_INVALID_ARGS); + ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS); return; }
if (argc == 2) { if (CurrentDisk == NULL) - PrintResourceString(IDS_SELECT_NO_DISK); + ConResPuts(StdOut, IDS_SELECT_NO_DISK); else - PrintResourceString(IDS_SELECT_DISK, CurrentDisk->DiskNumber); + ConResPrintf(StdOut, IDS_SELECT_DISK, CurrentDisk->DiskNumber); return; }
@@ -45,7 +45,7 @@ if (((lValue == 0) && (endptr == argv[2])) || (lValue < 0)) { - PrintResourceString(IDS_ERROR_INVALID_ARGS); + ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS); return; }
@@ -60,14 +60,14 @@ { CurrentDisk = DiskEntry; CurrentPartition = NULL; - PrintResourceString(IDS_SELECT_DISK, CurrentDisk->DiskNumber); + ConResPrintf(StdOut, IDS_SELECT_DISK, CurrentDisk->DiskNumber); return; }
Entry = Entry->Flink; }
- PrintResourceString(IDS_SELECT_DISK_INVALID); + ConResPuts(StdErr, IDS_SELECT_DISK_INVALID); }
@@ -87,22 +87,22 @@
if (argc > 3) { - PrintResourceString(IDS_ERROR_INVALID_ARGS); + ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS); return; }
if (CurrentDisk == NULL) { - PrintResourceString(IDS_SELECT_PARTITION_NO_DISK); + ConResPuts(StdOut, IDS_SELECT_PARTITION_NO_DISK); return; }
if (argc == 2) { if (CurrentPartition == NULL) - PrintResourceString(IDS_SELECT_NO_PARTITION); + ConResPuts(StdOut, IDS_SELECT_NO_PARTITION); else - PrintResourceString(IDS_SELECT_PARTITION, CurrentPartition); + ConResPrintf(StdOut, IDS_SELECT_PARTITION, CurrentPartition); return; }
@@ -110,7 +110,7 @@ if (((lValue == 0) && (endptr == argv[2])) || (lValue < 0)) { - PrintResourceString(IDS_ERROR_INVALID_ARGS); + ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS); return; }
@@ -124,7 +124,7 @@ if (PartNumber == (ULONG)lValue) { CurrentPartition = PartEntry; - PrintResourceString(IDS_SELECT_PARTITION, PartNumber); + ConResPrintf(StdOut, IDS_SELECT_PARTITION, PartNumber); return; }
@@ -144,7 +144,7 @@ if (PartNumber == (ULONG)lValue) { CurrentPartition = PartEntry; - PrintResourceString(IDS_SELECT_PARTITION, PartNumber); + ConResPrintf(StdOut, IDS_SELECT_PARTITION, PartNumber); return; }
@@ -153,7 +153,7 @@ Entry = Entry->Flink; }
- PrintResourceString(IDS_SELECT_PARTITION_INVALID); + ConResPuts(StdErr, IDS_SELECT_PARTITION_INVALID); }
@@ -165,7 +165,7 @@ /* gets the first word from the string */ if (argc == 1) { - PrintResourceString(IDS_HELP_CMD_SELECT); + ConResPuts(StdOut, IDS_HELP_CMD_SELECT); return TRUE; }
@@ -175,7 +175,7 @@ else if (!wcsicmp(argv[1], L"partition")) SelectPartition(argc, argv); else - PrintResourceString(IDS_HELP_CMD_SELECT); + ConResPuts(StdOut, IDS_HELP_CMD_SELECT);
return TRUE; }
Modified: trunk/reactos/sdk/lib/conutils/conutils.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/conutils/conutils.h... ============================================================================== --- trunk/reactos/sdk/lib/conutils/conutils.h [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/conutils/conutils.h [iso-8859-1] Fri Oct 7 22:50:32 2016 @@ -243,30 +243,6 @@ ...);
-/* - * Those are compatibility #defines for old code! - */ - -/*** tree.c ***/ - -#define PrintStringV(szStr, args) \ - ConPrintfV(StdOut, (szStr), (args)) -#define PrintString(szStr, ...) \ - ConPrintf(StdOut, (szStr), ##__VA_ARGS__) - -/*** network/net/main.c ***/ -#define PrintToConsole(szStr, ...) \ - ConPrintf(StdOut, (szStr), ##__VA_ARGS__) - -/*** clip.c, comp.c, help.c, tree.c ***/ -/*** subst.c ***/ -/*** format.c, network/net/main.c, shutdown.c, wlanconf.c, diskpart.c ***/ - -#define PrintResourceStringV(uID, args) \ - ConResPrintfV(StdOut, (uID), (args)) -#define PrintResourceString(uID, ...) \ - ConResPrintf(StdOut, (uID), ##__VA_ARGS__) - // // TODO: Add Console paged-output printf & ResPrintf functions! //