Jump to content

VioGlobalReg: Difference between revisions

From EDM2
Created page with "==Description== VioGlobalReg allows a subsystem to receive notification at the completion of VIO calls issued by all applications running in full-screen sessions. ==Syntax==..."
 
Ak120 (talk | contribs)
mNo edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Description==
VioGlobalReg allows a subsystem to receive notification at the completion of VIO calls issued by all applications running in full-screen sessions.
VioGlobalReg allows a subsystem to receive notification at the completion of VIO calls issued by all applications running in full-screen sessions.  


==Syntax==
==Syntax==
<PRE>
  VioGlobalReg (ModuleName, EntryPoint, FunctionMask1, FunctionMask2, 0)
  VioGlobalReg


    (ModuleName, EntryPoint, FunctionMask1, FunctionMask2, 0)
</PRE>
==Parameters==
==Parameters==
; ModuleName (PSZ) - input : Address of the ASCIIZ string containing the 1-8 character file name of the subsystem. The maximum length of the ASCIIZ string is 9 bytes including the terminating byte of zero. The module must be a dynamic link library but the name supplied must not include the .DLL extension.  
;ModuleName ([[PSZ]]) - input: Address of the ASCIIZ string containing the 1-8 character file name of the subsystem. The maximum length of the ASCIIZ string is 9 bytes including the terminating byte of zero. The module must be a dynamic link library but the name supplied must not include the .DLL extension.
 
;EntryPoint (PSZ) - input: Address of the ASCIIZ name string containing the dynamic link entry point name of the routine in the subsystem to receive control when any of the registered functions is called. The maximum length of the ASCIIZ string is 33 bytes including the terminating byte of zero.
; EntryPoint (PSZ) - input : Address of the ASCIIZ name string containing the dynamic link entry point name of the routine in the subsystem to receive control when any of the registered functions is called. The maximum length of the ASCIIZ string is 33 bytes including the terminating byte of zero.  
;FunctionMask1 ([[ULONG]]) - input: A bit mask where each bit identifies a video function being registered. The bit definitions are shown below. The first word pushed onto the stack contains the high-order 16 bits of the function mask, and the second word contains the low-order 16 bits.
 
:{|class="wikitable"
; FunctionMask1 (ULONG) - input : A bit mask where each bit identifies a video function being registered. The bit definitions are shown below. The first word pushed onto the stack contains the high-order 16 bits of the function mask, and the second word contains the low-order 16 bits.
!BIT||REGISTERED FUNCTION||BIT||REGISTERED FUNCTION
 
|-
      BIT   REGISTERED FUNCTION         BIT   REGISTERED FUNCTION
|31||VioPrtScToggle||15||VioWrtCharStr
    ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|-
      31   VioPrtScToggle             15   VioWrtCharStr
|30||VioEndPopUp||14||VioWrtTTY
      30   VioEndPopUp                 14   VioWrtTTY
|-
      29   VioPopUp                   13   VioWrtNCell
|29||VioPopUp||13||VioWrtNCell
      28   VioSavRedrawUndo           12   VioWrtNAttr
|-
      27   VioSavRedrawWait           11   VioWrtNChar
|28||VioSavRedrawUndo||12||VioWrtNAttr
      26   VioScrUnLock               10   VioReadCellStr
|-
      25   VioScrLock                 9     VioReadCharStr
|27||VioSavRedrawWait||11||VioWrtNChar
      24   VioPrtSc                   8     VioShowBuf
|-
      23   VioGetAnsi                 7     VioSetMode
|26||VioScrUnLock||10||VioReadCellStr
      22   VioSetAnsi                 6     VioSetCurType
|-
      21   VioScrollRt                 5     VioSetCurPos
|25||VioScrLock||9||VioReadCharStr
      20   VioScrollLf                 4     VioGetPhysBuf
|-
      19   VioScrollDn                 3     VioGetBuf
|24||VioPrtSc||8||VioShowBuf
      18   VioScrollUp                 2     VioGetMode
|-
      17   VioWrtCellStr               1     VioGetCurType
|23||VioGetAnsi||7||VioSetMode
      16   VioWrtCharStrAtt           0     VioGetCurPos
|-
 
|22||VioSetAnsi||6||VioSetCurType
; FunctionMask2 (ULONG) - input : A bit mask where each bit identifies a video function being registered. The bit mask has the format shown below. The first word pushed onto the stack contains the high order 16 bits of the function mask, and the second word contains the low order 16 bits. Unused bits are reserved and must be set to zero.
|-
 
|21||VioScrollRt||5||VioSetCurPos
'''Bit        Registered Function'''
|-
  31-11   Reserved, must be set to zero.  
|20||VioScrollLf||4||VioGetPhysBuf
  10       VioDeRegister  
|-
  9       VioRegister  
|19||VioScrollDn||3||VioGetBuf
  8       VioSetState  
|-
  7       VioGetState  
|18||VioScrollUp||2||VioGetMode
  6       VioSetFont  
|-
  5       VioGetCp  
|17||VioWrtCellStr||1||VioGetCurType
  4       VioSetCp  
|-
  3       VioGetConfig  
|16||VioWrtCharStrAtt||0||VioGetCurPos
  2       VioGetFont  
|}
  1       VioModeUndo  
;FunctionMask2 (ULONG) - input: A bit mask where each bit identifies a video function being registered. The bit mask has the format shown below. The first word pushed onto the stack contains the high order 16 bits of the function mask, and the second word contains the low order 16 bits. Unused bits are reserved and must be set to zero.
  0       VioModeWait  
:{|
|
  31-11 Reserved, must be set to zero.
  10   VioDeRegister
  9     VioRegister
  8     VioSetState
  7     VioGetState
  6     VioSetFont
  5     VioGetCp
  4     VioSetCp
  3     VioGetConfig
  2     VioGetFont
  1     VioModeUndo
  0     VioModeWait
|}
;Reserved (LONG) - input: Reserved and must be zero.


; Reserved (LONG) - input : Reserved and must be zero.
==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code descriptions are:
 
*0 NO_ERROR
    Return code descriptions are:
*349 ERROR_VIO_INVALID_MASK
 
*403 ERROR_VIO_INVALID_ASCIIZ
* 0         NO_ERROR  
*426 ERROR_VIO_REGISTER
* 349       ERROR_VIO_INVALID_MASK  
*494 ERROR_VIO_EXTENDED_SG
* 403       ERROR_VIO_INVALID_ASCIIZ  
* 426       ERROR_VIO_REGISTER  
* 494       ERROR_VIO_EXTENDED_SG


==Remarks==
==Remarks==
Notification of VIO calls issued within the hard error handler and DOS (real mode) sessions is not provided.
Notification of VIO calls issued within the hard error handler and DOS (real mode) sessions is not provided.


When control is routed to EntryPoint, the stack appears as it did after the original VIO call except that four additional values have been pushed onto the stack. The first is the index number (WORD) of the routine called. The second is a near pointer (WORD). The third is the caller's DS register (WORD). The fourth is the return address (DWORD) to the VIO router.
When control is routed to EntryPoint, the stack appears as it did after the original VIO call except that four additional values have been pushed onto the stack. The first is the index number (WORD) of the routine called. The second is a near pointer (WORD). The third is the caller's DS register (WORD). The fourth is the return address (DWORD) to the VIO router.


For example, if VioSetCurPos were a registered function, the stack would appear as if the following instruction sequence were executed if VioSetCurPos were called and control routed to EntryPoint:
For example, if [[VioSetCurPos]] were a registered function, the stack would appear as if the following instruction sequence were executed if VioSetCurPos were called and control routed to EntryPoint:
 
  PUSH    WORD    Row
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
  PUSH    WORD    Column
  ³ PUSH    WORD    Row                                 ³
  PUSH    WORD    VioHandle
  ³ PUSH    WORD    Column                             ³
  CALL    FAR      VioSetCurPos
  ³ PUSH    WORD    VioHandle                           ³
  PUSH    WORD    Index
  ³ CALL    FAR      VioSetCurPos                       ³
  CALL    NEAR    Entry point in Vio router
  ³ PUSH    WORD    Index                               ³
  PUSH    WORD    Caller's DS
  ³ CALL    NEAR    Entry point in Vio router           ³
  CALL    FAR      Dynamic link entry point
  ³ PUSH    WORD    Caller's DS                         ³
  ³ CALL    FAR      Dynamic link entry point           ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
 
The index numbers that correspond to the registered functions are listed below:
The index numbers that correspond to the registered functions are listed below:
<PRE>
<PRE>
VioGetPhysBuf
VioGetPhysBuf   22 VioSetAnsi       1
 
VioGetBuf       23 VioGetAnsi       2
    22 VioSetAnsi  
VioShowBuf       24 VioPrtSc         3
 
VioGetCurPos    25 VioScrLock       4
1 VioGetBuf
VioGetCurType   26 VioScrUnLock     5
 
VioGetMode       27 VioSavRedrawWait 6
    23 VioGetAnsi  
VioSetCurPos    28 VioSavRedrawUndo 7
 
VioSetCurType   29 VioPopUp         8
2 VioShowBuf
VioSetMode       30 VioEndPopUp     9
 
VioReadCharStr   31 VioPrtScToggle 10
    24 VioPrtSc  
VioReadCellStr   32 VioModeWait     11
 
VioWrtNChar     33 VioModeUndo     12
3 VioGetCurPos
VioWrtNAttr     34 VioGetFont     13
 
VioWrtNCell     35 VioGetConfig   14
     25 VioScrLock  
VioWrtCharStr   36 VioSetCp       15
 
VioWrtCharStrAtt 37 VioGetCp       16
4 VioGetCurType
VioWrtCellStr   38 VioSetFont     17
 
VioWrtTTY       39 VioGetState     18
    26 VioScrUnLock  
VioScrollUp     40 VioSetState     19
 
VioScrollDn     41 VioRegister     20
5 VioGetMode
VioScrollLf     42 VioDeRegister   21
 
VioScrollRt     43
    27 VioSavRedrawWait  
 
6 VioSetCurPos
 
     28 VioSavRedrawUndo  
 
7 VioSetCurType
 
    29 VioPopUp  
 
8 VioSetMode
 
    30 VioEndPopUp  
 
9 VioReadCharStr
 
    31 VioPrtScToggle  
 
10 VioReadCellStr
 
    32 VioModeWait  
 
11 VioWrtNChar
 
    33 VioModeUndo  
 
12 VioWrtNAttr
 
    34 VioGetFont  
 
13 VioWrtNCell
 
    35 VioGetConfig  
 
14 VioWrtCharStr
 
    36 VioSetCp  
 
15 VioWrtCharStrAtt
 
    37 VioGetCp  
 
16 VioWrtCellStr
 
    38 VioSetFont  
 
17 VioWrtTTY
 
    39 VioGetState  
 
18 VioScrollUp
 
    40 VioSetState  
 
19 VioScrollDn
 
    41 VioRegister  
 
20 VioScrollLf
 
    42 VioDeRegister  
 
21 VioScrollRt
</PRE>
</PRE>
On entry to the global subsystem, AX contains the return code that is returned to the application that issued the VIO call. The global subsystem must return with all stack parameters and all general purpose registers, including AX, restored to the same values as on entry.
On entry to the global subsystem, AX contains the return code that is returned to the application that issued the VIO call. The global subsystem must return with all stack parameters and all general purpose registers, including AX, restored to the same values as on entry.
Line 176: Line 116:
If multiple global subsystems are registered, they are given control in the order that they are registered.
If multiple global subsystems are registered, they are given control in the order that they are registered.


A globally registered subsystem receives control on VIO calls issued from all full-screen sessions except the hard error handler and DOS (real mode) sessions.  
A globally registered subsystem receives control on VIO calls issued from all full-screen sessions except the hard error handler and DOS (real mode) sessions.


==Example Code==
==Bindings==
 
===C===
===C Binding===
<PRE>
<PRE>
#define INCL_VIO
#define INCL_VIO
Line 187: Line 126:
                           FunctionMask2, 0);
                           FunctionMask2, 0);


PSZ         ModuleName;       /* Module name  */
PSZ     ModuleName;   /* Module name  */
PSZ         EntryPoint;       /* Entry point name */
PSZ     EntryPoint;   /* Entry point name */
ULONG       FunctionMask1;     /* Function mask 1  */
ULONG   FunctionMask1; /* Function mask 1  */
ULONG       FunctionMask2;     /* Function mask 2  */
ULONG   FunctionMask2; /* Function mask 2  */
LONG         0;                 /* Reserved (must be zero) */
LONG   0;             /* Reserved (must be zero) */


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


=== MASM Binding===
===MASM===
<PRE>
<PRE>
EXTRN VioGlobalReg:FAR
EXTRN VioGlobalReg:FAR
Line 211: Line 150:
</PRE>
</PRE>


==Related Functions==
[[Category:Vio]]
*
 
 
[[Category:The OS/2 API Project]]

Latest revision as of 22:20, 1 January 2020

VioGlobalReg allows a subsystem to receive notification at the completion of VIO calls issued by all applications running in full-screen sessions.

Syntax

VioGlobalReg (ModuleName, EntryPoint, FunctionMask1, FunctionMask2, 0)

Parameters

ModuleName (PSZ) - input
Address of the ASCIIZ string containing the 1-8 character file name of the subsystem. The maximum length of the ASCIIZ string is 9 bytes including the terminating byte of zero. The module must be a dynamic link library but the name supplied must not include the .DLL extension.
EntryPoint (PSZ) - input
Address of the ASCIIZ name string containing the dynamic link entry point name of the routine in the subsystem to receive control when any of the registered functions is called. The maximum length of the ASCIIZ string is 33 bytes including the terminating byte of zero.
FunctionMask1 (ULONG) - input
A bit mask where each bit identifies a video function being registered. The bit definitions are shown below. The first word pushed onto the stack contains the high-order 16 bits of the function mask, and the second word contains the low-order 16 bits.
BIT REGISTERED FUNCTION BIT REGISTERED FUNCTION
31 VioPrtScToggle 15 VioWrtCharStr
30 VioEndPopUp 14 VioWrtTTY
29 VioPopUp 13 VioWrtNCell
28 VioSavRedrawUndo 12 VioWrtNAttr
27 VioSavRedrawWait 11 VioWrtNChar
26 VioScrUnLock 10 VioReadCellStr
25 VioScrLock 9 VioReadCharStr
24 VioPrtSc 8 VioShowBuf
23 VioGetAnsi 7 VioSetMode
22 VioSetAnsi 6 VioSetCurType
21 VioScrollRt 5 VioSetCurPos
20 VioScrollLf 4 VioGetPhysBuf
19 VioScrollDn 3 VioGetBuf
18 VioScrollUp 2 VioGetMode
17 VioWrtCellStr 1 VioGetCurType
16 VioWrtCharStrAtt 0 VioGetCurPos
FunctionMask2 (ULONG) - input
A bit mask where each bit identifies a video function being registered. The bit mask has the format shown below. The first word pushed onto the stack contains the high order 16 bits of the function mask, and the second word contains the low order 16 bits. Unused bits are reserved and must be set to zero.
31-11 Reserved, must be set to zero.
10    VioDeRegister
9     VioRegister
8     VioSetState
7     VioGetState
6     VioSetFont
5     VioGetCp
4     VioSetCp
3     VioGetConfig
2     VioGetFont
1     VioModeUndo
0     VioModeWait
Reserved (LONG) - input
Reserved and must be zero.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 349 ERROR_VIO_INVALID_MASK
  • 403 ERROR_VIO_INVALID_ASCIIZ
  • 426 ERROR_VIO_REGISTER
  • 494 ERROR_VIO_EXTENDED_SG

Remarks

Notification of VIO calls issued within the hard error handler and DOS (real mode) sessions is not provided.

When control is routed to EntryPoint, the stack appears as it did after the original VIO call except that four additional values have been pushed onto the stack. The first is the index number (WORD) of the routine called. The second is a near pointer (WORD). The third is the caller's DS register (WORD). The fourth is the return address (DWORD) to the VIO router.

For example, if VioSetCurPos were a registered function, the stack would appear as if the following instruction sequence were executed if VioSetCurPos were called and control routed to EntryPoint:

PUSH     WORD     Row
PUSH     WORD     Column
PUSH     WORD     VioHandle
CALL     FAR      VioSetCurPos
PUSH     WORD     Index
CALL     NEAR     Entry point in Vio router
PUSH     WORD     Caller's DS
CALL     FAR      Dynamic link entry point

The index numbers that correspond to the registered functions are listed below:

 VioGetPhysBuf    22 VioSetAnsi       1
 VioGetBuf        23 VioGetAnsi       2
 VioShowBuf       24 VioPrtSc         3
 VioGetCurPos     25 VioScrLock       4
 VioGetCurType    26 VioScrUnLock     5
 VioGetMode       27 VioSavRedrawWait 6
 VioSetCurPos     28 VioSavRedrawUndo 7
 VioSetCurType    29 VioPopUp         8
 VioSetMode       30 VioEndPopUp      9
 VioReadCharStr   31 VioPrtScToggle  10
 VioReadCellStr   32 VioModeWait     11
 VioWrtNChar      33 VioModeUndo     12
 VioWrtNAttr      34 VioGetFont      13
 VioWrtNCell      35 VioGetConfig    14
 VioWrtCharStr    36 VioSetCp        15
 VioWrtCharStrAtt 37 VioGetCp        16
 VioWrtCellStr    38 VioSetFont      17
 VioWrtTTY        39 VioGetState     18
 VioScrollUp      40 VioSetState     19
 VioScrollDn      41 VioRegister     20
 VioScrollLf      42 VioDeRegister   21
 VioScrollRt      43

On entry to the global subsystem, AX contains the return code that is returned to the application that issued the VIO call. The global subsystem must return with all stack parameters and all general purpose registers, including AX, restored to the same values as on entry.

All VIO functions within a session are serialized on a thread basis. That is, when a global subsystem receives control, it can safely assume that it is not called again from the same session until the current call has completed. Note, however, that VIO calls across different sessions are not serialized.

VioGlobalReg may only be issued during system initialization. After system initialization, VioGlobalReg returns ERROR_VIO_REGISTER. A globally registered subsystem is active for the life of the system.

If multiple global subsystems are registered, they are given control in the order that they are registered.

A globally registered subsystem receives control on VIO calls issued from all full-screen sessions except the hard error handler and DOS (real mode) sessions.

Bindings

C

#define INCL_VIO

USHORT  rc = VioGlobalReg(ModuleName, EntryPoint, FunctionMask1,
                           FunctionMask2, 0);

PSZ     ModuleName;    /* Module name  */
PSZ     EntryPoint;    /* Entry point name */
ULONG   FunctionMask1; /* Function mask 1  */
ULONG   FunctionMask2; /* Function mask 2  */
LONG    0;             /* Reserved (must be zero) */

USHORT  rc;            /* return code */

MASM

EXTRN VioGlobalReg:FAR
INCL_VIO            EQU 1

PUSH@ ASCIIZ ModuleName      ;Module name
PUSH@ ASCIIZ EntryPoint      ;Entry point name
PUSH  DWORD  FunctionMask1   ;Function mask 1
PUSH  DWORD  FunctionMask2   ;Function mask 2
PUSH  DWORD  0               ;Reserved (must be zero)
CALL  VioGlobalReg

Returns WORD