source: trunk/src/kernel32/mailslot.cpp@ 7029

Last change on this file since 7029 was 6646, checked in by bird, 24 years ago

Added $Id:$ keyword.

File size: 5.3 KB
Line 
1/* $Id: mailslot.cpp,v 1.2 2001-09-05 12:57:59 bird Exp $
2 *
3 * Win32 mailslot APIs
4 *
5 * Copyright 2001 Sander van Leeuwen (sandervl@xs4all.nl)
6 *
7 * Project Odin Software License can be found in LICENSE.TXT
8 *
9 */
10
11#include <odin.h>
12#include <odinwrap.h>
13#include <os2sel.h>
14#include <os2win.h>
15#include <string.h>
16#include "HandleManager.h"
17#include <unicode.h>
18
19#define DBG_LOCALLOG DBG_mailslot
20#include "dbglocal.h"
21
22ODINDEBUGCHANNEL(KERNEL32-MAILSLOT)
23
24/*****************************************************************************
25 * Name : HANDLE WIN32API CreateMailslotA
26 * Purpose : The CreateMailslot function creates a mailslot with the specified
27 * name and returns a handle that a mailslot server can use to
28 * perform operations on the mailslot. The mailslot is local to the
29 * computer that creates it. An error occurs if a mailslot with
30 * the specified name already exists.
31 * Parameters: LPCSTR lpName pointer to string for mailslot name
32 * DWORD nMaxMessageSize maximum message size
33 * DWORD lReadTimeout milliseconds before read time-out
34 * LPSECURITY_ATTRIBUTES lpSecurityAttributes pointer to security structure
35 * Variables :
36 * Result : If the function succeeds, the return value is a handle to
37 * the mailslot, for use in server mailslot operations.
38 * If the function fails, the return value is INVALID_HANDLE_VALUE.
39 * Remark :
40 * Status :
41 *
42 * Author : SvL
43 *****************************************************************************/
44
45ODINFUNCTION4(HANDLE, CreateMailslotA, LPCSTR, lpName, DWORD, nMaxMessageSize,
46 DWORD, lReadTimeout,
47 LPSECURITY_ATTRIBUTES, lpSecurityAttributes)
48{
49 return HMCreateMailslotA(lpName, nMaxMessageSize, lReadTimeout, lpSecurityAttributes);
50}
51
52/*****************************************************************************
53 * Name : HANDLE WIN32API CreateMailslotW
54 * Purpose : The CreateMailslot function creates a mailslot with the specified
55 * name and returns a handle that a mailslot server can use to
56 * perform operations on the mailslot. The mailslot is local to the
57 * computer that creates it. An error occurs if a mailslot with
58 * the specified name already exists.
59 * Parameters: LPCWSTR lpName pointer to string for mailslot name
60 * DWORD nMaxMessageSize maximum message size
61 * DWORD lReadTimeout milliseconds before read time-out
62 * LPSECURITY_ATTRIBUTES lpSecurityAttributes pointer to security
63 * structure
64 * Variables :
65 * Result : If the function succeeds, the return value is a handle to
66 * the mailslot, for use in server mailslot operations.
67 * If the function fails, the return value is INVALID_HANDLE_VALUE.
68 * Remark :
69 * Status :
70 *
71 * Author : SvL
72 *****************************************************************************/
73
74ODINFUNCTION4(HANDLE, CreateMailslotW, LPCWSTR, lpName, DWORD, nMaxMessageSize,
75 DWORD, lReadTimeout,
76 LPSECURITY_ATTRIBUTES, lpSecurityAttributes)
77{
78 HANDLE rc;
79 char *astring;
80
81 astring = UnicodeToAsciiString((LPWSTR)lpName);
82 rc = HMCreateMailslotA(astring, nMaxMessageSize, lReadTimeout, lpSecurityAttributes);
83 FreeAsciiString(astring);
84 return(rc);
85}
86
87/*****************************************************************************
88 * Name : BOOL GetMailslotInfo
89 * Purpose : The GetMailslotInfo function retrieves information about the
90 * specified mailslot.
91 * Parameters: HANDLE hMailslot mailslot handle
92 * LPDWORD lpMaxMessageSize address of maximum message size
93 * LPDWORD lpNextSize address of size of next message
94 * LPDWORD lpMessageCount address of number of messages
95 * LPDWORD lpReadTimeout address of read time-out
96 * Variables :
97 * Result : TRUE / FALSE
98 * Remark :
99 * Status :
100 *
101 * Author : SvL
102 *****************************************************************************/
103
104ODINFUNCTION5(BOOL, GetMailslotInfo, HANDLE, hMailslot,
105 LPDWORD, lpMaxMessageSize,
106 LPDWORD, lpNextSize,
107 LPDWORD, lpMessageCount,
108 LPDWORD, lpReadTimeout)
109{
110 return HMGetMailslotInfo(hMailslot, lpMaxMessageSize, lpNextSize,
111 lpMessageCount, lpReadTimeout);
112}
113
114/*****************************************************************************
115 * Name : BOOL SetMailslotInfo
116 * Purpose : The SetMailslotInfo function sets the time-out value used by the
117 * specified mailslot for a read operation.
118 * Parameters: HANDLE hObject handle to a mailslot object
119 * DWORD dwReadTimeout read time-out
120 * Variables :
121 * Result : TRUE / FALSE
122 * Remark :
123 * Status :
124 *
125 * Author : SvL
126 *****************************************************************************/
127
128ODINFUNCTION2(BOOL, SetMailslotInfo,HANDLE, hMailslot, DWORD, dwReadTimeout)
129{
130 return HMSetMailslotInfo(hMailslot, dwReadTimeout);
131}
Note: See TracBrowser for help on using the repository browser.