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

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

?? sfilter.c

?? 網程絡過濾驅動,可以截獲網絡封包!對其進行分析攔截!
?? C
?? 第 1 頁 / 共 5 頁
字號:
/*++

Copyright (c) 1989-1993  Microsoft Corporation

Module Name:

	sfilter.c

Abstract:

	This module contains the code that implements the general purpose sample
	file system filter driver.

	As of the Windows XP SP1 IFS Kit version of this sample and later, this
	sample can be built for each build environment released with the IFS Kit
	with no additional modifications.  To provide this capability, additional
	compile-time logic was added -- see the '#if WINVER' locations.  Comments
	tagged with the 'VERSION NOTE' header have also been added as appropriate to
	describe how the logic must change between versions.

	If this sample is built in the Windows XP environment or later, it will run
	on Windows 2000 or later.  This is done by dynamically loading the routines
	that are only available on Windows XP or later and making run-time decisions
	to determine what code to execute.  Comments tagged with 'MULTIVERISON NOTE'
	mark the locations where such logic has been added.

Environment:

	Kernel mode

--*/

#include "ntifs.h"
#include "ntdddisk.h"

// 
// Enable these warnings in the code.
// 

#pragma warning(error:4100)	// Unreferenced formal parameter
#pragma warning(error:4101)	// Unreferenced local variable

// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /
// 
//				 Macro and Structure Definitions
// 
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /

// 
// VERSION NOTE:
// 
// The following useful macros are defined in NTIFS.H in Windows XP and later.
// We will define them locally if we are building for the Windows 2000 
// environment.
// 

#if WINVER == 0x0500

// 
// These macros are used to test, set and clear flags respectively
// 

#ifndef FlagOn
#define FlagOn(_F, _SF)			((_F) & (_SF))
#endif

#ifndef BooleanFlagOn
#define BooleanFlagOn(F, SF)	((BOOLEAN) (((F) & (SF)) != 0))
#endif

#ifndef SetFlag
#define SetFlag(_F, _SF)		((_F) |= (_SF))
#endif

#ifndef ClearFlag
#define ClearFlag(_F, _SF)		((_F) &= ~(_SF))
#endif

#define RtlInitEmptyUnicodeString(_ucStr, _buf, _bufSize) \
	((_ucStr)->Buffer = (_buf), \
	 (_ucStr)->Length = 0, \
	 (_ucStr)->MaximumLength = (USHORT)(_bufSize))

#ifndef min
#define min(a, b) (((a) < (b)) ? (a) : (b))
#endif

#ifndef max
#define max(a, b) (((a) > (b)) ? (a) : (b))
#endif

// 
// We want ASSERT defined as an expression, which was fixed after Windows 2000
// 

#ifdef ASSERT
#undef ASSERT
#if DBG
#define ASSERT(exp) \
	((!(exp)) ? \
		(RtlAssert(#exp, __FILE__, __LINE__, NULL),FALSE) : \
		TRUE)
#else
#define ASSERT(exp) ((void) 0)
#endif
#endif		

#define ExFreePoolWithTag(a, b) ExFreePool((a))

#endif /* WINVER == 0x0500 */

#ifndef Add2Ptr
#define Add2Ptr(P,I) ((PVOID)((PUCHAR)(P) + (I)))
#endif

// 
// Buffer size for local names on the stack
// 

#define MAX_DEVNAME_LENGTH				64
#define MAX_PATH						512

#define ENCRYPT_BIT_SIZE				(128 * 8)

#define SF_ENCRYPT_INFO_DIR				L"System Encrypt Information"
#define SF_ENCRYPT_INFOR_DIR_LENGTH		26

#define RULE_FILE_NAME					L"\\SystemRoot\\xefs.dat"

#if DBG
#define DEBUG_VOLUME						L'G'
#endif

typedef struct _FILE_CONTEXT
{
	PVOID FsContext;
	ULONG RefCount;
	BOOLEAN DecryptOnRead;
	BOOLEAN EncryptOnWrite;
	BOOLEAN EncryptFlagExist; // if encrypt flag file exists, then the file is encrypted
	BOOLEAN NeedEncrypt;
	KEVENT Event;
	WCHAR Name[MAX_PATH];
	UCHAR EncryptExtData[ENCRYPT_BIT_SIZE / sizeof(UCHAR)];
	
} FILE_CONTEXT, *PFILE_CONTEXT;

// 
// Device extension definition for our driver.  Note that the same extension
// is used for the following types of device objects:
//	- File system device object we attach to
//	- Mounted volume device objects we attach to
// 
typedef struct _SFILTER_DEVICE_EXTENSION
{
	// 
	// Pointer to the file system device object we are attached to
	// 
	PDEVICE_OBJECT AttachedToDeviceObject;

	// 
	// Pointer to the real (disk) device object that is associated with
	// the file system device object we are attached to
	// 
	PDEVICE_OBJECT StorageStackDeviceObject;

	// 
	// Name for this device.  If attached to a Volume Device Object it is the
	// name of the physical disk drive.  If attached to a Control Device
	// Object it is the name of the Control Device Object.
	// 
	UNICODE_STRING DeviceName;

	// 
	// Buffer used to hold the above unicode strings
	// 
	WCHAR DeviceNameBuffer[MAX_DEVNAME_LENGTH];

	WCHAR DriveLetter;

	RTL_GENERIC_TABLE FsCtxTable;
	FAST_MUTEX FsCtxTableMutex;
} SFILTER_DEVICE_EXTENSION, *PSFILTER_DEVICE_EXTENSION;

// 
// This structure contains the information we need to pass to the completion
// processing for FSCTRLs.
// 
typedef struct _FSCTRL_COMPLETION_CONTEXT
{
	// 
	// The workitem that will be initialized with our context and 
	// worker routine if this completion processing needs to be completed
	// in a worker thread.
	// 
	WORK_QUEUE_ITEM WorkItem;

	// 
	// The device object to which this device is currently directed.
	// 
	PDEVICE_OBJECT DeviceObject;

	// 
	// The IRP for this FSCTRL operation.
	// 
	PIRP Irp;

	// 
	// For mount operations, the new device object that we have allocated
	// and partially initialized that we will attach to the mounted volume
	// if the mount is successful.
	// 
	PDEVICE_OBJECT NewDeviceObject;
} FSCTRL_COMPLETION_CONTEXT, *PFSCTRL_COMPLETION_CONTEXT;

typedef struct _POST_CREATE_WORKER_CONTEXT
{
	WORK_QUEUE_ITEM WorkItem;
	KEVENT Event;
	PDEVICE_OBJECT DeviceObject;
	PFILE_OBJECT FileObject;
	PFILE_CONTEXT FileContext;
	BOOLEAN NewElement;
} POST_CREATE_WORKER_CONTEXT, *PPOST_CREATE_WORKER_CONTEXT;

typedef struct _READ_WRITE_COMPLETION_CONTEXT
{
	PMDL OldMdl;
	PVOID OldUserBuffer;
	PVOID OldSystemBuffer;
	
	PVOID OldBuffer;
	PVOID MyBuffer;
	ULONG Length;
} READ_WRITE_COMPLETION_CONTEXT, *PREAD_WRITE_COMPLETION_CONTEXT;

typedef struct _POST_SET_INFORMATION_WORKER_CONTEXT
{
	WORK_QUEUE_ITEM WorkItem;
	KEVENT Event;
	PDEVICE_OBJECT DeviceObject;
	PFILE_OBJECT FileObject;
	PFILE_CONTEXT FileContext;
	PWCHAR FileName;
	PWCHAR TargetFileName;
	BOOLEAN Delete;
} POST_SET_INFORMATION_WORKER_CONTEXT, *PPOST_SET_INFORMATION_WORKER_CONTEXT;

#define POLICY_NONE			0x0
#define POLICY_ENCRYPT		0x1
#define POLICY_END			0xFFFFFFFF

typedef struct _RULE
{
	ULONG Policy;
	WCHAR Pattern[MAX_PATH];
} RULE, *PRULE;

// 
// Macro to test if this is my device object
// 
#define IS_MY_DEVICE_OBJECT(_devObj) \
	(((_devObj) != NULL) && \
	 ((_devObj)->DriverObject == gSFilterDriverObject) && \
	  ((_devObj)->DeviceExtension != NULL))

// 
// Macro to test if this is my control device object
// 
#define IS_MY_CONTROL_DEVICE_OBJECT(_devObj) \
	(((_devObj) == gSFilterControlDeviceObject) ? \
			(ASSERT(((_devObj)->DriverObject == gSFilterDriverObject) && \
					((_devObj)->DeviceExtension == NULL)), TRUE) : \
			FALSE)

// 
// Macro to test for device types we want to attach to
// 
#define IS_DESIRED_DEVICE_TYPE(_type) \
	(((_type) == FILE_DEVICE_DISK_FILE_SYSTEM) || \
	 ((_type) == FILE_DEVICE_CD_ROM_FILE_SYSTEM) || \
	 ((_type) == FILE_DEVICE_NETWORK_FILE_SYSTEM))

// 
// Macro to test if FAST_IO_DISPATCH handling routine is valid
// 
#define VALID_FAST_IO_DISPATCH_HANDLER(_FastIoDispatchPtr, _FieldName) \
	(((_FastIoDispatchPtr) != NULL) && \
	 (((_FastIoDispatchPtr)->SizeOfFastIoDispatch) >= \
			(FIELD_OFFSET(FAST_IO_DISPATCH, _FieldName) + sizeof(void *))) && \
	 ((_FastIoDispatchPtr)->_FieldName != NULL))


#if WINVER >= 0x0501
// 
// MULTIVERSION NOTE:
// 
// If built in the Windows XP environment or later, we will dynamically import
// the function pointers for routines that were not supported on Windows 2000
// so that we can build a driver that will run, with modified logic, on 
// Windows 2000 or later.
// 
// Below are the prototypes for the function pointers that we need to 
// dynamically import because not all OS versions support these routines.
// 

typedef
NTSTATUS
(* PSF_REGISTER_FILE_SYSTEM_FILTER_CALLBACKS)(
	IN PDRIVER_OBJECT DriverObject,
	IN PFS_FILTER_CALLBACKS Callbacks
	);

typedef
NTSTATUS
(* PSF_ENUMERATE_DEVICE_OBJECT_LIST)(
	IN PDRIVER_OBJECT DriverObject,
	IN PDEVICE_OBJECT *DeviceObjectList,
	IN ULONG DeviceObjectListSize,
	OUT PULONG ActualNumberDeviceObjects
	);

typedef
NTSTATUS
(* PSF_ATTACH_DEVICE_TO_DEVICE_STACK_SAFE)(
	IN PDEVICE_OBJECT SourceDevice,
	IN PDEVICE_OBJECT TargetDevice,
	OUT PDEVICE_OBJECT *AttachedToDeviceObject
	);

typedef	
PDEVICE_OBJECT
(* PSF_GET_LOWER_DEVICE_OBJECT)(
	IN PDEVICE_OBJECT DeviceObject
	);

typedef
PDEVICE_OBJECT
(* PSF_GET_DEVICE_ATTACHMENT_BASE_REF)(
	IN PDEVICE_OBJECT DeviceObject
	);

typedef
NTSTATUS
(* PSF_GET_DISK_DEVICE_OBJECT)(
	IN PDEVICE_OBJECT FileSystemDeviceObject,
	OUT PDEVICE_OBJECT *DiskDeviceObject
	);

typedef
PDEVICE_OBJECT
(* PSF_GET_ATTACHED_DEVICE_REFERENCE)(
	IN PDEVICE_OBJECT DeviceObject
	);

typedef
NTSTATUS
(* PSF_GET_VERSION)(
	IN OUT PRTL_OSVERSIONINFOW VersionInformation
	);

typedef struct _SF_DYNAMIC_FUNCTION_POINTERS
{
	// 
	// The following routines should all be available on Windows XP (5.1) and
	// later.
	// 
	PSF_REGISTER_FILE_SYSTEM_FILTER_CALLBACKS RegisterFileSystemFilterCallbacks;
	PSF_ATTACH_DEVICE_TO_DEVICE_STACK_SAFE AttachDeviceToDeviceStackSafe;
	PSF_ENUMERATE_DEVICE_OBJECT_LIST EnumerateDeviceObjectList;
	PSF_GET_LOWER_DEVICE_OBJECT GetLowerDeviceObject;
	PSF_GET_DEVICE_ATTACHMENT_BASE_REF GetDeviceAttachmentBaseRef;
	PSF_GET_DISK_DEVICE_OBJECT GetDiskDeviceObject;
	PSF_GET_ATTACHED_DEVICE_REFERENCE GetAttachedDeviceReference;
	PSF_GET_VERSION GetVersion;
} SF_DYNAMIC_FUNCTION_POINTERS, *PSF_DYNAMIC_FUNCTION_POINTERS;

SF_DYNAMIC_FUNCTION_POINTERS gSfDynamicFunctions = {NULL};

// 
// MULTIVERSION NOTE: For this version of the driver, we need to know the
// current OS version while we are running to make decisions regarding what
// logic to use when the logic cannot be the same for all platforms.  We
// will look up the OS version in DriverEntry and store the values
// in these global variables.
// 
ULONG gSfOsMajorVersion = 0;
ULONG gSfOsMinorVersion = 0;

// 
// Here is what the major and minor versions should be for the various OS versions:
// 
// OS Name								 MajorVersion	MinorVersion
// ---------------------------------------------------------------------
// Windows 2000							 5				 0
// Windows XP							 5				 1
// Windows Server 2003					 5				 2
// 

#define IS_WINDOWS2000() \
	((gSfOsMajorVersion == 5) && (gSfOsMinorVersion == 0))

#define IS_WINDOWSXP() \
	((gSfOsMajorVersion == 5) && (gSfOsMinorVersion == 1))

#define IS_WINDOWSXP_OR_LATER() \
	(((gSfOsMajorVersion == 5) && (gSfOsMinorVersion >= 1)) || \
	 (gSfOsMajorVersion > 5))

#define IS_WINDOWSSRV2003_OR_LATER() \
	(((gSfOsMajorVersion == 5) && (gSfOsMinorVersion >= 2)) || \
	 (gSfOsMajorVersion > 5))

#endif


// 
// TAG identifying memory SFilter allocates
// 

#define SFLT_POOL_TAG			'tlFS'

// 
// This structure and these routines are used to retrieve the name of a file
// object.  To prevent allocating memory every time we get a name this
// structure contains a small buffer (which should handle 90+% of all names).
// If we do overflow this buffer we will allocate a buffer big enough
// for the name.
// 

typedef struct _GET_NAME_CONTROL
{
	PCHAR allocatedBuffer;
	CHAR smallBuffer[256];
} GET_NAME_CONTROL, *PGET_NAME_CONTROL;


PUNICODE_STRING
SfGetFileName(
	IN PFILE_OBJECT FileObject,
	IN NTSTATUS CreateStatus,
	IN OUT PGET_NAME_CONTROL NameControl
	);

VOID
SfGetFileNameCleanup(
	IN OUT PGET_NAME_CONTROL NameControl
	);

// 
// Macros for SFilter DbgPrint levels.
// 
#define SF_LOG_PRINT(_dbgLevel, _string)				  \
	(FlagOn(SfDebug,(_dbgLevel)) ?						  \
		DbgPrint _string  :								 \
		((void)0))

// 
// Delay values for KeDelayExecutionThread()
// (Values are negative to represent relative time)
// 
#define DELAY_ONE_MICROSECOND	(-10)
#define DELAY_ONE_MILLISECOND	(DELAY_ONE_MICROSECOND*1000)
#define DELAY_ONE_SECOND		(DELAY_ONE_MILLISECOND*1000)


// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /
// 
//					Global variables
// 
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /

// 
// Holds pointer to the driver object for this driver
// 
PDRIVER_OBJECT gSFilterDriverObject = NULL;

// 
// Holds pointer to the device object that represents this driver and is used
// by external programs to access this driver.  This is also known as the
// "control device object".
// 
PDEVICE_OBJECT gSFilterControlDeviceObject = NULL;

// 
// This lock is used to synchronize our attaching to a given device object.
// This lock fixes a race condition where we could accidently attach to the
// same device object more then once.  This race condition only occurs if
// a volume is being mounted at the same time as this filter is being loaded.
// This problem will never occur if this filter is loaded at boot time before
// any file systems are loaded.
// 
// This lock is used to atomically test if we are already attached to a given
// device object and if not, do the attach.
// 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线精品视频免费播放| 99精品久久久久久| 中文字幕中文在线不卡住| 欧美日韩久久久一区| 懂色中文一区二区在线播放| 视频一区二区三区中文字幕| 中文一区一区三区高中清不卡| 欧美另类久久久品| 99久久99久久久精品齐齐| 久久成人久久爱| 午夜影院久久久| 中文字幕一区二区三区不卡在线 | 日韩制服丝袜av| 亚洲同性gay激情无套| 日韩精品一区二区三区视频在线观看 | 国产美女一区二区三区| 亚洲一区二区三区在线播放| 国产亚洲精品bt天堂精选| 7777精品伊人久久久大香线蕉超级流畅 | 国产毛片精品视频| 日本强好片久久久久久aaa| 亚洲欧洲精品成人久久奇米网| 久久综合久久综合九色| 欧美日韩成人高清| 在线中文字幕一区| 99久久伊人精品| 成人动漫中文字幕| 国产很黄免费观看久久| 紧缚捆绑精品一区二区| 日本欧美一区二区三区乱码| 亚洲猫色日本管| 国产精品久久久久婷婷| 久久久久久电影| 26uuu亚洲综合色| 精品久久五月天| 精品国产乱码久久| 精品国产一区久久| 精品区一区二区| 欧美电影免费观看高清完整版在线观看| 欧美日韩色一区| 欧美久久久一区| 欧美一区二区大片| 欧美成人女星排行榜| 精品人伦一区二区色婷婷| 日韩精品中午字幕| 欧美变态口味重另类| 欧美精品一区二区三区高清aⅴ| 欧美一区二区三区男人的天堂| 欧美一区中文字幕| 日韩欧美一区二区不卡| 日韩一区二区免费在线观看| 91精品中文字幕一区二区三区| 欧美日本国产视频| 欧美一区二区三区在线| 日韩精品资源二区在线| 久久久精品国产免大香伊| 日本一区二区三区免费乱视频| 国产精品人成在线观看免费| 最新国产の精品合集bt伙计| 亚洲精品成人悠悠色影视| 亚洲午夜一区二区三区| 日韩综合一区二区| 久久www免费人成看片高清| 国产精品白丝jk白祙喷水网站| 成人黄色大片在线观看| 91黄色小视频| 51精品秘密在线观看| 精品99999| 国产日韩精品一区二区三区在线| 中文字幕一区免费在线观看| 亚洲一区二区三区视频在线播放| 日韩不卡在线观看日韩不卡视频| 久久精品国产第一区二区三区| 国产精品2024| 色综合咪咪久久| 欧美一区二区三区喷汁尤物| 中文字幕国产一区| 亚洲第一成年网| 国产一区二区三区不卡在线观看 | 捆绑调教一区二区三区| 国产99久久久国产精品| 欧美优质美女网站| 26uuu亚洲| 亚洲蜜臀av乱码久久精品| 蜜臀国产一区二区三区在线播放 | 日韩一级片在线播放| 国产欧美一区二区在线| 亚洲成人在线免费| 不卡电影免费在线播放一区| 欧美区视频在线观看| 中文字幕乱码日本亚洲一区二区| 亚洲aaa精品| av一区二区三区四区| 日韩欧美你懂的| 亚洲精品日产精品乱码不卡| 极品尤物av久久免费看| 欧美中文字幕久久| 国产精品水嫩水嫩| 另类人妖一区二区av| 91久久免费观看| 久久久久国产一区二区三区四区| 婷婷综合五月天| 99精品1区2区| 国产欧美日韩亚州综合| 日本系列欧美系列| 欧洲一区二区三区免费视频| 国产精品天干天干在观线| 免费日韩伦理电影| 欧美性色欧美a在线播放| 国产女主播一区| 韩日欧美一区二区三区| 在线成人免费观看| 亚洲一区二区美女| 91亚洲精品久久久蜜桃网站| 国产欧美一区二区精品忘忧草| 午夜亚洲福利老司机| youjizz国产精品| 欧美r级电影在线观看| 五月天激情综合| 欧美亚洲综合一区| 亚洲美女视频一区| jvid福利写真一区二区三区| 国产色综合一区| 狠狠色丁香婷婷综合| 日韩欧美一区二区在线视频| 日韩经典中文字幕一区| 欧美日韩亚洲综合一区| 洋洋av久久久久久久一区| 色呦呦一区二区三区| 亚洲毛片av在线| 日本高清不卡aⅴ免费网站| 亚洲免费观看高清完整版在线观看| 成人免费毛片app| 国产精品国产三级国产三级人妇 | 91啪九色porn原创视频在线观看| 久久毛片高清国产| 国产美女一区二区三区| 国产欧美久久久精品影院| 国产+成+人+亚洲欧洲自线| 国产欧美一区二区精品秋霞影院| 国产成人精品影院| 国产精品黄色在线观看| 99精品久久免费看蜜臀剧情介绍| 中文字幕日韩精品一区| 91啦中文在线观看| 亚洲二区视频在线| 欧美一区二区成人6969| 精品一区免费av| 久久亚洲精华国产精华液| 高清久久久久久| 亚洲视频你懂的| 欧美日韩mp4| 捆绑紧缚一区二区三区视频| 久久久久久久久久看片| 99在线视频精品| 香港成人在线视频| 2020国产精品| 99国产精品99久久久久久| 一区二区三区中文免费| 欧美色精品在线视频| 日韩av一区二区三区四区| 精品日韩欧美在线| 不卡高清视频专区| 亚洲成人免费av| 精品捆绑美女sm三区| 成人av综合在线| 午夜国产精品影院在线观看| 精品国产乱码久久久久久牛牛 | 精品一区二区三区欧美| 久久久久久亚洲综合影院红桃| av中文一区二区三区| 五月婷婷综合激情| 欧美经典一区二区| 欧美日韩免费一区二区三区视频| 国产一区二区三区综合| 一区二区三区日韩欧美| 日韩你懂的在线播放| 99久久精品免费看国产| 日韩高清一区二区| 日本一二三四高清不卡| 欧美日韩国产一级片| 国产成+人+日韩+欧美+亚洲| 亚洲成a人v欧美综合天堂| 久久久精品黄色| 欧美精品xxxxbbbb| 97精品视频在线观看自产线路二| 日韩电影在线免费| 亚洲欧洲日本在线| 欧美mv日韩mv亚洲| 欧美亚一区二区| 成人激情综合网站| 久久丁香综合五月国产三级网站| 亚洲激情男女视频| 欧美高清在线一区| 日韩女优制服丝袜电影| 欧美优质美女网站| 93久久精品日日躁夜夜躁欧美| 激情欧美一区二区三区在线观看| 一区二区三国产精华液| 国产日韩成人精品|