Jump to content

DosTransactNmPipe: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
 
(3 intermediate revisions by 2 users not shown)
Line 5: Line 5:


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


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


==Remarks==
==Remarks==
Line 27: Line 26:
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.  
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.  


==Example Code==
==Binding==
=== C Binding===
===C===
<PRE>
<PRE>
#define INCL_DOSNMPIPES
#define INCL_DOSNMPIPES
Line 35: Line 34:
                                 OutBufferLen, BytesOut);
                                 OutBufferLen, BytesOut);


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


USHORT           rc;            /* return code */
USHORT rc;            /* return code */
</PRE>
</PRE>


===MASM Binding===
===MASM===
<PRE>
<PRE>
EXTRN  DosTransactNmPipe:FAR
EXTRN  DosTransactNmPipe:FAR
Line 61: Line 60:
</PRE>
</PRE>


==Related Functions==
[[Category:Dos16]]
*
 
[[Category:Dos]]

Latest revision as of 15:25, 15 October 2023

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