2 * PROJECT: ReactOS kernel-mode tests
3 * LICENSE: LGPLv2+ - See COPYING.LIB in the top level directory
4 * PURPOSE: Kernel-Mode Test Suite NPFS Create test
5 * PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
13 TestCreateNamedPipe(VOID
)
18 ULONG InQuota
, OutQuota
;
19 ULONG Quotas
[] = { 0, 1, 2, 1024, PAGE_SIZE
- 1, PAGE_SIZE
, PAGE_SIZE
+ 1, 2 * PAGE_SIZE
, 8 * PAGE_SIZE
, 64 * PAGE_SIZE
, 64 * PAGE_SIZE
+ 1, 128 * PAGE_SIZE
};
21 LARGE_INTEGER Timeout
;
23 /* Invalid pipe name */
27 ServerHandle
= INVALID_HANDLE_VALUE
;
28 Status
= NpCreatePipe(&ServerHandle
,
29 DEVICE_NAMED_PIPE L
"",
30 BYTE_STREAM
, QUEUE
, BYTE_STREAM
, DUPLEX
,
34 ok_eq_hex(Status
, STATUS_OBJECT_NAME_INVALID
);
35 ok_eq_pointer(ServerHandle
, INVALID_HANDLE_VALUE
);
36 if (ServerHandle
!= NULL
&& ServerHandle
!= INVALID_HANDLE_VALUE
)
37 ObCloseHandle(ServerHandle
, KernelMode
);
39 ServerHandle
= INVALID_HANDLE_VALUE
;
40 Status
= NpCreatePipe(&ServerHandle
,
41 DEVICE_NAMED_PIPE L
"\\",
42 BYTE_STREAM
, QUEUE
, BYTE_STREAM
, DUPLEX
,
46 ok_eq_hex(Status
, STATUS_OBJECT_NAME_INVALID
);
47 ok_eq_pointer(ServerHandle
, INVALID_HANDLE_VALUE
);
48 if (ServerHandle
!= NULL
&& ServerHandle
!= INVALID_HANDLE_VALUE
)
49 ObCloseHandle(ServerHandle
, KernelMode
);
51 ServerHandle
= INVALID_HANDLE_VALUE
;
52 Status
= NpCreatePipe(&ServerHandle
,
53 DEVICE_NAMED_PIPE L
"\\\\",
54 BYTE_STREAM
, QUEUE
, BYTE_STREAM
, DUPLEX
,
58 ok_eq_hex(Status
, STATUS_OBJECT_NAME_INVALID
);
59 ok_eq_pointer(ServerHandle
, INVALID_HANDLE_VALUE
);
60 if (ServerHandle
!= NULL
&& ServerHandle
!= INVALID_HANDLE_VALUE
)
61 ObCloseHandle(ServerHandle
, KernelMode
);
66 for (i
= 0; i
< RTL_NUMBER_OF(Quotas
); i
++)
69 ServerHandle
= INVALID_HANDLE_VALUE
;
70 Status
= NpCreatePipe(&ServerHandle
,
71 DEVICE_NAMED_PIPE L
"\\KmtestNpfsCreateTestPipe",
72 BYTE_STREAM
, QUEUE
, BYTE_STREAM
, DUPLEX
,
76 ok_eq_hex(Status
, STATUS_SUCCESS
);
77 ok(ServerHandle
!= NULL
&& ServerHandle
!= INVALID_HANDLE_VALUE
, "ServerHandle = %p\n", ServerHandle
);
78 if (!skip(NT_SUCCESS(Status
) && ServerHandle
!= NULL
&& ServerHandle
!= INVALID_HANDLE_VALUE
, "No pipe\n"))
80 NpCheckServerPipe(ServerHandle
,
81 BYTE_STREAM
, QUEUE
, BYTE_STREAM
, DUPLEX
,
85 FILE_PIPE_LISTENING_STATE
);
86 ObCloseHandle(ServerHandle
, KernelMode
);
87 Timeout
.QuadPart
= -100 * 1000 * 10;
88 Status
= KeDelayExecutionThread(KernelMode
, FALSE
, &Timeout
);
89 ok_eq_hex(Status
, STATUS_SUCCESS
);
100 static KSTART_ROUTINE RunTest
;
107 UNREFERENCED_PARAMETER(Context
);
108 TestCreateNamedPipe();
112 START_TEST(NpfsCreate
)
116 Thread
= KmtStartThread(RunTest
, NULL
);
117 KmtFinishThread(Thread
, NULL
);