Jump to content

DosMonReg: Difference between revisions

From EDM2
No edit summary
Ak120 (talk | contribs)
mNo edit summary
Line 2: Line 2:


==Syntax==
==Syntax==
  DosMonReg (Handle, BufferI, BufferO, Posflag, Index)  
  DosMonReg (Handle, BufferI, BufferO, Posflag, Index)


==Parameters==
==Parameters==
; Handle (HMONITOR) - input : Device handle returned from a previous DosMonOpen call.  
;Handle ([[HMONITOR]]) - input: Device handle returned from a previous [[DosMonOpen]] call.
; BufferI (PBYTE) - input : Address of the monitor's input buffer. The monitor dispatcher moves data records into this buffer from the device driver (if the monitor is the first monitor in the monitor chain) or from the previous monitor, if any, in the monitor chain. The monitor takes data from this buffer for filtering by calling DosMonRead.
;BufferI (PBYTE) - input: Address of the monitor's input buffer. The monitor dispatcher moves data records into this buffer from the device driver (if the monitor is the first monitor in the monitor chain) or from the previous monitor, if any, in the monitor chain. The monitor takes data from this buffer for filtering by calling DosMonRead.
; BufferO (PBYTE) - input : Address of the monitor's output buffer. The monitor places filtered data into this buffer by calling DosMonWrite. The monitor dispatcher moves data records from this buffer to the device driver (if the monitor is the last monitor in the monitor chain) or to the next monitor, if any, in the monitor chain.
;BufferO (PBYTE) - input: Address of the monitor's output buffer. The monitor places filtered data into this buffer by calling [[DosMonWrite]]. The monitor dispatcher moves data records from this buffer to the device driver (if the monitor is the last monitor in the monitor chain) or to the next monitor, if any, in the monitor chain.
; Posflag (USHORT) - input : Used to specify the placement of a monitor's buffers with the monitor chain (FIRST, LAST or DEFAULT) and whether one or two threads are created by the monitor dispatcher to handle data movement.
;Posflag (USHORT) - input: Used to specify the placement of a monitor's buffers with the monitor chain (FIRST, LAST or DEFAULT) and whether one or two threads are created by the monitor dispatcher to handle data movement.
::0 - DEFAULT (no position preference) and one thread for data movement.
::0 - DEFAULT (no position preference) and one thread for data movement.
::1 - FIRST (monitor placed at beginning of monitor chain) and one thread for data movement.
::1 - FIRST (monitor placed at beginning of monitor chain) and one thread for data movement.
Line 16: Line 16:
::5 - LAST with two threads for data movement.
::5 - LAST with two threads for data movement.
:The first monitor in a monitor chain that registers as FIRST is placed at the head of the monitor chain. The next monitor that registers as FIRST follows the last monitor registered as FIRST, and so on. Similarly, the first monitor that registers as LAST is placed at the end of the monitor chain. The next monitor that registers as LAST is placed before the last monitor that registered as LAST, and so on. The first monitor that registers as DEFAULT is placed before the last monitor, if any, that registered as LAST. The next monitor that registers as DEFAULT is placed before the last monitor that registered as DEFAULT, and so on.  
:The first monitor in a monitor chain that registers as FIRST is placed at the head of the monitor chain. The next monitor that registers as FIRST follows the last monitor registered as FIRST, and so on. Similarly, the first monitor that registers as LAST is placed at the end of the monitor chain. The next monitor that registers as LAST is placed before the last monitor that registered as LAST, and so on. The first monitor that registers as DEFAULT is placed before the last monitor, if any, that registered as LAST. The next monitor that registers as DEFAULT is placed before the last monitor that registered as DEFAULT, and so on.  
; Index (USHORT) - input : Device specific value. For the keyboard it pertains to the session you wish to register a monitor on. For the printer it pertains to the data or code page monitor chain.
;Index (USHORT) - input: Device specific value. For the keyboard it pertains to the session you wish to register a monitor on. For the printer it pertains to the data or code page monitor chain.


==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code descriptions are:
 
* 0 - NO_ERROR
Return code descriptions are:
* 8 - ERROR_NOT_ENOUGH_MEMORY
* 0 - NO_ERROR  
*165 - ERROR_MONITORS_NOT_SUPPORTED
* 8 - ERROR_NOT_ENOUGH_MEMORY  
*379 - ERROR_MON_INVALID_PARMS
* 165 - ERROR_MONITORS_NOT_SUPPORTED  
*381 - ERROR_MON_INVALID_HANDLE
* 379 - ERROR_MON_INVALID_PARMS  
*382 - ERROR_MON_BUFFER_TOO_SMALL
* 381 - ERROR_MON_INVALID_HANDLE  
* 382 - ERROR_MON_BUFFER_TOO_SMALL


==Remarks==
==Remarks==
For a detailed description of this call see the chapter "Character Device Monitors" in the IBM Operating System/2 Version 1.2 I/O Subsystems And Device Support Volume 1.  
For a detailed description of this call see the chapter "Character Device Monitors" in the ''IBM Operating System/2 Version 1.2 I/O Subsystems And Device Support Volume 1''.
 
==Example Code==
=== C Binding===
<PRE>
#define INCL_DOSMONITORS
 
USHORT  rc = DosMonReg(Handle, BufferI, BufferO, Posflag, Index);
 
HMONITOR        Handle;        /* Monitor handle */
PBYTE            BufferI;      /* Input buffer */
PBYTE            BufferO;      /* Output buffer */
USHORT          Posflag;      /* Position flag */
USHORT          Index;        /* Index */
 
USHORT          rc;            /* return code */
</PRE>
 
===MASM Binding===
<PRE>
EXTRN  DosMonReg:FAR
INCL_DOSMONITORS    EQU 1


PUSH   WORD    Handle        ;Monitor handle
==Bindings==
PUSH@ OTHER  BufferI      ;Input buffer
=== C ===
PUSH@ OTHER  BufferO      ;Output buffer
<code>
PUSH   WORD    Posflag      ;Position flag
#define INCL_DOSMONITORS
PUSH   WORD    Index        ;Index
CALL   DosMonReg
USHORT   rc = DosMonReg(Handle, BufferI, BufferO, Posflag, Index);
HMONITOR Handle;       /* Monitor handle */
  PBYTE    BufferI;       /* Input buffer */
  PBYTE    BufferO;       /* Output buffer */
USHORT   Posflag;       /* Position flag */
USHORT   Index;         /* Index */
USHORT   rc;            /* return code */
</code>


Returns WORD
===MASM===
</PRE>
<code>
EXTRN  DosMonReg:FAR
INCL_DOSMONITORS    EQU 1
PUSH  WORD    Handle    ;Monitor handle
PUSH@  OTHER  BufferI    ;Input buffer
PUSH@  OTHER  BufferO    ;Output buffer
PUSH  WORD    Posflag    ;Position flag
PUSH  WORD    Index      ;Index
CALL  DosMonReg
Returns WORD
</code>


[[Category:Dos]]
[[Category:Dos]]

Revision as of 14:17, 25 May 2018

This call establishes an input and output buffer structure to monitor an I/O stream for a character device.

Syntax

DosMonReg (Handle, BufferI, BufferO, Posflag, Index)

Parameters

Handle (HMONITOR) - input
Device handle returned from a previous DosMonOpen call.
BufferI (PBYTE) - input
Address of the monitor's input buffer. The monitor dispatcher moves data records into this buffer from the device driver (if the monitor is the first monitor in the monitor chain) or from the previous monitor, if any, in the monitor chain. The monitor takes data from this buffer for filtering by calling DosMonRead.
BufferO (PBYTE) - input
Address of the monitor's output buffer. The monitor places filtered data into this buffer by calling DosMonWrite. The monitor dispatcher moves data records from this buffer to the device driver (if the monitor is the last monitor in the monitor chain) or to the next monitor, if any, in the monitor chain.
Posflag (USHORT) - input
Used to specify the placement of a monitor's buffers with the monitor chain (FIRST, LAST or DEFAULT) and whether one or two threads are created by the monitor dispatcher to handle data movement.
0 - DEFAULT (no position preference) and one thread for data movement.
1 - FIRST (monitor placed at beginning of monitor chain) and one thread for data movement.
2 - LAST (monitor placed at end of monitor chain) and one thread for data movement.
3 - DEFAULT with two threads for data movement.
4 - FIRST with two threads for data movement.
5 - LAST with two threads for data movement.
The first monitor in a monitor chain that registers as FIRST is placed at the head of the monitor chain. The next monitor that registers as FIRST follows the last monitor registered as FIRST, and so on. Similarly, the first monitor that registers as LAST is placed at the end of the monitor chain. The next monitor that registers as LAST is placed before the last monitor that registered as LAST, and so on. The first monitor that registers as DEFAULT is placed before the last monitor, if any, that registered as LAST. The next monitor that registers as DEFAULT is placed before the last monitor that registered as DEFAULT, and so on.
Index (USHORT) - input
Device specific value. For the keyboard it pertains to the session you wish to register a monitor on. For the printer it pertains to the data or code page monitor chain.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 - NO_ERROR
  • 8 - ERROR_NOT_ENOUGH_MEMORY
  • 165 - ERROR_MONITORS_NOT_SUPPORTED
  • 379 - ERROR_MON_INVALID_PARMS
  • 381 - ERROR_MON_INVALID_HANDLE
  • 382 - ERROR_MON_BUFFER_TOO_SMALL

Remarks

For a detailed description of this call see the chapter "Character Device Monitors" in the IBM Operating System/2 Version 1.2 I/O Subsystems And Device Support Volume 1.

Bindings

C

#define INCL_DOSMONITORS

USHORT   rc = DosMonReg(Handle, BufferI, BufferO, Posflag, Index);
HMONITOR Handle;        /* Monitor handle */
PBYTE    BufferI;       /* Input buffer */
PBYTE    BufferO;       /* Output buffer */
USHORT   Posflag;       /* Position flag */
USHORT   Index;         /* Index */

USHORT   rc;            /* return code */

MASM

EXTRN  DosMonReg:FAR
INCL_DOSMONITORS    EQU 1

PUSH   WORD    Handle     ;Monitor handle
PUSH@  OTHER   BufferI    ;Input buffer
PUSH@  OTHER   BufferO    ;Output buffer
PUSH   WORD    Posflag    ;Position flag
PUSH   WORD    Index      ;Index
CALL   DosMonReg

Returns WORD