申明: 代码是网上收集的,原则上只供学习使用
// 【相关文章:WebWork2与Struts比较】 //==================================================================== 【扩展阅读:企业开发的发展趋势】 // 【扩展信息:WebWork2教程(中文版)(1)】 // defrag.h // copyright (c) 1997 mark russinovich // // header file for defragmentation demonstration program. this file // includes definitions for defragmentation file system control // commands, as well as the undocumented ntfscontrol call. // //==================================================================== //-------------------------------------------------------------------- // d e f i n e s //-------------------------------------------------------------------- // // file system control commands related to defragging // #define fsctl_read_mft_record 0x90068 #define fsctl_get_volume_bitmap 0x9006f #define fsctl_get_retrieval_pointers 0x90073 #define fsctl_move_file 0x90074 // // return code type // typedef uint ntstatus; // // error codes returned by ntfscontrolfile (see ntstatus.h) // #define status_success ((ntstatus)0x00000000l) #define status_buffer_overflow ((ntstatus)0x80000005l) #define status_invalid_parameter ((ntstatus)0xc000000dl) #define status_buffer_too_small ((ntstatus)0xc0000023l) #define status_already_committed ((ntstatus)0xc0000021l) #define status_invalid_device_request ((ntstatus)0xc0000010l) //-------------------------------------------------------------------- // f s c t l s p e c i f i c t y p e d e f s //-------------------------------------------------------------------- // // this is the definition for a vcn/lcn (virtual cluster/logical cluster) // mapping pair that is returned in the buffer passed to // fsctl_get_retrieval_pointers // typedef struct { ulonglong vcn; ulonglong lcn; } mapping_pair, *pmapping_pair; // // this is the definition for the buffer that fsctl_get_retrieval_pointers // returns. it consists of a header followed by mapping pairs // typedef struct { ulong numberofpairs; ulonglong startvcn; mapping_pair pair[1]; } get_retrieval_descriptor, *pget_retrieval_descriptor; // // this is the definition of the buffer that fsctl_get_volume_bitmap // returns. it consists of a header followed by the actual bitmap data // typedef struct { ulonglong startlcn; ulonglong clusterstoendofvol; byte map[1]; } bitmap_descriptor, *pbitmap_descriptor; // // this is the definition for the data structure that is passed in to // fsctl_move_file // typedef struct { handle filehandle; ulong reserved; large_integer startvcn; large_integer targetlcn; ulong numvcns; ulong reserved1; } movefile_descriptor, *pmovefile_descriptor; //-------------------------------------------------------------------- // n t f s c o n t r o l f i l e d e f i n i t i o n s //-------------------------------------------------------------------- // // prototype for ntfscontrolfile and data structures // used in its definition // // // io status block (see ntddk.h) // typedef struct _io_status_block { ntstatus status; ulong information; } io_status_block, *pio_status_block; // // apc routine (see ntddk.h) // typedef void (*pio_apc_routine) ( pvoid apccontext, pio_status_block iostatusblock, ulong reserved ); // // the undocumented ntfscontrolfile // // this function is used to send file system control (fsctl) // commands into file system drivers. its definition is // in ntdll.dll (ntdll.lib), a file shipped with the ntddk. // ntstatus (__stdcall *ntfscontrolfile)( handle filehandle, handle event, // optional pio_apc_routine apcroutine, // optional pvoid apccontext, // optional pio_status_block iostatusblock, ulong fscontrolcode, pvoid inputbuffer, // optional... 下一页