23#define SUBST_DRIVE_LETTER 'M'
24#define SUBST_DRIVE "M:"
25#define SUBST_DRIVE_NON_EXIST_DIR "M:\\deadbeef"
26#define SUBST_DRIVE_WITH_TRAILING_PATH_SEPERATOR "M:\\"
27#define SUBST_DRIVE_SEARCH "M:\\*"
28#define SUBST_DRIVE_LOWERCASE "m:"
29#define SUBST_DRIVE_LOWERCASE_SEARCH "m:\\*"
30#define SUBST_DRIVE2_LETTER 'N'
31#define SUBST_DRIVE2 "N:"
32#define SUBST_DRIVE2_WITH_TRAILING_PATH_SEPERATOR "N:\\"
33#define SUBST_DRIVE2_SEARCH "N:\\*"
42 UINT SystemDriveType, DriveType1, DriveType2;
43 DWORD dwMaskPrev, dwMaskCur;
48 ok(CharCount > 0,
"Failed to get windows directory\n");
57 ok(
Result,
"Failed to subst drive\n");
60 ok(
Result,
"Failed to subst drive\n");
63 ok(dwMaskCur != dwMaskPrev,
"Drive masks match when it shouldn't\n");
69 ok(DriveType1 == DriveType2,
"subst drive types don't match\n");
70 ok(DriveType1 == SystemDriveType,
"subst drive types don't match\n");
71 ok(DriveType2 == SystemDriveType,
"subst drive types don't match\n");
73 ok(
Result,
"Failed to remove subst drive using NULL Target name\n");
78 ok(
Result,
"Failed to remove subst drive using NULL Target name\n");
80 ok(!
Result,
"Subst drive is present even after remove attempt\n");
82 ok(!
Result,
"Subst drive is present even after remove attempt\n");
84 ok(dwMaskCur == dwMaskPrev,
"Drive masks don't match\n");
89 ok(
Result,
"Failed to subst drive using lowercase drive letter\n");
91 ok(DriveType1 == SystemDriveType,
"subst drive types don't match\n");
93 ok(dwMaskCur != dwMaskPrev,
"Drive masks match when it shouldn't\n");
99 ok(
Result,
"Failed to remove subst drive using lowercase drive letter\n");
101 ok(!
Result,
"Subst drive is present even after remove attempt\n");
103 ok(dwMaskCur == dwMaskPrev,
"Drive masks don't match\n");
108 ok(
Result,
"Failed to subst drive\n");
110 ok(DriveType1 == SystemDriveType,
"subst drive types don't match\n");
112 ok(dwMaskCur != dwMaskPrev,
"Drive masks match when it shouldn't\n");
118 ok(
Result,
"Failed to remove subst drive using NULL Target name\n");
120 ok(!
Result,
"Subst drive is present even after remove attempt\n");
122 ok(dwMaskCur == dwMaskPrev,
"Drive masks don't match\n");
127 ok(
Result,
"Failed to subst drive\n");
129 ok(
Result,
"Failed to subst drive\n");
131 ok(
Result,
"Failed to subst drive\n");
133 ok(DriveType1 != SystemDriveType,
"subst drive types match when it shouldn't\n");
136 ok(dwMaskCur != dwMaskPrev,
"Drive masks match when it shouldn't\n");
139 ok(
Result,
"Failed to remove subst drive\n");
141 ok(
Result,
"Failed to query subst drive\n");
142 if (
Result)
ok((
_stricmp(
Buffer,
"\\??\\C:\\temp3") == 0),
"Subst drive is not pointing to correct target\n");
144 ok(
Result,
"Failed to remove subst drive\n");
146 ok(
Result,
"Failed to query subst drive\n");
147 if (
Result)
ok((
_stricmp(
Buffer,
"\\??\\C:\\temp3") == 0),
"Subst drive is not pointing to correct target\n");
149 ok(
Result,
"Failed to remove subst drive\n");
151 ok(!
Result,
"Subst drive is present even after remove attempt\n");
153 ok(dwMaskCur == dwMaskPrev,
"Drive masks don't match\n");
158 ok(
Result,
"Failed to subst drive\n");
160 ok(
Result,
"Failed to subst drive\n");
162 ok(
Result,
"Failed to subst drive\n");
164 ok(DriveType1 != SystemDriveType,
"subst drive types match when it shouldn't\n");
167 ok(dwMaskCur != dwMaskPrev,
"Drive masks match when it shouldn't\n");
170 ok(
Result,
"Failed to remove subst drive\n");
172 ok(
Result,
"Failed to query subst drive\n");
173 if (
Result)
ok((
_stricmp(
Buffer,
"\\??\\C:\\temp2") == 0),
"Subst drive is not pointing to correct target\n");
175 ok(
Result,
"Failed to remove subst drive\n");
177 ok(
Result,
"Failed to query subst drive\n");
178 if (
Result)
ok((
_stricmp(
Buffer,
"\\??\\C:\\temp1") == 0),
"Subst drive is not pointing to correct target\n");
180 ok(
Result,
"Failed to remove subst drive\n");
182 ok(!
Result,
"Subst drive is present even after remove attempt\n");
184 ok(dwMaskCur == dwMaskPrev,
"Drive masks don't match\n");
189 ok(
Result,
"Failed to subst drive\n");
191 ok(
Result,
"Failed to subst drive\n");
193 ok(
Result,
"Failed to subst drive\n");
195 ok(
Result,
"Failed to subst drive\n");
197 ok(
Result,
"Failed to subst drive\n");
199 ok(DriveType1 != SystemDriveType,
"subst drive types match when it shouldn't\n");
202 ok(dwMaskCur != dwMaskPrev,
"Drive masks match when it shouldn't\n");
205 ok(
Result,
"Failed to remove subst drive\n");
207 ok(
Result,
"Failed to query subst drive\n");
208 if (
Result)
ok((
_stricmp(
Buffer,
"\\??\\C:\\temp5") == 0),
"Subst drive is not pointing to correct target\n");
210 ok(
Result,
"Failed to remove subst drive\n");
212 ok(
Result,
"Failed to query subst drive\n");
213 if (
Result)
ok((
_stricmp(
Buffer,
"\\??\\C:\\temp4") == 0),
"Subst drive is not pointing to correct target\n");
215 ok(
Result,
"Failed to remove subst drive\n");
217 ok(
Result,
"Failed to query subst drive\n");
218 if (
Result)
ok((
_stricmp(
Buffer,
"\\??\\C:\\temp4") == 0),
"Subst drive is not pointing to correct target\n");
220 ok(
Result,
"Failed to remove subst drive\n");
222 ok(
Result,
"Failed to query subst drive\n");
223 if (
Result)
ok((
_stricmp(
Buffer,
"\\??\\C:\\temp4") == 0),
"Subst drive is not pointing to correct target");
225 ok(
Result,
"Failed to remove subst drive\n");
227 ok(!
Result,
"Subst drive is present even after remove attempt\n");
229 ok(dwMaskCur == dwMaskPrev,
"Drive masks don't match\n");
235 ok(
Result,
"Failed to subst drive\n");
237 ok(DriveType1 == SystemDriveType,
"subst drive types don't match\n");
239 ok(dwMaskCur != dwMaskPrev,
"Drive masks match when it shouldn't\n");
245 ok(
Result,
"Failed to remove subst drive using NULL Target name\n");
247 ok(!
Result,
"Subst drive is present even after remove attempt\n");
249 ok(dwMaskCur == dwMaskPrev,
"Drive masks don't match\n");
255 ok(
Result,
"Failed to subst drive\n");
257 ok(DriveType1 != SystemDriveType,
"subst drive types match when they shouldn't\n");
259 ok(dwMaskCur != dwMaskPrev,
"Drive masks match when it shouldn't\n");
266 ok(
Result,
"Failed to remove subst drive using NULL Target name\n");
268 ok(!
Result,
"Subst drive is present even after remove attempt\n");
270 ok(dwMaskCur == dwMaskPrev,
"Drive masks don't match\n");
275 ok(!
Result,
"Subst drive using trailing path seperator, this should not happen\n");
277 ok(DriveType1 != SystemDriveType,
"subst drive types match when it shouldn't\n");
279 ok(dwMaskCur == dwMaskPrev,
"Drive masks don't match\n");
285 ok(!
Result,
"Removing Subst drive using trailing path seperator passed when it should fail\n");
287 ok(!
Result,
"Subst drive is present when it should not be created in the first place\n");
289 ok(dwMaskCur == dwMaskPrev,
"Drive masks don't match\n");
294 ok(
Result,
"Failed to subst drive using non-DOS drive name\n");
296 ok(dwMaskCur == dwMaskPrev,
"Drive masks don't match\n");
298 ok(
Result,
"Failed to subst drive using non-DOS drive name\n");
300 ok(!
Result,
"Subst drive is present even after remove attempt\n");
302 ok(dwMaskCur == dwMaskPrev,
"Drive masks don't match\n");
307 ok(
Result,
"Failed to subst drive\n");
309 ok(DriveType1 != SystemDriveType,
"subst drive types match when it shouldn't\n");
312 ok(dwMaskCur != dwMaskPrev,
"Drive masks match when it shouldn't\n");
318 ok(
Result,
"Failed to remove subst drive using lowercase drive letter\n");
320 ok(!
Result,
"Subst drive is present even after remove attempt\n");
322 ok(dwMaskCur == dwMaskPrev,
"Drive masks don't match\n");
327 ok(
Result,
"Failed to subst drive\n");
329 ok(DriveType1 != SystemDriveType,
"subst drive types match when it shouldn't\n");
332 ok(dwMaskCur != dwMaskPrev,
"Drive masks match when it shouldn't\n");
338 ok(
Result,
"Failed to remove subst drive using lowercase drive letter\n");
340 ok(!
Result,
"Subst drive is present even after remove attempt\n");
342 ok(dwMaskCur == dwMaskPrev,
"Drive masks don't match\n");
353 ok(CharCount > 0,
"Failed to get windows directory\n");
356 ok(
Result,
"Failed to subst drive\n");
358 ok(!
Result,
"Should fail as the buffer passed is supposed to be small\n");
361 ok(
Result,
"failed to get target path\n");
362 ok(
_strnicmp(
Buffer,
"\\??\\", 4) == 0,
"The target returned does have correct prefix set\n");
365 ok(
Result,
"Failed to remove subst drive using lowercase drive letter\n");
370 ok(!
Result,
"Should fail as the buffer passed is supposed to be small\n");
#define ERROR_INSUFFICIENT_BUFFER
#define INVALID_HANDLE_VALUE
#define _strnicmp(_String1, _String2, _MaxCount)
#define stricmp(_String1, _String2)
#define ERROR_INVALID_NAME
DWORD WINAPI QueryDosDeviceA(LPCSTR lpDeviceName, LPSTR lpTargetPath, DWORD ucchMax)
BOOL WINAPI DefineDosDeviceA(DWORD dwFlags, LPCSTR lpDeviceName, LPCSTR lpTargetPath)
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
HANDLE WINAPI FindFirstFileA(IN LPCSTR lpFileName, OUT LPWIN32_FIND_DATAA lpFindFileData)
BOOL WINAPI FindClose(HANDLE hFindFile)
UINT WINAPI GetSystemWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
#define ERROR_FILE_NOT_FOUND
#define SUBST_DRIVE2_WITH_TRAILING_PATH_SEPERATOR
static void test_QueryDosDeviceA(void)
#define SUBST_DRIVE_LETTER
static void test_DefineDosDeviceA(void)
#define SUBST_DRIVE2_SEARCH
#define SUBST_DRIVE2_LETTER
#define SUBST_DRIVE_LOWERCASE
#define SUBST_DRIVE_WITH_TRAILING_PATH_SEPERATOR
#define SUBST_DRIVE_NON_EXIST_DIR
#define SUBST_DRIVE_SEARCH
DWORD WINAPI GetLastError(void)
#define DDD_EXACT_MATCH_ON_REMOVE
#define DDD_RAW_TARGET_PATH
DWORD WINAPI GetLogicalDrives(void)
#define DDD_REMOVE_DEFINITION
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO