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
|
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
PURPOSE.
Module Name:
regctrl.h
Environment:
User mode only
--*/
#pragma once
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <devioctl.h>
#include <tchar.h>
#include <strsafe.h>
#include "common.h"
//
// Utility macro
//
#define ARRAY_LENGTH(array) (sizeof (array) / sizeof (array[0]))
//
// Logging macros
//
#define InfoPrint(str, ...) \
printf(##str"\n", \
__VA_ARGS__)
#define ErrorPrint(str, ...) \
printf("ERROR: %u: "##str"\n", \
__LINE__, \
__VA_ARGS__)
//
// Global variables
//
//
// Handle to the driver
//
extern HANDLE g_Driver;
//
// Handle to the root test key
//
extern HKEY g_RootKey;
//
// Version number for the registry callback
//
extern ULONG g_MajorVersion;
extern ULONG g_MinorVersion;
//
// The user mode samples
//
VOID
PreNotificationBlockSample();
VOID
PreNotificationBypassSample();
VOID
PostNotificationOverrideSuccessSample();
VOID
PostNotificationOverrideErrorSample();
VOID
CaptureSample();
//
// Utility routines to load and unload the driver
//
BOOL
UtilLoadDriver(
_In_ LPTSTR szDriverNameNoExt,
_In_ LPTSTR szDriverNameWithExt,
_In_ LPTSTR szWin32DeviceName,
_Out_ HANDLE *pDriver
);
BOOL
UtilUnloadDriver(
_In_ HANDLE hDriver,
_In_opt_ SC_HANDLE hSCM,
_In_ LPTSTR szDriverNameNoExt
);
|