[uxtheme]
[reactos.git] / rostests / winetests / ntdll / om.c
1 /*
2 * Unit test suite for object manager functions
3 *
4 * Copyright 2005 Robert Shearman
5 * Copyright 2005 Vitaliy Margolen
6 *
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.
11 *
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.
16 *
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
20 */
21
22 #include "ntdll_test.h"
23 #include "winternl.h"
24 #include "stdio.h"
25 #include "winnt.h"
26 #include "stdlib.h"
27
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
50
51 static void test_case_sensitive (void)
52 {
53 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};
54 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};
55 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};
56 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};
57 NTSTATUS status;
58 OBJECT_ATTRIBUTES attr;
59 UNICODE_STRING str;
60 HANDLE Event, Mutant, h;
61
62 pRtlInitUnicodeString(&str, buffer1);
63 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
64 status = pNtCreateMutant(&Mutant, GENERIC_ALL, &attr, FALSE);
65 ok(status == STATUS_SUCCESS, "Failed to create Mutant(%08x)\n", status);
66
67 status = pNtCreateEvent(&Event, GENERIC_ALL, &attr, FALSE, FALSE);
68 ok(status == STATUS_OBJECT_NAME_COLLISION || status == STATUS_OBJECT_TYPE_MISMATCH,
69 "NtCreateEvent should have failed with STATUS_OBJECT_NAME_COLLISION or STATUS_OBJECT_TYPE_MISMATCH got (%08x)\n", status);
70
71 pRtlInitUnicodeString(&str, buffer2);
72 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
73 status = pNtCreateEvent(&Event, GENERIC_ALL, &attr, FALSE, FALSE);
74 ok(status == STATUS_SUCCESS, "Failed to create Event(%08x)\n", status);
75
76 pRtlInitUnicodeString(&str, buffer3);
77 InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, 0, NULL);
78 status = pNtOpenMutant(&h, GENERIC_ALL, &attr);
79 ok(status == STATUS_OBJECT_TYPE_MISMATCH,
80 "NtOpenMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08x)\n", status);
81
82 pNtClose(Mutant);
83
84 pRtlInitUnicodeString(&str, buffer4);
85 InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, 0, NULL);
86 status = pNtCreateMutant(&Mutant, GENERIC_ALL, &attr, FALSE);
87 ok(status == STATUS_OBJECT_NAME_COLLISION || status == STATUS_OBJECT_TYPE_MISMATCH,
88 "NtCreateMutant should have failed with STATUS_OBJECT_NAME_COLLISION or STATUS_OBJECT_TYPE_MISMATCH got (%08x)\n", status);
89
90 status = pNtCreateEvent(&h, GENERIC_ALL, &attr, FALSE, FALSE);
91 ok(status == STATUS_OBJECT_NAME_COLLISION,
92 "NtCreateEvent should have failed with STATUS_OBJECT_NAME_COLLISION got(%08x)\n", status);
93
94 attr.Attributes = 0;
95 status = pNtCreateMutant(&Mutant, GENERIC_ALL, &attr, FALSE);
96 ok(status == STATUS_OBJECT_PATH_NOT_FOUND,
97 "NtCreateMutant should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08x)\n", status);
98
99 pNtClose(Event);
100 }
101
102 static void test_namespace_pipe(void)
103 {
104 static const WCHAR buffer1[] = {'\\','?','?','\\','P','I','P','E','\\','t','e','s','t','\\','p','i','p','e',0};
105 static const WCHAR buffer2[] = {'\\','?','?','\\','P','I','P','E','\\','T','E','S','T','\\','P','I','P','E',0};
106 static const WCHAR buffer3[] = {'\\','?','?','\\','p','i','p','e','\\','t','e','s','t','\\','p','i','p','e',0};
107 static const WCHAR buffer4[] = {'\\','?','?','\\','p','i','p','e','\\','t','e','s','t',0};
108 OBJECT_ATTRIBUTES attr;
109 UNICODE_STRING str;
110 IO_STATUS_BLOCK iosb;
111 NTSTATUS status;
112 LARGE_INTEGER timeout;
113 HANDLE pipe, h;
114
115 timeout.QuadPart = -10000;
116
117 pRtlInitUnicodeString(&str, buffer1);
118 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
119 status = pNtCreateNamedPipeFile(&pipe, GENERIC_READ|GENERIC_WRITE, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE,
120 FILE_CREATE, FILE_PIPE_FULL_DUPLEX, FALSE, FALSE, FALSE, 1, 256, 256, &timeout);
121 ok(status == STATUS_SUCCESS, "Failed to create NamedPipe(%08x)\n", status);
122
123 status = pNtCreateNamedPipeFile(&pipe, GENERIC_READ|GENERIC_WRITE, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE,
124 FILE_CREATE, FILE_PIPE_FULL_DUPLEX, FALSE, FALSE, FALSE, 1, 256, 256, &timeout);
125 ok(status == STATUS_INSTANCE_NOT_AVAILABLE,
126 "NtCreateNamedPipeFile should have failed with STATUS_INSTANCE_NOT_AVAILABLE got(%08x)\n", status);
127
128 pRtlInitUnicodeString(&str, buffer2);
129 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
130 status = pNtCreateNamedPipeFile(&pipe, GENERIC_READ|GENERIC_WRITE, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE,
131 FILE_CREATE, FILE_PIPE_FULL_DUPLEX, FALSE, FALSE, FALSE, 1, 256, 256, &timeout);
132 ok(status == STATUS_INSTANCE_NOT_AVAILABLE,
133 "NtCreateNamedPipeFile should have failed with STATUS_INSTANCE_NOT_AVAILABLE got(%08x)\n", status);
134
135 h = CreateFileA("\\\\.\\pipe\\test\\pipe", GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
136 OPEN_EXISTING, 0, 0 );
137 ok(h != INVALID_HANDLE_VALUE, "Failed to open NamedPipe (%u)\n", GetLastError());
138 pNtClose(h);
139
140 pRtlInitUnicodeString(&str, buffer3);
141 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
142 status = pNtOpenFile(&h, GENERIC_READ, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN);
143 ok(status == STATUS_OBJECT_PATH_NOT_FOUND ||
144 status == STATUS_PIPE_NOT_AVAILABLE ||
145 status == STATUS_OBJECT_NAME_INVALID, /* vista */
146 "NtOpenFile should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08x)\n", status);
147
148 pRtlInitUnicodeString(&str, buffer4);
149 InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, 0, NULL);
150 status = pNtOpenFile(&h, GENERIC_READ, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN);
151 ok(status == STATUS_OBJECT_NAME_NOT_FOUND ||
152 status == STATUS_OBJECT_NAME_INVALID, /* vista */
153 "NtOpenFile should have failed with STATUS_OBJECT_NAME_NOT_FOUND got(%08x)\n", status);
154
155 pNtClose(pipe);
156 }
157
158 #define DIRECTORY_QUERY (0x0001)
159 #define SYMBOLIC_LINK_QUERY 0x0001
160
161 #define DIR_TEST_CREATE_FAILURE(h,e) \
162 status = pNtCreateDirectoryObject(h, DIRECTORY_QUERY, &attr);\
163 ok(status == e,"NtCreateDirectoryObject should have failed with %s got(%08x)\n", #e, status);
164 #define DIR_TEST_OPEN_FAILURE(h,e) \
165 status = pNtOpenDirectoryObject(h, DIRECTORY_QUERY, &attr);\
166 ok(status == e,"NtOpenDirectoryObject should have failed with %s got(%08x)\n", #e, status);
167 #define DIR_TEST_CREATE_OPEN_FAILURE(h,n,e) \
168 pRtlCreateUnicodeStringFromAsciiz(&str, n);\
169 DIR_TEST_CREATE_FAILURE(h,e) DIR_TEST_OPEN_FAILURE(h,e)\
170 pRtlFreeUnicodeString(&str);
171
172 #define DIR_TEST_CREATE_SUCCESS(h) \
173 status = pNtCreateDirectoryObject(h, DIRECTORY_QUERY, &attr); \
174 ok(status == STATUS_SUCCESS, "Failed to create Directory(%08x)\n", status);
175 #define DIR_TEST_OPEN_SUCCESS(h) \
176 status = pNtOpenDirectoryObject(h, DIRECTORY_QUERY, &attr); \
177 ok(status == STATUS_SUCCESS, "Failed to open Directory(%08x)\n", status);
178 #define DIR_TEST_CREATE_OPEN_SUCCESS(h,n) \
179 pRtlCreateUnicodeStringFromAsciiz(&str, n);\
180 DIR_TEST_CREATE_SUCCESS(&h) pNtClose(h); DIR_TEST_OPEN_SUCCESS(&h) pNtClose(h); \
181 pRtlFreeUnicodeString(&str);
182
183 static BOOL is_correct_dir( HANDLE dir, const char *name )
184 {
185 NTSTATUS status;
186 UNICODE_STRING str;
187 OBJECT_ATTRIBUTES attr;
188 HANDLE h = 0;
189
190 pRtlCreateUnicodeStringFromAsciiz(&str, name);
191 InitializeObjectAttributes(&attr, &str, OBJ_OPENIF, dir, NULL);
192 status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
193 pRtlFreeUnicodeString(&str);
194 if (h) pNtClose( h );
195 return (status == STATUS_OBJECT_NAME_EXISTS);
196 }
197
198 /* return a handle to the BaseNamedObjects dir where kernel32 objects get created */
199 static HANDLE get_base_dir(void)
200 {
201 static const char objname[] = "om.c_get_base_dir_obj";
202 NTSTATUS status;
203 UNICODE_STRING str;
204 OBJECT_ATTRIBUTES attr;
205 HANDLE dir, h;
206 unsigned int i;
207
208 h = CreateMutexA(NULL, FALSE, objname);
209 ok(h != 0, "CreateMutexA failed got ret=%p (%d)\n", h, GetLastError());
210 InitializeObjectAttributes(&attr, &str, OBJ_OPENIF, 0, NULL);
211
212 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Local");
213 status = pNtOpenDirectoryObject(&dir, DIRECTORY_QUERY, &attr);
214 pRtlFreeUnicodeString(&str);
215 if (!status && is_correct_dir( dir, objname )) goto done;
216 if (!status) pNtClose( dir );
217
218 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects");
219 status = pNtOpenDirectoryObject(&dir, DIRECTORY_QUERY, &attr);
220 pRtlFreeUnicodeString(&str);
221 if (!status && is_correct_dir( dir, objname )) goto done;
222 if (!status) pNtClose( dir );
223
224 for (i = 0; i < 20; i++)
225 {
226 char name[40];
227 sprintf( name, "\\BaseNamedObjects\\Session\\%u", i );
228 pRtlCreateUnicodeStringFromAsciiz(&str, name );
229 status = pNtOpenDirectoryObject(&dir, DIRECTORY_QUERY, &attr);
230 pRtlFreeUnicodeString(&str);
231 if (!status && is_correct_dir( dir, objname )) goto done;
232 if (!status) pNtClose( dir );
233 }
234 dir = 0;
235
236 done:
237 pNtClose( h );
238 return dir;
239 }
240
241 static void test_name_collisions(void)
242 {
243 NTSTATUS status;
244 UNICODE_STRING str;
245 OBJECT_ATTRIBUTES attr;
246 HANDLE dir, h, h1, h2;
247 DWORD winerr;
248 LARGE_INTEGER size;
249
250 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
251 pRtlCreateUnicodeStringFromAsciiz(&str, "\\");
252 DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_NAME_COLLISION)
253 InitializeObjectAttributes(&attr, &str, OBJ_OPENIF, 0, NULL);
254
255 DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_NAME_EXISTS)
256 pNtClose(h);
257 status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
258 ok(status == STATUS_OBJECT_TYPE_MISMATCH,
259 "NtCreateMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08x)\n", status);
260 pRtlFreeUnicodeString(&str);
261
262 pRtlCreateUnicodeStringFromAsciiz(&str, "\\??\\PIPE\\om.c-mutant");
263 status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
264 ok(status == STATUS_OBJECT_TYPE_MISMATCH || status == STATUS_OBJECT_PATH_NOT_FOUND,
265 "NtCreateMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08x)\n", status);
266 pRtlFreeUnicodeString(&str);
267
268 if (!(dir = get_base_dir()))
269 {
270 win_skip( "couldn't find the BaseNamedObjects dir\n" );
271 return;
272 }
273 pRtlCreateUnicodeStringFromAsciiz(&str, "om.c-test");
274 InitializeObjectAttributes(&attr, &str, OBJ_OPENIF, dir, NULL);
275 h = CreateMutexA(NULL, FALSE, "om.c-test");
276 ok(h != 0, "CreateMutexA failed got ret=%p (%d)\n", h, GetLastError());
277 status = pNtCreateMutant(&h1, GENERIC_ALL, &attr, FALSE);
278 ok(status == STATUS_OBJECT_NAME_EXISTS && h1 != NULL,
279 "NtCreateMutant should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)\n", status);
280 h2 = CreateMutexA(NULL, FALSE, "om.c-test");
281 winerr = GetLastError();
282 ok(h2 != 0 && winerr == ERROR_ALREADY_EXISTS,
283 "CreateMutexA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)\n", h2, winerr);
284 pNtClose(h);
285 pNtClose(h1);
286 pNtClose(h2);
287
288 h = CreateEventA(NULL, FALSE, FALSE, "om.c-test");
289 ok(h != 0, "CreateEventA failed got ret=%p (%d)\n", h, GetLastError());
290 status = pNtCreateEvent(&h1, GENERIC_ALL, &attr, FALSE, FALSE);
291 ok(status == STATUS_OBJECT_NAME_EXISTS && h1 != NULL,
292 "NtCreateEvent should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)\n", status);
293 h2 = CreateEventA(NULL, FALSE, FALSE, "om.c-test");
294 winerr = GetLastError();
295 ok(h2 != 0 && winerr == ERROR_ALREADY_EXISTS,
296 "CreateEventA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)\n", h2, winerr);
297 pNtClose(h);
298 pNtClose(h1);
299 pNtClose(h2);
300
301 h = CreateSemaphoreA(NULL, 1, 2, "om.c-test");
302 ok(h != 0, "CreateSemaphoreA failed got ret=%p (%d)\n", h, GetLastError());
303 status = pNtCreateSemaphore(&h1, GENERIC_ALL, &attr, 1, 2);
304 ok(status == STATUS_OBJECT_NAME_EXISTS && h1 != NULL,
305 "NtCreateSemaphore should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)\n", status);
306 h2 = CreateSemaphoreA(NULL, 1, 2, "om.c-test");
307 winerr = GetLastError();
308 ok(h2 != 0 && winerr == ERROR_ALREADY_EXISTS,
309 "CreateSemaphoreA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)\n", h2, winerr);
310 pNtClose(h);
311 pNtClose(h1);
312 pNtClose(h2);
313
314 h = pCreateWaitableTimerA(NULL, TRUE, "om.c-test");
315 ok(h != 0, "CreateWaitableTimerA failed got ret=%p (%d)\n", h, GetLastError());
316 status = pNtCreateTimer(&h1, GENERIC_ALL, &attr, NotificationTimer);
317 ok(status == STATUS_OBJECT_NAME_EXISTS && h1 != NULL,
318 "NtCreateTimer should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)\n", status);
319 h2 = pCreateWaitableTimerA(NULL, TRUE, "om.c-test");
320 winerr = GetLastError();
321 ok(h2 != 0 && winerr == ERROR_ALREADY_EXISTS,
322 "CreateWaitableTimerA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)\n", h2, winerr);
323 pNtClose(h);
324 pNtClose(h1);
325 pNtClose(h2);
326
327 h = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 256, "om.c-test");
328 ok(h != 0, "CreateFileMappingA failed got ret=%p (%d)\n", h, GetLastError());
329 size.u.LowPart = 256;
330 size.u.HighPart = 0;
331 status = pNtCreateSection(&h1, SECTION_MAP_WRITE, &attr, &size, PAGE_READWRITE, SEC_COMMIT, 0);
332 ok(status == STATUS_OBJECT_NAME_EXISTS && h1 != NULL,
333 "NtCreateSection should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)\n", status);
334 h2 = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 256, "om.c-test");
335 winerr = GetLastError();
336 ok(h2 != 0 && winerr == ERROR_ALREADY_EXISTS,
337 "CreateFileMappingA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)\n", h2, winerr);
338 pNtClose(h);
339 pNtClose(h1);
340 pNtClose(h2);
341
342 pRtlFreeUnicodeString(&str);
343 pNtClose(dir);
344 }
345
346 static void test_directory(void)
347 {
348 NTSTATUS status;
349 UNICODE_STRING str;
350 OBJECT_ATTRIBUTES attr;
351 HANDLE dir, dir1, h;
352 BOOL is_nt4;
353
354 /* No name and/or no attributes */
355 status = pNtCreateDirectoryObject(NULL, DIRECTORY_QUERY, &attr);
356 ok(status == STATUS_ACCESS_VIOLATION || status == STATUS_INVALID_PARAMETER,
357 "NtCreateDirectoryObject should have failed with STATUS_ACCESS_VIOLATION got(%08x)\n", status);
358 status = pNtOpenDirectoryObject(NULL, DIRECTORY_QUERY, &attr);
359 ok(status == STATUS_ACCESS_VIOLATION || status == STATUS_INVALID_PARAMETER,
360 "NtOpenDirectoryObject should have failed with STATUS_ACCESS_VIOLATION got(%08x)\n", status);
361
362 status = pNtCreateDirectoryObject(&h, DIRECTORY_QUERY, NULL);
363 ok(status == STATUS_SUCCESS, "Failed to create Directory without attributes(%08x)\n", status);
364 pNtClose(h);
365 status = pNtOpenDirectoryObject(&h, DIRECTORY_QUERY, NULL);
366 ok(status == STATUS_INVALID_PARAMETER,
367 "NtOpenDirectoryObject should have failed with STATUS_INVALID_PARAMETER got(%08x)\n", status);
368
369 InitializeObjectAttributes(&attr, NULL, 0, 0, NULL);
370 DIR_TEST_CREATE_SUCCESS(&dir)
371 DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD)
372
373 /* Bad name */
374 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
375
376 pRtlCreateUnicodeStringFromAsciiz(&str, "");
377 DIR_TEST_CREATE_SUCCESS(&h)
378 pNtClose(h);
379 DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD)
380 pRtlFreeUnicodeString(&str);
381 pNtClose(dir);
382
383 DIR_TEST_CREATE_OPEN_FAILURE(&h, "BaseNamedObjects", STATUS_OBJECT_PATH_SYNTAX_BAD)
384 DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\", STATUS_OBJECT_NAME_INVALID)
385 DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\\\BaseNamedObjects", STATUS_OBJECT_NAME_INVALID)
386 DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\\\om.c-test", STATUS_OBJECT_NAME_INVALID)
387 DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\om.c-test\\", STATUS_OBJECT_PATH_NOT_FOUND)
388
389 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\om.c-test");
390 DIR_TEST_CREATE_SUCCESS(&h)
391 DIR_TEST_OPEN_SUCCESS(&dir1)
392 pRtlFreeUnicodeString(&str);
393 pNtClose(h);
394 pNtClose(dir1);
395
396
397 /* Use of root directory */
398
399 /* Can't use symlinks as a directory */
400 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Local");
401 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
402 status = pNtOpenSymbolicLinkObject(&dir, SYMBOLIC_LINK_QUERY, &attr);
403 is_nt4 = (status == STATUS_OBJECT_NAME_NOT_FOUND); /* nt4 doesn't have Local\\ symlink */
404 if (!is_nt4)
405 {
406 WCHAR buffer[256];
407 ULONG len, full_len;
408
409 ok(status == STATUS_SUCCESS, "Failed to open SymbolicLink(%08x)\n", status);
410 pRtlFreeUnicodeString(&str);
411 InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
412 pRtlCreateUnicodeStringFromAsciiz(&str, "one more level");
413 DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_TYPE_MISMATCH)
414 pRtlFreeUnicodeString(&str);
415
416 str.Buffer = buffer;
417 str.MaximumLength = sizeof(buffer);
418 len = 0xdeadbeef;
419 memset( buffer, 0xaa, sizeof(buffer) );
420 status = pNtQuerySymbolicLinkObject( dir, &str, &len );
421 ok( status == STATUS_SUCCESS, "NtQuerySymbolicLinkObject failed %08x\n", status );
422 full_len = str.Length + sizeof(WCHAR);
423 ok( len == full_len, "bad length %u/%u\n", len, full_len );
424 ok( buffer[len / sizeof(WCHAR) - 1] == 0, "no terminating null\n" );
425
426 str.MaximumLength = str.Length;
427 len = 0xdeadbeef;
428 status = pNtQuerySymbolicLinkObject( dir, &str, &len );
429 ok( status == STATUS_BUFFER_TOO_SMALL, "NtQuerySymbolicLinkObject failed %08x\n", status );
430 ok( len == full_len, "bad length %u/%u\n", len, full_len );
431
432 str.MaximumLength = 0;
433 len = 0xdeadbeef;
434 status = pNtQuerySymbolicLinkObject( dir, &str, &len );
435 ok( status == STATUS_BUFFER_TOO_SMALL, "NtQuerySymbolicLinkObject failed %08x\n", status );
436 ok( len == full_len, "bad length %u/%u\n", len, full_len );
437
438 str.MaximumLength = str.Length + sizeof(WCHAR);
439 len = 0xdeadbeef;
440 status = pNtQuerySymbolicLinkObject( dir, &str, &len );
441 ok( status == STATUS_SUCCESS, "NtQuerySymbolicLinkObject failed %08x\n", status );
442 ok( len == full_len, "bad length %u/%u\n", len, full_len );
443
444 pNtClose(dir);
445 }
446
447 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects");
448 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
449 DIR_TEST_OPEN_SUCCESS(&dir)
450 pRtlFreeUnicodeString(&str);
451
452 InitializeObjectAttributes(&attr, NULL, 0, dir, NULL);
453 DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_NAME_INVALID)
454
455 InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
456 DIR_TEST_CREATE_OPEN_SUCCESS(h, "")
457 DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\", STATUS_OBJECT_PATH_SYNTAX_BAD)
458 DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\om.c-test", STATUS_OBJECT_PATH_SYNTAX_BAD)
459 DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\om.c-test\\", STATUS_OBJECT_PATH_SYNTAX_BAD)
460 DIR_TEST_CREATE_OPEN_FAILURE(&h, "om.c-test\\", STATUS_OBJECT_PATH_NOT_FOUND)
461
462 pRtlCreateUnicodeStringFromAsciiz(&str, "om.c-test");
463 DIR_TEST_CREATE_SUCCESS(&dir1)
464 DIR_TEST_OPEN_SUCCESS(&h)
465 pRtlFreeUnicodeString(&str);
466
467 pNtClose(h);
468 pNtClose(dir1);
469 pNtClose(dir);
470
471 /* Nested directories */
472 pRtlCreateUnicodeStringFromAsciiz(&str, "\\");
473 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
474 DIR_TEST_OPEN_SUCCESS(&dir)
475 InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
476 DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD)
477 pRtlFreeUnicodeString(&str);
478 pNtClose(dir);
479
480 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
481 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\om.c-test");
482 DIR_TEST_CREATE_SUCCESS(&dir)
483 pRtlFreeUnicodeString(&str);
484 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\om.c-test\\one more level");
485 DIR_TEST_CREATE_SUCCESS(&h)
486 pRtlFreeUnicodeString(&str);
487 pNtClose(h);
488 InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
489 pRtlCreateUnicodeStringFromAsciiz(&str, "one more level");
490 DIR_TEST_CREATE_SUCCESS(&h)
491 pRtlFreeUnicodeString(&str);
492 pNtClose(h);
493
494 pNtClose(dir);
495
496 if (!is_nt4)
497 {
498 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
499 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Global\\om.c-test");
500 DIR_TEST_CREATE_SUCCESS(&dir)
501 pRtlFreeUnicodeString(&str);
502 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Local\\om.c-test\\one more level");
503 DIR_TEST_CREATE_SUCCESS(&h)
504 pRtlFreeUnicodeString(&str);
505 pNtClose(h);
506 InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
507 pRtlCreateUnicodeStringFromAsciiz(&str, "one more level");
508 DIR_TEST_CREATE_SUCCESS(&dir)
509 pRtlFreeUnicodeString(&str);
510 pNtClose(h);
511 pNtClose(dir);
512 }
513
514 /* Create other objects using RootDirectory */
515
516 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
517 pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects");
518 DIR_TEST_OPEN_SUCCESS(&dir)
519 pRtlFreeUnicodeString(&str);
520 InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
521
522 /* Test invalid paths */
523 pRtlCreateUnicodeStringFromAsciiz(&str, "\\om.c-mutant");
524 status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
525 ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD,
526 "NtCreateMutant should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08x)\n", status);
527 pRtlFreeUnicodeString(&str);
528 pRtlCreateUnicodeStringFromAsciiz(&str, "\\om.c-mutant\\");
529 status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
530 ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD,
531 "NtCreateMutant should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08x)\n", status);
532 pRtlFreeUnicodeString(&str);
533
534 pRtlCreateUnicodeStringFromAsciiz(&str, "om.c\\-mutant");
535 status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
536 ok(status == STATUS_OBJECT_PATH_NOT_FOUND,
537 "NtCreateMutant should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08x)\n", status);
538 pRtlFreeUnicodeString(&str);
539
540 pRtlCreateUnicodeStringFromAsciiz(&str, "om.c-mutant");
541 status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
542 ok(status == STATUS_SUCCESS, "Failed to create Mutant(%08x)\n", status);
543 pRtlFreeUnicodeString(&str);
544 pNtClose(h);
545
546 pNtClose(dir);
547 }
548
549 #define SYMLNK_TEST_CREATE_OPEN_FAILURE2(h,n,t,e,e2) \
550 pRtlCreateUnicodeStringFromAsciiz(&str, n);\
551 pRtlCreateUnicodeStringFromAsciiz(&target, t);\
552 status = pNtCreateSymbolicLinkObject(h, SYMBOLIC_LINK_QUERY, &attr, &target);\
553 ok(status == e || status == e2, \
554 "NtCreateSymbolicLinkObject should have failed with %s or %s got(%08x)\n", #e, #e2, status);\
555 status = pNtOpenSymbolicLinkObject(h, SYMBOLIC_LINK_QUERY, &attr);\
556 ok(status == e || status == e2, \
557 "NtOpenSymbolicLinkObject should have failed with %s or %s got(%08x)\n", #e, #e2, status);\
558 pRtlFreeUnicodeString(&target);\
559 pRtlFreeUnicodeString(&str);
560
561 #define SYMLNK_TEST_CREATE_OPEN_FAILURE(h,n,t,e) SYMLNK_TEST_CREATE_OPEN_FAILURE2(h,n,t,e,e)
562
563 static void test_symboliclink(void)
564 {
565 NTSTATUS status;
566 UNICODE_STRING str, target;
567 OBJECT_ATTRIBUTES attr;
568 HANDLE dir, link, h;
569 IO_STATUS_BLOCK iosb;
570
571 /* No name and/or no attributes */
572 InitializeObjectAttributes(&attr, NULL, 0, 0, NULL);
573 SYMLNK_TEST_CREATE_OPEN_FAILURE2(NULL, "", "", STATUS_ACCESS_VIOLATION, STATUS_INVALID_PARAMETER)
574
575 status = pNtCreateSymbolicLinkObject(&h, SYMBOLIC_LINK_QUERY, NULL, NULL);
576 ok(status == STATUS_ACCESS_VIOLATION,
577 "NtCreateSymbolicLinkObject should have failed with STATUS_ACCESS_VIOLATION got(%08x)\n", status);
578 status = pNtOpenSymbolicLinkObject(&h, SYMBOLIC_LINK_QUERY, NULL);
579 ok(status == STATUS_INVALID_PARAMETER,
580 "NtOpenSymbolicLinkObject should have failed with STATUS_INVALID_PARAMETER got(%08x)\n", status);
581
582 /* No attributes */
583 pRtlCreateUnicodeStringFromAsciiz(&target, "\\DosDevices");
584 status = pNtCreateSymbolicLinkObject(&h, SYMBOLIC_LINK_QUERY, NULL, &target);
585 ok(status == STATUS_SUCCESS || status == STATUS_ACCESS_VIOLATION, /* nt4 */
586 "NtCreateSymbolicLinkObject failed(%08x)\n", status);
587 pRtlFreeUnicodeString(&target);
588 if (!status) pNtClose(h);
589
590 InitializeObjectAttributes(&attr, NULL, 0, 0, NULL);
591 status = pNtCreateSymbolicLinkObject(&link, SYMBOLIC_LINK_QUERY, &attr, &target);
592 ok(status == STATUS_INVALID_PARAMETER ||
593 broken(status == STATUS_SUCCESS), /* nt4 */
594 "NtCreateSymbolicLinkObject should have failed with STATUS_INVALID_PARAMETER got(%08x)\n", status);
595 if (!status) pNtClose(h);
596 status = pNtOpenSymbolicLinkObject(&h, SYMBOLIC_LINK_QUERY, &attr);
597 ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD,
598 "NtOpenSymbolicLinkObject should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08x)\n", status);
599
600 /* Bad name */
601 pRtlCreateUnicodeStringFromAsciiz(&target, "anywhere");
602 InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
603
604 pRtlCreateUnicodeStringFromAsciiz(&str, "");
605 status = pNtCreateSymbolicLinkObject(&link, SYMBOLIC_LINK_QUERY, &attr, &target);
606 ok(status == STATUS_SUCCESS, "Failed to create SymbolicLink(%08x)\n", status);
607 status = pNtOpenSymbolicLinkObject(&h, SYMBOLIC_LINK_QUERY, &attr);
608 ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD,
609 "NtOpenSymbolicLinkObject should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08x)\n", status);
610 pNtClose(link);
611 pRtlFreeUnicodeString(&str);
612
613 pRtlCreateUnicodeStringFromAsciiz(&str, "\\");
614 status = pNtCreateSymbolicLinkObject(&h, SYMBOLIC_LINK_QUERY, &attr, &target);
615 todo_wine ok(status == STATUS_OBJECT_TYPE_MISMATCH,
616 "NtCreateSymbolicLinkObject should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08x)\n", status);
617 pRtlFreeUnicodeString(&str);
618 pRtlFreeUnicodeString(&target);
619
620 SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "BaseNamedObjects", "->Somewhere", STATUS_OBJECT_PATH_SYNTAX_BAD)
621 SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\", "->Somewhere", STATUS_OBJECT_NAME_INVALID)
622 SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\\\BaseNamedObjects", "->Somewhere", STATUS_OBJECT_NAME_INVALID)
623 SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\\\om.c-test", "->Somewhere", STATUS_OBJECT_NAME_INVALID)
624 SYMLNK_TEST_CREATE_OPEN_FAILURE2(&h, "\\BaseNamedObjects\\om.c-test\\", "->Somewhere",
625 STATUS_OBJECT_NAME_INVALID, STATUS_OBJECT_PATH_NOT_FOUND)
626
627
628 /* Compound test */
629 if (!(dir = get_base_dir()))
630 {
631 win_skip( "couldn't find the BaseNamedObjects dir\n" );
632 return;
633 }
634
635 InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
636 pRtlCreateUnicodeStringFromAsciiz(&str, "test-link");
637 pRtlCreateUnicodeStringFromAsciiz(&target, "\\DosDevices");
638 status = pNtCreateSymbolicLinkObject(&link, SYMBOLIC_LINK_QUERY, &attr, &target);
639 ok(status == STATUS_SUCCESS, "Failed to create SymbolicLink(%08x)\n", status);
640 pRtlFreeUnicodeString(&str);
641 pRtlFreeUnicodeString(&target);
642
643 pRtlCreateUnicodeStringFromAsciiz(&str, "test-link\\NUL");
644 status = pNtOpenFile(&h, GENERIC_READ, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN);
645 todo_wine ok(status == STATUS_SUCCESS, "Failed to open NUL device(%08x)\n", status);
646 pRtlFreeUnicodeString(&str);
647
648 pNtClose(h);
649 pNtClose(link);
650 pNtClose(dir);
651 }
652
653 static void test_query_object(void)
654 {
655 static const WCHAR name[] = {'\\','B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s',
656 '\\','t','e','s','t','_','e','v','e','n','t'};
657 HANDLE handle;
658 char buffer[1024];
659 NTSTATUS status;
660 ULONG len;
661 UNICODE_STRING *str;
662 char dir[MAX_PATH];
663
664 handle = CreateEventA( NULL, FALSE, FALSE, "test_event" );
665
666 len = 0;
667 status = pNtQueryObject( handle, ObjectNameInformation, buffer, 0, &len );
668 ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status );
669 ok( len >= sizeof(UNICODE_STRING) + sizeof(name) + sizeof(WCHAR), "unexpected len %u\n", len );
670
671 len = 0;
672 status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(UNICODE_STRING), &len );
673 ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status );
674 ok( len >= sizeof(UNICODE_STRING) + sizeof(name) + sizeof(WCHAR), "unexpected len %u\n", len );
675
676 len = 0;
677 status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(buffer), &len );
678 ok( status == STATUS_SUCCESS, "NtQueryObject failed %x\n", status );
679 ok( len > sizeof(UNICODE_STRING), "unexpected len %u\n", len );
680 str = (UNICODE_STRING *)buffer;
681 ok( sizeof(UNICODE_STRING) + str->Length + sizeof(WCHAR) == len, "unexpected len %u\n", len );
682 ok( str->Length >= sizeof(name), "unexpected len %u\n", str->Length );
683 /* there can be a \\Sessions prefix in the name */
684 ok( !memcmp( str->Buffer + (str->Length - sizeof(name)) / sizeof(WCHAR), name, sizeof(name) ),
685 "wrong name %s\n", wine_dbgstr_w(str->Buffer) );
686
687 len -= sizeof(WCHAR);
688 status = pNtQueryObject( handle, ObjectNameInformation, buffer, len, &len );
689 ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status );
690 ok( len >= sizeof(UNICODE_STRING) + sizeof(name) + sizeof(WCHAR), "unexpected len %u\n", len );
691
692 pNtClose( handle );
693
694 handle = CreateEventA( NULL, FALSE, FALSE, NULL );
695 len = 0;
696 status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(buffer), &len );
697 ok( status == STATUS_SUCCESS, "NtQueryObject failed %x\n", status );
698 ok( len == sizeof(UNICODE_STRING), "unexpected len %u\n", len );
699 str = (UNICODE_STRING *)buffer;
700 ok( str->Length == 0, "unexpected len %u\n", len );
701 ok( str->Buffer == NULL, "unexpected ptr %p\n", str->Buffer );
702 pNtClose( handle );
703
704 GetWindowsDirectoryA( dir, MAX_PATH );
705 handle = CreateFileA( dir, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
706 FILE_FLAG_BACKUP_SEMANTICS, 0 );
707 len = 0;
708 status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(buffer), &len );
709 ok( status == STATUS_SUCCESS, "NtQueryObject failed %x\n", status );
710 ok( len > sizeof(UNICODE_STRING), "unexpected len %u\n", len );
711 str = (UNICODE_STRING *)buffer;
712 ok( sizeof(UNICODE_STRING) + str->Length + sizeof(WCHAR) == len ||
713 broken(sizeof(UNICODE_STRING) + str->Length == len), /* NT4 */
714 "unexpected len %u\n", len );
715 trace( "got %s len %u\n", wine_dbgstr_w(str->Buffer), len );
716 pNtClose( handle );
717 }
718
719 START_TEST(om)
720 {
721 HMODULE hntdll = GetModuleHandleA("ntdll.dll");
722 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
723
724 if (!hntdll)
725 {
726 skip("not running on NT, skipping test\n");
727 return;
728 }
729
730 pCreateWaitableTimerA = (void *)GetProcAddress(hkernel32, "CreateWaitableTimerA");
731
732 pRtlCreateUnicodeStringFromAsciiz = (void *)GetProcAddress(hntdll, "RtlCreateUnicodeStringFromAsciiz");
733 pRtlFreeUnicodeString = (void *)GetProcAddress(hntdll, "RtlFreeUnicodeString");
734 pNtCreateEvent = (void *)GetProcAddress(hntdll, "NtCreateEvent");
735 pNtCreateMutant = (void *)GetProcAddress(hntdll, "NtCreateMutant");
736 pNtOpenMutant = (void *)GetProcAddress(hntdll, "NtOpenMutant");
737 pNtOpenFile = (void *)GetProcAddress(hntdll, "NtOpenFile");
738 pNtClose = (void *)GetProcAddress(hntdll, "NtClose");
739 pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
740 pNtCreateNamedPipeFile = (void *)GetProcAddress(hntdll, "NtCreateNamedPipeFile");
741 pNtOpenDirectoryObject = (void *)GetProcAddress(hntdll, "NtOpenDirectoryObject");
742 pNtCreateDirectoryObject= (void *)GetProcAddress(hntdll, "NtCreateDirectoryObject");
743 pNtOpenSymbolicLinkObject = (void *)GetProcAddress(hntdll, "NtOpenSymbolicLinkObject");
744 pNtCreateSymbolicLinkObject = (void *)GetProcAddress(hntdll, "NtCreateSymbolicLinkObject");
745 pNtQuerySymbolicLinkObject = (void *)GetProcAddress(hntdll, "NtQuerySymbolicLinkObject");
746 pNtCreateSemaphore = (void *)GetProcAddress(hntdll, "NtCreateSemaphore");
747 pNtCreateTimer = (void *)GetProcAddress(hntdll, "NtCreateTimer");
748 pNtCreateSection = (void *)GetProcAddress(hntdll, "NtCreateSection");
749 pNtQueryObject = (void *)GetProcAddress(hntdll, "NtQueryObject");
750
751 test_case_sensitive();
752 test_namespace_pipe();
753 test_name_collisions();
754 test_directory();
755 test_symboliclink();
756 test_query_object();
757 }