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

Last change on this file since 5587 was 5587, checked in by sandervl, 24 years ago

added mailslot implemenation, named pipe fixes + FreeLibraryAndExitThread

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