[CACLS][CLIP][COMP][EVENTCREATE][HELP][LOGOFF][SHUTDOWN][CHKDSK][FORMAT][SUBST]

- Use Puts functions where needed;
- Fix a __stdcall that needs to be read __cdecl for a variadic function.

[CACLS]
Fix some resources so that the strings can hold on the width of a standard console screen (80 chars).

svn path=/trunk/; revision=72930
This commit is contained in:
Hermès Bélusca-Maïto 2016-10-07 21:57:12 +00:00
parent bf2828383e
commit cc5ded3854
16 changed files with 153 additions and 158 deletions

View file

@ -33,19 +33,17 @@ static GENERIC_MAPPING FileGenericMapping =
};
static
VOID PrintError(DWORD dwError)
static VOID
PrintError(DWORD dwError)
{
if (dwError == ERROR_SUCCESS)
return;
ConMsgPrintf(StdErr,
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, dwError, LANG_USER_DEFAULT);
ConMsgPuts(StdErr, FORMAT_MESSAGE_FROM_SYSTEM,
NULL, dwError, LANG_USER_DEFAULT);
}
static
BOOL
static BOOL
PrintFileDacl(IN LPTSTR FilePath,
IN LPTSTR FileName)
{
@ -63,10 +61,8 @@ PrintFileDacl(IN LPTSTR FilePath,
return FALSE;
}
_tcscpy(FullFileName,
FilePath);
_tcscat(FullFileName,
FileName);
_tcscpy(FullFileName, FilePath);
_tcscat(FullFileName, FileName);
/* find out how much memory we need */
if (!GetFileSecurity(FullFileName,
@ -182,8 +178,7 @@ BuildSidString:
}
/* print the file name or space */
_tprintf(_T("%s "),
FullFileName);
ConPrintf(StdOut, L"%s ", FullFileName);
/* attempt to map the SID to a user name */
if (AceIndex == 0)
@ -199,32 +194,29 @@ BuildSidString:
/* print the domain and/or user if possible, or the SID string */
if (Name != NULL && Domain[0] != _T('\0'))
{
_tprintf(_T("%s\\%s:"),
Domain,
Name);
ConPrintf(StdOut, L"%s\\%s:", Domain, Name);
IndentAccess = (DWORD)_tcslen(Domain) + _tcslen(Name);
}
else
{
LPTSTR DisplayString = (Name != NULL ? Name : SidString);
_tprintf(_T("%s:"),
DisplayString);
ConPrintf(StdOut, L"%s:", DisplayString);
IndentAccess = (DWORD)_tcslen(DisplayString);
}
/* print the ACE Flags */
if (Ace->Header.AceFlags & CONTAINER_INHERIT_ACE)
{
IndentAccess += PrintResourceString(IDS_ABBR_CI);
IndentAccess += ConResPuts(StdOut, IDS_ABBR_CI);
}
if (Ace->Header.AceFlags & OBJECT_INHERIT_ACE)
{
IndentAccess += PrintResourceString(IDS_ABBR_OI);
IndentAccess += ConResPuts(StdOut, IDS_ABBR_OI);
}
if (Ace->Header.AceFlags & INHERIT_ONLY_ACE)
{
IndentAccess += PrintResourceString(IDS_ABBR_IO);
IndentAccess += ConResPuts(StdOut, IDS_ABBR_IO);
}
IndentAccess += 2;
@ -236,11 +228,11 @@ BuildSidString:
{
if (AccessMask == FILE_ALL_ACCESS)
{
PrintResourceString(IDS_ABBR_NONE);
ConResPuts(StdOut, IDS_ABBR_NONE);
}
else
{
PrintResourceString(IDS_DENY);
ConResPuts(StdOut, IDS_DENY);
goto PrintSpecialAccess;
}
}
@ -248,20 +240,20 @@ BuildSidString:
{
if (AccessMask == FILE_ALL_ACCESS)
{
PrintResourceString(IDS_ABBR_FULL);
ConResPuts(StdOut, IDS_ABBR_FULL);
}
else if (!(Ace->Mask & (GENERIC_READ | GENERIC_EXECUTE)) &&
AccessMask == (FILE_GENERIC_READ | FILE_EXECUTE))
{
PrintResourceString(IDS_ABBR_READ);
ConResPuts(StdOut, IDS_ABBR_READ);
}
else if (AccessMask == (FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_EXECUTE | DELETE))
{
PrintResourceString(IDS_ABBR_CHANGE);
ConResPuts(StdOut, IDS_ABBR_CHANGE);
}
else if (AccessMask == FILE_GENERIC_WRITE)
{
PrintResourceString(IDS_ABBR_WRITE);
ConResPuts(StdOut, IDS_ABBR_WRITE);
}
else
{
@ -301,10 +293,10 @@ BuildSidString:
{STANDARD_RIGHTS_ALL, IDS_STANDARD_RIGHTS_ALL},
};
PrintResourceString(IDS_ALLOW);
ConResPuts(StdOut, IDS_ALLOW);
PrintSpecialAccess:
PrintResourceString(IDS_SPECIAL_ACCESS);
ConResPuts(StdOut, IDS_SPECIAL_ACCESS);
/* print the special access rights */
x = ARRAYSIZE(AccessRights);
@ -312,24 +304,21 @@ PrintSpecialAccess:
{
if ((Ace->Mask & AccessRights[x].Access) == AccessRights[x].Access)
{
_tprintf(_T("\n%s "),
FullFileName);
for (x2 = 0;
x2 < IndentAccess;
x2++)
ConPrintf(StdOut, L"\n%s ", FullFileName);
for (x2 = 0; x2 < IndentAccess; x2++)
{
_tprintf(_T(" "));
ConPuts(StdOut, L" ");
}
PrintResourceString(AccessRights[x].uID);
ConResPuts(StdOut, AccessRights[x].uID);
}
}
_tprintf(_T("\n"));
ConPuts(StdOut, L"\n");
}
}
_tprintf(_T("\n"));
ConPuts(StdOut, L"\n");
/* free up all resources */
if (Name != NULL)
@ -451,10 +440,14 @@ PrintDaclsOfFiles(LPCTSTR pszFiles)
}
}
else
{
break;
}
}
else
_tprintf(_T("\n"));
{
ConPuts(StdOut, L"\n");
}
} while(FindNextFile(hFind, &FindData));
LastError = GetLastError();
FindClose(hFind);
@ -758,10 +751,12 @@ int _tmain(int argc, const TCHAR *argv[])
if (argc <= 1)
{
PrintResourceString(IDS_HELP);
ConResPuts(StdOut, IDS_HELP);
return 0;
}
// FIXME: Convert to proper parsing, with support for /?
/*
* parse command line options
*/
@ -845,7 +840,7 @@ int _tmain(int argc, const TCHAR *argv[])
if (InvalidParameter)
{
PrintError(ERROR_INVALID_PARAMETER);
PrintResourceString(IDS_HELP);
ConResPuts(StdOut, IDS_HELP);
return 1;
}

View file

@ -23,7 +23,8 @@ CACLS όνομα_αρχείου [/T] [/E] [/C] [/G χρήστης:άδειες [
C Αλλαγή (εγγραφή)\n\
F Πλήρης έλεγχος\n\
/D user Αποτροπή χρήστη από προσπέλαση.\n\
Τα Wildcards μπορούν να χρησιμοποιηθούν για να προσδιορίσουν παραπαπάνω από ένα αρχεία στην εντολή.\n\
Τα Wildcards μπορούν να χρησιμοποιηθούν για να προσδιορίσουν παραπαπάνω από\n\
ένα αρχεία στην εντολή.\n\
Μπορείτε να προσδιορίσετε παρπαάνω από έναν χρήστη στην εντολή.\n\n\
Abbreviations:\n\
CI - Container Inherit.\n\

View file

@ -18,7 +18,8 @@ CACLS archivo [/T] [/E] [/C] [/G user:perm [...]] [/R usuario [...]]\n\
W Escribir\n\
C Cambiar (escribir)\n\
F Control total\n\
/R usuario Revoca los derechos de acceso al usuario especificado (unicamente válido con /E).\n\
/R usuario Revoca los derechos de acceso al usuario especificado\n\
(unicamente válido con /E).\n\
/P user:perm Reemplaza los derechos de acceso del usuario especificado.\n\
Perm puede ser: N Ninguno\n\
R Leer\n\

View file

@ -15,7 +15,8 @@ CACLS nomfichier [/T] [/E] [/C] [/G user:perm [...]] [/R user [...]]\n\
W Écriture\n\
C Modification (Écriture)\n\
F Contrôle total\n\
/R user Supprime les droits d'accès de l'utilisateur spécifié (valide uniquement avec /E).\n\
/R user Supprime les droits d'accès de l'utilisateur spécifié\n\
(valide uniquement avec /E).\n\
/P user:perm Remplace les droits d'accès de l'utilisateur spécifié.\n\
Perm peut valoir : N Aucun \n\
R Lecture\n\
@ -23,7 +24,8 @@ CACLS nomfichier [/T] [/E] [/C] [/G user:perm [...]] [/R user [...]]\n\
C Modification (Écriture)\n\
F Contrôle total\n\
/D user Interdit l'accès à l'utilisateur spécifié.\n\
Il est possible d'utiliser des caractères joker pour sélectionner plus d'un fichier avec une commande.\n\
Il est possible d'utiliser des caractères joker pour sélectionner plus d'un\n\
fichier avec une commande.\n\
Il est possible de spécifier plus d'un utilisateur dans une commande.\n\n\
Abréviations:\n\
CI - Héritage du conteneur.\n\

View file

@ -2,7 +2,9 @@ LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL
STRINGTABLE
BEGIN
IDS_HELP "ACL's (Access Control Lists, toegangslijsten) van bestanden weergeven\nof bewerken\n\nCACLS bestandsnaam [/T] [/E] [/C] [/G gebr:toeg] [/R gebruiker [...]]\n\
IDS_HELP "ACL's (Access Control Lists, toegangslijsten) van bestanden weergeven\n\
of bewerken\n\n\
CACLS bestandsnaam [/T] [/E] [/C] [/G gebr:toeg] [/R gebruiker [...]]\n\
[/P gebr:toeg [...]] [/D gebruiker [...]]\n\
bestandsnaam ACL's weergeven.\n\
/T ACL's wijzigen van opgegeven bestanden in\n\

View file

@ -24,7 +24,8 @@ CACLS nazwa pliku [/T] [/E] [/C] [/G użytkownik:dostęp [...]] [/R użytkownik
W Zapis\n\
C Zmiana (zapis)\n\
F Pełny dostęp\n\
/R użytkownik Odwołuje prawa dostępu określonemu użytkownikowi (działa tylko z opcją /E).\n\
/R użytkownik Odwołuje prawa dostępu określonemu użytkownikowi\n\
(działa tylko z opcją /E).\n\
/P użytkownik:dostęp Edytuje prawa dostępu określonego użytkownika.\n\
Poziom dostępu:\n\
N Brak\n\
@ -33,7 +34,8 @@ CACLS nazwa pliku [/T] [/E] [/C] [/G użytkownik:dostęp [...]] [/R użytkownik
C Zmiana (zapis)\n\
F Pełny dostęp\n\
/D użytkownik Odbiera prawa dostępu określonemu użytkownikowi.\n\
W jednym poleceniu można edytować prawa dostępu do wielu plików, używając symboli wieloznacznych.\n\
W jednym poleceniu można edytować prawa dostępu do wielu plików, używając\n\
symboli wieloznacznych.\n\
W jednym poleceniu można edytować prawa dostępu wielu użytkowników.\n\n\
Skróty:\n\
CI - Dziedziczenie kontenera.\n\

View file

@ -21,9 +21,8 @@ VOID PrintError(DWORD dwError)
if (dwError == ERROR_SUCCESS)
return;
ConMsgPrintf(StdErr,
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, dwError, LANG_USER_DEFAULT);
ConMsgPuts(StdErr, FORMAT_MESSAGE_FROM_SYSTEM,
NULL, dwError, LANG_USER_DEFAULT);
}
static BOOL IsDataUnicode(HGLOBAL hGlobal)
@ -55,13 +54,13 @@ int wmain(int argc, wchar_t** argv)
/* Check for usage */
if (argc > 1 && wcsncmp(argv[1], L"/?", 2) == 0)
{
ConResPrintf(StdOut, IDS_HELP);
ConResPuts(StdOut, IDS_HELP);
return 0;
}
if (GetFileType(hInput) == FILE_TYPE_CHAR)
{
ConResPrintf(StdOut, IDS_USAGE);
ConResPuts(StdOut, IDS_USAGE);
return 0;
}

View file

@ -26,8 +26,6 @@
#include <stdio.h>
#include <stdlib.h>
// #include <string.h>
// #include <wchar.h>
#include <assert.h>
#define WIN32_NO_STATUS
@ -102,12 +100,12 @@ int wmain (int argc, WCHAR* argv[])
break;
case L'?':
PrintResourceString(IDS_HELP);
ConResPuts(StdOut, IDS_HELP);
return EXIT_SUCCESS;
default:
PrintResourceString(IDS_INVALIDSWITCH, argv[i][1]);
PrintResourceString(IDS_HELP);
ConResPrintf(StdErr, IDS_INVALIDSWITCH, argv[i][1]);
ConResPuts(StdOut, IDS_HELP);
return EXIT_FAILURE;
}
}
@ -120,14 +118,14 @@ int wmain (int argc, WCHAR* argv[])
}
else
{
PrintResourceString(IDS_BADSYNTAX);
ConResPuts(StdErr, IDS_BADSYNTAX);
return EXIT_FAILURE;
}
Buff1 = (PBYTE)malloc(STRBUF);
if (Buff1 == NULL)
{
ConPrintf(StdErr, L"Can't get free memory for Buff1\n");
ConPuts(StdErr, L"Can't get free memory for Buff1\n");
Status = EXIT_FAILURE;
goto Cleanup;
}
@ -135,30 +133,30 @@ int wmain (int argc, WCHAR* argv[])
Buff2 = (PBYTE)malloc(STRBUF);
if (Buff2 == NULL)
{
ConPrintf(StdErr, L"Can't get free memory for Buff2\n");
ConPuts(StdErr, L"Can't get free memory for Buff2\n");
Status = EXIT_FAILURE;
goto Cleanup;
}
if ((fp1 = _wfopen(File1, L"rb")) == NULL)
{
PrintResourceString(IDS_FILEERROR, File1);
ConResPrintf(StdErr, IDS_FILEERROR, File1);
Status = EXIT_FAILURE;
goto Cleanup;
}
if ((fp2 = _wfopen(File2, L"rb")) == NULL)
{
PrintResourceString(IDS_FILEERROR, File2);
ConResPrintf(StdErr, IDS_FILEERROR, File2);
Status = EXIT_FAILURE;
goto Cleanup;
}
PrintResourceString(IDS_COMPARING, File1, File2);
ConResPrintf(StdOut, IDS_COMPARING, File1, File2);
FileSizeFile1 = FileSize(fp1);
if (FileSizeFile1 == -1)
{
PrintResourceString(IDS_FILESIZEERROR, File1);
ConResPrintf(StdErr, IDS_FILESIZEERROR, File1);
Status = EXIT_FAILURE;
goto Cleanup;
}
@ -166,14 +164,14 @@ int wmain (int argc, WCHAR* argv[])
FileSizeFile2 = FileSize(fp2);
if (FileSizeFile2 == -1)
{
PrintResourceString(IDS_FILESIZEERROR, File2);
ConResPrintf(StdErr, IDS_FILESIZEERROR, File2);
Status = EXIT_FAILURE;
goto Cleanup;
}
if (FileSizeFile1 != FileSizeFile2)
{
PrintResourceString(IDS_SIZEDIFFERS);
ConResPuts(StdOut, IDS_SIZEDIFFERS);
Status = EXIT_FAILURE;
goto Cleanup;
}
@ -187,7 +185,7 @@ int wmain (int argc, WCHAR* argv[])
if (ferror(fp1) || ferror(fp2))
{
PrintResourceString(IDS_READERROR);
ConResPuts(StdErr, IDS_READERROR);
Status = EXIT_FAILURE;
goto Cleanup;
}
@ -205,22 +203,22 @@ int wmain (int argc, WCHAR* argv[])
/* Reporting here a mismatch */
if (bLineNos)
{
PrintResourceString(IDS_MISMATCHLINE, LineNumber);
ConResPrintf(StdOut, IDS_MISMATCHLINE, LineNumber);
}
else
{
PrintResourceString(IDS_MISMATCHOFFSET, Offset);
ConResPrintf(StdOut, IDS_MISMATCHOFFSET, Offset);
}
if (bAscii)
{
PrintResourceString(IDS_ASCIIDIFF, 1, Buff1[i]);
PrintResourceString(IDS_ASCIIDIFF, 2, Buff2[i]);
ConResPrintf(StdOut, IDS_ASCIIDIFF, 1, Buff1[i]);
ConResPrintf(StdOut, IDS_ASCIIDIFF, 2, Buff2[i]);
}
else
{
PrintResourceString(IDS_HEXADECIMALDIFF, 1, Buff1[i]);
PrintResourceString(IDS_HEXADECIMALDIFF, 2, Buff2[i]);
ConResPrintf(StdOut, IDS_HEXADECIMALDIFF, 1, Buff1[i]);
ConResPrintf(StdOut, IDS_HEXADECIMALDIFF, 2, Buff2[i]);
}
}
@ -232,7 +230,7 @@ int wmain (int argc, WCHAR* argv[])
}
if (FilesOK)
PrintResourceString(IDS_MATCH);
ConResPuts(StdOut, IDS_MATCH);
Cleanup:
if (fp2)

View file

@ -113,10 +113,9 @@ VOID PrintError(DWORD dwError)
if (dwError == ERROR_SUCCESS)
return;
ConMsgPrintf(StdErr,
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, dwError, LANG_USER_DEFAULT);
ConPrintf(StdErr, L"\n");
ConMsgPuts(StdErr, FORMAT_MESSAGE_FROM_SYSTEM,
NULL, dwError, LANG_USER_DEFAULT);
ConPuts(StdErr, L"\n");
}
@ -594,7 +593,7 @@ Finalize:
else
{
/* This is NOT a custom source, we must return an error! */
ConResPrintf(StdErr, IDS_SOURCE_NOT_CUSTOM);
ConResPuts(StdErr, IDS_SOURCE_NOT_CUSTOM);
goto Quit;
}
}
@ -605,7 +604,7 @@ Finalize:
if (!LogNameValid /* && !FoundLog */)
{
/* The log name is not specified, we cannot create the source */
ConResPrintf(StdErr, IDS_SOURCE_NOCREATE);
ConResPuts(StdErr, IDS_SOURCE_NOCREATE);
goto Quit;
}
else // LogNameValid && FoundLog
@ -721,7 +720,7 @@ typedef enum _PARSER_ERROR
MandatoryOptionAbsent,
} PARSER_ERROR;
typedef VOID (__stdcall *PRINT_ERROR_FUNC)(IN PARSER_ERROR, ...);
typedef VOID (__cdecl *PRINT_ERROR_FUNC)(IN PARSER_ERROR, ...);
BOOL
DoParse(
@ -982,7 +981,7 @@ DoParse(
static VOID
__stdcall
__cdecl
PrintParserError(PARSER_ERROR Error, ...)
{
/* WARNING: Please keep this lookup table in sync with the resources! */
@ -1008,7 +1007,7 @@ PrintParserError(PARSER_ERROR Error, ...)
va_end(args);
if (Error != Success)
ConResPrintf(StdErr, IDS_USAGE);
ConResPuts(StdErr, IDS_USAGE);
}
else
{
@ -1121,7 +1120,7 @@ int wmain(int argc, WCHAR* argv[])
return EXIT_FAILURE;
}
ConResPrintf(StdOut, IDS_HELP);
ConResPuts(StdOut, IDS_HELP);
return EXIT_SUCCESS;
}
@ -1141,7 +1140,7 @@ int wmain(int argc, WCHAR* argv[])
{
/* Invalid event identifier */
ConResPrintf(StdErr, IDS_BADSYNTAX_7, OPT_EVTID.OptionStr, EVENT_ID_MIN, EVENT_ID_MAX);
ConResPrintf(StdErr, IDS_USAGE);
ConResPuts(StdErr, IDS_USAGE);
return EXIT_FAILURE;
}
@ -1238,12 +1237,12 @@ int wmain(int argc, WCHAR* argv[])
if (!Success)
{
PrintError(GetLastError());
ConPrintf(StdErr, L"Failed to report event!\n");
ConPuts(StdErr, L"Failed to report event!\n");
}
else
{
/* Show success */
ConPrintf(StdOut, L"\n");
ConPuts(StdOut, L"\n");
if (!szEventSource)
ConResPrintf(StdOut, IDS_SUCCESS_1, szEventType, szLogName);
else if (!szLogName)
@ -1257,7 +1256,7 @@ int wmain(int argc, WCHAR* argv[])
else
{
PrintError(GetLastError());
ConPrintf(StdErr, L"GetUserToken() failed!\n");
ConPuts(StdErr, L"GetUserToken() failed!\n");
}
/* Close the event log */

View file

@ -66,8 +66,8 @@ int wmain(int argc, WCHAR* argv[])
*/
if (argc <= 1)
{
PrintResourceString(IDS_HELP1);
PrintResourceString(IDS_HELP2);
ConResPuts(StdOut, IDS_HELP1);
ConResPuts(StdOut, IDS_HELP2);
return 0;
}
@ -77,7 +77,7 @@ int wmain(int argc, WCHAR* argv[])
*/
if ((argc > 2) || (wcscmp(argv[1], L"/?") == 0))
{
PrintResourceString(IDS_USAGE);
ConResPuts(StdOut, IDS_USAGE);
return 0;
}
@ -87,7 +87,7 @@ int wmain(int argc, WCHAR* argv[])
*/
if (!IsInternalCommand(argv[1]))
{
PrintResourceString(IDS_NO_ENTRY, argv[1]);
ConResPrintf(StdOut, IDS_NO_ENTRY, argv[1]);
return 0;
}

View file

@ -32,9 +32,8 @@ BOOL bVerbose;
//----------------------------------------------------------------------
VOID DisplayError(DWORD dwError)
{
ConMsgPrintf(StdErr,
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, dwError, LANG_USER_DEFAULT);
ConMsgPuts(StdErr, FORMAT_MESSAGE_FROM_SYSTEM,
NULL, dwError, LANG_USER_DEFAULT);
ConPrintf(StdErr, L"Error code: %lu\n", dwError);
}
@ -65,7 +64,7 @@ BOOL ParseCommandLine(int argc, WCHAR *argv[])
}
default:
//Invalid parameter detected
ConResPrintf(StdErr, IDS_ILLEGAL_PARAM);
ConResPuts(StdErr, IDS_ILLEGAL_PARAM);
return FALSE;
}
}
@ -87,7 +86,7 @@ int wmain(int argc, WCHAR *argv[])
// Parse command line
//
if (!ParseCommandLine(argc, argv)) {
ConResPrintf(StdOut, IDS_USAGE);
ConResPuts(StdOut, IDS_USAGE);
return 1;
}
@ -96,11 +95,11 @@ int wmain(int argc, WCHAR *argv[])
//
if (szRemoteServerName) {
if (bVerbose) {
ConResPrintf(StdOut, IDS_LOGOFF_REMOTE);
ConResPuts(StdOut, IDS_LOGOFF_REMOTE);
}
// FIXME: Add Remote Procedure Call to logoff user on a remote machine
ConPrintf(StdErr, L"Remote Procedure Call in logoff.exe has not been implemented");
ConPuts(StdErr, L"Remote Procedure Call in logoff.exe has not been implemented");
}
//
// Perform logoff of current session on local machine instead
@ -108,7 +107,7 @@ int wmain(int argc, WCHAR *argv[])
else {
if (bVerbose) {
// Get resource string, and print it.
ConResPrintf(StdOut, IDS_LOGOFF_LOCAL);
ConResPuts(StdOut, IDS_LOGOFF_LOCAL);
}
// Actual logoff

View file

@ -162,9 +162,8 @@ DWORD ParseReasonCode(LPCWSTR code)
/* Writes the last error as both text and error code to the console */
VOID DisplayError(DWORD dwError)
{
ConMsgPrintf(StdErr,
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, dwError, LANG_USER_DEFAULT);
ConMsgPuts(StdErr, FORMAT_MESSAGE_FROM_SYSTEM,
NULL, dwError, LANG_USER_DEFAULT);
ConPrintf(StdErr, L"Error code: %lu\n", dwError);
}

View file

@ -48,7 +48,7 @@ ParseArguments(struct CommandLineOptions* pOpts, int argc, WCHAR *argv[])
switch (towlower(argv[index][1]))
{
case L'?': /* Help */
PrintResourceString(IDS_USAGE);
ConResPuts(StdOut, IDS_USAGE);
return ERROR_SUCCESS;
case L'a': /* Cancel delayed shutdown */
@ -66,7 +66,7 @@ ParseArguments(struct CommandLineOptions* pOpts, int argc, WCHAR *argv[])
}
else
{
PrintResourceString(IDS_ERROR_MAX_COMMENT_LENGTH);
ConResPuts(StdErr, IDS_ERROR_MAX_COMMENT_LENGTH);
return ERROR_BAD_LENGTH;
}
break;
@ -125,7 +125,7 @@ ParseArguments(struct CommandLineOptions* pOpts, int argc, WCHAR *argv[])
default:
/* Unknown arguments will exit the program. */
PrintResourceString(IDS_USAGE);
ConResPuts(StdOut, IDS_USAGE);
return ERROR_SUCCESS;
}
}
@ -192,7 +192,7 @@ int wmain(int argc, WCHAR *argv[])
if (argc == 1) /* i.e. no commandline arguments given */
{
PrintResourceString(IDS_USAGE);
ConResPuts(StdOut, IDS_USAGE);
return EXIT_SUCCESS;
}
@ -216,7 +216,7 @@ int wmain(int argc, WCHAR *argv[])
/* Abort the delayed system shutdown specified. */
if (!AbortSystemShutdownW(opts.remote_system))
{
PrintResourceString(IDS_ERROR_ABORT);
ConResPuts(StdErr, IDS_ERROR_ABORT);
DisplayError(GetLastError());
return EXIT_FAILURE;
}
@ -245,13 +245,13 @@ int wmain(int argc, WCHAR *argv[])
if (!SetSuspendState(TRUE, FALSE, FALSE))
{
PrintResourceString(IDS_ERROR_HIBERNATE);
ConResPuts(StdErr, IDS_ERROR_HIBERNATE);
DisplayError(GetLastError());
return EXIT_FAILURE;
}
else
{
PrintResourceString(IDS_ERROR_HIBERNATE_ENABLED);
ConResPuts(StdOut, IDS_ERROR_HIBERNATE_ENABLED);
return EXIT_SUCCESS;
}
}
@ -264,14 +264,14 @@ int wmain(int argc, WCHAR *argv[])
/* Both shutdown and restart flags cannot both be true */
if (opts.shutdown && opts.restart)
{
PrintResourceString(IDS_ERROR_SHUTDOWN_REBOOT);
ConResPuts(StdErr, IDS_ERROR_SHUTDOWN_REBOOT);
return EXIT_FAILURE;
}
/* Ensure that the timout amount is not too high or a negative number */
if (opts.shutdown_delay > MAX_SHUTDOWN_TIMEOUT)
{
PrintResourceString(IDS_ERROR_TIMEOUT, opts.shutdown_delay);
ConResPrintf(StdErr, IDS_ERROR_TIMEOUT, opts.shutdown_delay);
return EXIT_FAILURE;
}
@ -302,7 +302,7 @@ int wmain(int argc, WCHAR *argv[])
}
else
{
PrintResourceString(IDS_ERROR_LOGOFF);
ConResPuts(StdErr, IDS_ERROR_LOGOFF);
DisplayError(GetLastError());
return EXIT_FAILURE;
}
@ -343,9 +343,9 @@ int wmain(int argc, WCHAR *argv[])
* on whether the user wanted to shutdown or restart.
*/
if (opts.restart)
PrintResourceString(IDS_ERROR_RESTART);
ConResPuts(StdErr, IDS_ERROR_RESTART);
else
PrintResourceString(IDS_ERROR_SHUTDOWN);
ConResPuts(StdErr, IDS_ERROR_SHUTDOWN);
DisplayError(GetLastError());
return EXIT_FAILURE;

View file

@ -88,10 +88,9 @@ PCHKDSK Chkdsk;
static VOID PrintWin32Error(LPWSTR Message, DWORD ErrorCode)
{
ConPrintf(StdErr, L"%s: ", Message);
ConMsgPrintf(StdErr,
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, ErrorCode, LANG_USER_DEFAULT);
ConPrintf(StdErr, L"\n");
ConMsgPuts(StdErr, FORMAT_MESSAGE_FROM_SYSTEM,
NULL, ErrorCode, LANG_USER_DEFAULT);
ConPuts(StdErr, L"\n");
}
@ -240,59 +239,59 @@ ChkdskCallback(
switch (Command)
{
case UNKNOWN2:
ConPrintf(StdOut, L"UNKNOWN2\r");
ConPuts(StdOut, L"UNKNOWN2\r");
break;
case UNKNOWN3:
ConPrintf(StdOut, L"UNKNOWN3\n");
ConPuts(StdOut, L"UNKNOWN3\n");
break;
case UNKNOWN4:
ConPrintf(StdOut, L"UNKNOWN4\n");
ConPuts(StdOut, L"UNKNOWN4\n");
break;
case UNKNOWN5:
ConPrintf(StdOut, L"UNKNOWN5\n");
ConPuts(StdOut, L"UNKNOWN5\n");
break;
case FSNOTSUPPORTED:
ConPrintf(StdOut, L"FSNOTSUPPORTED\n");
ConPuts(StdOut, L"FSNOTSUPPORTED\n");
break;
case VOLUMEINUSE:
ConPrintf(StdOut, L"VOLUMEINUSE\n");
ConPuts(StdOut, L"VOLUMEINUSE\n");
break;
case UNKNOWN9:
ConPrintf(StdOut, L"UNKNOWN9\n");
ConPuts(StdOut, L"UNKNOWN9\n");
break;
case UNKNOWNA:
ConPrintf(StdOut, L"UNKNOWNA\n");
ConPuts(StdOut, L"UNKNOWNA\n");
break;
case UNKNOWNC:
ConPrintf(StdOut, L"UNKNOWNC\n");
ConPuts(StdOut, L"UNKNOWNC\n");
break;
case UNKNOWND:
ConPrintf(StdOut, L"UNKNOWND\n");
ConPuts(StdOut, L"UNKNOWND\n");
break;
case INSUFFICIENTRIGHTS:
ConPrintf(StdOut, L"INSUFFICIENTRIGHTS\n");
ConPuts(StdOut, L"INSUFFICIENTRIGHTS\n");
break;
case STRUCTUREPROGRESS:
ConPrintf(StdOut, L"STRUCTUREPROGRESS\n");
ConPuts(StdOut, L"STRUCTUREPROGRESS\n");
break;
case DONEWITHSTRUCTURE:
ConPrintf(StdOut, L"DONEWITHSTRUCTURE\n");
ConPuts(StdOut, L"DONEWITHSTRUCTURE\n");
break;
case CLUSTERSIZETOOSMALL:
ConPrintf(StdOut, L"CLUSTERSIZETOOSMALL\n");
ConPuts(StdOut, L"CLUSTERSIZETOOSMALL\n");
break;
case PROGRESS:
@ -309,7 +308,7 @@ ChkdskCallback(
status = (PBOOLEAN)Argument;
if (*status == FALSE)
{
ConPrintf(StdOut, L"Chkdsk was unable to complete successfully.\n\n");
ConPuts(StdOut, L"Chkdsk was unable to complete successfully.\n\n");
Error = TRUE;
}
break;
@ -369,7 +368,7 @@ wmain(int argc, WCHAR *argv[])
/* Initialize the Console Standard Streams */
ConInitStdStreams();
ConPrintf(StdOut,
ConPuts(StdOut,
L"\n"
L"Chkdskx v1.0.1 by Mark Russinovich\n"
L"Systems Internals - http://www.sysinternals.com\n"
@ -381,7 +380,7 @@ wmain(int argc, WCHAR *argv[])
//
if (!LoadFMIFSEntryPoints())
{
ConPrintf(StdErr, L"Could not located FMIFS entry points.\n\n");
ConPuts(StdErr, L"Could not located FMIFS entry points.\n\n");
return -1;
}
#endif
@ -448,7 +447,7 @@ wmain(int argc, WCHAR *argv[])
0);
if (volumeHandle == INVALID_HANDLE_VALUE)
{
ConPrintf(StdErr, L"Chkdsk cannot run because the volume is in use by another process.\n\n");
ConPuts(StdErr, L"Chkdsk cannot run because the volume is in use by another process.\n\n");
return -1;
}
CloseHandle(volumeHandle);

View file

@ -117,10 +117,9 @@ SIZEDEFINITION LegalSizes[] = {
static VOID PrintWin32Error(LPWSTR Message, DWORD ErrorCode)
{
ConPrintf(StdErr, L"%s: ", Message);
ConMsgPrintf(StdErr,
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, ErrorCode, LANG_USER_DEFAULT);
ConPrintf(StdErr, L"\n");
ConMsgPuts(StdErr, FORMAT_MESSAGE_FROM_SYSTEM,
NULL, ErrorCode, LANG_USER_DEFAULT);
ConPuts(StdErr, L"\n");
}
@ -241,7 +240,7 @@ FormatExCallback(
status = (PBOOLEAN)Argument;
if (*status == FALSE)
{
ConResPrintf(StdOut, STRING_FORMAT_FAIL);
ConResPuts(StdOut, STRING_FORMAT_FAIL);
Error = TRUE;
}
break;
@ -260,7 +259,7 @@ FormatExCallback(
case UNKNOWND:
case STRUCTUREPROGRESS:
case CLUSTERSIZETOOSMALL:
ConResPrintf(StdOut, STRING_NO_SUPPORT);
ConResPuts(StdOut, STRING_NO_SUPPORT);
return FALSE;
}
return TRUE;
@ -374,7 +373,7 @@ int wmain(int argc, WCHAR *argv[])
/* Initialize the Console Standard Streams */
ConInitStdStreams();
ConPrintf(StdOut,
ConPuts(StdOut,
L"\n"
L"Formatx v1.0 by Mark Russinovich\n"
L"Systems Internals - http://www.sysinternals.com\n"
@ -386,7 +385,7 @@ int wmain(int argc, WCHAR *argv[])
//
if (!LoadFMIFSEntryPoints())
{
ConResPrintf(StdErr, STRING_FMIFS_FAIL);
ConResPuts(StdErr, STRING_FMIFS_FAIL);
return -1;
}
#endif
@ -397,7 +396,7 @@ int wmain(int argc, WCHAR *argv[])
badArg = ParseCommandLine(argc, argv);
if (badArg)
{
ConResPrintf(StdOut, STRING_UNKNOW_ARG, argv[badArg]);
ConResPrintf(StdErr, STRING_UNKNOW_ARG, argv[badArg]);
Usage(argv[0]);
return -1;
}
@ -407,7 +406,7 @@ int wmain(int argc, WCHAR *argv[])
//
if (!Drive)
{
ConResPrintf(StdOut, STRING_DRIVE_PARM);
ConResPuts(StdErr, STRING_DRIVE_PARM);
Usage(argv[0]);
return -1;
}
@ -431,7 +430,7 @@ int wmain(int argc, WCHAR *argv[])
case DRIVE_REMOTE:
case DRIVE_CDROM:
ConResPrintf(StdOut, STRING_NO_SUPPORT);
ConResPuts(StdOut, STRING_NO_SUPPORT);
return -1;
case DRIVE_NO_ROOT_DIR:
@ -462,7 +461,7 @@ int wmain(int argc, WCHAR *argv[])
if (towlower(path[0]) == towlower(Drive[0]))
{
// todo: report "Cannot format system drive"
ConResPrintf(StdOut, STRING_NO_SUPPORT);
ConResPuts(StdOut, STRING_NO_SUPPORT);
return -1;
}
}
@ -507,7 +506,7 @@ int wmain(int argc, WCHAR *argv[])
if (!wcsicmp(input, volumeName))
break;
ConResPrintf(StdOut, STRING_ERROR_LABEL);
ConResPuts(StdOut, STRING_ERROR_LABEL);
}
}
@ -520,7 +519,7 @@ int wmain(int argc, WCHAR *argv[])
if (_wcsnicmp(&input[0], &szMsg[0], 1) == 0) break;
if (_wcsnicmp(&input[0], &szMsg[1], 1) == 0)
{
ConPrintf(StdOut, L"\n");
ConPuts(StdOut, L"\n");
return 0;
}
}
@ -554,7 +553,7 @@ int wmain(int argc, WCHAR *argv[])
ConPrintf(StdOut, L"%s %.2fM\n", szMsg,
((float)(LONGLONG)totalNumberOfBytes.QuadPart)/(float)(1024.0*1024.0));
}
ConResPrintf(StdOut, STRING_CREATE_FSYS);
ConResPuts(StdOut, STRING_CREATE_FSYS);
}
//
@ -563,7 +562,7 @@ int wmain(int argc, WCHAR *argv[])
FormatEx(RootDirectory, media, FileSystem, Label, QuickFormat,
ClusterSize, FormatExCallback);
if (Error) return -1;
ConResPrintf(StdOut, STRING_FMT_COMPLETE);
ConResPuts(StdOut, STRING_FMT_COMPLETE);
//
// Enable compression if desired
@ -571,7 +570,7 @@ int wmain(int argc, WCHAR *argv[])
if (CompressDrive)
{
if (!EnableVolumeCompression(RootDirectory, TRUE))
ConResPrintf(StdOut, STRING_VOL_COMPRESS);
ConResPuts(StdOut, STRING_VOL_COMPRESS);
}
//
@ -579,7 +578,7 @@ int wmain(int argc, WCHAR *argv[])
//
if (!GotALabel)
{
ConResPrintf(StdOut, STRING_ENTER_LABEL);
ConResPuts(StdOut, STRING_ENTER_LABEL);
fgetws(input, ARRAYSIZE(LabelString), stdin);
input[wcslen(input) - 1] = 0;

View file

@ -267,7 +267,7 @@ Quit:
case ERROR_IS_SUBSTED:
{
ConResPrintf(StdErr, IDS_DRIVE_ALREADY_SUBSTED);
ConResPuts(StdErr, IDS_DRIVE_ALREADY_SUBSTED);
return 1;
}
@ -305,7 +305,7 @@ int wmain(int argc, WCHAR* argv[])
{
if (!_wcsicmp(argv[i], L"/?"))
{
ConResPrintf(StdOut, IDS_USAGE);
ConResPuts(StdOut, IDS_USAGE);
return 0;
}
}