Jump to content

DevHelp Register: Difference between revisions

From EDM2
m Martini moved page DevHlp Register to DevHelp Register over redirect: Revert
 
Line 26: Line 26:
==Parameters==
==Parameters==
===C===
===C===
; MonitorHandle (USHORT)       : input - from MonCreate
;''MonitorHandle'' ([[USHORT]]) - input: From MonCreate
;MonitorPID (USHORT)           : input - Process Id retrieved by way of GetDosvar
;''MonitorPID'' (USHORT) - input: Process Id retrieved by way of GetDosvar
;InputBuffer (PBYTE)           : input - Far pointer to Mon in buffer
;''InputBuffer'' ([[PBYTE]]) - input: Far pointer to Mon in buffer
;OutputBuffer (NPBYTE)         : input - Near pointer to Mon out buffer
;''OutputBuffer'' (NPBYTE) - input: Near pointer to Mon out buffer
;ChainFlag (USHORT)           : input - Chain placement (high or low in chain)
;''ChainFlag'' (USHORT) - input: Chain placement (high or low in chain)


===Assembler===
===Assembler===

Latest revision as of 03:55, 23 May 2025

This service adds a monitor to the chain of monitors for a class of device.

Syntax

C

USHORT APIENTRY DevHelp_Register(USHORT  MonitorHandle,
                                 USHORT  MonitorPID,
                                 PBYTE   InputBuffer,
                                 NPBYTE  OutputBuffer,
                                 USHORT  ChainFlag);

Assembler

LES   SI,input_buffer          ; Address of input buffer
MOV   DI,output_buffer_offset  ; Offset of output buffer
MOV   CX,monitor_PID           ; Process ID of monitor task
MOV   AX,monitor_handle        ; Handle for chain returned from previous
                                    MonitorCreate call
MOV   DH,placement_flag        ; High or Low place in chain
MOV   DL,DevHlp_Register

CALL  [Device_Help]

Parameters

C

MonitorHandle (USHORT) - input
From MonCreate
MonitorPID (USHORT) - input
Process Id retrieved by way of GetDosvar
InputBuffer (PBYTE) - input
Far pointer to Mon in buffer
OutputBuffer (NPBYTE) - input
Near pointer to Mon out buffer
ChainFlag (USHORT) - input
Chain placement (high or low in chain)

Assembler

LES   SI,input_buffer          ; Address of input buffer
MOV   DI,output_buffer_offset  ; Offset of output buffer
MOV   CX,monitor_PID           ; Process ID of monitor task
MOV   AX,monitor_handle        ; Handle for chain returned from previous
                                    MonitorCreate call
MOV   DH,placement_flag        ; High or Low place in chain

Return Code

C

Success indicator: 0

Possible errors:

              ERROR_MON_INVALID_HANDLE (381)
              ERROR_NOT_ENOUGH_MEMORY  (8)
              ERROR_MON_INVALID_PARMS  (379)

Assembler

   'C' Clear if successful.

   'C' Set if error.
       AX = Error code.
            Possible errors:
               ERROR_MON_INVALID_HANDLE    (381)
               ERROR_INVALID_PARAMETER     (87)
               ERROR_NOT_ENOUGH_MEMORY     (8)

Remarks

This function can be called only at task time in the OS/2 mode. If this function is called in a DOS session context, an invalid parameter error is returned to the physical device driver.

A monitor chain must have previously been created with MonitorCreate. A single process can register more than one monitor (with different input and output buffers) with the same monitor chain. The first WORD of each of the input and output buffers must contain the length in bytes (length WORD inclusive) of the buffers. The length of the input and output buffers of the monitor must be greater than the length of the monitor chain buffer of the physical device driver plus 20 bytes. The input buffer, output buffer offset, and placement flag are supplied to the physical device driver by the monitor application that is requesting monitor registration (that is, calling DosMonReg).

The physical device driver must identify the monitor chain with the monitor handle returned from a previous MonitorCreate call. The physical device driver can determine the Process ID of the requesting monitor task from the Local InfoSeg. See GetDOSVar.

Example Code

C

#include  "dhcalls.h"
#define   CHAIN_AT_TOP    0
#define   CHAIN_AT_BOTTOM 1

USHORT APIENTRY DevHelp_Register(USHORT  MonitorHandle,
                                 USHORT  MonitorPID,
                                 PBYTE   InputBuffer,
                                 NPBYTE  OutputBuffer,
                                 USHORT  ChainFlag);