2 * PROJECT: ReactOS api tests
3 * LICENSE: GNU GPLv2 only as published by the Free Software Foundation
4 * PURPOSE: Test for mailslot (CORE-10188)
5 * PROGRAMMER: Nikita Pechenkin (n.pechenkin@mail.ru)
10 #define WIN32_NO_STATUS
13 #define LMS TEXT("\\\\.\\mailslot\\rostest_slot")
16 static DWORD dInMsg
= MSG
;
17 static DWORD dOutMsg
= 0x0;
27 hMailslot
= CreateFile(LMS
, GENERIC_WRITE
, FILE_SHARE_READ
| FILE_SHARE_WRITE
,
28 NULL
, OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
, NULL
);
29 ok(hMailslot
!= INVALID_HANDLE_VALUE
, "CreateFile failed, results might not be accurate\n");
30 if (hMailslot
!= INVALID_HANDLE_VALUE
)
33 ok(WriteFile(hMailslot
, &dInMsg
, sizeof(dInMsg
), &cbWritten
, (LPOVERLAPPED
) NULL
), "Slot write failed\n");
34 CloseHandle(hMailslot
);
44 HANDLE hMailslotClient
;
48 hMailslotClient
= CreateMailslot(LMS
, 0L, MAILSLOT_WAIT_FOREVER
, (LPSECURITY_ATTRIBUTES
) NULL
);
49 ok(hMailslotClient
!= INVALID_HANDLE_VALUE
, "CreateMailslot failed\n");
50 if (hMailslotClient
!= INVALID_HANDLE_VALUE
)
52 hThread
= CreateThread(NULL
,0, MailSlotWriter
, NULL
, 0, NULL
);
53 ok(hThread
!= INVALID_HANDLE_VALUE
, "CreateThread failed\n");
54 if (hThread
!= INVALID_HANDLE_VALUE
)
56 ok(ReadFile(hMailslotClient
, &dOutMsg
, sizeof(dOutMsg
), &cbRead
, NULL
), "Slot read failed\n");
57 WaitForSingleObject(hThread
, INFINITE
);
60 CloseHandle(hMailslotClient
);
66 StartTestCORE10188(VOID
)
70 hThread
= CreateThread(NULL
,0, MailSlotReader
, NULL
, 0, NULL
);
71 ok(hThread
!= INVALID_HANDLE_VALUE
, "CreateThread failed\n");
72 if (hThread
!= INVALID_HANDLE_VALUE
)
74 WaitForSingleObject(hThread
, INFINITE
);
77 ok(dInMsg
== dOutMsg
, "Transfer data failed\n");