mirror of
https://github.com/reactos/reactos.git
synced 2026-06-20 02:17:31 +08:00
[FORMAT]
- Completely reunicodify the application. CORE-9369 - Add back the original copyright/author information. svn path=/trunk/; revision=70916
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
|
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/libs/fmifs)
|
||||||
|
|
||||||
add_executable(format format.c format.rc)
|
add_executable(format format.c format.rc)
|
||||||
set_module_type(format win32cui)
|
set_module_type(format win32cui UNICODE)
|
||||||
set_target_properties(format PROPERTIES SUFFIX ".com")
|
set_target_properties(format PROPERTIES SUFFIX ".com")
|
||||||
add_importlibs(format user32 fmifs msvcrt kernel32 ntdll)
|
add_importlibs(format user32 fmifs msvcrt kernel32 ntdll)
|
||||||
add_cd_file(TARGET format DESTINATION reactos/system32 FOR all)
|
add_cd_file(TARGET format DESTINATION reactos/system32 FOR all)
|
||||||
|
|||||||
@@ -1,19 +1,64 @@
|
|||||||
|
//======================================================================
|
||||||
|
//
|
||||||
|
// Formatx
|
||||||
|
//
|
||||||
// Copyright (c) 1998 Mark Russinovich
|
// Copyright (c) 1998 Mark Russinovich
|
||||||
// Systems Internals
|
// Systems Internals
|
||||||
// http://www.sysinternals.com
|
// http://www.sysinternals.com
|
||||||
|
//
|
||||||
|
// Format clone that demonstrates the use of the FMIFS file system
|
||||||
|
// utility library.
|
||||||
|
//
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This software is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public License as
|
||||||
|
// published by the Free Software Foundation; either version 2 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This software is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Library General Public
|
||||||
|
// License along with this software; see the file COPYING.LIB. If
|
||||||
|
// not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||||
|
// Cambridge, MA 02139, USA.
|
||||||
|
//
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 1999 February (Emanuele Aliberti)
|
||||||
|
// Adapted for ReactOS and lcc-win32.
|
||||||
|
//
|
||||||
|
// 1999 April (Emanuele Aliberti)
|
||||||
|
// Adapted for ReactOS and egcs.
|
||||||
|
//
|
||||||
|
// 2003 April (Casper S. Hornstrup)
|
||||||
|
// Reintegration.
|
||||||
|
//
|
||||||
|
//======================================================================
|
||||||
|
|
||||||
#define WIN32_NO_STATUS
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
|
/* PSDK/NDK Headers */
|
||||||
|
#define WIN32_NO_STATUS
|
||||||
#include <windef.h>
|
#include <windef.h>
|
||||||
#include <winbase.h>
|
#include <winbase.h>
|
||||||
#include <winnls.h>
|
#include <winnls.h>
|
||||||
#include <winuser.h>
|
#include <winuser.h>
|
||||||
#include <wine/winternl.h>
|
|
||||||
|
#define NTOS_MODE_USER
|
||||||
|
#include <ndk/rtlfuncs.h>
|
||||||
|
|
||||||
|
/* FMIFS Public Header */
|
||||||
#include <fmifs/fmifs.h>
|
#include <fmifs/fmifs.h>
|
||||||
#include <tchar.h>
|
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define FMIFS_IMPORT_DLL
|
||||||
|
|
||||||
// Globals
|
// Globals
|
||||||
BOOL Error = FALSE;
|
BOOL Error = FALSE;
|
||||||
|
|
||||||
@@ -22,46 +67,76 @@ BOOL QuickFormat = FALSE;
|
|||||||
DWORD ClusterSize = 0;
|
DWORD ClusterSize = 0;
|
||||||
BOOL CompressDrive = FALSE;
|
BOOL CompressDrive = FALSE;
|
||||||
BOOL GotALabel = FALSE;
|
BOOL GotALabel = FALSE;
|
||||||
LPTSTR Label = _T("");
|
PWCHAR Label = L"";
|
||||||
LPTSTR Drive = NULL;
|
PWCHAR Drive = NULL;
|
||||||
LPTSTR FileSystem = _T("FAT");
|
PWCHAR FileSystem = L"FAT";
|
||||||
|
|
||||||
|
WCHAR RootDirectory[MAX_PATH];
|
||||||
|
WCHAR LabelString[12];
|
||||||
|
|
||||||
|
#ifndef FMIFS_IMPORT_DLL
|
||||||
|
//
|
||||||
|
// Functions in FMIFS.DLL
|
||||||
|
//
|
||||||
|
PFORMATEX FormatEx;
|
||||||
|
PENABLEVOLUMECOMPRESSION EnableVolumeCompression;
|
||||||
|
PQUERYAVAILABLEFILESYSTEMFORMAT QueryAvailableFileSystemFormat;
|
||||||
|
#endif
|
||||||
|
|
||||||
TCHAR RootDirectory[MAX_PATH];
|
|
||||||
TCHAR LabelString[12];
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Size array
|
// Size array
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
TCHAR SizeString[16];
|
WCHAR SizeString[16];
|
||||||
DWORD ClusterSize;
|
DWORD ClusterSize;
|
||||||
} SIZEDEFINITION, *PSIZEDEFINITION;
|
} SIZEDEFINITION, *PSIZEDEFINITION;
|
||||||
|
|
||||||
SIZEDEFINITION LegalSizes[] = {
|
SIZEDEFINITION LegalSizes[] = {
|
||||||
{ _T("512"), 512 },
|
{ L"512", 512 },
|
||||||
{ _T("1024"), 1024 },
|
{ L"1024", 1024 },
|
||||||
{ _T("2048"), 2048 },
|
{ L"2048", 2048 },
|
||||||
{ _T("4096"), 4096 },
|
{ L"4096", 4096 },
|
||||||
{ _T("8192"), 8192 },
|
{ L"8192", 8192 },
|
||||||
{ _T("16K"), 16384 },
|
{ L"16K", 16384 },
|
||||||
{ _T("32K"), 32768 },
|
{ L"32K", 32768 },
|
||||||
{ _T("64K"), 65536 },
|
{ L"64K", 65536 },
|
||||||
{ _T("128K"), 65536 * 2 },
|
{ L"128K", 65536 * 2 },
|
||||||
{ _T("256K"), 65536 * 4 },
|
{ L"256K", 65536 * 4 },
|
||||||
{ _T(""), 0 },
|
{ L"", 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int LoadStringAndOem(HINSTANCE hInst,
|
VOID PrintStringV(LPWSTR szStr, va_list args)
|
||||||
UINT uID,
|
|
||||||
LPTSTR szStr,
|
|
||||||
int Siz
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
TCHAR szTmp[RC_STRING_MAX_SIZE];
|
WCHAR bufFormatted[RC_STRING_MAX_SIZE];
|
||||||
int res = LoadString(hInst, uID, szTmp, sizeof(szTmp));
|
CHAR bufFormattedOem[RC_STRING_MAX_SIZE];
|
||||||
CharToOem(szTmp, szStr);
|
|
||||||
return(res);
|
_vsnwprintf(bufFormatted, ARRAYSIZE(bufFormatted), szStr, args);
|
||||||
|
|
||||||
|
CharToOemW(bufFormatted, bufFormattedOem);
|
||||||
|
puts(bufFormattedOem);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID PrintString(LPWSTR szStr, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start(args, szStr);
|
||||||
|
PrintStringV(szStr, args);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID PrintResourceString(UINT uID, ...)
|
||||||
|
{
|
||||||
|
WCHAR bufSrc[RC_STRING_MAX_SIZE];
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
LoadStringW(GetModuleHandleW(NULL), uID, bufSrc, ARRAYSIZE(bufSrc));
|
||||||
|
|
||||||
|
va_start(args, uID);
|
||||||
|
PrintStringV(bufSrc, args);
|
||||||
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -72,16 +147,16 @@ int LoadStringAndOem(HINSTANCE hInst,
|
|||||||
// Takes the win32 error code and prints the text version.
|
// Takes the win32 error code and prints the text version.
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
static VOID PrintWin32Error( LPTSTR Message, DWORD ErrorCode )
|
static VOID PrintWin32Error( LPWSTR Message, DWORD ErrorCode )
|
||||||
{
|
{
|
||||||
LPTSTR lpMsgBuf;
|
LPWSTR lpMsgBuf;
|
||||||
|
|
||||||
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
NULL, ErrorCode,
|
NULL, ErrorCode,
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
(LPTSTR)&lpMsgBuf, 0, NULL );
|
(LPWSTR)&lpMsgBuf, 0, NULL );
|
||||||
|
|
||||||
_tprintf(_T("%s: %s\n"), Message, lpMsgBuf );
|
PrintString(L"%s: %s\n", Message, lpMsgBuf );
|
||||||
LocalFree( lpMsgBuf );
|
LocalFree( lpMsgBuf );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +168,7 @@ static VOID PrintWin32Error( LPTSTR Message, DWORD ErrorCode )
|
|||||||
// Get the switches.
|
// Get the switches.
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
static int ParseCommandLine( int argc, TCHAR *argv[] )
|
static int ParseCommandLine( int argc, WCHAR *argv[] )
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
BOOLEAN gotFormat = FALSE;
|
BOOLEAN gotFormat = FALSE;
|
||||||
@@ -107,41 +182,41 @@ static int ParseCommandLine( int argc, TCHAR *argv[] )
|
|||||||
|
|
||||||
switch( argv[i][0] ) {
|
switch( argv[i][0] ) {
|
||||||
|
|
||||||
case '-':
|
case L'-':
|
||||||
case '/':
|
case L'/':
|
||||||
|
|
||||||
if( !_tcsnicmp( &argv[i][1], _T("FS:"), 3 )) {
|
if( !_wcsnicmp( &argv[i][1], L"FS:", 3 )) {
|
||||||
|
|
||||||
if( gotFormat) return -1;
|
if( gotFormat) return -1;
|
||||||
FileSystem = &argv[i][4];
|
FileSystem = &argv[i][4];
|
||||||
gotFormat = TRUE;
|
gotFormat = TRUE;
|
||||||
|
|
||||||
|
|
||||||
} else if( !_tcsnicmp( &argv[i][1], _T("A:"), 2 )) {
|
} else if( !_wcsnicmp( &argv[i][1], L"A:", 2 )) {
|
||||||
|
|
||||||
if( gotSize ) return -1;
|
if( gotSize ) return -1;
|
||||||
j = 0;
|
j = 0;
|
||||||
while( LegalSizes[j].ClusterSize &&
|
while( LegalSizes[j].ClusterSize &&
|
||||||
_tcsicmp( LegalSizes[j].SizeString, &argv[i][3] )) j++;
|
wcsicmp( LegalSizes[j].SizeString, &argv[i][3] )) j++;
|
||||||
|
|
||||||
if( !LegalSizes[j].ClusterSize ) return i;
|
if( !LegalSizes[j].ClusterSize ) return i;
|
||||||
ClusterSize = LegalSizes[j].ClusterSize;
|
ClusterSize = LegalSizes[j].ClusterSize;
|
||||||
gotSize = TRUE;
|
gotSize = TRUE;
|
||||||
|
|
||||||
} else if( ! _tcsnicmp( &argv[i][1], _T("V:"), 2 )) {
|
} else if( ! _wcsnicmp( &argv[i][1], L"V:", 2 )) {
|
||||||
|
|
||||||
if( gotLabel ) return -1;
|
if( gotLabel ) return -1;
|
||||||
Label = &argv[i][3];
|
Label = &argv[i][3];
|
||||||
gotLabel = TRUE;
|
gotLabel = TRUE;
|
||||||
GotALabel = TRUE;
|
GotALabel = TRUE;
|
||||||
|
|
||||||
} else if( !_tcsicmp( &argv[i][1], _T("Q") )) {
|
} else if( !wcsicmp( &argv[i][1], L"Q" )) {
|
||||||
|
|
||||||
if( gotQuick ) return -1;
|
if( gotQuick ) return -1;
|
||||||
QuickFormat = TRUE;
|
QuickFormat = TRUE;
|
||||||
gotQuick = TRUE;
|
gotQuick = TRUE;
|
||||||
|
|
||||||
} else if( !_tcsicmp( &argv[i][1], _T("C") )) {
|
} else if( !wcsicmp( &argv[i][1], L"C" )) {
|
||||||
|
|
||||||
if( gotCompressed ) return -1;
|
if( gotCompressed ) return -1;
|
||||||
CompressDrive = TRUE;
|
CompressDrive = TRUE;
|
||||||
@@ -153,7 +228,7 @@ static int ParseCommandLine( int argc, TCHAR *argv[] )
|
|||||||
default:
|
default:
|
||||||
|
|
||||||
if( Drive ) return i;
|
if( Drive ) return i;
|
||||||
if( argv[i][1] != _T(':') ) return i;
|
if( argv[i][1] != L':' ) return i;
|
||||||
|
|
||||||
Drive = argv[i];
|
Drive = argv[i];
|
||||||
break;
|
break;
|
||||||
@@ -179,7 +254,6 @@ FormatExCallback (
|
|||||||
PDWORD percent;
|
PDWORD percent;
|
||||||
PTEXTOUTPUT output;
|
PTEXTOUTPUT output;
|
||||||
PBOOLEAN status;
|
PBOOLEAN status;
|
||||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// We get other types of commands, but we don't have to pay attention to them
|
// We get other types of commands, but we don't have to pay attention to them
|
||||||
@@ -188,21 +262,19 @@ FormatExCallback (
|
|||||||
|
|
||||||
case PROGRESS:
|
case PROGRESS:
|
||||||
percent = (PDWORD) Argument;
|
percent = (PDWORD) Argument;
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_COMPLETE, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_COMPLETE, *percent);
|
||||||
_tprintf(szMsg, *percent);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OUTPUT:
|
case OUTPUT:
|
||||||
output = (PTEXTOUTPUT) Argument;
|
output = (PTEXTOUTPUT) Argument;
|
||||||
fprintf(stdout, "%s", output->Output);
|
wprintf(L"%S", output->Output);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DONE:
|
case DONE:
|
||||||
status = (PBOOLEAN) Argument;
|
status = (PBOOLEAN) Argument;
|
||||||
if( *status == FALSE ) {
|
if( *status == FALSE ) {
|
||||||
|
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_FORMAT_FAIL, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_FORMAT_FAIL);
|
||||||
_tprintf("%s", szMsg);
|
|
||||||
Error = TRUE;
|
Error = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -220,14 +292,13 @@ FormatExCallback (
|
|||||||
case UNKNOWND:
|
case UNKNOWND:
|
||||||
case STRUCTUREPROGRESS:
|
case STRUCTUREPROGRESS:
|
||||||
case CLUSTERSIZETOOSMALL:
|
case CLUSTERSIZETOOSMALL:
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_NO_SUPPORT, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_NO_SUPPORT);
|
||||||
_tprintf("%s", szMsg);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef FMIFS_IMPORT_DLL
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// LoadFMIFSEntryPoints
|
// LoadFMIFSEntryPoints
|
||||||
@@ -235,32 +306,34 @@ FormatExCallback (
|
|||||||
// Loads FMIFS.DLL and locates the entry point(s) we are going to use
|
// Loads FMIFS.DLL and locates the entry point(s) we are going to use
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
BOOLEAN LoadFMIFSEntryPoints()
|
static BOOLEAN LoadFMIFSEntryPoints(VOID)
|
||||||
{
|
{
|
||||||
HMODULE hFmifs = LoadLibrary( _T("fmifs.dll") );
|
HMODULE hFmifs = LoadLibraryW( L"fmifs.dll" );
|
||||||
if (hFmifs == NULL) {
|
if (hFmifs == NULL) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !(void*) GetProcAddress( hFmifs, "FormatEx" ) ) {
|
FormatEx = (PFORMATEX)GetProcAddress(hFmifs, "FormatEx");
|
||||||
|
if (!FormatEx) {
|
||||||
FreeLibrary(hFmifs);
|
FreeLibrary(hFmifs);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !((void *) GetProcAddress( hFmifs,
|
EnableVolumeCompression = (PENABLEVOLUMECOMPRESSION)GetProcAddress(hFmifs, "EnableVolumeCompression");
|
||||||
"EnableVolumeCompression" )) ) {
|
if (!EnableVolumeCompression) {
|
||||||
FreeLibrary(hFmifs);
|
FreeLibrary(hFmifs);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !((void *) GetProcAddress( hFmifs,
|
QueryAvailableFileSystemFormat = (PQUERYAVAILABLEFILESYSTEMFORMAT)GetProcAddress(hFmifs, "QueryAvailableFileSystemFormat");
|
||||||
"QueryAvailableFileSystemFormat" )) ) {
|
if (!QueryAvailableFileSystemFormat) {
|
||||||
FreeLibrary(hFmifs);
|
FreeLibrary(hFmifs);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@@ -270,24 +343,24 @@ BOOLEAN LoadFMIFSEntryPoints()
|
|||||||
// Tell the user how to use the program
|
// Tell the user how to use the program
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
static VOID Usage( LPTSTR ProgramName )
|
static VOID Usage( LPWSTR ProgramName )
|
||||||
{
|
{
|
||||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||||
TCHAR szFormats[MAX_PATH];
|
WCHAR szFormats[MAX_PATH];
|
||||||
#ifndef UNICODE
|
|
||||||
TCHAR szFormatA[MAX_PATH];
|
|
||||||
#endif
|
|
||||||
WCHAR szFormatW[MAX_PATH];
|
WCHAR szFormatW[MAX_PATH];
|
||||||
DWORD Index = 0;
|
DWORD Index = 0;
|
||||||
BYTE dummy;
|
BYTE dummy;
|
||||||
BOOLEAN latestVersion;
|
BOOLEAN latestVersion;
|
||||||
|
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_HELP, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
LoadStringW(GetModuleHandle(NULL), STRING_HELP, szMsg, ARRAYSIZE(szMsg));
|
||||||
|
|
||||||
|
#ifndef FMIFS_IMPORT_DLL
|
||||||
if (!LoadFMIFSEntryPoints())
|
if (!LoadFMIFSEntryPoints())
|
||||||
{
|
{
|
||||||
_tprintf(szMsg, ProgramName, _T(""));
|
PrintString(szMsg, ProgramName, L"");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
szFormats[0] = 0;
|
szFormats[0] = 0;
|
||||||
while (QueryAvailableFileSystemFormat(Index++, szFormatW, &dummy, &dummy, &latestVersion))
|
while (QueryAvailableFileSystemFormat(Index++, szFormatW, &dummy, &dummy, &latestVersion))
|
||||||
@@ -295,15 +368,11 @@ static VOID Usage( LPTSTR ProgramName )
|
|||||||
if (!latestVersion)
|
if (!latestVersion)
|
||||||
continue;
|
continue;
|
||||||
if (szFormats[0])
|
if (szFormats[0])
|
||||||
_tcscat(szFormats, _T(", "));
|
wcscat(szFormats, L", ");
|
||||||
#ifdef UNICODE
|
|
||||||
_tcscat(szFormats, szFormatW);
|
wcscat(szFormats, szFormatW);
|
||||||
#else
|
|
||||||
if (0 != WideCharToMultiByte(CP_ACP, 0, szFormatW, -1, szFormatA, sizeof(szFormatA), NULL, NULL))
|
|
||||||
_tcscat(szFormats, szFormatA);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
_tprintf(szMsg, ProgramName, szFormats);
|
PrintString(szMsg, ProgramName, szFormats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -319,39 +388,40 @@ static VOID Usage( LPTSTR ProgramName )
|
|||||||
// arguments.
|
// arguments.
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int
|
int wmain(int argc, WCHAR *argv[])
|
||||||
_tmain(int argc, TCHAR *argv[])
|
|
||||||
{
|
{
|
||||||
int badArg;
|
int badArg;
|
||||||
DWORD media = FMIFS_HARDDISK;
|
DWORD media = FMIFS_HARDDISK;
|
||||||
DWORD driveType;
|
DWORD driveType;
|
||||||
TCHAR fileSystem[1024];
|
WCHAR fileSystem[1024];
|
||||||
TCHAR volumeName[1024];
|
WCHAR volumeName[1024];
|
||||||
TCHAR input[1024];
|
WCHAR input[1024];
|
||||||
DWORD serialNumber;
|
DWORD serialNumber;
|
||||||
DWORD flags, maxComponent;
|
DWORD flags, maxComponent;
|
||||||
ULARGE_INTEGER freeBytesAvailableToCaller, totalNumberOfBytes, totalNumberOfFreeBytes;
|
ULARGE_INTEGER freeBytesAvailableToCaller, totalNumberOfBytes, totalNumberOfFreeBytes;
|
||||||
#ifndef UNICODE
|
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||||
WCHAR RootDirectoryW[MAX_PATH], FileSystemW[MAX_PATH], LabelW[MAX_PATH];
|
|
||||||
#endif
|
|
||||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
|
||||||
|
|
||||||
|
wprintf(L"\n"
|
||||||
|
L"Formatx v1.0 by Mark Russinovich\n"
|
||||||
|
L"Systems Internals - http://www.sysinternals.com\n"
|
||||||
|
L"ReactOS adaptation 1999 by Emanuele Aliberti\n\n");
|
||||||
|
|
||||||
|
#ifndef FMIFS_IMPORT_DLL
|
||||||
//
|
//
|
||||||
// Get function pointers
|
// Get function pointers
|
||||||
//
|
//
|
||||||
if( !LoadFMIFSEntryPoints()) {
|
if( !LoadFMIFSEntryPoints()) {
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_FMIFS_FAIL, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_FMIFS_FAIL);
|
||||||
_tprintf("%s", szMsg);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Parse command line
|
// Parse command line
|
||||||
//
|
//
|
||||||
if( (badArg = ParseCommandLine( argc, argv ))) {
|
if( (badArg = ParseCommandLine( argc, argv ))) {
|
||||||
|
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_UNKNOW_ARG, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_UNKNOW_ARG, argv[badArg]);
|
||||||
_tprintf(szMsg, argv[badArg] );
|
|
||||||
|
|
||||||
Usage(argv[0]);
|
Usage(argv[0]);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -362,44 +432,41 @@ _tmain(int argc, TCHAR *argv[])
|
|||||||
//
|
//
|
||||||
if( !Drive ) {
|
if( !Drive ) {
|
||||||
|
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_DRIVE_PARM, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_DRIVE_PARM);
|
||||||
_tprintf(szMsg);
|
|
||||||
Usage( argv[0] );
|
Usage( argv[0] );
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
_tcscpy( RootDirectory, Drive );
|
wcscpy( RootDirectory, Drive );
|
||||||
}
|
}
|
||||||
RootDirectory[2] = _T('\\');
|
RootDirectory[2] = L'\\';
|
||||||
RootDirectory[3] = _T('\0');
|
RootDirectory[3] = L'\0';
|
||||||
|
|
||||||
//
|
//
|
||||||
// See if the drive is removable or not
|
// See if the drive is removable or not
|
||||||
//
|
//
|
||||||
driveType = GetDriveType( RootDirectory );
|
driveType = GetDriveTypeW( RootDirectory );
|
||||||
switch (driveType)
|
switch (driveType)
|
||||||
{
|
{
|
||||||
case DRIVE_UNKNOWN :
|
case DRIVE_UNKNOWN :
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_ERROR_DRIVE_TYPE, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
LoadStringW(GetModuleHandle(NULL), STRING_ERROR_DRIVE_TYPE, szMsg, ARRAYSIZE(szMsg));
|
||||||
PrintWin32Error( szMsg, GetLastError());
|
PrintWin32Error( szMsg, GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
case DRIVE_REMOTE:
|
case DRIVE_REMOTE:
|
||||||
case DRIVE_CDROM:
|
case DRIVE_CDROM:
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_NO_SUPPORT, (LPTSTR) szMsg, RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_NO_SUPPORT);
|
||||||
_tprintf(szMsg);
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
case DRIVE_NO_ROOT_DIR:
|
case DRIVE_NO_ROOT_DIR:
|
||||||
LoadString( GetModuleHandle(NULL), STRING_NO_VOLUME, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
LoadStringW(GetModuleHandle(NULL), STRING_NO_VOLUME, szMsg, ARRAYSIZE(szMsg));
|
||||||
PrintWin32Error( szMsg, GetLastError());
|
PrintWin32Error( szMsg, GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
case DRIVE_REMOVABLE:
|
case DRIVE_REMOVABLE:
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_INSERT_DISK, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_INSERT_DISK, RootDirectory[0]);
|
||||||
_tprintf(szMsg, RootDirectory[0] );
|
fgetws( input, ARRAYSIZE(input), stdin );
|
||||||
_fgetts( input, sizeof(input)/2, stdin );
|
|
||||||
media = FMIFS_FLOPPY;
|
media = FMIFS_FLOPPY;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -411,17 +478,16 @@ _tmain(int argc, TCHAR *argv[])
|
|||||||
|
|
||||||
// Reject attempts to format the system drive
|
// Reject attempts to format the system drive
|
||||||
{
|
{
|
||||||
TCHAR path[MAX_PATH + 1];
|
WCHAR path[MAX_PATH + 1];
|
||||||
UINT rc;
|
UINT rc;
|
||||||
rc = GetWindowsDirectory(path, MAX_PATH);
|
rc = GetWindowsDirectoryW(path, MAX_PATH);
|
||||||
if (rc == 0 || rc > MAX_PATH)
|
if (rc == 0 || rc > MAX_PATH)
|
||||||
// todo: Report "Unable to query system directory"
|
// todo: Report "Unable to query system directory"
|
||||||
return -1;
|
return -1;
|
||||||
if (_totlower(path[0]) == _totlower(Drive[0]))
|
if (towlower(path[0]) == towlower(Drive[0]))
|
||||||
{
|
{
|
||||||
// todo: report "Cannot format system drive"
|
// todo: report "Cannot format system drive"
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_NO_SUPPORT, (LPTSTR) szMsg, RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_NO_SUPPORT);
|
||||||
_tprintf(szMsg);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -429,27 +495,26 @@ _tmain(int argc, TCHAR *argv[])
|
|||||||
//
|
//
|
||||||
// Determine the drive's file system format
|
// Determine the drive's file system format
|
||||||
//
|
//
|
||||||
if( !GetVolumeInformation( RootDirectory,
|
if( !GetVolumeInformationW( RootDirectory,
|
||||||
volumeName, sizeof(volumeName)/2,
|
volumeName, ARRAYSIZE(volumeName),
|
||||||
&serialNumber, &maxComponent, &flags,
|
&serialNumber, &maxComponent, &flags,
|
||||||
fileSystem, sizeof(fileSystem)/2)) {
|
fileSystem, ARRAYSIZE(fileSystem))) {
|
||||||
|
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_NO_VOLUME, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
LoadStringW(GetModuleHandle(NULL), STRING_NO_VOLUME, szMsg, ARRAYSIZE(szMsg));
|
||||||
PrintWin32Error( szMsg, GetLastError());
|
PrintWin32Error( szMsg, GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !GetDiskFreeSpaceEx( RootDirectory,
|
if( !GetDiskFreeSpaceExW( RootDirectory,
|
||||||
&freeBytesAvailableToCaller,
|
&freeBytesAvailableToCaller,
|
||||||
&totalNumberOfBytes,
|
&totalNumberOfBytes,
|
||||||
&totalNumberOfFreeBytes )) {
|
&totalNumberOfFreeBytes )) {
|
||||||
|
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_NO_VOLUME_SIZE, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
LoadStringW(GetModuleHandle(NULL), STRING_NO_VOLUME_SIZE, szMsg, ARRAYSIZE(szMsg));
|
||||||
PrintWin32Error( szMsg, GetLastError());
|
PrintWin32Error( szMsg, GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_FILESYSTEM, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_FILESYSTEM, fileSystem);
|
||||||
_tprintf(szMsg, fileSystem );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make sure they want to do this
|
// Make sure they want to do this
|
||||||
@@ -460,30 +525,27 @@ _tmain(int argc, TCHAR *argv[])
|
|||||||
|
|
||||||
while(1 ) {
|
while(1 ) {
|
||||||
|
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_LABEL_NAME_EDIT, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_LABEL_NAME_EDIT, RootDirectory[0]);
|
||||||
_tprintf(szMsg, RootDirectory[0] );
|
fgetws( input, ARRAYSIZE(input), stdin );
|
||||||
_fgetts( input, sizeof(input)/2, stdin );
|
input[ wcslen( input ) - 1] = 0;
|
||||||
input[ _tcslen( input ) - 1] = 0;
|
|
||||||
|
|
||||||
if( !_tcsicmp( input, volumeName )) {
|
if( !wcsicmp( input, volumeName )) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_ERROR_LABEL, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_ERROR_LABEL);
|
||||||
_tprintf("%s", szMsg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_YN_FORMAT, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_YN_FORMAT, RootDirectory[0]);
|
||||||
_tprintf(szMsg, RootDirectory[0] );
|
|
||||||
|
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_YES_NO_FAQ, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
LoadStringW(GetModuleHandle(NULL), STRING_YES_NO_FAQ, szMsg, ARRAYSIZE(szMsg));
|
||||||
|
|
||||||
while( 1 ) {
|
while( 1 ) {
|
||||||
_fgetts( input, sizeof(input)/2, stdin );
|
fgetws( input, ARRAYSIZE(input), stdin );
|
||||||
if(_strnicmp(&input[0],&szMsg[0],1) == 0) break;
|
if(_wcsnicmp(&input[0],&szMsg[0],1) == 0) break;
|
||||||
if(_strnicmp(&input[0],&szMsg[1],1) == 0) {
|
if(_wcsnicmp(&input[0],&szMsg[1],1) == 0) {
|
||||||
_tprintf(_T("\n"));
|
wprintf(L"\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -494,64 +556,48 @@ _tmain(int argc, TCHAR *argv[])
|
|||||||
//
|
//
|
||||||
if( !QuickFormat ) {
|
if( !QuickFormat ) {
|
||||||
|
|
||||||
LoadString( GetModuleHandle(NULL), STRING_VERIFYING, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
LoadStringW(GetModuleHandle(NULL), STRING_VERIFYING, szMsg, ARRAYSIZE(szMsg));
|
||||||
|
|
||||||
if( totalNumberOfBytes.QuadPart > 1024*1024*10 ) {
|
if( totalNumberOfBytes.QuadPart > 1024*1024*10 ) {
|
||||||
|
|
||||||
_tprintf(_T("%s %luM\n"),szMsg, (DWORD) (totalNumberOfBytes.QuadPart/(1024*1024)));
|
PrintString(L"%s %luM\n",szMsg, (DWORD) (totalNumberOfBytes.QuadPart/(1024*1024)));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
_tprintf(_T("%s %.1fM\n"),szMsg,
|
PrintString(L"%s %.1fM\n",szMsg,
|
||||||
((float)(LONGLONG)totalNumberOfBytes.QuadPart)/(float)(1024.0*1024.0));
|
((float)(LONGLONG)totalNumberOfBytes.QuadPart)/(float)(1024.0*1024.0));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_FAST_FMT, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
LoadStringW(GetModuleHandle(NULL), STRING_FAST_FMT, szMsg, ARRAYSIZE(szMsg));
|
||||||
if( totalNumberOfBytes.QuadPart > 1024*1024*10 ) {
|
if( totalNumberOfBytes.QuadPart > 1024*1024*10 ) {
|
||||||
|
|
||||||
_tprintf(_T("%s %luM\n"),szMsg, (DWORD) (totalNumberOfBytes.QuadPart/(1024*1024)));
|
PrintString(L"%s %luM\n",szMsg, (DWORD) (totalNumberOfBytes.QuadPart/(1024*1024)));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
_tprintf(_T("%s %.2fM\n"),szMsg,
|
PrintString(L"%s %.2fM\n",szMsg,
|
||||||
((float)(LONGLONG)totalNumberOfBytes.QuadPart)/(float)(1024.0*1024.0));
|
((float)(LONGLONG)totalNumberOfBytes.QuadPart)/(float)(1024.0*1024.0));
|
||||||
}
|
}
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_CREATE_FSYS, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_CREATE_FSYS);
|
||||||
_tprintf("%s", szMsg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Format away!
|
// Format away!
|
||||||
//
|
//
|
||||||
#ifndef UNICODE
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, RootDirectory, -1, RootDirectoryW, MAX_PATH);
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, FileSystem, -1, FileSystemW, MAX_PATH);
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, Label, -1, LabelW, MAX_PATH);
|
|
||||||
FormatEx( RootDirectoryW, media, FileSystemW, LabelW, QuickFormat,
|
|
||||||
ClusterSize, FormatExCallback );
|
|
||||||
#else
|
|
||||||
FormatEx( RootDirectory, media, FileSystem, Label, QuickFormat,
|
FormatEx( RootDirectory, media, FileSystem, Label, QuickFormat,
|
||||||
ClusterSize, FormatExCallback );
|
ClusterSize, FormatExCallback );
|
||||||
#endif
|
|
||||||
if( Error ) return -1;
|
if( Error ) return -1;
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_FMT_COMPLETE, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_FMT_COMPLETE);
|
||||||
_tprintf("%s", szMsg);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Enable compression if desired
|
// Enable compression if desired
|
||||||
//
|
//
|
||||||
if( CompressDrive ) {
|
if( CompressDrive ) {
|
||||||
|
|
||||||
#ifndef UNICODE
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, RootDirectory, -1, RootDirectoryW, MAX_PATH);
|
|
||||||
if( !EnableVolumeCompression( RootDirectoryW, TRUE )) {
|
|
||||||
#else
|
|
||||||
if( !EnableVolumeCompression( RootDirectory, TRUE )) {
|
if( !EnableVolumeCompression( RootDirectory, TRUE )) {
|
||||||
#endif
|
|
||||||
|
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_VOL_COMPRESS, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_VOL_COMPRESS);
|
||||||
_tprintf("%s", szMsg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,25 +606,24 @@ _tmain(int argc, TCHAR *argv[])
|
|||||||
//
|
//
|
||||||
if( !GotALabel ) {
|
if( !GotALabel ) {
|
||||||
|
|
||||||
LoadString( GetModuleHandle(NULL), STRING_ENTER_LABEL, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_ENTER_LABEL);
|
||||||
_tprintf("%s", szMsg);
|
fgetws( input, ARRAYSIZE(LabelString), stdin );
|
||||||
_fgetts( input, sizeof(LabelString)/2, stdin );
|
|
||||||
|
|
||||||
input[ _tcslen(input)-1] = 0;
|
input[ wcslen(input)-1] = 0;
|
||||||
if( !SetVolumeLabel( RootDirectory, input )) {
|
if( !SetVolumeLabelW( RootDirectory, input )) {
|
||||||
|
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_NO_LABEL, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
LoadStringW(GetModuleHandle(NULL), STRING_NO_LABEL, szMsg, ARRAYSIZE(szMsg));
|
||||||
PrintWin32Error(szMsg, GetLastError());
|
PrintWin32Error(szMsg, GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !GetVolumeInformation( RootDirectory,
|
if( !GetVolumeInformationW( RootDirectory,
|
||||||
volumeName, sizeof(volumeName)/2,
|
volumeName, ARRAYSIZE(volumeName),
|
||||||
&serialNumber, &maxComponent, &flags,
|
&serialNumber, &maxComponent, &flags,
|
||||||
fileSystem, sizeof(fileSystem)/2)) {
|
fileSystem, ARRAYSIZE(fileSystem))) {
|
||||||
|
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_NO_VOLUME, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
LoadStringW(GetModuleHandle(NULL), STRING_NO_VOLUME, szMsg, ARRAYSIZE(szMsg));
|
||||||
PrintWin32Error( szMsg, GetLastError());
|
PrintWin32Error( szMsg, GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -586,34 +631,33 @@ _tmain(int argc, TCHAR *argv[])
|
|||||||
//
|
//
|
||||||
// Print out some stuff including the formatted size
|
// Print out some stuff including the formatted size
|
||||||
//
|
//
|
||||||
if( !GetDiskFreeSpaceEx( RootDirectory,
|
if( !GetDiskFreeSpaceExW( RootDirectory,
|
||||||
&freeBytesAvailableToCaller,
|
&freeBytesAvailableToCaller,
|
||||||
&totalNumberOfBytes,
|
&totalNumberOfBytes,
|
||||||
&totalNumberOfFreeBytes )) {
|
&totalNumberOfFreeBytes )) {
|
||||||
|
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_NO_VOLUME_SIZE, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
LoadStringW(GetModuleHandle(NULL), STRING_NO_VOLUME_SIZE, szMsg, ARRAYSIZE(szMsg));
|
||||||
PrintWin32Error(szMsg, GetLastError());
|
PrintWin32Error(szMsg, GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_FREE_SPACE, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_FREE_SPACE, totalNumberOfBytes.QuadPart, totalNumberOfFreeBytes.QuadPart );
|
||||||
_tprintf(szMsg, totalNumberOfBytes.QuadPart, totalNumberOfFreeBytes.QuadPart );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the drive's serial number
|
// Get the drive's serial number
|
||||||
//
|
//
|
||||||
if( !GetVolumeInformation( RootDirectory,
|
if( !GetVolumeInformationW( RootDirectory,
|
||||||
volumeName, sizeof(volumeName)/2,
|
volumeName, ARRAYSIZE(volumeName),
|
||||||
&serialNumber, &maxComponent, &flags,
|
&serialNumber, &maxComponent, &flags,
|
||||||
fileSystem, sizeof(fileSystem)/2)) {
|
fileSystem, ARRAYSIZE(fileSystem))) {
|
||||||
|
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_NO_VOLUME, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
LoadStringW(GetModuleHandle(NULL), STRING_NO_VOLUME, szMsg, ARRAYSIZE(szMsg));
|
||||||
PrintWin32Error( szMsg, GetLastError());
|
PrintWin32Error( szMsg, GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
LoadStringAndOem( GetModuleHandle(NULL), STRING_SERIAL_NUMBER, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
PrintResourceString(STRING_SERIAL_NUMBER,
|
||||||
_tprintf(szMsg, (unsigned int)(serialNumber >> 16),
|
(unsigned int)(serialNumber >> 16),
|
||||||
(unsigned int)(serialNumber & 0xFFFF) );
|
(unsigned int)(serialNumber & 0xFFFF));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user