www.pudn.com > disk-filter.gz > diskf_scu.h, change:2006-04-13,size:3425b


/*================================================================================== 
 
Copyright @ timixu 2005-2006 
 
Module Name: 
 
  diskf_scu.h 
 
Description: 
  
   write for fruitprince 
 
Author: 
 
  timixu 
 
Date&Time: 
 
  2006-04-12 
 
==================================================================================*/ 
 
#ifndef _DISKF_SCU_H_ 
#define _DISKF_SCU_H_ 
 
#include <ntddk.h> 
#include <ntdddisk.h> 
#include <ntddvol.h> 
#include <mountdev.h> 
#include <wmilib.h> 
 
#ifndef min 
#define min(a,b) (((a) < (b)) ? (a) : (b)) 
#endif 
 
#ifndef max 
#define max(a,b) (((a) > (b)) ? (a) : (b)) 
#endif 
 
 
#define DISKPERF_MAXSTR         64 
 
NTSTATUS 
Diskf_DeviceControl( 
	IN PDEVICE_OBJECT DeviceObject, 
	IN PIRP           Irp 
	); 
 
NTSTATUS 
Diskf_Close( 
   IN PDEVICE_OBJECT  DeviceObject, 
   IN PIRP            Irp 
   ); 
 
NTSTATUS 
Diskf_Read( 
   IN PDEVICE_OBJECT  DeviceObject, 
   IN PIRP            Irp 
   ); 
 
VOID 
Diskf_Write( 
   IN PDEVICE_OBJECT  DeviceObject, 
   IN PIRP            Irp 
   ); 
 
NTSTATUS 
Diskf_DeviceControlCDO(  
	IN  PDEVICE_OBJECT  DeviceObject, 
	IN  PIRP            Irp 
	); 
 
NTSTATUS 
DiskPerfDeviceControl( 
    IN PDEVICE_OBJECT DeviceObject, 
    IN PIRP Irp 
    ); 
 
NTSTATUS 
DiskPerfSendToNextDriver( 
    IN PDEVICE_OBJECT DeviceObject, 
    IN PIRP Irp 
    ); 
 
 
// 
//define the log format 
// 
typedef struct _LOG_ENTRY 
{ 
	ULONG  DiskNumber; 
	 
	// 
	//0 - Read disk 
	//1 - Write disk 
	// 
	ULONG  OperationType; 
     
	ULONG  SectorNumber; 
	// 
	//The size of read\write 
	// 
	ULONG  Length; 
 
	// 
	//First 16 bytes of secotr 
	// 
	CHAR   Data[16]; 
 
}LOG_ENTRY,*PLOG_ENTRY; 
 
typedef struct _WORK_ITEM_CONTEXT 
{ 
	LOG_ENTRY      Log; 
	PIO_WORKITEM   WorkItem; 
 
}WORK_ITEM_CONTEXT,*PWORK_ITEM_CONTEXT; 
 
 
#define  MAX_LOG_BUFFER_SIZE  1024*64 // 64KB 
#define  MAX_LOG_ENTRY_COUNT  (MAX_LOG_BUFFER_SIZE / sizeof(LOG_ENTRY))  
// 
//Log Buffer 
// 
typedef struct _LOG_BUFFER 
{ 
	ULONG    EntryCount; 
	PULONG   Buffer; 
}LOG_BUFFER,*PLOG_BUFFER; 
 
// 
// Device Extension 
// 
 
typedef struct _DEVICE_EXTENSION { 
 
    // 
    // Back pointer to device object 
    // 
 
    PDEVICE_OBJECT DeviceObject; 
 
    // 
    // Target Device Object 
    // 
 
    PDEVICE_OBJECT TargetDeviceObject; 
 
    // 
    // Physical device object 
    // 
    PDEVICE_OBJECT PhysicalDeviceObject; 
 
    // 
    // Disk number for reference in WMI 
    // 
 
    ULONG       DiskNumber; 
 
    // 
    // If device is enabled for counting always 
    // 
 
    LONG        EnabledAlways; 
 
    // 
    // Use to keep track of Volume info from ntddvol.h 
    // 
 
    WCHAR StorageManagerName[8]; 
 
    // 
    // Disk performance counters 
    // and locals used to compute counters 
    // 
 
    ULONG   Processors; 
    PDISK_PERFORMANCE DiskCounters;    // per processor counters 
    LARGE_INTEGER LastIdleClock; 
    LONG QueueDepth; 
    LONG CountersEnabled; 
 
    // 
    // must synchronize paging path notifications 
    // 
    KEVENT PagingPathCountEvent; 
    ULONG  PagingPathCount; 
 
    // 
    // Physical Device name or WMI Instance Name 
    // 
 
    UNICODE_STRING PhysicalDeviceName; 
    WCHAR PhysicalDeviceNameBuffer[DISKPERF_MAXSTR]; 
 
    // 
    // Private context for using WmiLib 
    // 
    WMILIB_CONTEXT WmilibContext; 
 
} DEVICE_EXTENSION, *PDEVICE_EXTENSION; 
 
 
#endif