亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? format.c

?? 格式化磁盤和磁盤檢測代碼
?? C
字號:
//======================================================================
//
// Formatx
//
// By Mark Russinovich
// Systems Internals
// http://www.sysinternals.com
//
// Format clone that demonstrates the use of the FMIFS file system
// utility library.
//
//======================================================================
#include <windows.h>
#include <stdio.h>
#include "..\fmifs.h"
#define _UNICODE 1
#include "tchar.h"

//
// Globals
//
BOOL	Error = FALSE;

// switches
BOOL	QuickFormat = FALSE;
DWORD   ClusterSize = 0;
BOOL	CompressDrive = FALSE;
BOOL    GotALabel = FALSE;
PWCHAR  Label = L"";
PWCHAR  Drive = NULL;
PWCHAR  Format = L"FAT";

WCHAR  RootDirectory[MAX_PATH];
WCHAR  LabelString[12];

//
// Functions in FMIFS.DLL
//
PFORMATEX   FormatEx;
PENABLEVOLUMECOMPRESSION EnableVolumeCompression;

//
// Size array
//
typedef struct {
	WCHAR  SizeString[16];
	DWORD  ClusterSize;
} SIZEDEFINITION, *PSIZEDEFINITION;

SIZEDEFINITION LegalSizes[] = {
	{ L"512", 512 },
	{ L"1024", 1024 },
	{ L"2048", 2048 },
	{ L"4096", 4096 },
	{ L"8192", 8192 },
	{ L"16K", 16384 },
	{ L"32K", 32768 },
	{ L"64K", 65536 },
	{ L"128K", 65536 * 2 },
	{ L"256K", 65536 * 4 },
	{ L"", 0 },
};


//----------------------------------------------------------------------
//
// PrintWin32Error
//
// Takes the win32 error code and prints the text version.
//
//----------------------------------------------------------------------
void PrintWin32Error( PWCHAR Message, DWORD ErrorCode )
{
	LPVOID lpMsgBuf;
 
	FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
					NULL, ErrorCode, 
					MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
					(PWCHAR) &lpMsgBuf, 0, NULL );
	_tprintf(L"%s: %s\n", Message, lpMsgBuf );
	LocalFree( lpMsgBuf );
}


//----------------------------------------------------------------------
// 
// Usage
//
// Tell the user how to use the program
//
//----------------------------------------------------------------------
VOID Usage( PWCHAR ProgramName )
{
	_tprintf(L"Usage: %s drive: [-FS:file-system] [-V:label] [-Q] [-A:size] [-C]\n\n");
	_tprintf(L"  [drive:]         Specifies the drive to format.\n");
	_tprintf(L"  -FS:file-system  Specifies the type of file system (e.g. FAT).\n");
	_tprintf(L"  -V:label         Specifies volume label.\n");
	_tprintf(L"  -Q               Performs a quick format.\n");
	_tprintf(L"  -A:size          Overrides the default allocation unit size. Default settings\n");
	_tprintf(L"                   are strongly recommended for general use\n"); 
	_tprintf(L"                   NTFS supports 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K.\n");
	_tprintf(L"                   FAT supports 8192, 16K, 32K, 64K, 128K, 256K.\n");
	_tprintf(L"                   NTFS compression is not supported for allocation unit sizes\n");
	_tprintf(L"                   above 4096.\n");
	_tprintf(L"  -C               Files created on the new volume will be compressed by\n");
	_tprintf(L"                   default.\n");
	_tprintf(L"\n");
}


//----------------------------------------------------------------------
//
// ParseCommandLine
//
// Get the switches.
//
//----------------------------------------------------------------------
int ParseCommandLine( int argc, WCHAR *argv[] )
{
	int i, j;
	BOOLEAN gotFormat = FALSE;
	BOOLEAN gotQuick = FALSE;
	BOOLEAN gotSize = FALSE;
	BOOLEAN gotLabel = FALSE;
	BOOLEAN gotCompressed = FALSE;


	for( i = 1; i < argc; i++ ) {

		switch( argv[i][0] ) {

		case '-':
		case '/':

			if( !wcsnicmp( &argv[i][1], L"FS:", 3 )) {

				if( gotFormat) return -1;
				Format = &argv[i][4];
				gotFormat = TRUE;


			} else if( !wcsnicmp( &argv[i][1], L"A:", 2 )) {

				if( gotSize ) return -1;
				j = 0; 
				while( LegalSizes[j].ClusterSize &&
					 wcsicmp( LegalSizes[j].SizeString, &argv[i][3] )) j++;

				if( !LegalSizes[j].ClusterSize ) return i;
				ClusterSize = LegalSizes[j].ClusterSize;
				gotSize = TRUE;

			} else if( !wcsnicmp( &argv[i][1], L"V:", 2 )) {

				if( gotLabel ) return -1;
				Label = &argv[i][3];
				gotLabel = TRUE;
				GotALabel = TRUE;

			} else if( !wcsicmp( &argv[i][1], L"Q" )) {

				if( gotQuick ) return -1;
				QuickFormat = TRUE;
				gotQuick = TRUE;

			} else if( !wcsicmp( &argv[i][1], L"C" )) {

				if( gotCompressed ) return -1;
				CompressDrive = TRUE;
				gotCompressed = TRUE;

			} else return i;
			break;

		default:

			if( Drive ) return i;
			if( argv[i][1] != L':' ) return i;

			Drive = argv[i];
			break;
		}
	}
	return 0;
}


//----------------------------------------------------------------------
//
// FormatExCallback
//
// The file system library will call us back with commands that we
// can interpret. If we wanted to halt the chkdsk we could return FALSE.
//
//----------------------------------------------------------------------
BOOLEAN __stdcall FormatExCallback( CALLBACKCOMMAND Command, DWORD Modifier, PVOID Argument )
{
	PDWORD percent;
	PTEXTOUTPUT output;
	PBOOLEAN status;
	static createStructures = FALSE;

	// 
	// We get other types of commands, but we don't have to pay attention to them
	//
	switch( Command ) {

	case PROGRESS:
		percent = (PDWORD) Argument;
		_tprintf(L"%d percent completed.\r", *percent);
		break;

	case OUTPUT:
		output = (PTEXTOUTPUT) Argument;
		fprintf(stdout, "%s", output->Output);
		break;

	case DONE:
		status = (PBOOLEAN) Argument;
		if( *status == FALSE ) {

			_tprintf(L"FormatEx was unable to complete successfully.\n\n");
			Error = TRUE;
		}
		break;
	}
	return TRUE;
}


//----------------------------------------------------------------------
//
// LoadFMIFSEntryPoints
//
// Loads FMIFS.DLL and locates the entry point(s) we are going to use
//
//----------------------------------------------------------------------
BOOLEAN LoadFMIFSEntryPoints()
{
	LoadLibrary( "fmifs.dll" );

	if( !(FormatEx = (void *) GetProcAddress( GetModuleHandle( "fmifs.dll"),
			"FormatEx" )) ) {

		return FALSE;
	}

	if( !(EnableVolumeCompression = (void *) GetProcAddress( GetModuleHandle( "fmifs.dll"),
			"EnableVolumeCompression" )) ) {

		return FALSE;
	}
	return TRUE;
}


//----------------------------------------------------------------------
// 
// WMain
//
// Engine. Just get command line switches and fire off a format. This 
// could also be done in a GUI like Explorer does when you select a 
// drive and run a check on it.
//
// We do this in UNICODE because the chkdsk command expects PWCHAR
// arguments.
//
//----------------------------------------------------------------------
int wmain( int argc, WCHAR *argv[] )
{
	int badArg;
	DWORD media;
	DWORD driveType;
	WCHAR fileSystem[1024];
	WCHAR volumeName[1024];
	WCHAR input[1024];
	DWORD serialNumber;
	DWORD flags, maxComponent;
	ULARGE_INTEGER freeBytesAvailableToCaller, totalNumberOfBytes, totalNumberOfFreeBytes;

	_tprintf(L"\nFormatx v1.0 by Mark Russinovich\n");
	_tprintf(L"Systems Internals - http://www.sysinternals.com\n\n");

	//
	// Get function pointers
	//
	if( !LoadFMIFSEntryPoints()) {

		_tprintf(L"Could not located FMIFS entry points.\n\n");
		return -1;
	}

	//
	// Parse command line
	//
	if( (badArg = ParseCommandLine( argc, argv ))) {

		_tprintf(L"Unknown argument: %s\n", argv[badArg] );

		Usage(argv[0]);
		return -1;
	}

	// 
	// Get the drive's format
	//
	if( !Drive ) {

		_tprintf(L"Required drive parameter is missing.\n\n");
		Usage( argv[0] );
		return -1;

	} else {

		wcscpy( RootDirectory, Drive );
	}
	RootDirectory[2] = L'\\';
	RootDirectory[3] = (WCHAR) 0;

	//
	// See if the drive is removable or not
	//
	driveType = GetDriveTypeW( RootDirectory );

	if( driveType != DRIVE_FIXED ) {

		_tprintf(L"Insert a new floppy in drive %C:\nand press Enter when ready...",
			RootDirectory[0] );
		fgetws( input, sizeof(input)/2, stdin );

		media = FMIFS_FLOPPY;
	}

	//
	// Determine the drive's file system format
	//
	if( !GetVolumeInformationW( RootDirectory, 
						volumeName, sizeof(volumeName)/2, 
						&serialNumber, &maxComponent, &flags, 
						fileSystem, sizeof(fileSystem)/2)) {

		PrintWin32Error( L"Could not query volume", GetLastError());
		return -1;
	}

	if( !GetDiskFreeSpaceExW( RootDirectory, 
			&freeBytesAvailableToCaller,
			&totalNumberOfBytes,
			&totalNumberOfFreeBytes )) {

		PrintWin32Error( L"Could not query volume size", GetLastError());
		return -1;
	}
	_tprintf(L"The type of the file system is %s.\n", fileSystem );

	//
	// Make sure they want to do this
	//
	if( driveType == DRIVE_FIXED ) {

		if( volumeName[0] ) {

			while(1 ) {

				_tprintf(L"Enter current volume label for drive %C: ", RootDirectory[0] );
				fgetws( input, sizeof(input)/2, stdin );
				input[ wcslen( input ) - 1] = 0;
				
				if( !wcsicmp( input, volumeName )) {

					break;
				}
				_tprintf(L"An incorrect volume label was entered for this drive.\n");
			}
		}

		while( 1 ) {

			_tprintf(L"\nWARNING, ALL DATA ON NON_REMOVABLE DISK\n");
			_tprintf(L"DRIVE %C: WILL BE LOST!\n", RootDirectory[0] );
			_tprintf(L"Proceed with Format (Y/N)? " );
			fgetws( input, sizeof(input)/2, stdin );
		
			if( input[0] == L'Y' || input[0] == L'y' ) break;

			if(	input[0] == L'N' || input[0] == L'n' ) {
				
				_tprintf(L"\n");
				return 0;
			}
		}
		media = FMIFS_HARDDISK;
	} 

	//
	// Tell the user we're doing a long format if appropriate
	//
	if( !QuickFormat ) {
		
		if( totalNumberOfBytes.QuadPart > 1024*1024*10 ) {
			
			_tprintf(L"Verifying %dM\n", (DWORD) (totalNumberOfBytes.QuadPart/(1024*1024)));
			
		} else {

			_tprintf(L"Verifying %.1fM\n", 
				((float)(LONGLONG)totalNumberOfBytes.QuadPart)/(float)(1024.0*1024.0));
		}
	} else  {

		if( totalNumberOfBytes.QuadPart > 1024*1024*10 ) {
			
			_tprintf(L"QuickFormatting %dM\n", (DWORD) (totalNumberOfBytes.QuadPart/(1024*1024)));
			
		} else {

			_tprintf(L"QuickFormatting %.2fM\n", 
				((float)(LONGLONG)totalNumberOfBytes.QuadPart)/(float)(1024.0*1024.0));
		}
		_tprintf(L"Creating file system structures.\n");
	}

	//
	// Format away!
	//			
	FormatEx( RootDirectory, media, Format, Label, QuickFormat,
			ClusterSize, FormatExCallback );
	if( Error ) return -1;
	_tprintf(L"Format complete.\n");

	//
	// Enable compression if desired
	//
	if( CompressDrive ) {

		if( !EnableVolumeCompression( RootDirectory, TRUE )) {

			_tprintf(L"Volume does not support compression.\n");
		}
	}

	//
	// Get the label if we don't have it
	//
	if( !GotALabel ) {

		_tprintf(L"Volume Label (11 characters, Enter for none)? " );
		fgetws( input, sizeof(LabelString)/2, stdin );

		input[ wcslen(input)-1] = 0;
		if( !SetVolumeLabelW( RootDirectory, input )) {

			PrintWin32Error(L"Could not label volume", GetLastError());
			return -1;
		}	
	}

	if( !GetVolumeInformationW( RootDirectory, 
						volumeName, sizeof(volumeName)/2, 
						&serialNumber, &maxComponent, &flags, 
						fileSystem, sizeof(fileSystem)/2)) {

		PrintWin32Error( L"Could not query volume", GetLastError());
		return -1;
	}

	// 
	// Print out some stuff including the formatted size
	//
	if( !GetDiskFreeSpaceExW( RootDirectory, 
			&freeBytesAvailableToCaller,
			&totalNumberOfBytes,
			&totalNumberOfFreeBytes )) {

		PrintWin32Error( L"Could not query volume size", GetLastError());
		return -1;
	}

	_tprintf(L"\n%I64d bytes total disk space.\n", totalNumberOfBytes.QuadPart );
	_tprintf(L"%I64d bytes available on disk.\n", totalNumberOfFreeBytes.QuadPart );

	//
	// Get the drive's serial number
	//
	if( !GetVolumeInformationW( RootDirectory, 
						volumeName, sizeof(volumeName)/2, 
						&serialNumber, &maxComponent, &flags, 
						fileSystem, sizeof(fileSystem)/2)) {

		PrintWin32Error( L"Could not query volume", GetLastError());
		return -1;
	}
	_tprintf(L"\nVolume Serial Number is %04X-%04X\n", serialNumber >> 16,
					serialNumber & 0xFFFF );
			
	return 0;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩中文国产| 高潮精品一区videoshd| 成人av片在线观看| 欧美日韩精品一区二区| 国产精品欧美经典| 日本欧美大码aⅴ在线播放| 成人av网址在线| 日韩三级.com| 亚洲电影一级黄| 国产电影一区在线| 91麻豆精品91久久久久久清纯| 国产蜜臀97一区二区三区 | 欧美性色aⅴ视频一区日韩精品| 精品国产乱码久久久久久牛牛| 夜夜嗨av一区二区三区| 国产一区二区三区在线观看免费| 欧美日韩一区二区三区不卡 | 91官网在线免费观看| 久久伊人蜜桃av一区二区| 亚洲成人在线免费| av在线一区二区| 精品久久久影院| 男男成人高潮片免费网站| 色先锋久久av资源部| 国产欧美日韩三级| 国产综合久久久久久鬼色 | 福利电影一区二区三区| 精品剧情在线观看| 日韩高清不卡一区| 欧美日韩在线免费视频| 亚洲男同1069视频| www.66久久| 久久夜色精品一区| 韩国三级在线一区| 欧美一级高清大全免费观看| 亚洲一二三四久久| 91麻豆福利精品推荐| 欧美激情综合网| 国产一区二区三区在线观看免费视频| 日韩一卡二卡三卡四卡| 日日夜夜精品视频天天综合网| 在线看日本不卡| 亚洲精品视频一区| 99久久精品国产麻豆演员表| 欧美高清在线视频| 不卡视频一二三四| 国产欧美一区二区精品久导航| 成人综合激情网| 中文一区一区三区高中清不卡| 国产一区二区三区久久悠悠色av| 日韩精品中午字幕| 国内精品久久久久影院色 | 91天堂素人约啪| 亚洲视频免费观看| 色噜噜狠狠色综合中国| 亚洲精品欧美激情| 91福利在线免费观看| 一区二区三区四区在线播放 | 国产综合色产在线精品| 久久精品亚洲精品国产欧美 | 久久国产麻豆精品| 精品国产免费视频| 国产黄人亚洲片| 久久精品人人爽人人爽| 高清国产午夜精品久久久久久| 国产精品乱码一区二区三区软件| 波多野洁衣一区| 亚洲色图欧美偷拍| 欧美日韩免费一区二区三区| 日韩不卡一区二区三区 | 91色porny| 亚洲国产精品久久人人爱蜜臀| 欧美日韩在线观看一区二区 | 国产精品久久久久久久久搜平片 | 奇米亚洲午夜久久精品| 日韩一区二区在线看片| 国产一区视频在线看| 中文字幕乱码日本亚洲一区二区| eeuss国产一区二区三区| 亚洲美女在线一区| 在线不卡一区二区| 国产在线麻豆精品观看| 国产精品国产三级国产普通话三级| 成人黄色电影在线 | 精品国产伦理网| av不卡一区二区三区| 一区二区三区高清在线| 日韩一区二区三区四区五区六区| 国产乱国产乱300精品| 亚洲欧美日韩国产成人精品影院| 欧美日韩一卡二卡三卡| 国产在线视频一区二区| 一区二区三区在线观看视频 | 99在线精品一区二区三区| 亚洲综合视频在线观看| 欧美白人最猛性xxxxx69交| 懂色av一区二区在线播放| 亚洲三级在线看| 日韩欧美一区二区三区在线| 国产91精品免费| 亚洲国产欧美在线| 精品99一区二区| 色欧美片视频在线观看 | 69久久夜色精品国产69蝌蚪网| 高清国产午夜精品久久久久久| 亚洲国产精品一区二区www | 欧美三级电影网站| 国产一区二区三区视频在线播放| 夜夜嗨av一区二区三区中文字幕| 欧美本精品男人aⅴ天堂| 色婷婷狠狠综合| 国产乱子伦视频一区二区三区| 亚洲午夜电影在线| 中文字幕欧美三区| 日韩一区国产二区欧美三区| 色婷婷香蕉在线一区二区| 国产一区啦啦啦在线观看| 香蕉影视欧美成人| 国产精品免费aⅴ片在线观看| 日韩一级完整毛片| 欧洲中文字幕精品| zzijzzij亚洲日本少妇熟睡| 另类小说综合欧美亚洲| 亚洲综合激情另类小说区| 国产目拍亚洲精品99久久精品 | 国产成人aaaa| 日韩av中文在线观看| 中文字幕va一区二区三区| 欧美视频一区二区三区| 国产一区久久久| 成人免费在线视频| 欧美精品一区在线观看| 成人avav影音| 国产成人综合视频| 亚洲国产精品影院| 久久免费看少妇高潮| 另类小说图片综合网| 国产精品国模大尺度视频| 亚洲国产成人av网| 国产女同性恋一区二区| 99热精品国产| 国产永久精品大片wwwapp| 中文字幕一区三区| 欧美国产激情一区二区三区蜜月| 欧美亚洲自拍偷拍| 久久精品久久99精品久久| 亚洲欧洲精品一区二区三区不卡| 51精品视频一区二区三区| 欧美日韩一区二区三区四区| 国产精品综合视频| 国产精品色眯眯| 欧美日韩国产首页在线观看| 国产成人精品免费看| 亚洲国产中文字幕在线视频综合| 久久久精品日韩欧美| 欧美日韩国产系列| 99视频国产精品| 91麻豆免费视频| 国产精品乡下勾搭老头1| 国产美女av一区二区三区| 亚洲午夜在线电影| 精品国产3级a| 久久网站热最新地址| 欧美日韩不卡视频| 日韩综合一区二区| 亚洲另类春色校园小说| 精品国产亚洲在线| 国产视频一区在线观看| 8x福利精品第一导航| 91精品国产综合久久精品麻豆| 在线观看亚洲成人| 国产一区二区成人久久免费影院| 国产一区二区免费视频| 日日噜噜夜夜狠狠视频欧美人 | 国内精品久久久久影院色 | 91国产福利在线| 欧美性三三影院| 丁香激情综合五月| 北条麻妃一区二区三区| 秋霞国产午夜精品免费视频| 欧美激情综合五月色丁香| 日韩毛片高清在线播放| 国产日韩欧美精品在线| 国产精品青草久久| 久久女同性恋中文字幕| 六月丁香综合在线视频| 国产高清亚洲一区| 三级久久三级久久久| 亚洲精品在线电影| 日韩精品中文字幕在线一区| 欧美主播一区二区三区美女| av电影在线观看一区| 国产精品123区| 色香蕉久久蜜桃| 97久久精品人人做人人爽| 色婷婷国产精品| 欧洲在线/亚洲| 久久99久久精品| voyeur盗摄精品| eeuss鲁一区二区三区|