File indexing completed on 2025-01-18 09:53:47
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_WINAPI_PIPES_HPP_INCLUDED_
0010 #define BOOST_WINAPI_PIPES_HPP_INCLUDED_
0011
0012 #include <boost/winapi/basic_types.hpp>
0013 #include <boost/winapi/config.hpp>
0014 #include <boost/winapi/overlapped.hpp>
0015
0016 #ifdef BOOST_HAS_PRAGMA_ONCE
0017 #pragma once
0018 #endif
0019
0020 #if BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM
0021
0022 #include <boost/winapi/detail/header.hpp>
0023
0024 #if !defined( BOOST_USE_WINDOWS_H ) && BOOST_WINAPI_PARTITION_DESKTOP && !defined( BOOST_NO_ANSI_APIS )
0025 extern "C" {
0026 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC CreateNamedPipeA(
0027 boost::winapi::LPCSTR_ lpName,
0028 boost::winapi::DWORD_ dwOpenMode,
0029 boost::winapi::DWORD_ dwPipeMode,
0030 boost::winapi::DWORD_ nMaxInstances,
0031 boost::winapi::DWORD_ nOutBufferSize,
0032 boost::winapi::DWORD_ nInBufferSize,
0033 boost::winapi::DWORD_ nDefaultTimeOut,
0034 _SECURITY_ATTRIBUTES *lpSecurityAttributes);
0035 }
0036 #endif
0037
0038 #if !defined( BOOST_USE_WINDOWS_H )
0039 extern "C" {
0040
0041 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC ImpersonateNamedPipeClient(
0042 boost::winapi::HANDLE_ hNamedPipe);
0043
0044 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC CreatePipe(
0045 boost::winapi::PHANDLE_ hReadPipe,
0046 boost::winapi::PHANDLE_ hWritePipe,
0047 _SECURITY_ATTRIBUTES* lpPipeAttributes,
0048 boost::winapi::DWORD_ nSize);
0049
0050 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC ConnectNamedPipe(
0051 boost::winapi::HANDLE_ hNamedPipe,
0052 _OVERLAPPED* lpOverlapped);
0053
0054 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC DisconnectNamedPipe(
0055 boost::winapi::HANDLE_ hNamedPipe);
0056
0057 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC SetNamedPipeHandleState(
0058 boost::winapi::HANDLE_ hNamedPipe,
0059 boost::winapi::LPDWORD_ lpMode,
0060 boost::winapi::LPDWORD_ lpMaxCollectionCount,
0061 boost::winapi::LPDWORD_ lpCollectDataTimeout);
0062
0063 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC PeekNamedPipe(
0064 boost::winapi::HANDLE_ hNamedPipe,
0065 boost::winapi::LPVOID_ lpBuffer,
0066 boost::winapi::DWORD_ nBufferSize,
0067 boost::winapi::LPDWORD_ lpBytesRead,
0068 boost::winapi::LPDWORD_ lpTotalBytesAvail,
0069 boost::winapi::LPDWORD_ lpBytesLeftThisMessage);
0070
0071 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC TransactNamedPipe(
0072 boost::winapi::HANDLE_ hNamedPipe,
0073 boost::winapi::LPVOID_ lpInBuffer,
0074 boost::winapi::DWORD_ nInBufferSize,
0075 boost::winapi::LPVOID_ lpOutBuffer,
0076 boost::winapi::DWORD_ nOutBufferSize,
0077 boost::winapi::LPDWORD_ lpBytesRead,
0078 _OVERLAPPED* lpOverlapped);
0079
0080 #if !defined( BOOST_NO_ANSI_APIS )
0081 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC WaitNamedPipeA(
0082 boost::winapi::LPCSTR_ lpNamedPipeName,
0083 boost::winapi::DWORD_ nTimeOut);
0084 #endif
0085
0086 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC CreateNamedPipeW(
0087 boost::winapi::LPCWSTR_ lpName,
0088 boost::winapi::DWORD_ dwOpenMode,
0089 boost::winapi::DWORD_ dwPipeMode,
0090 boost::winapi::DWORD_ nMaxInstances,
0091 boost::winapi::DWORD_ nOutBufferSize,
0092 boost::winapi::DWORD_ nInBufferSize,
0093 boost::winapi::DWORD_ nDefaultTimeOut,
0094 _SECURITY_ATTRIBUTES* lpSecurityAttributes);
0095
0096 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC WaitNamedPipeW(
0097 boost::winapi::LPCWSTR_ lpNamedPipeName,
0098 boost::winapi::DWORD_ nTimeOut);
0099
0100 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
0101 #if !defined( BOOST_NO_ANSI_APIS )
0102 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC GetNamedPipeClientComputerNameA(
0103 boost::winapi::HANDLE_ Pipe,
0104 boost::winapi::LPSTR_ ClientComputerName,
0105 boost::winapi::ULONG_ ClientComputerNameLength);
0106 #endif
0107
0108 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC GetNamedPipeClientComputerNameW(
0109 boost::winapi::HANDLE_ Pipe,
0110 boost::winapi::LPWSTR_ ClientComputerName,
0111 boost::winapi::ULONG_ ClientComputerNameLength);
0112 #endif
0113
0114 }
0115 #endif
0116
0117 namespace boost {
0118 namespace winapi {
0119
0120 #if defined( BOOST_USE_WINDOWS_H )
0121
0122 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_ACCESS_DUPLEX_ = PIPE_ACCESS_DUPLEX;
0123 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_ACCESS_INBOUND_ = PIPE_ACCESS_INBOUND;
0124 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_ACCESS_OUTBOUND_ = PIPE_ACCESS_OUTBOUND;
0125
0126 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_TYPE_BYTE_ = PIPE_TYPE_BYTE;
0127 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_TYPE_MESSAGE_ = PIPE_TYPE_MESSAGE;
0128
0129 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_READMODE_BYTE_ = PIPE_READMODE_BYTE;
0130 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_READMODE_MESSAGE_ = PIPE_READMODE_MESSAGE;
0131
0132 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_WAIT_ = PIPE_WAIT;
0133 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_NOWAIT_ = PIPE_NOWAIT;
0134
0135 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_UNLIMITED_INSTANCES_ = PIPE_UNLIMITED_INSTANCES;
0136
0137 BOOST_CONSTEXPR_OR_CONST DWORD_ NMPWAIT_USE_DEFAULT_WAIT_ = NMPWAIT_USE_DEFAULT_WAIT;
0138 BOOST_CONSTEXPR_OR_CONST DWORD_ NMPWAIT_NOWAIT_ = NMPWAIT_NOWAIT;
0139 BOOST_CONSTEXPR_OR_CONST DWORD_ NMPWAIT_WAIT_FOREVER_ = NMPWAIT_WAIT_FOREVER;
0140
0141 #else
0142
0143 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_ACCESS_DUPLEX_ = 0x00000003;
0144 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_ACCESS_INBOUND_ = 0x00000001;
0145 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_ACCESS_OUTBOUND_ = 0x00000002;
0146
0147 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_TYPE_BYTE_ = 0x00000000;
0148 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_TYPE_MESSAGE_ = 0x00000004;
0149
0150 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_READMODE_BYTE_ = 0x00000000;
0151 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_READMODE_MESSAGE_ = 0x00000002;
0152
0153 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_WAIT_ = 0x00000000;
0154 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_NOWAIT_ = 0x00000001;
0155
0156 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_UNLIMITED_INSTANCES_ = 255u;
0157
0158 BOOST_CONSTEXPR_OR_CONST DWORD_ NMPWAIT_USE_DEFAULT_WAIT_ = 0x00000000;
0159 BOOST_CONSTEXPR_OR_CONST DWORD_ NMPWAIT_NOWAIT_ = 0x00000001;
0160 BOOST_CONSTEXPR_OR_CONST DWORD_ NMPWAIT_WAIT_FOREVER_ = 0xFFFFFFFF;
0161
0162 #endif
0163
0164
0165 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_ACCEPT_REMOTE_CLIENTS_ = 0x00000000;
0166 BOOST_CONSTEXPR_OR_CONST DWORD_ PIPE_REJECT_REMOTE_CLIENTS_ = 0x00000008;
0167
0168 using ::ImpersonateNamedPipeClient;
0169 using ::DisconnectNamedPipe;
0170 using ::SetNamedPipeHandleState;
0171 using ::PeekNamedPipe;
0172
0173 #if !defined( BOOST_NO_ANSI_APIS )
0174 using ::WaitNamedPipeA;
0175 #endif
0176 using ::WaitNamedPipeW;
0177
0178 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
0179 #if !defined( BOOST_NO_ANSI_APIS )
0180 using ::GetNamedPipeClientComputerNameA;
0181 #endif
0182 using ::GetNamedPipeClientComputerNameW;
0183 #endif
0184
0185 BOOST_FORCEINLINE BOOL_ CreatePipe(PHANDLE_ hReadPipe, PHANDLE_ hWritePipe, LPSECURITY_ATTRIBUTES_ lpPipeAttributes, DWORD_ nSize)
0186 {
0187 return ::CreatePipe(hReadPipe, hWritePipe, reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpPipeAttributes), nSize);
0188 }
0189
0190 BOOST_FORCEINLINE BOOL_ ConnectNamedPipe(HANDLE_ hNamedPipe, LPOVERLAPPED_ lpOverlapped)
0191 {
0192 return ::ConnectNamedPipe(hNamedPipe, reinterpret_cast< ::_OVERLAPPED* >(lpOverlapped));
0193 }
0194
0195 BOOST_FORCEINLINE BOOL_ TransactNamedPipe(HANDLE_ hNamedPipe, LPVOID_ lpInBuffer, DWORD_ nInBufferSize, LPVOID_ lpOutBuffer, DWORD_ nOutBufferSize, LPDWORD_ lpBytesRead, LPOVERLAPPED_ lpOverlapped)
0196 {
0197 return ::TransactNamedPipe(hNamedPipe, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesRead, reinterpret_cast< ::_OVERLAPPED* >(lpOverlapped));
0198 }
0199
0200
0201 #if BOOST_WINAPI_PARTITION_DESKTOP && !defined( BOOST_NO_ANSI_APIS )
0202 BOOST_FORCEINLINE HANDLE_ CreateNamedPipeA(
0203 LPCSTR_ lpName,
0204 DWORD_ dwOpenMode,
0205 DWORD_ dwPipeMode,
0206 DWORD_ nMaxInstances,
0207 DWORD_ nOutBufferSize,
0208 DWORD_ nInBufferSize,
0209 DWORD_ nDefaultTimeOut,
0210 LPSECURITY_ATTRIBUTES_ lpSecurityAttributes)
0211 {
0212 return ::CreateNamedPipeA(
0213 lpName,
0214 dwOpenMode,
0215 dwPipeMode,
0216 nMaxInstances,
0217 nOutBufferSize,
0218 nInBufferSize,
0219 nDefaultTimeOut,
0220 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpSecurityAttributes));
0221 }
0222
0223 BOOST_FORCEINLINE HANDLE_ create_named_pipe(
0224 LPCSTR_ lpName,
0225 DWORD_ dwOpenMode,
0226 DWORD_ dwPipeMode,
0227 DWORD_ nMaxInstances,
0228 DWORD_ nOutBufferSize,
0229 DWORD_ nInBufferSize,
0230 DWORD_ nDefaultTimeOut,
0231 LPSECURITY_ATTRIBUTES_ lpSecurityAttributes)
0232 {
0233 return ::CreateNamedPipeA(
0234 lpName,
0235 dwOpenMode,
0236 dwPipeMode,
0237 nMaxInstances,
0238 nOutBufferSize,
0239 nInBufferSize,
0240 nDefaultTimeOut,
0241 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpSecurityAttributes));
0242 }
0243 #endif
0244
0245 BOOST_FORCEINLINE HANDLE_ CreateNamedPipeW(
0246 LPCWSTR_ lpName,
0247 DWORD_ dwOpenMode,
0248 DWORD_ dwPipeMode,
0249 DWORD_ nMaxInstances,
0250 DWORD_ nOutBufferSize,
0251 DWORD_ nInBufferSize,
0252 DWORD_ nDefaultTimeOut,
0253 LPSECURITY_ATTRIBUTES_ lpSecurityAttributes)
0254 {
0255 return ::CreateNamedPipeW(
0256 lpName,
0257 dwOpenMode,
0258 dwPipeMode,
0259 nMaxInstances,
0260 nOutBufferSize,
0261 nInBufferSize,
0262 nDefaultTimeOut,
0263 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpSecurityAttributes));
0264 }
0265
0266 BOOST_FORCEINLINE HANDLE_ create_named_pipe(
0267 LPCWSTR_ lpName,
0268 DWORD_ dwOpenMode,
0269 DWORD_ dwPipeMode,
0270 DWORD_ nMaxInstances,
0271 DWORD_ nOutBufferSize,
0272 DWORD_ nInBufferSize,
0273 DWORD_ nDefaultTimeOut,
0274 LPSECURITY_ATTRIBUTES_ lpSecurityAttributes)
0275 {
0276 return ::CreateNamedPipeW(
0277 lpName,
0278 dwOpenMode,
0279 dwPipeMode,
0280 nMaxInstances,
0281 nOutBufferSize,
0282 nInBufferSize,
0283 nDefaultTimeOut,
0284 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpSecurityAttributes));
0285 }
0286
0287 #if !defined( BOOST_NO_ANSI_APIS )
0288 BOOST_FORCEINLINE BOOL_ wait_named_pipe(LPCSTR_ lpNamedPipeName, DWORD_ nTimeOut)
0289 {
0290 return ::WaitNamedPipeA(lpNamedPipeName, nTimeOut);
0291 }
0292 #endif
0293
0294 BOOST_FORCEINLINE BOOL_ wait_named_pipe(LPCWSTR_ lpNamedPipeName, DWORD_ nTimeOut)
0295 {
0296 return ::WaitNamedPipeW(lpNamedPipeName, nTimeOut);
0297 }
0298
0299 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
0300
0301 #if !defined( BOOST_NO_ANSI_APIS )
0302 BOOST_FORCEINLINE BOOL_ get_named_pipe_client_computer_name(HANDLE_ Pipe, LPSTR_ ClientComputerName, ULONG_ ClientComputerNameLength)
0303 {
0304 return ::GetNamedPipeClientComputerNameA(Pipe, ClientComputerName, ClientComputerNameLength);
0305 }
0306 #endif
0307
0308 BOOST_FORCEINLINE BOOL_ get_named_pipe_client_computer_name(HANDLE_ Pipe, LPWSTR_ ClientComputerName, ULONG_ ClientComputerNameLength)
0309 {
0310 return ::GetNamedPipeClientComputerNameW(Pipe, ClientComputerName, ClientComputerNameLength);
0311 }
0312
0313 #endif
0314
0315 }
0316 }
0317
0318 #include <boost/winapi/detail/footer.hpp>
0319
0320 #endif
0321
0322 #endif