ReactOS  0.4.15-dev-1397-g19779b3
NpfsCreate.c
Go to the documentation of this file.
1 /*
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>
6  */
7 
8 #include <kmt_test.h>
9 #include "npfs.h"
10 
11 static
12 VOID
14 {
16  HANDLE ServerHandle;
17  ULONG MaxInstances;
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 };
20  ULONG i;
22 
23  /* Invalid pipe name */
24  MaxInstances = 1;
25  InQuota = 4096;
26  OutQuota = 4096;
27  ServerHandle = INVALID_HANDLE_VALUE;
28  Status = NpCreatePipe(&ServerHandle,
31  MaxInstances,
32  InQuota,
33  OutQuota);
35  ok_eq_pointer(ServerHandle, INVALID_HANDLE_VALUE);
36  if (ServerHandle != NULL && ServerHandle != INVALID_HANDLE_VALUE)
37  ObCloseHandle(ServerHandle, KernelMode);
38 
39  ServerHandle = INVALID_HANDLE_VALUE;
40  Status = NpCreatePipe(&ServerHandle,
41  DEVICE_NAMED_PIPE L"\\",
43  MaxInstances,
44  InQuota,
45  OutQuota);
47  ok_eq_pointer(ServerHandle, INVALID_HANDLE_VALUE);
48  if (ServerHandle != NULL && ServerHandle != INVALID_HANDLE_VALUE)
49  ObCloseHandle(ServerHandle, KernelMode);
50 
51  ServerHandle = INVALID_HANDLE_VALUE;
52  Status = NpCreatePipe(&ServerHandle,
53  DEVICE_NAMED_PIPE L"\\\\",
55  MaxInstances,
56  InQuota,
57  OutQuota);
59  ok_eq_pointer(ServerHandle, INVALID_HANDLE_VALUE);
60  if (ServerHandle != NULL && ServerHandle != INVALID_HANDLE_VALUE)
61  ObCloseHandle(ServerHandle, KernelMode);
62 
63  /* Test in-quota */
64  MaxInstances = 1;
65  OutQuota = 4096;
66  for (i = 0; i < RTL_NUMBER_OF(Quotas); i++)
67  {
68  InQuota = Quotas[i];
69  ServerHandle = INVALID_HANDLE_VALUE;
70  Status = NpCreatePipe(&ServerHandle,
71  DEVICE_NAMED_PIPE L"\\KmtestNpfsCreateTestPipe",
73  MaxInstances,
74  InQuota,
75  OutQuota);
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"))
79  {
80  NpCheckServerPipe(ServerHandle,
82  MaxInstances, 1,
83  InQuota, 0,
84  OutQuota, OutQuota,
86  ObCloseHandle(ServerHandle, KernelMode);
87  Timeout.QuadPart = -100 * 1000 * 10;
90  }
91  }
92 }
93 
94 static
95 VOID
97 {
98 }
99 
100 static KSTART_ROUTINE RunTest;
101 static
102 VOID
103 NTAPI
105  IN PVOID Context)
106 {
109  TestCreate();
110 }
111 
112 START_TEST(NpfsCreate)
113 {
115 
118 }
NTSTATUS NpCreatePipe(OUT PHANDLE ServerHandle, IN PCWSTR PipePath, IN ULONG ReadMode, IN ULONG CompletionMode, IN ULONG NamedPipeType, IN ULONG NamedPipeConfiguration, IN ULONG MaximumInstances, IN ULONG InboundQuota, IN ULONG OutboundQuota)
#define IN
Definition: typedefs.h:39
PKTHREAD KmtStartThread(IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext OPTIONAL)
static KSTART_ROUTINE RunTest
Definition: NpfsCreate.c:100
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define ok_eq_pointer(value, expected)
LONG NTSTATUS
Definition: precomp.h:26
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG _Inout_ PLUID _Out_ PHANDLE _Out_ PQUOTA_LIMITS Quotas
static VOID TestCreateNamedPipe(VOID)
Definition: NpfsCreate.c:13
#define DEVICE_NAMED_PIPE
Definition: npfs.h:11
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define NpCheckServerPipe(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps)
Definition: npfs.h:95
#define FALSE
Definition: types.h:117
NTSTATUS NTAPI KeDelayExecutionThread(IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Interval OPTIONAL)
Definition: wait.c:283
Status
Definition: gdiplustypes.h:24
START_TEST(NpfsCreate)
Definition: NpfsCreate.c:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
static VOID TestCreate(VOID)
Definition: NpfsCreate.c:96
#define DUPLEX
Definition: npfs.h:21
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3376
static const WCHAR L[]
Definition: oid.c:1250
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define BYTE_STREAM
Definition: npfs.h:13
VOID KmtFinishThread(IN PKTHREAD Thread OPTIONAL, IN PKEVENT Event OPTIONAL)
static ULONG Timeout
Definition: ping.c:61
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
Definition: glfuncs.h:248
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define ok(value,...)
Definition: atltest.h:57
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
#define NULL
Definition: types.h:112
#define QUEUE
Definition: npfs.h:17
#define skip(...)
Definition: atltest.h:64
unsigned int ULONG
Definition: retypes.h:1
#define ok_eq_hex(value, expected)
#define STATUS_SUCCESS
Definition: shellext.h:65
#define FILE_PIPE_LISTENING_STATE
Definition: winternl.h:791