};
-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)
{
return FALSE;
}
- _tcscpy(FullFileName,
- FilePath);
- _tcscat(FullFileName,
- FileName);
+ _tcscpy(FullFileName, FilePath);
+ _tcscat(FullFileName, FileName);
/* find out how much memory we need */
if (!GetFileSecurity(FullFileName,
}
/* 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)
/* 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;
{
if (AccessMask == FILE_ALL_ACCESS)
{
- PrintResourceString(IDS_ABBR_NONE);
+ ConResPuts(StdOut, IDS_ABBR_NONE);
}
else
{
- PrintResourceString(IDS_DENY);
+ ConResPuts(StdOut, IDS_DENY);
goto PrintSpecialAccess;
}
}
{
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
{
{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);
{
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)
}
}
else
+ {
break;
+ }
}
else
- _tprintf(_T("\n"));
+ {
+ ConPuts(StdOut, L"\n");
+ }
} while(FindNextFile(hFind, &FindData));
LastError = GetLastError();
FindClose(hFind);
if (argc <= 1)
{
- PrintResourceString(IDS_HELP);
+ ConResPuts(StdOut, IDS_HELP);
return 0;
}
+ // FIXME: Convert to proper parsing, with support for /?
+
/*
* parse command line options
*/
if (InvalidParameter)
{
PrintError(ERROR_INVALID_PARAMETER);
- PrintResourceString(IDS_HELP);
+ ConResPuts(StdOut, IDS_HELP);
return 1;
}
C Αλλαγή (εγγραφή)\n\
F Πλήρης έλεγχος\n\
/D user Αποτροπή χρήστη από προσπέλαση.\n\
-Τα Wildcards μπορούν να χρησιμοποιηθούν για να προσδιορίσουν παραπαπάνω από ένα αρχεία στην εντολή.\n\
+Τα Wildcards μπορούν να χρησιμοποιηθούν για να προσδιορίσουν παραπαπάνω από\n\
+ένα αρχεία στην εντολή.\n\
Μπορείτε να προσδιορίσετε παρπαάνω από έναν χρήστη στην εντολή.\n\n\
Abbreviations:\n\
CI - Container Inherit.\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\
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\
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\
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\
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\
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\
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)
/* 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;
}
#include <stdio.h>
#include <stdlib.h>
-// #include <string.h>
-// #include <wchar.h>
#include <assert.h>
#define WIN32_NO_STATUS
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;
}
}
}
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;
}
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;
}
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;
}
if (ferror(fp1) || ferror(fp2))
{
- PrintResourceString(IDS_READERROR);
+ ConResPuts(StdErr, IDS_READERROR);
Status = EXIT_FAILURE;
goto Cleanup;
}
/* 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]);
}
}
}
if (FilesOK)
- PrintResourceString(IDS_MATCH);
+ ConResPuts(StdOut, IDS_MATCH);
Cleanup:
if (fp2)
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");
}
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;
}
}
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
MandatoryOptionAbsent,
} PARSER_ERROR;
-typedef VOID (__stdcall *PRINT_ERROR_FUNC)(IN PARSER_ERROR, ...);
+typedef VOID (__cdecl *PRINT_ERROR_FUNC)(IN PARSER_ERROR, ...);
BOOL
DoParse(
static VOID
-__stdcall
+__cdecl
PrintParserError(PARSER_ERROR Error, ...)
{
/* WARNING: Please keep this lookup table in sync with the resources! */
va_end(args);
if (Error != Success)
- ConResPrintf(StdErr, IDS_USAGE);
+ ConResPuts(StdErr, IDS_USAGE);
}
else
{
return EXIT_FAILURE;
}
- ConResPrintf(StdOut, IDS_HELP);
+ ConResPuts(StdOut, IDS_HELP);
return EXIT_SUCCESS;
}
{
/* 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;
}
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)
else
{
PrintError(GetLastError());
- ConPrintf(StdErr, L"GetUserToken() failed!\n");
+ ConPuts(StdErr, L"GetUserToken() failed!\n");
}
/* Close the event log */
*/
if (argc <= 1)
{
- PrintResourceString(IDS_HELP1);
- PrintResourceString(IDS_HELP2);
+ ConResPuts(StdOut, IDS_HELP1);
+ ConResPuts(StdOut, IDS_HELP2);
return 0;
}
*/
if ((argc > 2) || (wcscmp(argv[1], L"/?") == 0))
{
- PrintResourceString(IDS_USAGE);
+ ConResPuts(StdOut, IDS_USAGE);
return 0;
}
*/
if (!IsInternalCommand(argv[1]))
{
- PrintResourceString(IDS_NO_ENTRY, argv[1]);
+ ConResPrintf(StdOut, IDS_NO_ENTRY, argv[1]);
return 0;
}
//----------------------------------------------------------------------
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);
}
}
default:
//Invalid parameter detected
- ConResPrintf(StdErr, IDS_ILLEGAL_PARAM);
+ ConResPuts(StdErr, IDS_ILLEGAL_PARAM);
return FALSE;
}
}
// Parse command line
//
if (!ParseCommandLine(argc, argv)) {
- ConResPrintf(StdOut, IDS_USAGE);
+ ConResPuts(StdOut, IDS_USAGE);
return 1;
}
//
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
else {
if (bVerbose) {
// Get resource string, and print it.
- ConResPrintf(StdOut, IDS_LOGOFF_LOCAL);
+ ConResPuts(StdOut, IDS_LOGOFF_LOCAL);
}
// Actual logoff
/* 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);
}
switch (towlower(argv[index][1]))
{
case L'?': /* Help */
- PrintResourceString(IDS_USAGE);
+ ConResPuts(StdOut, IDS_USAGE);
return ERROR_SUCCESS;
case L'a': /* Cancel delayed shutdown */
}
else
{
- PrintResourceString(IDS_ERROR_MAX_COMMENT_LENGTH);
+ ConResPuts(StdErr, IDS_ERROR_MAX_COMMENT_LENGTH);
return ERROR_BAD_LENGTH;
}
break;
default:
/* Unknown arguments will exit the program. */
- PrintResourceString(IDS_USAGE);
+ ConResPuts(StdOut, IDS_USAGE);
return ERROR_SUCCESS;
}
}
if (argc == 1) /* i.e. no commandline arguments given */
{
- PrintResourceString(IDS_USAGE);
+ ConResPuts(StdOut, IDS_USAGE);
return EXIT_SUCCESS;
}
/* 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;
}
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;
}
}
/* 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;
}
}
else
{
- PrintResourceString(IDS_ERROR_LOGOFF);
+ ConResPuts(StdErr, IDS_ERROR_LOGOFF);
DisplayError(GetLastError());
return EXIT_FAILURE;
}
* 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;
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");
}
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:
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;
/* 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"
//
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
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);
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");
}
status = (PBOOLEAN)Argument;
if (*status == FALSE)
{
- ConResPrintf(StdOut, STRING_FORMAT_FAIL);
+ ConResPuts(StdOut, STRING_FORMAT_FAIL);
Error = TRUE;
}
break;
case UNKNOWND:
case STRUCTUREPROGRESS:
case CLUSTERSIZETOOSMALL:
- ConResPrintf(StdOut, STRING_NO_SUPPORT);
+ ConResPuts(StdOut, STRING_NO_SUPPORT);
return FALSE;
}
return TRUE;
/* 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"
//
if (!LoadFMIFSEntryPoints())
{
- ConResPrintf(StdErr, STRING_FMIFS_FAIL);
+ ConResPuts(StdErr, STRING_FMIFS_FAIL);
return -1;
}
#endif
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;
}
//
if (!Drive)
{
- ConResPrintf(StdOut, STRING_DRIVE_PARM);
+ ConResPuts(StdErr, STRING_DRIVE_PARM);
Usage(argv[0]);
return -1;
}
case DRIVE_REMOTE:
case DRIVE_CDROM:
- ConResPrintf(StdOut, STRING_NO_SUPPORT);
+ ConResPuts(StdOut, STRING_NO_SUPPORT);
return -1;
case DRIVE_NO_ROOT_DIR:
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;
}
}
if (!wcsicmp(input, volumeName))
break;
- ConResPrintf(StdOut, STRING_ERROR_LABEL);
+ ConResPuts(StdOut, STRING_ERROR_LABEL);
}
}
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;
}
}
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);
}
//
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
if (CompressDrive)
{
if (!EnableVolumeCompression(RootDirectory, TRUE))
- ConResPrintf(StdOut, STRING_VOL_COMPRESS);
+ ConResPuts(StdOut, STRING_VOL_COMPRESS);
}
//
//
if (!GotALabel)
{
- ConResPrintf(StdOut, STRING_ENTER_LABEL);
+ ConResPuts(StdOut, STRING_ENTER_LABEL);
fgetws(input, ARRAYSIZE(LabelString), stdin);
input[wcslen(input) - 1] = 0;
case ERROR_IS_SUBSTED:
{
- ConResPrintf(StdErr, IDS_DRIVE_ALREADY_SUBSTED);
+ ConResPuts(StdErr, IDS_DRIVE_ALREADY_SUBSTED);
return 1;
}
{
if (!_wcsicmp(argv[i], L"/?"))
{
- ConResPrintf(StdOut, IDS_USAGE);
+ ConResPuts(StdOut, IDS_USAGE);
return 0;
}
}