ReactOS  0.4.15-dev-1054-gd029a62
npfs.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _THREAD_CONTEXT
 

Macros

#define DEVICE_NAMED_PIPE   L"\\Device\\NamedPipe"
 
#define BYTE_STREAM   FILE_PIPE_BYTE_STREAM_MODE
 
#define MESSAGE   FILE_PIPE_MESSAGE_MODE
 
#define QUEUE   FILE_PIPE_QUEUE_OPERATION
 
#define COMPLETE   FILE_PIPE_COMPLETE_OPERATION
 
#define INBOUND   FILE_PIPE_INBOUND
 
#define OUTBOUND   FILE_PIPE_OUTBOUND
 
#define DUPLEX   FILE_PIPE_FULL_DUPLEX
 
#define NpListenPipe(ServerHandle)   NpControlPipe(ServerHandle, FSCTL_PIPE_LISTEN, NULL, 0)
 
#define NpDisconnectPipe(ServerHandle)   NpControlPipe(ServerHandle, FSCTL_PIPE_DISCONNECT, NULL, 0)
 
#define NpCheckServerPipe(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps)   NpCheckServerPipe__(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps, __FILE__, __LINE__)
 
#define NpCheckServerPipe__(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps, file, line)   NpCheckServerPipe_(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps, file ":" KMT_STRINGIZE(line))
 
#define NpCheckClientPipe(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps)   NpCheckClientPipe__(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps, __FILE__, __LINE__)
 
#define NpCheckClientPipe__(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps, file, line)   NpCheckClientPipe_(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps, file ":" KMT_STRINGIZE(line))
 
#define NpQueryPipe(h, es)   NpQueryPipe__(h, es, __FILE__, __LINE__)
 
#define NpQueryPipe__(h, es, file, line)   NpQueryPipe_(h, es, file ":" KMT_STRINGIZE(line))
 

Typedefs

typedef VOID() WORK_FUNCTION(IN OUT struct _THREAD_CONTEXT *)
 
typedef WORK_FUNCTIONPWORK_FUNCTION
 
typedef struct _THREAD_CONTEXT THREAD_CONTEXT
 
typedef struct _THREAD_CONTEXTPTHREAD_CONTEXT
 

Functions

 C_ASSERT (FILE_PIPE_BYTE_STREAM_MODE==FILE_PIPE_BYTE_STREAM_TYPE)
 
 C_ASSERT (FILE_PIPE_MESSAGE_MODE==FILE_PIPE_MESSAGE_TYPE)
 
NTSTATUS NpCreatePipeEx (OUT PHANDLE ServerHandle, IN PCWSTR PipePath, IN ULONG ReadMode, IN ULONG CompletionMode, IN ULONG NamedPipeType, IN ULONG ShareAccess, IN ULONG MaximumInstances, IN ULONG InboundQuota, IN ULONG OutboundQuota, IN ACCESS_MASK DesiredAccess, IN ULONG Disposition, IN ULONG CreateOptions, IN PLARGE_INTEGER DefaultTimeout OPTIONAL)
 
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)
 
NTSTATUS NpOpenPipeEx (OUT PHANDLE ClientHandle, IN PCWSTR PipePath, IN ACCESS_MASK DesiredAccess, IN ULONG ShareAccess, IN ULONG Disposition, IN ULONG CreateOptions)
 
NTSTATUS NpOpenPipe (OUT PHANDLE ClientHandle, IN PCWSTR PipePath, IN ULONG NamedPipeConfiguration)
 
NTSTATUS NpControlPipe (IN HANDLE PipeHandle, IN ULONG FsControlCode, IN PVOID InputBuffer, IN ULONG InputBufferLength)
 
NTSTATUS NpWaitPipe (IN PCWSTR PipeName, IN PLARGE_INTEGER Timeout)
 
NTSTATUS NpReadPipe (IN HANDLE PipeHandle, OUT PVOID Buffer, IN ULONG BufferSize, OUT PULONG_PTR BytesRead)
 
NTSTATUS NpWritePipe (IN HANDLE PipeHandle, IN const VOID *Buffer, IN ULONG BufferSize, OUT PULONG_PTR BytesWritten)
 
VOID NpCheckServerPipe_ (IN HANDLE ServerHandle, IN ULONG ReadMode, IN ULONG CompletionMode, IN ULONG NamedPipeType, IN ULONG NamedPipeConfiguration, IN ULONG MaximumInstances, IN ULONG CurrentInstances, IN ULONG InboundQuota, IN ULONG ReadDataAvailable, IN ULONG OutboundQuota, IN ULONG WriteQuotaAvailable, IN ULONG NamedPipeState, IN PCSTR FileAndLine)
 
VOID NpCheckClientPipe_ (IN HANDLE ClientHandle, IN ULONG ReadMode, IN ULONG CompletionMode, IN ULONG NamedPipeType, IN ULONG NamedPipeConfiguration, IN ULONG MaximumInstances, IN ULONG CurrentInstances, IN ULONG InboundQuota, IN ULONG ReadDataAvailable, IN ULONG OutboundQuota, IN ULONG WriteQuotaAvailable, IN ULONG NamedPipeState, IN PCSTR FileAndLine)
 
VOID NpQueryPipe_ (IN HANDLE Handle, IN NTSTATUS ExpectedStatus, IN PCSTR FileAndLine)
 
VOID StartWorkerThread (OUT PTHREAD_CONTEXT Context)
 
VOID FinishWorkerThread (IN PTHREAD_CONTEXT Context)
 
BOOLEAN WaitForWork (IN PTHREAD_CONTEXT Context, IN ULONG MilliSeconds)
 
BOOLEAN TriggerWork (IN PTHREAD_CONTEXT Context, IN ULONG MilliSeconds)
 

Macro Definition Documentation

◆ BYTE_STREAM

Definition at line 13 of file npfs.h.

◆ COMPLETE

Definition at line 18 of file npfs.h.

◆ DEVICE_NAMED_PIPE

#define DEVICE_NAMED_PIPE   L"\\Device\\NamedPipe"

Definition at line 11 of file npfs.h.

◆ DUPLEX

Definition at line 21 of file npfs.h.

◆ INBOUND

#define INBOUND   FILE_PIPE_INBOUND

Definition at line 19 of file npfs.h.

◆ MESSAGE

Definition at line 15 of file npfs.h.

◆ NpCheckClientPipe

#define NpCheckClientPipe (   h,
  rm,
  cm,
  npt,
  npc,
  mi,
  ci,
  iq,
  rsa,
  oq,
  wqa,
  nps 
)    NpCheckClientPipe__(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps, __FILE__, __LINE__)

Definition at line 121 of file npfs.h.

◆ NpCheckClientPipe__

#define NpCheckClientPipe__ (   h,
  rm,
  cm,
  npt,
  npc,
  mi,
  ci,
  iq,
  rsa,
  oq,
  wqa,
  nps,
  file,
  line 
)    NpCheckClientPipe_(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps, file ":" KMT_STRINGIZE(line))

Definition at line 124 of file npfs.h.

◆ NpCheckServerPipe

#define NpCheckServerPipe (   h,
  rm,
  cm,
  npt,
  npc,
  mi,
  ci,
  iq,
  rsa,
  oq,
  wqa,
  nps 
)    NpCheckServerPipe__(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps, __FILE__, __LINE__)

Definition at line 95 of file npfs.h.

◆ NpCheckServerPipe__

#define NpCheckServerPipe__ (   h,
  rm,
  cm,
  npt,
  npc,
  mi,
  ci,
  iq,
  rsa,
  oq,
  wqa,
  nps,
  file,
  line 
)    NpCheckServerPipe_(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps, file ":" KMT_STRINGIZE(line))

Definition at line 98 of file npfs.h.

◆ NpDisconnectPipe

#define NpDisconnectPipe (   ServerHandle)    NpControlPipe(ServerHandle, FSCTL_PIPE_DISCONNECT, NULL, 0)

Definition at line 74 of file npfs.h.

◆ NpListenPipe

#define NpListenPipe (   ServerHandle)    NpControlPipe(ServerHandle, FSCTL_PIPE_LISTEN, NULL, 0)

Definition at line 73 of file npfs.h.

◆ NpQueryPipe

#define NpQueryPipe (   h,
  es 
)    NpQueryPipe__(h, es, __FILE__, __LINE__)

Definition at line 147 of file npfs.h.

◆ NpQueryPipe__

#define NpQueryPipe__ (   h,
  es,
  file,
  line 
)    NpQueryPipe_(h, es, file ":" KMT_STRINGIZE(line))

Definition at line 150 of file npfs.h.

◆ OUTBOUND

#define OUTBOUND   FILE_PIPE_OUTBOUND

Definition at line 20 of file npfs.h.

◆ QUEUE

Definition at line 17 of file npfs.h.

Typedef Documentation

◆ PTHREAD_CONTEXT

◆ PWORK_FUNCTION

Definition at line 162 of file npfs.h.

◆ THREAD_CONTEXT

◆ WORK_FUNCTION

typedef VOID() WORK_FUNCTION(IN OUT struct _THREAD_CONTEXT *)

Definition at line 161 of file npfs.h.

Function Documentation

◆ C_ASSERT() [1/2]

◆ C_ASSERT() [2/2]

◆ FinishWorkerThread()

VOID FinishWorkerThread ( IN PTHREAD_CONTEXT  Context)

Definition at line 685 of file NpfsHelpers.c.

687 {
688  KmtFinishThread(Context->Thread, &Context->ThreadDoneEvent);
689 }
VOID KmtFinishThread(IN PKTHREAD Thread OPTIONAL, IN PKEVENT Event OPTIONAL)

Referenced by TestConnect(), and TestReadWrite().

◆ NpCheckClientPipe_()

VOID NpCheckClientPipe_ ( IN HANDLE  ClientHandle,
IN ULONG  ReadMode,
IN ULONG  CompletionMode,
IN ULONG  NamedPipeType,
IN ULONG  NamedPipeConfiguration,
IN ULONG  MaximumInstances,
IN ULONG  CurrentInstances,
IN ULONG  InboundQuota,
IN ULONG  ReadDataAvailable,
IN ULONG  OutboundQuota,
IN ULONG  WriteQuotaAvailable,
IN ULONG  NamedPipeState,
IN PCSTR  FileAndLine 
)

Definition at line 520 of file NpfsHelpers.c.

538 {
542  FILE_PIPE_LOCAL_INFORMATION PipeLocalInfo;
543  FILE_PIPE_REMOTE_INFORMATION PipeRemoteInfo;
544 
545  RtlFillMemory(&IoStatusBlock, sizeof(IoStatusBlock), 0x55);
546  RtlFillMemory(&PipeInfo, sizeof(PipeInfo), 0x55);
547  Status = ZwQueryInformationFile(ClientHandle,
548  &IoStatusBlock,
549  &PipeInfo,
550  sizeof(PipeInfo),
555  ok_eq_ulong_(PipeInfo.ReadMode, ReadMode);
556  ok_eq_ulong_(PipeInfo.CompletionMode, CompletionMode);
557 
558  RtlFillMemory(&IoStatusBlock, sizeof(IoStatusBlock), 0x55);
559  RtlFillMemory(&PipeLocalInfo, sizeof(PipeLocalInfo), 0x55);
560  Status = ZwQueryInformationFile(ClientHandle,
561  &IoStatusBlock,
562  &PipeLocalInfo,
563  sizeof(PipeLocalInfo),
567  ok_eq_ulongptr_(IoStatusBlock.Information, sizeof(PipeLocalInfo));
568  ok_eq_ulong_(PipeLocalInfo.NamedPipeType, NamedPipeType);
569  ok_eq_ulong_(PipeLocalInfo.NamedPipeConfiguration, NamedPipeConfiguration);
570  ok_eq_ulong_(PipeLocalInfo.MaximumInstances, MaximumInstances);
571  ok_eq_ulong_(PipeLocalInfo.CurrentInstances, CurrentInstances);
572  ok_eq_ulong_(PipeLocalInfo.InboundQuota, InboundQuota);
573  ok_eq_ulong_(PipeLocalInfo.ReadDataAvailable, ReadDataAvailable);
574  ok_eq_ulong_(PipeLocalInfo.OutboundQuota, OutboundQuota);
575  ok_eq_ulong_(PipeLocalInfo.WriteQuotaAvailable, WriteQuotaAvailable);
576  ok_eq_ulong_(PipeLocalInfo.NamedPipeState, NamedPipeState);
578 
579  RtlFillMemory(&IoStatusBlock, sizeof(IoStatusBlock), 0x55);
580  RtlFillMemory(&PipeRemoteInfo, sizeof(PipeRemoteInfo), 0x55);
581  Status = ZwQueryInformationFile(ClientHandle,
582  &IoStatusBlock,
583  &PipeRemoteInfo,
584  sizeof(PipeRemoteInfo),
589  ok_eq_ulonglong_(PipeRemoteInfo.CollectDataTime.QuadPart, 0ULL);
590  ok_eq_ulong_(PipeRemoteInfo.MaximumCollectionCount, 0x55555555UL);
591 }
ULONG NamedPipeConfiguration
Definition: pipe.c:43
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_PIPE_CLIENT_END
Definition: iotypes.h:84
LARGE_INTEGER CollectDataTime
Definition: iotypes.h:5895
#define ok_eq_ulong_(value, expected)
Definition: NpfsHelpers.c:436
#define ULL(a, b)
Definition: format_msg.c:27
_In_ PUSBD_PIPE_INFORMATION PipeInfo
Definition: hubbusif.h:294
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
#define RTL_SIZEOF_THROUGH_FIELD(type, field)
Definition: ntbasedef.h:673
#define ok_eq_ulonglong_(value, expected)
Definition: NpfsHelpers.c:437
Status
Definition: gdiplustypes.h:24
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define ok_eq_ulongptr_(value, expected)
Definition: NpfsHelpers.c:439
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define ok_eq_hex_(value, expected)
Definition: NpfsHelpers.c:443
LONGLONG QuadPart
Definition: typedefs.h:114

◆ NpCheckServerPipe_()

VOID NpCheckServerPipe_ ( IN HANDLE  ServerHandle,
IN ULONG  ReadMode,
IN ULONG  CompletionMode,
IN ULONG  NamedPipeType,
IN ULONG  NamedPipeConfiguration,
IN ULONG  MaximumInstances,
IN ULONG  CurrentInstances,
IN ULONG  InboundQuota,
IN ULONG  ReadDataAvailable,
IN ULONG  OutboundQuota,
IN ULONG  WriteQuotaAvailable,
IN ULONG  NamedPipeState,
IN PCSTR  FileAndLine 
)

Definition at line 446 of file NpfsHelpers.c.

464 {
468  FILE_PIPE_LOCAL_INFORMATION PipeLocalInfo;
469  FILE_PIPE_REMOTE_INFORMATION PipeRemoteInfo;
470 
471  RtlFillMemory(&IoStatusBlock, sizeof(IoStatusBlock), 0x55);
472  RtlFillMemory(&PipeInfo, sizeof(PipeInfo), 0x55);
473  Status = ZwQueryInformationFile(ServerHandle,
474  &IoStatusBlock,
475  &PipeInfo,
476  sizeof(PipeInfo),
481  ok_eq_ulong_(PipeInfo.ReadMode, ReadMode);
482  ok_eq_ulong_(PipeInfo.CompletionMode, CompletionMode);
483 
484  RtlFillMemory(&IoStatusBlock, sizeof(IoStatusBlock), 0x55);
485  RtlFillMemory(&PipeLocalInfo, sizeof(PipeLocalInfo), 0x55);
486  Status = ZwQueryInformationFile(ServerHandle,
487  &IoStatusBlock,
488  &PipeLocalInfo,
489  sizeof(PipeLocalInfo),
493  ok_eq_ulongptr_(IoStatusBlock.Information, sizeof(PipeLocalInfo));
494  ok_eq_ulong_(PipeLocalInfo.NamedPipeType, NamedPipeType);
495  ok_eq_ulong_(PipeLocalInfo.NamedPipeConfiguration, NamedPipeConfiguration);
496  ok_eq_ulong_(PipeLocalInfo.MaximumInstances, MaximumInstances);
497  ok_eq_ulong_(PipeLocalInfo.CurrentInstances, CurrentInstances);
498  ok_eq_ulong_(PipeLocalInfo.InboundQuota, InboundQuota);
499  ok_eq_ulong_(PipeLocalInfo.ReadDataAvailable, ReadDataAvailable);
500  ok_eq_ulong_(PipeLocalInfo.OutboundQuota, OutboundQuota);
501  ok_eq_ulong_(PipeLocalInfo.WriteQuotaAvailable, WriteQuotaAvailable);
502  ok_eq_ulong_(PipeLocalInfo.NamedPipeState, NamedPipeState);
504 
505  RtlFillMemory(&IoStatusBlock, sizeof(IoStatusBlock), 0x55);
506  RtlFillMemory(&PipeRemoteInfo, sizeof(PipeRemoteInfo), 0x55);
507  Status = ZwQueryInformationFile(ServerHandle,
508  &IoStatusBlock,
509  &PipeRemoteInfo,
510  sizeof(PipeRemoteInfo),
515  ok_eq_ulonglong_(PipeRemoteInfo.CollectDataTime.QuadPart, 0ULL);
516  ok_eq_ulong_(PipeRemoteInfo.MaximumCollectionCount, 0x55555555UL);
517 }
ULONG NamedPipeConfiguration
Definition: pipe.c:43
LONG NTSTATUS
Definition: precomp.h:26
LARGE_INTEGER CollectDataTime
Definition: iotypes.h:5895
#define ok_eq_ulong_(value, expected)
Definition: NpfsHelpers.c:436
#define ULL(a, b)
Definition: format_msg.c:27
_In_ PUSBD_PIPE_INFORMATION PipeInfo
Definition: hubbusif.h:294
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
#define RTL_SIZEOF_THROUGH_FIELD(type, field)
Definition: ntbasedef.h:673
#define ok_eq_ulonglong_(value, expected)
Definition: NpfsHelpers.c:437
#define FILE_PIPE_SERVER_END
Definition: iotypes.h:85
Status
Definition: gdiplustypes.h:24
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define ok_eq_ulongptr_(value, expected)
Definition: NpfsHelpers.c:439
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define ok_eq_hex_(value, expected)
Definition: NpfsHelpers.c:443
LONGLONG QuadPart
Definition: typedefs.h:114

◆ NpControlPipe()

NTSTATUS NpControlPipe ( IN HANDLE  PipeHandle,
IN ULONG  FsControlCode,
IN PVOID  InputBuffer,
IN ULONG  InputBufferLength 
)

Definition at line 208 of file NpfsHelpers.c.

213 {
216 
217  RtlFillMemory(&IoStatusBlock, sizeof(IoStatusBlock), 0x55);
218  Status = ZwFsControlFile(ServerHandle,
219  NULL,
220  NULL,
221  NULL,
222  &IoStatusBlock,
224  InputBuffer,
226  NULL,
227  0);
228  if (Status == STATUS_PENDING)
229  {
230  Status = ZwWaitForSingleObject(ServerHandle,
231  FALSE,
232  NULL);
235  }
236  if (NT_SUCCESS(Status))
237  {
240  }
241  else
242  {
243  ok_eq_hex(IoStatusBlock.Status, 0x55555555UL);
244  ok_eq_ulongptr(IoStatusBlock.Information, 0x5555555555555555ULL);
245  }
246  return Status;
247 }
LONG NTSTATUS
Definition: precomp.h:26
#define ok_eq_ulongptr(value, expected)
Definition: kmt_test.h:249
CHAR InputBuffer[80]
Definition: conmgr.c:33
#define FALSE
Definition: types.h:117
NTSYSAPI NTSTATUS NTAPI ZwFsControlFile(IN HANDLE DeviceHandle, IN HANDLE Event OPTIONAL, IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, IN PVOID ApcContext OPTIONAL, OUT PIO_STATUS_BLOCK IoStatusBlock, IN ULONG IoControlCode, IN PVOID InputBuffer, IN ULONG InputBufferSize, OUT PVOID OutputBuffer, IN ULONG OutputBufferSize)
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG InputBufferLength
Definition: fltkernel.h:1372
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG FsControlCode
Definition: fltkernel.h:1369
#define ok_eq_hex(value, expected)
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by NpWaitPipe().

◆ NpCreatePipe()

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 
)

Referenced by RunTest(), and TestCreateNamedPipe().

◆ NpCreatePipeEx()

NTSTATUS NpCreatePipeEx ( OUT PHANDLE  ServerHandle,
IN PCWSTR  PipePath,
IN ULONG  ReadMode,
IN ULONG  CompletionMode,
IN ULONG  NamedPipeType,
IN ULONG  ShareAccess,
IN ULONG  MaximumInstances,
IN ULONG  InboundQuota,
IN ULONG  OutboundQuota,
IN ACCESS_MASK  DesiredAccess,
IN ULONG  Disposition,
IN ULONG  CreateOptions,
IN PLARGE_INTEGER DefaultTimeout  OPTIONAL 
)

Definition at line 12 of file NpfsHelpers.c.

26 {
32 
33  RtlInitUnicodeString(&ObjectName, PipePath);
35  &ObjectName,
37  NULL,
38  NULL);
39 
40  Params.NamedPipeType = NamedPipeType;
41  Params.ReadMode = ReadMode;
42  Params.CompletionMode = CompletionMode;
43  Params.MaximumInstances = MaximumInstances;
44  Params.InboundQuota = InboundQuota;
45  Params.OutboundQuota = OutboundQuota;
46  if (DefaultTimeout)
47  {
48  Params.DefaultTimeout.QuadPart = DefaultTimeout->QuadPart;
49  Params.TimeoutSpecified = TRUE;
50  }
51  else
52  {
53  Params.DefaultTimeout.QuadPart = 0;
54  Params.TimeoutSpecified = FALSE;
55  }
56 
57  RtlFillMemory(&IoStatusBlock, sizeof(IoStatusBlock), 0x55);
58  Status = IoCreateFile(ServerHandle,
62  NULL, /* AllocationSize */
63  0, /* FileAttributes */
67  NULL, /* EaBuffer */
68  0, /* EaLength */
70  &Params,
71  0);
72  if (NT_SUCCESS(Status))
73  {
76  }
77  else
78  {
79  ok_eq_hex(IoStatusBlock.Status, 0x55555555UL);
80  ok_eq_ulongptr(IoStatusBlock.Information, 0x5555555555555555ULL);
81  }
82  return Status;
83 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define ok_eq_ulongptr(value, expected)
Definition: kmt_test.h:249
_In_ PVOID _Out_opt_ PULONG_PTR _Outptr_opt_ PCUNICODE_STRING * ObjectName
Definition: cmfuncs.h:62
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK _In_ USHORT ShareAccess
Definition: create.c:4137
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:50
#define FALSE
Definition: types.h:117
LARGE_INTEGER DefaultTimeout
Definition: iotypes.h:790
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE _In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Out_ PIO_STATUS_BLOCK _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _In_ ULONG _In_ ULONG CreateOptions
Definition: fltkernel.h:1230
Status
Definition: gdiplustypes.h:24
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4137
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define FILE_CREATED
Definition: nt_native.h:770
NTSTATUS NTAPI IoCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG Disposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength, IN CREATE_FILE_TYPE CreateFileType, IN PVOID ExtraCreateParameters OPTIONAL, IN ULONG Options)
Definition: file.c:3009
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define ok_eq_hex(value, expected)
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by NpCreatePipe().

◆ NpOpenPipe()

NTSTATUS NpOpenPipe ( OUT PHANDLE  ClientHandle,
IN PCWSTR  PipePath,
IN ULONG  NamedPipeConfiguration 
)

Definition at line 180 of file NpfsHelpers.c.

184 {
186 
187  if (NamedPipeConfiguration == FILE_PIPE_INBOUND)
189  else if (NamedPipeConfiguration == FILE_PIPE_OUTBOUND)
191  else if (NamedPipeConfiguration == FILE_PIPE_FULL_DUPLEX)
193  else
194  {
195  ASSERTMSG("Invalid NamedPipeConfiguration parameter value!\n", FALSE);
197  }
198 
199  return NpOpenPipeEx(ClientHandle,
200  PipePath,
202  ShareAccess,
203  FILE_OPEN,
205 }
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK _In_ USHORT ShareAccess
Definition: create.c:4137
#define FILE_SHARE_READ
Definition: compat.h:136
#define STATUS_INVALID_PARAMETER_3
Definition: ntstatus.h:477
#define FALSE
Definition: types.h:117
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
#define GENERIC_WRITE
Definition: nt_native.h:90
NTSTATUS NpOpenPipeEx(OUT PHANDLE ClientHandle, IN PCWSTR PipePath, IN ACCESS_MASK DesiredAccess, IN ULONG ShareAccess, IN ULONG Disposition, IN ULONG CreateOptions)
Definition: NpfsHelpers.c:130
#define GENERIC_READ
Definition: compat.h:135
#define SYNCHRONIZE
Definition: nt_native.h:61
#define FILE_OPEN
Definition: from_kernel.h:54
#define FILE_PIPE_OUTBOUND
Definition: iotypes.h:82
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
unsigned int ULONG
Definition: retypes.h:1
#define FILE_PIPE_INBOUND
Definition: iotypes.h:81
#define FILE_PIPE_FULL_DUPLEX
Definition: iotypes.h:83

Referenced by ConnectPipe().

◆ NpOpenPipeEx()

NTSTATUS NpOpenPipeEx ( OUT PHANDLE  ClientHandle,
IN PCWSTR  PipePath,
IN ACCESS_MASK  DesiredAccess,
IN ULONG  ShareAccess,
IN ULONG  Disposition,
IN ULONG  CreateOptions 
)

Definition at line 130 of file NpfsHelpers.c.

137 {
142 
143  RtlInitUnicodeString(&ObjectName, PipePath);
145  &ObjectName,
147  NULL,
148  NULL);
149 
150  RtlFillMemory(&IoStatusBlock, sizeof(IoStatusBlock), 0x55);
151  Status = IoCreateFile(ClientHandle,
154  &IoStatusBlock,
155  NULL, /* AllocationSize */
156  0, /* FileAttributes */
157  ShareAccess,
158  Disposition,
160  NULL, /* EaBuffer */
161  0, /* EaLength */
163  NULL,
164  0);
165  if (NT_SUCCESS(Status))
166  {
167  ok(Status != STATUS_PENDING, "IoCreateFile returned pending\n");
170  }
171  else
172  {
173  ok_eq_hex(IoStatusBlock.Status, 0x55555555UL);
174  ok_eq_ulongptr(IoStatusBlock.Information, 0x5555555555555555ULL);
175  }
176  return Status;
177 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_OPENED
Definition: nt_native.h:769
#define ok_eq_ulongptr(value, expected)
Definition: kmt_test.h:249
_In_ PVOID _Out_opt_ PULONG_PTR _Outptr_opt_ PCUNICODE_STRING * ObjectName
Definition: cmfuncs.h:62
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK _In_ USHORT ShareAccess
Definition: create.c:4137
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:50
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE _In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Out_ PIO_STATUS_BLOCK _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _In_ ULONG _In_ ULONG CreateOptions
Definition: fltkernel.h:1230
Status
Definition: gdiplustypes.h:24
#define ok(value,...)
Definition: atltest.h:57
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4137
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
NTSTATUS NTAPI IoCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG Disposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength, IN CREATE_FILE_TYPE CreateFileType, IN PVOID ExtraCreateParameters OPTIONAL, IN ULONG Options)
Definition: file.c:3009
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define ok_eq_hex(value, expected)

Referenced by ConnectPipe(), and NpOpenPipe().

◆ NpQueryPipe_()

VOID NpQueryPipe_ ( IN HANDLE  Handle,
IN NTSTATUS  ExpectedStatus,
IN PCSTR  FileAndLine 
)

Definition at line 594 of file NpfsHelpers.c.

598 {
602  FILE_PIPE_LOCAL_INFORMATION PipeLocalInfo;
603  FILE_PIPE_REMOTE_INFORMATION PipeRemoteInfo;
604 
605  ASSERT(!NT_SUCCESS(ExpectedStatus));
606 
607  RtlFillMemory(&IoStatusBlock, sizeof(IoStatusBlock), 0x55);
608  RtlFillMemory(&PipeInfo, sizeof(PipeInfo), 0x55);
609  Status = ZwQueryInformationFile(PipeHandle,
610  &IoStatusBlock,
611  &PipeInfo,
612  sizeof(PipeInfo),
614  ok_eq_hex_(Status, ExpectedStatus);
615  ok_bool_true(CheckBuffer(&IoStatusBlock, sizeof(IoStatusBlock), 0x55), "CheckBuffer returned");
616  ok_bool_true(CheckBuffer(&PipeInfo, sizeof(PipeInfo), 0x55), "CheckBuffer returned");
617 
618  RtlFillMemory(&IoStatusBlock, sizeof(IoStatusBlock), 0x55);
619  RtlFillMemory(&PipeLocalInfo, sizeof(PipeLocalInfo), 0x55);
620  Status = ZwQueryInformationFile(PipeHandle,
621  &IoStatusBlock,
622  &PipeLocalInfo,
623  sizeof(PipeLocalInfo),
625  ok_eq_hex_(Status, ExpectedStatus);
626  ok_bool_true(CheckBuffer(&IoStatusBlock, sizeof(IoStatusBlock), 0x55), "CheckBuffer returned");
627  ok_bool_true(CheckBuffer(&PipeLocalInfo, sizeof(PipeLocalInfo), 0x55), "CheckBuffer returned");
628 
629  RtlFillMemory(&IoStatusBlock, sizeof(IoStatusBlock), 0x55);
630  RtlFillMemory(&PipeRemoteInfo, sizeof(PipeRemoteInfo), 0x55);
631  Status = ZwQueryInformationFile(PipeHandle,
632  &IoStatusBlock,
633  &PipeRemoteInfo,
634  sizeof(PipeRemoteInfo),
636  ok_eq_hex_(Status, ExpectedStatus);
637  ok_bool_true(CheckBuffer(&IoStatusBlock, sizeof(IoStatusBlock), 0x55), "CheckBuffer returned");
638  ok_bool_true(CheckBuffer(&PipeRemoteInfo, sizeof(PipeRemoteInfo), 0x55), "CheckBuffer returned");
639 }
LONG NTSTATUS
Definition: precomp.h:26
#define ok_bool_true(value, desc)
Definition: kmt_test.h:256
static BOOLEAN CheckBuffer(PVOID Buffer, SIZE_T Size, UCHAR Value)
Definition: NpfsHelpers.c:417
_In_ PUSBD_PIPE_INFORMATION PipeInfo
Definition: hubbusif.h:294
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Status
Definition: gdiplustypes.h:24
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
static HANDLE PipeHandle
Definition: dhcpcsvc.c:21
#define ok_eq_hex_(value, expected)
Definition: NpfsHelpers.c:443

◆ NpReadPipe()

NTSTATUS NpReadPipe ( IN HANDLE  PipeHandle,
OUT PVOID  Buffer,
IN ULONG  BufferSize,
OUT PULONG_PTR  BytesRead 
)

Definition at line 322 of file NpfsHelpers.c.

327 {
330  BOOLEAN PendingReturned = FALSE;
331 
332  RtlFillMemory(&IoStatusBlock, sizeof(IoStatusBlock), 0x55);
333  Status = ZwReadFile(PipeHandle,
334  NULL,
335  NULL,
336  NULL,
337  &IoStatusBlock,
338  Buffer,
339  BufferSize,
340  NULL,
341  NULL);
342  if (Status == STATUS_PENDING)
343  {
344  Status = ZwWaitForSingleObject(PipeHandle,
345  FALSE,
346  NULL);
349  PendingReturned = TRUE;
350  }
351  if (NT_SUCCESS(Status))
352  {
355  }
356  else
357  {
358  if (PendingReturned)
359  {
362  }
363  else
364  {
365  ok_eq_hex(IoStatusBlock.Status, 0x55555555UL);
366  ok_eq_ulongptr(IoStatusBlock.Information, 0x5555555555555555ULL);
367  }
368  *BytesRead = 0;
369  }
370  return Status;
371 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define ok_eq_ulongptr(value, expected)
Definition: kmt_test.h:249
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
#define BufferSize
Definition: classpnp.h:436
Status
Definition: gdiplustypes.h:24
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
static HANDLE PipeHandle
Definition: dhcpcsvc.c:21
#define ok_eq_hex(value, expected)
return STATUS_SUCCESS
Definition: btrfs.c:3014
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255

Referenced by ReadPipe().

◆ NpWaitPipe()

NTSTATUS NpWaitPipe ( IN PCWSTR  PipeName,
IN PLARGE_INTEGER  Timeout 
)

Definition at line 250 of file NpfsHelpers.c.

253 {
255  HANDLE RootHandle;
259  PFILE_PIPE_WAIT_FOR_BUFFER WaitForBuffer;
260  ULONG NameLength;
262 
264  &RootDirectoryName,
266  NULL,
267  NULL);
268 
269  RtlFillMemory(&IoStatusBlock, sizeof(IoStatusBlock), 0x55);
270  Status = IoCreateFile(&RootHandle,
273  &IoStatusBlock,
274  NULL,
275  0,
277  FILE_OPEN,
279  NULL,
280  0,
282  NULL,
283  0);
284  if (!NT_SUCCESS(Status))
285  {
286  ok_eq_hex(IoStatusBlock.Status, 0x55555555UL);
287  ok_eq_ulongptr(IoStatusBlock.Information, 0x5555555555555555ULL);
288  return Status;
289  }
290  ok(Status != STATUS_PENDING, "IoCreateFile returned pending\n");
293 
294  NameLength = (ULONG)(wcslen(PipeName) * sizeof(WCHAR));
296  Name[NameLength / sizeof(WCHAR)]);
297  WaitForBuffer = ExAllocatePoolWithTag(NonPagedPool, BufferSize, 'WPmK');
298  if (WaitForBuffer == NULL)
300 
301  if (Timeout)
302  {
303  WaitForBuffer->Timeout.QuadPart = Timeout->QuadPart;
304  WaitForBuffer->TimeoutSpecified = TRUE;
305  }
306  else
307  {
308  WaitForBuffer->Timeout.QuadPart = 0;
309  WaitForBuffer->TimeoutSpecified = FALSE;
310  }
311  WaitForBuffer->NameLength = NameLength;
312  RtlCopyMemory(WaitForBuffer->Name, PipeName, NameLength);
313  Status = NpControlPipe(RootHandle,
315  WaitForBuffer,
316  BufferSize);
317  ExFreePoolWithTag(WaitForBuffer, 'WPmK');
318  return Status;
319 }
LARGE_INTEGER Timeout
Definition: winioctl.h:457
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_OPENED
Definition: nt_native.h:769
#define ok_eq_ulongptr(value, expected)
Definition: kmt_test.h:249
#define DEVICE_NAMED_PIPE
Definition: npfs.h:11
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define FILE_SHARE_READ
Definition: compat.h:136
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
#define FSCTL_PIPE_WAIT
Definition: winioctl.h:199
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
#define BufferSize
Definition: classpnp.h:436
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
Status
Definition: gdiplustypes.h:24
#define SYNCHRONIZE
Definition: nt_native.h:61
#define FILE_OPEN
Definition: from_kernel.h:54
static ULONG Timeout
Definition: ping.c:61
#define ok(value,...)
Definition: atltest.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
NTSTATUS NTAPI IoCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG Disposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength, IN CREATE_FILE_TYPE CreateFileType, IN PVOID ExtraCreateParameters OPTIONAL, IN ULONG Options)
Definition: file.c:3009
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
unsigned int ULONG
Definition: retypes.h:1
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define ok_eq_hex(value, expected)
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
NTSTATUS NpControlPipe(IN HANDLE ServerHandle, IN ULONG FsControlCode, IN PVOID InputBuffer, IN ULONG InputBufferLength)
Definition: NpfsHelpers.c:208
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
LONGLONG QuadPart
Definition: typedefs.h:114
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

◆ NpWritePipe()

NTSTATUS NpWritePipe ( IN HANDLE  PipeHandle,
IN const VOID Buffer,
IN ULONG  BufferSize,
OUT PULONG_PTR  BytesWritten 
)

Definition at line 374 of file NpfsHelpers.c.

379 {
382 
383  RtlFillMemory(&IoStatusBlock, sizeof(IoStatusBlock), 0x55);
384  Status = ZwWriteFile(PipeHandle,
385  NULL,
386  NULL,
387  NULL,
388  &IoStatusBlock,
389  (PVOID)Buffer,
390  BufferSize,
391  NULL,
392  NULL);
393  if (Status == STATUS_PENDING)
394  {
395  Status = ZwWaitForSingleObject(PipeHandle,
396  FALSE,
397  NULL);
400  }
401  if (NT_SUCCESS(Status))
402  {
405  }
406  else
407  {
408  ok_eq_hex(IoStatusBlock.Status, 0x55555555UL);
409  ok_eq_ulongptr(IoStatusBlock.Information, 0x5555555555555555ULL);
410  *BytesWritten = 0;
411  }
412  return Status;
413 }
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesWritten
Definition: fltkernel.h:1293
LONG NTSTATUS
Definition: precomp.h:26
#define ok_eq_ulongptr(value, expected)
Definition: kmt_test.h:249
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
#define BufferSize
Definition: classpnp.h:436
Status
Definition: gdiplustypes.h:24
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
static HANDLE PipeHandle
Definition: dhcpcsvc.c:21
#define ok_eq_hex(value, expected)
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by WritePipe().

◆ StartWorkerThread()

VOID StartWorkerThread ( OUT PTHREAD_CONTEXT  Context)

Definition at line 674 of file NpfsHelpers.c.

676 {
677  KeInitializeEvent(&Context->ThreadDoneEvent, NotificationEvent, FALSE);
679  KeInitializeEvent(&Context->WorkCompleteEvent, NotificationEvent, TRUE);
680 
682 }
PKTHREAD KmtStartThread(IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext OPTIONAL)
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static KSTART_ROUTINE PipeWorkerThread
Definition: NpfsHelpers.c:641
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477

Referenced by TestConnect(), and TestReadWrite().

◆ TriggerWork()

BOOLEAN TriggerWork ( IN PTHREAD_CONTEXT  Context,
IN ULONG  MilliSeconds 
)

Definition at line 710 of file NpfsHelpers.c.

713 {
715 
716  Status = KeWaitForSingleObject(&Context->WorkCompleteEvent,
717  Executive,
718  KernelMode,
719  FALSE,
720  NULL);
722  KeClearEvent(&Context->WorkCompleteEvent);
723  KeSetEvent(&Context->StartWorkEvent, IO_NO_INCREMENT, TRUE);
724  return WaitForWork(Context, MilliSeconds);
725 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
Status
Definition: gdiplustypes.h:24
#define IO_NO_INCREMENT
Definition: iotypes.h:581
BOOLEAN WaitForWork(IN PTHREAD_CONTEXT Context, IN ULONG MilliSeconds)
Definition: NpfsHelpers.c:692
#define ok_eq_hex(value, expected)
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by CheckConnectPipe(), CheckListenPipe(), CheckReadPipe(), and CheckWritePipe().

◆ WaitForWork()

BOOLEAN WaitForWork ( IN PTHREAD_CONTEXT  Context,
IN ULONG  MilliSeconds 
)

Definition at line 692 of file NpfsHelpers.c.

695 {
698 
699  Timeout.QuadPart = -10 * 1000 * (LONGLONG)MilliSeconds;
700  Status = KeWaitForSingleObject(&Context->WorkCompleteEvent,
701  Executive,
702  KernelMode,
703  FALSE,
704  &Timeout);
705  ok(Status == STATUS_SUCCESS || Status == STATUS_TIMEOUT, "Wait status %lx\n", Status);
706  return Status != STATUS_TIMEOUT;
707 }
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
#define STATUS_TIMEOUT
Definition: ntstatus.h:81
#define FALSE
Definition: types.h:117
int64_t LONGLONG
Definition: typedefs.h:68
Status
Definition: gdiplustypes.h:24
static ULONG Timeout
Definition: ping.c:61
#define ok(value,...)
Definition: atltest.h:57
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by TestConnect(), TestReadWrite(), and TriggerWork().