26#define WIN32_NO_STATUS
35static const char szmspath[] =
"\\\\.\\mailslot\\wine_mailslot_test";
40 HANDLE hSlot, hSlot2, hWriter, hWriter2;
42 DWORD count, dwMax, dwNext, dwMsgCount, dwTimeout;
49 dwMax = dwNext = dwMsgCount = dwTimeout = 0;
51 &dwMsgCount, &dwTimeout ),
"getmailslotinfo succeeded\n");
61 "Created mailslot with invalid name\n");
63 "error should be ERROR_INVALID_NAME\n");
73 dwMax = dwNext = dwMsgCount = dwTimeout = 0;
75 "getmailslotinfo failed\n");
76 ok( dwMax == ~0
U,
"dwMax incorrect\n");
78 ok( dwMsgCount == 0,
"dwMsgCount incorrect\n");
79 ok( dwTimeout == ~0
U,
"dwTimeout incorrect\n");
81 "getmailslotinfo failed\n");
92 ok(!
ret,
"ReadFile should fail\n");
99 ok(!
ret,
"ReadFile should fail\n");
106 ok( !
ret,
"slot read\n");
113 io.Status = 0xdeadbeef;
114 io.Information = 0xdeadbeef;
117 ok(
io.Status == 0xdeadbeef,
"got status %#lx\n",
io.Status );
118 ok(
io.Information == 0xdeadbeef,
"got size %Iu\n",
io.Information );
120 io.Status = 0xdeadbeef;
121 io.Information = 0xdeadbeef;
124 ok(
io.Status == 0xdeadbeef,
"got status %#lx\n",
io.Status );
125 ok(
io.Information == 0xdeadbeef,
"got size %Iu\n",
io.Information );
131 "error should be ERROR_SHARING_VIOLATION got %p / %lu\n", hWriter,
GetLastError());
144 ok( !
ret,
"slot read\n");
156 "can read client\n");
160 "can't write client\n");
162 "can read client\n");
166 io.Status = 0xdeadbeef;
167 io.Information = 0xdeadbeef;
170 ok(
io.Status == 0xdeadbeef,
"got status %#lx\n",
io.Status );
171 ok(
io.Information == 0xdeadbeef,
"got size %Iu\n",
io.Information );
183 ok( !
ret,
"slot read\n");
235 dwMax = dwNext = dwMsgCount = dwTimeout = 0;
237 "getmailslotinfo failed\n");
239 ok( dwMax == 0,
"dwMax incorrect\n");
240 ok( dwMsgCount == 0,
"dwMsgCount incorrect\n");
241 ok( dwTimeout == 0,
"dwTimeout incorrect\n");
245 ok( !
ret,
"slot read\n");
254 dwNext = dwMsgCount = 0;
256 "getmailslotinfo failed\n");
257 ok( dwNext == 1,
"dwNext incorrect\n");
258 ok( dwMsgCount == 1,
"dwMsgCount incorrect\n");
265 dwNext = dwMsgCount = 0;
267 "getmailslotinfo failed\n");
268 ok( dwNext == 1,
"dwNext incorrect\n");
269 ok( dwMsgCount == 2,
"dwMsgCount incorrect\n");
275 dwNext = dwMsgCount = 0;
277 "getmailslotinfo failed\n");
278 ok( dwNext == 1,
"dwNext incorrect\n");
279 ok( dwMsgCount == 3,
"dwMsgCount incorrect %lu\n", dwMsgCount);
288 "1st slot read failed\n");
289 ok(
count == 1,
"failed to get 1st message\n");
290 ok(
buffer[0] ==
'a',
"1st message wrong\n");
293 dwNext = dwMsgCount = 0;
295 "getmailslotinfo failed\n");
296 ok( dwNext == 2,
"dwNext incorrect\n");
297 ok( dwMsgCount == 2,
"dwMsgCount incorrect %lu\n", dwMsgCount);
301 "2nd slot read failed\n");
302 ok(
count == 2,
"failed to get 2nd message\n");
303 ok( (
buffer[0] ==
'b' ) && (
buffer[1] ==
'c' ),
"2nd message wrong\n");
306 dwNext = dwMsgCount = 0;
308 "getmailslotinfo failed\n");
309 ok( dwNext == 0,
"dwNext incorrect %lu\n", dwNext);
310 ok( dwMsgCount == 1,
"dwMsgCount incorrect %lu\n", dwMsgCount);
314 "3rd slot read failed\n");
315 ok(
count == 0,
"failed to get 3rd message\n");
321 dwNext = dwMsgCount = 0;
323 "getmailslotinfo failed\n");
325 ok( dwMsgCount == 0,
"dwMsgCount incorrect\n");
329 ok( !
ret,
"3rd slot read succeeded\n");
339 io.Status = 0xdeadbeef;
340 io.Information = 0xdeadbeef;
343 ok(
io.Status == 0xdeadbeef,
"got status %#lx\n",
io.Status );
344 ok(
io.Information == 0xdeadbeef,
"got size %Iu\n",
io.Information );
346 io.Status = 0xdeadbeef;
347 io.Information = 0xdeadbeef;
352 ok(
io.Information ==
sizeof(
info),
"got size %Iu\n",
io.Information );
353 ok( !
info.MaximumMessageSize,
"got maximum size %lu\n",
info.MaximumMessageSize );
354 ok( !
info.MailslotQuota,
"got quota %lu\n",
info.MailslotQuota );
355 ok(
info.NextMessageSize == 2,
"got next size %lu\n",
info.NextMessageSize );
356 ok(
info.MessagesAvailable == 1,
"got message count %lu\n",
info.MessagesAvailable );
357 ok( !
info.ReadTimeout.QuadPart,
"got timeout %I64u\n",
info.ReadTimeout.QuadPart );
359 io.Status = 0xdeadbeef;
360 io.Information = 0xdeadbeef;
367 ok(
io.Information ==
sizeof(
info),
"got size %Iu\n",
io.Information );
368 ok( !
info.MaximumMessageSize,
"got maximum size %lu\n",
info.MaximumMessageSize );
369 ok( !
info.MailslotQuota,
"got quota %lu\n",
info.MailslotQuota );
370 ok(
info.NextMessageSize == 2,
"got next size %lu\n",
info.NextMessageSize );
371 ok(
info.MessagesAvailable == 1,
"got message count %lu\n",
info.MessagesAvailable );
372 ok( !
info.ReadTimeout.QuadPart,
"got timeout %I64u\n",
info.ReadTimeout.QuadPart );
389 ok( dwTimeout >= 900,
"timeout too short %lu\n", dwTimeout );
396 io.Status = 0xdeadbeef;
397 io.Information = 0xdeadbeef;
400 ok(
io.Status == 0xdeadbeef,
"got status %#lx\n",
io.Status );
401 ok(
io.Information == 0xdeadbeef,
"got size %Iu\n",
io.Information );
405 ok(
FALSE,
"FIXME: This often bugchecks on ReactOS. This does not bugcheck on checked Windows builds.\n");
408 io.Status = 0xdeadbeef;
409 io.Information = 0xdeadbeef;
412 ok(
io.Status == 0xdeadbeef,
"got status %#lx\n",
io.Status );
413 ok(
io.Information == 0xdeadbeef,
"got size %Iu\n",
io.Information );
438 ok( !
io.Status ||
broken(
io.Status == 0xdeadbeef) ,
"got status %#lx\n",
io.Status );
442 ok( !
io.Status,
"got status %#lx\n",
io.Status );
444 ok(
io.Information == 4,
"got size %Iu\n",
io.Information );
#define ERROR_INVALID_PARAMETER
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define ERROR_INVALID_HANDLE
#define ERROR_ACCESS_DENIED
#define ERROR_INVALID_NAME
BOOL WINAPI GetMailslotInfo(IN HANDLE hMailslot, IN LPDWORD lpMaxMessageSize, IN LPDWORD lpNextSize, IN LPDWORD lpMessageCount, IN LPDWORD lpReadTimeout)
HANDLE WINAPI CreateMailslotA(IN LPCSTR lpName, IN DWORD nMaxMessageSize, IN DWORD lReadTimeout, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
@ FileMailslotQueryInformation
GLuint GLuint GLsizei count
static const char szmspath[]
static int mailslot_test(void)
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK io
#define InitializeObjectAttributes(p, n, a, r, s)
#define MAILSLOT_NO_MESSAGE
NTSYSAPI NTSTATUS NTAPI NtWriteFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID WriteBuffer, IN ULONG WriteBufferLength, IN PLARGE_INTEGER FileOffset OPTIONAL, IN PULONG LockOperationKey OPTIONAL)
NTSYSAPI NTSTATUS NTAPI NtQueryInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, OUT PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
NTSTATUS NTAPI NtCreateMailslotFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN ULONG CreateOptions, IN ULONG MailslotQuota, IN ULONG MaxMessageSize, IN PLARGE_INTEGER TimeOut)
#define _WIN32_WINNT_VISTA
#define STATUS_BUFFER_TOO_SMALL
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)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
#define RTL_CONSTANT_STRING(s)
#define STATUS_ACCESS_DENIED
#define STATUS_INVALID_PARAMETER
#define STATUS_IO_TIMEOUT
DWORD WINAPI GetLastError(void)
#define ERROR_SEM_TIMEOUT
#define ERROR_SHARING_VIOLATION
#define ERROR_PATH_NOT_FOUND