ReactOS 0.4.15-dev-8127-g6338913
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
11static
12VOID
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);
36 if (ServerHandle != NULL && ServerHandle != INVALID_HANDLE_VALUE)
37 ObCloseHandle(ServerHandle, KernelMode);
38
39 ServerHandle = INVALID_HANDLE_VALUE;
40 Status = NpCreatePipe(&ServerHandle,
43 MaxInstances,
44 InQuota,
45 OutQuota);
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);
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
94static
95VOID
97{
98}
99
100static KSTART_ROUTINE RunTest;
101static
102VOID
103NTAPI
106{
109 TestCreate();
110}
111
112START_TEST(NpfsCreate)
113{
115
118}
static VOID TestCreateNamedPipe(VOID)
Definition: NpfsCreate.c:13
static VOID TestCreate(VOID)
Definition: NpfsCreate.c:96
static KSTART_ROUTINE RunTest
Definition: NpfsCreate.c:100
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define ok_eq_pointer(value, expected)
Definition: apitest.h:59
#define ok_eq_hex(value, expected)
Definition: apitest.h:77
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define KeDelayExecutionThread(mode, foo, t)
Definition: env_spec_w32.h:484
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
Status
Definition: gdiplustypes.h:25
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 FILE_PIPE_LISTENING_STATE
Definition: winternl.h:791
PKTHREAD KmtStartThread(IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext OPTIONAL)
VOID KmtFinishThread(IN PKTHREAD Thread OPTIONAL, IN PKEVENT Event OPTIONAL)
#define BYTE_STREAM
Definition: npfs.h:13
#define DUPLEX
Definition: npfs.h:21
#define DEVICE_NAMED_PIPE
Definition: npfs.h:11
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 NpCheckServerPipe(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps)
Definition: npfs.h:95
#define QUEUE
Definition: npfs.h:17
#define KernelMode
Definition: asm.h:34
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
_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
#define L(x)
Definition: ntvdm.h:50
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3379
static ULONG Timeout
Definition: ping.c:61
#define STATUS_SUCCESS
Definition: shellext.h:65
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148