ReactOS  0.4.10-dev-19-g39281f0
pipe.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include "ntstatus.h"
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winreg.h"
#include "winnls.h"
#include "wine/test.h"
#include "winternl.h"
#include "winioctl.h"
Include dependency graph for pipe.c:

Go to the source code of this file.

Classes

struct  FILE_PIPE_INFORMATION
 
struct  FILE_PIPE_LOCAL_INFORMATION
 

Macros

#define WIN32_NO_STATUS
 
#define FILE_SYNCHRONOUS_IO_ALERT   0x10
 
#define FILE_SYNCHRONOUS_IO_NONALERT   0x20
 
#define FSCTL_PIPE_LISTEN   CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
 
#define loadfunc(name)
 
#define check_pipe_handle_state(handle, r, c)   _check_pipe_handle_state(__LINE__, handle, r, c)
 
#define PIPENAME   "\\\\.\\pipe\\ntdll_tests_pipe.c"
 
#define test_file_name_fail(a, b)   _test_file_name_fail(__LINE__,a,b)
 
#define test_file_name(a)   _test_file_name(__LINE__,a)
 
#define test_group(a, b, c)   _test_group(__LINE__,a,b,c)
 

Functions

static NTSTATUS (WINAPI *pNtFsControlFile)(HANDLE handle
 
static void (WINAPI *pRtlInitUnicodeString)(PUNICODE_STRING target
 
static HANDLE (WINAPI *pOpenThread)(DWORD dwDesiredAccess
 
static DWORD (WINAPI *pQueueUserAPC)(PAPCFUNC pfnAPC
 
static BOOL init_func_ptrs (void)
 
static BOOL is_signaled (HANDLE obj)
 
static NTSTATUS create_pipe (PHANDLE handle, ULONG sharing, ULONG options)
 
static void CALLBACK ioapc (void *arg, PIO_STATUS_BLOCK io, ULONG reserved)
 
static NTSTATUS listen_pipe (HANDLE hPipe, HANDLE hEvent, PIO_STATUS_BLOCK iosb, BOOL use_apc)
 
static void test_create_invalid (void)
 
static void test_create (void)
 
static void test_overlapped (void)
 
static void test_completion (void)
 
static void CALLBACK userapc (ULONG_PTR dwParam)
 
static DWORD WINAPI thread (PVOID main_thread)
 
static void test_alertable (void)
 
static void test_nonalertable (void)
 
static void test_cancelio (void)
 
static void _check_pipe_handle_state (int line, HANDLE handle, ULONG read, ULONG completion)
 
static void test_filepipeinfo (void)
 
static void WINAPI apc (void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved)
 
static void test_peek (HANDLE pipe)
 
static BOOL create_pipe_pair (HANDLE *read, HANDLE *write, ULONG flags, ULONG type, ULONG size)
 
static void read_pipe_test (ULONG pipe_flags, ULONG pipe_type)
 
static void test_volume_info (void)
 
static void _test_file_name_fail (unsigned line, HANDLE pipe, NTSTATUS expected_status)
 
static void _test_file_name (unsigned line, HANDLE pipe)
 
static void test_file_info (void)
 
static PSECURITY_DESCRIPTOR get_security_descriptor (HANDLE handle, BOOL todo)
 
static TOKEN_OWNERget_current_owner (void)
 
static TOKEN_PRIMARY_GROUPget_current_group (void)
 
static SIDwell_known_sid (WELL_KNOWN_SID_TYPE sid_type)
 
static void _test_group (unsigned line, HANDLE handle, SID *expected_sid, BOOL todo)
 
static void test_security_info (void)
 
 START_TEST (pipe)
 

Variables

static HANDLE event
 
static HANDLE PIO_APC_ROUTINE apc
 
static HANDLE PIO_APC_ROUTINE PVOID apc_context
 
static HANDLE PIO_APC_ROUTINE
PVOID PIO_STATUS_BLOCK 
io
 
static HANDLE PIO_APC_ROUTINE
PVOID PIO_STATUS_BLOCK ULONG 
code
 
static HANDLE PIO_APC_ROUTINE
PVOID PIO_STATUS_BLOCK ULONG
PVOID 
in_buffer
 
static HANDLE PIO_APC_ROUTINE
PVOID PIO_STATUS_BLOCK ULONG
PVOID ULONG 
in_size
 
static HANDLE PIO_APC_ROUTINE
PVOID PIO_STATUS_BLOCK ULONG
PVOID ULONG PVOID 
out_buffer
 
static HANDLE PIO_APC_ROUTINE
PVOID PIO_STATUS_BLOCK ULONG
PVOID ULONG PVOID ULONG 
out_size
 
static ULONG access
 
static ULONG POBJECT_ATTRIBUTES attr
 
static ULONG
POBJECT_ATTRIBUTES
PIO_STATUS_BLOCK 
iosb
 
static ULONG
POBJECT_ATTRIBUTES
PIO_STATUS_BLOCK ULONG 
sharing
 
static ULONG
POBJECT_ATTRIBUTES
PIO_STATUS_BLOCK ULONG ULONG 
dispo
 
static ULONG
POBJECT_ATTRIBUTES
PIO_STATUS_BLOCK ULONG ULONG
ULONG 
options
 
static ULONG
POBJECT_ATTRIBUTES
PIO_STATUS_BLOCK ULONG ULONG
ULONG ULONG 
pipe_type
 
static ULONG
POBJECT_ATTRIBUTES
PIO_STATUS_BLOCK ULONG ULONG
ULONG ULONG ULONG 
read_mode
 
static ULONG
POBJECT_ATTRIBUTES
PIO_STATUS_BLOCK ULONG ULONG
ULONG ULONG ULONG ULONG 
completion_mode
 
static ULONG
POBJECT_ATTRIBUTES
PIO_STATUS_BLOCK ULONG ULONG
ULONG ULONG ULONG ULONG ULONG 
max_inst
 
static ULONG
POBJECT_ATTRIBUTES
PIO_STATUS_BLOCK ULONG ULONG
ULONG ULONG ULONG ULONG ULONG
ULONG 
inbound_quota
 
static ULONG
POBJECT_ATTRIBUTES
PIO_STATUS_BLOCK ULONG ULONG
ULONG ULONG ULONG ULONG ULONG
ULONG ULONG 
outbound_quota
 
static ULONG
POBJECT_ATTRIBUTES
PIO_STATUS_BLOCK ULONG ULONG
ULONG ULONG ULONG ULONG ULONG
ULONG ULONG PLARGE_INTEGER 
timeout
 
static OUT PIO_STATUS_BLOCK IoStatusBlock
 
static OUT PIO_STATUS_BLOCK
OUT PVOID 
FileInformation
 
static OUT PIO_STATUS_BLOCK
OUT PVOID IN ULONG 
Length
 
static OUT PIO_STATUS_BLOCK
OUT PVOID IN ULONG IN
FILE_INFORMATION_CLASS 
FileInformationClass
 
static PIO_STATUS_BLOCK voidbuffer
 
static PIO_STATUS_BLOCK void ULONG length
 
static PIO_STATUS_BLOCK void
ULONG FS_INFORMATION_CLASS 
info_class
 
static PIO_STATUS_BLOCK PVOID ptr
 
static PIO_STATUS_BLOCK PVOID ULONG len
 
static PIO_STATUS_BLOCK PVOID
ULONG FILE_INFORMATION_CLASS 
class
 
static PIO_STATUS_BLOCK io_status
 
static PCWSTR source
 
static BOOL bInheritHandle
 
static BOOL DWORD dwThreadId
 
static HANDLE hThread
 
static HANDLE ULONG_PTR dwData
 
static const WCHAR testpipe []
 
static const WCHAR testpipe_nt []
 
static BOOL ioapc_called
 
static BOOL userapc_called
 
static BOOL open_succeeded
 

Macro Definition Documentation

#define check_pipe_handle_state (   handle,
  r,
  c 
)    _check_pipe_handle_state(__LINE__, handle, r, c)

Definition at line 628 of file pipe.c.

Referenced by test_filepipeinfo().

#define FILE_SYNCHRONOUS_IO_ALERT   0x10

Definition at line 55 of file pipe.c.

Referenced by test_alertable().

#define FILE_SYNCHRONOUS_IO_NONALERT   0x20

Definition at line 59 of file pipe.c.

Referenced by test_nonalertable().

#define loadfunc (   name)
Value:
if (!(p##name = (void *)GetProcAddress(module, #name))) { \
trace("GetProcAddress(%s) failed\n", #name); \
}
#define trace(...)
Definition: kmt_test.h:217
return
Definition: dirsup.c:529
#define FALSE
Definition: types.h:117
Definition: name.c:36
#define GetProcAddress(x, y)
Definition: compat.h:410
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by init_func_ptrs().

#define PIPENAME   "\\\\.\\pipe\\ntdll_tests_pipe.c"

Definition at line 829 of file pipe.c.

Referenced by create_pipe_pair(), and test_security_info().

#define test_file_name (   a)    _test_file_name(__LINE__,a)

Definition at line 1224 of file pipe.c.

Referenced by test_file_info(), and test_mru().

#define test_file_name_fail (   a,
  b 
)    _test_file_name_fail(__LINE__,a,b)

Definition at line 1212 of file pipe.c.

Referenced by test_file_info().

#define test_group (   a,
  b,
  c 
)    _test_group(__LINE__,a,b,c)

Definition at line 1359 of file pipe.c.

Referenced by test_security_info().

#define WIN32_NO_STATUS

Definition at line 24 of file pipe.c.

Function Documentation

static void _check_pipe_handle_state ( int  line,
HANDLE  handle,
ULONG  read,
ULONG  completion 
)
static

Definition at line 612 of file pipe.c.

613 {
616  NTSTATUS res;
618  {
619  memset(&fpi, 0x55, sizeof(fpi));
620  res = pNtQueryInformationFile(handle, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
621  ok_(__FILE__, line)(!res, "NtQueryInformationFile returned %x\n", res);
622  ok_(__FILE__, line)(fpi.ReadMode == read, "Unexpected ReadMode, expected %x, got %x\n",
623  read, fpi.ReadMode);
624  ok_(__FILE__, line)(fpi.CompletionMode == completion, "Unexpected CompletionMode, expected %x, got %x\n",
626  }
627 }
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK iosb
Definition: pipe.c:68
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
Definition: parser.c:48
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
Definition: directory.c:44
LONG NTSTATUS
Definition: precomp.h:26
void CALLBACK completion(DWORD dwError, DWORD cbTransferred, LPWSAOVERLAPPED lpOverlapped, DWORD dwFlags)
Definition: WSARecv.c:16
ULONG CompletionMode
Definition: pipe.c:38
GLuint res
Definition: glext.h:9613
#define memset(x, y, z)
Definition: compat.h:39
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
#define ok_(x1, x2)
Definition: CString.cpp:56
static void _test_file_name ( unsigned  line,
HANDLE  pipe 
)
static

Definition at line 1225 of file pipe.c.

1226 {
1227  char buffer[512];
1228  FILE_NAME_INFORMATION *name_info = (FILE_NAME_INFORMATION*)buffer;
1230  NTSTATUS status;
1231 
1232  static const WCHAR nameW[] =
1233  {'\\','n','t','d','l','l','_','t','e','s','t','s','_','p','i','p','e','.','c'};
1234 
1235  memset( buffer, 0xaa, sizeof(buffer) );
1236  memset( &iosb, 0xaa, sizeof(iosb) );
1237  status = NtQueryInformationFile( pipe, &iosb, buffer, sizeof(buffer), FileNameInformation );
1238  ok_(__FILE__,line)( status == STATUS_SUCCESS, "NtQueryInformationFile failed: %x\n", status );
1239  ok_(__FILE__,line)( iosb.Status == STATUS_SUCCESS, "Status = %x\n", iosb.Status );
1240  ok_(__FILE__,line)( iosb.Information == sizeof(name_info->FileNameLength) + sizeof(nameW),
1241  "Information = %lu\n", iosb.Information );
1242  ok( name_info->FileNameLength == sizeof(nameW), "FileNameLength = %u\n", name_info->FileNameLength );
1243  ok( !memcmp(name_info->FileName, nameW, sizeof(nameW)), "FileName = %s\n", wine_dbgstr_w(name_info->FileName) );
1244 
1245  /* too small buffer */
1246  memset( buffer, 0xaa, sizeof(buffer) );
1247  memset( &iosb, 0xaa, sizeof(iosb) );
1248  status = NtQueryInformationFile( pipe, &iosb, buffer, 20, FileNameInformation );
1249  ok( status == STATUS_BUFFER_OVERFLOW, "NtQueryInformationFile failed: %x\n", status );
1250  ok( iosb.Status == STATUS_BUFFER_OVERFLOW, "Status = %x\n", iosb.Status );
1251  ok( iosb.Information == 20, "Information = %lu\n", iosb.Information );
1252  ok( name_info->FileNameLength == sizeof(nameW), "FileNameLength = %u\n", name_info->FileNameLength );
1253  ok( !memcmp(name_info->FileName, nameW, 16), "FileName = %s\n", wine_dbgstr_w(name_info->FileName) );
1254 
1255  /* too small buffer */
1256  memset( buffer, 0xaa, sizeof(buffer) );
1257  memset( &iosb, 0xaa, sizeof(iosb) );
1258  status = NtQueryInformationFile( pipe, &iosb, buffer, 4, FileNameInformation );
1259  ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryInformationFile failed: %x\n", status );
1260 }
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK iosb
Definition: pipe.c:68
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
__wchar_t WCHAR
Definition: xmlstorage.h:180
return STATUS_SUCCESS
Definition: btrfs.c:2690
GLuint buffer
Definition: glext.h:5915
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: CString.cpp:62
Definition: parser.c:48
#define ok(value,...)
Definition: CComObject.cpp:34
static const WCHAR nameW[]
Definition: main.c:46
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NtQueryInformationFile(HANDLE hFile, PIO_STATUS_BLOCK io, PVOID ptr, ULONG len, FILE_INFORMATION_CLASS FileInformationClass)
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:49
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
#define ok_(x1, x2)
Definition: CString.cpp:56
static void _test_file_name_fail ( unsigned  line,
HANDLE  pipe,
NTSTATUS  expected_status 
)
static

Definition at line 1213 of file pipe.c.

1214 {
1215  char buffer[512];
1217  NTSTATUS status;
1218 
1219  status = NtQueryInformationFile( pipe, &iosb, buffer, sizeof(buffer), FileNameInformation );
1220  ok_(__FILE__,line)( status == expected_status, "NtQueryInformationFile failed: %x, expected %x\n",
1221  status, expected_status );
1222 }
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK iosb
Definition: pipe.c:68
GLuint buffer
Definition: glext.h:5915
Definition: parser.c:48
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NtQueryInformationFile(HANDLE hFile, PIO_STATUS_BLOCK io, PVOID ptr, ULONG len, FILE_INFORMATION_CLASS FileInformationClass)
static SERVICE_STATUS status
Definition: service.c:31
#define ok_(x1, x2)
Definition: CString.cpp:56
static void _test_group ( unsigned  line,
HANDLE  handle,
SID expected_sid,
BOOL  todo 
)
static

Definition at line 1360 of file pipe.c.

1361 {
1362  SECURITY_DESCRIPTOR *sec_desc;
1363  BOOLEAN defaulted;
1364  PSID group_sid;
1365  NTSTATUS status;
1366 
1367  sec_desc = get_security_descriptor(handle, todo);
1368  if (!sec_desc) return;
1369 
1370  status = RtlGetGroupSecurityDescriptor(sec_desc, &group_sid, &defaulted);
1371  ok_(__FILE__,line)(status == STATUS_SUCCESS,
1372  "Failed to query group from security descriptor: %08x\n", status);
1374  ok_(__FILE__,line)(EqualSid(group_sid, expected_sid), "SIDs are not equal\n");
1375 
1376  HeapFree(GetProcessHeap(), 0, sec_desc);
1377 }
return STATUS_SUCCESS
Definition: btrfs.c:2690
BOOL WINAPI EqualSid(PSID pSid1, PSID pSid2)
Definition: security.c:704
#define equal(x, y)
Definition: reader.cc:56
BOOL todo
Definition: filedlg.c:313
static PSECURITY_DESCRIPTOR get_security_descriptor(HANDLE handle, BOOL todo)
Definition: pipe.c:1279
GLuint n
Definition: s_context.h:57
NTSYSAPI NTSTATUS NTAPI RtlGetGroupSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor, OUT PSID *Group, OUT PBOOLEAN GroupDefaulted)
Definition: sd.c:280
Definition: parser.c:48
#define todo_wine_if(is_todo)
Definition: test.h:155
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define GetProcessHeap()
Definition: compat.h:395
static SERVICE_STATUS status
Definition: service.c:31
#define HeapFree(x, y, z)
Definition: compat.h:394
#define ok_(x1, x2)
Definition: CString.cpp:56
static void WINAPI apc ( void arg,
IO_STATUS_BLOCK iosb,
ULONG  reserved 
)
static

Definition at line 798 of file pipe.c.

799 {
800  int *count = arg;
801  (*count)++;
802  ok( !reserved, "reserved is not 0: %x\n", reserved );
803 }
void * arg
Definition: msvc.h:12
#define ok(value,...)
Definition: CComObject.cpp:34
GLuint GLuint GLsizei count
Definition: gl.h:1545
r reserved
Definition: btrfs.c:2620
static NTSTATUS create_pipe ( PHANDLE  handle,
ULONG  sharing,
ULONG  options 
)
static

Definition at line 121 of file pipe.c.

Referenced by test_alertable(), test_cancelio(), test_completion(), test_create(), test_nonalertable(), and test_overlapped().

122 {
127  NTSTATUS res;
128 
129  pRtlInitUnicodeString(&name, testpipe_nt);
130 
131  attr.Length = sizeof(attr);
132  attr.RootDirectory = 0;
133  attr.ObjectName = &name;
134  attr.Attributes = 0x40; /*case insensitive */
135  attr.SecurityDescriptor = NULL;
137 
138  timeout.QuadPart = -100000000;
139 
140  res = pNtCreateNamedPipeFile(handle, FILE_READ_ATTRIBUTES | SYNCHRONIZE, &attr, &iosb, sharing, 2 /*FILE_CREATE*/,
141  options, 1, 0, 0, 0xFFFFFFFF, 500, 500, &timeout);
142  return res;
143 }
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK ULONG sharing
Definition: pipe.c:68
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK iosb
Definition: pipe.c:68
GLuint const GLchar * name
Definition: glext.h:6031
static ULONG POBJECT_ATTRIBUTES attr
Definition: pipe.c:68
smooth NULL
Definition: ftsmooth.c:416
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK ULONG ULONG ULONG ULONG ULONG ULONG ULONG ULONG ULONG PLARGE_INTEGER timeout
Definition: pipe.c:68
#define SYNCHRONIZE
Definition: nt_native.h:61
PVOID SecurityDescriptor
Definition: umtypes.h:175
PVOID SecurityQualityOfService
Definition: umtypes.h:176
GLuint res
Definition: glext.h:9613
PUNICODE_STRING ObjectName
Definition: umtypes.h:173
HANDLE RootDirectory
Definition: umtypes.h:172
static const WCHAR testpipe_nt[]
Definition: pipe.c:118
LONGLONG QuadPart
Definition: typedefs.h:112
static BOOL create_pipe_pair ( HANDLE read,
HANDLE write,
ULONG  flags,
ULONG  type,
ULONG  size 
)
static

Definition at line 831 of file pipe.c.

Referenced by read_pipe_test(), test_file_info(), and test_volume_info().

832 {
833  const BOOL server_reader = flags & PIPE_ACCESS_INBOUND;
835 
838  ok(server != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n");
839 
840  client = CreateFileA(PIPENAME, server_reader ? GENERIC_WRITE : GENERIC_READ | FILE_WRITE_ATTRIBUTES, 0,
842  ok(client != INVALID_HANDLE_VALUE, "CreateFile failed (%d)\n", GetLastError());
843 
844  if(server_reader)
845  {
846  *read = server;
847  *write = client;
848  }
849  else
850  {
852  {
854  ok(SetNamedPipeHandleState(client, &read_mode, NULL, NULL), "Change mode\n");
855  }
856 
857  *read = client;
858  *write = server;
859  }
860  return TRUE;
861 }
#define TRUE
Definition: types.h:120
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define PIPENAME
Definition: pipe.c:829
HANDLE WINAPI CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: npipe.c:220
#define PIPE_WAIT
Definition: winbase.h:171
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
#define NMPWAIT_USE_DEFAULT_WAIT
Definition: winbase.h:134
DWORD DWORD
Definition: winlogon.h:75
#define FILE_WRITE_ATTRIBUTES
Definition: nt_native.h:649
#define write
Definition: acwin.h:73
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizeiptr size
Definition: glext.h:5919
BOOL WINAPI SetNamedPipeHandleState(HANDLE hNamedPipe, LPDWORD lpMode, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout)
Definition: npipe.c:774
static FILE * client
Definition: client.c:41
GLbitfield flags
Definition: glext.h:7161
#define GENERIC_READ
Definition: compat.h:124
#define PIPE_READMODE_MESSAGE
Definition: winbase.h:170
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define PIPE_ACCESS_INBOUND
Definition: winbase.h:165
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK ULONG ULONG ULONG ULONG ULONG read_mode
Definition: pipe.c:68
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
static DWORD ( WINAPI pQueueUserAPC)
static
static TOKEN_PRIMARY_GROUP* get_current_group ( void  )
static

Definition at line 1324 of file pipe.c.

Referenced by test_security_info().

1325 {
1327  ULONG length = 0;
1328  HANDLE token;
1329  BOOL ret;
1330 
1332  ok(ret, "Failed to get process token: %u\n", GetLastError());
1333 
1334  ret = GetTokenInformation(token, TokenPrimaryGroup, NULL, 0, &length);
1336  "GetTokenInformation failed: %u\n", GetLastError());
1337  ok(length != 0, "Failed to get primary group token information length: %u\n", GetLastError());
1338 
1339  group = HeapAlloc(GetProcessHeap(), 0, length);
1340  ret = GetTokenInformation(token, TokenPrimaryGroup, group, length, &length);
1341  ok(ret, "Failed to get primary group token information: %u\n", GetLastError());
1342 
1343  CloseHandle(token);
1344  return group;
1345 }
#define CloseHandle
Definition: compat.h:398
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
int token
Definition: lex.c:71
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1195
#define TOKEN_ALL_ACCESS
Definition: setypes.h:892
int ret
DWORD *typedef HANDLE
Definition: winlogon.h:52
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:292
GLboolean GLuint group
Definition: glext.h:11120
unsigned int ULONG
Definition: retypes.h:1
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:409
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
static TOKEN_OWNER* get_current_owner ( void  )
static

Definition at line 1301 of file pipe.c.

Referenced by test_security_info().

1302 {
1303  TOKEN_OWNER *owner;
1304  ULONG length = 0;
1305  HANDLE token;
1306  BOOL ret;
1307 
1309  ok(ret, "Failed to get process token: %u\n", GetLastError());
1310 
1311  ret = GetTokenInformation(token, TokenOwner, NULL, 0, &length);
1313  "GetTokenInformation failed: %u\n", GetLastError());
1314  ok(length != 0, "Failed to get token owner information length: %u\n", GetLastError());
1315 
1316  owner = HeapAlloc(GetProcessHeap(), 0, length);
1317  ret = GetTokenInformation(token, TokenOwner, owner, length, &length);
1318  ok(ret, "Failed to get token owner information: %u)\n", GetLastError());
1319 
1320  CloseHandle(token);
1321  return owner;
1322 }
#define CloseHandle
Definition: compat.h:398
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
int token
Definition: lex.c:71
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1195
#define TOKEN_ALL_ACCESS
Definition: setypes.h:892
int ret
DWORD *typedef HANDLE
Definition: winlogon.h:52
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:292
unsigned int ULONG
Definition: retypes.h:1
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:409
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
static PSECURITY_DESCRIPTOR get_security_descriptor ( HANDLE  handle,
BOOL  todo 
)
static

Definition at line 1279 of file pipe.c.

Referenced by _test_group().

1280 {
1281  SECURITY_DESCRIPTOR *sec_desc;
1282  ULONG length = 0;
1283  NTSTATUS status;
1284 
1286  NULL, 0, &length);
1288  ok(status == STATUS_BUFFER_TOO_SMALL,
1289  "Failed to query object security descriptor length: %08x\n", status);
1290  if(status != STATUS_BUFFER_TOO_SMALL) return NULL;
1291  ok(length != 0, "length = 0\n");
1292 
1293  sec_desc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, length);
1295  sec_desc, length, &length);
1296  ok(status == STATUS_SUCCESS, "Failed to query object security descriptor: %08x\n", status);
1297 
1298  return sec_desc;
1299 }
#define STATUS_PIPE_DISCONNECTED
Definition: ntstatus.h:398
return STATUS_SUCCESS
Definition: btrfs.c:2690
BOOL todo
Definition: filedlg.c:313
#define GROUP_SECURITY_INFORMATION
Definition: setypes.h:124
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:52
return
Definition: dirsup.c:529
GLuint n
Definition: s_context.h:57
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
Definition: arc.h:79
#define todo_wine_if(is_todo)
Definition: test.h:155
NTSTATUS NTAPI NtQuerySecurityObject(IN HANDLE Handle, IN SECURITY_INFORMATION SecurityInformation, OUT PSECURITY_DESCRIPTOR SecurityDescriptor, IN ULONG Length, OUT PULONG ResultLength)
Definition: obsecure.c:803
LONG NTSTATUS
Definition: precomp.h:26
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
if(!(yy_init))
Definition: macro.lex.yy.c:717
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define OWNER_SECURITY_INFORMATION
Definition: setypes.h:123
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
unsigned int ULONG
Definition: retypes.h:1
static SERVICE_STATUS status
Definition: service.c:31
INT x
Definition: msvc.h:62
static HANDLE ( WINAPI pOpenThread)
static
static BOOL init_func_ptrs ( void  )
static

Definition at line 86 of file pipe.c.

Referenced by START_TEST().

87 {
88  HMODULE module = GetModuleHandleA("ntdll.dll");
89 
90 #define loadfunc(name) if (!(p##name = (void *)GetProcAddress(module, #name))) { \
91  trace("GetProcAddress(%s) failed\n", #name); \
92  return FALSE; \
93  }
94 
102 
103  /* not fatal */
104  pNtCancelIoFileEx = (void *)GetProcAddress(module, "NtCancelIoFileEx");
105  module = GetModuleHandleA("kernel32.dll");
106  pOpenThread = (void *)GetProcAddress(module, "OpenThread");
107  pQueueUserAPC = (void *)GetProcAddress(module, "QueueUserAPC");
108  return TRUE;
109 }
#define TRUE
Definition: types.h:120
NTSYSCALLAPI NTSTATUS NTAPI NtFsControlFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG FsControlCode, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength)
static HMODULE dll
Definition: str.c:188
return
Definition: dirsup.c:529
DWORD WINAPI QueueUserAPC(IN PAPCFUNC pfnAPC, IN HANDLE hThread, IN ULONG_PTR dwData)
Definition: thread.c:932
NTSTATUS NTAPI NtQueryVolumeInformationFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PVOID FsInformation, IN ULONG Length, IN FS_INFORMATION_CLASS FsInformationClass)
Definition: iofunc.c:3833
NTSYSAPI NTSTATUS WINAPI NtCancelIoFileEx(HANDLE, PIO_STATUS_BLOCK, PIO_STATUS_BLOCK)
HANDLE WINAPI OpenThread(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwThreadId)
Definition: thread.c:387
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:818
NTSTATUS NTAPI NtQueryInformationFile(HANDLE hFile, PIO_STATUS_BLOCK io, PVOID ptr, ULONG len, FILE_INFORMATION_CLASS FileInformationClass)
#define loadfunc(name)
HANDLE HMODULE
Definition: typedefs.h:75
NTSTATUS NTAPI NtCancelIoFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock)
Definition: file.c:3575
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define GetProcAddress(x, y)
Definition: compat.h:410
NTSTATUS NTAPI NtCreateNamedPipeFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN ULONG NamedPipeType, IN ULONG ReadMode, IN ULONG CompletionMode, IN ULONG MaximumInstances, IN ULONG InboundQuota, IN ULONG OutboundQuota, IN PLARGE_INTEGER DefaultTimeout)
Definition: file.c:3414
NTSYSAPI NTSTATUS NTAPI NtSetInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
Definition: iofunc.c:2854
static void CALLBACK ioapc ( void arg,
PIO_STATUS_BLOCK  io,
ULONG  reserved 
)
static

Definition at line 146 of file pipe.c.

Referenced by listen_pipe().

147 {
148  ioapc_called = TRUE;
149 }
#define TRUE
Definition: types.h:120
static BOOL ioapc_called
Definition: pipe.c:145
static BOOL is_signaled ( HANDLE  obj)
inlinestatic

Definition at line 111 of file pipe.c.

Referenced by read_pipe_test(), test_overlapped(), and test_peek().

112 {
113  return WaitForSingleObject( obj, 0 ) == WAIT_OBJECT_0;
114 }
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define WAIT_OBJECT_0
Definition: winbase.h:387
static NTSTATUS listen_pipe ( HANDLE  hPipe,
HANDLE  hEvent,
PIO_STATUS_BLOCK  iosb,
BOOL  use_apc 
)
static

Definition at line 151 of file pipe.c.

Referenced by test_alertable(), test_cancelio(), test_completion(), test_create(), test_nonalertable(), and test_overlapped().

152 {
153  int dummy;
154 
156 
157  return pNtFsControlFile(hPipe, hEvent, use_apc ? &ioapc: NULL, use_apc ? &dummy: NULL, iosb, FSCTL_PIPE_LISTEN, 0, 0, 0, 0);
158 }
static HANDLE hEvent
Definition: comm.c:54
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
#define FSCTL_PIPE_LISTEN
Definition: pipe.c:63
static void CALLBACK ioapc(void *arg, PIO_STATUS_BLOCK io, ULONG reserved)
Definition: pipe.c:146
unsigned char dummy
Definition: maze.c:118
static BOOL ioapc_called
Definition: pipe.c:145
static NTSTATUS ( WINAPI pNtFsControlFile)
static
static void read_pipe_test ( ULONG  pipe_flags,
ULONG  pipe_type 
)
static

Definition at line 863 of file pipe.c.

Referenced by START_TEST().

864 {
865  IO_STATUS_BLOCK iosb, iosb2;
867  HANDLE event = CreateEventA( NULL, TRUE, FALSE, NULL );
868  int apc_count = 0;
869  char buffer[128];
870  DWORD written;
871  BOOL ret;
873 
874  if (!create_pipe_pair( &read, &write, FILE_FLAG_OVERLAPPED | pipe_flags, pipe_type, 4096 )) return;
875 
876  /* try read with no data */
877  U(iosb).Status = 0xdeadbabe;
878  iosb.Information = 0xdeadbeef;
879  ok( is_signaled( read ), "read handle is not signaled\n" );
880  status = NtReadFile( read, event, apc, &apc_count, &iosb, buffer, 1, NULL, NULL );
881  ok( status == STATUS_PENDING, "wrong status %x\n", status );
882  ok( !is_signaled( read ), "read handle is signaled\n" );
883  ok( !is_signaled( event ), "event is signaled\n" );
884  ok( U(iosb).Status == 0xdeadbabe, "wrong status %x\n", U(iosb).Status );
885  ok( iosb.Information == 0xdeadbeef, "wrong info %lu\n", iosb.Information );
886  ok( !apc_count, "apc was called\n" );
887  ret = WriteFile( write, buffer, 1, &written, NULL );
888  ok(ret && written == 1, "WriteFile error %d\n", GetLastError());
889  /* iosb updated here by async i/o */
890  ok( U(iosb).Status == 0, "wrong status %x\n", U(iosb).Status );
891  ok( iosb.Information == 1, "wrong info %lu\n", iosb.Information );
892  ok( !is_signaled( read ), "read handle is signaled\n" );
893  ok( is_signaled( event ), "event is not signaled\n" );
894  ok( !apc_count, "apc was called\n" );
895  apc_count = 0;
896  SleepEx( 1, FALSE ); /* non-alertable sleep */
897  ok( !apc_count, "apc was called\n" );
898  SleepEx( 1, TRUE ); /* alertable sleep */
899  ok( apc_count == 1, "apc not called\n" );
900 
901  /* with no event, the pipe handle itself gets signaled */
902  apc_count = 0;
903  U(iosb).Status = 0xdeadbabe;
904  iosb.Information = 0xdeadbeef;
905  ok( !is_signaled( read ), "read handle is signaled\n" );
906  status = NtReadFile( read, 0, apc, &apc_count, &iosb, buffer, 1, NULL, NULL );
907  ok( status == STATUS_PENDING, "wrong status %x\n", status );
908  ok( !is_signaled( read ), "read handle is signaled\n" );
909  ok( U(iosb).Status == 0xdeadbabe, "wrong status %x\n", U(iosb).Status );
910  ok( iosb.Information == 0xdeadbeef, "wrong info %lu\n", iosb.Information );
911  ok( !apc_count, "apc was called\n" );
912  ret = WriteFile( write, buffer, 1, &written, NULL );
913  ok(ret && written == 1, "WriteFile error %d\n", GetLastError());
914  /* iosb updated here by async i/o */
915  ok( U(iosb).Status == 0, "wrong status %x\n", U(iosb).Status );
916  ok( iosb.Information == 1, "wrong info %lu\n", iosb.Information );
917  ok( is_signaled( read ), "read handle is not signaled\n" );
918  ok( !apc_count, "apc was called\n" );
919  apc_count = 0;
920  SleepEx( 1, FALSE ); /* non-alertable sleep */
921  ok( !apc_count, "apc was called\n" );
922  SleepEx( 1, TRUE ); /* alertable sleep */
923  ok( apc_count == 1, "apc not called\n" );
924 
925  /* now read with data ready */
926  apc_count = 0;
927  U(iosb).Status = 0xdeadbabe;
928  iosb.Information = 0xdeadbeef;
929  ResetEvent( event );
930  ret = WriteFile( write, buffer, 1, &written, NULL );
931  ok(ret && written == 1, "WriteFile error %d\n", GetLastError());
932 
933  test_peek(read);
934 
935  status = NtReadFile( read, event, apc, &apc_count, &iosb, buffer, 1, NULL, NULL );
936  ok( status == STATUS_SUCCESS, "wrong status %x\n", status );
937  ok( U(iosb).Status == 0, "wrong status %x\n", U(iosb).Status );
938  ok( iosb.Information == 1, "wrong info %lu\n", iosb.Information );
939  ok( is_signaled( event ), "event is not signaled\n" );
940  ok( !apc_count, "apc was called\n" );
941  SleepEx( 1, FALSE ); /* non-alertable sleep */
942  ok( !apc_count, "apc was called\n" );
943  SleepEx( 1, TRUE ); /* alertable sleep */
944  ok( apc_count == 1, "apc not called\n" );
945 
946  /* now partial read with data ready */
947  apc_count = 0;
948  U(iosb).Status = 0xdeadbabe;
949  iosb.Information = 0xdeadbeef;
950  ResetEvent( event );
951  ret = WriteFile( write, buffer, 2, &written, NULL );
952  ok(ret && written == 2, "WriteFile error %d\n", GetLastError());
953  status = NtReadFile( read, event, apc, &apc_count, &iosb, buffer, 1, NULL, NULL );
955  {
956  ok( status == STATUS_BUFFER_OVERFLOW, "wrong status %x\n", status );
957  ok( U(iosb).Status == STATUS_BUFFER_OVERFLOW, "wrong status %x\n", U(iosb).Status );
958  }
959  else
960  {
961  ok( status == STATUS_SUCCESS, "wrong status %x\n", status );
962  ok( U(iosb).Status == 0, "wrong status %x\n", U(iosb).Status );
963  }
964  ok( iosb.Information == 1, "wrong info %lu\n", iosb.Information );
965  ok( is_signaled( event ), "event is not signaled\n" );
966  ok( !apc_count, "apc was called\n" );
967  SleepEx( 1, FALSE ); /* non-alertable sleep */
968  ok( !apc_count, "apc was called\n" );
969  SleepEx( 1, TRUE ); /* alertable sleep */
970  ok( apc_count == 1, "apc not called\n" );
971  apc_count = 0;
972  status = NtReadFile( read, event, apc, &apc_count, &iosb, buffer, 1, NULL, NULL );
973  ok( status == STATUS_SUCCESS, "wrong status %x\n", status );
974  ok( U(iosb).Status == 0, "wrong status %x\n", U(iosb).Status );
975  ok( iosb.Information == 1, "wrong info %lu\n", iosb.Information );
976  ok( is_signaled( event ), "event is not signaled\n" );
977  ok( !apc_count, "apc was called\n" );
978  SleepEx( 1, FALSE ); /* non-alertable sleep */
979  ok( !apc_count, "apc was called\n" );
980  SleepEx( 1, TRUE ); /* alertable sleep */
981  ok( apc_count == 1, "apc not called\n" );
982 
983  /* try read with no data */
984  apc_count = 0;
985  U(iosb).Status = 0xdeadbabe;
986  iosb.Information = 0xdeadbeef;
987  ok( is_signaled( event ), "event is not signaled\n" ); /* check that read resets the event */
988  status = NtReadFile( read, event, apc, &apc_count, &iosb, buffer, 2, NULL, NULL );
989  ok( status == STATUS_PENDING, "wrong status %x\n", status );
990  ok( !is_signaled( event ), "event is signaled\n" );
991  ok( U(iosb).Status == 0xdeadbabe, "wrong status %x\n", U(iosb).Status );
992  ok( iosb.Information == 0xdeadbeef, "wrong info %lu\n", iosb.Information );
993  ok( !apc_count, "apc was called\n" );
994  ret = WriteFile( write, buffer, 1, &written, NULL );
995  ok(ret && written == 1, "WriteFile error %d\n", GetLastError());
996  /* partial read is good enough */
997  Sleep(1); /* FIXME: needed for wine to run the i/o apc */
998  ok( is_signaled( event ), "event is not signaled\n" );
999  ok( U(iosb).Status == 0, "wrong status %x\n", U(iosb).Status );
1000  ok( iosb.Information == 1, "wrong info %lu\n", iosb.Information );
1001  ok( !apc_count, "apc was called\n" );
1002  SleepEx( 1, TRUE ); /* alertable sleep */
1003  ok( apc_count == 1, "apc was not called\n" );
1004 
1005  /* read from disconnected pipe */
1006  apc_count = 0;
1007  U(iosb).Status = 0xdeadbabe;
1008  iosb.Information = 0xdeadbeef;
1009  CloseHandle( write );
1010  status = NtReadFile( read, event, apc, &apc_count, &iosb, buffer, 1, NULL, NULL );
1011  ok( status == STATUS_PIPE_BROKEN, "wrong status %x\n", status );
1012  ok( U(iosb).Status == 0xdeadbabe, "wrong status %x\n", U(iosb).Status );
1013  ok( iosb.Information == 0xdeadbeef, "wrong info %lu\n", iosb.Information );
1014  ok( !is_signaled( event ), "event is signaled\n" );
1015  ok( !apc_count, "apc was called\n" );
1016  SleepEx( 1, TRUE ); /* alertable sleep */
1017  ok( !apc_count, "apc was called\n" );
1018  CloseHandle( read );
1019 
1020  /* read from disconnected pipe, with invalid event handle */
1021  apc_count = 0;
1022  U(iosb).Status = 0xdeadbabe;
1023  iosb.Information = 0xdeadbeef;
1024  status = NtReadFile( read, (HANDLE)0xdeadbeef, apc, &apc_count, &iosb, buffer, 1, NULL, NULL );
1025  ok( status == STATUS_INVALID_HANDLE, "wrong status %x\n", status );
1026  ok( U(iosb).Status == 0xdeadbabe, "wrong status %x\n", U(iosb).Status );
1027  ok( iosb.Information == 0xdeadbeef, "wrong info %lu\n", iosb.Information );
1028  ok( !apc_count, "apc was called\n" );
1029  SleepEx( 1, TRUE ); /* alertable sleep */
1030  ok( !apc_count, "apc was called\n" );
1031  CloseHandle( read );
1032 
1033  /* read from closed handle */
1034  apc_count = 0;
1035  U(iosb).Status = 0xdeadbabe;
1036  iosb.Information = 0xdeadbeef;
1037  SetEvent( event );
1038  status = NtReadFile( read, event, apc, &apc_count, &iosb, buffer, 1, NULL, NULL );
1039  ok( status == STATUS_INVALID_HANDLE, "wrong status %x\n", status );
1040  ok( U(iosb).Status == 0xdeadbabe, "wrong status %x\n", U(iosb).Status );
1041  ok( iosb.Information == 0xdeadbeef, "wrong info %lu\n", iosb.Information );
1042  ok( is_signaled( event ), "event is not signaled\n" ); /* not reset on invalid handle */
1043  ok( !apc_count, "apc was called\n" );
1044  SleepEx( 1, TRUE ); /* alertable sleep */
1045  ok( !apc_count, "apc was called\n" );
1046 
1047  /* disconnect while async read is in progress */
1048  if (!create_pipe_pair( &read, &write, FILE_FLAG_OVERLAPPED | pipe_flags, pipe_type, 4096 )) return;
1049  apc_count = 0;
1050  U(iosb).Status = 0xdeadbabe;
1051  iosb.Information = 0xdeadbeef;
1052  status = NtReadFile( read, event, apc, &apc_count, &iosb, buffer, 2, NULL, NULL );
1053  ok( status == STATUS_PENDING, "wrong status %x\n", status );
1054  ok( !is_signaled( event ), "event is signaled\n" );
1055  ok( U(iosb).Status == 0xdeadbabe, "wrong status %x\n", U(iosb).Status );
1056  ok( iosb.Information == 0xdeadbeef, "wrong info %lu\n", iosb.Information );
1057  ok( !apc_count, "apc was called\n" );
1058  CloseHandle( write );
1059  Sleep(1); /* FIXME: needed for wine to run the i/o apc */
1060  ok( U(iosb).Status == STATUS_PIPE_BROKEN, "wrong status %x\n", U(iosb).Status );
1061  ok( iosb.Information == 0, "wrong info %lu\n", iosb.Information );
1062  ok( is_signaled( event ), "event is not signaled\n" );
1063  ok( !apc_count, "apc was called\n" );
1064  SleepEx( 1, TRUE ); /* alertable sleep */
1065  ok( apc_count == 1, "apc was not called\n" );
1066  CloseHandle( read );
1067 
1068  if (!create_pipe_pair( &read, &write, FILE_FLAG_OVERLAPPED | pipe_flags, pipe_type, 4096 )) return;
1070  ok(ret, "Failed to duplicate handle: %d\n", GetLastError());
1071 
1072  apc_count = 0;
1073  U(iosb).Status = 0xdeadbabe;
1074  iosb.Information = 0xdeadbeef;
1075  status = NtReadFile( handle, event, apc, &apc_count, &iosb, buffer, 2, NULL, NULL );
1076  ok( status == STATUS_PENDING, "wrong status %x\n", status );
1077  ok( !is_signaled( event ), "event is signaled\n" );
1078  ok( U(iosb).Status == 0xdeadbabe, "wrong status %x\n", U(iosb).Status );
1079  ok( iosb.Information == 0xdeadbeef, "wrong info %lu\n", iosb.Information );
1080  ok( !apc_count, "apc was called\n" );
1081  /* Cancel by other handle */
1082  status = pNtCancelIoFile( read, &iosb2 );
1083  ok(status == STATUS_SUCCESS, "failed to cancel by different handle: %x\n", status);
1084  Sleep(1); /* FIXME: needed for wine to run the i/o apc */
1085  ok( U(iosb).Status == STATUS_CANCELLED, "wrong status %x\n", U(iosb).Status );
1086  ok( iosb.Information == 0, "wrong info %lu\n", iosb.Information );
1087  ok( is_signaled( event ), "event is not signaled\n" );
1088  ok( !apc_count, "apc was called\n" );
1089  SleepEx( 1, TRUE ); /* alertable sleep */
1090  ok( apc_count == 1, "apc was not called\n" );
1091 
1092  apc_count = 0;
1093  U(iosb).Status = 0xdeadbabe;
1094  iosb.Information = 0xdeadbeef;
1095  status = NtReadFile( read, event, apc, &apc_count, &iosb, buffer, 2, NULL, NULL );
1096  ok( status == STATUS_PENDING, "wrong status %x\n", status );
1097  ok( !is_signaled( event ), "event is signaled\n" );
1098  ok( U(iosb).Status == 0xdeadbabe, "wrong status %x\n", U(iosb).Status );
1099  ok( iosb.Information == 0xdeadbeef, "wrong info %lu\n", iosb.Information );
1100  ok( !apc_count, "apc was called\n" );
1101  /* Close queued handle */
1102  CloseHandle( read );
1103  SleepEx( 1, TRUE ); /* alertable sleep */
1104  ok( U(iosb).Status == 0xdeadbabe, "wrong status %x\n", U(iosb).Status );
1105  ok( iosb.Information == 0xdeadbeef, "wrong info %lu\n", iosb.Information );
1106  status = pNtCancelIoFile( read, &iosb2 );
1107  ok(status == STATUS_INVALID_HANDLE, "cancelled by closed handle?\n");
1108  status = pNtCancelIoFile( handle, &iosb2 );
1109  ok(status == STATUS_SUCCESS, "failed to cancel: %x\n", status);
1110  Sleep(1); /* FIXME: needed for wine to run the i/o apc */
1111  ok( U(iosb).Status == STATUS_CANCELLED, "wrong status %x\n", U(iosb).Status );
1112  ok( iosb.Information == 0, "wrong info %lu\n", iosb.Information );
1113  ok( is_signaled( event ), "event is not signaled\n" );
1114  ok( !apc_count, "apc was called\n" );
1115  SleepEx( 1, TRUE ); /* alertable sleep */
1116  ok( apc_count == 1, "apc was not called\n" );
1117  CloseHandle( handle );
1118  CloseHandle( write );
1119 
1120  if (pNtCancelIoFileEx)
1121  {
1122  /* Basic Cancel Ex */
1123  if (!create_pipe_pair( &read, &write, FILE_FLAG_OVERLAPPED | pipe_flags, pipe_type, 4096 )) return;
1124 
1125  apc_count = 0;
1126  U(iosb).Status = 0xdeadbabe;
1127  iosb.Information = 0xdeadbeef;
1128  status = NtReadFile( read, event, apc, &apc_count, &iosb, buffer, 2, NULL, NULL );
1129  ok( status == STATUS_PENDING, "wrong status %x\n", status );
1130  ok( !is_signaled( event ), "event is signaled\n" );
1131  ok( U(iosb).Status == 0xdeadbabe, "wrong status %x\n", U(iosb).Status );
1132  ok( iosb.Information == 0xdeadbeef, "wrong info %lu\n", iosb.Information );
1133  ok( !apc_count, "apc was called\n" );
1134  status = pNtCancelIoFileEx( read, &iosb, &iosb2 );
1135  ok(status == STATUS_SUCCESS, "Failed to cancel I/O\n");
1136  Sleep(1); /* FIXME: needed for wine to run the i/o apc */
1137  ok( U(iosb).Status == STATUS_CANCELLED, "wrong status %x\n", U(iosb).Status );
1138  ok( iosb.Information == 0, "wrong info %lu\n", iosb.Information );
1139  ok( is_signaled( event ), "event is not signaled\n" );
1140  ok( !apc_count, "apc was called\n" );
1141  SleepEx( 1, TRUE ); /* alertable sleep */
1142  ok( apc_count == 1, "apc was not called\n" );
1143 
1144  /* Duplicate iosb */
1145  apc_count = 0;
1146  U(iosb).Status = 0xdeadbabe;
1147  iosb.Information = 0xdeadbeef;
1148  status = NtReadFile( read, event, apc, &apc_count, &iosb, buffer, 2, NULL, NULL );
1149  ok( status == STATUS_PENDING, "wrong status %x\n", status );
1150  ok( !is_signaled( event ), "event is signaled\n" );
1151  ok( U(iosb).Status == 0xdeadbabe, "wrong status %x\n", U(iosb).Status );
1152  ok( iosb.Information == 0xdeadbeef, "wrong info %lu\n", iosb.Information );
1153  ok( !apc_count, "apc was called\n" );
1154  status = NtReadFile( read, event, apc, &apc_count, &iosb, buffer, 2, NULL, NULL );
1155  ok( status == STATUS_PENDING, "wrong status %x\n", status );
1156  ok( !is_signaled( event ), "event is signaled\n" );
1157  ok( U(iosb).Status == 0xdeadbabe, "wrong status %x\n", U(iosb).Status );
1158  ok( iosb.Information == 0xdeadbeef, "wrong info %lu\n", iosb.Information );
1159  ok( !apc_count, "apc was called\n" );
1160  status = pNtCancelIoFileEx( read, &iosb, &iosb2 );
1161  ok(status == STATUS_SUCCESS, "Failed to cancel I/O\n");
1162  Sleep(1); /* FIXME: needed for wine to run the i/o apc */
1163  ok( U(iosb).Status == STATUS_CANCELLED, "wrong status %x\n", U(iosb).Status );
1164  ok( iosb.Information == 0, "wrong info %lu\n", iosb.Information );
1165  ok( is_signaled( event ), "event is not signaled\n" );
1166  ok( !apc_count, "apc was called\n" );
1167  SleepEx( 1, TRUE ); /* alertable sleep */
1168  ok( apc_count == 2, "apc was not called\n" );
1169 
1170  CloseHandle( read );
1171  CloseHandle( write );
1172  }
1173  else
1174  win_skip("NtCancelIoFileEx not available\n");
1175 
1176  CloseHandle(event);
1177 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define TRUE
Definition: types.h:120
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK iosb
Definition: pipe.c:68
#define CloseHandle
Definition: compat.h:398
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:736
return STATUS_SUCCESS
Definition: btrfs.c:2690
#define U(x)
Definition: wordpad.c:44
static BOOL is_signaled(HANDLE obj)
Definition: pipe.c:111
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
GLuint buffer
Definition: glext.h:5915
static HANDLE PIO_APC_ROUTINE apc
Definition: pipe.c:67
DWORD DWORD
Definition: winlogon.h:75
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
#define write
Definition: acwin.h:73
#define DUPLICATE_SAME_ACCESS
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:583
static BOOL create_pipe_pair(HANDLE *read, HANDLE *write, ULONG flags, ULONG type, ULONG size)
Definition: pipe.c:831
#define ok(value,...)
Definition: CComObject.cpp:34
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
DWORD WINAPI SleepEx(IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:748
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_PENDING
Definition: ntstatus.h:82
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1195
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
#define STATUS_PIPE_BROKEN
Definition: ntstatus.h:553
int ret
struct _cl_event * event
Definition: glext.h:7739
Status
Definition: gdiplustypes.h:24
#define PIPE_READMODE_MESSAGE
Definition: winbase.h:170
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:49
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:660
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK ULONG ULONG ULONG ULONG pipe_type
Definition: pipe.c:68
static void test_peek(HANDLE pipe)
Definition: pipe.c:805
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
static SERVICE_STATUS status
Definition: service.c:31
#define win_skip
Definition: test.h:141
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
Definition: handle.c:149
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
NTSTATUS NTAPI NtReadFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key)
START_TEST ( pipe  )

Definition at line 1492 of file pipe.c.

1493 {
1494  if (!init_func_ptrs())
1495  return;
1496 
1497  trace("starting invalid create tests\n");
1499 
1500  trace("starting create tests\n");
1501  test_create();
1502 
1503  trace("starting overlapped tests\n");
1504  test_overlapped();
1505 
1506  trace("starting completion tests\n");
1507  test_completion();
1508 
1509  trace("starting FILE_PIPE_INFORMATION tests\n");
1511 
1512  if (!pOpenThread || !pQueueUserAPC)
1513  return;
1514 
1515  trace("starting alertable tests\n");
1516  test_alertable();
1517 
1518  trace("starting nonalertable tests\n");
1520 
1521  trace("starting cancelio tests\n");
1522  test_cancelio();
1523 
1524  trace("starting byte read in byte mode client -> server\n");
1526  trace("starting byte read in message mode client -> server\n");
1528  trace("starting message read in message mode client -> server\n");
1530  trace("starting byte read in byte mode server -> client\n");
1532  trace("starting byte read in message mode server -> client\n");
1534  trace("starting message read in message mode server -> client\n");
1536 
1537  test_volume_info();
1538  test_file_info();
1540 }
#define trace(...)
Definition: kmt_test.h:217
#define PIPE_TYPE_MESSAGE
Definition: winbase.h:168
static void test_nonalertable(void)
Definition: pipe.c:511
static BOOL init_func_ptrs(void)
Definition: pipe.c:86
static void test_security_info(void)
Definition: pipe.c:1379
static void test_cancelio(void)
Definition: pipe.c:556
static void test_file_info(void)
Definition: pipe.c:1262
static void test_alertable(void)
Definition: pipe.c:441
#define PIPE_TYPE_BYTE
Definition: winbase.h:167
static void test_filepipeinfo(void)
Definition: pipe.c:630
static void test_completion(void)
Definition: pipe.c:339
static void test_volume_info(void)
Definition: pipe.c:1179
static void test_create_invalid(void)
Definition: pipe.c:160
#define PIPE_ACCESS_OUTBOUND
Definition: winbase.h:166
static void test_overlapped(void)
Definition: pipe.c:282
#define PIPE_READMODE_MESSAGE
Definition: winbase.h:170
#define PIPE_ACCESS_INBOUND
Definition: winbase.h:165
static void test_create(void)
Definition: pipe.c:220
static void read_pipe_test(ULONG pipe_flags, ULONG pipe_type)
Definition: pipe.c:863
static void test_alertable ( void  )
static

Definition at line 441 of file pipe.c.

Referenced by START_TEST().

442 {
444  HANDLE hEvent;
445  HANDLE hPipe;
446  NTSTATUS res;
447  HANDLE hThread;
448  DWORD ret;
449 
450  memset(&iosb, 0x55, sizeof(iosb));
451 
452  hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
453  ok(hEvent != INVALID_HANDLE_VALUE, "can't create event, GetLastError: %x\n", GetLastError());
454 
456  ok(!res, "NtCreateNamedPipeFile returned %x\n", res);
457 
458 /* queue an user apc before calling listen */
460  ret = pQueueUserAPC(&userapc, GetCurrentThread(), 0);
461  ok(ret, "can't queue user apc, GetLastError: %x\n", GetLastError());
462 
463  res = listen_pipe(hPipe, hEvent, &iosb, TRUE);
464  todo_wine ok(res == STATUS_CANCELLED, "NtFsControlFile returned %x\n", res);
465 
466  todo_wine ok(userapc_called, "user apc didn't run\n");
467  ok(U(iosb).Status == 0x55555555, "iosb.Status got changed to %x\n", U(iosb).Status);
468  todo_wine ok(WaitForSingleObjectEx(hEvent, 0, TRUE) == WAIT_TIMEOUT, "hEvent signaled\n");
469  ok(!ioapc_called, "IOAPC ran\n");
470 
471 /* queue an user apc from a different thread */
472  hThread = CreateThread(NULL, 0, &thread, pOpenThread(MAXIMUM_ALLOWED, FALSE, GetCurrentThreadId()), 0, 0);
473  ok(hThread != INVALID_HANDLE_VALUE, "can't create thread, GetLastError: %x\n", GetLastError());
474 
475  /* wine_todo: the earlier NtFsControlFile call gets cancelled after the pipe gets set into listen state
476  instead of before, so this NtFsControlFile will fail STATUS_INVALID_HANDLE */
477  res = listen_pipe(hPipe, hEvent, &iosb, TRUE);
478  todo_wine ok(res == STATUS_CANCELLED, "NtFsControlFile returned %x\n", res);
479 
480  ok(userapc_called, "user apc didn't run\n");
481  ok(U(iosb).Status == 0x55555555, "iosb.Status got changed to %x\n", U(iosb).Status);
482  ok(WaitForSingleObjectEx(hEvent, 0, TRUE) == WAIT_TIMEOUT, "hEvent signaled\n");
483  ok(!ioapc_called, "IOAPC ran\n");
484 
485  WaitForSingleObject(hThread, INFINITE);
486 
487  SleepEx(0, TRUE); /* get rid of the userapc, if NtFsControlFile failed */
488 
489  ok(open_succeeded, "couldn't open client side pipe\n");
490 
491  CloseHandle(hThread);
492  DisconnectNamedPipe(hPipe);
493 
494 /* finally try without an apc */
495  hThread = CreateThread(NULL, 0, &thread, 0, 0, 0);
496  ok(hThread != INVALID_HANDLE_VALUE, "can't create thread, GetLastError: %x\n", GetLastError());
497 
498  res = listen_pipe(hPipe, hEvent, &iosb, TRUE);
499  todo_wine ok(!res, "NtFsControlFile returned %x\n", res);
500 
501  ok(open_succeeded, "couldn't open client side pipe\n");
502  ok(!U(iosb).Status, "Wrong iostatus %x\n", U(iosb).Status);
503  todo_wine ok(WaitForSingleObject(hEvent, 0) == 0, "hEvent not signaled\n");
504 
505  WaitForSingleObject(hThread, INFINITE);
506  CloseHandle(hThread);
507  CloseHandle(hEvent);
508  CloseHandle(hPipe);
509 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
DWORD WINAPI WaitForSingleObjectEx(IN HANDLE hHandle, IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:94
#define TRUE
Definition: types.h:120
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK iosb
Definition: pipe.c:68
#define CloseHandle
Definition: compat.h:398
static BOOL open_succeeded
Definition: pipe.c:412
static BOOL userapc_called
Definition: pipe.c:406
#define U(x)
Definition: wordpad.c:44
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
DWORD DWORD
Definition: winlogon.h:75
#define FILE_SHARE_READ
Definition: compat.h:125
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
static HANDLE hEvent
Definition: comm.c:54
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define FALSE
Definition: types.h:117
HANDLE WINAPI GetCurrentThread(VOID)
Definition: proc.c:1205
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:135
smooth NULL
Definition: ftsmooth.c:416
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:443
#define ok(value,...)
Definition: CComObject.cpp:34
static NTSTATUS listen_pipe(HANDLE hPipe, HANDLE hEvent, PIO_STATUS_BLOCK iosb, BOOL use_apc)
Definition: pipe.c:151
DWORD WINAPI SleepEx(IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:748
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
#define WAIT_TIMEOUT
Definition: dderror.h:14
int ret
static NTSTATUS create_pipe(PHANDLE handle, ULONG sharing, ULONG options)
Definition: pipe.c:121
#define FILE_SYNCHRONOUS_IO_ALERT
Definition: pipe.c:55
#define todo_wine
Definition: test.h:154
BOOL WINAPI DisconnectNamedPipe(HANDLE hNamedPipe)
Definition: npipe.c:961
static void CALLBACK userapc(ULONG_PTR dwParam)
Definition: pipe.c:407
Status
Definition: gdiplustypes.h:24
DWORD *typedef HANDLE
Definition: winlogon.h:52
static DWORD WINAPI thread(PVOID main_thread)
Definition: pipe.c:413
static HANDLE hThread
Definition: pipe.c:40
GLuint res
Definition: glext.h:9613
#define INFINITE
Definition: serial.h:102
#define memset(x, y, z)
Definition: compat.h:39
static BOOL ioapc_called
Definition: pipe.c:145
static void test_cancelio ( void  )
static

Definition at line 556 of file pipe.c.

Referenced by START_TEST().

557 {
559  IO_STATUS_BLOCK cancel_sb;
560  HANDLE hEvent;
561  HANDLE hPipe;
562  NTSTATUS res;
563 
564  hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
565  ok(hEvent != INVALID_HANDLE_VALUE, "can't create event, GetLastError: %x\n", GetLastError());
566 
567  res = create_pipe(&hPipe, FILE_SHARE_READ | FILE_SHARE_WRITE, 0 /* OVERLAPPED */);
568  ok(!res, "NtCreateNamedPipeFile returned %x\n", res);
569 
570  memset(&iosb, 0x55, sizeof(iosb));
571 
572  res = listen_pipe(hPipe, hEvent, &iosb, TRUE);
573  ok(res == STATUS_PENDING, "NtFsControlFile returned %x\n", res);
574 
575  res = pNtCancelIoFile(hPipe, &cancel_sb);
576  ok(!res, "NtCancelIoFile returned %x\n", res);
577 
578  ok(U(iosb).Status == STATUS_CANCELLED, "Wrong iostatus %x\n", U(iosb).Status);
579  ok(WaitForSingleObject(hEvent, 0) == 0, "hEvent not signaled\n");
580 
581  ok(!ioapc_called, "IOAPC ran too early\n");
582 
583  SleepEx(0, TRUE); /* alertable wait state */
584 
585  ok(ioapc_called, "IOAPC didn't run\n");
586 
587  CloseHandle(hPipe);
588 
589  if (pNtCancelIoFileEx)
590  {
591  res = create_pipe(&hPipe, FILE_SHARE_READ | FILE_SHARE_WRITE, 0 /* OVERLAPPED */);
592  ok(!res, "NtCreateNamedPipeFile returned %x\n", res);
593 
594  memset(&iosb, 0x55, sizeof(iosb));
595  res = listen_pipe(hPipe, hEvent, &iosb, FALSE);
596  ok(res == STATUS_PENDING, "NtFsControlFile returned %x\n", res);
597 
598  res = pNtCancelIoFileEx(hPipe, &iosb, &cancel_sb);
599  ok(!res, "NtCancelIoFileEx returned %x\n", res);
600 
601  ok(U(iosb).Status == STATUS_CANCELLED, "Wrong iostatus %x\n", U(iosb).Status);
602  ok(WaitForSingleObject(hEvent, 0) == 0, "hEvent not signaled\n");
603 
604  CloseHandle(hPipe);
605  }
606  else
607  win_skip("NtCancelIoFileEx not available\n");
608 
609  CloseHandle(hEvent);
610 }
#define TRUE
Definition: types.h:120
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK iosb
Definition: pipe.c:68
#define CloseHandle
Definition: compat.h:398
#define U(x)
Definition: wordpad.c:44
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:125
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
static HANDLE hEvent
Definition: comm.c:54
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
static NTSTATUS listen_pipe(HANDLE hPipe, HANDLE hEvent, PIO_STATUS_BLOCK iosb, BOOL use_apc)
Definition: pipe.c:151
DWORD WINAPI SleepEx(IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:748
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
static NTSTATUS create_pipe(PHANDLE handle, ULONG sharing, ULONG options)
Definition: pipe.c:121
Status
Definition: gdiplustypes.h:24
DWORD *typedef HANDLE
Definition: winlogon.h:52
GLuint res
Definition: glext.h:9613
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141
static BOOL ioapc_called
Definition: pipe.c:145
static void test_completion ( void  )
static

Definition at line 339 of file pipe.c.

Referenced by START_TEST().

340 {
341  static const char buf[] = "testdata";
343  HANDLE port, pipe, client;
345  OVERLAPPED ov, *pov;
349  ULONG_PTR key;
350  DWORD dwret;
351  BOOL ret;
352 
353  memset(&ov, 0, sizeof(ov));
355  ok(ov.hEvent != INVALID_HANDLE_VALUE, "CreateEvent failed, error %u\n", GetLastError());
356 
357  status = create_pipe(&pipe, FILE_SHARE_READ | FILE_SHARE_WRITE, 0 /* OVERLAPPED */);
358  ok(!status, "NtCreateNamedPipeFile returned %x\n", status);
359  status = listen_pipe(pipe, ov.hEvent, &iosb, FALSE);
360  ok(status == STATUS_PENDING, "NtFsControlFile returned %x\n", status);
361 
364  ok(client != INVALID_HANDLE_VALUE, "CreateFile failed, error %u\n", GetLastError());
365  dwret = WaitForSingleObject(ov.hEvent, 0);
366  ok(dwret == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %u\n", dwret);
367 
368  port = CreateIoCompletionPort(client, NULL, 0xdeadbeef, 0);
369  ok(port != NULL, "CreateIoCompletionPort failed, error %u\n", GetLastError());
370 
371  ret = WriteFile(client, buf, sizeof(buf), &num_bytes, &ov);
372  ok(ret, "WriteFile failed, error %u\n", GetLastError());
373  ok(num_bytes == sizeof(buf), "expected sizeof(buf), got %u\n", num_bytes);
374 
375  key = 0;
376  pov = NULL;
377  ret = GetQueuedCompletionStatus(port, &num_bytes, &key, &pov, 1000);
378  ok(ret, "GetQueuedCompletionStatus failed, error %u\n", GetLastError());
379  ok(key == 0xdeadbeef, "expected 0xdeadbeef, got %lx\n", key);
380  ok(pov == &ov, "expected %p, got %p\n", &ov, pov);
381 
383  status = pNtSetInformationFile(client, &io, &info, sizeof(info), FileIoCompletionNotificationInformation);
384  ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %08x\n", status);
385 
386  info.Flags = 0;
387  status = pNtQueryInformationFile(client, &io, &info, sizeof(info), FileIoCompletionNotificationInformation);
388  ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %08x\n", status);
389  ok((info.Flags & FILE_SKIP_COMPLETION_PORT_ON_SUCCESS) != 0, "got %08x\n", info.Flags);
390 
391  ret = WriteFile(client, buf, sizeof(buf), &num_bytes, &ov);
392  ok(ret, "WriteFile failed, error %u\n", GetLastError());
393  ok(num_bytes == sizeof(buf), "expected sizeof(buf), got %u\n", num_bytes);
394 
395  pov = (void *)0xdeadbeef;
396  ret = GetQueuedCompletionStatus(port, &num_bytes, &key, &pov, 1000);
397  ok(!ret, "GetQueuedCompletionStatus succeeded\n");
398  ok(pov == NULL, "expected NULL, got %p\n", pov);
399 
400  CloseHandle(ov.hEvent);
401  CloseHandle(client);
402  CloseHandle(pipe);
403  CloseHandle(port);
404 }
#define TRUE
Definition: types.h:120
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK iosb
Definition: pipe.c:68
#define CloseHandle
Definition: compat.h:398
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
return STATUS_SUCCESS
Definition: btrfs.c:2690
BOOL WINAPI GetQueuedCompletionStatus(IN HANDLE CompletionHandle, IN LPDWORD lpNumberOfBytesTransferred, OUT PULONG_PTR lpCompletionKey, OUT LPOVERLAPPED *lpOverlapped, IN DWORD dwMilliseconds)
Definition: iocompl.c:114
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK io
Definition: pipe.c:67
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS
Definition: iocompl.c:21
DWORD DWORD
Definition: winlogon.h:75
#define FILE_SHARE_READ
Definition: compat.h:125
uint32_t ULONG_PTR
Definition: typedefs.h:63
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define FALSE
Definition: types.h:117
#define GENERIC_WRITE
Definition: nt_native.h:90
HANDLE hEvent
Definition: winbase.h:792
smooth NULL
Definition: ftsmooth.c:416
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:583
#define OPEN_EXISTING
Definition: compat.h:426
#define ok(value,...)
Definition: CComObject.cpp:34
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
static NTSTATUS listen_pipe(HANDLE hPipe, HANDLE hEvent, PIO_STATUS_BLOCK iosb, BOOL use_apc)
Definition: pipe.c:151
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WAIT_OBJECT_0
Definition: winbase.h:387
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_PENDING
Definition: ntstatus.h:82
ed2 num_bytes
Definition: write.c:2841
static FILE * client
Definition: client.c:41
int ret
static NTSTATUS create_pipe(PHANDLE handle, ULONG sharing, ULONG options)
Definition: pipe.c:121
HKEY key
Definition: reg.c:42
#define GENERIC_READ
Definition: compat.h:124
HANDLE WINAPI CreateIoCompletionPort(IN HANDLE FileHandle, IN HANDLE ExistingCompletionPort, IN ULONG_PTR CompletionKey, IN DWORD NumberOfConcurrentThreads)
Definition: iocompl.c:48
const XML_Char XML_Encoding * info
Definition: expat.h:530
DWORD *typedef HANDLE
Definition: winlogon.h:52
static const WCHAR testpipe[]
Definition: pipe.c:116
#define CreateFileW
Definition: compat.h:400
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
USHORT port
Definition: uri.c:227
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
static void test_create ( void  )
static

Definition at line 220 of file pipe.c.

Referenced by START_TEST().

221 {
222  HANDLE hserver;
223  NTSTATUS res;
224  int j, k;
228 
229  static const DWORD access[] = { 0, GENERIC_READ, GENERIC_WRITE, GENERIC_READ | GENERIC_WRITE};
230  static const DWORD sharing[] = { FILE_SHARE_READ, FILE_SHARE_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE };
231  static const DWORD pipe_config[]= { 1, 0, 2 };
232 
233  for (j = 0; j < sizeof(sharing) / sizeof(DWORD); j++) {
234  for (k = 0; k < sizeof(access) / sizeof(DWORD); k++) {
235  HANDLE hclient;
236  BOOL should_succeed = TRUE;
237 
238  res = create_pipe(&hserver, sharing[j], 0);
239  if (res) {
240  ok(0, "NtCreateNamedPipeFile returned %x, sharing: %x\n", res, sharing[j]);
241  continue;
242  }
243 
244  res = listen_pipe(hserver, hEvent, &iosb, FALSE);
245  ok(res == STATUS_PENDING, "NtFsControlFile returned %x\n", res);
246 
247  res = pNtQueryInformationFile(hserver, &iosb, &info, sizeof(info), (FILE_INFORMATION_CLASS)24);
248  ok(!res, "NtQueryInformationFile for server returned %x, sharing: %x\n", res, sharing[j]);
249  ok(info.NamedPipeConfiguration == pipe_config[j], "wrong duplex status for pipe: %d, expected %d\n",
250  info.NamedPipeConfiguration, pipe_config[j]);
251 
252  hclient = CreateFileW(testpipe, access[k], 0, 0, OPEN_EXISTING, 0, 0);
253  if (hclient != INVALID_HANDLE_VALUE) {
254  res = pNtQueryInformationFile(hclient, &iosb, &info, sizeof(info), (FILE_INFORMATION_CLASS)24);
255  ok(!res, "NtQueryInformationFile for client returned %x, access: %x, sharing: %x\n",
256  res, access[k], sharing[j]);
257  ok(info.NamedPipeConfiguration == pipe_config[j], "wrong duplex status for pipe: %d, expected %d\n",
258  info.NamedPipeConfiguration, pipe_config[j]);
259 
260  res = listen_pipe(hclient, hEvent, &iosb, FALSE);
261  ok(res == STATUS_ILLEGAL_FUNCTION, "expected STATUS_ILLEGAL_FUNCTION, got %x\n", res);
262  CloseHandle(hclient);
263  }
264 
265  if (access[k] & GENERIC_WRITE)
266  should_succeed &= !!(sharing[j] & FILE_SHARE_WRITE);
267  if (access[k] & GENERIC_READ)
268  should_succeed &= !!(sharing[j] & FILE_SHARE_READ);
269 
270  if (should_succeed)
271  ok(hclient != INVALID_HANDLE_VALUE, "CreateFile failed for sharing %x, access: %x, GetLastError: %d\n",
272  sharing[j], access[k], GetLastError());
273  else
274  ok(hclient == INVALID_HANDLE_VALUE, "CreateFile succeeded for sharing %x, access: %x\n", sharing[j], access[k]);
275 
276  CloseHandle(hserver);
277  }
278  }
279  CloseHandle(hEvent);
280 }
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK ULONG sharing
Definition: pipe.c:68
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint 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 GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint j
Definition: glfuncs.h:98
#define TRUE
Definition: types.h:120
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK iosb
Definition: pipe.c:68
#define CloseHandle
Definition: compat.h:398
ULONG NamedPipeConfiguration
Definition: pipe.c:43
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
DWORD DWORD
Definition: winlogon.h:75
#define FILE_SHARE_READ
Definition: compat.h:125
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
static HANDLE hEvent
Definition: comm.c:54
#define FALSE
Definition: types.h:117
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
#define ok(value,...)
Definition: CComObject.cpp:34
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
Definition: directory.c:44
static NTSTATUS listen_pipe(HANDLE hPipe, HANDLE hEvent, PIO_STATUS_BLOCK iosb, BOOL use_apc)
Definition: pipe.c:151
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_PENDING
Definition: ntstatus.h:82
static NTSTATUS create_pipe(PHANDLE handle, ULONG sharing, ULONG options)
Definition: pipe.c:121
#define GENERIC_READ
Definition: compat.h:124
const XML_Char XML_Encoding * info
Definition: expat.h:530
DWORD *typedef HANDLE
Definition: winlogon.h:52
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
static const WCHAR testpipe[]
Definition: pipe.c:116
#define CreateFileW
Definition: compat.h:400
GLuint res
Definition: glext.h:9613
#define STATUS_ILLEGAL_FUNCTION
Definition: ntstatus.h:397
static ULONG access
Definition: pipe.c:68
int k
Definition: mpi.c:3369
static void test_create_invalid ( void  )
static

Definition at line 160 of file pipe.c.

Referenced by START_TEST().

161 {
166  NTSTATUS res;
167  HANDLE handle, handle2;
169 
170  pRtlInitUnicodeString(&name, testpipe_nt);
171 
172  attr.Length = sizeof(attr);
173  attr.RootDirectory = 0;
174  attr.ObjectName = &name;
175  attr.Attributes = 0x40; /*case insensitive */
176  attr.SecurityDescriptor = NULL;
178 
179  timeout.QuadPart = -100000000;
180 
181 /* create a pipe with FILE_OVERWRITE */
182  res = pNtCreateNamedPipeFile(&handle, FILE_READ_ATTRIBUTES | SYNCHRONIZE, &attr, &iosb, FILE_SHARE_READ, 4 /*FILE_OVERWRITE*/,
183  0, 1, 0, 0, 0xFFFFFFFF, 500, 500, &timeout);
184  todo_wine ok(res == STATUS_INVALID_PARAMETER, "NtCreateNamedPipeFile returned %x\n", res);
185  if (!res)
186  CloseHandle(handle);
187 
188 /* create a pipe with FILE_OVERWRITE_IF */
189  res = pNtCreateNamedPipeFile(&handle, FILE_READ_ATTRIBUTES | SYNCHRONIZE, &attr, &iosb, FILE_SHARE_READ, 5 /*FILE_OVERWRITE_IF*/,
190  0, 1, 0, 0, 0xFFFFFFFF, 500, 500, &timeout);
191  todo_wine ok(res == STATUS_INVALID_PARAMETER, "NtCreateNamedPipeFile returned %x\n", res);
192  if (!res)
193  CloseHandle(handle);
194 
195 /* create a pipe with sharing = 0 */
196  res = pNtCreateNamedPipeFile(&handle, FILE_READ_ATTRIBUTES | SYNCHRONIZE, &attr, &iosb, 0, 2 /*FILE_CREATE*/,
197  0, 1, 0, 0, 0xFFFFFFFF, 500, 500, &timeout);
198  ok(res == STATUS_INVALID_PARAMETER, "NtCreateNamedPipeFile returned %x\n", res);
199  if (!res)
200  CloseHandle(handle);
201 
202 /* create a pipe without r/w access */
203  res = pNtCreateNamedPipeFile(&handle, SYNCHRONIZE, &attr, &iosb, FILE_SHARE_READ | FILE_SHARE_WRITE, 2 /*FILE_CREATE*/,
204  0, 1, 0, 0, 0xFFFFFFFF, 500, 500, &timeout);
205  ok(!res, "NtCreateNamedPipeFile returned %x\n", res);
206 
207  res = pNtQueryInformationFile(handle, &iosb, &info, sizeof(info), (FILE_INFORMATION_CLASS)24);
208  ok(res == STATUS_ACCESS_DENIED, "NtQueryInformationFile returned %x\n", res);
209 
210 /* test FILE_CREATE creation disposition */
211  res = pNtCreateNamedPipeFile(&handle2, SYNCHRONIZE, &attr, &iosb, FILE_SHARE_READ | FILE_SHARE_WRITE, 2 /*FILE_CREATE*/,
212  0, 1, 0, 0, 0xFFFFFFFF, 500, 500, &timeout);
213  todo_wine ok(res == STATUS_ACCESS_DENIED, "NtCreateNamedPipeFile returned %x\n", res);
214  if (!res)
215  CloseHandle(handle2);
216 
217  CloseHandle(handle);
218 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK iosb
Definition: pipe.c:68
#define CloseHandle
Definition: compat.h:398
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:125
GLuint const GLchar * name
Definition: glext.h:6031
static ULONG POBJECT_ATTRIBUTES attr
Definition: pipe.c:68
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
Definition: directory.c:44
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define todo_wine
Definition: test.h:154
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK ULONG ULONG ULONG ULONG ULONG ULONG ULONG ULONG ULONG PLARGE_INTEGER timeout
Definition: pipe.c:68
#define SYNCHRONIZE
Definition: nt_native.h:61
const XML_Char XML_Encoding * info
Definition: expat.h:530
DWORD *typedef HANDLE
Definition: winlogon.h:52
PVOID SecurityDescriptor
Definition: umtypes.h:175
PVOID SecurityQualityOfService
Definition: umtypes.h:176
GLuint res
Definition: glext.h:9613
PUNICODE_STRING ObjectName
Definition: umtypes.h:173
HANDLE RootDirectory
Definition: umtypes.h:172
static const WCHAR testpipe_nt[]
Definition: pipe.c:118
LONGLONG QuadPart
Definition: typedefs.h:112
static void test_file_info ( void  )
static

Definition at line 1262 of file pipe.c.

Referenced by START_TEST().

1263 {
1264  HANDLE server, client;
1265 
1266  if (!create_pipe_pair( &server, &client, FILE_FLAG_OVERLAPPED | PIPE_ACCESS_INBOUND,
1267  PIPE_TYPE_MESSAGE, 4096 )) return;
1268 
1269  test_file_name( client );
1270  test_file_name( server );
1271 
1272  DisconnectNamedPipe( server );
1274 
1275  CloseHandle( server );
1276  CloseHandle( client );
1277 }
#define CloseHandle
Definition: compat.h:398
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define STATUS_PIPE_DISCONNECTED
Definition: ntstatus.h:398
#define PIPE_TYPE_MESSAGE
Definition: winbase.h:168
#define test_file_name_fail(a, b)
Definition: pipe.c:1212
#define test_file_name(a)
Definition: pipe.c:1224
static BOOL create_pipe_pair(HANDLE *read, HANDLE *write, ULONG flags, ULONG type, ULONG size)
Definition: pipe.c:831
static FILE * client
Definition: client.c:41
BOOL WINAPI DisconnectNamedPipe(HANDLE hNamedPipe)
Definition: npipe.c:961
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define PIPE_ACCESS_INBOUND
Definition: winbase.h:165
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
static void test_filepipeinfo ( void  )
static

Definition at line 630 of file pipe.c.

Referenced by START_TEST().

631 {
636  HANDLE hServer, hClient;
638  NTSTATUS res;
639 
640  pRtlInitUnicodeString(&name, testpipe_nt);
641 
642  attr.Length = sizeof(attr);
643  attr.RootDirectory = 0;
644  attr.ObjectName = &name;
645  attr.Attributes = 0x40; /* case insensitive */
646  attr.SecurityDescriptor = NULL;
648 
649  timeout.QuadPart = -100000000;
650 
651  /* test with INVALID_HANDLE_VALUE */
652  res = pNtQueryInformationFile(INVALID_HANDLE_VALUE, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
653  ok(res == STATUS_OBJECT_TYPE_MISMATCH, "NtQueryInformationFile returned %x\n", res);
654 
655  fpi.ReadMode = 0;
656  fpi.CompletionMode = 0;
657  res = pNtSetInformationFile(INVALID_HANDLE_VALUE, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
658  ok(res == STATUS_OBJECT_TYPE_MISMATCH, "NtSetInformationFile returned %x\n", res);
659 
660  /* server end with read-only attributes */
661  res = pNtCreateNamedPipeFile(&hServer, FILE_READ_ATTRIBUTES | SYNCHRONIZE, &attr, &iosb,
662  FILE_SHARE_READ | FILE_SHARE_WRITE, 2 /* FILE_CREATE */,
663  0, 0, 0, 1, 0xFFFFFFFF, 500, 500, &timeout);
664  ok(!res, "NtCreateNamedPipeFile returned %x\n", res);
665 
666  check_pipe_handle_state(hServer, 0, 1);
667 
668  hClient = CreateFileW(testpipe, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
669  ok(hClient != INVALID_HANDLE_VALUE || broken(GetLastError() == ERROR_PIPE_BUSY) /* > Win 8 */,
670  "can't open pipe, GetLastError: %x\n", GetLastError());
671 
672  check_pipe_handle_state(hServer, 0, 1);
673  check_pipe_handle_state(hClient, 0, 0);
674 
675  fpi.ReadMode = 0;
676  fpi.CompletionMode = 0;
677  res = pNtSetInformationFile(hServer, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
678  ok(res == STATUS_ACCESS_DENIED, "NtSetInformationFile returned %x\n", res);
679 
680  check_pipe_handle_state(hServer, 0, 1);
681  check_pipe_handle_state(hClient, 0, 0);
682 
683  fpi.ReadMode = 1; /* invalid on a byte stream pipe */
684  fpi.CompletionMode = 1;
685  res = pNtSetInformationFile(hServer, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
686  ok(res == STATUS_ACCESS_DENIED, "NtSetInformationFile returned %x\n", res);
687 
688  check_pipe_handle_state(hServer, 0, 1);
689  check_pipe_handle_state(hClient, 0, 0);
690 
691  if (hClient != INVALID_HANDLE_VALUE)
692  {
693  fpi.ReadMode = 1; /* invalid on a byte stream pipe */
694  fpi.CompletionMode = 1;
695  res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
696  ok(res == STATUS_INVALID_PARAMETER, "NtSetInformationFile returned %x\n", res);
697  }
698 
699  check_pipe_handle_state(hServer, 0, 1);
700  check_pipe_handle_state(hClient, 0, 0);
701 
702  if (hClient != INVALID_HANDLE_VALUE)
703  {
704  fpi.ReadMode = 0;
705  fpi.CompletionMode = 1;
706  res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
707  ok(!res, "NtSetInformationFile returned %x\n", res);
708  }
709 
710  check_pipe_handle_state(hServer, 0, 1);
711  check_pipe_handle_state(hClient, 0, 1);
712 
713  if (hClient != INVALID_HANDLE_VALUE)
714  {
715  fpi.ReadMode = 0;
716  fpi.CompletionMode = 2; /* not in range 0-1 */
717  res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
718  ok(res == STATUS_INVALID_PARAMETER || broken(!res) /* < Vista */, "NtSetInformationFile returned %x\n", res);
719 
720  fpi.ReadMode = 2; /* not in range 0-1 */
721  fpi.CompletionMode = 0;
722  res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
723  ok(res == STATUS_INVALID_PARAMETER || broken(!res) /* < Vista */, "NtSetInformationFile returned %x\n", res);
724  }
725 
726  CloseHandle(hClient);
727 
728  check_pipe_handle_state(hServer, 0, 1);
729 
730  fpi.ReadMode = 0;
731  fpi.CompletionMode = 0;
732  res = pNtSetInformationFile(hServer, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
733  ok(res == STATUS_ACCESS_DENIED, "NtSetInformationFile returned %x\n", res);
734 
735  CloseHandle(hServer);
736 
737  /* message mode server with read/write attributes */
738  res = pNtCreateNamedPipeFile(&hServer, FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES | SYNCHRONIZE, &attr, &iosb,
739  FILE_SHARE_READ | FILE_SHARE_WRITE, 2 /* FILE_CREATE */,
740  0, 1, 1, 0, 0xFFFFFFFF, 500, 500, &timeout);
741  ok(!res, "NtCreateNamedPipeFile returned %x\n", res);
742 
743  check_pipe_handle_state(hServer, 1, 0);
744 
745  hClient = CreateFileW(testpipe, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
746  ok(hClient != INVALID_HANDLE_VALUE || broken(GetLastError() == ERROR_PIPE_BUSY) /* > Win 8 */,
747  "can't open pipe, GetLastError: %x\n", GetLastError());
748 
749  check_pipe_handle_state(hServer, 1, 0);
750  check_pipe_handle_state(hClient, 0, 0);
751 
752  if (hClient != INVALID_HANDLE_VALUE)
753  {
754  fpi.ReadMode = 1;
755  fpi.CompletionMode = 1;
756  res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
757  ok(!res, "NtSetInformationFile returned %x\n", res);
758  }
759 
760  check_pipe_handle_state(hServer, 1, 0);
761  check_pipe_handle_state(hClient, 1, 1);
762 
763  fpi.ReadMode = 0;
764  fpi.CompletionMode = 1;
765  res = pNtSetInformationFile(hServer, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
766  ok(!res, "NtSetInformationFile returned %x\n", res);
767 
768  check_pipe_handle_state(hServer, 0, 1);
769  check_pipe_handle_state(hClient, 1, 1);
770 
771  if (hClient != INVALID_HANDLE_VALUE)
772  {
773  fpi.ReadMode = 0;
774  fpi.CompletionMode = 2; /* not in range 0-1 */
775  res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
776  ok(res == STATUS_INVALID_PARAMETER || broken(!res) /* < Vista */, "NtSetInformationFile returned %x\n", res);
777 
778  fpi.ReadMode = 2; /* not in range 0-1 */
779  fpi.CompletionMode = 0;
780  res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
781  ok(res == STATUS_INVALID_PARAMETER || broken(!res) /* < Vista */, "NtSetInformationFile returned %x\n", res);
782  }
783 
784  CloseHandle(hClient);
785 
786  check_pipe_handle_state(hServer, 0, 1);
787 
788  fpi.ReadMode = 1;
789  fpi.CompletionMode = 0;
790  res = pNtSetInformationFile(hServer, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
791  ok(!res, "NtSetInformationFile returned %x\n", res);
792 
793  check_pipe_handle_state(hServer, 1, 0);
794 
795  CloseHandle(hServer);
796 }
#define check_pipe_handle_state(handle, r, c)
Definition: pipe.c:628
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK iosb
Definition: pipe.c:68
#define CloseHandle
Definition: compat.h:398
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_WRITE_ATTRIBUTES
Definition: nt_native.h:649
#define FILE_SHARE_READ
Definition: compat.h:125
GLuint const GLchar * name
Definition: glext.h:6031
#define GENERIC_WRITE
Definition: nt_native.h:90
static ULONG POBJECT_ATTRIBUTES attr
Definition: pipe.c:68
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
#define ok(value,...)
Definition: CComObject.cpp:34
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
Definition: directory.c:44
#define STATUS_OBJECT_TYPE_MISMATCH
Definition: ntstatus.h:259
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define ERROR_PIPE_BUSY
Definition: winerror.h:283
#define GENERIC_READ
Definition: compat.h:124
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK ULONG ULONG ULONG ULONG ULONG ULONG ULONG ULONG ULONG PLARGE_INTEGER timeout
Definition: pipe.c:68
#define SYNCHRONIZE
Definition: nt_native.h:61
#define broken(x)
Definition: _sntprintf.h:21
DWORD *typedef HANDLE
Definition: winlogon.h:52
PVOID SecurityDescriptor
Definition: umtypes.h:175
ULONG CompletionMode
Definition: pipe.c:38
static const WCHAR testpipe[]
Definition: pipe.c:116
#define CreateFileW
Definition: compat.h:400
PVOID SecurityQualityOfService
Definition: umtypes.h:176
GLuint res
Definition: glext.h:9613
PUNICODE_STRING ObjectName
Definition: umtypes.h:173
HANDLE RootDirectory
Definition: umtypes.h:172
static const WCHAR testpipe_nt[]
Definition: pipe.c:118
LONGLONG QuadPart
Definition: typedefs.h:112
static void test_nonalertable ( void  )
static

Definition at line 511 of file pipe.c.

Referenced by START_TEST().

512 {
514  HANDLE hEvent;
515  HANDLE hPipe;
516  NTSTATUS res;
517  HANDLE hThread;
518  DWORD ret;
519 
520  memset(&iosb, 0x55, sizeof(iosb));
521 
522  hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
523  ok(hEvent != INVALID_HANDLE_VALUE, "can't create event, GetLastError: %x\n", GetLastError());
524 
526  ok(!res, "NtCreateNamedPipeFile returned %x\n", res);
527 
528  hThread = CreateThread(NULL, 0, &thread, 0, 0, 0);
529  ok(hThread != INVALID_HANDLE_VALUE, "can't create thread, GetLastError: %x\n", GetLastError());
530 
532  ret = pQueueUserAPC(&userapc, GetCurrentThread(), 0);
533  ok(ret, "can't queue user apc, GetLastError: %x\n", GetLastError());
534 
535  res = listen_pipe(hPipe, hEvent, &iosb, TRUE);
536  todo_wine ok(!res, "NtFsControlFile returned %x\n", res);
537 
538  ok(open_succeeded, "couldn't open client side pipe\n");
539  todo_wine ok(!U(iosb).Status, "Wrong iostatus %x\n", U(iosb).Status);
540  todo_wine ok(WaitForSingleObject(hEvent, 0) == 0, "hEvent not signaled\n");
541 
542  ok(!ioapc_called, "IOAPC ran too early\n");
543  ok(!userapc_called, "user apc ran too early\n");
544 
545  SleepEx(0, TRUE); /* alertable wait state */
546 
547  ok(ioapc_called, "IOAPC didn't run\n");
548  ok(userapc_called, "user apc didn't run\n");
549 
550  WaitForSingleObject(hThread, INFINITE);
551  CloseHandle(hThread);
552  CloseHandle(hEvent);
553  CloseHandle(hPipe);
554 }
#define TRUE
Definition: types.h:120
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK iosb
Definition: pipe.c:68
#define CloseHandle
Definition: compat.h:398
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: pipe.c:59
static BOOL open_succeeded
Definition: pipe.c:412
static BOOL userapc_called
Definition: pipe.c:406
#define U(x)
Definition: wordpad.c:44
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
DWORD DWORD
Definition: winlogon.h:75
#define FILE_SHARE_READ
Definition: compat.h:125
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
static HANDLE hEvent
Definition: comm.c:54
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define FALSE
Definition: types.h:117
HANDLE WINAPI GetCurrentThread(VOID)
Definition: proc.c:1205
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:135
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
static NTSTATUS listen_pipe(HANDLE hPipe, HANDLE hEvent, PIO_STATUS_BLOCK iosb, BOOL use_apc)
Definition: pipe.c:151
DWORD WINAPI SleepEx(IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:748
LONG NTSTATUS
Definition: precomp.h:26
int ret
static NTSTATUS create_pipe(PHANDLE handle, ULONG sharing, ULONG options)
Definition: pipe.c:121
#define todo_wine
Definition: test.h:154
static void CALLBACK userapc(ULONG_PTR dwParam)
Definition: pipe.c:407
Status
Definition: gdiplustypes.h:24
DWORD *typedef HANDLE
Definition: winlogon.h:52
static DWORD WINAPI thread(PVOID main_thread)
Definition: pipe.c:413
static HANDLE hThread
Definition: pipe.c:40
GLuint res
Definition: glext.h:9613
#define INFINITE
Definition: serial.h:102
#define memset(x, y, z)
Definition: compat.h:39
static BOOL ioapc_called
Definition: pipe.c:145
static void test_overlapped ( void  )
static

Definition at line 282 of file pipe.c.

Referenced by START_TEST().

283 {
285  HANDLE hEvent;
286  HANDLE hPipe;
287  HANDLE hClient;
288  NTSTATUS res;
289 
290  hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
291  ok(hEvent != INVALID_HANDLE_VALUE, "can't create event, GetLastError: %x\n", GetLastError());
292 
293  res = create_pipe(&hPipe, FILE_SHARE_READ | FILE_SHARE_WRITE, 0 /* OVERLAPPED */);
294  ok(!res, "NtCreateNamedPipeFile returned %x\n", res);
295 
296  memset(&iosb, 0x55, sizeof(iosb));
297  res = listen_pipe(hPipe, hEvent, &iosb, TRUE);
298  ok(res == STATUS_PENDING, "NtFsControlFile returned %x\n", res);
299  ok(U(iosb).Status == 0x55555555, "iosb.Status got changed to %x\n", U(iosb).Status);
300 
301  hClient = CreateFileW(testpipe, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
302  ok(hClient != INVALID_HANDLE_VALUE, "can't open pipe, GetLastError: %x\n", GetLastError());
303 
304  ok(U(iosb).Status == 0, "Wrong iostatus %x\n", U(iosb).Status);
305  ok(WaitForSingleObject(hEvent, 0) == 0, "hEvent not signaled\n");
306 
307  ok(!ioapc_called, "IOAPC ran too early\n");
308 
309  SleepEx(0, TRUE); /* alertable wait state */
310 
311  ok(ioapc_called, "IOAPC didn't run\n");
312 
313  CloseHandle(hPipe);
314  CloseHandle(hClient);
315 
316  res = create_pipe(&hPipe, FILE_SHARE_READ | FILE_SHARE_WRITE, 0 /* OVERLAPPED */);
317  ok(!res, "NtCreateNamedPipeFile returned %x\n", res);
318 
319  hClient = CreateFileW(testpipe, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
320  ok(hClient != INVALID_HANDLE_VALUE || broken(GetLastError() == ERROR_PIPE_BUSY) /* > Win 8 */,
321  "can't open pipe, GetLastError: %x\n", GetLastError());
322 
323  if (hClient != INVALID_HANDLE_VALUE)
324  {
325  SetEvent(hEvent);
326  memset(&iosb, 0x55, sizeof(iosb));
327  res = listen_pipe(hPipe, hEvent, &iosb, TRUE);
328  ok(res == STATUS_PIPE_CONNECTED, "NtFsControlFile returned %x\n", res);
329  ok(U(iosb).Status == 0x55555555, "iosb.Status got changed to %x\n", U(iosb).Status);
330  ok(!is_signaled(hEvent), "hEvent not signaled\n");
331 
332  CloseHandle(hClient);
333  }
334 
335  CloseHandle(hPipe);
336  CloseHandle(hEvent);
337 }
#define TRUE
Definition: types.h:120
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK iosb
Definition: pipe.c:68
#define CloseHandle
Definition: compat.h:398
#define U(x)
Definition: wordpad.c:44
static BOOL is_signaled(HANDLE obj)
Definition: pipe.c:111
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:125
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
static HANDLE hEvent
Definition: comm.c:54
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define FALSE
Definition: types.h:117
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
#define ok(value,...)
Definition: CComObject.cpp:34
static NTSTATUS listen_pipe(HANDLE hPipe, HANDLE hEvent, PIO_STATUS_BLOCK iosb, BOOL use_apc)
Definition: pipe.c:151
DWORD WINAPI SleepEx(IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:748
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_PENDING
Definition: ntstatus.h:82
#define ERROR_PIPE_BUSY
Definition: winerror.h:283
static NTSTATUS create_pipe(PHANDLE handle, ULONG sharing, ULONG options)
Definition: pipe.c:121
#define STATUS_PIPE_CONNECTED
Definition: ntstatus.h:400
#define GENERIC_READ
Definition: compat.h:124
#define broken(x)
Definition: _sntprintf.h:21
Status
Definition: gdiplustypes.h:24
DWORD *typedef HANDLE
Definition: winlogon.h:52
static const WCHAR testpipe[]
Definition: pipe.c:116
#define CreateFileW
Definition: compat.h:400
GLuint res
Definition: glext.h:9613
#define memset(x, y, z)
Definition: compat.h:39
static BOOL ioapc_called
Definition: pipe.c:145
static void test_peek ( HANDLE  pipe)
static

Definition at line 805 of file pipe.c.

Referenced by read_pipe_test().

806 {
809  HANDLE event = CreateEventA( NULL, TRUE, FALSE, NULL );
811 
812  memset(&iosb, 0x55, sizeof(iosb));
813  status = NtFsControlFile(pipe, NULL, NULL, NULL, &iosb, FSCTL_PIPE_PEEK, NULL, 0, &buf, sizeof(buf));
814  ok(!status || status == STATUS_PENDING, "NtFsControlFile failed: %x\n", status);
815  ok(!iosb.Status, "iosb.Status = %x\n", iosb.Status);
816  ok(buf.ReadDataAvailable == 1, "ReadDataAvailable = %u\n", buf.ReadDataAvailable);
817 
818  ResetEvent(event);
819  memset(&iosb, 0x55, sizeof(iosb));
820  status = NtFsControlFile(pipe, event, NULL, NULL, &iosb, FSCTL_PIPE_PEEK, NULL, 0, &buf, sizeof(buf));
821  ok(!status || status == STATUS_PENDING, "NtFsControlFile failed: %x\n", status);
822  ok(buf.ReadDataAvailable == 1, "ReadDataAvailable = %u\n", buf.ReadDataAvailable);
823  ok(!iosb.Status, "iosb.Status = %x\n", iosb.Status);
824  ok(is_signaled(event), "event is not signaled\n");
825 
827 }
#define TRUE
Definition: types.h:120
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK iosb
Definition: pipe.c:68
#define CloseHandle
Definition: compat.h:398
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static BOOL is_signaled(HANDLE obj)
Definition: pipe.c:111
NTSYSCALLAPI NTSTATUS NTAPI NtFsControlFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG FsControlCode, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength)
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:583
#define ok(value,...)
Definition: CComObject.cpp:34
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_PENDING
Definition: ntstatus.h:82
struct _cl_event * event
Definition: glext.h:7739
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define FSCTL_PIPE_PEEK
Definition: winioctl.h:196
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:660
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
static void test_security_info ( void  )
static

Definition at line 1379 of file pipe.c.

Referenced by START_TEST().

1380 {
1381  char sec_desc[SECURITY_DESCRIPTOR_MIN_LENGTH];
1383  SECURITY_ATTRIBUTES sec_attr;
1384  TOKEN_OWNER *process_owner;
1385  HANDLE server, client, server2;
1386  SID *world_sid, *local_sid;
1387  ULONG length;
1388  NTSTATUS status;
1389  BOOL ret;
1390 
1391  trace("security tests...\n");
1392 
1393  process_owner = get_current_owner();
1394  process_group = get_current_group();
1395  world_sid = well_known_sid(WinWorldSid);
1396  local_sid = well_known_sid(WinLocalSid);
1397 
1399  ok(ret, "InitializeSecurityDescriptor failed\n");
1400 
1401  ret = SetSecurityDescriptorOwner(sec_desc, process_owner->Owner, FALSE);
1402  ok(ret, "SetSecurityDescriptorOwner failed\n");
1403 
1404  ret = SetSecurityDescriptorGroup(sec_desc, process_group->PrimaryGroup, FALSE);
1405  ok(ret, "SetSecurityDescriptorGroup failed\n");
1406 
1408  0x20000, 0x20000, 0, NULL);
1409  ok(server != INVALID_HANDLE_VALUE, "CreateNamedPipe failed: %u\n", GetLastError());
1410 
1411  client = CreateFileA(PIPENAME, GENERIC_ALL, 0, NULL, OPEN_EXISTING, 0, NULL);
1412  ok(client != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
1413 
1414  test_group(server, process_group->PrimaryGroup, TRUE);
1415  test_group(client, process_group->PrimaryGroup, TRUE);
1416 
1417  /* set server group, client changes as well */
1418  ret = SetSecurityDescriptorGroup(sec_desc, world_sid, FALSE);
1419  ok(ret, "SetSecurityDescriptorGroup failed\n");
1420  status = NtSetSecurityObject(server, GROUP_SECURITY_INFORMATION, sec_desc);
1421  ok(status == STATUS_SUCCESS, "NtSetSecurityObject failed: %08x\n", status);
1422 
1423  test_group(server, world_sid, FALSE);
1424  test_group(client, world_sid, FALSE);
1425 
1426  /* new instance of pipe server has the same security descriptor */
1428  0x20000, 0x20000, 0, NULL);
1429  ok(server2 != INVALID_HANDLE_VALUE, "CreateNamedPipe failed: %u\n", GetLastError());
1430  test_group(server2, world_sid, FALSE);
1431 
1432  /* set client group, server changes as well */
1433  ret = SetSecurityDescriptorGroup(sec_desc, local_sid, FALSE);
1434  ok(ret, "SetSecurityDescriptorGroup failed\n");
1435  status = NtSetSecurityObject(server, GROUP_SECURITY_INFORMATION, sec_desc);
1436  ok(status == STATUS_SUCCESS, "NtSetSecurityObject failed: %08x\n", status);
1437 
1438  test_group(server, local_sid, FALSE);
1439  test_group(client, local_sid, FALSE);
1440  test_group(server2, local_sid, FALSE);
1441 
1442  CloseHandle(server);
1443  /* SD is preserved after closing server object */
1444  test_group(client, local_sid, TRUE);
1445  CloseHandle(client);
1446 
1447  server = server2;
1448  client = CreateFileA(PIPENAME, GENERIC_ALL, 0, NULL, OPEN_EXISTING, 0, NULL);
1449  ok(client != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
1450 
1451  test_group(client, local_sid, FALSE);
1452 
1453  ret = DisconnectNamedPipe(server);
1454  ok(ret, "DisconnectNamedPipe failed: %u\n", GetLastError());
1455 
1456  /* disconnected server may be queried for security info, but client does not */
1457  test_group(server, local_sid, FALSE);
1459  NULL, 0, &length);
1460  ok(status == STATUS_PIPE_DISCONNECTED, "NtQuerySecurityObject returned %08x\n", status);
1461  status = NtSetSecurityObject(client, GROUP_SECURITY_INFORMATION, sec_desc);
1462  ok(status == STATUS_PIPE_DISCONNECTED, "NtQuerySecurityObject returned %08x\n", status);
1463 
1464  /* attempting to create another pipe instance with specified sd fails */
1465  sec_attr.nLength = sizeof(sec_attr);
1466  sec_attr.lpSecurityDescriptor = sec_desc;
1467  sec_attr.bInheritHandle = FALSE;
1468  ret = SetSecurityDescriptorGroup(sec_desc, local_sid, FALSE);
1469  ok(ret, "SetSecurityDescriptorGroup failed\n");
1471  0x20000, 0x20000, 0, &sec_attr);
1472  todo_wine
1474  "CreateNamedPipe failed: %u\n", GetLastError());
1475  if (server2 != INVALID_HANDLE_VALUE) CloseHandle(server2);
1476 
1477  CloseHandle(server);
1478  CloseHandle(client);
1479 
1481  0x20000, 0x20000, 0, &sec_attr);
1482  ok(server != INVALID_HANDLE_VALUE, "CreateNamedPipe failed: %u\n", GetLastError());
1483  test_group(server, local_sid, FALSE);
1484  CloseHandle(server);
1485 
1486  HeapFree(GetProcessHeap(), 0, process_owner);
1487  HeapFree(GetProcessHeap(), 0, process_group);
1488  HeapFree(GetProcessHeap(), 0, world_sid);
1489  HeapFree(GetProcessHeap(), 0, local_sid);
1490 }
#define trace(...)
Definition: kmt_test.h:217
static SID * well_known_sid(WELL_KNOWN_SID_TYPE sid_type)
Definition: pipe.c:1347
#define GENERIC_ALL
Definition: nt_native.h:92
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define STATUS_PIPE_DISCONNECTED
Definition: ntstatus.h:398
#define SECURITY_DESCRIPTOR_MIN_LENGTH
Definition: setypes.h:761
#define PIPENAME
Definition: pipe.c:829
return STATUS_SUCCESS
Definition: btrfs.c:2690
BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision)
Definition: security.c:803
HANDLE WINAPI CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: npipe.c:220
static TOKEN_PRIMARY_GROUP * get_current_group(void)
Definition: pipe.c:1324
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
#define GROUP_SECURITY_INFORMATION
Definition: setypes.h:124
#define WRITE_OWNER
Definition: nt_native.h:60
#define SECURITY_DESCRIPTOR_REVISION
Definition: setypes.h:58
#define FALSE
Definition: types.h:117
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
#define PIPE_TYPE_BYTE
Definition: winbase.h:167
smooth NULL
Definition: ftsmooth.c:416
PSID Owner
Definition: setypes.h:974
#define test_group(a, b, c)
Definition: pipe.c:1359
#define OPEN_EXISTING
Definition: compat.h:426
#define ok(value,...)
Definition: CComObject.cpp:34
NTSTATUS NTAPI NtQuerySecurityObject(IN HANDLE Handle, IN SECURITY_INFORMATION SecurityInformation, OUT PSECURITY_DESCRIPTOR SecurityDescriptor, IN ULONG Length, OUT PULONG ResultLength)
Definition: obsecure.c:803
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG NTSTATUS
Definition: precomp.h:26
#define GetProcessHeap()
Definition: compat.h:395
#define PIPE_ACCESS_DUPLEX
Definition: winbase.h:164
static FILE * client
Definition: client.c:41
NTSTATUS WINAPI NtSetSecurityObject(HANDLE Handle, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor)
int ret
#define todo_wine
Definition: test.h:154
static PIO_STATUS_BLOCK void ULONG length
Definition: pipe.c:76
BOOL WINAPI DisconnectNamedPipe(HANDLE hNamedPipe)
Definition: npipe.c:961
static TOKEN_OWNER * get_current_owner(void)
Definition: pipe.c:1301
static HRESULT process_group(struct ciffile *file, struct inf_section *section, const char *section_name)
Definition: icif.c:1619
DWORD *typedef HANDLE
Definition: winlogon.h:52
LPVOID lpSecurityDescriptor
Definition: compat.h:181
#define OWNER_SECURITY_INFORMATION
Definition: setypes.h:123
unsigned int ULONG
Definition: retypes.h:1
BOOL WINAPI SetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pGroup, BOOL bGroupDefaulted)
Definition: sec.c:288
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
static SERVICE_STATUS status
Definition: service.c:31
#define HeapFree(x, y, z)
Definition: compat.h:394
BOOL WINAPI SetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pOwner, BOOL bOwnerDefaulted)
Definition: sec.c:312
static void test_volume_info ( void  )
static

Definition at line 1179 of file pipe.c.

Referenced by START_TEST().

1180 {
1181  FILE_FS_DEVICE_INFORMATION *device_info;
1183  HANDLE read, write;
1184  char buffer[128];
1185  NTSTATUS status;
1186 
1188  PIPE_TYPE_MESSAGE, 4096 )) return;
1189 
1190  memset( buffer, 0xaa, sizeof(buffer) );
1191  status = pNtQueryVolumeInformationFile( read, &iosb, buffer, sizeof(buffer), FileFsDeviceInformation );
1192  ok( status == STATUS_SUCCESS, "NtQueryVolumeInformationFile failed: %x\n", status );
1193  ok( iosb.Information == sizeof(*device_info), "Information = %lu\n", iosb.Information );
1194  device_info = (FILE_FS_DEVICE_INFORMATION*)buffer;
1195  ok( device_info->DeviceType == FILE_DEVICE_NAMED_PIPE, "DeviceType = %u\n", device_info->DeviceType );
1197  "Characteristics = %x\n", device_info->Characteristics );
1198 
1199  memset( buffer, 0xaa, sizeof(buffer) );
1200  status = pNtQueryVolumeInformationFile( write, &iosb, buffer, sizeof(buffer), FileFsDeviceInformation );
1201  ok( status == STATUS_SUCCESS, "NtQueryVolumeInformationFile failed: %x\n", status );
1202  ok( iosb.Information == sizeof(*device_info), "Information = %lu\n", iosb.Information );
1203  device_info = (FILE_FS_DEVICE_INFORMATION*)buffer;
1204  ok( device_info->DeviceType == FILE_DEVICE_NAMED_PIPE, "DeviceType = %u\n", device_info->DeviceType );
1206  "Characteristics = %x\n", device_info->Characteristics );
1207 
1208  CloseHandle( read );
1209  CloseHandle( write );
1210 }
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK iosb
Definition: pipe.c:68
#define CloseHandle
Definition: compat.h:398
#define PIPE_TYPE_MESSAGE
Definition: winbase.h:168
return STATUS_SUCCESS
Definition: btrfs.c:2690
#define FILE_DEVICE_NAMED_PIPE
Definition: winioctl.h:122
GLuint buffer
Definition: glext.h:5915
#define write
Definition: acwin.h:73
static BOOL create_pipe_pair(HANDLE *read, HANDLE *write, ULONG flags, ULONG type, ULONG size)
Definition: pipe.c:831
#define ok(value,...)
Definition: CComObject.cpp:34
LONG NTSTATUS
Definition: precomp.h:26
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL
Definition: btrfs_drv.h:130
#define PIPE_ACCESS_INBOUND
Definition: winbase.h:165
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
static DWORD WINAPI thread ( PVOID  main_thread)
static

Definition at line 413 of file pipe.c.

Referenced by _test_flush_async(), RpcReadFile(), test_alertable(), test_nonalertable(), and test_overlapped().

414 {
415  HANDLE h;
416 
417  Sleep(400);
418 
419  if (main_thread) {
420  DWORD ret;
422  ret = pQueueUserAPC(&userapc, main_thread, 0);
423  ok(ret, "can't queue user apc, GetLastError: %x\n", GetLastError());
424  CloseHandle(main_thread);
425  }
426 
427  Sleep(400);
428 
430 
431  if (h != INVALID_HANDLE_VALUE) {
433  Sleep(100);
434  CloseHandle(h);
435  } else
437 
438  return 0;
439 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:736
static BOOL open_succeeded
Definition: pipe.c:412
static BOOL userapc_called
Definition: pipe.c:406
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
DWORD DWORD
Definition: winlogon.h:75
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define FALSE
Definition: types.h:117
#define GENERIC_WRITE
Definition: nt_native.h:90
#define OPEN_EXISTING
Definition: compat.h:426
#define ok(value,...)
Definition: CComObject.cpp:34
int ret
static void CALLBACK userapc(ULONG_PTR dwParam)
Definition: pipe.c:407
#define GENERIC_READ
Definition: compat.h:124
DWORD *typedef HANDLE
Definition: winlogon.h:52
static const WCHAR testpipe[]
Definition: pipe.c:116
#define CreateFileW
Definition: compat.h:400
static void CALLBACK userapc ( ULONG_PTR  dwParam)
static

Definition at line 407 of file pipe.c.

Referenced by test_alertable(), test_nonalertable(), and thread().

408 {
410 }
#define TRUE
Definition: types.h:120
static BOOL userapc_called
Definition: pipe.c:406
static void ( WINAPI pRtlInitUnicodeString)
static
static SID* well_known_sid ( WELL_KNOWN_SID_TYPE  sid_type)
static

Definition at line 1347 of file pipe.c.

Referenced by test_security_info().

1348 {
1350  SID *sid;
1351  BOOL ret;
1352 
1353  sid = HeapAlloc(GetProcessHeap(), 0, size);
1354  ret = CreateWellKnownSid(sid_type, NULL, sid, &size);
1355  ok(ret, "CreateWellKnownSid failed: %u\n", GetLastError());
1356  return sid;
1357 }
#define SECURITY_MAX_SID_SIZE
Definition: setypes.h:458
FT_UInt sid
Definition: cffcmap.c:139
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
DWORD DWORD
Definition: winlogon.h:75
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int ret
BOOL WINAPI CreateWellKnownSid(IN WELL_KNOWN_SID_TYPE WellKnownSidType, IN PSID DomainSid OPTIONAL, OUT PSID pSid, IN OUT DWORD *cbSid)
Definition: security.c:597

Variable Documentation

Definition at line 68 of file pipe.c.

Referenced by test_create().

Definition at line 67 of file pipe.c.

Referenced by read_pipe_test().

Definition at line 67 of file pipe.c.

BOOL bInheritHandle

Definition at line 82 of file pipe.c.

Referenced by DuplicateConsoleHandle(), and OpenConsoleW().

Definition at line 76 of file pipe.c.

Referenced by test_CreatePipe().

Definition at line 77 of file pipe.c.

Definition at line 67 of file pipe.c.

Referenced by _test_status_code(), bdf_cmap_char_index(), bdf_cmap_char_next(), bitmap_decompress1(), bitmap_decompress2(), bitmap_decompress3(), bitmap_decompress4(), bytecode_addref(), cf2_getSeacComponent(), cff_cmap_encoding_char_next(), cff_parser_init(), cff_parser_run(), child_process(), chmc_system_done(), chmcerr_set(), COMBOEX_Notify(), compile_script(), compress_block(), construct_function(), create_copy_error(), create_parseError(), create_source_function(), CreateCaseDiff(), DATETIME_SendSimpleNotify(), decode_source(), DetectJapaneseCode(), dll_entry_point(), emit_catch_jmp(), Ext2DeviceControl(), fetch_2d_texel_rgba_dxt5(), FillTable(), FreeBT_DispatchDevCtrl(), ft_lzwstate_io(), generate_nibble(), get_notifycode(), getreply(), GetResponse(), gif_compress(), handle_edit_event(), handle_WM_HSCROLL(), handle_WM_VSCROLL(), HEADER_NotifyCodeWtoA(), HEADER_SendNotify(), HLPFILE_Uncompress2(), iso_connect(), jpeg_huff_decode(), jpeg_make_c_derived_tbl(), jpeg_make_d_derived_tbl(), JScriptParse_ParseScriptText(), JScriptParseProcedure_ParseProcedureText(), JSGlobal_eval(), QMyScrollView::keyPressEvent(), QMyScrollView::keyReleaseEvent(), lznt1_decompress_chunk(), marshal_nfs41_dirquery(), marshal_nfs41_rw(), ME_HandleMessage(), mi_check_modifier(), mi_read_keyboard_state(), MonSelNotify(), MonthCalNotifyControlParent(), navigate_javascript_proc(), notify_hdr(), NotifyControlParent(), TKeyDef::operator=(), parse_option_buffer(), parse_script(), pcf_cmap_char_index(), pcf_cmap_char_next(), pfr_lookup_bitmap_data(), pretty_print_option(), process_nibble(), process_plane(), push_error(), ReadChmSystem(), REBAR_Notify(), remove_product_upgrade_code(), script_parse(), STATUSBAR_SendMouseNotify(), store_options(), StringConstr_fromCharCode(), SYSLINK_SendParentNotify(), t1_cmap_std_char_index(), TAB_SendSimpleNotify(), test_bitmap_font_glyph_index(), test_domdoc(), test_exec_script(), test_ExitCode(), test_GetCharABCWidths(), test_Handles(), test_media_event(), test_timers_exception(), test_WM_GETDLGCODE(), TKeyDef::TKeyDef(), TOOLBAR_SendNotify(), tr_static_init(), trace_extended_error(), TREEVIEW_ScrollKeyDown(), tt_name_ascii_from_other(), tt_name_ascii_from_utf16(), unmarshal_nfs41_dirquery(), unmarshal_nfs41_rw(), VBScriptParse_ParseScriptText(), VBScriptParseProcedure_ParseProcedureText(), and WshExec_get_Status().

Definition at line 68 of file pipe.c.

Definition at line 68 of file pipe.c.

HANDLE ULONG_PTR dwData

Definition at line 83 of file pipe.c.

BOOL DWORD dwThreadId

Definition at line 82 of file pipe.c.

Definition at line 67 of file pipe.c.

Referenced by test_overlapped_error(), and test_readfileex_pending().

HANDLE hThread

Definition at line 83 of file pipe.c.

Definition at line 67 of file pipe.c.

Definition at line 67 of file pipe.c.

Definition at line 67 of file pipe.c.

Referenced by _test_peek_pipe(), and test_completion().

Definition at line 78 of file pipe.c.

BOOL ioapc_called
static
_Out_ PIO_STATUS_BLOCK IoStatusBlock

Definition at line 75 of file pipe.c.

Referenced by AccpOpenNamedObject(), AcsHlpSendCommand(), AddRemoteDatabaseEntry(), AllocConsole(), ApphelpCacheQueryInfo(), BaseMarkFileForDelete(), BasepCopyFileExW(), BasepDoTapeOperation(), BasepMapFile(), BasepNotifyTrackingService(), BasepOpenFileForMove(), BatteryIoctl(), Beep(), BroadcastOpen(), CabinetExtractFile(), CabinetOpen(), CallCacheControl(), CancelIo(), ClassCompletionRoutine(), CmBattSendDownStreamIrp(), CmpFileFlush(), CmpFileRead(), CmpFileSetSize(), CmpFileWrite(), CmpInitializeHive(), CmpOpenHiveFiles(), CommandDumpSector(), CommandPartInfo(), CompareFileContents(), CompBattGetDeviceObjectPointer(), CopyLoop(), CreateDirectoryExW(), CreateDirectoryW(), CreateFileW(), CreateHardLinkW(), CreateIoCompletionPort(), CreateProcessInternalW(), CreateRegistryFile(), CreateRemoteDatabaseWorker(), DbgkCreateThread(), DbgkpPostFakeModuleMessages(), DbgkpSectionToFileHandle(), DeleteFileW(), DeleteRemoteDatabaseEntry(), DoesFileExist(), DoesPathExist(), EngLoadModuleEx(), ExtractFont(), Fat12WriteBootSector(), Fat12WriteFAT(), Fat12WriteRootDirectory(), Fat16WriteBootSector(), Fat16WriteFAT(), Fat16WriteRootDirectory(), Fat32WriteBootSector(), Fat32WriteFAT(), Fat32WriteFsInfo(), Fat32WriteRootDirectory(), FatWipeSectors(), Fatx16WriteFAT(), Fatx32WriteFAT(), FatxWriteBootSector(), FatxWriteRootDirectory(), FillConsoleOutputAttribute(), FillConsoleOutputCharacterA(), FilterConnectCommunicationPort(), FindFirstChangeNotificationW(), FindFirstFileExW(), FindFirstStreamW(), FindNextFileW(), FlushConsoleInputBuffer(), FlushFileBuffers(), FlushViewOfFile(), FsRecGetDeviceSectors(), FsRecGetDeviceSectorSize(), FsRecReadBlock(), FsRtlBalanceReads(), FsRtlpOpenDev(), FsRtlpRegisterProviderWithMUP(), FsRtlProcessFileLock(), FstubGetDiskGeometry(), FstubReadSector(), FstubWriteSector(), GetCompressedFileSizeW(), GetConnectionHandle(), GetConsoleScreenBufferInfo(), GetDiskFreeSpaceExW(), GetDiskFreeSpaceW(), GetDriveTypeW(), GetFileAttributesByHandle(), GetFileInformationByHandle(), GetFileSize(), GetFileSizeEx(), GetFileSystem(), GetFileTime(), GetRemoteDatabaseEntry(), GetRemoteDatabaseSize(), GetVolumeInformationW(), GetVolumeNameForRoot(), HalpGetFullGeometry(), HidUsb_ResetPort(), InfOpenFile(), InfWriteFile(), IniCacheLoad(), IniCacheSave(), InstallExt2BootCodeToDisk(), InstallFat12BootCodeToFloppy(), InstallFat16BootCodeToDisk(), InstallFat16BootCodeToFile(), InstallFat32BootCodeToDisk(), InstallFat32BootCodeToFile(), InstallMbrBootCodeToDisk(), IntAgpGetInterface(), IntGetFullFileName(), IntUpdateControlKeyState(), IoBuildAsynchronousFsdRequest(), IoBuildDeviceIoControlRequest(), IoGetBootDiskInformation(), IoGetDmaAdapter(), IoInvalidateDeviceState(), IopActionInterrogateDeviceStack(), IopCancelPrepareDeviceForRemoval(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopCreateDeviceInstancePath(), IopCreateLogFile(), IopDeviceFsIoControl(), IopEnumerateDevice(), IopFilterResourceRequirements(), IopGetBasicInformationFile(), IopGetDeviceRelations(), IopGetFileInformation(), IopGetSetSecurityObject(), IopLoadFileSystemDriver(), IopMarkBootPartition(), IopMountVolume(), IopOpenLinkOrRenameTarget(), IopParseDevice(), IopPrepareDeviceForRemoval(), IopQueryCompatibleIds(), IopQueryDeviceInformation(), IopQueryHardwareIds(), IopStartRamdisk(), IopSynchronousCall(), IopWriteLogFile(), IoRequestDeviceEject(), IoSetInformation(), IoVerifyVolume(), IoVolumeDeviceToDosName(), IsFtVolume(), IsThereAValidBootSector(), IsThisARootDirectory(), KdbpSymLoadModuleSymbols(), KernelModeTest(), KmtInitTestFiles(), KsecDeviceIoControl(), KsecOpenDevice(), KsiCreateObjectType(), KspCreateObjectType(), KspSynchronousIoControlDeviceCompletion(), KsSynchronousIoControlDevice(), LdrpCreateDllSection(), LdrVerifyImageMatchesChecksum(), LockFile(), LogfBackupFile(), LogfCreate(), LogfpFlushFile(), LogfpReadFile(), LogfpSetFileSize(), LogfpWriteFile(), main(), MakeBeep(), MapFile(), MmCheckSystemImage(), MmLoadSystemImage(), MountMgrNotifyNameChange(), MountMgrValidateBackPointer(), MountMgrVolumeMountPointChanged(), MoveFileWithProgressW(), MyDeleteFile(), NdisOpenFile(), NpCheckClientPipe_(), NpCheckServerPipe_(), NpControlPipe(), NpCreatePipeEx(), NpOpenPipeEx(), NpQueryPipe_(), NpReadPipe(), NpWaitPipe(), NpWritePipe(), nt_mailslot_test(), NtLockFile(), NtNotifyChangeDirectoryFile(), NtQueryDirectoryFile(), NtQueryInformationFile(), NtReadFile(), NtSetInformationFile(), NtWriteFile(), OnlineMountedVolumes(), OpenDevice(), OpenDirectory(), OpenDirectoryByHandleOrPath(), OpenFile(), OpenRemoteDatabase(), PciGetDeviceCapabilities(), PciQueryForPciBusInterface(), PciSendIoctl(), PopAddRemoveSysCapsCallback(), PopFlushVolumeWorker(), PopSendQuerySystemPowerState(), PopSendSetSystemPowerState(), PrivMoveFileIdentityW(), ProtectBootIni(), PsLocateSystemDll(), QueryDeviceInformation(), QueryFileInfo(), QuerySuggestedLinkName(), QueryVolumeName(), RawQueryFsSizeInfo(), ReadBlock(), ReadConsoleInput(), ReadDirectoryChangesW(), ReconcileThisDatabaseWithMasterWorker(), RegisterUncProvider(), RegNotifyChangeKeyValue(), RegRestoreKeyW(), RegSaveKeyW(), RemoveDirectoryW(), ReplaceFileW(), RosSymZwReadFile(), RosSymZwSeekFile(), RtlCreateBootStatusDataFile(), RtlCreateSystemVolumeInformationFolder(), RtlGetSetBootStatusData(), RtlLockBootStatusData(), RtlpMapFile(), RtlpSysVolTakeOwnership(), RtlpWorkerThreadProc(), RtlSetCurrentDirectory_U(), RtlSetIoCompletionCallback(), RtlUnlockBootStatusData(), SaveBootSector(), SdbpOpenMemMappedFile(), SendIoctl(), SendLinkCreated(), SendLinkDeleted(), SendOnlineNotification(), SetAttributesOnFile(), SetConsoleCursorInfo(), SetConsoleCursorPosition(), SetConsoleOutputCP(), SetConsoleTextAttribute(), SetEndOfFile(), SetFileAttributesByHandle(), SetFileAttributesW(), SetFileInformationByHandle(), SetFilePointer(), SetFilePointerEx(), SetFileShortNameW(), SetFileTime(), SetFileValidData(), SetLastWriteTime(), SetupCopyFile(), SetupCreateSingleDirectory(), SetVolumeLabelW(), SimpleErrorChecks(), SmpCreateVolumeDescriptors(), SmpDeletePagingFile(), SmpGetPagingFileSize(), SmpGetVolumeFreeSpace(), SmpInitializeKnownDllsInternal(), SmpProcessFileRenames(), SpeakerInitialize(), SpiSendInquiry(), START_TEST(), StreamClassRWCompletion(), TCPSendIoctl(), TdiCall(), Test_ImageSection(), Test_ImageSection2(), TestFileFsAttributeInformation(), TestFileFsDeviceInformation(), TestFileFsVolumeInformation(), TestFileInfo(), TestIoCreateFile(), TestKM(), TestSymlinks(), TestVolumeInfo(), TruncateRemoteDatabase(), UnprotectBootIni(), USBH_EnableParentPort(), USBH_GetPortStatus(), USBH_SyncGetDeviceHandle(), USBH_SyncGetHubCount(), USBH_SyncGetRootHubPdo(), USBH_SyncSubmitUrb(), USBPORT_IsCompanionController(), USBPORT_QueryPciBusInterface(), UserModeTest(), VfatFlushVolume(), VfatSetRenameInformation(), VideoPortCheckForDeviceExistence(), ViReadFile(), W32kOpenFile(), WahCreateSocketHandle(), WahOpenHandleHelper(), WaitNamedPipeW(), WdmAudOpenSysAudioDevice(), WIN32read(), WIN32write(), WriteConsole(), WriteConsoleOutputCharacterA(), WriteConsoleOutputCharacterW(), WriteRemoteDatabaseEntry(), WSPCloseSocket(), xHalExamineMBR(), xHalGetPartialGeometry(), xHalIoReadPartitionTable(), xHalIoSetPartitionInformation(), xHalIoWritePartitionTable(), and xOpenFile().

Definition at line 77 of file pipe.c.

Definition at line 75 of file pipe.c.

Definition at line 76 of file pipe.c.

Referenced by test_security_info().

BOOL open_succeeded
static

Definition at line 412 of file pipe.c.

Referenced by test_alertable(), test_nonalertable(), and thread().

Definition at line 67 of file pipe.c.

Definition at line 68 of file pipe.c.

Definition at line 77 of file pipe.c.

Definition at line 68 of file pipe.c.

Referenced by _wsopen_s(), sc_cb_open(), and test_create().

Definition at line 80 of file pipe.c.

const WCHAR testpipe[]
static
Initial value:
= { '\\', '\\', '.', '\\', 'p', 'i', 'p', 'e', '\\',
't', 'e', 's', 't', 'p', 'i', 'p', 'e', 0 }

Definition at line 116 of file pipe.c.

Referenced by test_completion(), test_create(), test_filepipeinfo(), test_overlapped(), and thread().

const WCHAR testpipe_nt[]
static
Initial value:
= { '\\', '?', '?', '\\', 'p', 'i', 'p', 'e', '\\',
't', 'e', 's', 't', 'p', 'i', 'p', 'e', 0 }

Definition at line 118 of file pipe.c.

Referenced by create_pipe(), test_create_invalid(), and test_filepipeinfo().

BOOL userapc_called
static

Definition at line 406 of file pipe.c.

Referenced by test_alertable(), test_nonalertable(), thread(), and userapc().