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

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

?? filespy.c

?? 文件過濾驅動
?? C
?? 第 1 頁 / 共 5 頁
字號:
/*++

Copyright (c) 1989-1999  Microsoft Corporation

Module Name:

    filespy.c

Abstract:

    This is the main module of FileSpy.

Author:

    

Environment:

    Kernel mode


Revision History:

    George Jenkins (georgeje) 6-Jan-1999    cloned from sfilter.c

--*/

#include <ntifs.h>
#include "filespy.h"
#include "fspyKern.h"

//
// Global storage for this file system filter driver.
//
PDEVICE_OBJECT gControlDeviceObject;

PDRIVER_OBJECT gFsDriverObject;

FAST_MUTEX gSpyDeviceExtensionListLock;
LIST_ENTRY gSpyDeviceExtensionList;

//
// NOTE 1:  There are some cases where we need to hold both the 
//   gControlDeviceStateLock and the gOutputBufferLock at the same time.  In
//   these cases, you should acquire the gControlDeviceStateLock then the
//   gOutputBufferLock.
// NOTE 2:  The gControlDeviceStateLock MUST be a spinlock since we try to 
//   acquire it during the completion path in SpyLog, which could be called at
//   DISPATCH_LEVEL (only KSPIN_LOCKs can be acquired at DISPATCH_LEVEL).
//
CONTROL_DEVICE_STATE gControlDeviceState = CLOSED;
KSPIN_LOCK           gControlDeviceStateLock;

// NOTE:  Like the gControlDeviceStateLock, gOutputBufferLock MUST be a spinlock
//   since we try to acquire it during the completion path in SpyLog, which 
//   could be called at DISPATCH_LEVEL (only KSPIN_LOCKs can be acquired at 
//   DISPATCH_LEVEL).
//
KSPIN_LOCK gOutputBufferLock;
LIST_ENTRY gOutputBufferList;

NPAGED_LOOKASIDE_LIST gFreeBufferList;

ULONG gLogSequenceNumber = 0;
KSPIN_LOCK gLogSequenceLock;

UNICODE_STRING gVolumeString;
UNICODE_STRING gOverrunString;
UNICODE_STRING gPagingIoString;

//
// NOTE:  Like above for the ControlDeviceLock, we must use KSPIN_LOCKs
//   to synchronize access to hash buckets since we may call try to
//   acquire them at DISPATCH_LEVEL.
//
LIST_ENTRY gHashTable[HASH_SIZE];
KSPIN_LOCK gHashLockTable[HASH_SIZE];
ULONG gHashMaxCounters[HASH_SIZE];
ULONG gHashCurrentCounters[HASH_SIZE];

HASH_STATISTICS gHashStat;

LONG         gMaxRecordsToAllocate = DEFAULT_MAX_RECORDS_TO_ALLOCATE;
LONG         gRecordsAllocated = 0;

LONG         gMaxNamesToAllocate = DEFAULT_MAX_NAMES_TO_ALLOCATE;
LONG         gNamesAllocated = 0;

LONG         gStaticBufferInUse = FALSE;
CHAR         gOutOfMemoryBuffer[RECORD_SIZE];


//
// Macro to test if we are logging for this device
// NOTE: We don't bother synchronizing to check the gControlDeviceState since
//   we can tolerate a stale value here.  We just look at it here to avoid 
//   doing the logging work if we can.  We synchronize to check the 
//   gControlDeviceState before we add the log record to the gOutputBufferList 
//   and discard the log record if the ControlDevice is no longer OPENED.
//
#define SHOULD_LOG(pDeviceObject) \
    ((gControlDeviceState == OPENED) && \
     ASSERT(((PDEVICE_EXTENSION)(pDeviceObject)->DeviceExtension)->Type == \
            FILESPY_DEVICE_TYPE) && \
     ((PDEVICE_EXTENSION)(pDeviceObject)->DeviceExtension)->LogThisDevice)
     
//
//  Macro for validating the FastIo dispatch routines before calling
//  them in the FastIo pass through functions.
//
#define VALID_FAST_IO_DISPATCH_HANDLER( FastIoDispatchPtr, Handler) \
    ((FastIoDispatchPtr) && (FastIoDispatchPtr)->Handler)
    
//
//  Since functions in drivers are non-pagable by default, these pragmas 
//  allow the driver writer to tell the system what functions can be paged.
//
//  Use the PAGED_CODE() macro at the beginning of these functions'
//  implementations while debugging to ensure that these routines are
//  never called at IRQL > APC_LEVEL (therefore the routine cannot
//  be paged).
//

#ifdef ALLOC_PRAGMA
#pragma alloc_text(INIT, DriverEntry)
#pragma alloc_text(PAGE, SpyFastIoCheckIfPossible)
#pragma alloc_text(PAGE, SpyFastIoRead)
#pragma alloc_text(PAGE, SpyFastIoWrite)
#pragma alloc_text(PAGE, SpyFastIoQueryBasicInfo)
#pragma alloc_text(PAGE, SpyFastIoQueryStandardInfo)
#pragma alloc_text(PAGE, SpyFastIoLock)
#pragma alloc_text(PAGE, SpyFastIoUnlockSingle)
#pragma alloc_text(PAGE, SpyFastIoUnlockAll)
#pragma alloc_text(PAGE, SpyFastIoUnlockAllByKey)
#pragma alloc_text(PAGE, SpyFastIoDeviceControl)
#pragma alloc_text(PAGE, SpyFastIoDetachDevice)
#pragma alloc_text(PAGE, SpyFastIoQueryNetworkOpenInfo)
#pragma alloc_text(PAGE, SpyFastIoAcquireForModWrite)
#pragma alloc_text(PAGE, SpyFastIoMdlRead)
#pragma alloc_text(PAGE, SpyFastIoPrepareMdlWrite)
#pragma alloc_text(PAGE, SpyFastIoMdlWriteComplete)
#pragma alloc_text(PAGE, SpyFastIoReadCompressed)
#pragma alloc_text(PAGE, SpyFastIoWriteCompressed)
#pragma alloc_text(PAGE, SpyFastIoQueryOpen)
#pragma alloc_text(PAGE, SpyFastIoReleaseForModWrite)
#pragma alloc_text(PAGE, SpyFastIoAcquireForCcFlush)
#pragma alloc_text(PAGE, SpyFastIoReleaseForCcFlush)
#ifdef SPY_BOOT_DRIVER
#pragma alloc_text(PAGE, SpyReinitDriver)
#endif
#endif
 
#ifdef SPY_BOOT_DRIVER
VOID
SpyReinitDriver(
    PDRIVER_OBJECT DriverObject,
    PVOID Context,
    ULONG Count
    )
/*++

Routine Description:

    This routine attaches FileSpy to the drives that were listed
    in the Registry.  This routine is passed into 
    IoRegisterBootDriverReinitialization.  
    
Arguments:

    DriverObject - FileSpy's driver object

    Context - The partial value information from reading the
        list of drives to attached to from the registry.
        
    Count - not used
    
Return Value:

    None.

--*/
{
    PKEY_VALUE_PARTIAL_INFORMATION pValuePartialInfo;
    NTSTATUS status;
    PWSTR attachDrives;
    
    PAGED_CODE();
    
    if (NULL != Context) {
        pValuePartialInfo = (PKEY_VALUE_PARTIAL_INFORMATION) Context;
        attachDrives = (PWSTR)&pValuePartialInfo->Data;
        
        while(*attachDrives){
            status = SpyAttachDevice(gControlDeviceObject, attachDrives);
        
            while(*attachDrives++)              // look for the null
                ;
        }
        ExFreePool(Context);
    }
    
}
#endif 

NTSTATUS
DriverEntry(
    IN PDRIVER_OBJECT  DriverObject,
    IN PUNICODE_STRING RegistryPath
)
/*++

Routine Description:

    This is the initialization routine for the general purpose file system
    filter driver.  This routine creates the device object that represents 
    this driver in the system and registers it for watching all file systems 
    that register or unregister themselves as active file systems.

Arguments:

    DriverObject - Pointer to driver object created by the system.

Return Value:

    The function value is the final status from the initialization operation.

--*/
{
    UNICODE_STRING    nameString;
    PFILE_OBJECT      fileObject;
    NTSTATUS          status;
    PFAST_IO_DISPATCH fastIoDispatch;
    ULONG             i;
    PDEVICE_EXTENSION deviceExtension;
    UNICODE_STRING    linkString;
    
    //////////////////////////////////////////////////////////////////////
    //                                                                  //
    //  General setup for all filter drivers.  This sets up the filter  //
    //  driver's DeviceObject and registers the callback routines for   //
    //  the filter driver.                                              //
    //                                                                  //
    //////////////////////////////////////////////////////////////////////

    //
    // Create the device object that will represent the FileSpy device.
    //

    RtlInitUnicodeString( &nameString, FILESPY_FULLDEVICE_NAME );
    
    //
    // Create the "control" device object.  Note that this device object does
    // not have a device extension (set to NULL).  Most of the fast IO routines
    // check for this condition to determine if the fast IO is directed at the
    // control device.
    //
    status = IoCreateDevice(
        DriverObject,
        0,
        &nameString,
        FILESPY_DEVICE_TYPE,
        0,
        FALSE,
        &gControlDeviceObject);
    if (!NT_SUCCESS( status )) {
#if DBG
        DbgPrint( "Error creating FileSpy device, error: %x\n", status );
#endif // DBG
        return status;
    } else {
        RtlInitUnicodeString ( &linkString, FILESPY_DOSDEVICE_NAME );
        status = IoCreateSymbolicLink ( &linkString, &nameString );
        if (!NT_SUCCESS(status)) {
            DbgPrint (("FileSpy.SYS: IoCreateSymbolicLink failed\n"));
            IoDeleteDevice(gControlDeviceObject);
            return status;
        }
    }

    //
    // Initialize the driver object with this device driver's entry points.
    //
    for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++) {
        DriverObject->MajorFunction[i] = SpyDispatch;
    }
    DriverObject->MajorFunction[IRP_MJ_CREATE] = SpyCreate;

    //
    // Allocate fast I/O data structure and fill it in.  This structure
    // is used to register the callbacks for FileSpy in the fast I/O
    // data paths.
    //
    fastIoDispatch = ExAllocatePool( NonPagedPool, sizeof( FAST_IO_DISPATCH ) );
    if (!fastIoDispatch) {
        IoDeleteDevice( gControlDeviceObject );
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    RtlZeroMemory( fastIoDispatch, sizeof( FAST_IO_DISPATCH ) );
    fastIoDispatch->SizeOfFastIoDispatch = sizeof( FAST_IO_DISPATCH );
    fastIoDispatch->FastIoCheckIfPossible = SpyFastIoCheckIfPossible;
    fastIoDispatch->FastIoRead = SpyFastIoRead;
    fastIoDispatch->FastIoWrite = SpyFastIoWrite;
    fastIoDispatch->FastIoQueryBasicInfo = SpyFastIoQueryBasicInfo;
    fastIoDispatch->FastIoQueryStandardInfo = SpyFastIoQueryStandardInfo;
    fastIoDispatch->FastIoLock = SpyFastIoLock;
    fastIoDispatch->FastIoUnlockSingle = SpyFastIoUnlockSingle;
    fastIoDispatch->FastIoUnlockAll = SpyFastIoUnlockAll;
    fastIoDispatch->FastIoUnlockAllByKey = SpyFastIoUnlockAllByKey;
    fastIoDispatch->FastIoDeviceControl = SpyFastIoDeviceControl;
    fastIoDispatch->FastIoDetachDevice = SpyFastIoDetachDevice;
    fastIoDispatch->FastIoQueryNetworkOpenInfo = SpyFastIoQueryNetworkOpenInfo;
    fastIoDispatch->AcquireForModWrite = SpyFastIoAcquireForModWrite;
    fastIoDispatch->MdlRead = SpyFastIoMdlRead;
    fastIoDispatch->MdlReadComplete = SpyFastIoMdlReadComplete;
    fastIoDispatch->PrepareMdlWrite = SpyFastIoPrepareMdlWrite;
    fastIoDispatch->MdlWriteComplete = SpyFastIoMdlWriteComplete;
    fastIoDispatch->FastIoReadCompressed = SpyFastIoReadCompressed;
    fastIoDispatch->FastIoWriteCompressed = SpyFastIoWriteCompressed;
    fastIoDispatch->MdlReadCompleteCompressed = 
                                    SpyFastIoMdlReadCompleteCompressed;
    fastIoDispatch->MdlWriteCompleteCompressed = 
                                    SpyFastIoMdlWriteCompleteCompressed;
    fastIoDispatch->FastIoQueryOpen = SpyFastIoQueryOpen;
    fastIoDispatch->ReleaseForModWrite = SpyFastIoReleaseForModWrite;
    fastIoDispatch->AcquireForCcFlush = SpyFastIoAcquireForCcFlush;
    fastIoDispatch->ReleaseForCcFlush = SpyFastIoReleaseForCcFlush;

    DriverObject->FastIoDispatch = fastIoDispatch;

    //////////////////////////////////////////////////////////////////////
    //                                                                  //
    //  Initialize global data structures that are used for FileSpy's   //
    //  logging of I/O operations.                                      //
    //                                                                  //
    //////////////////////////////////////////////////////////////////////

    InitializeListHead( &gSpyDeviceExtensionList );
    
    //
    // A fast mutex was used in this case because the mutex is never acquired at DPC level or above.
    // Spinlocks were chosen in other cases because they are acquired at DPC level or above.
    // Another consideration is that on an MP machine, a spin lock will literally spin trying to 
    // acquire the lock when the lock is already acquired.  Acquiring a previously acquired fast
    // mutex will suspend the thread, thus freeing up the processor.
    //
    
    ExInitializeFastMutex( &gSpyDeviceExtensionListLock );


    gFsDriverObject = DriverObject;

    KeInitializeSpinLock( &gControlDeviceStateLock );

    InitializeListHead( &gOutputBufferList );

    KeInitializeSpinLock( &gOutputBufferLock );
    KeInitializeSpinLock( &gLogSequenceLock );


#ifndef MEMORY_DBG

    //
    //  When we aren't debugging our memory usage, we want to allocate 
    //  memory from a lookaside list for better performance.  Unfortunately,
    //  we cannot benefit from the memory debugging help of the Driver 
    //  Verifier if we allocate memory from a look-aside list.
    //

    ExInitializeNPagedLookasideList( 
        &gFreeBufferList, 
        ExAllocatePoolWithTag, 
        ExFreePool, 
        0, 
        RECORD_SIZE, 
        MSFM_TAG, 
        100 );
#endif

    //
    // Initialize the hash table
    //
        
    for (i = 0; i < HASH_SIZE; i++){
        InitializeListHead(&gHashTable[i]);
        KeInitializeSpinLock(&gHashLockTable[i]);
    }

    //
    // Indicate that the type for this device object is a primary, not a 
    // filter device object so that it doesn't accidentally get used to 
    // call a file system.
    //

    RtlInitUnicodeString(&gVolumeString, L"VOLUME");
    RtlInitUnicodeString(&gOverrunString, L"......");
    RtlInitUnicodeString(&gPagingIoString, L"Paging IO");

    //
    // Read the custom parameters for FileSpy from the registry
    //
    SpyReadDriverParameters(RegistryPath, DriverObject);

    return STATUS_SUCCESS;
}

DBGSTATIC
NTSTATUS
SpyPassThrough(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP           Irp

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美在线一二三| 欧美成人欧美edvon| 天天色 色综合| 亚洲国产精品ⅴa在线观看| 日韩午夜精品视频| 538在线一区二区精品国产| 欧美亚洲动漫另类| 欧美日韩国产高清一区二区| 欧美日韩一区 二区 三区 久久精品| 色婷婷久久久久swag精品| 高清成人免费视频| 国产成人亚洲精品青草天美 | 国产一区二区三区四区五区美女| 天堂av在线一区| 午夜精品久久久久久久| 不卡av电影在线播放| gogo大胆日本视频一区| 日本韩国一区二区| 欧美一区二区三区在线观看视频| 日韩欧美激情四射| 久久精品人人做| 国产精品三级久久久久三级| 亚洲免费在线视频一区 二区| 亚洲精品你懂的| 日韩成人免费看| 风间由美一区二区三区在线观看 | 91国产免费看| 亚洲美女视频在线| 97aⅴ精品视频一二三区| 在线观看亚洲一区| 亚洲精品免费在线观看| 一本色道a无线码一区v| 国产精品女人毛片| 色香色香欲天天天影视综合网| 国产精品伦理在线| 成年人午夜久久久| 亚洲精品老司机| 欧美影视一区在线| 日韩中文字幕亚洲一区二区va在线 | 久久成人久久爱| 91香蕉视频mp4| 精品日韩一区二区三区免费视频| 毛片av一区二区| 欧美在线啊v一区| 午夜国产不卡在线观看视频| 91精品久久久久久蜜臀| 精品一区精品二区高清| 欧美专区日韩专区| 日韩国产高清影视| 精品免费一区二区三区| 粉嫩嫩av羞羞动漫久久久| 国产精品国产三级国产aⅴ原创| 免费在线观看日韩欧美| 欧美艳星brazzers| 蜜桃一区二区三区在线观看| 久久精品一区四区| 色哟哟一区二区| 日本不卡中文字幕| 国产欧美一区二区精品秋霞影院| 日韩黄色免费电影| 国产欧美一区二区精品久导航 | 亚洲欧洲国产日本综合| 国产麻豆成人精品| 亚洲美腿欧美偷拍| 日韩精品一区国产麻豆| 成人福利在线看| 天堂蜜桃91精品| 日本一区二区三区四区| 在线不卡的av| 水蜜桃久久夜色精品一区的特点| 久久久亚洲精华液精华液精华液| 日韩成人精品在线观看| 欧美高清一级片在线观看| 欧美综合一区二区| 国产成人欧美日韩在线电影| 偷偷要91色婷婷| 亚洲人123区| 精品欧美乱码久久久久久 | 亚洲无人区一区| 91蜜桃网址入口| 激情六月婷婷综合| 久久久久国产精品麻豆| 欧美日韩一区高清| 成人国产精品免费观看视频| 久久精品国产精品亚洲精品| 亚洲精品久久久久久国产精华液| 久久久久久久久久久久久夜| 欧美精品一二三四| 在线视频你懂得一区二区三区| 国产一区二区不卡老阿姨| 午夜精品一区二区三区免费视频 | 精品粉嫩aⅴ一区二区三区四区| 韩国视频一区二区| 亚洲午夜激情av| 亚洲美女免费视频| 久久久久久久网| 欧美mv日韩mv亚洲| 欧美日韩不卡在线| 91久久精品网| 99re这里只有精品视频首页| 国产凹凸在线观看一区二区| 理论电影国产精品| 久久福利视频一区二区| 奇米精品一区二区三区在线观看一| 亚洲综合成人在线| 日韩精品影音先锋| 日韩一级高清毛片| 欧美一区二区精品在线| 欧美高清精品3d| 欧美丰满嫩嫩电影| 欧美狂野另类xxxxoooo| 欧美乱熟臀69xxxxxx| 欧美日本在线看| 欧美日韩视频专区在线播放| 欧美视频日韩视频在线观看| 在线观看一区二区视频| 色成人在线视频| 欧美在线一区二区| 欧美日韩免费观看一区二区三区| 日本精品裸体写真集在线观看| 91免费版在线| 欧美另类久久久品| 欧美电影免费观看高清完整版在线观看 | 美腿丝袜在线亚洲一区| 日本不卡免费在线视频| 激情综合色综合久久| 国产在线一区二区| 国产成都精品91一区二区三| 成人午夜免费电影| 美女在线视频一区| 国产精品2024| 久久不见久久见中文字幕免费| 国产一区二区h| www.日韩大片| 欧美日韩不卡一区二区| 精品国产免费久久 | 免费看欧美女人艹b| 久久aⅴ国产欧美74aaa| 国产91丝袜在线播放0| 91免费在线视频观看| 欧美熟乱第一页| 欧美成人免费网站| 亚洲欧美日本韩国| 日本亚洲最大的色成网站www| 国产成人综合视频| 精品视频一区 二区 三区| 久久影院视频免费| 欧美精品一区二区在线播放| 国产精品素人一区二区| 天天操天天色综合| 高清不卡一区二区| 在线成人高清不卡| 亚洲视频一区在线观看| 成人欧美一区二区三区| 丝袜脚交一区二区| 99久久伊人网影院| 日韩一区二区在线看| 中文字幕一区二区三区乱码在线| 偷窥少妇高潮呻吟av久久免费| 国产精品一区二区无线| 欧美日韩aaa| 亚洲桃色在线一区| 国产乱子伦视频一区二区三区| 91久久久免费一区二区| 日本一区二区三区在线不卡| 五月天国产精品| 99久久精品国产精品久久| 久久久精品一品道一区| 蜜臀av一区二区在线观看| 91久久精品日日躁夜夜躁欧美| 久久综合九色综合欧美亚洲| 日本不卡123| 欧美日韩高清影院| 一区二区三区国产精品| 午夜电影一区二区| 91美女在线视频| 国产精品免费视频观看| 黄色日韩三级电影| 欧美精品久久久久久久多人混战| 国产精品高潮呻吟| 国产91精品一区二区麻豆网站 | 经典三级视频一区| 91麻豆精品国产| 香蕉久久一区二区不卡无毒影院 | 最新中文字幕一区二区三区| 国内精品视频666| 欧美一区二区三区视频在线观看| 亚洲美女偷拍久久| 91麻豆精东视频| 亚洲精品国产视频| 91在线观看一区二区| 国产精品免费久久久久| 国产宾馆实践打屁股91| 亚洲国产精华液网站w| 国产99精品国产| 成人免费一区二区三区视频| 9人人澡人人爽人人精品| 一区在线观看免费| 色av一区二区| 五月综合激情网|