2 * Unit test suite for object manager functions
4 * Copyright 2005 Robert Shearman
5 * Copyright 2005 Vitaliy Margolen
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "ntdll_test.h"
28 static HANDLE (WINAPI *pCreateWaitableTimerA)(SECURITY_ATTRIBUTES*, BOOL, LPCSTR);
29 static NTSTATUS (WINAPI *pRtlCreateUnicodeStringFromAsciiz)(PUNICODE_STRING, LPCSTR);
30 static VOID (WINAPI *pRtlInitUnicodeString)( PUNICODE_STRING, LPCWSTR );
31 static VOID (WINAPI *pRtlFreeUnicodeString)(PUNICODE_STRING);
32 static NTSTATUS (WINAPI *pNtCreateEvent) ( PHANDLE, ACCESS_MASK, const POBJECT_ATTRIBUTES, BOOLEAN, BOOLEAN);
33 static NTSTATUS (WINAPI *pNtCreateMutant)( PHANDLE, ACCESS_MASK, const POBJECT_ATTRIBUTES, BOOLEAN );
34 static NTSTATUS (WINAPI *pNtOpenMutant) ( PHANDLE, ACCESS_MASK, const POBJECT_ATTRIBUTES );
35 static NTSTATUS (WINAPI *pNtCreateSemaphore)( PHANDLE, ACCESS_MASK,const POBJECT_ATTRIBUTES,LONG,LONG );
36 static NTSTATUS (WINAPI *pNtCreateTimer) ( PHANDLE, ACCESS_MASK, const POBJECT_ATTRIBUTES, TIMER_TYPE );
37 static NTSTATUS (WINAPI *pNtCreateSection)( PHANDLE, ACCESS_MASK, const POBJECT_ATTRIBUTES, const PLARGE_INTEGER,
38 ULONG, ULONG, HANDLE );
39 static NTSTATUS (WINAPI *pNtOpenFile) ( PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, PIO_STATUS_BLOCK, ULONG, ULONG );
40 static NTSTATUS (WINAPI *pNtClose) ( HANDLE );
41 static NTSTATUS (WINAPI *pNtCreateNamedPipeFile)( PHANDLE, ULONG, POBJECT_ATTRIBUTES, PIO_STATUS_BLOCK,
42 ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, PLARGE_INTEGER );
43 static NTSTATUS (WINAPI *pNtOpenDirectoryObject)(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
44 static NTSTATUS (WINAPI *pNtCreateDirectoryObject)(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
45 static NTSTATUS (WINAPI *pNtOpenSymbolicLinkObject)(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
46 static NTSTATUS (WINAPI *pNtCreateSymbolicLinkObject)(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, PUNICODE_STRING);
47 static NTSTATUS (WINAPI *pNtQuerySymbolicLinkObject)(HANDLE,PUNICODE_STRING,PULONG);
48 static NTSTATUS (WINAPI *pNtQueryObject)(HANDLE,OBJECT_INFORMATION_CLASS,PVOID,ULONG,PULONG);
49 static NTSTATUS (WINAPI *pNtReleaseSemaphore)(HANDLE handle, ULONG count, PULONG previous);
52 static void test_case_sensitive (void)
54 static const WCHAR buffer1[] = {'\\','B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s','\\','t','e','s','t',0};
55 static const WCHAR buffer2[] = {'\\','B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s','\\','T','e','s','t',0};
56 static const WCHAR buffer3[] = {'\\','B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s','\\','T','E','s','t',0};
57 static const WCHAR buffer4[] = {'\\','B','A','S','E','N','a','m','e','d','O','b','j','e','c','t','s','\\','t','e','s','t',0};
59 OBJECT_ATTRIBUTES attr;
61 HANDLE Event, Mutant, h;
63 pRtlInitUnicodeString(&str, buffer1);
64 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
65 status = pNtCreateMutant(&Mutant, GENERIC_ALL, &attr, FALSE);
66 ok(status == STATUS_SUCCESS, "Failed to create Mutant(%08x)\n", status);
68 status = pNtCreateEvent(&Event, GENERIC_ALL, &attr, FALSE, FALSE);
69 ok(status == STATUS_OBJECT_NAME_COLLISION || status == STATUS_OBJECT_TYPE_MISMATCH,
70 "NtCreateEvent should have failed with STATUS_OBJECT_NAME_COLLISION or STATUS_OBJECT_TYPE_MISMATCH got (%08x)\n", status);
72 pRtlInitUnicodeString(&str, buffer2);
73 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
74 status = pNtCreateEvent(&Event, GENERIC_ALL, &attr, FALSE, FALSE);
75 ok(status == STATUS_SUCCESS, "Failed to create Event(%08x)\n", status);
77 pRtlInitUnicodeString(&str, buffer3);
78 InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, 0, NULL);
79 status = pNtOpenMutant(&h, GENERIC_ALL, &attr);
80 ok(status == STATUS_OBJECT_TYPE_MISMATCH,
81 "NtOpenMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08x)\n", status);
85 pRtlInitUnicodeString(&str, buffer4);
86 InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, 0, NULL);
87 status = pNtCreateMutant(&Mutant, GENERIC_ALL, &attr, FALSE);
88 ok(status == STATUS_OBJECT_NAME_COLLISION || status == STATUS_OBJECT_TYPE_MISMATCH,
89 "NtCreateMutant should have failed with STATUS_OBJECT_NAME_COLLISION or STATUS_OBJECT_TYPE_MISMATCH got (%08x)\n", status);
91 status = pNtCreateEvent(&h, GENERIC_ALL, &attr, FALSE, FALSE);
92 ok(status == STATUS_OBJECT_NAME_COLLISION,
93 "NtCreateEvent should have failed with STATUS_OBJECT_NAME_COLLISION got(%08x)\n", status);
96 status = pNtCreateMutant(&Mutant, GENERIC_ALL, &attr, FALSE);
97 ok(status == STATUS_OBJECT_PATH_NOT_FOUND,
98 "NtCreateMutant should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08x)\n", status);
103 static void test_namespace_pipe(void)
105 static const WCHAR buffer1[] = {'\\','?','?','\\','P','I','P','E','\\','t','e','s','t','\\','p','i','p','e',0};
106 static const WCHAR buffer2[] = {'\\','?','?','\\','P','I','P','E','\\','T','E','S','T','\\','P','I','P','E',0};
107 static const WCHAR buffer3[] = {'\\','?','?','\\','p','i','p','e','\\','t','e','s','t','\\','p','i','p','e',0};
108 static const WCHAR buffer4[] = {'\\','?','?','\\','p','i','p','e','\\','t','e','s','t',0};
109 OBJECT_ATTRIBUTES attr;
111 IO_STATUS_BLOCK iosb;
113 LARGE_INTEGER timeout;
116 timeout.QuadPart = -10000;
118 pRtlInitUnicodeString(&str, buffer1);
119 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
120 status = pNtCreateNamedPipeFile(&pipe, GENERIC_READ|GENERIC_WRITE, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE,
121 FILE_CREATE, FILE_PIPE_FULL_DUPLEX, FALSE, FALSE, FALSE, 1, 256, 256, &timeout);
122 ok(status == STATUS_SUCCESS, "Failed to create NamedPipe(%08x)\n", status);
124 status = pNtCreateNamedPipeFile(&pipe, GENERIC_READ|GENERIC_WRITE, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE,
125 FILE_CREATE, FILE_PIPE_FULL_DUPLEX, FALSE, FALSE, FALSE, 1, 256, 256, &timeout);
126 ok(status == STATUS_INSTANCE_NOT_AVAILABLE,
127 "NtCreateNamedPipeFile should have failed with STATUS_INSTANCE_NOT_AVAILABLE got(%08x)\n", status);
129 pRtlInitUnicodeString(&str, buffer2);
130 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
131 status = pNtCreateNamedPipeFile(&pipe, GENERIC_READ|GENERIC_WRITE, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE,
132 FILE_CREATE, FILE_PIPE_FULL_DUPLEX, FALSE, FALSE, FALSE, 1, 256, 256, &timeout);
133 ok(status == STATUS_INSTANCE_NOT_AVAILABLE,
134 "NtCreateNamedPipeFile should have failed with STATUS_INSTANCE_NOT_AVAILABLE got(%08x)\n", status);
136 h = CreateFileA("\\\\.\\pipe\\test\\pipe", GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
137 OPEN_EXISTING, 0, 0 );
138 ok(h != INVALID_HANDLE_VALUE, "Failed to open NamedPipe (%u)\n", GetLastError());
141 pRtlInitUnicodeString(&str, buffer3);
142 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
143 status = pNtOpenFile(&h, GENERIC_READ, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN);
144 ok(status == STATUS_OBJECT_PATH_NOT_FOUND ||
145 status == STATUS_PIPE_NOT_AVAILABLE ||
146 status == STATUS_OBJECT_NAME_INVALID || /* vista */
147 status == STATUS_OBJECT_NAME_NOT_FOUND, /* win8 */
148 "NtOpenFile should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08x)\n", status);
150 pRtlInitUnicodeString(&str, buffer4);
151 InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, 0, NULL);
152 status = pNtOpenFile(&h, GENERIC_READ, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN);
153 ok(status == STATUS_OBJECT_NAME_NOT_FOUND ||
154 status == STATUS_OBJECT_NAME_INVALID, /* vista */
155 "NtOpenFile should have failed with STATUS_OBJECT_NAME_NOT_FOUND got(%08x)\n", status);
160 #define DIRECTORY_QUERY (0x0001)
161 #define SYMBOLIC_LINK_QUERY 0x0001
163 #define DIR_TEST_CREATE_FAILURE(h,e) \
164 status = pNtCreateDirectoryObject(h, DIRECTORY_QUERY, &attr);\
165 ok(status == e,"NtCreateDirectoryObject should have failed with %s got(%08x)\n", #e, status);
166 #define DIR_TEST_OPEN_FAILURE(h,e) \
167 status = pNtOpenDirectoryObject(h, DIRECTORY_QUERY, &attr);\
168 ok(status == e,"NtOpenDirectoryObject should have failed with %s got(%08x)\n", #e, status);
169 #define DIR_TEST_CREATE_OPEN_FAILURE(h,n,e) \
170 pRtlCreateUnicodeStringFromAsciiz(&str, n);\
171 DIR_TEST_CREATE_FAILURE(h,e) DIR_TEST_OPEN_FAILURE(h,e)\
172 pRtlFreeUnicodeString(&str);
174 #define DIR_TEST_CREATE_SUCCESS(h) \
175 status = pNtCreateDirectoryObject(h, DIRECTORY_QUERY, &attr); \
176 ok(status == STATUS_SUCCESS, "Failed to create Directory(%08x)\n", status);
177 #define DIR_TEST_OPEN_SUCCESS(h) \
178 status = pNtOpenDirectoryObject(h, DIRECTORY_QUERY, &attr); \
179 ok(status == STATUS_SUCCESS, "Failed to open Directory(%08x)\n", status);
180 #define DIR_TEST_CREATE_OPEN_SUCCESS(h,n) \
181 pRtlCreateUnicodeStringFromAsciiz(&str, n);\
182 DIR_TEST_CREATE_SUCCESS(&h) pNtClose(h); DIR_TEST_OPEN_SUCCESS(&h) pNtClose(h); \
183 pRtlFreeUnicodeString(&str);
185 static BOOL is_correct_dir( HANDLE dir, const char *name )
189 OBJECT_ATTRIBUTES attr;
192 pRtlCreateUnicodeStringFromAsciiz(&str, name);
193 InitializeObjectAttributes(&attr, &str, OBJ_OPENIF, dir, NULL);
194 status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
195 pRtlFreeUnicodeString(&str);
196 if (h) pNtClose( h );
197 return (status == STATUS_OBJECT_NAME_EXISTS);
200 /* return a handle to the BaseNamedObjects dir where kernel32 objects get created */
201 static HANDLE get_base_dir(void)
203 static const char objname[] = "om.c_get_base_dir_obj";
206 OBJECT_ATTRIBUTES attr;
210 h = CreateMutexA(NULL, FALSE, objname);
211 ok(h != 0, "CreateMutexA failed got ret=%p (%d)\n", h, GetLastError());
212 InitializeObjectAttributes(&attr, &str, OBJ_OPENIF, 0, NULL);
214 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Local");
215 status = pNtOpenDirectoryObject(&dir, DIRECTORY_QUERY, &attr);
216 pRtlFreeUnicodeString(&str);
217 if (!status && is_correct_dir( dir, objname )) goto done;
218 if (!status) pNtClose( dir );
220 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects");
221 status = pNtOpenDirectoryObject(&dir, DIRECTORY_QUERY, &attr);
222 pRtlFreeUnicodeString(&str);
223 if (!status && is_correct_dir( dir, objname )) goto done;
224 if (!status) pNtClose( dir );
226 for (i = 0; i < 20; i++)
229 sprintf( name, "\\BaseNamedObjects\\Session\\%u", i );
230 pRtlCreateUnicodeStringFromAsciiz(&str, name );
231 status = pNtOpenDirectoryObject(&dir, DIRECTORY_QUERY, &attr);
232 pRtlFreeUnicodeString(&str);
233 if (!status && is_correct_dir( dir, objname )) goto done;
234 if (!status) pNtClose( dir );
243 static void test_name_collisions(void)
247 OBJECT_ATTRIBUTES attr;
248 HANDLE dir, h, h1, h2;
252 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
253 pRtlCreateUnicodeStringFromAsciiz(&str, "\\");
254 DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_NAME_COLLISION)
255 InitializeObjectAttributes(&attr, &str, OBJ_OPENIF, 0, NULL);
257 DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_NAME_EXISTS)
259 status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
260 ok(status == STATUS_OBJECT_TYPE_MISMATCH,
261 "NtCreateMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08x)\n", status);
262 pRtlFreeUnicodeString(&str);
264 pRtlCreateUnicodeStringFromAsciiz(&str, "\\??\\PIPE\\om.c-mutant");
265 status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
266 ok(status == STATUS_OBJECT_TYPE_MISMATCH || status == STATUS_OBJECT_PATH_NOT_FOUND,
267 "NtCreateMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08x)\n", status);
268 pRtlFreeUnicodeString(&str);
270 if (!(dir = get_base_dir()))
272 win_skip( "couldn't find the BaseNamedObjects dir\n" );
275 pRtlCreateUnicodeStringFromAsciiz(&str, "om.c-test");
276 InitializeObjectAttributes(&attr, &str, OBJ_OPENIF, dir, NULL);
277 h = CreateMutexA(NULL, FALSE, "om.c-test");
278 ok(h != 0, "CreateMutexA failed got ret=%p (%d)\n", h, GetLastError());
279 status = pNtCreateMutant(&h1, GENERIC_ALL, &attr, FALSE);
280 ok(status == STATUS_OBJECT_NAME_EXISTS && h1 != NULL,
281 "NtCreateMutant should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)\n", status);
282 h2 = CreateMutexA(NULL, FALSE, "om.c-test");
283 winerr = GetLastError();
284 ok(h2 != 0 && winerr == ERROR_ALREADY_EXISTS,
285 "CreateMutexA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)\n", h2, winerr);
290 h = CreateEventA(NULL, FALSE, FALSE, "om.c-test");
291 ok(h != 0, "CreateEventA failed got ret=%p (%d)\n", h, GetLastError());
292 status = pNtCreateEvent(&h1, GENERIC_ALL, &attr, FALSE, FALSE);
293 ok(status == STATUS_OBJECT_NAME_EXISTS && h1 != NULL,
294 "NtCreateEvent should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)\n", status);
295 h2 = CreateEventA(NULL, FALSE, FALSE, "om.c-test");
296 winerr = GetLastError();
297 ok(h2 != 0 && winerr == ERROR_ALREADY_EXISTS,
298 "CreateEventA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)\n", h2, winerr);
303 h = CreateSemaphoreA(NULL, 1, 2, "om.c-test");
304 ok(h != 0, "CreateSemaphoreA failed got ret=%p (%d)\n", h, GetLastError());
305 status = pNtCreateSemaphore(&h1, GENERIC_ALL, &attr, 1, 2);
306 ok(status == STATUS_OBJECT_NAME_EXISTS && h1 != NULL,
307 "NtCreateSemaphore should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)\n", status);
308 h2 = CreateSemaphoreA(NULL, 1, 2, "om.c-test");
309 winerr = GetLastError();
310 ok(h2 != 0 && winerr == ERROR_ALREADY_EXISTS,
311 "CreateSemaphoreA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)\n", h2, winerr);
316 h = pCreateWaitableTimerA(NULL, TRUE, "om.c-test");
317 ok(h != 0, "CreateWaitableTimerA failed got ret=%p (%d)\n", h, GetLastError());
318 status = pNtCreateTimer(&h1, GENERIC_ALL, &attr, NotificationTimer);
319 ok(status == STATUS_OBJECT_NAME_EXISTS && h1 != NULL,
320 "NtCreateTimer should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)\n", status);
321 h2 = pCreateWaitableTimerA(NULL, TRUE, "om.c-test");
322 winerr = GetLastError();
323 ok(h2 != 0 && winerr == ERROR_ALREADY_EXISTS,
324 "CreateWaitableTimerA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)\n", h2, winerr);
329 h = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 256, "om.c-test");
330 ok(h != 0, "CreateFileMappingA failed got ret=%p (%d)\n", h, GetLastError());
331 size.u.LowPart = 256;
333 status = pNtCreateSection(&h1, SECTION_MAP_WRITE, &attr, &size, PAGE_READWRITE, SEC_COMMIT, 0);
334 ok(status == STATUS_OBJECT_NAME_EXISTS && h1 != NULL,
335 "NtCreateSection should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)\n", status);
336 h2 = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 256, "om.c-test");
337 winerr = GetLastError();
338 ok(h2 != 0 && winerr == ERROR_ALREADY_EXISTS,
339 "CreateFileMappingA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)\n", h2, winerr);
344 pRtlFreeUnicodeString(&str);
348 static void test_directory(void)
352 OBJECT_ATTRIBUTES attr;
356 /* No name and/or no attributes */
357 status = pNtCreateDirectoryObject(NULL, DIRECTORY_QUERY, &attr);
358 ok(status == STATUS_ACCESS_VIOLATION || status == STATUS_INVALID_PARAMETER,
359 "NtCreateDirectoryObject should have failed with STATUS_ACCESS_VIOLATION got(%08x)\n", status);
360 status = pNtOpenDirectoryObject(NULL, DIRECTORY_QUERY, &attr);
361 ok(status == STATUS_ACCESS_VIOLATION || status == STATUS_INVALID_PARAMETER,
362 "NtOpenDirectoryObject should have failed with STATUS_ACCESS_VIOLATION got(%08x)\n", status);
364 status = pNtCreateDirectoryObject(&h, DIRECTORY_QUERY, NULL);
365 ok(status == STATUS_SUCCESS, "Failed to create Directory without attributes(%08x)\n", status);
367 status = pNtOpenDirectoryObject(&h, DIRECTORY_QUERY, NULL);
368 ok(status == STATUS_INVALID_PARAMETER,
369 "NtOpenDirectoryObject should have failed with STATUS_INVALID_PARAMETER got(%08x)\n", status);
371 InitializeObjectAttributes(&attr, NULL, 0, 0, NULL);
372 DIR_TEST_CREATE_SUCCESS(&dir)
373 DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD)
376 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
378 pRtlCreateUnicodeStringFromAsciiz(&str, "");
379 DIR_TEST_CREATE_SUCCESS(&h)
381 DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD)
382 pRtlFreeUnicodeString(&str);
385 DIR_TEST_CREATE_OPEN_FAILURE(&h, "BaseNamedObjects", STATUS_OBJECT_PATH_SYNTAX_BAD)
386 DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\", STATUS_OBJECT_NAME_INVALID)
387 DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\\\BaseNamedObjects", STATUS_OBJECT_NAME_INVALID)
388 DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\\\om.c-test", STATUS_OBJECT_NAME_INVALID)
389 DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\om.c-test\\", STATUS_OBJECT_PATH_NOT_FOUND)
391 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\om.c-test");
392 DIR_TEST_CREATE_SUCCESS(&h)
393 DIR_TEST_OPEN_SUCCESS(&dir1)
394 pRtlFreeUnicodeString(&str);
399 /* Use of root directory */
401 /* Can't use symlinks as a directory */
402 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Local");
403 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
404 status = pNtOpenSymbolicLinkObject(&dir, SYMBOLIC_LINK_QUERY, &attr);
405 is_nt4 = (status == STATUS_OBJECT_NAME_NOT_FOUND); /* nt4 doesn't have Local\\ symlink */
411 ok(status == STATUS_SUCCESS, "Failed to open SymbolicLink(%08x)\n", status);
412 pRtlFreeUnicodeString(&str);
413 InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
414 pRtlCreateUnicodeStringFromAsciiz(&str, "one more level");
415 DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_TYPE_MISMATCH)
416 pRtlFreeUnicodeString(&str);
419 str.MaximumLength = sizeof(buffer);
421 memset( buffer, 0xaa, sizeof(buffer) );
422 status = pNtQuerySymbolicLinkObject( dir, &str, &len );
423 ok( status == STATUS_SUCCESS, "NtQuerySymbolicLinkObject failed %08x\n", status );
424 if (status != STATUS_SUCCESS)
426 full_len = str.Length + sizeof(WCHAR);
427 ok( len == full_len, "bad length %u/%u\n", len, full_len );
429 ok( buffer[len / sizeof(WCHAR) - 1] == 0, "no terminating null\n" );
431 str.MaximumLength = str.Length;
433 status = pNtQuerySymbolicLinkObject( dir, &str, &len );
434 ok( status == STATUS_BUFFER_TOO_SMALL, "NtQuerySymbolicLinkObject failed %08x\n", status );
435 ok( len == full_len, "bad length %u/%u\n", len, full_len );
437 str.MaximumLength = 0;
439 status = pNtQuerySymbolicLinkObject( dir, &str, &len );
440 ok( status == STATUS_BUFFER_TOO_SMALL, "NtQuerySymbolicLinkObject failed %08x\n", status );
441 ok( len == full_len, "bad length %u/%u\n", len, full_len );
443 str.MaximumLength = str.Length + sizeof(WCHAR);
445 status = pNtQuerySymbolicLinkObject( dir, &str, &len );
446 ok( status == STATUS_SUCCESS, "NtQuerySymbolicLinkObject failed %08x\n", status );
447 ok( len == full_len, "bad length %u/%u\n", len, full_len );
453 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects");
454 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
455 DIR_TEST_OPEN_SUCCESS(&dir)
456 pRtlFreeUnicodeString(&str);
458 InitializeObjectAttributes(&attr, NULL, 0, dir, NULL);
459 DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_NAME_INVALID)
461 InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
462 DIR_TEST_CREATE_OPEN_SUCCESS(h, "")
463 DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\", STATUS_OBJECT_PATH_SYNTAX_BAD)
464 DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\om.c-test", STATUS_OBJECT_PATH_SYNTAX_BAD)
465 DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\om.c-test\\", STATUS_OBJECT_PATH_SYNTAX_BAD)
466 DIR_TEST_CREATE_OPEN_FAILURE(&h, "om.c-test\\", STATUS_OBJECT_PATH_NOT_FOUND)
468 pRtlCreateUnicodeStringFromAsciiz(&str, "om.c-test");
469 DIR_TEST_CREATE_SUCCESS(&dir1)
470 DIR_TEST_OPEN_SUCCESS(&h)
471 pRtlFreeUnicodeString(&str);
477 /* Nested directories */
478 pRtlCreateUnicodeStringFromAsciiz(&str, "\\");
479 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
480 DIR_TEST_OPEN_SUCCESS(&dir)
481 InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
482 DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD)
483 pRtlFreeUnicodeString(&str);
486 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
487 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\om.c-test");
488 DIR_TEST_CREATE_SUCCESS(&dir)
489 pRtlFreeUnicodeString(&str);
490 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\om.c-test\\one more level");
491 DIR_TEST_CREATE_SUCCESS(&h)
492 pRtlFreeUnicodeString(&str);
494 InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
495 pRtlCreateUnicodeStringFromAsciiz(&str, "one more level");
496 DIR_TEST_CREATE_SUCCESS(&h)
497 pRtlFreeUnicodeString(&str);
504 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
505 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Global\\om.c-test");
506 DIR_TEST_CREATE_SUCCESS(&dir)
507 pRtlFreeUnicodeString(&str);
508 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Local\\om.c-test\\one more level");
509 DIR_TEST_CREATE_SUCCESS(&h)
510 pRtlFreeUnicodeString(&str);
512 InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
513 pRtlCreateUnicodeStringFromAsciiz(&str, "one more level");
514 DIR_TEST_CREATE_SUCCESS(&dir)
515 pRtlFreeUnicodeString(&str);
520 /* Create other objects using RootDirectory */
522 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
523 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects");
524 DIR_TEST_OPEN_SUCCESS(&dir)
525 pRtlFreeUnicodeString(&str);
526 InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
528 /* Test invalid paths */
529 pRtlCreateUnicodeStringFromAsciiz(&str, "\\om.c-mutant");
530 status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
531 ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD,
532 "NtCreateMutant should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08x)\n", status);
533 pRtlFreeUnicodeString(&str);
534 pRtlCreateUnicodeStringFromAsciiz(&str, "\\om.c-mutant\\");
535 status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
536 ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD,
537 "NtCreateMutant should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08x)\n", status);
538 pRtlFreeUnicodeString(&str);
540 pRtlCreateUnicodeStringFromAsciiz(&str, "om.c\\-mutant");
541 status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
542 ok(status == STATUS_OBJECT_PATH_NOT_FOUND,
543 "NtCreateMutant should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08x)\n", status);
544 pRtlFreeUnicodeString(&str);
546 pRtlCreateUnicodeStringFromAsciiz(&str, "om.c-mutant");
547 status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
548 ok(status == STATUS_SUCCESS, "Failed to create Mutant(%08x)\n", status);
549 pRtlFreeUnicodeString(&str);
555 #define SYMLNK_TEST_CREATE_OPEN_FAILURE2(h,n,t,e,e2) \
556 pRtlCreateUnicodeStringFromAsciiz(&str, n);\
557 pRtlCreateUnicodeStringFromAsciiz(&target, t);\
558 status = pNtCreateSymbolicLinkObject(h, SYMBOLIC_LINK_QUERY, &attr, &target);\
559 ok(status == e || status == e2, \
560 "NtCreateSymbolicLinkObject should have failed with %s or %s got(%08x)\n", #e, #e2, status);\
561 status = pNtOpenSymbolicLinkObject(h, SYMBOLIC_LINK_QUERY, &attr);\
562 ok(status == e || status == e2, \
563 "NtOpenSymbolicLinkObject should have failed with %s or %s got(%08x)\n", #e, #e2, status);\
564 pRtlFreeUnicodeString(&target);\
565 pRtlFreeUnicodeString(&str);
567 #define SYMLNK_TEST_CREATE_OPEN_FAILURE(h,n,t,e) SYMLNK_TEST_CREATE_OPEN_FAILURE2(h,n,t,e,e)
569 static void test_symboliclink(void)
572 UNICODE_STRING str, target;
573 OBJECT_ATTRIBUTES attr;
575 IO_STATUS_BLOCK iosb;
577 /* No name and/or no attributes */
578 InitializeObjectAttributes(&attr, NULL, 0, 0, NULL);
579 SYMLNK_TEST_CREATE_OPEN_FAILURE2(NULL, "", "", STATUS_ACCESS_VIOLATION, STATUS_INVALID_PARAMETER)
581 status = pNtCreateSymbolicLinkObject(&h, SYMBOLIC_LINK_QUERY, NULL, NULL);
582 ok(status == STATUS_ACCESS_VIOLATION,
583 "NtCreateSymbolicLinkObject should have failed with STATUS_ACCESS_VIOLATION got(%08x)\n", status);
584 status = pNtOpenSymbolicLinkObject(&h, SYMBOLIC_LINK_QUERY, NULL);
585 ok(status == STATUS_INVALID_PARAMETER,
586 "NtOpenSymbolicLinkObject should have failed with STATUS_INVALID_PARAMETER got(%08x)\n", status);
589 pRtlCreateUnicodeStringFromAsciiz(&target, "\\DosDevices");
590 status = pNtCreateSymbolicLinkObject(&h, SYMBOLIC_LINK_QUERY, NULL, &target);
591 ok(status == STATUS_SUCCESS || status == STATUS_ACCESS_VIOLATION, /* nt4 */
592 "NtCreateSymbolicLinkObject failed(%08x)\n", status);
593 pRtlFreeUnicodeString(&target);
594 if (!status) pNtClose(h);
596 InitializeObjectAttributes(&attr, NULL, 0, 0, NULL);
597 status = pNtCreateSymbolicLinkObject(&link, SYMBOLIC_LINK_QUERY, &attr, &target);
598 ok(status == STATUS_INVALID_PARAMETER ||
599 broken(status == STATUS_SUCCESS), /* nt4 */
600 "NtCreateSymbolicLinkObject should have failed with STATUS_INVALID_PARAMETER got(%08x)\n", status);
601 if (!status) pNtClose(h);
602 status = pNtOpenSymbolicLinkObject(&h, SYMBOLIC_LINK_QUERY, &attr);
603 ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD,
604 "NtOpenSymbolicLinkObject should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08x)\n", status);
607 pRtlCreateUnicodeStringFromAsciiz(&target, "anywhere");
608 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
610 pRtlCreateUnicodeStringFromAsciiz(&str, "");
611 status = pNtCreateSymbolicLinkObject(&link, SYMBOLIC_LINK_QUERY, &attr, &target);
612 ok(status == STATUS_SUCCESS, "Failed to create SymbolicLink(%08x)\n", status);
613 status = pNtOpenSymbolicLinkObject(&h, SYMBOLIC_LINK_QUERY, &attr);
614 ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD,
615 "NtOpenSymbolicLinkObject should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08x)\n", status);
617 pRtlFreeUnicodeString(&str);
619 pRtlCreateUnicodeStringFromAsciiz(&str, "\\");
620 status = pNtCreateSymbolicLinkObject(&h, SYMBOLIC_LINK_QUERY, &attr, &target);
621 todo_wine ok(status == STATUS_OBJECT_TYPE_MISMATCH,
622 "NtCreateSymbolicLinkObject should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08x)\n", status);
623 pRtlFreeUnicodeString(&str);
624 pRtlFreeUnicodeString(&target);
626 SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "BaseNamedObjects", "->Somewhere", STATUS_OBJECT_PATH_SYNTAX_BAD)
627 SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\", "->Somewhere", STATUS_OBJECT_NAME_INVALID)
628 SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\\\BaseNamedObjects", "->Somewhere", STATUS_OBJECT_NAME_INVALID)
629 SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\\\om.c-test", "->Somewhere", STATUS_OBJECT_NAME_INVALID)
630 SYMLNK_TEST_CREATE_OPEN_FAILURE2(&h, "\\BaseNamedObjects\\om.c-test\\", "->Somewhere",
631 STATUS_OBJECT_NAME_INVALID, STATUS_OBJECT_PATH_NOT_FOUND)
635 if (!(dir = get_base_dir()))
637 win_skip( "couldn't find the BaseNamedObjects dir\n" );
641 InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
642 pRtlCreateUnicodeStringFromAsciiz(&str, "test-link");
643 pRtlCreateUnicodeStringFromAsciiz(&target, "\\DosDevices");
644 status = pNtCreateSymbolicLinkObject(&link, SYMBOLIC_LINK_QUERY, &attr, &target);
645 ok(status == STATUS_SUCCESS, "Failed to create SymbolicLink(%08x)\n", status);
646 pRtlFreeUnicodeString(&str);
647 pRtlFreeUnicodeString(&target);
649 pRtlCreateUnicodeStringFromAsciiz(&str, "test-link\\NUL");
650 status = pNtOpenFile(&h, GENERIC_READ, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN);
651 todo_wine ok(status == STATUS_SUCCESS, "Failed to open NUL device(%08x)\n", status);
652 pRtlFreeUnicodeString(&str);
659 static void test_query_object(void)
661 static const WCHAR name[] = {'\\','B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s',
662 '\\','t','e','s','t','_','e','v','e','n','t'};
663 static const WCHAR type_event[] = {'E','v','e','n','t'};
664 static const WCHAR type_file[] = {'F','i','l','e'};
668 ULONG len, expected_len;
672 handle = CreateEventA( NULL, FALSE, FALSE, "test_event" );
675 status = pNtQueryObject( handle, ObjectNameInformation, buffer, 0, &len );
676 ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status );
677 ok( len >= sizeof(UNICODE_STRING) + sizeof(name) + sizeof(WCHAR), "unexpected len %u\n", len );
680 status = pNtQueryObject( handle, ObjectTypeInformation, buffer, 0, &len );
681 todo_wine ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status );
682 todo_wine ok( len >= sizeof(OBJECT_TYPE_INFORMATION) + sizeof(type_event) + sizeof(WCHAR), "unexpected len %u\n", len );
685 status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(UNICODE_STRING), &len );
686 ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status );
687 ok( len >= sizeof(UNICODE_STRING) + sizeof(name) + sizeof(WCHAR), "unexpected len %u\n", len );
690 status = pNtQueryObject( handle, ObjectTypeInformation, buffer, sizeof(OBJECT_TYPE_INFORMATION), &len );
691 todo_wine ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status );
692 todo_wine ok( len >= sizeof(OBJECT_TYPE_INFORMATION) + sizeof(type_event) + sizeof(WCHAR), "unexpected len %u\n", len );
695 status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(buffer), &len );
696 ok( status == STATUS_SUCCESS, "NtQueryObject failed %x\n", status );
697 ok( len > sizeof(UNICODE_STRING), "unexpected len %u\n", len );
698 str = (UNICODE_STRING *)buffer;
699 ok( sizeof(UNICODE_STRING) + str->Length + sizeof(WCHAR) == len, "unexpected len %u\n", len );
700 ok( str->Length >= sizeof(name), "unexpected len %u\n", str->Length );
701 /* there can be a \\Sessions prefix in the name */
702 ok( !memcmp( str->Buffer + (str->Length - sizeof(name)) / sizeof(WCHAR), name, sizeof(name) ),
703 "wrong name %s\n", wine_dbgstr_w(str->Buffer) );
705 len -= sizeof(WCHAR);
706 status = pNtQueryObject( handle, ObjectNameInformation, buffer, len, &len );
707 ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status );
708 ok( len >= sizeof(UNICODE_STRING) + sizeof(name) + sizeof(WCHAR), "unexpected len %u\n", len );
711 memset( buffer, 0, sizeof(buffer) );
712 status = pNtQueryObject( handle, ObjectTypeInformation, buffer, sizeof(buffer), &len );
713 todo_wine ok( status == STATUS_SUCCESS, "NtQueryObject failed %x\n", status );
714 todo_wine ok( len > sizeof(OBJECT_TYPE_INFORMATION), "unexpected len %u\n", len );
715 str = (UNICODE_STRING *)buffer;
716 todo_wine ok( len >= sizeof(OBJECT_TYPE_INFORMATION) + str->Length + sizeof(WCHAR), "unexpected len %u\n", len );
717 todo_wine ok( str->Buffer && !memcmp( str->Buffer, type_event, sizeof(type_file) ),
718 "wrong/bad type name %s (%p)\n", wine_dbgstr_w(str->Buffer), str->Buffer );
720 len -= sizeof(WCHAR);
721 status = pNtQueryObject( handle, ObjectTypeInformation, buffer, len, &len );
722 todo_wine ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status );
723 todo_wine ok( len >= sizeof(OBJECT_TYPE_INFORMATION) + sizeof(type_event) + sizeof(WCHAR), "unexpected len %u\n", len );
727 handle = CreateEventA( NULL, FALSE, FALSE, NULL );
729 status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(buffer), &len );
730 ok( status == STATUS_SUCCESS, "NtQueryObject failed %x\n", status );
731 ok( len == sizeof(UNICODE_STRING), "unexpected len %u\n", len );
732 str = (UNICODE_STRING *)buffer;
733 ok( str->Length == 0, "unexpected len %u\n", len );
734 ok( str->Buffer == NULL, "unexpected ptr %p\n", str->Buffer );
737 GetWindowsDirectoryA( dir, MAX_PATH );
738 handle = CreateFileA( dir, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
739 FILE_FLAG_BACKUP_SEMANTICS, 0 );
741 status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(buffer), &len );
742 ok( status == STATUS_SUCCESS, "NtQueryObject failed %x\n", status );
743 ok( len > sizeof(UNICODE_STRING), "unexpected len %u\n", len );
744 str = (UNICODE_STRING *)buffer;
745 expected_len = sizeof(UNICODE_STRING) + str->Length + sizeof(WCHAR);
746 ok( len == expected_len || broken(len == expected_len - sizeof(WCHAR)), /* NT4 */
747 "unexpected len %u\n", len );
748 trace( "got %s len %u\n", wine_dbgstr_w(str->Buffer), len );
751 status = pNtQueryObject( handle, ObjectNameInformation, buffer, 0, &len );
752 ok( status == STATUS_INFO_LENGTH_MISMATCH || broken(status == STATUS_INSUFFICIENT_RESOURCES),
753 "NtQueryObject failed %x\n", status );
754 ok( len == expected_len || broken(!len || len == sizeof(UNICODE_STRING)),
755 "unexpected len %u\n", len );
758 status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(UNICODE_STRING), &len );
759 ok( status == STATUS_BUFFER_OVERFLOW || broken(status == STATUS_INSUFFICIENT_RESOURCES
760 || status == STATUS_INFO_LENGTH_MISMATCH),
761 "NtQueryObject failed %x\n", status );
762 ok( len == expected_len || broken(!len),
763 "unexpected len %u\n", len );
766 memset( buffer, 0, sizeof(buffer) );
767 status = pNtQueryObject( handle, ObjectTypeInformation, buffer, sizeof(buffer), &len );
768 todo_wine ok( status == STATUS_SUCCESS, "NtQueryObject failed %x\n", status );
769 todo_wine ok( len > sizeof(OBJECT_TYPE_INFORMATION), "unexpected len %u\n", len );
770 str = (UNICODE_STRING *)buffer;
771 expected_len = sizeof(OBJECT_TYPE_INFORMATION) + str->Length + sizeof(WCHAR);
772 todo_wine ok( len >= expected_len, "unexpected len %u\n", len );
773 todo_wine ok( str->Buffer && !memcmp( str->Buffer, type_file, sizeof(type_file) ),
774 "wrong/bad type name %s (%p)\n", wine_dbgstr_w(str->Buffer), str->Buffer );
779 static void test_type_mismatch(void)
783 OBJECT_ATTRIBUTES attr;
785 attr.Length = sizeof(attr);
786 attr.RootDirectory = 0;
787 attr.ObjectName = NULL;
789 attr.SecurityDescriptor = NULL;
790 attr.SecurityQualityOfService = NULL;
792 res = pNtCreateEvent( &h, 0, &attr, 0, 0 );
793 ok(!res, "can't create event: %x\n", res);
795 res = pNtReleaseSemaphore( h, 30, NULL );
796 ok(res == STATUS_OBJECT_TYPE_MISMATCH, "expected 0xc0000024, got %x\n", res);
803 HMODULE hntdll = GetModuleHandleA("ntdll.dll");
804 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
808 skip("not running on NT, skipping test\n");
812 pCreateWaitableTimerA = (void *)GetProcAddress(hkernel32, "CreateWaitableTimerA");
814 pRtlCreateUnicodeStringFromAsciiz = (void *)GetProcAddress(hntdll, "RtlCreateUnicodeStringFromAsciiz");
815 pRtlFreeUnicodeString = (void *)GetProcAddress(hntdll, "RtlFreeUnicodeString");
816 pNtCreateEvent = (void *)GetProcAddress(hntdll, "NtCreateEvent");
817 pNtCreateMutant = (void *)GetProcAddress(hntdll, "NtCreateMutant");
818 pNtOpenMutant = (void *)GetProcAddress(hntdll, "NtOpenMutant");
819 pNtOpenFile = (void *)GetProcAddress(hntdll, "NtOpenFile");
820 pNtClose = (void *)GetProcAddress(hntdll, "NtClose");
821 pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
822 pNtCreateNamedPipeFile = (void *)GetProcAddress(hntdll, "NtCreateNamedPipeFile");
823 pNtOpenDirectoryObject = (void *)GetProcAddress(hntdll, "NtOpenDirectoryObject");
824 pNtCreateDirectoryObject= (void *)GetProcAddress(hntdll, "NtCreateDirectoryObject");
825 pNtOpenSymbolicLinkObject = (void *)GetProcAddress(hntdll, "NtOpenSymbolicLinkObject");
826 pNtCreateSymbolicLinkObject = (void *)GetProcAddress(hntdll, "NtCreateSymbolicLinkObject");
827 pNtQuerySymbolicLinkObject = (void *)GetProcAddress(hntdll, "NtQuerySymbolicLinkObject");
828 pNtCreateSemaphore = (void *)GetProcAddress(hntdll, "NtCreateSemaphore");
829 pNtCreateTimer = (void *)GetProcAddress(hntdll, "NtCreateTimer");
830 pNtCreateSection = (void *)GetProcAddress(hntdll, "NtCreateSection");
831 pNtQueryObject = (void *)GetProcAddress(hntdll, "NtQueryObject");
832 pNtReleaseSemaphore = (void *)GetProcAddress(hntdll, "NtReleaseSemaphore");
834 test_case_sensitive();
835 test_namespace_pipe();
836 test_name_collisions();
840 test_type_mismatch();