38{
40 HANDLE hSlot, hSlot2, hWriter, hWriter2;
42 DWORD count, dwMax, dwNext, dwMsgCount, dwTimeout;
47
48
49 dwMax = dwNext = dwMsgCount = dwTimeout = 0;
51 &dwMsgCount, &dwTimeout ), "getmailslotinfo succeeded\n");
52
53
57
58
61 "Created mailslot with invalid name\n");
63 "error should be ERROR_INVALID_NAME\n");
64
65
69
70
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");
83
84
87
88
92 ok(!
ret,
"ReadFile should fail\n");
95
99 ok(!
ret,
"ReadFile should fail\n");
102
106 ok( !
ret,
"slot read\n");
110 "slot write\n");
112
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 );
119
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 );
126
127
131 "error should be ERROR_SHARING_VIOLATION got %p / %lu\n", hWriter,
GetLastError());
133
134
138
139
140
141
142
144 ok( !
ret,
"slot read\n");
148 "slot write\n");
150
151
152
153
154
156 "can read client\n");
160 "can't write client\n");
162 "can read client\n");
165
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 );
172
173
174
175
176
178 "slot read\n");
180
181
183 ok( !
ret,
"slot read\n");
186
187
190
192
193
196
198
199
202
204
205
208
209
211
212
213
214
215
219
220
221
222
223
226
228
229
233
234
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");
242
243
245 ok( !
ret,
"slot read\n");
248
249
252
253
254 dwNext = dwMsgCount = 0;
256 "getmailslotinfo failed\n");
257 ok( dwNext == 1,
"dwNext incorrect\n");
258 ok( dwMsgCount == 1,
"dwMsgCount incorrect\n");
259
263
264
265 dwNext = dwMsgCount = 0;
267 "getmailslotinfo failed\n");
268 ok( dwNext == 1,
"dwNext incorrect\n");
269 ok( dwMsgCount == 2,
"dwMsgCount incorrect\n");
270
271
273
274
275 dwNext = dwMsgCount = 0;
277 "getmailslotinfo failed\n");
278 ok( dwNext == 1,
"dwNext incorrect\n");
279 ok( dwMsgCount == 3,
"dwMsgCount incorrect %lu\n", dwMsgCount);
280
282
283
284
285
286
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");
291
292
293 dwNext = dwMsgCount = 0;
295 "getmailslotinfo failed\n");
296 ok( dwNext == 2,
"dwNext incorrect\n");
297 ok( dwMsgCount == 2,
"dwMsgCount incorrect %lu\n", dwMsgCount);
298
299
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");
304
305
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);
311
312
314 "3rd slot read failed\n");
315 ok(
count == 0,
"failed to get 3rd message\n");
316
317
318
319
320
321 dwNext = dwMsgCount = 0;
323 "getmailslotinfo failed\n");
325 ok( dwMsgCount == 0,
"dwMsgCount incorrect\n");
326
327
329 ok( !
ret,
"3rd slot read succeeded\n");
332
333
338
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 );
345
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 );
358
359 io.Status = 0xdeadbeef;
360 io.Information = 0xdeadbeef;
365 {
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 );
373 }
374
375
379
380
389 ok( dwTimeout >= 900,
"timeout too short %lu\n", dwTimeout );
391
395
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 );
402
403#ifdef __REACTOS__
405 ok(
FALSE,
"FIXME: This often bugchecks on ReactOS. This does not bugcheck on checked Windows builds.\n");
406 } else {
407#endif
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 );
414#ifdef __REACTOS__
415 }
416#endif
417
420
422#ifdef __REACTOS__
424#else
426#endif
427
429#ifdef __REACTOS__
431#else
433#endif
434
436#ifdef __REACTOS__
438 ok( !
io.Status ||
broken(
io.Status == 0xdeadbeef) ,
"got status %#lx\n",
io.Status );
440#else
442 ok( !
io.Status,
"got status %#lx\n",
io.Status );
443#endif
444 ok(
io.Information == 4,
"got size %Iu\n",
io.Information );
445
448
449 return 0;
450}
#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 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