ReactOS 0.4.15-dev-5669-g09dde2c
main.c File Reference
#include "DriverTester.h"
Include dependency graph for main.c:

Go to the source code of this file.

Functions

static BOOL Initialize (LPCWSTR lpDriverPath)
 
static BOOL Uninitialize (LPCWSTR lpDriverPath)
 
static BOOL UsermodeMethod (LPCWSTR lpDriverPath)
 
static BOOL UndocumentedMethod (LPCWSTR lpDriverPath)
 
static BOOL SneakyUndocumentedMethods (LPCWSTR lpDriverPath)
 
int __cdecl wmain (int argc, wchar_t *argv[])
 

Function Documentation

◆ Initialize()

static BOOL Initialize ( LPCWSTR  lpDriverPath)
static

Definition at line 4 of file main.c.

5{
6 if (!RegisterDriver(DRIVER_NAME, lpDriverPath))
7 {
8 wprintf(L"[%lu] Failed to install %s\n", GetLastError(), DRIVER_NAME);
9 return FALSE;
10 }
11
12 return TRUE;
13}
BOOL RegisterDriver(LPCWSTR lpDriverName, LPCWSTR lpPathName)
Definition: umode.c:5
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define DRIVER_NAME
Definition: ext2fs.h:136
#define L(x)
Definition: ntvdm.h:50
#define wprintf(...)
Definition: whoami.c:18
DWORD WINAPI GetLastError(void)
Definition: except.c:1040

◆ SneakyUndocumentedMethods()

static BOOL SneakyUndocumentedMethods ( LPCWSTR  lpDriverPath)
static

Definition at line 85 of file main.c.

86{
87 WCHAR szDevice[MAX_PATH];
88
89 if (ConvertPath(lpDriverPath, szDevice))
90 {
91 wprintf(L"\nStarting %s.sys via NtSetSystemInformation with SystemLoadGdiDriverInformation\n", DRIVER_NAME);
93 {
94 wprintf(L"\tStarted\n");
95
97 }
98
99 wprintf(L"\nStarting %s.sys via NtSetSystemInformation with SystemExtendServiceTableInformation\n", DRIVER_NAME);
101 {
102 wprintf(L"\tStarted\n");
103
105 }
106
107 return TRUE;
108 }
109
110 return FALSE;
111}
BOOL NtStopDriver(LPCWSTR lpService)
Definition: undoc.c:164
BOOL ConvertPath(LPCWSTR lpPath, LPWSTR lpDevice)
Definition: undoc.c:56
BOOL LoadVia_SystemExtendServiceTableInformation(LPWSTR lpDriverPath)
Definition: undoc.c:240
BOOL LoadVia_SystemLoadGdiDriverInformation(LPWSTR lpDriverPath)
Definition: undoc.c:199
#define MAX_PATH
Definition: compat.h:34
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by wmain().

◆ UndocumentedMethod()

static BOOL UndocumentedMethod ( LPCWSTR  lpDriverPath)
static

Definition at line 56 of file main.c.

57{
58 wprintf(L"\nStarting %s.sys via native API\n", DRIVER_NAME);
59
61 {
62 wprintf(L"[%lu] Failed to start %s\n", GetLastError(), DRIVER_NAME);
64 return FALSE;
65 }
66
67 wprintf(L"\tStarted\n");
68
69 wprintf(L"Stopping %s.sys via native API\n", DRIVER_NAME);
70
72 {
73 wprintf(L"[%lu] Failed to stop %s\n", GetLastError(), DRIVER_NAME);
75 return FALSE;
76 }
77
78 wprintf(L"\tStopped\n");
79
80 return TRUE;
81}
BOOL NtStartDriver(LPCWSTR lpService)
Definition: undoc.c:133
BOOL UnregisterDriver(LPCWSTR lpDriverName)
Definition: umode.c:135

Referenced by wmain().

◆ Uninitialize()

static BOOL Uninitialize ( LPCWSTR  lpDriverPath)
static

Definition at line 16 of file main.c.

17{
19 {
20 wprintf(L"[%lu] Failed to unregister %s\n", GetLastError(), DRIVER_NAME);
21 return FALSE;
22 }
23
24 return TRUE;
25}

Referenced by DECLARE_INTERFACE_(), wmain(), and CIconWatcher::~CIconWatcher().

◆ UsermodeMethod()

static BOOL UsermodeMethod ( LPCWSTR  lpDriverPath)
static

Definition at line 28 of file main.c.

29{
30 wprintf(L"\nStarting %s.sys via the SCM\n", DRIVER_NAME);
31
33 {
34 wprintf(L"[%lu] Failed to start %s\n", GetLastError(), DRIVER_NAME);
36 return FALSE;
37 }
38
39 wprintf(L"\tStarted\n");
40
41 wprintf(L"Stopping %s.sys via the SCM\n", DRIVER_NAME);
42
44 {
45 wprintf(L"[%lu] Failed to stop %s\n", GetLastError(), DRIVER_NAME);
47 return FALSE;
48 }
49
50 wprintf(L"\tStopped\n");
51
52 return TRUE;
53}
BOOLEAN StartDriver(VOID)
Definition: vcdcli.c:85
static VOID StopDriver(VOID)

Referenced by wmain().

◆ wmain()

int __cdecl wmain ( int  argc,
wchar_t argv[] 
)

Main entry point

Definition at line 114 of file main.c.

115{
117
118 if (argc != 2)
119 {
120 wprintf(L"Usage: DriverTester.exe <path>");
121 return -1;
122 }
123
124 if (!SearchPathW(NULL,
125 argv[1],
126 L".sys",
127 MAX_PATH,
128 buf,
129 NULL))
130 {
131 wprintf(L"%s does not exist", argv[1]);
132 return -1;
133 }
134
135 if (Initialize(argv[1]))
136 {
137 //
138 // Load using conventional SCM methods
139 //
141
142 //
143 // Load using undocumented NtLoad/UnloadDriver
144 //
146
147 //
148 // Load using hidden unknown methods
149 //
151
152 Uninitialize(argv[1]);
153 }
154
155 return 0;
156}
static int argc
Definition: ServiceArgs.c:12
#define NULL
Definition: types.h:112
DWORD WINAPI SearchPathW(IN LPCWSTR lpPath OPTIONAL, IN LPCWSTR lpFileName, IN LPCWSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart OPTIONAL)
Definition: path.c:1298
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static BOOL SneakyUndocumentedMethods(LPCWSTR lpDriverPath)
Definition: main.c:85
static BOOL Uninitialize(LPCWSTR lpDriverPath)
Definition: main.c:16
static BOOL UsermodeMethod(LPCWSTR lpDriverPath)
Definition: main.c:28
static BOOL UndocumentedMethod(LPCWSTR lpDriverPath)
Definition: main.c:56
#define argv
Definition: mplay32.c:18
static void Initialize()
Definition: xlate.c:212