Jump to content

DosMonReg

From EDM2
Revision as of 04:56, 26 January 2020 by Ak120 (talk | contribs)

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