DosTransactNmPipe

From EDM2
Jump to: navigation, search

This call performs a write followed by a read on a duplex message pipe.

Syntax

DosTransactNmPipe (Handle, InBuffer, InBufferLen, OutBuffer, OutBufferLen, BytesOut)

Parameters

Handle (HPIPE) - input
Named pipe handle returned by DosMakeNmPipe or DosOpen.
InBuffer (PBYTE) - input
Address of the buffer to write to the pipe.
InBufferLen (USHORT) - input
Number of bytes to be written.
OutBuffer (PBYTE) - output
Address of the buffer for returned data.
OutBufferLen (USHORT) - input
Maximum size, number of bytes, of returned data.
BytesOut (PUSHORT) - output
Address of the number of bytes read.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 11 ERROR_BAD_FORMAT
  • 230 ERROR_BAD_PIPE
  • 231 ERROR_PIPE_BUSY
  • 233 ERROR_PIPE_NOT_CONNECTED
  • 234 ERROR_MORE_DATA

Remarks

DosTransactNmPipe is intended for use only on duplex message pipes. If this call is issued and the pipe is not a duplex message pipe, ERROR_BAD_FORMAT is returned.

This call enables you to implement transaction-oriented dialogs. DosTransactNmPipe writes the entire InBuffer to the pipe and then reads a response from the pipe into the OutBuffer. The current state of blocking/non-blocking has no effect. DosTransactNmPipe does not return until a message has been read into the OutBuffer. If the OutBuffer is too small to contain the response message, ERROR_MORE_DATA is returned, as described for DosRead.

Binding

C

#define INCL_DOSNMPIPES

USHORT  rc = DosTransactNmPipe(Handle, InBuffer, InBufferLen, OutBuffer,
                                OutBufferLen, BytesOut);

HPIPE   Handle;        /* Pipe handle */
PBYTE   InBuffer;      /* Write buffer */
USHORT  InBufferLen;   /* Write buffer length */
PBYTE   OutBuffer;     /* Read buffer (returned) */
USHORT  OutBufferLen;  /* Read buffer length */
PUSHORT BytesOut;      /* Bytes read (returned) */

USHORT  rc;            /* return code */

MASM

EXTRN  DosTransactNmPipe:FAR
INCL_DOSNMPIPES     EQU 1

PUSH   WORD    Handle        ;Pipe handle
PUSH@  OTHER   InBuffer      ;Write buffer
PUSH   WORD    InBufferLen   ;Write buffer length
PUSH@  OTHER   OutBuffer     ;Read buffer (returned)
PUSH   WORD    OutBufferLen  ;Read buffer length
PUSH@  WORD    BytesOut      ;Bytes read (returned)
CALL   DosTransactNmPipe

Returns WORD