74#define KEYEDEVENT_WAIT 0x0001
75#define KEYEDEVENT_WAKE 0x0002
76#define KEYEDEVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x0003)
78#define ROUND_UP(value, alignment) (((value) + ((alignment) - 1)) & ~((alignment)-1))
82 if (!
us)
return "(null)";
89 while ((--
n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; }
95 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};
96 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};
97 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};
98 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};
104 pRtlInitUnicodeString(&
str, buffer1);
111 "NtCreateEvent should have failed with STATUS_OBJECT_NAME_COLLISION or STATUS_OBJECT_TYPE_MISMATCH got (%08x)\n",
status);
113 pRtlInitUnicodeString(&
str, buffer2);
118 pRtlInitUnicodeString(&
str, buffer3);
122 "NtOpenMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08x)\n",
status);
126 pRtlInitUnicodeString(&
str, buffer4);
130 "NtCreateMutant should have failed with STATUS_OBJECT_NAME_COLLISION or STATUS_OBJECT_TYPE_MISMATCH got (%08x)\n",
status);
134 "NtCreateEvent should have failed with STATUS_OBJECT_NAME_COLLISION got(%08x)\n",
status);
139 "NtCreateMutant should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08x)\n",
status);
146 static const WCHAR buffer1[] = {
'\\',
'?',
'?',
'\\',
'P',
'I',
'P',
'E',
'\\',
't',
'e',
's',
't',
'\\',
'p',
'i',
'p',
'e',0};
147 static const WCHAR buffer2[] = {
'\\',
'?',
'?',
'\\',
'P',
'I',
'P',
'E',
'\\',
'T',
'E',
'S',
'T',
'\\',
'P',
'I',
'P',
'E',0};
148 static const WCHAR buffer3[] = {
'\\',
'?',
'?',
'\\',
'p',
'i',
'p',
'e',
'\\',
't',
'e',
's',
't',
'\\',
'p',
'i',
'p',
'e',0};
149 static const WCHAR buffer4[] = {
'\\',
'?',
'?',
'\\',
'p',
'i',
'p',
'e',
'\\',
't',
'e',
's',
't',0};
159 pRtlInitUnicodeString(&
str, buffer1);
168 "NtCreateNamedPipeFile should have failed with STATUS_INSTANCE_NOT_AVAILABLE got(%08x)\n",
status);
170 pRtlInitUnicodeString(&
str, buffer2);
175 "NtCreateNamedPipeFile should have failed with STATUS_INSTANCE_NOT_AVAILABLE got(%08x)\n",
status);
182 pRtlInitUnicodeString(&
str, buffer3);
189 "NtOpenFile should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08x)\n",
status);
191 pRtlInitUnicodeString(&
str, buffer4);
196 "NtOpenFile should have failed with STATUS_OBJECT_NAME_NOT_FOUND got(%08x)\n",
status);
211#define DIRECTORY_QUERY (0x0001)
212#define SYMBOLIC_LINK_QUERY 0x0001
214#define DIR_TEST_CREATE_OPEN(n,e) \
217 pRtlCreateUnicodeStringFromAsciiz(&str, n); \
218 status = pNtCreateDirectoryObject( &h, DIRECTORY_QUERY, &attr ); \
219 ok( status == e, "NtCreateDirectoryObject(%s) got %08x\n", n, status ); \
220 if (!status) pNtClose( h ); \
221 status = pNtOpenDirectoryObject( &h, DIRECTORY_QUERY, &attr ); \
222 ok( status == e, "NtOpenDirectoryObject(%s) got %08x\n", n, status ); \
223 if (!status) pNtClose( h ); \
224 pRtlFreeUnicodeString(&str); \
234 pRtlCreateUnicodeStringFromAsciiz(&
str,
name);
237 pRtlFreeUnicodeString(&
str);
238 if (
h) pNtClose(
h );
245 static const char objname[] =
"om.c_get_base_dir_obj";
257 pRtlCreateUnicodeStringFromAsciiz(&
str,
name );
259 pRtlFreeUnicodeString(&
str);
263 pRtlCreateUnicodeStringFromAsciiz(&
str,
"\\BaseNamedObjects");
265 pRtlFreeUnicodeString(&
str);
286 pRtlCreateUnicodeStringFromAsciiz(&
str,
"\\");
296 "NtCreateMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08x)\n",
status);
297 pRtlFreeUnicodeString(&
str);
299 pRtlCreateUnicodeStringFromAsciiz(&
str,
"\\??\\PIPE\\om.c-mutant");
302 "NtCreateMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08x)\n",
status);
303 pRtlFreeUnicodeString(&
str);
307 win_skip(
"couldn't find the BaseNamedObjects dir\n" );
310 pRtlCreateUnicodeStringFromAsciiz(&
str,
"om.c-test");
316 "NtCreateMutant should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)\n",
status);
320 "CreateMutexA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)\n", h2,
winerr);
329 "NtCreateEvent should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)\n",
status);
333 "CreateEventA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)\n", h2,
winerr);
342 "NtCreateSemaphore should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)\n",
status);
346 "CreateSemaphoreA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)\n", h2,
winerr);
351 h = pCreateWaitableTimerA(
NULL,
TRUE,
"om.c-test");
352 ok(
h != 0,
"CreateWaitableTimerA failed got ret=%p (%d)\n",
h,
GetLastError());
355 "NtCreateTimer should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)\n",
status);
356 h2 = pCreateWaitableTimerA(
NULL,
TRUE,
"om.c-test");
359 "CreateWaitableTimerA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)\n", h2,
winerr);
365 ok(
h != 0,
"CreateFileMappingA failed got ret=%p (%d)\n",
h,
GetLastError());
366 size.u.LowPart = 256;
370 "NtCreateSection should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)\n",
status);
374 "CreateFileMappingA should have succeeded with ERROR_ALREADY_EXISTS got ret=%p (%d)\n", h2,
winerr);
379 pRtlFreeUnicodeString(&
str);
391 pRtlCreateUnicodeStringFromAsciiz( &
target,
"\\DosDevices" );
392 size.QuadPart = 4096;
397 ok( status2 == open_expect,
"%u: NtOpenMutant failed %x\n",
line, status2 );
399 if (!status2) pNtClose( ret2 );
403 ok( status2 == open_expect,
"%u: NtOpenSemaphore failed %x\n",
line, status2 );
405 if (!status2) pNtClose( ret2 );
409 ok( status2 == open_expect,
"%u: NtOpenEvent failed %x\n",
line, status2 );
411 if (!status2) pNtClose( ret2 );
415 ok( status2 == open_expect,
"%u: NtOpenKeyedEvent failed %x\n",
line, status2 );
417 if (!status2) pNtClose( ret2 );
421 ok( status2 == open_expect,
"%u: NtOpenTimer failed %x\n",
line, status2 );
423 if (!status2) pNtClose( ret2 );
427 ok( status2 == open_expect,
"%u: NtOpenCompletion failed %x\n",
line, status2 );
429 if (!status2) pNtClose( ret2 );
433 ok( status2 == open_expect,
"%u: NtOpenJobObject failed %x\n",
line, status2 );
435 if (!status2) pNtClose( ret2 );
437 ok(
status == create_expect,
"%u: NtCreateDirectoryObject failed %x\n",
line,
status );
439 ok( status2 == open_expect,
"%u: NtOpenDirectoryObject failed %x\n",
line, status2 );
441 if (!status2) pNtClose( ret2 );
443 ok(
status == create_expect,
"%u: NtCreateSymbolicLinkObject failed %x\n",
line,
status );
445 ok( status2 == open_expect,
"%u: NtOpenSymbolicLinkObject failed %x\n",
line, status2 );
447 if (!status2) pNtClose( ret2 );
451 ok( status2 == open_expect,
"%u: NtOpenSection failed %x\n",
line, status2 );
453 if (!status2) pNtClose( ret2 );
454 pRtlFreeUnicodeString( &
target );
459 static const WCHAR localW[] = {
'\\',
'B',
'a',
's',
'e',
'N',
'a',
'm',
'e',
'd',
'O',
'b',
'j',
'e',
'c',
't',
's',
'\\',
'L',
'o',
'c',
'a',
'l',0};
460 static const WCHAR pipeW[] = {
'\\',
'D',
'e',
'v',
'i',
'c',
'e',
'\\',
'N',
'a',
'm',
'e',
'd',
'P',
'i',
'p',
'e',
'\\'};
461 static const WCHAR mailslotW[] = {
'\\',
'D',
'e',
'v',
'i',
'c',
'e',
'\\',
'M',
'a',
'i',
'l',
'S',
'l',
'o',
't',
'\\'};
462 static const WCHAR registryW[] = {
'\\',
'R',
'E',
'G',
'I',
'S',
'T',
'R',
'Y',
'\\',
'M',
'a',
'c',
'h',
'i',
'n',
'e',
'\\',
'S',
'O',
'F',
'T',
'W',
'A',
'R',
'E',
'\\',
'M',
'i',
'c',
'r',
'o',
's',
'o',
'f',
't',
'\\'};
475 str.MaximumLength = 65534;
476 for (
i = 0;
i < 65536 /
sizeof(
WCHAR);
i++)
str.Buffer[
i] =
'a';
477 size.QuadPart = 4096;
478 pRtlCreateUnicodeStringFromAsciiz( &
target,
"\\DosDevices" );
482 win_skip(
"couldn't find the BaseNamedObjects dir\n" );
494 "%u: NtOpenMutant failed %x\n",
str.Length,
status );
503 "%u: NtOpenSemaphore failed %x\n",
str.Length,
status );
512 "%u: NtOpenEvent failed %x\n",
str.Length,
status );
521 "%u: NtOpenKeyedEvent failed %x\n",
str.Length,
status );
530 "%u: NtOpenTimer failed %x\n",
str.Length,
status );
539 "%u: NtOpenCompletion failed %x\n",
str.Length,
status );
548 "%u: NtOpenJobObject failed %x\n",
str.Length,
status );
555 "%u: NtOpenDirectoryObject failed %x\n",
str.Length,
status );
556 if (!
status) pNtClose( ret2 );
577 "%u: NtOpenSection failed %x\n",
str.Length,
status );
606 pRtlInitUnicodeString( &str2, localW );
656 "NULL: NtCreateSymbolicLinkObject failed %x\n",
status );
668 memcpy(
str.Buffer, pipeW,
sizeof(pipeW) );
669 for (
i = 0;
i < 65536 /
sizeof(
WCHAR);
i++)
str.Buffer[
i +
sizeof(pipeW)/
sizeof(
WCHAR)] =
'a';
671 attr.RootDirectory = 0;
695 "%u: NtCreateNamedPipeFile failed %x\n",
str.Length,
status );
721 memcpy(
str.Buffer, mailslotW,
sizeof(mailslotW) );
722 for (
i = 0;
i < 65536 /
sizeof(
WCHAR);
i++)
str.Buffer[
i +
sizeof(mailslotW)/
sizeof(
WCHAR)] =
'a';
741 "%u: NtCreateMailslotFile failed %x\n",
str.Length,
status );
762 memcpy(
str.Buffer, registryW,
sizeof(registryW) );
763 for (
i = 0;
i < 65536 /
sizeof(
WCHAR);
i++)
str.Buffer[
i +
sizeof(registryW)/
sizeof(
WCHAR)] =
'a';
772 str.Length =
sizeof(registryW) + 250 *
sizeof(
WCHAR) + 1;
777 "%u: NtCreateKey failed %x\n",
str.Length,
status );
783 str.Length =
sizeof(registryW) + 256 *
sizeof(
WCHAR);
786 "%u: NtCreateKey failed %x\n",
str.Length,
status );
800 str.Length =
sizeof(registryW) + 256 *
sizeof(
WCHAR);
823 str.Length =
sizeof(registryW) + 256 *
sizeof(
WCHAR) + 1;
828 "%u: NtCreateKey failed %x\n",
str.Length,
status );
838 "%u: NtOpenKey failed %x\n",
str.Length,
status );
857 "%u: NtCreateKey failed %x\n",
str.Length,
status );
863 "%u: NtOpenKey failed %x\n",
str.Length,
status );
869 "%u: NtCreateKey failed %x\n",
str.Length,
status );
875 "%u: NtOpenKey failed %x\n",
str.Length,
status );
881 "NULL: NtCreateKey failed %x\n",
status );
889 "NULL: NtOpenKey failed %x\n",
status );
896 pRtlFreeUnicodeString( &
str );
897 pRtlFreeUnicodeString( &
target );
911 "NtCreateDirectoryObject should have failed with STATUS_ACCESS_VIOLATION got(%08x)\n",
status);
914 "NtOpenDirectoryObject should have failed with STATUS_ACCESS_VIOLATION got(%08x)\n",
status);
921 "NtOpenDirectoryObject should have failed with STATUS_INVALID_PARAMETER got(%08x)\n",
status);
932 pRtlCreateUnicodeStringFromAsciiz(&
str,
"");
938 pRtlFreeUnicodeString(&
str);
947 pRtlCreateUnicodeStringFromAsciiz(&
str,
"\\BaseNamedObjects\\om.c-test");
952 pRtlFreeUnicodeString(&
str);
960 pRtlCreateUnicodeStringFromAsciiz(&
str,
"\\BaseNamedObjects\\Local");
970 pRtlFreeUnicodeString(&
str);
972 pRtlCreateUnicodeStringFromAsciiz(&
str,
"one more level");
975 pRtlFreeUnicodeString(&
str);
977 pRtlCreateUnicodeStringFromAsciiz( &
str,
"\\BaseNamedObjects\\Local\\om.c-test" );
981 pRtlFreeUnicodeString( &
str );
982 pRtlCreateUnicodeStringFromAsciiz( &
str,
"om.c-test" );
987 pRtlFreeUnicodeString( &
str );
989 pRtlCreateUnicodeStringFromAsciiz( &
str,
"om.c-event" );
996 pRtlFreeUnicodeString( &
str );
997 pRtlCreateUnicodeStringFromAsciiz( &
str,
"om.c-test\\om.c-event" );
1001 pRtlFreeUnicodeString( &
str );
1002 pRtlCreateUnicodeStringFromAsciiz( &
str,
"\\BasedNamedObjects\\Local\\om.c-test\\om.c-event" );
1006 pRtlFreeUnicodeString( &
str );
1018 full_len =
str.Length +
sizeof(
WCHAR);
1019 ok(
len == full_len,
"bad length %u/%u\n",
len, full_len );
1020 if (
len == full_len)
1023 str.MaximumLength =
str.Length;
1027 ok(
len == full_len,
"bad length %u/%u\n",
len, full_len );
1029 str.MaximumLength = 0;
1033 ok(
len == full_len,
"bad length %u/%u\n",
len, full_len );
1039 ok(
len == full_len,
"bad length %u/%u\n",
len, full_len );
1045 pRtlCreateUnicodeStringFromAsciiz(&
str,
"\\BaseNamedObjects");
1049 pRtlFreeUnicodeString(&
str);
1062 pRtlCreateUnicodeStringFromAsciiz(&
str,
"om.c-test");
1067 pRtlFreeUnicodeString(&
str);
1074 pRtlCreateUnicodeStringFromAsciiz(&
str,
"\\");
1081 pRtlFreeUnicodeString(&
str);
1085 pRtlCreateUnicodeStringFromAsciiz(&
str,
"\\BaseNamedObjects\\om.c-test");
1088 pRtlFreeUnicodeString(&
str);
1089 pRtlCreateUnicodeStringFromAsciiz(&
str,
"\\BaseNamedObjects\\om.c-test\\one more level");
1092 pRtlFreeUnicodeString(&
str);
1095 pRtlCreateUnicodeStringFromAsciiz(&
str,
"one more level");
1098 pRtlFreeUnicodeString(&
str);
1106 pRtlCreateUnicodeStringFromAsciiz(&
str,
"\\BaseNamedObjects\\Global\\om.c-test");
1109 pRtlFreeUnicodeString(&
str);
1110 pRtlCreateUnicodeStringFromAsciiz(&
str,
"\\BaseNamedObjects\\Local\\om.c-test\\one more level");
1113 pRtlFreeUnicodeString(&
str);
1116 pRtlCreateUnicodeStringFromAsciiz(&
str,
"one more level");
1119 pRtlFreeUnicodeString(&
str);
1127 pRtlCreateUnicodeStringFromAsciiz(&
str,
"\\BaseNamedObjects");
1130 pRtlFreeUnicodeString(&
str);
1134 pRtlCreateUnicodeStringFromAsciiz(&
str,
"\\om.c-mutant");
1137 "NtCreateMutant should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08x)\n",
status);
1138 pRtlFreeUnicodeString(&
str);
1139 pRtlCreateUnicodeStringFromAsciiz(&
str,
"\\om.c-mutant\\");
1142 "NtCreateMutant should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08x)\n",
status);
1143 pRtlFreeUnicodeString(&
str);
1145 pRtlCreateUnicodeStringFromAsciiz(&
str,
"om.c\\-mutant");
1148 "NtCreateMutant should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08x)\n",
status);
1149 pRtlFreeUnicodeString(&
str);
1151 pRtlCreateUnicodeStringFromAsciiz(&
str,
"om.c-mutant");
1154 pRtlFreeUnicodeString(&
str);
1170 pRtlCreateUnicodeStringFromAsciiz(&
target,
"\\DosDevices");
1173 "NtCreateSymbolicLinkObject got %08x\n",
status );
1176 "NtOpenSymbolicLinkObject got %08x\n",
status );
1180 "NtCreateSymbolicLinkObject should have failed with STATUS_ACCESS_VIOLATION got(%08x)\n",
status);
1183 "NtOpenSymbolicLinkObject should have failed with STATUS_INVALID_PARAMETER got(%08x)\n",
status);
1188 "NtCreateSymbolicLinkObject failed(%08x)\n",
status);
1189 pRtlFreeUnicodeString(&
target);
1196 "NtCreateSymbolicLinkObject should have failed with STATUS_INVALID_PARAMETER got(%08x)\n",
status);
1200 "NtOpenSymbolicLinkObject should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08x)\n",
status);
1203 pRtlCreateUnicodeStringFromAsciiz(&
target,
"anywhere");
1206 pRtlCreateUnicodeStringFromAsciiz(&
str,
"");
1211 "NtOpenSymbolicLinkObject should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08x)\n",
status);
1213 pRtlFreeUnicodeString(&
str);
1215 pRtlCreateUnicodeStringFromAsciiz(&
str,
"\\");
1218 "NtCreateSymbolicLinkObject should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08x)\n",
status);
1219 pRtlFreeUnicodeString(&
str);
1220 pRtlFreeUnicodeString(&
target);
1222 pRtlCreateUnicodeStringFromAsciiz( &
target,
"->Somewhere");
1224 pRtlCreateUnicodeStringFromAsciiz( &
str,
"BaseNamedObjects" );
1229 pRtlFreeUnicodeString( &
str );
1231 pRtlCreateUnicodeStringFromAsciiz( &
str,
"\\BaseNamedObjects\\" );
1236 pRtlFreeUnicodeString( &
str );
1238 pRtlCreateUnicodeStringFromAsciiz( &
str,
"\\\\BaseNamedObjects" );
1243 pRtlFreeUnicodeString( &
str );
1245 pRtlCreateUnicodeStringFromAsciiz( &
str,
"\\BaseNamedObjects\\\\om.c-test" );
1250 pRtlFreeUnicodeString( &
str );
1252 pRtlCreateUnicodeStringFromAsciiz( &
str,
"\\BaseNamedObjects\\om.c-test\\" );
1255 "NtCreateSymbolicLinkObject got %08x\n",
status );
1258 "NtOpenSymbolicLinkObject got %08x\n",
status );
1259 pRtlFreeUnicodeString( &
str );
1260 pRtlFreeUnicodeString(&
target);
1265 win_skip(
"couldn't find the BaseNamedObjects dir\n" );
1270 pRtlCreateUnicodeStringFromAsciiz(&
str,
"test-link");
1271 pRtlCreateUnicodeStringFromAsciiz(&
target,
"\\DosDevices");
1274 pRtlFreeUnicodeString(&
str);
1275 pRtlFreeUnicodeString(&
target);
1277 pRtlCreateUnicodeStringFromAsciiz(&
str,
"test-link\\NUL");
1282 pRtlFreeUnicodeString(&
str);
1291 static const WCHAR name[] = {
'\\',
'B',
'a',
's',
'e',
'N',
'a',
'm',
'e',
'd',
'O',
'b',
'j',
'e',
'c',
't',
's',
1292 '\\',
't',
'e',
's',
't',
'_',
'e',
'v',
'e',
'n',
't'};
1293 static const WCHAR type_event[] = {
'E',
'v',
'e',
'n',
't'};
1294 static const WCHAR type_file[] = {
'F',
'i',
'l',
'e'};
1295 static const WCHAR type_iocompletion[] = {
'I',
'o',
'C',
'o',
'm',
'p',
'l',
'e',
't',
'i',
'o',
'n'};
1296 static const WCHAR type_directory[] = {
'D',
'i',
'r',
'e',
'c',
't',
'o',
'r',
'y'};
1297 static const WCHAR type_section[] = {
'S',
'e',
'c',
't',
'i',
'o',
'n'};
1308 pRtlCreateUnicodeStringFromAsciiz( &
session, tmp_path );
1339 ok(
str->Length >=
sizeof(
name),
"unexpected len %u\n",
str->Length );
1362 ok(
str->Buffer && !
memcmp(
str->Buffer, type_event,
sizeof(type_event) ),
1378 ok(
str->Length == 0,
"unexpected len %u\n",
len );
1379 ok(
str->Buffer ==
NULL,
"unexpected ptr %p\n",
str->Buffer );
1392 "unexpected len %u\n",
len );
1398 "NtQueryObject failed %x\n",
status );
1400 "unexpected len %u\n",
len );
1406 "NtQueryObject failed %x\n",
status );
1408 "unexpected len %u\n",
len );
1417 ok(
len >= expected_len,
"unexpected len %u\n",
len );
1418 ok(
str->Buffer && !
memcmp(
str->Buffer, type_file,
sizeof(type_file) ),
1433 ok(
len >= expected_len,
"unexpected len %u\n",
len );
1434 ok(
str->Buffer && !
memcmp(
str->Buffer, type_file,
sizeof(type_file) ),
1448 ok(
len >= expected_len,
"unexpected len %u\n",
len );
1449 ok(
str->Buffer && !
memcmp(
str->Buffer, type_iocompletion,
sizeof(type_iocompletion) ),
1462 ok(
len >= expected_len,
"unexpected len %u\n",
len );
1463 ok(
str->Buffer && !
memcmp(
str->Buffer, type_directory,
sizeof(type_directory) ),
1467 size.u.LowPart = 256;
1468 size.u.HighPart = 0;
1478 ok(
len >= expected_len,
"unexpected len %u\n",
len );
1479 ok(
str->Buffer && !
memcmp(
str->Buffer, type_section,
sizeof(type_section) ),
1493 "unexpected len %u\n",
len );
1500 1, 1000, 1000, 1000,
NULL );
1510 "unexpected len %u\n",
len );
1516 pRtlCreateUnicodeStringFromAsciiz( &
path,
"\\REGISTRY\\Machine\\Software\\Classes" );
1519 "NtCreateKey failed status %x\n",
status );
1520 pRtlFreeUnicodeString( &
path );
1533 "unexpected len %u\n",
len );
1540 pRtlFreeUnicodeString( &
session );
1559 static const WCHAR typeW[] = {
'T',
'y',
'p',
'e'};
1560 static const WCHAR eventW[] = {
'E',
'v',
'e',
'n',
't'};
1574 ok(
len,
"len is zero\n");
1582 ok(
buffer->NumberOfTypes,
"NumberOfTypes is zero\n" );
1585 for (
i = 0;
i <
buffer->NumberOfTypes;
i++)
1595 if (
type->TypeName.Length ==
sizeof(eventW) && !
strncmpW(eventW,
type->TypeName.Buffer, 5))
1598 event_type_index =
type->TypeIndex;
1608 ok( event_type_index,
"Could not find object type for events\n" );
1614 ok( shi !=
NULL,
"Failed to allocate memory\n" );
1620 ok( shi !=
NULL,
"Failed to allocate memory\n" );
1652 attr.RootDirectory = 0;
1654 attr.Attributes = 0;
1656 attr.SecurityQualityOfService =
NULL;
1658 res = pNtCreateEvent( &
h, 0, &
attr, 0, 0 );
1659 ok(!
res,
"can't create event: %x\n",
res);
1661 res = pNtReleaseSemaphore(
h, 30,
NULL );
1675 static const WCHAR eventName[] = {
'\\',
'B',
'a',
's',
'e',
'N',
'a',
'm',
'e',
'd',
'O',
'b',
'j',
'e',
'c',
't',
's',
'\\',
't',
'e',
's',
't',
'E',
'v',
'e',
'n',
't',0};
1677 pRtlInitUnicodeString(&
str, eventName);
1688 ok(
info.EventType == 1 &&
info.EventState == 0,
1689 "NtQueryEvent failed, expected 1 0, got %d %d\n",
info.EventType,
info.EventState );
1698 ok(
info.EventType == 1 &&
info.EventState == 0,
1699 "NtQueryEvent failed, expected 1 0, got %d %d\n",
info.EventType,
info.EventState );
1704static const WCHAR keyed_nameW[] = {
'\\',
'B',
'a',
's',
'e',
'N',
'a',
'm',
'e',
'd',
'O',
'b',
'j',
'e',
'c',
't',
's',
1705 '\\',
'W',
'i',
'n',
'e',
'T',
'e',
's',
't',
'E',
'v',
'e',
'n',
't',0};
1717 attr.RootDirectory = 0;
1719 attr.Attributes = 0;
1721 attr.SecurityQualityOfService =
NULL;
1727 for (
i = 0;
i < 20;
i++)
1759 if (!pNtCreateKeyedEvent)
1761 win_skip(
"Keyed events not supported\n" );
1766 attr.RootDirectory = 0;
1768 attr.Attributes = 0;
1770 attr.SecurityQualityOfService =
NULL;
1806 for (
i = 0;
i < 20;
i++)
1878 "CreateEvent %x\n",
status );
1904 memset(&ov, 0,
sizeof(ov));
1907 pRtlCreateUnicodeStringFromAsciiz(&
str,
"\\Device\\Null");
1911 "expected STATUS_OBJECT_TYPE_MISMATCH, got %08x\n",
status);
1916 "expected STATUS_SUCCESS, got %08x\n",
status);
1920 ok(!
ret,
"WriteFile unexpectedly succeeded\n");
1922 "expected ERROR_INVALID_PARAMETER, got %u\n",
GetLastError());
1926 ok(!
ret,
"ReadFile unexpectedly succeeded\n");
1928 "expected ERROR_INVALID_PARAMETER, got %u\n",
GetLastError());
1930 num_bytes = 0xdeadbeef;
1939 num_bytes = 0xdeadbeef;
1943 ok(num_bytes ==
sizeof(
buf),
"expected num_bytes = %u, got %u\n",
1946 num_bytes = 0xdeadbeef;
1951 ok(!
ret,
"ReadFile unexpectedly succeeded\n");
1955 num_bytes = 0xdeadbeef;
1957 ok(!
ret,
"GetOverlappedResult unexpectedly succeeded\n");
1960 "expected ERROR_HANDLE_EOF, got %u\n",
GetLastError());
1969 "expected ERROR_FILE_NOT_FOUND, got %u\n",
GetLastError());
1976 "expected ERROR_PATH_NOT_FOUND, got %u\n",
GetLastError());
1978 pRtlFreeUnicodeString(&
str);
1996 ok(
info.CurrentCount == 0,
"expected 0, got %d\n",
info.CurrentCount );
1997 ok(
info.OwnedByCaller ==
TRUE,
"expected TRUE, got %d\n",
info.OwnedByCaller );
1998 ok(
info.AbandonedState ==
FALSE,
"expected FALSE, got %d\n",
info.AbandonedState );
2006 static const WCHAR name[] = {
'\\',
'B',
'a',
's',
'e',
'N',
'a',
'm',
'e',
'd',
'O',
'b',
'j',
'e',
'c',
't',
's',
2007 '\\',
't',
'e',
's',
't',
'_',
'm',
'u',
't',
'a',
'n',
't',0};
2018 pRtlInitUnicodeString(&
str,
name);
2026 "Failed to NtQueryMutant, expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n",
status );
2029 "Failed to NtQueryMutant, expected STATUS_INVALID_INFO_CLASS, got %08x\n",
status );
2032 "Failed to NtQueryMutant, expected STATUS_INVALID_HANDLE, got %08x\n",
status );
2039 ok(
info.CurrentCount == 0,
"expected 0, got %d\n",
info.CurrentCount );
2040 ok(
info.OwnedByCaller ==
TRUE,
"expected TRUE, got %d\n",
info.OwnedByCaller );
2041 ok(
info.AbandonedState ==
FALSE,
"expected FALSE, got %d\n",
info.AbandonedState );
2050 ok(
info.CurrentCount == -1,
"expected -1, got %d\n",
info.CurrentCount );
2051 ok(
info.OwnedByCaller ==
TRUE,
"expected TRUE, got %d\n",
info.OwnedByCaller );
2052 ok(
info.AbandonedState ==
FALSE,
"expected FALSE, got %d\n",
info.AbandonedState );
2055 status = pNtReleaseMutant(mutant, &prev);
2057 ok( prev == -1,
"NtQueryRelease failed, expected -1, got %d\n", prev );
2060 status = pNtReleaseMutant(mutant, &prev);
2062 ok( prev == 0,
"NtQueryRelease failed, expected 0, got %d\n", prev );
2067 ok(
info.CurrentCount == 1,
"expected 1, got %d\n",
info.CurrentCount );
2068 ok(
info.OwnedByCaller ==
FALSE,
"expected FALSE, got %d\n",
info.OwnedByCaller );
2069 ok(
info.AbandonedState ==
FALSE,
"expected FALSE, got %d\n",
info.AbandonedState );
2080 ok(
info.CurrentCount == 1,
"expected 0, got %d\n",
info.CurrentCount );
2081 ok(
info.OwnedByCaller ==
FALSE,
"expected FALSE, got %d\n",
info.OwnedByCaller );
2082 ok(
info.AbandonedState ==
TRUE,
"expected TRUE, got %d\n",
info.AbandonedState );
2090 ok(
info.CurrentCount == 0,
"expected 0, got %d\n",
info.CurrentCount );
2091 ok(
info.OwnedByCaller ==
TRUE,
"expected TRUE, got %d\n",
info.OwnedByCaller );
2092 ok(
info.AbandonedState ==
FALSE,
"expected FALSE, got %d\n",
info.AbandonedState );
2104 skip(
"not running on NT, skipping test\n");
2110 pRtlCreateUnicodeStringFromAsciiz = (
void *)
GetProcAddress(
hntdll,
"RtlCreateUnicodeStringFromAsciiz");
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define FILE_DIRECTORY_FILE
#define STATUS_INVALID_HANDLE
#define STATUS_NOT_IMPLEMENTED
#define STATUS_OBJECT_TYPE_MISMATCH
#define ERROR_INVALID_PARAMETER
#define ReadFile(a, b, c, d, e)
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define HeapFree(x, y, z)
#define FILE_ATTRIBUTE_NORMAL
#define ERROR_ACCESS_DENIED
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
HANDLE WINAPI CreateMailslotA(IN LPCSTR lpName, IN DWORD nMaxMessageSize, IN DWORD lReadTimeout, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
BOOL WINAPI VerifyVersionInfoW(IN LPOSVERSIONINFOEXW lpVersionInformation, IN DWORD dwTypeMask, IN DWORDLONG dwlConditionMask)
static const WCHAR typeW[]
struct _UNICODE_STRING UNICODE_STRING
HANDLE NTAPI CreateFileMappingA(IN HANDLE hFile, IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes, IN DWORD flProtect, IN DWORD dwMaximumSizeHigh, IN DWORD dwMaximumSizeLow, IN LPCSTR lpName)
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
enum _SYSTEM_INFORMATION_CLASS SYSTEM_INFORMATION_CLASS
GLuint GLuint GLsizei GLenum type
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLsizei GLsizei * length
GLfloat GLfloat GLfloat GLfloat h
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define OBJ_CASE_INSENSITIVE
BOOL WINAPI GetOverlappedResult(IN HANDLE hFile, IN LPOVERLAPPED lpOverlapped, OUT LPDWORD lpNumberOfBytesTransferred, IN BOOL bWait)
#define memcpy(s1, s2, n)
#define ERROR_ALREADY_EXISTS
#define FILE_FLAG_BACKUP_SEMANTICS
#define ERROR_FILE_NOT_FOUND
#define sprintf(buf, format,...)
static HINSTANCE hkernel32
#define IO_COMPLETION_ALL_ACCESS
static PIO_STATUS_BLOCK iosb
#define InitializeObjectAttributes(p, n, a, r, s)
@ SystemExtendedHandleInformation
#define FILE_PIPE_FULL_DUPLEX
struct _OBJECT_TYPE_INFORMATION OBJECT_TYPE_INFORMATION
#define VER_GREATER_EQUAL
HANDLE WINAPI CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
#define SECTION_MAP_WRITE
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
#define VER_SET_CONDITION(ConditionMask, TypeBitMask, ComparisonType)
#define STATUS_PIPE_NOT_AVAILABLE
#define STATUS_OBJECT_PATH_SYNTAX_BAD
#define STATUS_OBJECT_NAME_EXISTS
#define STATUS_ACCESS_VIOLATION
#define STATUS_INVALID_INFO_CLASS
#define STATUS_INVALID_PARAMETER_1
#define STATUS_INSTANCE_NOT_AVAILABLE
static const POBJECT_ATTRIBUTES
static MUTANT_INFORMATION_CLASS
static const const HANDLE
static const WCHAR keyed_nameW[]
static void test_name_limits(void)
#define SYMBOLIC_LINK_QUERY
static void test_directory(void)
static LPCSTR wine_dbgstr_us(const UNICODE_STRING *us)
static void test_case_sensitive(void)
#define KEYEDEVENT_ALL_ACCESS
static void test_type_mismatch(void)
static void test_namespace_pipe(void)
#define ROUND_UP(value, alignment)
static void test_symboliclink(void)
static void test_query_object_types(void)
static BOOL winver_equal_or_newer(WORD major, WORD minor)
static HANDLE get_base_dir(void)
static void test_all_kernel_objects(UINT line, OBJECT_ATTRIBUTES *attr, NTSTATUS create_expect, NTSTATUS open_expect)
static void test_mutant(void)
static void test_event(void)
static OBJECT_INFORMATION_CLASS
static BOOL is_correct_dir(HANDLE dir, const char *name)
static DWORD WINAPI keyed_event_thread(void *arg)
static void test_name_collisions(void)
static EVENT_INFORMATION_CLASS
static void test_keyed_events(void)
static void test_query_object(void)
static DWORD WINAPI mutant_thread(void *arg)
static void test_null_device(void)
#define DIR_TEST_CREATE_OPEN(n, e)
#define strncmpW(s1, s2, n)
#define STATUS_BUFFER_TOO_SMALL
#define STATUS_BUFFER_OVERFLOW
PUNICODE_STRING ObjectName
ULONG_PTR UniqueProcessId
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreA(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCSTR lpName OPTIONAL)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexA(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCSTR lpName OPTIONAL)
#define STATUS_ACCESS_DENIED
#define STATUS_OBJECT_PATH_NOT_FOUND
#define STATUS_INVALID_PARAMETER
#define STATUS_OBJECT_NAME_COLLISION
#define STATUS_INFO_LENGTH_MISMATCH
#define STATUS_OBJECT_NAME_INVALID
#define STATUS_INSUFFICIENT_RESOURCES
#define STATUS_OBJECT_NAME_NOT_FOUND
#define PIPE_READMODE_BYTE
DWORD WINAPI GetLastError(void)
#define PIPE_ACCESS_DUPLEX
DWORD WINAPI GetCurrentProcessId(void)
#define ERROR_PATH_NOT_FOUND