ReactOS  0.4.14-dev-98-gb0d4763
NpfsCreate.c File Reference
#include <kmt_test.h>
#include "npfs.h"
Include dependency graph for NpfsCreate.c:

Go to the source code of this file.

Functions

static VOID TestCreateNamedPipe (VOID)
 
static VOID TestCreate (VOID)
 
static VOID NTAPI RunTest (IN PVOID Context)
 
 START_TEST (NpfsCreate)
 

Variables

static KSTART_ROUTINE RunTest
 

Function Documentation

◆ RunTest()

static VOID NTAPI RunTest ( IN PVOID  Context)
static

Definition at line 104 of file NpfsCreate.c.

106 {
109  TestCreate();
110 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
static VOID TestCreateNamedPipe(VOID)
Definition: NpfsCreate.c:13
static VOID TestCreate(VOID)
Definition: NpfsCreate.c:96

◆ START_TEST()

START_TEST ( NpfsCreate  )

Definition at line 112 of file NpfsCreate.c.

113 {
115 
118 }
PKTHREAD KmtStartThread(IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext OPTIONAL)
static KSTART_ROUTINE RunTest
Definition: NpfsCreate.c:100
smooth NULL
Definition: ftsmooth.c:416
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
VOID KmtFinishThread(IN PKTHREAD Thread OPTIONAL, IN PKEVENT Event OPTIONAL)

◆ TestCreate()

static VOID TestCreate ( VOID  )
static

Definition at line 96 of file NpfsCreate.c.

97 {
98 }

Referenced by RunTest().

◆ TestCreateNamedPipe()

static VOID TestCreateNamedPipe ( VOID  )
static

Definition at line 13 of file NpfsCreate.c.

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 }
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 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
#define DEVICE_NAMED_PIPE
Definition: npfs.h:11
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
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 NpCheckServerPipe(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps)
Definition: npfs.h:95
NTSTATUS NTAPI KeDelayExecutionThread(IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Interval OPTIONAL)
Definition: wait.c:283
smooth NULL
Definition: ftsmooth.c:416
#define FILE_PIPE_LISTENING_STATE
Definition: winternl.h:791
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#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
Status
Definition: gdiplustypes.h:24
static ULONG Timeout
Definition: ping.c:61
#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 QUEUE
Definition: npfs.h:17
#define skip(...)
Definition: atltest.h:64
unsigned int ULONG
Definition: retypes.h:1
#define ok_eq_hex(value, expected)
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by RunTest().

Variable Documentation

◆ RunTest

KSTART_ROUTINE RunTest
static

Definition at line 100 of file NpfsCreate.c.

Referenced by START_TEST().