📄 mspykern.h
字号:
/*++
Copyright (c) 1989-2002 Microsoft Corporation
Module Name:
mspyKern.h
Abstract:
Header file which contains the structures, type definitions,
constants, global variables and function prototypes that are
only visible within the kernel.
Environment:
Kernel mode
--*/
#ifndef __MSPYKERN_H__
#define __MSPYKERN_H__
#include <fltKernel.h>
#include "minispy.h"
//
// Memory allocation tag
//
#define SPY_TAG 'ypSM'
//---------------------------------------------------------------------------
// Global variables
//---------------------------------------------------------------------------
typedef struct _MINISPY_DATA {
//
// The object that identifies this driver.
//
PDRIVER_OBJECT DriverObject;
//
// The filter that results from a call to
// FltRegisterFilter.
//
PFLT_FILTER Filter;
//
// Server port: user mode connects to this port
//
PFLT_PORT ServerPort;
//
// Client connection port: only one connection is allowed at a time.,
//
PFLT_PORT ClientPort;
//
// List of buffers with data to send to user mode.
//
KSPIN_LOCK OutputBufferLock;
LIST_ENTRY OutputBufferList;
//
// Lookaside list used for allocating buffers.
//
NPAGED_LOOKASIDE_LIST FreeBufferList;
//
// Variables used to throttle how many records buffer we can use
//
LONG MaxRecordsToAllocate;
LONG RecordsAllocated;
//
// static buffer used for sending an "out-of-memory" message
// to user mode.
//
ULONG StaticBufferInUse;
//
// We need to make sure this buffer aligns on a PVOID boundary because
// minispy casts this buffer to a RECORD_LIST structure.
// That can cause alignment faults unless the structure starts on the
// proper PVOID boundary
//
PVOID OutOfMemoryBuffer[RECORD_SIZE/sizeof( PVOID )];
//
// Variable and lock for maintaining LogRecord sequence numbers.
//
ULONG LogSequenceNumber;
//
// The name query method to use. By default, it is set to
// FLT_FILE_NAME_QUERY_ALWAYS_ALLOW_CACHE_LOOKUP, but it can be overridden
// by a setting in the registery.
//
ULONG NameQueryMethod;
//
// Global debug flags
//
ULONG DebugFlags;
} MINISPY_DATA, *PMINISPY_DATA;
//
// Minispy's global variables
//
extern MINISPY_DATA MiniSpyData;
#define DEFAULT_MAX_RECORDS_TO_ALLOCATE 500
#define MAX_RECORDS_TO_ALLOCATE L"MaxRecords"
#define DEFAULT_NAME_QUERY_METHOD FLT_FILE_NAME_QUERY_ALWAYS_ALLOW_CACHE_LOOKUP
#define NAME_QUERY_METHOD L"NameQueryMethod"
//
// DebugFlag values
//
#define SPY_DEBUG_PARSE_NAMES 0x00000001
//---------------------------------------------------------------------------
// Registration structure
//---------------------------------------------------------------------------
extern const FLT_REGISTRATION FilterRegistration;
//---------------------------------------------------------------------------
// Function prototypes
//---------------------------------------------------------------------------
FLT_PREOP_CALLBACK_STATUS
SpyPreOperationCallback (
IN OUT PFLT_CALLBACK_DATA Data,
IN PCFLT_RELATED_OBJECTS FltObjects,
OUT PVOID *CompletionContext
);
FLT_POSTOP_CALLBACK_STATUS
SpyPostOperationCallback (
IN OUT PFLT_CALLBACK_DATA Data,
IN PCFLT_RELATED_OBJECTS FltObjects,
IN PVOID CompletionContext,
IN FLT_POST_OPERATION_FLAGS Flags
);
NTSTATUS
SpyFilterUnload (
FLT_FILTER_UNLOAD_FLAGS Flags
);
NTSTATUS
SpyQueryTeardown (
IN PCFLT_RELATED_OBJECTS FltObjects,
IN FLT_INSTANCE_QUERY_TEARDOWN_FLAGS Flags
);
VOID
SpyReadDriverParameters (
IN PUNICODE_STRING RegistryPath
);
//---------------------------------------------------------------------------
// Memory allocation routines
//---------------------------------------------------------------------------
PRECORD_LIST
SpyAllocateBuffer (
OUT PULONG RecordType
);
VOID
SpyFreeBuffer (
PVOID Buffer
);
//---------------------------------------------------------------------------
// Logging routines
//---------------------------------------------------------------------------
PRECORD_LIST
SpyNewRecord (
VOID
);
VOID
SpyFreeRecord (
PRECORD_LIST Record
);
VOID
SpySetRecordName (
PLOG_RECORD Record,
PUNICODE_STRING Name
);
VOID
SpyLogPreOperationData (
IN PFLT_CALLBACK_DATA Data,
IN PCFLT_RELATED_OBJECTS FltObjects,
IN PRECORD_LIST RecordList
);
VOID
SpyLogPostOperationData (
IN PFLT_CALLBACK_DATA Data,
IN PRECORD_LIST RecordList
);
VOID
SpyLog (
IN PRECORD_LIST RecordList
);
NTSTATUS
SpyGetLog (
OUT PUCHAR OutputBuffer,
IN ULONG OutputBufferLength,
OUT PULONG ReturnOutputBufferLength
);
VOID
SpyEmptyOutputBufferList (
VOID
);
#endif //__MSPYKERN_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -