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