ReactOS  0.4.14-dev-608-gd495a4f
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 }
#define TRUE
Definition: types.h:120
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define wprintf(...)
Definition: whoami.c:18
static const WCHAR L[]
Definition: oid.c:1250
#define DRIVER_NAME
Definition: ext2fs.h:136
BOOL RegisterDriver(LPCWSTR lpDriverName, LPCWSTR lpPathName)
Definition: umode.c:5

Referenced by Win32kProcessCallback(), and wmain().

◆ 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 }
#define TRUE
Definition: types.h:120
#define wprintf(...)
Definition: whoami.c:18
BOOL NtStopDriver(LPCWSTR lpService)
Definition: undoc.c:164
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
static const WCHAR L[]
Definition: oid.c:1250
#define DRIVER_NAME
Definition: ext2fs.h:136
BOOL LoadVia_SystemLoadGdiDriverInformation(LPWSTR lpDriverPath)
Definition: undoc.c:199
BOOL LoadVia_SystemExtendServiceTableInformation(LPWSTR lpDriverPath)
Definition: undoc.c:240
BOOL ConvertPath(LPCWSTR lpPath, LPWSTR lpDevice)
Definition: undoc.c:56

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 }
#define TRUE
Definition: types.h:120
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define wprintf(...)
Definition: whoami.c:18
BOOL NtStartDriver(LPCWSTR lpService)
Definition: undoc.c:133
BOOL NtStopDriver(LPCWSTR lpService)
Definition: undoc.c:164
static const WCHAR L[]
Definition: oid.c:1250
#define DRIVER_NAME
Definition: ext2fs.h:136
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 }
#define TRUE
Definition: types.h:120
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define wprintf(...)
Definition: whoami.c:18
static const WCHAR L[]
Definition: oid.c:1250
#define DRIVER_NAME
Definition: ext2fs.h:136
BOOL UnregisterDriver(LPCWSTR lpDriverName)
Definition: umode.c:135

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 
43  if (!StopDriver(DRIVER_NAME))
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 }
#define TRUE
Definition: types.h:120
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static VOID StopDriver(VOID)
#define wprintf(...)
Definition: whoami.c:18
static const WCHAR L[]
Definition: oid.c:1250
#define DRIVER_NAME
Definition: ext2fs.h:136
BOOLEAN StartDriver(VOID)
Definition: vcdcli.c:85
BOOL UnregisterDriver(LPCWSTR lpDriverName)
Definition: umode.c:135

Referenced by wmain().

◆ wmain()

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

Main entry point

Definition at line 114 of file main.c.

115 {
116  WCHAR buf[MAX_PATH];
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  //
140  UsermodeMethod(argv[1]);
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
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define wprintf(...)
Definition: whoami.c:18
#define argv
Definition: mplay32.c:18
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
static BOOL Uninitialize(LPCWSTR lpDriverPath)
Definition: main.c:16
static const WCHAR L[]
Definition: oid.c:1250
static BOOL Initialize(LPCWSTR lpDriverPath)
Definition: main.c:4
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:1297
static BOOL SneakyUndocumentedMethods(LPCWSTR lpDriverPath)
Definition: main.c:85
static BOOL UsermodeMethod(LPCWSTR lpDriverPath)
Definition: main.c:28
static BOOL UndocumentedMethod(LPCWSTR lpDriverPath)
Definition: main.c:56

Referenced by main().