?? filter.h
字號:
#include "ntddk.h"
#include "ntddkbd.h"
#include "string.h"
//#include <ntddk.h>
//#include <wdmsec.h>
//#include <initguid.h>
//#include "ntddk.h"
//#include "wdmsec.h"
//#include "initguid.h"
#include "intrface.h"
#include "scsi.h"
DEFINE_GUID (GUID_SD_FILTER_CONTROL_OBJECT,
0x41966169, 0x3fd7, 0x4392, 0xaf, 0xe4, 0xe6, 0xa9, 0xd0, 0xa9, 0x2c, 0x72);
#if !defined(_FILTER_H_) //注意這個位置不能亂放,我的認識是要放在加載的頭文件的下面
#define _FILTER_H_
#define DISK_TAG_SRB 'SDcS' // "ScDS" - srb allocation
#define MAXLEN 256
#define NTDEVICE_NAME_STRING L"\\Device\\Usbstorfilter"
#define SYMBOLIC_NAME_STRING L"\\DosDevices\\Usbstorfilter"
#ifndef STATUS_CONTINUE_COMPLETION
#define STATUS_CONTINUE_COMPLETION STATUS_SUCCESS
#endif
#define POOL_TAG 'liFT'
typedef enum _DEVICE_PNP_STATE{
NotStarted = 0,
Started,
StopPending,
Stopped,
RemovePending,
SurpriseRemovePending,
Deleted
} DEVICE_PNP_STATE;
#define INITIALIZE_PNP_STATE(_Data_) \
(_Data_)->DevicePnPState = NotStarted;\
(_Data_)->PreviousPnPState = NotStarted;
#define SET_NEW_PNP_STATE(_Data_, _state_) \
(_Data_)->PreviousPnPState = (_Data_)->DevicePnPState;\
(_Data_)->DevicePnPState = (_state_);
#define RESTORE_PREVIOUS_PNP_STATE(_Data_) \
(_Data_)->DevicePnPState = (_Data_)->PreviousPnPState;\
typedef struct _DEVICE_EXTENSION
{
// A back pointer to the device object.
PDEVICE_OBJECT Self;
//The top of the stack before this filter was added.
PDEVICE_OBJECT NextLowerDriver;
//Current PnP state of the device
DEVICE_PNP_STATE DevicePnPState;
//The previous pnp state
DEVICE_PNP_STATE PreviousPnPState;
//Removelock to track IRPs so that device can be
//removed and the driver can be unloaded safely.
IO_REMOVE_LOCK RemoveLock;
} DEVICE_EXTENSION,*PDEVICE_EXTENSION;
typedef struct _CONTROL_DEVICE_EXTENSION {
ULONG Deleted; // False if the deviceobject is valid, TRUE if it's deleted
PVOID ControlData; // Store your control data here
} CONTROL_DEVICE_EXTENSION, *PCONTROL_DEVICE_EXTENSION;
PCHAR
PnPMinorFunctionString (
UCHAR MinorFunction
);
NTSTATUS
FilterAddDevice(
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT PhysicalDeviceObject
);
NTSTATUS
FilterDispatchPnp(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
VOID
FilterUnload(
IN PDRIVER_OBJECT DriverObject
);
NTSTATUS
FilterPass(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
NTSTATUS
DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath
);
NTSTATUS
FilterStartCompletionRoutine(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PVOID Context
);
NTSTATUS
FilterDeviceUsageNotificationCompletionRoutine(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PVOID Context
);
NTSTATUS
USBSCSIPassThrough( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp );
NTSTATUS
USBSCSICompletion( IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PVOID Context );
#ifdef IOCTL_INTERFACE
//#define NTDEVICE_NAME_STRING L"\\Device\\Usbstorfilter"
//#define SYMBOLIC_NAME_STRING L"\\DosDevices\\Usbstorfilter"
NTSTATUS
FilterCreateControlObject(
IN PDEVICE_OBJECT DeviceObject
);
VOID
FilterDeleteControlObject(
);
NTSTATUS
FilterDispatchIo(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
#endif
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -