| 1 | /* $Id: npipe.cpp,v 1.8 2000-06-28 21:05:56 phaller Exp $ */
|
|---|
| 2 | /*
|
|---|
| 3 | * Win32 Named pipes API
|
|---|
| 4 | *
|
|---|
| 5 | * Copyright 1998 Sander van Leeuwen
|
|---|
| 6 | * Copyright 2000 Przemyslaw Dobrowolski
|
|---|
| 7 | *
|
|---|
| 8 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 9 | */
|
|---|
| 10 | #include <odin.h>
|
|---|
| 11 | #include <odinwrap.h>
|
|---|
| 12 | #include <os2win.h>
|
|---|
| 13 | #include <stdlib.h>
|
|---|
| 14 | #include <unicode.h>
|
|---|
| 15 | #include <heapstring.h>
|
|---|
| 16 | #include <options.h>
|
|---|
| 17 | #include "debugtools.h"
|
|---|
| 18 | #include "oslibdos.h"
|
|---|
| 19 |
|
|---|
| 20 | #define DBG_LOCALLOG DBG_npipe
|
|---|
| 21 | #include "dbglocal.h"
|
|---|
| 22 |
|
|---|
| 23 | ODINDEBUGCHANNEL(KERNEL32-NPIPE)
|
|---|
| 24 |
|
|---|
| 25 | //******************************************************************************
|
|---|
| 26 | //******************************************************************************
|
|---|
| 27 | ODINFUNCTION6(BOOL,PeekNamedPipe,HANDLE ,hPipe,
|
|---|
| 28 | LPVOID ,lpvBuffer,
|
|---|
| 29 | DWORD ,cbBuffer,
|
|---|
| 30 | LPDWORD,lpcbRead,
|
|---|
| 31 | LPDWORD,lpcbAvail,
|
|---|
| 32 | LPDWORD,lpcbMessage)
|
|---|
| 33 | {
|
|---|
| 34 | return(OSLibDosPeekNamedPipe(hPipe,lpvBuffer,cbBuffer,lpcbRead,lpcbAvail,lpcbMessage));
|
|---|
| 35 | }
|
|---|
| 36 | //******************************************************************************
|
|---|
| 37 | //LPSECURITY_ATTRIBUTES lpsa; /* address of security attributes */
|
|---|
| 38 | //******************************************************************************
|
|---|
| 39 | ODINFUNCTION4(BOOL, CreatePipe,
|
|---|
| 40 | PHANDLE, phRead,
|
|---|
| 41 | PHANDLE, phWrite,
|
|---|
| 42 | LPSECURITY_ATTRIBUTES,lpsa,
|
|---|
| 43 | DWORD, cbPipe)
|
|---|
| 44 | {
|
|---|
| 45 | // @@@PH Note: HandleManager support is missing!
|
|---|
| 46 |
|
|---|
| 47 | if(!OSLibDosCreatePipe(phRead,
|
|---|
| 48 | phWrite,
|
|---|
| 49 | lpsa,
|
|---|
| 50 | cbPipe))
|
|---|
| 51 | return TRUE;
|
|---|
| 52 | else
|
|---|
| 53 | return(FALSE);
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 | //******************************************************************************
|
|---|
| 58 | //******************************************************************************
|
|---|
| 59 | ODINFUNCTION8(HANDLE,CreateNamedPipeA,LPCTSTR,lpName, DWORD,dwOpenMode, DWORD,dwPipeMode,
|
|---|
| 60 | DWORD, nMaxInstances, DWORD, nOutBufferSize,
|
|---|
| 61 | DWORD, nInBufferSize, DWORD, nDefaultTimeOut,
|
|---|
| 62 | void*, lpSecurityAttributes)
|
|---|
| 63 |
|
|---|
| 64 | {
|
|---|
| 65 | HANDLE hPipe;
|
|---|
| 66 |
|
|---|
| 67 | hPipe = OSLibDosCreateNamedPipe(lpName,
|
|---|
| 68 | dwOpenMode,
|
|---|
| 69 | dwPipeMode,
|
|---|
| 70 | nMaxInstances,
|
|---|
| 71 | nOutBufferSize,
|
|---|
| 72 | nInBufferSize,
|
|---|
| 73 | nDefaultTimeOut,
|
|---|
| 74 | lpSecurityAttributes);
|
|---|
| 75 |
|
|---|
| 76 | return hPipe;
|
|---|
| 77 |
|
|---|
| 78 | }
|
|---|
| 79 | //******************************************************************************
|
|---|
| 80 | //******************************************************************************
|
|---|
| 81 | ODINFUNCTION8(HANDLE,CreateNamedPipeW,LPCWSTR,lpName, DWORD,dwOpenMode, DWORD,dwPipeMode,
|
|---|
| 82 | DWORD, nMaxInstances, DWORD, nOutBufferSize,
|
|---|
| 83 | DWORD, nInBufferSize, DWORD, nDefaultTimeOut,
|
|---|
| 84 | void *,lpSecurityAttributes)
|
|---|
| 85 | {
|
|---|
| 86 | char *asciiname;
|
|---|
| 87 | HANDLE hPipe;
|
|---|
| 88 |
|
|---|
| 89 | asciiname = UnicodeToAsciiString((LPWSTR)lpName);
|
|---|
| 90 |
|
|---|
| 91 | hPipe=OSLibDosCreateNamedPipe(asciiname,
|
|---|
| 92 | dwOpenMode,
|
|---|
| 93 | dwPipeMode,
|
|---|
| 94 | nMaxInstances,
|
|---|
| 95 | nOutBufferSize,
|
|---|
| 96 | nInBufferSize,
|
|---|
| 97 | nDefaultTimeOut,
|
|---|
| 98 | lpSecurityAttributes);
|
|---|
| 99 |
|
|---|
| 100 | FreeAsciiString(asciiname);
|
|---|
| 101 |
|
|---|
| 102 | return(hPipe);
|
|---|
| 103 | }
|
|---|
| 104 | //******************************************************************************
|
|---|
| 105 | //******************************************************************************
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 | /*****************************************************************************
|
|---|
| 109 | * Name : BOOL WIN32API ConnectNamedPipe
|
|---|
| 110 | * Purpose : The ConnectNamedPipe function enables a named pipe server process
|
|---|
| 111 | * to wait for a client process to connect to an instance of a
|
|---|
| 112 | * named pipe. A client process connects by calling either the
|
|---|
| 113 | * CreateFile or CallNamedPipe function.
|
|---|
| 114 | * Parameters: HANDLE hNamedPipe handle to named pipe to connect
|
|---|
| 115 | * LPOVERLAPPED lpOverlapped pointer to overlapped structure
|
|---|
| 116 | * Variables :
|
|---|
| 117 | * Result : If the function succeeds, the return value is nonzero.
|
|---|
| 118 | * If the function fails, the return value is zero.
|
|---|
| 119 | * To get extended error information, call GetLastError.
|
|---|
| 120 | * Remark :
|
|---|
| 121 | * Status : NOT FULLY TESTED
|
|---|
| 122 | *
|
|---|
| 123 | * Author : Przemyslaw Dobrowolski [Sun, 2000/01/02 12:48]
|
|---|
| 124 | *****************************************************************************/
|
|---|
| 125 |
|
|---|
| 126 | ODINFUNCTION2(BOOL,ConnectNamedPipe,HANDLE,hNamedPipe, LPOVERLAPPED,lpOverlapped)
|
|---|
| 127 | {
|
|---|
| 128 | return (OSLibDosConnectNamedPipe(hNamedPipe,lpOverlapped));
|
|---|
| 129 | }
|
|---|
| 130 |
|
|---|
| 131 | /*****************************************************************************
|
|---|
| 132 | * Name : BOOL WIN32AOI CallNamedPipeA
|
|---|
| 133 | * Purpose : The CallNamedPipe function connects to a message-type pipe
|
|---|
| 134 | * (and waits if an instance of the pipe is not available),
|
|---|
| 135 | * writes to and reads from the pipe, and then closes the pipe.
|
|---|
| 136 | * Parameters: LPCSTR lpNamedPipeName pointer to pipe name
|
|---|
| 137 | * LPVOID lpInBuffer pointer to write buffer
|
|---|
| 138 | * DWORD nInBufferSize size, in bytes, of write buffer
|
|---|
| 139 | * LPVOID lpOutBuffer pointer to read buffer
|
|---|
| 140 | * DWORD nOutBufferSize size, in bytes, of read buffer
|
|---|
| 141 | * LPDWORD lpBytesRead pointer to number of bytes read
|
|---|
| 142 | * DWORD nTimeOut time-out time, in milliseconds
|
|---|
| 143 | * Variables :
|
|---|
| 144 | * Result : If the function succeeds, the return value is nonzero.
|
|---|
| 145 | * If the function fails, the return value is zero.
|
|---|
| 146 | * To get extended error information, call GetLastError.
|
|---|
| 147 | * Remark : Calling CallNamedPipe is equivalent to calling the CreateFile
|
|---|
| 148 | * (or WaitNamedPipe, if CreateFile cannot open the pipe immediately),
|
|---|
| 149 | * TransactNamedPipe, and CloseHandle functions. CreateFile is called
|
|---|
| 150 | * with an access flag of GENERIC_READ | GENERIC_WRITE, an inherit
|
|---|
| 151 | * handle flag of FALSE, and a share mode of zero (indicating no
|
|---|
| 152 | * sharing of this pipe instance).
|
|---|
| 153 | * If the message written to the pipe by the server process is
|
|---|
| 154 | * longer than nOutBufferSize, CallNamedPipe returns FALSE, and
|
|---|
| 155 | * GetLastError returns ERROR_MORE_DATA. The remainder of the
|
|---|
| 156 | * message is discarded, because CallNamedPipe closes the handle
|
|---|
| 157 | * to the pipe before returning.
|
|---|
| 158 | *
|
|---|
| 159 | * CallNamedPipe fails if the pipe is a byte-type pipe.
|
|---|
| 160 | * Status : NOT FULLY TESTED
|
|---|
| 161 | *
|
|---|
| 162 | * Author : Przemyslaw Dobrowolski [Mon, 2000/01/03 13:32]
|
|---|
| 163 | *****************************************************************************/
|
|---|
| 164 |
|
|---|
| 165 | ODINFUNCTION7(BOOL,CallNamedPipeA,LPCSTR , lpNamedPipeName,
|
|---|
| 166 | LPVOID , lpInBuffer,
|
|---|
| 167 | DWORD , nInBufferSize,
|
|---|
| 168 | LPVOID , lpOutBuffer,
|
|---|
| 169 | DWORD , nOutBufferSize,
|
|---|
| 170 | LPDWORD, lpBytesRead,
|
|---|
| 171 | DWORD , nTimeOut)
|
|---|
| 172 | {
|
|---|
| 173 | return(OSLibDosCallNamedPipe(lpNamedPipeName,
|
|---|
| 174 | lpInBuffer,
|
|---|
| 175 | nInBufferSize,
|
|---|
| 176 | lpOutBuffer,
|
|---|
| 177 | nOutBufferSize,
|
|---|
| 178 | lpBytesRead,
|
|---|
| 179 | nTimeOut ));
|
|---|
| 180 | }
|
|---|
| 181 |
|
|---|
| 182 | /*****************************************************************************
|
|---|
| 183 | * Name : BOOL WIN32AOI CallNamedPipeW
|
|---|
| 184 | * Purpose : The CallNamedPipe function connects to a message-type pipe
|
|---|
| 185 | * (and waits if an instance of the pipe is not available),
|
|---|
| 186 | * writes to and reads from the pipe, and then closes the pipe.
|
|---|
| 187 | * Parameters: LPCWSTR lpNamedPipeName pointer to pipe name
|
|---|
| 188 | * LPVOID lpInBuffer pointer to write buffer
|
|---|
| 189 | * DWORD nInBufferSize size, in bytes, of write buffer
|
|---|
| 190 | * LPVOID lpOutBuffer pointer to read buffer
|
|---|
| 191 | * DWORD nOutBufferSize size, in bytes, of read buffer
|
|---|
| 192 | * LPDWORD lpBytesRead pointer to number of bytes read
|
|---|
| 193 | * DWORD nTimeOut time-out time, in milliseconds
|
|---|
| 194 | * Variables :
|
|---|
| 195 | * Result : If the function succeeds, the return value is nonzero.
|
|---|
| 196 | * If the function fails, the return value is zero.
|
|---|
| 197 | * To get extended error information, call GetLastError.
|
|---|
| 198 | * Remark : Calling CallNamedPipe is equivalent to calling the CreateFile
|
|---|
| 199 | * (or WaitNamedPipe, if CreateFile cannot open the pipe immediately),
|
|---|
| 200 | * TransactNamedPipe, and CloseHandle functions. CreateFile is called
|
|---|
| 201 | * with an access flag of GENERIC_READ | GENERIC_WRITE, an inherit
|
|---|
| 202 | * handle flag of FALSE, and a share mode of zero (indicating no
|
|---|
| 203 | * sharing of this pipe instance).
|
|---|
| 204 | * If the message written to the pipe by the server process is
|
|---|
| 205 | * longer than nOutBufferSize, CallNamedPipe returns FALSE, and
|
|---|
| 206 | * GetLastError returns ERROR_MORE_DATA. The remainder of the
|
|---|
| 207 | * message is discarded, because CallNamedPipe closes the handle
|
|---|
| 208 | * to the pipe before returning.
|
|---|
| 209 | *
|
|---|
| 210 | * CallNamedPipe fails if the pipe is a byte-type pipe.
|
|---|
| 211 | * Status : NOT FULLY TESTED
|
|---|
| 212 | *
|
|---|
| 213 | * Author : Przemyslaw Dobrowolski [Mon, 2000/01/03 13:33]
|
|---|
| 214 | *****************************************************************************/
|
|---|
| 215 | ODINFUNCTION7(BOOL,CallNamedPipeW,LPCWSTR , lpNamedPipeName,
|
|---|
| 216 | LPVOID , lpInBuffer,
|
|---|
| 217 | DWORD , nInBufferSize,
|
|---|
| 218 | LPVOID , lpOutBuffer,
|
|---|
| 219 | DWORD , nOutBufferSize,
|
|---|
| 220 | LPDWORD, lpBytesRead,
|
|---|
| 221 | DWORD , nTimeOut)
|
|---|
| 222 | {
|
|---|
| 223 | char *asciiname;
|
|---|
| 224 | BOOL rc;
|
|---|
| 225 |
|
|---|
| 226 | asciiname = UnicodeToAsciiString((LPWSTR)lpNamedPipeName);
|
|---|
| 227 |
|
|---|
| 228 | rc=OSLibDosCallNamedPipe(asciiname,
|
|---|
| 229 | lpInBuffer,
|
|---|
| 230 | nInBufferSize,
|
|---|
| 231 | lpOutBuffer,
|
|---|
| 232 | nOutBufferSize,
|
|---|
| 233 | lpBytesRead,
|
|---|
| 234 | nTimeOut );
|
|---|
| 235 |
|
|---|
| 236 | FreeAsciiString(asciiname);
|
|---|
| 237 |
|
|---|
| 238 | return(rc);
|
|---|
| 239 | }
|
|---|
| 240 | /*****************************************************************************
|
|---|
| 241 | * Name : BOOL WIN32API DisconnectNamedPipe
|
|---|
| 242 | * Purpose : The DisconnectNamedPipe function disconnects the server end
|
|---|
| 243 | * of a named pipe instance from a client process.
|
|---|
| 244 | * Parameters: HANDLE hNamedPipe handle to named pipe
|
|---|
| 245 | * Variables :
|
|---|
| 246 | * Result : If the function succeeds, the return value is nonzero.
|
|---|
| 247 | * If the function fails, the return value is zero
|
|---|
| 248 | * Remark :
|
|---|
| 249 | * Status : NOT FULLY TESTED
|
|---|
| 250 | *
|
|---|
| 251 | * Author : Przemyslaw Dobrowolski [Mon, 2000/01/03 13:34]
|
|---|
| 252 | *****************************************************************************/
|
|---|
| 253 |
|
|---|
| 254 | ODINFUNCTION1(BOOL,DisconnectNamedPipe,HANDLE,hNamedPipe)
|
|---|
| 255 | {
|
|---|
| 256 | return (OSLibDosDisconnectNamedPipe(hNamedPipe));
|
|---|
| 257 | }
|
|---|
| 258 |
|
|---|
| 259 | /*****************************************************************************
|
|---|
| 260 | * Name : BOOL GetNamedPipeHandleStateA
|
|---|
| 261 | * Purpose : The GetNamedPipeHandleStateA function retrieves information about
|
|---|
| 262 | * a specified named pipe. The information returned can vary during
|
|---|
| 263 | * the lifetime of an instance of the named pipe.
|
|---|
| 264 | * Parameters: HANDLE hNamedPipe handle of named pipe
|
|---|
| 265 | * LPDWORD lpState address of flags indicating pipe state
|
|---|
| 266 | * LPDWORD lpCurInstances address of number of current pipe instances
|
|---|
| 267 | * LPDWORD lpMaxCollectionCount address of max. bytes before remote transmission
|
|---|
| 268 | * LPDWORD lpCollectDataTimeout address of max. time before remote transmission
|
|---|
| 269 | * LPTSTR lpUserName address of user name of client process
|
|---|
| 270 | * DWORD nMaxUserNameSize size, in characters, of user name buffer
|
|---|
| 271 | * Variables :
|
|---|
| 272 | * Result : TRUE / FALSE
|
|---|
| 273 | * Remark :
|
|---|
| 274 | * Status : UNTESTED STUB
|
|---|
| 275 | *
|
|---|
| 276 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
|---|
| 277 | *****************************************************************************/
|
|---|
| 278 |
|
|---|
| 279 | BOOL WIN32API GetNamedPipeHandleStateA(HANDLE hNamedPipe,
|
|---|
| 280 | LPDWORD lpState,
|
|---|
| 281 | LPDWORD lpCurInstances,
|
|---|
| 282 | LPDWORD lpMaxCollectionCount,
|
|---|
| 283 | LPDWORD lpCollectDataTimeout,
|
|---|
| 284 | LPTSTR lpUserName,
|
|---|
| 285 | DWORD nMaxUserNameSize)
|
|---|
| 286 | {
|
|---|
| 287 | dprintf(("KERNEL32: GetNamedPipeHandleStateA(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented (yet)\n",
|
|---|
| 288 | hNamedPipe,
|
|---|
| 289 | lpState,
|
|---|
| 290 | lpCurInstances,
|
|---|
| 291 | lpMaxCollectionCount,
|
|---|
| 292 | lpCollectDataTimeout,
|
|---|
| 293 | lpUserName,
|
|---|
| 294 | nMaxUserNameSize));
|
|---|
| 295 |
|
|---|
| 296 | return (FALSE);
|
|---|
| 297 | }
|
|---|
| 298 |
|
|---|
| 299 |
|
|---|
| 300 | /*****************************************************************************
|
|---|
| 301 | * Name : BOOL GetNamedPipeHandleStateW
|
|---|
| 302 | * Purpose : The GetNamedPipeHandleStateW function retrieves information about
|
|---|
| 303 | * a specified named pipe. The information returned can vary during
|
|---|
| 304 | * the lifetime of an instance of the named pipe.
|
|---|
| 305 | * Parameters: HANDLE hNamedPipe handle of named pipe
|
|---|
| 306 | * LPDWORD lpState address of flags indicating pipe state
|
|---|
| 307 | * LPDWORD lpCurInstances address of number of current pipe instances
|
|---|
| 308 | * LPDWORD lpMaxCollectionCount address of max. bytes before remote transmission
|
|---|
| 309 | * LPDWORD lpCollectDataTimeout address of max. time before remote transmission
|
|---|
| 310 | * LPWSTR lpUserName address of user name of client process
|
|---|
| 311 | * DWORD nMaxUserNameSize size, in characters, of user name buffer
|
|---|
| 312 | * Variables :
|
|---|
| 313 | * Result : TRUE / FALSE
|
|---|
| 314 | * Remark :
|
|---|
| 315 | * Status : UNTESTED STUB
|
|---|
| 316 | *
|
|---|
| 317 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
|---|
| 318 | *****************************************************************************/
|
|---|
| 319 |
|
|---|
| 320 | BOOL WIN32API GetNamedPipeHandleStateW(HANDLE hNamedPipe,
|
|---|
| 321 | LPDWORD lpState,
|
|---|
| 322 | LPDWORD lpCurInstances,
|
|---|
| 323 | LPDWORD lpMaxCollectionCount,
|
|---|
| 324 | LPDWORD lpCollectDataTimeout,
|
|---|
| 325 | LPWSTR lpUserName,
|
|---|
| 326 | DWORD nMaxUserNameSize)
|
|---|
| 327 | {
|
|---|
| 328 | dprintf(("KERNEL32: GetNamedPipeHandleStateW(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented\n",
|
|---|
| 329 | hNamedPipe,
|
|---|
| 330 | lpState,
|
|---|
| 331 | lpCurInstances,
|
|---|
| 332 | lpMaxCollectionCount,
|
|---|
| 333 | lpCollectDataTimeout,
|
|---|
| 334 | lpUserName,
|
|---|
| 335 | nMaxUserNameSize));
|
|---|
| 336 |
|
|---|
| 337 | return (FALSE);
|
|---|
| 338 | }
|
|---|
| 339 |
|
|---|
| 340 |
|
|---|
| 341 | /*****************************************************************************
|
|---|
| 342 | * Name : BOOL GetNamedPipeInfo
|
|---|
| 343 | * Purpose : The GetNamedPipeInfo function retrieves information about the specified named pipe.
|
|---|
| 344 | * Parameters: HANDLE hNamedPipe handle of named pipe
|
|---|
| 345 | * LPDWORD lpFlags address of flags indicating type of pipe
|
|---|
| 346 | * LPDWORD lpOutBufferSize address of size, in bytes, of pipe's output buffer
|
|---|
| 347 | * LPDWORD lpInBufferSize address of size, in bytes, of pipe's input buffer
|
|---|
| 348 | * LPDWORD lpMaxInstances address of max. number of pipe instances
|
|---|
| 349 | * Variables :
|
|---|
| 350 | * Result : TRUE / FALSE
|
|---|
| 351 | * Remark :
|
|---|
| 352 | * Status : UNTESTED STUB
|
|---|
| 353 | *
|
|---|
| 354 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
|---|
| 355 | *****************************************************************************/
|
|---|
| 356 |
|
|---|
| 357 | BOOL WIN32API GetNamedPipeInfo(HANDLE hNamedPipe,
|
|---|
| 358 | LPDWORD lpFlags,
|
|---|
| 359 | LPDWORD lpOutBufferSize,
|
|---|
| 360 | LPDWORD lpInBufferSize,
|
|---|
| 361 | LPDWORD lpMaxInstances)
|
|---|
| 362 | {
|
|---|
| 363 | dprintf(("KERNEL32: GetNamedPipeInfo(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented\n",
|
|---|
| 364 | hNamedPipe,
|
|---|
| 365 | lpFlags,
|
|---|
| 366 | lpOutBufferSize,
|
|---|
| 367 | lpInBufferSize,
|
|---|
| 368 | lpMaxInstances));
|
|---|
| 369 |
|
|---|
| 370 | return (FALSE);
|
|---|
| 371 | }
|
|---|
| 372 |
|
|---|
| 373 | /*****************************************************************************
|
|---|
| 374 | * Name : BOOL SetNamedPipeHandleState
|
|---|
| 375 | * Purpose : The SetNamedPipeHandleState function sets the read mode and the
|
|---|
| 376 | * blocking mode of the specified named pipe. If the specified handle
|
|---|
| 377 | * is to the client end of a named pipe and if the named pipe server
|
|---|
| 378 | * process is on a remote computer, the function can also be used to
|
|---|
| 379 | * control local buffering.
|
|---|
| 380 | * Parameters: HANDLE hNamedPipe handle of named pipe
|
|---|
| 381 | * LPDWORD lpdwMode address of new pipe mode
|
|---|
| 382 | * LPDWORD lpcbMaxCollect address of max. bytes before remote transmission
|
|---|
| 383 | * LPDWORD lpdwCollectDataTimeout address of max. time before remote transmission
|
|---|
| 384 | * Variables :
|
|---|
| 385 | * Result : TRUE / FALSE
|
|---|
| 386 | * Remark :
|
|---|
| 387 | * Status : UNTESTED STUB
|
|---|
| 388 | *
|
|---|
| 389 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
|---|
| 390 | *****************************************************************************/
|
|---|
| 391 |
|
|---|
| 392 | BOOL WIN32API SetNamedPipeHandleState(HANDLE hNamedPipe,
|
|---|
| 393 | LPDWORD lpdwMode,
|
|---|
| 394 | LPDWORD lpcbMaxCollect,
|
|---|
| 395 | LPDWORD lpdwCollectDataTimeout)
|
|---|
| 396 | {
|
|---|
| 397 | dprintf(("KERNEL32: SetNamedPipeHandleState(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
|---|
| 398 | hNamedPipe,
|
|---|
| 399 | lpdwMode,
|
|---|
| 400 | lpcbMaxCollect,
|
|---|
| 401 | lpdwCollectDataTimeout));
|
|---|
| 402 |
|
|---|
| 403 | return (FALSE);
|
|---|
| 404 | }
|
|---|
| 405 |
|
|---|
| 406 | /*****************************************************************************
|
|---|
| 407 | * Name : DWORD TransactNamedPipe
|
|---|
| 408 | * Purpose : The TransactNamedPipe function combines into a single network
|
|---|
| 409 | * operation the functions that write a message to and read a
|
|---|
| 410 | * message from the specified named pipe.
|
|---|
| 411 | * Parameters: HANDLE hNamedPipe handle of named pipe
|
|---|
| 412 | * LPVOID lpvWriteBuf address of write buffer
|
|---|
| 413 | * DWORD cbWriteBuf size of the write buffer, in bytes
|
|---|
| 414 | * LPVOID lpvReadBuf address of read buffer
|
|---|
| 415 | * DWORD cbReadBuf size of read buffer, in bytes
|
|---|
| 416 | * LPDWORD lpcbRead address of variable for bytes actually read
|
|---|
| 417 | * LPOVERLAPPED lpo address of overlapped structure
|
|---|
| 418 | * Variables :
|
|---|
| 419 | * Result : TRUE / FALSE
|
|---|
| 420 | * Remark :
|
|---|
| 421 | * Status : NOT FULLY TESTED (YET!)
|
|---|
| 422 | *
|
|---|
| 423 | * Author : Przemyslaw Dobrowolski [Mon, 2000/01/03 08:48]
|
|---|
| 424 | *****************************************************************************/
|
|---|
| 425 |
|
|---|
| 426 | ODINFUNCTION7(DWORD,TransactNamedPipe,HANDLE,hNamedPipe,
|
|---|
| 427 | LPVOID,lpvWriteBuf,
|
|---|
| 428 | DWORD,cbWriteBuf,
|
|---|
| 429 | LPVOID,lpvReadBuf,
|
|---|
| 430 | DWORD,cbReadBuf,
|
|---|
| 431 | LPDWORD,lpcbRead,
|
|---|
| 432 | LPOVERLAPPED,lpo)
|
|---|
| 433 | {
|
|---|
| 434 | return(OSLibDosTransactNamedPipe( hNamedPipe,
|
|---|
| 435 | lpvWriteBuf,
|
|---|
| 436 | cbWriteBuf,
|
|---|
| 437 | lpvReadBuf,
|
|---|
| 438 | cbReadBuf,
|
|---|
| 439 | lpcbRead,
|
|---|
| 440 | lpo));
|
|---|
| 441 |
|
|---|
| 442 | }
|
|---|
| 443 |
|
|---|
| 444 | /*****************************************************************************
|
|---|
| 445 | * Name : BOOL WaitNamedPipeA
|
|---|
| 446 | * Purpose : The WaitNamedPipe function waits until either a time-out interval
|
|---|
| 447 | * elapses or an instance of the specified named pipe is available
|
|---|
| 448 | * to be connected to (that is, the pipe's server process has a
|
|---|
| 449 | * pending ConnectNamedPipe operation on the pipe).
|
|---|
| 450 | * Parameters: LPCTSTR lpszNamedPipeName
|
|---|
| 451 | * DWORD dwTimeout
|
|---|
| 452 | * Variables :
|
|---|
| 453 | * Result : TRUE / FALSE
|
|---|
| 454 | * Remark :
|
|---|
| 455 | * Status : UNTESTED (YET)
|
|---|
| 456 | *
|
|---|
| 457 | * Author : Przemyslaw Dobrowolski [Mon, 2000/01/03 13:52]
|
|---|
| 458 | *****************************************************************************/
|
|---|
| 459 |
|
|---|
| 460 | ODINFUNCTION2(BOOL,WaitNamedPipeA,LPCSTR,lpszNamedPipeName, DWORD, dwTimeout)
|
|---|
| 461 | {
|
|---|
| 462 | return(OSLibDosWaitNamedPipe(lpszNamedPipeName, dwTimeout));
|
|---|
| 463 | }
|
|---|
| 464 |
|
|---|
| 465 |
|
|---|
| 466 | /*****************************************************************************
|
|---|
| 467 | * Name : BOOL WaitNamedPipeW
|
|---|
| 468 | * Purpose : The WaitNamedPipe function waits until either a time-out interval
|
|---|
| 469 | * elapses or an instance of the specified named pipe is available
|
|---|
| 470 | * to be connected to (that is, the pipe's server process has a
|
|---|
| 471 | * pending ConnectNamedPipe operation on the pipe).
|
|---|
| 472 | * Parameters: LPCWSTR lpszNamedPipeName
|
|---|
| 473 | * DWORD dwTimeout
|
|---|
| 474 | * Variables :
|
|---|
| 475 | * Result : TRUE / FALSE
|
|---|
| 476 | * Remark :
|
|---|
| 477 | * Status : UNTESTED (YET)
|
|---|
| 478 | *
|
|---|
| 479 | * Author : Przemyslaw Dobrowolski [Mon, 2000/01/03 13:44]
|
|---|
| 480 | *****************************************************************************/
|
|---|
| 481 |
|
|---|
| 482 | ODINFUNCTION2(BOOL,WaitNamedPipeW,LPCWSTR,lpszNamedPipeName, DWORD, dwTimeout)
|
|---|
| 483 | {
|
|---|
| 484 | char *asciiname;
|
|---|
| 485 | DWORD rc;
|
|---|
| 486 |
|
|---|
| 487 | asciiname = UnicodeToAsciiString((LPWSTR)lpszNamedPipeName);
|
|---|
| 488 |
|
|---|
| 489 | rc=OSLibDosWaitNamedPipe(asciiname, dwTimeout);
|
|---|
| 490 |
|
|---|
| 491 | FreeAsciiString(asciiname);
|
|---|
| 492 |
|
|---|
| 493 | return(rc);
|
|---|
| 494 | }
|
|---|