forked from aleksk/LazyCopy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Globals.h
146 lines (106 loc) · 4.46 KB
/
Globals.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/*++
The MIT License (MIT)
Copyright (c) 2015 Aleksey Kabanov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Module Name:
Globals.h
Abstract:
Contains global structures, type definitions, constants and
variables that can be shared across different driver modules.
Environment:
Kernel mode.
--*/
#pragma once
#ifndef __LAZY_COPY_GLOBALS_H__
#define __LAZY_COPY_GLOBALS_H__
//------------------------------------------------------------------------
// Disabled warnings.
//------------------------------------------------------------------------
#pragma prefast(disable:__WARNING_ENCODE_MEMBER_FUNCTION_POINTER, "Not valid for kernel mode drivers")
//------------------------------------------------------------------------
// Includes.
//------------------------------------------------------------------------
#pragma warning(push)
#pragma warning(disable:4995) // <function>: name was marked as #pragma deprecated.
#include <fltKernel.h>
#include <dontuse.h>
#include <suppress.h>
#include <Ntstrsafe.h>
#pragma warning(pop) // Enable C4995.
// Globally disable these compiler warnings.
#pragma warning(disable:6102) // Using value from failed function call.
#pragma warning(disable:6103) // Returning value from failed function call.
#include "Macro.h"
//------------------------------------------------------------------------
// Defines.
//------------------------------------------------------------------------
// Win8 supports NPFS/MSFS.
// Win7 supports new ECPs.
// Vista supports transactions, older ECPs.
#define PLATFORM_WIN10 (NTDDI_VERSIOn >= NTDDI_WIN10)
#define PLATFORM_WIN8 (NTDDI_VERSION >= NTDDI_WIN8)
#define PLATFORM_WIN7 (NTDDI_VERSION >= NTDDI_WIN7)
#define PLATFORM_VISTA (NTDDI_VERSION >= NTDDI_VISTA)
#define PLATFORM_NOT_W2K (OSVER(NTDDI_VERSION) > NTDDI_WIN2K)
// Current driver version.
#define LC_MAJOR_VERSION 1
#define LC_MINOR_VERSION 1
//
// Pool tags for memory allocation.
//
#define LC_BUFFER_PAGED_POOL_TAG ('lcbP')
#define LC_BUFFER_NON_PAGED_POOL_TAG ('lcbN')
#define LC_STRING_PAGED_POOL_TAG ('lcsP')
#define LC_STRING_NON_PAGED_POOL_TAG ('lcsN')
#define LC_ERESOURCE_PAGED_POOL_TAG ('lceP')
#define LC_ERESOURCE_NON_PAGED_POOL_TAG ('lceN')
#define LC_CONTEXT_PAGED_POOL_TAG ('lccP')
#define LC_CONTEXT_NON_PAGED_POOL_TAG ('lccN')
#define LC_COMMUNICATION_PAGED_POOL_TAG ('lcmP')
#define LC_COMMUNICATION_NON_PAGED_POOL_TAG ('lcmN')
//
// Reparse point data.
//
// TODO: Before releasing your driver, make sure to contact Microsoft to register this value.
#define LC_REPARSE_TAG (0x00000340)
extern GUID LC_REPARSE_GUID;
//
// File attributes.
//
#define LC_FILE_ATTRIBUTES (FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_REPARSE_POINT)
//
// Other.
//
// Seed to be used for randomization.
extern ULONG LC_RANDOM_SEED;
//------------------------------------------------------------------------
// Global structures and variables.
//------------------------------------------------------------------------
//
// Global driver data.
//
typedef struct _DRIVER_GLOBAL_DATA
{
// The object that identifies this driver.
PDRIVER_OBJECT DriverObject;
// The filter that results from a call to the 'FltRegisterFilter' function.
PFLT_FILTER Filter;
// Global driver lock.
PERESOURCE Lock;
} DRIVER_GLOBAL_DATA, *PDRIVER_GLOBAL_DATA;
extern DRIVER_GLOBAL_DATA Globals;
#endif // __LAZY_COPY_GLOBALS_H__