home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft_Programmers_Library.7z / MPL / os2 / os2dev.txt < prev    next >
Encoding:
Text File  |  2013-11-08  |  1.6 MB  |  50,465 lines

Text Truncated. Only the first 1MB is shown below. Download the file for the complete contents.
  1.  Microsoft Operating System/2 - Device Driver Reference
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  ────────────────────────────────────────────────────────────────────────────
  11.           Microsoft(R) Operating System/2 - Device Driver Reference
  12.  
  13.                                  Version 1.2
  14.  ────────────────────────────────────────────────────────────────────────────
  15.  
  16.  
  17.  
  18.  
  19.  Information in this document is subject to change without notice and does
  20.  not represent a commitment on the part of Microsoft Corporation. The
  21.  software and/or databases described in this document are furnished under a
  22.  license agreement or nondisclosure agreement. The software and/or databases
  23.  may be used or copied only in accordance with the terms of the
  24.  agreement. The purchaser may make one copy of the software for backup
  25.  purposes. No part of this manual and/or database may be reproduced or
  26.  transmitted in any form or by any means, electronic or mechanical,
  27.  including photocopying, recording, or information storage and retrieval
  28.  systems, for any purpose other than the purchaser's personal use, without
  29.  the written permission of Microsoft Corporation.
  30.  
  31.  
  32.  (C) Copyright Microsoft Corporation, 1990. All rights reserved.
  33.  
  34.  Printed in the United States of America.
  35.  
  36.  
  37.  Patent #4,825,358
  38.  
  39.  Patent #4,779,187
  40.  
  41.  
  42.  Microsoft(R), MS(R), MS-DOS(R), the Microsoft logo, and InPort(R)
  43.  are registered trademarks, and Windows(tm) is a trademark, of Microsoft
  44.  Corporation.
  45.  
  46.  
  47.  SideKick(R) is a registered trademark of Borland International, Inc.
  48.  
  49.  
  50.  IBM(R), PC/AT(R), and PS/2(R) are registered trademarks of
  51.  International Business Machines Corporation.
  52.  
  53.  
  54.  SY10190-1289 OEMO786-1Z
  55.  
  56.  
  57.  
  58.  
  59.  Preface
  60.  
  61.       Notational Conventions
  62.       Other References
  63.  
  64.  Chapter 1  Overview of Base and Installable Device Drivers
  65.  
  66.       1.1   MS OS/2 Device Drivers
  67.       1.2   Device Driver Logical Structure
  68.       1.3   Device Driver Segment Structure
  69.       1.4   Device Driver Executable File Format
  70.       1.5   Device Driver Header
  71.  
  72.  Chapter 2  Device Commands
  73.  
  74.       2.1   Introduction
  75.       2.2   Request Packets
  76.       2.3   MS OS/2 Device Driver Commands
  77.  
  78.  Chapter 3  Device Helper Services
  79.  
  80.       3.1   Device Helper Services
  81.       3.2   Using DevHlp Routines
  82.  
  83.  Chapter 4  Base Video Device Handlers
  84.  
  85.       4.1   Introduction
  86.       4.2   BVH Installation and the DevEnable Function
  87.       4.3   VDH Function Calls
  88.       4.4   LVB Formats
  89.       4.5   VDH Function Reference
  90.  
  91.  Chapter 5  Mouse Device Drivers
  92.  
  93.       5.1   Introduction
  94.       5.2   System-supplied IDC Functions
  95.       5.3   Device-dependent Driver Requirements
  96.       5.4   Mouse IDC Function Reference
  97.  
  98.  Chapter 6  Overview of Presentation Manager Device Drivers
  99.  
  100.       6.1   Introduction
  101.       6.2   Overview
  102.       6.3   The Graphics Engine
  103.       6.4   Presentation Manager Device Drivers
  104.       6.5   Installed Simulations
  105.       6.6   Device Driver Components
  106.  
  107.  Chapter 7  Graphics Functions
  108.  
  109.       7.1   Introduction
  110.       7.2   Function Groups
  111.       7.3   Function Directory
  112.  
  113.  Chapter 8  Spooler Functions
  114.  
  115.       8.1   Introduction
  116.  
  117.  Chapter 9  Types, Macros, Structures
  118.  
  119.       9.1   Introduction
  120.       9.2   Types
  121.       9.3   Macros
  122.       9.4   Structures
  123.  
  124.  Chapter 10  File Formats
  125.  
  126.       10.1  Introduction
  127.       10.2  Font Files
  128.       10.3  Keyboard Translation Tables
  129.       10.4  Resource-File Formats
  130.  
  131.  Chapter 11  MS OS/2 System Debugger
  132.  
  133.       11.1  Introduction
  134.       11.2  Debugger Command Reference
  135.  
  136.  Chapter 12  Assembly-Language Macros
  137.  
  138.       12.1  Introduction
  139.       12.2  Cmacros Reference
  140.  
  141.  Appendix A  A Device Driver Installation
  142.  
  143.       A.1   Introduction
  144.       A.2   Device Driver Profile
  145.  
  146.  Appendix B  B Setting Up the System Debugger
  147.  
  148.       B.1   Introduction
  149.       B.2   Symbol Files
  150.  
  151.  Appendix C  C Dos Functions for Installable Device Drivers
  152.  
  153.       C.1   Introduction
  154.       C.2   Function Reference
  155.  
  156.  Appendix D  D Presentation Manager Spooler-Queue Processor
  157.  
  158.       D.1   Overview
  159.       D.2   Functions
  160.  
  161.  Appendix E  E OEMHLP$ EISA Configuration Support
  162.  
  163.       E.1   Introduction
  164.       E.2   Calls from Base Device Drivers
  165.       E.3   Calls from Installable Drivers
  166.       E.4   EISA Configuration Buffers
  167.  
  168.  
  169.  
  170.  Preface
  171.  ────────────────────────────────────────────────────────────────────────────
  172.  
  173.  This manual describes the Microsoft(R) Operating System/2 (MS(R) OS/2)
  174.  device driver interfaces, a set of routines that MS OS/2 device drivers use
  175.  or supply to carry out tasks.
  176.  
  177.  MS OS/2 device drivers consist of routines that carry out device-specific
  178.  actions as requested by the operating system. To carry out a requested
  179.  action, device drivers may, in turn, call routines in the operating system.
  180.  For any device driver, the set of routines that the driver must have
  181.  combined with the set of system routines that the driver may call is the MS
  182.  OS/2 interface for that particular device.
  183.  
  184.  The MS OS/2 interfaces for base and installable device drivers are defined
  185.  in assembly language or in the C language. Interfaces for Presentation
  186.  Manager device drivers are defined in the C language.
  187.  
  188.  This manual has three parts and five appendixes:
  189.  
  190.  Part 1                            Chapters 1 through 5 describe the
  191.                                    interfaces for base and installable
  192.                                    device drivers.
  193.  
  194.  Part 2                            Chapters 6 through 10 describe the
  195.                                    interfaces for Presentation Manager
  196.                                    device drivers.
  197.  
  198.  Part 3                            Chapters 11 and 12 describe the MS OS/2
  199.                                    version 1.2 tools for the development
  200.                                    and testing of device drivers.
  201.  
  202.  Chapter 1, "Overview of Base and Installable Device Drivers," explains the
  203.  logical and segment structure, file format, and header for MS OS/2 version
  204.  1.2 device drivers.
  205.  
  206.  Chapter 2, "Device Commands," defines the device command interface. MS OS/2
  207.  uses this interface to send device commands to base and installable device
  208.  drivers that run at ring-0.
  209.  
  210.  Chapter 3, "Device Helper Services," defines the MS OS/2 device helper
  211.  (DevHlp) interface. MS OS/2 provides the DevHlp routines for base and
  212.  installable device drivers that need to carry out specific tasks, such as
  213.  allocating memory.
  214.  
  215.  Chapter 4, "Base Video Device Handlers," defines the structure of an MS OS/2
  216.  version 1.2 BVH (base video handler) and the functions that it supplies.
  217.  
  218.  Chapter 5, "Mouse Device Drivers," defines the IDC (inter-device driver
  219.  communication) interface between the device-independent mouse driver
  220.  supplied by MS OS/2 version 1.2 and any device-dependent mouse driver that
  221.  is added to the system.
  222.  
  223.  Chapter 6, "Overview of Presentation Manager Device Drivers," explains the
  224.  basics of Presentation Manager device drivers, their components, the
  225.  graphics engine, installed simulations, and the corresponding data
  226.  structures.
  227.  
  228.  Chapter 7, "Graphics Functions," defines each function of the graphics
  229.  interface. MS OS/2 uses this interface to send graphics commands to a
  230.  particular display or printer driver.
  231.  
  232.  Chapter 8, "Spooler Functions," defines the functions that a device driver
  233.  uses to access the spooler (the print-queue manager). The spooler is a
  234.  dynamic-link library containing functions that create and store print jobs.
  235.  
  236.  Chapter 9, "Types, Macros, Structures," defines the data types, macros, and
  237.  structures used with the graphics interface.
  238.  
  239.  Chapter 10, "File Formats," defines the files used with Presentation Manager
  240.  device drivers, such as font files and resource files containing bitmaps,
  241.  icons, and cursors.
  242.  
  243.  Chapter 11, "MS OS/2 System Debugger," defines the system-debugger command
  244.  keys, parameters, and commands for testing and debugging device driver code.
  245.  
  246.  
  247.  Chapter 12, "Assembly-Language Macros," defines the Cmacros that can be used
  248.  to simplify the interface between assembly-language device drivers and the
  249.  function and segment conventions of languages such as C.
  250.  
  251.  Appendix A, "Device Driver Installation," describes the ddinstal utility.
  252.  
  253.  Appendix B, "Setting Up the System Debugger," describes the equipment needed
  254.  to use the system debugger, how to set it up, and how to set up the
  255.  system-debugger software.
  256.  
  257.  Appendix C, "Dos Functions for Installable Device Drivers," describes those
  258.  functions that installable ring-0 drivers may call during initialization.
  259.  
  260.  Appendix D, "Presentation Manager Spooler Queue Processor," describes the
  261.  functions that the spooler calls to access the print-queue processor. This
  262.  processor is a dynamic-link library containing functions that prepare a
  263.  print job for printing or plotting on an output device.
  264.  
  265.  Appendix E, "OEMHLP$ EISA Configuration Support," describes how a base or
  266.  installable driver can get configuration information if it is running on an
  267.  EISA (extended industry standard architecture) machine.
  268.  
  269.  This manual is intended to fully describe the MS OS/2 device driver
  270.  interfaces, together with the structures and file formats used with each
  271.  routine. However, it does not show how to use these interfaces to carry out
  272.  specific tasks, nor how to write, compile, and link programs containing the
  273.  interfaces. For more information about these topics, see the Microsoft
  274.  Operating System/2 Programmer's Reference.
  275.  
  276.  
  277.  Notational Conventions
  278.  
  279.  The following notational conventions are used throughout this manual:
  280.  
  281.  Convention                        Meaning
  282.  ────────────────────────────────────────────────────────────────────────────
  283.  
  284.  bold                              Bold is used for keywords, such as
  285.                                    function, data-type, structure, and
  286.                                    macro names. These names are spelled
  287.                                    exactly as they should appear in source
  288.                                    programs.
  289.  
  290.  italics                           Italics are used to name a (formal)
  291.                                    parameter; the name is a metasymbol, and
  292.                                    any required parameter must be replaced
  293.                                    by an actual argument.
  294.  
  295.  monospace                         Monospace type is used for example code
  296.                                    fragments and for layout diagrams.
  297.  
  298.  
  299.  
  300.  Other References
  301.  
  302.  For information on 80286 or 80386 architecture, please refer to the
  303.  following books:
  304.  
  305.  iAPX 286 Programmer's Reference Manual including the iAPX 286 Numeric
  306.  Supplement, 1985, Intel Corporation.
  307.  
  308.  iAPX 286 Operating Systems Writer's Guide, 1983, Intel Corporation.
  309.  
  310.  80386 Programmer's Reference Manual, 1986, Intel Corporation.
  311.  
  312.  80387 Programmer's Reference Manual, 1987, Intel Corporation.
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  Chapter 1  Overview of Base and Installable Device Drivers
  320.  ────────────────────────────────────────────────────────────────────────────
  321.  
  322.  
  323.  
  324.  
  325.  1.1  MS OS/2 Device Drivers
  326.  
  327.  A device driver is the intermediary between a peripheral hardware device and
  328.  MS OS/2. Figure 1.1 illustrates this relationship, using a keyboard as a
  329.  representative peripheral device.
  330.  
  331.  (This figure may be found in the printed book).
  332.  
  333.  .AR 210p As the system boots, MS OS/2 must load certain essential device
  334.  drivers in the following order:
  335.  
  336.    ■   Clock driver─clock0x.sys names a replacement clock driver.
  337.  
  338.    ■   Display driver─screen0x.sys names a replacement display driver.
  339.  
  340.    ■   Keyboard driver─kbd0x.sys names a replacement keyboard driver.
  341.  
  342.    ■   Printer driver─print0x.sys names a replacement printer driver.
  343.  
  344.    ■   Disk driver─disk0x.sys names a replacement disk driver.
  345.  
  346.  
  347.  These essential drivers are called base drivers. MS OS/2 version 1.2
  348.  combines its own base drivers into a single device driver called
  349.  basedd01.sys for AT-class machines, basedd02.sys for PS/2 machines, or
  350.  basedd03.sys for Model 30 286 machines, and locates basedd0x.sys in high
  351.  memory. Early in the boot process, MS OS/2 steps through the base driver
  352.  table in basedd0x.sys and determines whether there is a replacement file for
  353.  one (or more) of the base drivers. If a replacement file exists, the system
  354.  loads and initializes this replacement driver, locates it in low memory, and
  355.  ignores the corresponding portion of basedd0x.sys after system boot. MS OS/2
  356.  inserts three stub base device drivers between the base keyboard and printer
  357.  drivers of basedd0x.sys. Device driver programmers should not attempt to
  358.  replace any of these stubs with another base device driver.
  359.  
  360.  During the boot process, MS OS/2 can also load additional device drivers,
  361.  according to the device directives found in the config.sys file. Such
  362.  drivers are called installable drivers.
  363.  
  364.  Both base and installable device drivers have the following common features:
  365.  
  366.  
  367.    ■   Logical structure driver must have a strategy routine to handle
  368.        incoming device commands and an interrupt routine to handle hardware
  369.        interrupts.
  370.  
  371.    ■   Physical structure driver must have a particular .exe file image.
  372.  
  373.    ■   Bimodal operation driver can handle incoming device commands and
  374.        hardware interrupts under the current CPU execution mode, whether it
  375.        is protected or real.
  376.  
  377.    ■   Reentrancy driver must be reentrant so that it can manage overlapping
  378.        I/O requests for its device in a multitasking environment.
  379.  
  380.    ■   Interfaces with the MS OS/2 kernel kernel sends device-specific
  381.        commands as request packets to the appropriate driver. The driver, in
  382.        turn, can call the MS OS/2 DevHlp routines in order to carry out these
  383.        requests.
  384.  
  385.    ■   Classification as a character or a block driver drivers control
  386.        devices that transfer data one byte at a time. Block drivers control
  387.        devices that transfer data in blocks, rather than byte-by-byte.
  388.  
  389.    ■   Incorporation into the system at boot time drivers load early in the
  390.        boot process. Installable drivers load slightly later, because they
  391.        usually support devices that are add-ons to the standard system.
  392.        However, an installable driver also may replace a system-supplied base
  393.        driver when MS OS/2 processes the config.sys file during system boot.
  394.  
  395.  
  396.  For more detailed information about the request-packet interface, see
  397.  Chapter 2, "Device Commands." For more detailed information about the DevHlp
  398.  routines, see Chapter 3, "Device Helper Services."
  399.  
  400.  
  401.  1.2  Device Driver Logical Structure
  402.  
  403.  MS OS/2 device drivers have the following functional parts:
  404.  
  405.    ■   Strategy routine driver's strategy routine handles I/O requests and
  406.        other device commands via a request-packet interface with the kernel.
  407.        The strategy routine must be bimodal (able to run both in protected
  408.        and real modes) and must follow the far call/ret model. The kernel
  409.        saves and restores registers for the strategy routine.
  410.  
  411.    ■   Hardware-interrupt handler driver's interrupt routine, or interrupt
  412.        handler, is called when a hardware interrupt occurs. It must be
  413.        bimodal and must follow the far call/ret model. When the interrupt
  414.        handler has processed an interrupt, it must clear the carry (C) flag
  415.        just before its far ret. This routine should run as much as possible
  416.        with interrupts enabled, and it should dismiss the interrupt at the
  417.        PIC (programmable interrupt controller) as soon as possible with a
  418.        call to the DevHlp routine EOI.
  419.  
  420.    ■   ROM BIOS handler (optional) driver's ROM BIOS software interrupt
  421.        handler, if any, runs only in real mode. The driver's strategy routine
  422.        may install such a handler with a call to the DevHlp routine
  423.        SetROMVector in order to intercept a particular ROM BIOS software
  424.        interrupt. The handler may call the DevHlp routine ROMCritSection to
  425.        protect a critical section of ROM BIOS execution.
  426.  
  427.  
  428.  Figure 1.2 shows the functional parts of a device driver and their
  429.  relationship to the system.
  430.  
  431.  (This figure may be found in the printed book).
  432.  
  433.  .AR 181p Note that the MS OS/2 kernel routes all I/O requests to the
  434.  driver's strategy routine, which calls other routines in the driver, usually
  435.  through a command-dispatch table. The strategy routine must call the
  436.  driver's other routines that process device commands.
  437.  
  438.  
  439.  1.3  Device Driver Segment Structure
  440.  
  441.  MS OS/2 version 1.2 device drivers may have multiple code and data segments.
  442.  However, the driver's first-linked segments must be a data segment followed
  443.  by a code segment. MS OS/2 assumes that these are the driver's primary data
  444.  and code segments and that they must be permanently fixed in low memory
  445.  (below 640K) after driver initialization, which has the following effects:
  446.  
  447.    ■   Data in the driver's primary data segment is directly accessible,
  448.        whatever the operating mode. Data used by the driver's interrupt
  449.        handler should be in this segment. The primary data segment also
  450.        contains the driver's command-dispatch table, which defines symbolic
  451.        offsets to the driver's routines that process particular device
  452.        commands.
  453.  
  454.    ■   Code in the driver's primary code segment must be executable in real
  455.        and protected modes. There must be an entry point for the driver's
  456.        strategy routine in this segment. The driver's bimodal
  457.        hardware-interrupt handler and real-mode ROM BIOS handler, if any,
  458.        must also be in this segment.
  459.  
  460.    ■   When it passes control to the device driver, MS OS/2 sets the ds and
  461.        cs registers to these segments, using a protected-mode selector or a
  462.        real-mode segment value, depending on the current operating mode.
  463.  
  464.  
  465.  The driver's primary data segment must contain a device driver header as its
  466.  initial data item. The driver must define a header in this segment for each
  467.  character device it supports. For more information about device driver
  468.  headers, see Section 1.5.
  469.  
  470.  The driver's primary code segment must contain an entry point for its
  471.  strategy routine. MS OS/2 calls the strategy routine to handle I/O requests
  472.  and other device commands, such as driver initialization, via a
  473.  request-packet interface with the kernel. For more information about the
  474.  request packet for each device command, see Chapter 2, "Device Commands."
  475.  
  476.  The driver's other code and data segments, if any, are loaded into high
  477.  memory. MS OS/2 assumes that such segments can be discarded after the driver
  478.  initializes. However, you can mark segments to be kept in high memory with
  479.  the Microsoft Segmented-Executable Linker (link), version 5.0. Set up
  480.  permanent segments in your driver's module definition file by using the link
  481.  SEGMENTS directive and the IOPL option (thereby overloading IOPL since your
  482.  driver runs at ring-0 after it initializes).
  483.  
  484.  Note that MS OS/2 loads and keeps the driver's non-primary but permanent
  485.  data and code segments (if any) above 640K, which has the following effects:
  486.  
  487.  
  488.    ■   Data in such segments cannot be accessed in real mode. The virtual
  489.        address of a data item is always a protected-mode selector:offset.
  490.  
  491.    ■   Code in such segments is executable only in protected mode. The
  492.        address of an entry point is a selector:offset.
  493.  
  494.    ■   MS OS/2 assumes that such segments can be moved and swapped but not
  495.        discarded. Your device driver can fix a segment permanently in high
  496.        memory, however, by calling the DevHlp routine Lock when it
  497.        initializes. For more information about Lock, see Chapter 3, "Device
  498.        Helper Services."
  499.  
  500.  
  501.  After the device driver initializes, MS OS/2 discards all extra code or data
  502.  segments that are not marked as permanent in the link module definition
  503.  file. Device drivers that must be compatible with MS OS/2 version 1.0 may
  504.  have only the single data segment and single code segment that are required
  505.  of MS OS/2 version 1.2 device drivers.
  506.  
  507.  
  508.  1.4  Device Driver Executable File Format
  509.  
  510.  One of the ways a device driver file differs from an ordinary .exe file is
  511.  that the initial (primary) data segment must contain a device driver header
  512.  at the top of the segment. The data segment must precede the code segment so
  513.  that the device driver header follows the .exe file header.
  514.  
  515.  Figure 1.3 shows the file image of an MS OS/2 device driver.
  516.  
  517.  (This figure may be found in the printed book).
  518.  
  519.  .AR 180p A character driver that supports more than one device must define a
  520.  header in its primary data segment for each character device it supports.
  521.  
  522.  
  523.  1.5  Device Driver Header
  524.  
  525.  The device driver header is a static data structure that defines a device
  526.  within the system. For example, this header supplies information that the
  527.  kernel's request router (see Figure 1.2) uses, such as the code segment
  528.  offset to the driver's strategy routine and whether the driver controls a
  529.  character or block device.
  530.  
  531.  Figure 1.4 shows the layout of the 26-byte device driver header with each
  532.  field and its size.
  533.  
  534.  (This figure may be found in the printed book).
  535.  
  536.  
  537.  
  538.  +--------------------------------+
  539.  |    Pointer_To_Next_Header      |  DWORD
  540.  +--------------------------------+
  541.  |    Device_Attribute            |  WORD
  542.  +--------------------------------+
  543.  |    Offset_To_Strategy_Routine  |  WORD
  544.  +--------------------------------+
  545.  |    Offset_To_IDC_Routine*      |  WORD
  546.  +--------------------------------+
  547.  |    Name_Or_Units               |  4 WORDS
  548.  +--------------------------------+
  549.  |    Reserved                    |  4 WORDS
  550.  +--------------------------------+
  551.       *Reserved = 0 if the driver does not participate
  552.        in inter-device driver communication (IDC)
  553.  
  554.  
  555.  The following sections explain each field in the device driver header.
  556.  
  557.  
  558.  1.5.1  Pointer_to_Next_Header Field
  559.  
  560.  Both words of the Pointer_to_Next_Header field should be set to -1 for
  561.  drivers that support one device. For drivers that support more than one
  562.  character device, this field should be set to the header for the next
  563.  character device, as follows:
  564.  
  565.    ■   The first word of this dword field is the offset to the next header.
  566.  
  567.    ■   The second word is the segment address.
  568.  
  569.    ■   Both words of the last header in a chain of linked headers should be
  570.        set to -1.
  571.  
  572.  
  573.  
  574.  
  575.  1.5.2  Device_Attribute Field
  576.  
  577.  The Device_Attribute field of the device driver header defines the
  578.  characteristics of the device driver. Figure 1.5 shows the format of the
  579.  Device_Attribute field.
  580.  
  581.  (This figure may be found in the printed book).
  582.  
  583.  
  584.  
  585.     15  14  13  12  11  10  9   8   7   6   5   4   3   2   1   0
  586.  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  587.  | C | I | I | S | O |///|           |///|///|///| C | N | S | K |
  588.  | H | D | B | H | P |///|   Level   |///|///|///| L | U | C | B |
  589.  | R | C | M | R | N |///|           |///|///|///| K | L | R | D |
  590.  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  591.  
  592.  
  593.  The bit fields in the Device_Attribute word indicate the following:
  594.  
  595.  Bit field                         Usage
  596.  ────────────────────────────────────────────────────────────────────────────
  597.  
  598.  0                                 Standard Input─Set this bit if your
  599.                                    driver will be the new standard-input
  600.                                    character device driver.
  601.  
  602.  1                                 Standard Output─Set this bit if your
  603.                                    driver will be the new standard-output
  604.                                    character device driver.
  605.  
  606.  2                                 Null Attribute─Set this bit if your
  607.                                    character driver is a null device. If
  608.                                    set, this bit tells MS OS/2 that the
  609.                                    system's null device is being used, but
  610.                                    you cannot reassign the null device.
  611.  
  612.  3                                 Clock Device─Set this bit if your
  613.                                    character driver is the new standard
  614.                                    system clock driver.
  615.  
  616.  4                                 Reserved = 0
  617.  
  618.  5                                 Reserved = 0
  619.  
  620.  6                                 Reserved = 0
  621.  
  622.  7-9                               Level─Set this field to 001B (DevLev_1
  623.                                    driver) or to 010B (DevLev_2 driver) for
  624.                                    a character driver or for a block driver
  625.                                    that supports removable media and the
  626.                                    logical partition types 1, 4, and 6. Set
  627.                                    this field to 010B (DevLev_2 driver) for
  628.                                    a block driver that also supports the
  629.                                    logical partition type 7, which is the
  630.                                    partition type of HPFS (High Performance
  631.                                    File System).
  632.  
  633.                                    MS OS/2 version 1.2 sends all DevLev_2
  634.                                    device drivers an extended GenericIOCtl
  635.                                    request packet with more information
  636.                                    than it sends to DevLev_1 drivers. MS
  637.                                    OS/2 version 1.2 also sends extended
  638.                                    Read, Write, and WriteVerify request
  639.                                    packets to DevLev_2 block drivers. The
  640.                                    system sends request packets that are
  641.                                    identical to those of MS OS/2 versions
  642.                                    1.0 and 1.1 to DevLev_1 drivers. For
  643.                                    more information about GenericIOCtl,
  644.                                    Read, Write, and WriteVerify requests,
  645.                                    see Chapter 2, "Device Commands."
  646.  
  647.  10                                Reserved = 0
  648.  
  649.  11                                Open/Close─For character device drivers,
  650.                                    set this bit if your driver must receive
  651.                                    OpenDevice and CloseDevice request
  652.                                    packets. For more information about
  653.                                    OpenDevice and CloseDevice requests, see
  654.                                    Chapter 2, "Device Commands."
  655.  
  656.  11                                Removable Media─For block device drivers,
  657.                                    set this bit if your driver handles
  658.                                    removable media.
  659.  
  660.  12                                Shared─For character device drivers, set
  661.                                    this bit if file-system sharing rules
  662.                                    apply to your driver as they apply to
  663.                                    any other file-system name. Under these
  664.                                    rules, a physical device may have only
  665.                                    one logical name (no aliases), and a
  666.                                    device name is protected by the sharer.
  667.                                    For character device drivers, clear this
  668.                                    bit (default) if your driver uses
  669.                                    aliases and assumes responsibility for
  670.                                    providing contention control. For block
  671.                                    device drivers, this bit has no meaning
  672.                                    and must be zero.
  673.  
  674.  13                                Media Type─For block device drivers, set
  675.                                    this bit if your driver uses information
  676.                                    in the BPB (BIOS parameter block) to
  677.                                    determine the media type or if your
  678.                                    driver supports the logical partition
  679.                                    type 7 of HPFS. For character device
  680.                                    drivers, this bit has no meaning and
  681.                                    must be zero.
  682.  
  683.  14                                Inter-Device Driver Communication─Set
  684.                                    this bit if your driver participates in
  685.                                    inter-device driver communication to
  686.                                    indicate that the Offset_to_IDC_Routine
  687.                                    field has been set up (see Section
  688.                                    1.5.4). Clear this bit if your driver
  689.                                    does not communicate with another device
  690.                                    driver.
  691.  
  692.  15                                Character Driver─Set this bit if your
  693.                                    driver is a character device driver.
  694.                                    Clear this bit if the driver is a block
  695.                                    device driver.
  696.  
  697.  
  698.  
  699.  1.5.3  Offset_to_Strategy_Routine Field
  700.  
  701.  The Offset_to_Strategy_Routine field of the device driver header contains
  702.  the offset from the driver's primary code segment to the entry point of its
  703.  strategy routine. The MS OS/2 request router calls the driver's strategy
  704.  routine by using the driver's cs selector or segment value and this word
  705.  field value as a far pointer.
  706.  
  707.  
  708.  1.5.4  Offset_to_IDC_Routine Field
  709.  
  710.  The Offset_to_IDC_Routine field of the device driver header contains the
  711.  offset from the driver's primary code segment to the entry point that is
  712.  callable by other device drivers. Note that bit 14 of the Device_Attribute
  713.  field must be set, indicating that the driver participates in inter-device
  714.  driver communication, for this field to have meaning. The
  715.  Offset_to_IDC_Routine field and bit 14 of the Device_Attribute field should
  716.  be zero if the driver is not an IDC target driver.
  717.  
  718.  
  719.  1.5.5  Name_or_Units Field
  720.  
  721.  The Name_or_Units field of the device driver header contains the name of the
  722.  device supported by a character device driver, or it contains the number of
  723.  logical units supported by a block device driver.
  724.  
  725.  For a character device driver, the Name_or_Units field must contain
  726.  uppercase ASCII characters and must be left-justified and blank-filled at
  727.  the right. Applications identify the device for I/O by this name. To avoid a
  728.  conflict between identical device and file names, choose a device name with
  729.  some unusual character such as a dollar sign ($). Otherwise, if there are
  730.  identical device and file names, an application that calls DosOpen or
  731.  DosOpen2 for the file will always open the device. For character device
  732.  drivers that use ABIOS (advanced basic I/O system), the device name
  733.  represents a single device identified by the logical ID (LID).
  734.  
  735.  For a block device driver, the first byte of the Name_or_Units field can
  736.  contain the number of units supported by the driver. However, this is
  737.  optional because MS OS/2 fills this field during device driver
  738.  initialization. For block device drivers that use ABIOS, the number of units
  739.  represents the number of devices (or units) under the LID.
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  Chapter 2  Device Commands
  747.  ────────────────────────────────────────────────────────────────────────────
  748.  
  749.  
  750.  
  751.  
  752.  2.1  Introduction
  753.  
  754.  MS OS/2 calls a device driver's strategy routine to handle I/O requests via
  755.  a request-packet interface with the kernel. For each request packet sent to
  756.  the driver, MS OS/2 supplies certain input parameters in a static, 13-byte
  757.  Request Header that has a byte-sized Command_Code field at offset 2. The
  758.  driver examines the Command_Code value to determine what operation it should
  759.  carry out.
  760.  
  761.  For a subset of requests, MS OS/2 supplies additional information in the
  762.  non-static, Command-specific_Data area of the request packet and expects the
  763.  driver to return updated information on a command-specific basis. For
  764.  certain requests, the Command-specific_Data area includes extra fields for
  765.  MS OS/2 version 1.2 DevLev_2 drivers.
  766.  
  767.  When it has carried out the appropriate operation, the driver must always
  768.  update the word-sized Status field at offset 3 in the Request Header of the
  769.  request packet. For more information about request packets in general and
  770.  the Request Header fields in particular, see Section 2.2. For detailed
  771.  information about command-specific requests, see Section 2.3. For more
  772.  information about device driver strategy routines and about MS OS/2 version
  773.  1.2 DevLev_1 and DevLev_2 drivers, see Chapter 1, "Overview of Base and
  774.  Installable Device Drivers."
  775.  
  776.  
  777.  2.2  Request Packets
  778.  
  779.  MS OS/2 calls the device driver's strategy routine with the es:bx register
  780.  pair pointing to the request packet. The pointer is a virtual address─a
  781.  selector:offset or a segment:offset─depending on the current operating mode.
  782.  
  783.  
  784.  However, MS OS/2 does not guarantee that the order of API requests issued by
  785.  multiple threads will be preserved when the corresponding request packets
  786.  arrive at the device driver. Multiple application threads (and threads
  787.  created by the DosReadAsync and DosWriteAsync functions) can get blocked in
  788.  the system, so an API request packet from an unblocked thread can arrive out
  789.  of order. The device driver must provide a synchronization mechanism between
  790.  itself and application processes (and threads) if it supports multiple
  791.  outstanding requests and if request-packet ordering must be preserved.
  792.  
  793.  Each request packet has two parts: a 13-byte Request Header and a
  794.  variable-sized Command-specific_Data area. Figure 2.1 shows the layout of MS
  795.  OS/2 version 1.2 request packets, including each field in the Request Header
  796.  with its size and its offset from the virtual pointer in es:bx, and the
  797.  Command-specific Data area.
  798.  
  799.  MS OS/2 calls the device driver's strategy routine for each request and
  800.  always passes access to the request packet in the es:bx register pair. The
  801.  strategy routine may store this pointer as a virtual or converted address in
  802.  its primary data segment as part of its request-queue management scheme. The
  803.  device driver's interrupt handler accesses the head of the work queue in the
  804.  driver's primary (low-memory) data segment to get a pointer to the request
  805.  packet.
  806.  
  807.  
  808.  2.2.1  Length_of_Request_Packet Field
  809.  
  810.  The Length_of_Request_Packet field is set to the number of bytes in the
  811.  request packet. The length is the sum of the 13-byte Request Header and the
  812.  number of bytes in the Command-specific_Data area.
  813.  
  814.  (This figure may be found in the printed book).
  815.  
  816.  
  817.  
  818.  +----------------------------+                    --|
  819.  Length_of_Request_Packet  |   BYTE PTR ReqPak+0  |
  820.  +----------------------------+                      |
  821.  |  Block_Device_Unit_Code    |   BYTE PTR ReqPak+1  |
  822.  +----------------------------+                      |  Static
  823.  |  Command_Code              |   BYTE PTR ReqPak+2  |  Request
  824.  +----------------------------+                      |  Header
  825.  |  Status                    |   WORD PTR ReqPak+3  |
  826.  +----------------------------+                      |
  827.  |  Reserved                  |   DWORD PTR ReqPak+5 |
  828.  +----------------------------+                      |
  829.  |  Queue_Linkage             |   DWORD PTR ReqPak+9 |
  830.  +----------------------------+                    --|  Command-specific_Data
  831.  |  BYTE PTR ReqPak+0DH
  832.  ~                            ~    DevLev_1 drivers: 0-13 BYTEs
  833.  |                            |    DevLev_2 drivers: 0-16 BYTEs
  834.  +----------------------------+
  835.  
  836.  
  837.  
  838.  
  839.  Note that MS OS/2 version 1.2 request packets for DevLev_1 drivers have a
  840.  Command-specific_Data area that varies from zero to 13 bytes in size,
  841.  depending on the command. For DevLev_1 drivers, the size of this area is
  842.  identical to the request packets for the same commands in MS OS/2 versions
  843.  1.0 and 1.1. However, MS OS/2 version 1.2 supplies extra information to
  844.  DevLev_2 drivers, so the size of the Command-specific_Data area varies from
  845.  zero to 16 bytes for DevLev_2 drivers.
  846.  
  847.  
  848.  2.2.2  Block_Device_Unit_Code Field
  849.  
  850.  The Block_Device_Unit_Code field of the Request Header identifies the
  851.  logical unit for which the request is intended. This field has no meaning
  852.  for character device drivers, so they can ignore it.
  853.  
  854.  
  855.  2.2.3  Command_Code Field
  856.  
  857.  The Command_Code field of the Request Header indicates which operation the
  858.  driver should carry out. Table 2.1 lists the Command_Code value for every MS
  859.  OS/2 version 1.2 request, in numeric order, and indicates whether it is sent
  860.  to block (BLK) or character (CHR) device drivers, or both. <TT>Summary of
  861.  Commands for Device Drivers"</TT>
  862.  
  863.  Code                              Command     Block/Character device
  864.                                                drivers
  865.  ────────────────────────────────────────────────────────────────────────────
  866.  
  867.  00                                Init        BLK, CHR
  868.  
  869.  01                                MediaCheck  BLK
  870.  
  871.  02                                BuildBPB    BLK
  872.  
  873.  03                                Reserved
  874.  
  875.  04                                Read        BLK, CHR
  876.                                    (input)
  877.  
  878.  05                                Nondestruc  CHR
  879.                                    tiveReadNo
  880.                                    Wait
  881.  
  882.  06                                InputStatu  CHR
  883.                                    s
  884.  
  885.  07                                InputFlush  CHR
  886.  
  887.  08                                Write       BLK, CHR
  888.                                    (output)
  889.  
  890.  09                                WriteVerif  BLK, CHR
  891.                                    y
  892.  
  893.  0AH                               OutputStat  CHR
  894.                                    us
  895.  
  896.  0BH                               OutputFlus  CHR
  897.                                    h
  898.  
  899.  0CH                               Reserved
  900.  
  901.  0DH                               OpenDevice  BLK, CHR
  902.  
  903.  0EH                               CloseDevic  BLK, CHR
  904.                                    e
  905.  
  906.  0FH                               RemovableM  BLK
  907.                                    edia
  908.  
  909.  10H                               GenericIOC  BLK, CHR
  910.                                    tl
  911.  
  912.  11H                               ResetMedia  BLK
  913.  
  914.  12H                               GetLogical  BLK
  915.                                    DriveMappi
  916.                                    ng
  917.  
  918.  13H                               SetLogical  BLK
  919.                                    DriveMappi
  920.                                    ng
  921.  
  922.  14H                               Deinstall   CHR
  923.  
  924.  15H                               Reserved
  925.  
  926.  16H                               Partitiona  BLK
  927.                                    bleFixedDi
  928.                                    sks
  929.  
  930.  17H                               GetFixedDi  BLK
  931.                                    sk/Logical
  932.                                    UnitMap
  933.  
  934.  18H                               NonCaching  BLK
  935.                                    Read
  936.  
  937.  19H                               NonCaching  BLK
  938.                                    Write
  939.  
  940.  1AH                               NonCaching  BLK
  941.                                    WriteVerif
  942.                                    y
  943.  
  944.  1BH                               Reserved
  945.  
  946.  1CH                               PrepareFor  BLK, CHR
  947.                                    SysShutdow
  948.                                    n
  949.  
  950.  For detailed information about each command, see Section 2.3.
  951.  
  952.  
  953.  2.2.4  Status Field
  954.  
  955.  The Status field of the Request Header describes the state of the request.
  956.  
  957.  When the kernel calls the driver's strategy routine, it defines Status field
  958.  values only for OpenDevice (Command_Code value 0DH) and CloseDevice (0EH)
  959.  request packets:
  960.  
  961.    ■   For an OpenDevice request, bit 3 of the Status field is set if the
  962.        DosMonOpen function caused generation of the request packet.
  963.        Otherwise, the DosOpen or DosOpen2 function caused generation of the
  964.        request packet.
  965.  
  966.    ■   For a CloseDevice request, bit 3 of the Status field is set if the
  967.        DosMonClose or DosClose function caused generation of the request
  968.        packet with a handle that was generated by the DosMonOpen function.
  969.        Otherwise, the DosClose function caused generation of the request
  970.        packet with a non-monitor handle.
  971.  
  972.  
  973.  The driver's strategy routine carries out whatever operations it must in
  974.  order to handle the request, possibly calling a command-specific subroutine
  975.  or detecting an error condition. Then, it must update the Status field to
  976.  describe the resulting status of the request before it returns control to
  977.  the kernel. Figure 2.2 defines the format of the resulting Status field.
  978.  
  979.  (This figure may be found in the printed book).
  980.  
  981.  
  982.  
  983.    15  14  13  12  11  10  9   8   7   6   5   4   3   2   1   0
  984.  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  985.  | E | D |///|///|///|///| B | D |                               |
  986.  | R | E |///|///|///|///| U | O |      error code if error      |
  987.  | R | V |///|///|///|///| S | N |                               |
  988.  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  989.  
  990.  
  991.  The fields in the Status word indicate the following:
  992.  
  993.  Field                             Usage
  994.  ────────────────────────────────────────────────────────────────────────────
  995.  
  996.  0-7                               Error code─Set the low-order byte to a
  997.                                    code for one of the standard errors
  998.                                    (listed in Section 2.2.5) when bit 15 is
  999.                                    set to indicate an error but bit 14 is
  1000.                                    clear. A driver may define a private
  1001.                                    error code for use when bit 14 is also
  1002.                                    set.
  1003.  
  1004.  8                                 Done─Set this bit when an operation is
  1005.                                    complete before the driver exits.
  1006.  
  1007.  9                                 Busy─Set this bit when the device is
  1008.                                    busy only for InputStatus (Command_Code
  1009.                                    value 06), OutputStatus (0AH), or
  1010.                                    RemovableMedia (0FH) requests.
  1011.  
  1012.  10-13                             Reserved = 0
  1013.  
  1014.  14                                Driver-defined error─Set this bit in
  1015.                                    conjunction with bit 15 for a
  1016.                                    driver-defined error.
  1017.  
  1018.  15                                Error─Set this bit for an error and set
  1019.                                    the appropriate standard error code in
  1020.                                    bits 0 to 7, provided bit 14 is clear.
  1021.  
  1022.  
  1023.  
  1024.  2.2.5  Errors
  1025.  
  1026.  When the Status field in the returned request packet indicates an error (bit
  1027.  15 is set), MS OS/2 processes the error code in one of the following ways
  1028.  and returns the result to the application that made the request:
  1029.  
  1030.    ■   If the IOCtl category code bit is set (user-defined), the byte-sized
  1031.        error code is combined with 0FF00H by the OR operator.
  1032.  
  1033.    ■   If the IOCtl category code bit is clear (system-defined) but bit 14 is
  1034.        set, the driver-defined, byte-wide error code is combined with 0FE00H
  1035.        by the OR operator.
  1036.  
  1037.    ■   Otherwise, the error code is a standard error code that MS OS/2 maps
  1038.        to one of the API return codes.
  1039.  
  1040.  
  1041.  The following lists the standard error codes that the driver may set in bits
  1042.  0 to 7 of the Status field:
  1043.  
  1044.  Error code                        Means
  1045.  ────────────────────────────────────────────────────────────────────────────
  1046.  
  1047.  00                                Write-protect violation
  1048.  
  1049.  01                                Unknown unit
  1050.  
  1051.  02                                Device not ready
  1052.  
  1053.  03                                Unknown command
  1054.  
  1055.  04                                CRC error
  1056.  
  1057.  05                                Bad drive request structure length
  1058.  
  1059.  06                                Seek error
  1060.  
  1061.  07                                Unknown media
  1062.  
  1063.  08                                Sector not found
  1064.  
  1065.  09                                Printer out of paper
  1066.  
  1067.  0AH                               Write fault
  1068.  
  1069.  0BH                               Read fault
  1070.  
  1071.  0CH                               General failure
  1072.  
  1073.  0DH                               Change disk (logical switch)
  1074.  
  1075.  0EH                               Reserved
  1076.  
  1077.  0FH                               Reserved
  1078.  
  1079.  10H                               Uncertain media
  1080.  
  1081.  11H                               Character I/O call interrupted
  1082.  
  1083.  12H                               Monitors not supported
  1084.  
  1085.  13H                               Invalid parameter
  1086.  
  1087.  14H                               Device already in use
  1088.  
  1089.  The driver determines which standard error code to return in the Status
  1090.  field, according to the nature of the device(s) it supports. The driver
  1091.  should return error code 03 (Unknown command) if it ever gets a request that
  1092.  is inappropriate to the kind of device that it supports and set the error
  1093.  and done bits of the Status field.
  1094.  
  1095.  When the state of the media in the drive is uncertain, a diskette device
  1096.  driver should return error code 10H (Uncertain media), but this response
  1097.  should not be returned for an Init request (Command_Code value 00). For
  1098.  fixed disks, the device driver must begin in an uncertain-media state to
  1099.  have the media correctly labeled. Use the following general guidelines to
  1100.  determine when to respond with error code 10H (Uncertain media):
  1101.  
  1102.    ■   When a drive-not-ready condition is detected, return Uncertain media
  1103.        to all subsequent requests until a ResetMedia (Command_Code value 11H)
  1104.        request is received.
  1105.  
  1106.    ■   When accessing removable media without change-line support and a time
  1107.        delay of two or more seconds has occurred, return Uncertain media.
  1108.  
  1109.    ■   When the state of the change-line indicates that the media might have
  1110.        changed, return Uncertain media.
  1111.  
  1112.  
  1113.  COM drivers should respond with error code 14H (Device already in use) when
  1114.  they cannot open a port in response to an OpenDevice request (Command_Code
  1115.  value 0DH) because another driver has already opened the same port but not
  1116.  yet closed it. COM drivers should return error code 0CH (General failure)
  1117.  when they cannot open a port for any other reason.
  1118.  
  1119.  Character drivers should respond with error code 11H (Character I/O call
  1120.  interrupted) when performing I/O for a blocked thread and the thread
  1121.  terminates before the requested operation was complete.
  1122.  
  1123.  Drivers that do not support monitors should respond with error code 12H
  1124.  (Monitors not supported) for all monitor requests caused by an application
  1125.  call to DosMonOpen, DosMonClose, or the IOCtl function DEV_QUERYMONSUPPORT
  1126.  (category 0BH, function 60h).
  1127.  
  1128.  All drivers should respond with error code 13H (Invalid parameter) when they
  1129.  receive a request packet with one or more fields containing invalid values.
  1130.  
  1131.  
  1132.  2.2.6  Queue_Linkage Field
  1133.  
  1134.  The Queue_Linkage field in the Request Header may contain a pointer to the
  1135.  next request packet so the driver can maintain a linked list of request
  1136.  packets. The device driver may manage its own queue, or it can use the
  1137.  DevHlp request-packet or character-queue routines described in Chapter 3,
  1138.  "Device Helper Services."
  1139.  
  1140.  Note that the pointer to a request packet is bimodal: valid in both
  1141.  protected and real modes. Such a pointer can be used directly from the
  1142.  Queue_Linkage field, without converting it to a physical address that must
  1143.  be reconverted if a mode switch occurs.
  1144.  
  1145.  
  1146.  2.2.7  Command-specific_Data Area
  1147.  
  1148.  The Command_Code field in the Request Header tells the driver which function
  1149.  to perform. The Command-specific_Data area in the request packet contains
  1150.  any parameters and additional function or return codes for the command. The
  1151.  size of this area varies from zero to 13 bytes for DevLev_1 drivers,
  1152.  depending on the command. For DevLev_2 drivers, the size of this area varies
  1153.  from zero to 16 bytes.
  1154.  
  1155.  All dword pointer parameters are stored with offset first and
  1156.  selector/segment next in the Command-specific_Data area.
  1157.  
  1158.  For detailed information about the Command-specific_Data area for each MS
  1159.  OS/2 version 1.2 request packet, see Section 2.3, next.
  1160.  
  1161.  
  1162.  2.3  MS OS/2 Device Driver Commands
  1163.  
  1164.  The following sections explain the device driver commands in numeric order
  1165.  by command code (see Table 2.1 for a list of Command_Code values).
  1166.  
  1167.  The structure of each request packet shows an abbreviated Request Header
  1168.  (see Figure 2.1 for details), followed by the fields, if any, of the
  1169.  Command-specific_Data area.
  1170.  
  1171.  
  1172.  █    Init
  1173.  ────────────────────────────────────────────────────────────────────────────
  1174.  
  1175.  
  1176.  +--------------------------------------+
  1177.  |           Request Header             |    13 BYTEs
  1178.  +--------------------------------------+
  1179.  |           Data_1                     |    BYTE PTR ReqPak+0DH
  1180.  |    (Number_of_Units on exit)         |
  1181.  +--------------------------------------+
  1182.  |           Pointer_1                  |    DWORD PTR ReqPak+0EH
  1183.  | (Pointer_to_Device_Help on entry)    |
  1184.  | (Offset_Ending_Code_Address on exit) |
  1185.  | (Offset_Ending_Data_Address on exit) |
  1186.  +--------------------------------------+
  1187.  |           Pointer_2                  |    DWORD PTR ReqPak+12H
  1188.  | (Pointer_to_Init_Arguments on entry) |
  1189.  | (Pointer_to_BPB_Array on exit)       |
  1190.  +--------------------------------------+
  1191.  |           Data_2                     |
  1192.  | (Drive_Number on entry)              |    BYTE PTR ReqPak+14H
  1193.  +--------------------------------------+
  1194.  
  1195.  
  1196.  The Init request tells the driver to initialize the device. The Command_Code
  1197.  value in the Request Header is 00.
  1198.  
  1199.  
  1200.  Comments
  1201.  
  1202.  On entry, the Command-specific_Data area of the request packet contains the
  1203.  following fields as input to the device driver:
  1204.  
  1205.    ■   Pointer_1 is set to point to the DevHlp strategy routine's entry
  1206.        point. The DevHlp entry point is a bimodal address; the driver may
  1207.        call a DevHlp routine by setting up the appropriate registers and
  1208.        loading the dl register with the DevHlp function code (for more
  1209.        information, see Chapter 3, "Device Helper Services").
  1210.  
  1211.    ■   Pointer_2 is set to point to device-specific information needed to
  1212.        initialize the device. For every base device driver that is preloaded
  1213.        with the operating system, the device-specific arguments are passed by
  1214.        the system initialization process. For an installable device driver,
  1215.        device-specific initialization arguments are obtained from its device
  1216.        line in the config.sys file, so each driver can use configurable
  1217.        parameters to initialize itself and the device.
  1218.  
  1219.    ■   Data_2 is set to the drive number for the first block device unit.
  1220.  
  1221.  
  1222.  At initialization time, the device driver runs as a thread under a
  1223.  protected-mode process at application level, with I/O privilege. Both base
  1224.  and installable device drivers may call one or more DevHlp routines that are
  1225.  permitted during initialization. Installable device drivers may also call
  1226.  the following MS OS/2 base system functions:
  1227.  
  1228.  Function                          Description
  1229.  ────────────────────────────────────────────────────────────────────────────
  1230.  
  1231.  DosBeep                           Generates sound from the speaker.
  1232.  
  1233.  DosCaseMap                        Performs case mapping.
  1234.  
  1235.  DosChgFilePtr                     Changes (moves) a file read/write
  1236.                                    pointer.
  1237.  
  1238.  DosClose                          Closes a file handle.
  1239.  
  1240.  DosDelete                         Deletes a file.
  1241.  
  1242.  DosDevConfig                      Gets a device's configuration.
  1243.  
  1244.  DosDevIOCtl                       I/O Control (IOCtl) for devices.
  1245.  
  1246.  DosDevIOCtl2                      I/O Control (IOCtl) for devices.
  1247.  
  1248.  DosFindClose                      Closes a search-directory handle.
  1249.  
  1250.  DosFindFirst                      Finds the first matching file.
  1251.  
  1252.  DosFindFirst2                     Finds the first matching file.
  1253.  
  1254.  DosFindNext                       Finds the next matching file.
  1255.  
  1256.  DosGetEnv                         Gets the address of a process
  1257.                                    environment string.
  1258.  
  1259.  DosGetMessage                     Gets a system message from a
  1260.                                    system-message file.
  1261.  
  1262.  DosOpen                           Opens a file.
  1263.  
  1264.  DosOpen2                          Opens a file.
  1265.  
  1266.  DosPutMessage                     Outputs text to the indicated handle.
  1267.  
  1268.  DosQCurDir                        Queries the current directory.
  1269.  
  1270.  DosQCurDisk                       Queries the current disk.
  1271.  
  1272.  DosQFileInfo                      Queries file information.
  1273.  
  1274.  DosQFileMode                      Queries the file mode.
  1275.  
  1276.  DosRead                           Reads from a file.
  1277.  
  1278.  DosSMRegisterDD                   Registers a driver with Session Manager
  1279.                                    for event notifications.
  1280.  
  1281.  DosWrite                          Writes synchronously to a file.
  1282.  
  1283.  For more information about these system functions, see Appendix C, "Dos
  1284.  Functions for Installable Device Drivers."
  1285.  
  1286.  On successful completion of initialization, the device driver must set
  1287.  fields in the request packet as follows:
  1288.  
  1289.    ■   A block driver must set the Data_1 field to the number of logical
  1290.        block devices or units available (Number_of_Units). MS OS/2 will
  1291.        assign sequential drive letters to these units. Character device
  1292.        drivers should set the Data_1 field to zero.
  1293.  
  1294.    ■   The driver must set the first word of the Pointer_1 field to the
  1295.        offset of the last byte in the driver's initial (and current) code
  1296.        segment (Offset_Ending_Code_Address). The driver must set the next
  1297.        word of the Pointer_1 field to the offset of the last byte in the
  1298.        driver's initial data segment (Offset_Ending_Data_Address). Doing this
  1299.        allows a device driver to release code and data that is used only by
  1300.        the driver's initialization routine. First, the initialization-only
  1301.        code and data must be located at the end of the appropriate segments.
  1302.        Then, as the final step in initialization, the device driver sets the
  1303.        offsets for the end of the code segment and the end of the data
  1304.        segment to retain the code and data that it needs after
  1305.        initialization. Doing this also allows every device driver to load
  1306.        with a maximum-sized data segment and then allows the kernel to
  1307.        release memory that each driver does not need from the primary
  1308.        (low-memory) data and code segments.
  1309.  
  1310.    ■   A block device driver must set the Pointer_2 field to the BPB (BIOS
  1311.        parameter block) array for the logical block devices or units that it
  1312.        supports (Pointer_to_BPB_Array). Character device drivers must set the
  1313.        Pointer _2 field to zero.
  1314.  
  1315.    ■   The driver must set the Status field in the Request Header to 0100H
  1316.        indicating no error and done.
  1317.  
  1318.  
  1319.  The driver must return the following values in the following fields of the
  1320.  request packet to indicate an initialization failure:
  1321.  
  1322.  Value                             Field
  1323.  ────────────────────────────────────────────────────────────────────────────
  1324.  
  1325.  810CH                             Status (General failure error code and
  1326.                                    done).
  1327.  
  1328.  00H                               Data_1 (Number_of_Units for block device
  1329.                                    drivers only).
  1330.  
  1331.  0000H                             Pointer_1 (first word for
  1332.                                    Offset_Ending_Code_address).
  1333.  
  1334.  0000H                             Pointer_1 + 2 (second word for
  1335.                                    Offset_Ending_Data_Address).
  1336.  
  1337.  A device driver that allocates multiple character device headers can fail
  1338.  initialization of a subset of its header chain.
  1339.  
  1340.  MS OS/2 retains the last nonzero code and data segment offsets returned for
  1341.  a device by a device driver that completes initialization successfully. The
  1342.  system initialization process uses these values to resize the device
  1343.  driver's code and data segments after Init request packets have been sent
  1344.  for each device in the device driver's header chain.
  1345.  
  1346.  When the driver cannot initialize a device in the header chain, it sets the
  1347.  code and data segment offsets in the Pointer_1 field to zero to indicate
  1348.  initialization failure for that device (as shown in the preceding list of
  1349.  fail values). If every device in the device driver's header chain fails
  1350.  initialization, the driver will not remain loaded.
  1351.  
  1352.  The MS OS/2 initialization process maintains the pass/fail return status for
  1353.  each device header in a device driver's header chain. Thus, the device
  1354.  driver should not manipulate the linkages in a chain of device driver
  1355.  headers.
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  See Also
  1361.  
  1362.  Command codes 02 (BuildBPB) and 10H (GenericIOCtl)
  1363.  
  1364.  
  1365.  █    MediaCheck
  1366.  ────────────────────────────────────────────────────────────────────────────
  1367.  
  1368.  
  1369.  +------------------------------+
  1370.  |   Request Header             |   13 BYTEs
  1371.  +------------------------------+
  1372.  |   Media_Descriptor           |   BYTE PTR ReqPak+0DH
  1373.  +------------------------------+
  1374.  |   Return_Code                |   BYTE PTR ReqPak+0EH
  1375.  +------------------------------+
  1376.  |   Ret_Ptr_Prev_Vol_ID        |   DWORD PTR ReqPak+0FH
  1377.  |      (if supported)          |
  1378.  +------------------------------+
  1379.  
  1380.  
  1381.  The MediaCheck request tells a block driver to determine the state of the
  1382.  media. The Command_Code value in the Request Header is 01.
  1383.  
  1384.  
  1385.  Comments
  1386.  
  1387.  On entry, the Media_Descriptor field of the request packet contains a code
  1388.  as input to the device driver.
  1389.  
  1390.  The following lists some examples of Media_Descriptor codes:
  1391.  
  1392.  Value                             Disk type
  1393.  ────────────────────────────────────────────────────────────────────────────
  1394.  
  1395.  F0H                               3.5-inch with 2 sides and 18 sectors per
  1396.                                    track.
  1397.  
  1398.  F8H                               Fixed.
  1399.  
  1400.  F9H                               3.5-inch with 2 sides and 9 sectors per
  1401.                                    track.
  1402.  
  1403.                                    5.25-inch with 2 sides and 15 sectors
  1404.                                    per track.
  1405.  
  1406.  FCH                               5.25-inch with 1 side and 9 sectors per
  1407.                                    track.
  1408.  
  1409.  FDH                               5.25-inch with 2 sides and 9 sectors per
  1410.                                    track
  1411.  
  1412.                                    8-inch with 2 sides and 26 sectors per
  1413.                                    track.
  1414.  
  1415.  FEH                               5.25-inch with 1 side and 8 sectors per
  1416.                                    track.
  1417.  
  1418.                                    8-inch with 1 side and 26 sectors per
  1419.                                    track.
  1420.  
  1421.                                    8-inch with 2 sides and 8 sectors per
  1422.                                    track.
  1423.  
  1424.  FFH                               5.25-inch with 2 sides and 8 sectors per
  1425.                                    track.
  1426.  
  1427.  If your driver supports removable media, it must set the Ret_Ptr_Prev_Vol_ID
  1428.  field to the previous volume ID.
  1429.  
  1430.  The device driver must set the Return_Code field to one of the following
  1431.  values:
  1432.  
  1433.  Value                             Meaning
  1434.  ────────────────────────────────────────────────────────────────────────────
  1435.  
  1436.  -1                                Media has been changed.
  1437.  
  1438.  0                                 Unsure whether media has been changed.
  1439.  
  1440.  1                                 Media is unchanged.
  1441.  
  1442.  In addition, the driver must do the following:
  1443.  
  1444.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  1445.        field of the Request Header if there is an error.
  1446.  
  1447.    ■   Set the done bit (8) in the Status field.
  1448.  
  1449.  
  1450.  The characteristics of 8-inch diskettes are as follows:
  1451.  
  1452.    ■   Media_Descriptor FDH is a double-sided, single-density diskette that
  1453.        is soft-sectored with 128 bytes per sector, 4 sectors per allocation
  1454.        unit, 4 reserved sectors, 2 FATs (file allocation tables), 68
  1455.        directory entries and 77*26*2 sectors.
  1456.  
  1457.    ■   Media_Descriptor FEH can be a single-sided, single-density diskette
  1458.        that is soft-sectored with 128 bytes per sector, 4 sectors per
  1459.        allocation unit, 1 reserved sector, 2 FATs, 68 directory entries, and
  1460.        77*26 sectors.
  1461.  
  1462.    ■   Media_Descriptor FEH can be a double-sided, double-density diskette
  1463.        that is soft-sectored with 1024 bytes per sector, 1 sector per
  1464.        allocation unit, 1 reserved sector, 2 FATs, 192 directory entries, and
  1465.        77*8*2 sectors.
  1466.  
  1467.  
  1468.  The device driver can support the IOCtl function DSK_GETDEVICEPARAMS
  1469.  (category 8, function 63) if application programmers are expected to
  1470.  determine the type of media by calling this IOCtl function and referencing
  1471.  the BPB (BIOS parameter block).
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  See Also
  1477.  
  1478.  Command codes 02 (BuildBPB) and 10H (GenericIOCtl)
  1479.  
  1480.  
  1481.  █    BuildBPB
  1482.  ────────────────────────────────────────────────────────────────────────────
  1483.  
  1484.  
  1485.  +-----------------------------+
  1486.  |   Request Header            |   13 BYTEs
  1487.  +-----------------------------+
  1488.  |   Media_Descriptor          |   BYTE PTR ReqPak+0DH
  1489.  +-----------------------------+
  1490.  |   Transfer_Address          |   DWORD PTR ReqPak+0EH
  1491.  +-----------------------------+
  1492.  |   Ptr_To_BPB_Table          |   DWORD PTR ReqPak+12H
  1493.  +-----------------------------+
  1494.  
  1495.  
  1496.  MS OS/2 issues the BuildBPB request in order to build the BPB (BIOS
  1497.  parameter block) when the media has changed or when the state of the media
  1498.  is uncertain. The Command_Code value in the Request Header is 02.
  1499.  
  1500.  
  1501.  Comments
  1502.  
  1503.  On entry, the Command-specific_Data area of the request packet contains the
  1504.  following fields as input to the device driver:
  1505.  
  1506.    ■   Media_Descriptor is set for the drive identified in the Request
  1507.        Header.
  1508.  
  1509.    ■   Transfer_Address is a virtual pointer to a buffer containing the data
  1510.        in sector 0. For DevLev_1 block drivers, this is the boot sector
  1511.        information for removable media or for the logical partition types 1,
  1512.        4, and 6. For DevLev_2 block drivers, this can be the boot sector
  1513.        information for removable media or for the logical partition types 1,
  1514.        4, and 6. However, DevLev_2 block drivers also support the logical
  1515.        partition type 7 of HPFS (High Performance File System), and the boot
  1516.        sector for this partition type need not be in sector 0.
  1517.  
  1518.  
  1519.  The device driver must do the following:
  1520.  
  1521.    ■   Determine the media type in the drive in order to set the
  1522.        Ptr_To_BPB_Table field.
  1523.  
  1524.    ■   Update the Media_Descriptor field.
  1525.  
  1526.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  1527.        field of the Request Header if there is an error.
  1528.  
  1529.    ■   Set the done bit (8) in the Status field.
  1530.  
  1531.  
  1532.  The driver determines the return value for Ptr_To_BPB_Table after reading
  1533.  the buffer to be sure that all BPB fields have values that are compatible
  1534.  with MS OS/2 versions 1.0 and 1.1. Otherwise, the driver should return an
  1535.  error.
  1536.  
  1537.  The driver should return error code 07H (Unknown media) if it cannot build
  1538.  the BPB because the buffer does not contain a boot sector with valid BPB
  1539.  field values.
  1540.  
  1541.  The BPB information for removable media and for logical partition types 1,
  1542.  4, and 6 is kept in the boot sector. The BPB information for logical
  1543.  partition type 7 is not necessarily in sector 0.
  1544.  
  1545.  The MS OS/2 version 1.2 BPB has the following layout:
  1546.  
  1547.  Length                            Field description
  1548.  ────────────────────────────────────────────────────────────────────────────
  1549.  
  1550.  word                              Number of bytes per sector─This field is
  1551.                                    at offset 0BH of the boot sector for
  1552.                                    removable media and for logical
  1553.                                    partition types 1, 4, and 6.
  1554.  
  1555.  byte                              Sectors per allocation unit─This field
  1556.                                    is always zero for partition-type 7
  1557.                                    media, and it must be a power of 2 for
  1558.                                    the other media.
  1559.  
  1560.  word                              Number of reserved sectors (starting at
  1561.                                    logical sector 0)─This field is always
  1562.                                    zero for partition-type 7 media and a
  1563.                                    nonnegative value for the other media.
  1564.  
  1565.  byte                              Number of FATs (file allocation
  1566.                                    tables)─This field is always zero for
  1567.                                    partition-type 7 media and a nonnegative
  1568.                                    value for other media.
  1569.  
  1570.  word                              Maximum number of root directory entries
  1571.                                    allowed─This field is always zero for
  1572.                                    partition-type 7 media and a nonnegative
  1573.                                    value for other media.
  1574.  
  1575.  word                              Total sectors in logical image (all
  1576.                                    media sectors, including boot sector,
  1577.                                    directories, etc.)─This field is always
  1578.                                    zero for partition-type 7 media and a
  1579.                                    nonnegative value for other media. When
  1580.                                    this field is zero, the last BPB field
  1581.                                    contains the total sector value for the
  1582.                                    logical drive.
  1583.  
  1584.  byte                              Media descriptor─This field is always
  1585.                                    zero for partition-type 7 media and a
  1586.                                    value in the range F0H to FFH for other
  1587.                                    media.
  1588.  
  1589.  word                              Number of sectors per FAT─This field is
  1590.                                    always zero for partition-type 7 media
  1591.                                    and a nonnegative value for other media.
  1592.  
  1593.  word                              Sectors per track.
  1594.  
  1595.  word                              Number of heads.
  1596.  
  1597.  dword                             Number of hidden sectors.
  1598.  
  1599.  dword                             Big total sectors─This field is a
  1600.                                    nonnegative value for partition-type 7
  1601.                                    media and zero for other media.
  1602.  
  1603.  6 bytes                           Reserved.
  1604.  
  1605.  Drivers that support volume identification and disk change should read a new
  1606.  volume identification off the disk in response to the BuildBPB request.
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  See Also
  1612.  
  1613.  Command codes 01 (MediaCheck), 04 (Read), 08 (Write), 09 (WriteVerify)
  1614.  
  1615.  
  1616.  █    Read
  1617.  ────────────────────────────────────────────────────────────────────────────
  1618.  
  1619.  
  1620.  +------------------------+
  1621.  |   Request Header       |   13 BYTEs
  1622.  +------------------------+
  1623.  |   Media_Descriptor     |   BYTE PTR ReqPak+0DH
  1624.  +------------------------+
  1625.  |   Transfer_Address     |   DWORD PTR ReqPak+0EH
  1626.  +------------------------+
  1627.  |   Byte_Or_Sector_Count |   WORD PTR ReqPak+12H
  1628.  +------------------------+
  1629.  |   Start_Sector_Num     |   DWORD PTR ReqPak+14H
  1630.  |     (block device)     |
  1631.  +------------------------+
  1632.  |   Sys_File_Num         |   WORD PTR ReqPak+18H
  1633.  +------------------------+                       -|   Advice_Code          |
  1634.  WORD PTR ReqPak+20H  | DevLev_2 block
  1635.  +------------------------+                       -- drivers only
  1636.  
  1637.  
  1638.  The Read request tells a driver to read from a device. The Command_Code
  1639.  value in the Request Header is 04.
  1640.  
  1641.  
  1642.  Comments
  1643.  
  1644.  On entry, the Command-specific_Data area of the request packet contains the
  1645.  following fields as input to the device driver:
  1646.  
  1647.    ■   Media_Descriptor is set for the drive identified in the Request
  1648.        Header, or it has zero for a character device.
  1649.  
  1650.    ■   Transfer_Address has the 32-bit physical address of the data buffer.
  1651.  
  1652.    ■   Byte_Or_Sector_Count has the number of bytes to transfer for character
  1653.        device drivers or the number of sectors to transfer for block device
  1654.        drivers.
  1655.  
  1656.    ■   Start_Sector_Num is set for where to begin the transfer on the block
  1657.        device. Character device drivers can ignore this field.
  1658.  
  1659.    ■   Sys_File_Num is set to a unique number associated with an OpenDevice
  1660.        request.
  1661.  
  1662.    ■   Advice_Code is set for DevLev_2 block drivers, but drivers that do not
  1663.        cache data can ignore this field.
  1664.  
  1665.  
  1666.  A DevLev_2 block driver that caches data can use the Advice_Code value to
  1667.  improve both its own I/O performance and the throughput of the whole system.
  1668.  Block drivers that cache data may ignore the least significant bit (bit 0)
  1669.  of the Advice_Code. Bit 1 of the Advice_Code is advisory, not mandatory. Bit
  1670.  1 advises the driver whether to read data into its cache. If bit 1 is set,
  1671.  this data is unlikely to be accessed again by the requesting process, so the
  1672.  driver need not cache this data.
  1673.  
  1674.  Advice_Code may be one of following values:
  1675.  
  1676.  Value                             Meaning
  1677.  ────────────────────────────────────────────────────────────────────────────
  1678.  
  1679.  0000                              The driver should read the data into its
  1680.                                    cache, if possible, because the
  1681.                                    requesting process might want access to
  1682.                                    this data again.
  1683.  
  1684.  0001                              The driver should read the data into its
  1685.                                    cache, if possible, because the
  1686.                                    requesting process might want access to
  1687.                                    this data again.
  1688.  
  1689.  0002                              The driver need not read the data into
  1690.                                    its cache, because the requesting
  1691.                                    process is unlikely to want access to
  1692.                                    this data again.
  1693.  
  1694.  0003                              The driver need not read the data into
  1695.                                    its cache, because the requesting
  1696.                                    process is unlikely to want access to
  1697.                                    this data again.
  1698.  
  1699.  Block drivers that support the partition-type 7 media of HPFS (High
  1700.  Performance File System) can improve their own and the system's I/O
  1701.  performance by not caching data. HPFS already caches the data read in by
  1702.  such a DevLev_2 driver if the requesting process is likely to access this
  1703.  data again.
  1704.  
  1705.  The device driver must do the following:
  1706.  
  1707.    ■   Perform the requested function.
  1708.  
  1709.    ■   Set the actual number of bytes (character drivers) or sectors (block
  1710.        drivers) transferred in the Byte_Or_Sector_Count field.
  1711.  
  1712.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  1713.        field of the Request Header if there is an error.
  1714.  
  1715.    ■   Set the done bit (8) in the Status field.
  1716.  
  1717.  
  1718.  Note that the Transfer_Address field on entry contains a locked 32-bit
  1719.  physical address. The device driver can call the PhysToVirt routine to
  1720.  convert this physical address into a selector:offset or segment:offset
  1721.  virtual address, according to the current operating mode. The driver need
  1722.  not unlock the address when it has completed the Read request. For more
  1723.  information about PhysToVirt, see Chapter 3, "Device Helper Services."
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  See Also
  1729.  
  1730.  Command codes 05 (NondestructiveReadNoWait), 08 (Write), 09 (WriteVerify),
  1731.  0DH (OpenDevice), 18H (NonCachingRead)
  1732.  
  1733.  
  1734.  █    NondestructiveReadNoWait
  1735.  ────────────────────────────────────────────────────────────────────────────
  1736.  
  1737.  
  1738.  +-----------------------------+
  1739.  |   Request Header            |   13 BYTEs
  1740.  +-----------------------------+
  1741.  |   Data_Returned             |   BYTE PTR ReqPak+0DH
  1742.  +-----------------------------+
  1743.  
  1744.  
  1745.  The NondestructiveReadNoWait request tells the driver to copy a character
  1746.  from the buffer. If no character is in the buffer, the driver returns the
  1747.  packet without waiting for an input character. The Command_Code value in the
  1748.  Request Header is 05.
  1749.  
  1750.  
  1751.  Comments
  1752.  
  1753.  If one or more characters are in the device driver's input buffer, the
  1754.  driver must do the following:
  1755.  
  1756.    ■   Copy the first character in the buffer and move the copy into the
  1757.        Data_Returned field of the request packet.
  1758.  
  1759.    ■   Clear the busy bit (9) in the Status field of the Request Header.
  1760.  
  1761.    ■   Set the done bit (8) in the Status field.
  1762.  
  1763.  
  1764.  This function allows MS OS/2 to look ahead one input character without
  1765.  blocking in the device driver.
  1766.  
  1767.  If no characters are in the buffer, the driver must do the following:
  1768.  
  1769.    ■   Set the busy bit (9) in the Status field of the Request Header.
  1770.  
  1771.    ■   Set the done bit (8) in the Status field.
  1772.  
  1773.  
  1774.  If the character driver finds an error, it must do the following:
  1775.  
  1776.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  1777.        field.
  1778.  
  1779.    ■   Set the done bit (8) in the Status field.
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  See Also
  1788.  
  1789.  Command code 04 (Read)
  1790.  
  1791.  
  1792.  █    InputStatus
  1793.  ────────────────────────────────────────────────────────────────────────────
  1794.  
  1795.  
  1796.  +-----------------------------+
  1797.  |     Request Header          |   13 BYTEs
  1798.  +-----------------------------+
  1799.  
  1800.  
  1801.  The InputStatus request tells a character driver to determine the input
  1802.  status on its device. The Command_Code value in the Request Header is 06.
  1803.  
  1804.  
  1805.  Comments
  1806.  
  1807.  The device driver must do the following:
  1808.  
  1809.    ■   Perform the requested function.
  1810.  
  1811.    ■   Set the busy bit (9) in the Status field of the Request Header if
  1812.        there are no characters currently in the driver's input buffer.
  1813.  
  1814.    ■   Clear the busy bit if there is at least one character currently in the
  1815.        driver's input buffer.
  1816.  
  1817.    ■   Set the done bit (8) in the Status field of the Request Header.
  1818.  
  1819.  
  1820.  If the driver returns the busy bit clear, indicating that it has one or more
  1821.  characters in the buffer, a read of one character should not need to block.
  1822.  
  1823.  A character driver that does not have an input buffer must do the following:
  1824.  
  1825.  
  1826.    ■   Clear the busy bit (9) in the Status field of the Request Header.
  1827.  
  1828.    ■   Set the done bit (8) in the Status field.
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  See Also
  1834.  
  1835.  Command codes 05 (NondestructiveReadNoWait), 0AH (OutputStatus)
  1836.  
  1837.  
  1838.  █    InputFlush
  1839.  ────────────────────────────────────────────────────────────────────────────
  1840.  
  1841.  
  1842.  +-----------------------------+
  1843.  |     Request Header          |    13 BYTEs
  1844.  +-----------------------------+
  1845.  
  1846.  
  1847.  The InputFlush request tells a character driver to terminate all pending
  1848.  input requests. The Command_Code value in the Request Header is 07.
  1849.  
  1850.  
  1851.  Comments
  1852.  
  1853.  The device driver must do the following:
  1854.  
  1855.    ■   Perform the requested function.
  1856.  
  1857.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  1858.        field of the Request Header if there is an error.
  1859.  
  1860.    ■   Set the done bit (8) in the Status field.
  1861.  
  1862.  
  1863.  InputFlush tells the device driver to terminate all known pending requests.
  1864.  Its primary use is to flush the input queue on character devices.
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  See Also
  1870.  
  1871.  Command code 0BH (OutputFlush)
  1872.  
  1873.  
  1874.  █    Write
  1875.  ────────────────────────────────────────────────────────────────────────────
  1876.  
  1877.  
  1878.  +------------------------+
  1879.  |   Request Header       |   13 BYTEs
  1880.  +------------------------+
  1881.  |   Media_Descriptor     |   BYTE PTR ReqPak+0DH
  1882.  +------------------------+
  1883.  |   Transfer_Address     |   DWORD PTR ReqPak+0EH
  1884.  +------------------------+
  1885.  |   Byte_Or_Sector_Count |   WORD PTR ReqPak+12H
  1886.  +------------------------+
  1887.  |   Start_Sector_Num     |   DWORD PTR ReqPak+14H
  1888.  |     (block device)     |
  1889.  +------------------------+
  1890.  |   Sys_File_Num         |   WORD PTR ReqPak+18H
  1891.  +------------------------+                       -|   Advice_Code          |
  1892.  WORD PTR ReqPak+20H  | DevLev_2 block
  1893.  +------------------------+                       -- drivers only
  1894.  
  1895.  
  1896.  The Write request tells the driver to write to the device. The Command_Code
  1897.  value in the Request Header is 08.
  1898.  
  1899.  
  1900.  Comments
  1901.  
  1902.  On entry, the Command-specific_Data area of the request packet contains the
  1903.  following fields as input to the device driver:
  1904.  
  1905.    ■   Media_Descriptor is set for the drive identified in the Request
  1906.        Header, or it has zero for a character device.
  1907.  
  1908.    ■   Transfer_Address has the 32-bit physical address of the buffer for the
  1909.        data.
  1910.  
  1911.    ■   Byte_Or_Sector_Count has the number of bytes to transfer for character
  1912.        device drivers or the number of sectors to transfer for block device
  1913.        drivers.
  1914.  
  1915.    ■   Start_Sector_Num is set for where to begin the transfer on the block
  1916.        device. Character device drivers can ignore this field.
  1917.  
  1918.    ■   Sys_File_Num is set to a unique number associated with an OpenDevice
  1919.        request.
  1920.  
  1921.    ■   Advice_Code is set for DevLev_2 block drivers, but drivers that do not
  1922.        cache data can ignore this field. Drivers that do not cache data must
  1923.        write all data to the device before returning the request packet
  1924.        (marked done) to the system.
  1925.  
  1926.  
  1927.  A DevLev_2 block driver that caches data can use the Advice_Code value to
  1928.  improve its own and the system's I/O performance, while maintaining the
  1929.  integrity of files on the device.
  1930.  
  1931.  DevLev_2 block drivers that cache data must obey the least significant bit
  1932.  (bit 0) of the Advice_Code. Bit 0 tells the driver whether to write all data
  1933.  out to the device before returning the request packet to the system. If bit
  1934.  0 is set, the device driver may not cache data to be written out later. Bit
  1935.  1 advises the driver whether to cache the data, if possible. Unlike bit 0,
  1936.  bit 1 is not mandatory. If bit 1 is set but bit 0 is clear, the driver may
  1937.  cache data to be written out to the device later.
  1938.  
  1939.  Advice_Code may be one of following values:
  1940.  
  1941.  Value                             Meaning
  1942.  ────────────────────────────────────────────────────────────────────────────
  1943.  
  1944.  0000                              The driver should copy the data into its
  1945.                                    cache, if possible, and write the data
  1946.                                    from the cache out to its device later.
  1947.  
  1948.  0001                              The driver must write all data to its
  1949.                                    device before returning the request
  1950.                                    packet (marked done) to the system, in
  1951.                                    order to maintain file integrity on the
  1952.                                    device. The driver should also copy the
  1953.                                    data into its cache, if possible.
  1954.  
  1955.  0002                              The driver need not copy the data into
  1956.                                    its cache, but it may do so and write
  1957.                                    the data from the cache out to its
  1958.                                    device later.
  1959.  
  1960.  0003                              The driver must write all data out to
  1961.                                    its device before returning the request
  1962.                                    packet (marked done) to the system, in
  1963.                                    order to maintain file integrity on the
  1964.                                    device. The driver need not copy the
  1965.                                    data into its cache, but it may do so.
  1966.  
  1967.  Block drivers that support the partition-type 7 media of HPFS (High
  1968.  Performance File System) can improve their own and the system's I/O
  1969.  performance by not caching data. HPFS already caches the data to be written
  1970.  out by such a DevLev_2 driver, so the driver can assume that every Write
  1971.  request has bit 0 of the Advice_Code set.
  1972.  
  1973.  The device driver must do the following:
  1974.  
  1975.    ■   Perform the requested function.
  1976.  
  1977.    ■   Set the actual number of bytes (character drivers) or sectors (block
  1978.        drivers) transferred in the Byte_Or_Sector_Count field.
  1979.  
  1980.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  1981.        field of the Request Header if there is an error.
  1982.  
  1983.    ■   Set the done bit (8) in the Status field.
  1984.  
  1985.  
  1986.  Note that the Transfer_Address field on entry contains a locked 32-bit
  1987.  physical address. The device driver can call the PhysToVirt routine to
  1988.  convert this physical address into a selector:offset or segment:offset
  1989.  virtual address, according to the current operating mode. The driver need
  1990.  not unlock the address when it has completed the Write request. For more
  1991.  information about PhysToVirt, see Chapter 3, "Device Helper Services."
  1992.  
  1993.  
  1994.  
  1995.  
  1996.  See Also
  1997.  
  1998.  Command codes 04 (Read), 09 (WriteVerify), 0DH (OpenDevice), 19H
  1999.  (NonCachingWrite)
  2000.  
  2001.  
  2002.  █    WriteVerify
  2003.  ────────────────────────────────────────────────────────────────────────────
  2004.  
  2005.  
  2006.  +------------------------+
  2007.  |   Request Header       |    13 BYTEs
  2008.  +------------------------+
  2009.  |   Media_Descriptor     |    BYTE PTR ReqPak+0DH
  2010.  +------------------------+
  2011.  |   Transfer_Address     |    DWORD PTR ReqPak+0EH
  2012.  +------------------------+
  2013.  |   Byte_Or_Sector_Count |    WORD PTR ReqPak+12H
  2014.  +------------------------+
  2015.  |   Start_Sector_Num     |    DWORD PTR ReqPak+14H
  2016.  |     (block device)     |
  2017.  +------------------------+
  2018.  |   Sys_File_Num         |    WORD PTR ReqPak+24H
  2019.  +------------------------+                       -|   Advice_Code          |
  2020.  WORD PTR ReqPak+20H  | DevLev_2 block
  2021.  +------------------------+                       --  drivers only
  2022.  
  2023.  
  2024.  The WriteVerify request tells the driver to write to the device and to
  2025.  verify the write. The Command_Code value in the Request Header is 09.
  2026.  
  2027.  
  2028.  Comments
  2029.  
  2030.  On entry, the Command-specific_Data area of the request packet contains the
  2031.  following fields as input to the device driver:
  2032.  
  2033.    ■   Media_Descriptor is set for the drive identified in the Request
  2034.        Header, or it has zero for a character device.
  2035.  
  2036.    ■   Transfer_Address has the 32-bit physical address of the data buffer.
  2037.  
  2038.    ■   Byte_Or_Sector_Count has the number of bytes to transfer for character
  2039.        device drivers or the number of sectors to transfer for block device
  2040.        drivers.
  2041.  
  2042.    ■   Start_Sector_Num is set for where to begin the transfer on the block
  2043.        device. Character device drivers can ignore this field.
  2044.  
  2045.    ■   Sys_File_Num is set to a unique number associated with an OpenDevice
  2046.        request.
  2047.  
  2048.    ■   Advice_Code is set for DevLev_2 block drivers, but drivers that do not
  2049.        cache data can ignore this field. Drivers that do not cache data must
  2050.        write all data to the device before returning the request packet
  2051.        (marked done) to the system.
  2052.  
  2053.  
  2054.  A DevLev_2 block driver that caches data can use the Advice_Code value to
  2055.  improve its own and the system's I/O performance, while maintaining the
  2056.  integrity of files on the device. DevLev_2 block drivers that cache data
  2057.  must obey the least significant bit (bit 0) of the Advice_Code. Bit 0 tells
  2058.  the driver whether to write all data out to the device before returning the
  2059.  request packet to the system. If bit 0 is set, the device driver may not
  2060.  cache data to be written out later. Bit 1 advises the driver whether to
  2061.  cache the data, if possible. Unlike bit 0, bit 1 is not mandatory. If bit 1
  2062.  is set but bit 0 is clear, the driver may cache data to be written out to
  2063.  the device later.
  2064.  
  2065.  Advice_Code may be one of following values:
  2066.  
  2067.  Value                             Meaning
  2068.  ────────────────────────────────────────────────────────────────────────────
  2069.  
  2070.  0000                              The driver should copy the data into its
  2071.                                    cache, if possible, and write the data
  2072.                                    from the cache out to its device later.
  2073.  
  2074.  0001                              The driver must write all data to its
  2075.                                    device before returning the request
  2076.                                    packet (marked done) to the system, in
  2077.                                    order to maintain file integrity on the
  2078.                                    device. The driver should also copy the
  2079.                                    data into its cache, if possible.
  2080.  
  2081.  0002                              The driver need not copy the data into
  2082.                                    its cache, but it may do so and write
  2083.                                    the data from the cache out to its
  2084.                                    device later.
  2085.  
  2086.  0003                              The driver must write all data out to
  2087.                                    its device before returning the request
  2088.                                    packet (marked done) to the system, in
  2089.                                    order to maintain file integrity on the
  2090.                                    device. The driver need not copy the
  2091.                                    data into its cache, but it may do so.
  2092.  
  2093.  Block drivers that support the partition-type 7 media of HPFS can improve
  2094.  their own and the system's I/O performance by not caching data. HPFS already
  2095.  caches the data to be written out by such a DevLev_2 driver, so the driver
  2096.  can assume that every Write request has bit 0 of the Advice_Code set.
  2097.  
  2098.  The device driver must do the following:
  2099.  
  2100.    ■   Perform the requested function.
  2101.  
  2102.    ■   Set the actual number of bytes (character drivers) or sectors (block
  2103.        drivers) transferred in the Byte_Or_Sector_Count field.
  2104.  
  2105.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  2106.        field of the Request Header if there is an error.
  2107.  
  2108.    ■   Set the done bit (8) in the Status field.
  2109.  
  2110.  
  2111.  Note that the Transfer_Address field on entry contains a locked 32-bit
  2112.  physical address. The device driver can call the PhysToVirt routine to
  2113.  convert this physical address into a selector:offset or segment:offset
  2114.  virtual address, according to the current operating mode. The driver need
  2115.  not unlock the address when it has completed the WriteVerify request. For
  2116.  more information about PhysToVirt, see Chapter 3, Device Helper Services.
  2117.  
  2118.  
  2119.  
  2120.  
  2121.  See Also
  2122.  
  2123.  Command codes 04 (Read), 08 (Write), 0DH (OpenDevice), 1AH
  2124.  (NonCachingWriteVerify)
  2125.  
  2126.  
  2127.  █    OutputStatus
  2128.  ────────────────────────────────────────────────────────────────────────────
  2129.  
  2130.  
  2131.  +-----------------------------+
  2132.  |     Request Header          |    13 BYTEs
  2133.  +-----------------------------+
  2134.  
  2135.  
  2136.  The OutputStatus request tells a character driver to determine the output
  2137.  status on its device. The Command_Code value in the Request Header is 0AH.
  2138.  
  2139.  
  2140.  Comments
  2141.  
  2142.  The device driver must do the following:
  2143.  
  2144.    ■   Perform the requested function.
  2145.  
  2146.    ■   Set the busy bit (9) in the Status field of the Request Header if an
  2147.        output request is currently active.
  2148.  
  2149.    ■   Clear the busy bit if no output request is currently active.
  2150.  
  2151.    ■   Set the done bit (8) in the Status field.
  2152.  
  2153.  
  2154.  If the driver returns the busy bit set, a subsequent write request to the
  2155.  device driver must wait for completion of a currently active request.
  2156.  
  2157.  If the driver returns the busy bit clear, a subsequent write request starts
  2158.  immediately.
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  See Also
  2164.  
  2165.  Command code 06 (InputStatus)
  2166.  
  2167.  
  2168.  █    OutputFlush
  2169.  ────────────────────────────────────────────────────────────────────────────
  2170.  
  2171.  
  2172.  +----------------------------+
  2173.  |    Request Header          |  13 BYTEs
  2174.  +----------------------------+
  2175.  
  2176.  
  2177.  The OutputFlush request tells a character driver to terminate pending output
  2178.  requests. The Command_Code value in the Request Header is 0BH.
  2179.  
  2180.  
  2181.  Comments
  2182.  
  2183.  The device driver must do the following:
  2184.  
  2185.    ■   Perform the requested function.
  2186.  
  2187.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  2188.        field of the Request Header if there is an error.
  2189.  
  2190.    ■   Set the done bit (8) in the Status field.
  2191.  
  2192.  
  2193.  OutputFlush tells the device driver to terminate all known pending requests.
  2194.  Its primary use is to flush the output queue on character devices.
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  See Also
  2200.  
  2201.  Command code 07 (InputFlush)
  2202.  
  2203.  
  2204.  █    OpenDevice
  2205.  ────────────────────────────────────────────────────────────────────────────
  2206.  
  2207.  
  2208.  +-----------------------------+
  2209.  |     Request Header          |    13 BYTEs
  2210.  +-----------------------------+
  2211.  |     Sys_File_Num            |    WORD PTR ReqPak+0DH
  2212.  +-----------------------------+
  2213.  
  2214.  
  2215.  The OpenDevice request tells a driver to open its device. The Command_Code
  2216.  value in the Request Header is 0DH.
  2217.  
  2218.  
  2219.  Comments
  2220.  
  2221.  The Sys_File_Num field contains a unique number assigned with this request.
  2222.  
  2223.  The device driver must do the following:
  2224.  
  2225.    ■   Perform the requested function.
  2226.  
  2227.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  2228.        field of the Request Header if there is an error.
  2229.  
  2230.    ■   Set the done bit (8) in the Status field.
  2231.  
  2232.  
  2233.  Character device drivers can use incoming OpenDevice and CloseDevice
  2234.  requests to coordinate use of their device with application I/O activity.
  2235.  
  2236.  For example, a character driver that increments a count at each OpenDevice
  2237.  request and decrements the count at each CloseDevice request might flush its
  2238.  input and output buffers whenever the count is zero. An OpenDevice request
  2239.  when the count is zero tells the driver to send an initialization string to
  2240.  the device; a CloseDevice request when the count is one tells the driver to
  2241.  decrement the count and flush its buffers.
  2242.  
  2243.  A printer driver could reset the font and page size on its device whenever
  2244.  it receives an OpenDevice request and send a form feed on receipt of the
  2245.  corresponding CloseDevice request. It can use the Sys_File_Num value to keep
  2246.  track of files.
  2247.  
  2248.  When an application calls the DosOpen or DosOpen2 function with a character
  2249.  driver's name, the driver gets a GenericIOCtl request packet for the IOCtl
  2250.  function PRT_ACTIVATEFONT (category 05, function 48H) before the driver gets
  2251.  the OpenDevice request packet. A printer driver should process the
  2252.  PRT_ACTIVATEFONT request, but drivers for other devices should dismiss the
  2253.  GenericIOCtl request, as follows:
  2254.  
  2255.    ■   Set the error bit (15) and set the error code to 03 (Unknown command)
  2256.        in the Status field of the Request Header.
  2257.  
  2258.    ■   Set the done bit (8) in the Status field.
  2259.  
  2260.  
  2261.  
  2262.  
  2263.  
  2264.  
  2265.  
  2266.  See Also
  2267.  
  2268.  Command codes 07 (InputFlush), 0BH (OutputFlush), 0EH (CloseDevice), 10H
  2269.  (GenericIOCtl)
  2270.  
  2271.  
  2272.  █    CloseDevice
  2273.  ────────────────────────────────────────────────────────────────────────────
  2274.  
  2275.  
  2276.  +-----------------------------+
  2277.  |     Request Header          |    13 BYTEs
  2278.  +-----------------------------+
  2279.  |     Sys_File_Num            |    WORD PTR ReqPak+0DH
  2280.  +-----------------------------+
  2281.  
  2282.  
  2283.  The CloseDevice request tells a driver close its device. The Command_Code
  2284.  value in the Request Header is 0EH.
  2285.  
  2286.  
  2287.  Comments
  2288.  
  2289.  The Sys_File_Num field contains a unique number associated with the
  2290.  corresponding OpenDevice request.
  2291.  
  2292.  The device driver must do the following:
  2293.  
  2294.    ■   Perform the requested function.
  2295.  
  2296.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  2297.        field of the Request Header if there is an error.
  2298.  
  2299.    ■   Set the done bit (8) in the Status field.
  2300.  
  2301.  
  2302.  Note that a printer driver can use the Sys_File_Num value to keep track of
  2303.  corresponding OpenDevice and CloseDevice requests when it has more than one
  2304.  pending OpenDevice request.
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  See Also
  2310.  
  2311.  Command code 0DH (OpenDevice)
  2312.  
  2313.  
  2314.  █    RemovableMedia
  2315.  ────────────────────────────────────────────────────────────────────────────
  2316.  
  2317.  
  2318.  +-----------------------------+
  2319.  |    Request Header           |     13 BYTEs
  2320.  +-----------------------------+
  2321.  
  2322.  
  2323.  The RemovableMedia tells a block driver to check for removable media. The
  2324.  Command_Code value in the Request Header is 0FH.
  2325.  
  2326.  
  2327.  Comments
  2328.  
  2329.  The device driver must do the following:
  2330.  
  2331.    ■   Set the busy bit (9) in the Status field of the Request Header if the
  2332.        media is nonremovable, or clear the busy bit if the media is
  2333.        removable.
  2334.  
  2335.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  2336.        field if there is an error.
  2337.  
  2338.    ■   Set the done bit (8) in the Status field.
  2339.  
  2340.  
  2341.  Note that the device driver receives this request packet when an application
  2342.  calls the IOCtl function DSK_BLOCKREMOVABLE (category 08, function 20H),
  2343.  rather than receiving a GenericIOCtl request packet (command code 10H).
  2344.  Nonremovable and removable drives may print different versions of certain
  2345.  prompts, so the application might need to know what kind of drive it is
  2346.  dealing with.
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  See Also
  2352.  
  2353.  Command code 10H (GenericIOCtl)
  2354.  
  2355.  
  2356.  █    GenericIOCtl
  2357.  ────────────────────────────────────────────────────────────────────────────
  2358.  
  2359.  
  2360.  +----------------------------+
  2361.  |   Request Header           |    13 BYTEs
  2362.  +----------------------------+
  2363.  |   IOCtl_Category           |    BYTE PTR ReqPak+0DH
  2364.  +----------------------------+
  2365.  |   IOCtl_Function_Code      |    BYTE PTR ReqPak+0EH
  2366.  +----------------------------+
  2367.  |   Ptr_To_Param_Buff        |    DWORD PTR ReqPak+0FH
  2368.  +----------------------------+
  2369.  |   Ptr_To_Data_Buff         |    DWORD PTR ReqPak+13H
  2370.  +----------------------------+
  2371.  |   Sys_File_Num             |    WORD PTR ReqPak+17H
  2372.  +----------------------------+                         -|   Param_Buff_Len
  2373.  |    WORD PTR ReqPak+19h   |  DevLev_2
  2374.  +----------------------------+                          |  drivers
  2375.  |   Data_Buff_Len            |    WORD PTR ReqPak+1BH   |  only
  2376.  +----------------------------+                         -
  2377.  
  2378.  
  2379.  The GenericIOCtl request tells the device driver to respond to an IOCtl
  2380.  function call. The Command_Code value in the Request Header is 10H.
  2381.  
  2382.  
  2383.  Comments
  2384.  
  2385.  On entry, the Command-specific_Data area of the request packet contains the
  2386.  following fields as input to the device driver:
  2387.  
  2388.    ■   IOCtl_Category has the category code.
  2389.  
  2390.    ■   IOCtl_Function_Code has the function code.
  2391.  
  2392.    ■   Ptr_To_Param_Buff is set as a protected-mode selector:offset or
  2393.        real-mode segment:offset pointer to the parameter buffer, if any. The
  2394.        virtual address is zero if the IOCtl function does not pass
  2395.        parameters.
  2396.  
  2397.    ■   Ptr_To_Data_Buff is set as a protected-mode selector:offset or
  2398.        real-mode segment:offset pointer to the data buffer, if any. The
  2399.        virtual address is zero if the IOCtl function does not pass access to
  2400.        data.
  2401.  
  2402.    ■   Sys_File_Num is set to a unique number associated with an OpenDevice
  2403.        request.
  2404.  
  2405.    ■   Param_Buff_Len is set to the number of bytes in the parameter buffer,
  2406.        if any. DevLev_2 drivers can use this value to be sure that the buffer
  2407.        contains all necessary parameters. Such a driver should stay within
  2408.        the bounds of the parameter buffer.
  2409.  
  2410.    ■   Data_Buff_Len is set to the number of bytes in the data buffer, if
  2411.        any. DevLev_2 drivers can use this value to be sure that no data was
  2412.        lost from the buffer. Such a driver should stay within the bounds of
  2413.        the data buffer.
  2414.  
  2415.  
  2416.  The device driver must do the following:
  2417.  
  2418.    ■   Check the validity of the Ptr_To_Param_Buff and Ptr_To_Data_Buff
  2419.        addresses, if the request packet contains application-supplied
  2420.        addresses. The system cannot verify the validity of user addresses
  2421.        passed in an IOCtl call, but the device driver can use the
  2422.        VerifyAccess routine to be sure that the application has proper access
  2423.        rights for these addresses.
  2424.  
  2425.    ■   Perform the requested IOCtl function.
  2426.  
  2427.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  2428.        field of the Request Header if there is an error.
  2429.  
  2430.    ■   Set the done bit (8) in the Status field.
  2431.  
  2432.  
  2433.  If the driver cannot perform the requested function immediately, it must do
  2434.  the following:
  2435.  
  2436.    ■   Call the Lock routine for the parameter and/or data pointer
  2437.        segment(s), then VerifyAccess to check the validity of these
  2438.        address(es).
  2439.  
  2440.    ■   Call the VirtToPhys routine with the parameter and/or data pointers to
  2441.        convert each virtual address into a 32-bit physical address if the
  2442.        driver requested a fixed-type lock.
  2443.  
  2444.    ■   Store any converted addresses in the driver's low-memory data segment.
  2445.  
  2446.    ■   Call the PhysToVirt routine to reconvert each stored address that the
  2447.        driver needs to use if the driver requested a fixed-type lock. This
  2448.        reconversion ensures that the correct virtual address is used for the
  2449.        current operating mode.
  2450.  
  2451.    ■   Call the UnLock routine for the parameter and/or data pointer
  2452.        segment(s) when the driver completes the IOCtl function.
  2453.  
  2454.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  2455.        field of the Request Header if there is an error.
  2456.  
  2457.    ■   Set the done bit (8) in the Status field of the Request Header.
  2458.  
  2459.  
  2460.  The driver must call Lock for a fixed-type lock on the parameter and data
  2461.  buffer segment(s) if it is necessary to call VirtToPhys to convert the
  2462.  pointers to physical addresses. Otherwise, it may call Lock for a
  2463.  short-term, verify-type lock on the segment(s). For more information about
  2464.  the Lock, PhysToVirt, Unlock, VerifyAccess, and VirtToPhys routines, see
  2465.  Chapter 3, "Device Helper Services."
  2466.  
  2467.  Note that a device driver may support some IOCtl functions that do not
  2468.  require MS OS/2 to pass parameters, data, or both. For these IOCtls, the
  2469.  incoming request packet will have zeros in the Ptr_To_Param_Buff field
  2470.  and/or the Ptr_To_Data_Buff field. If the driver determines that
  2471.  IOCtl_Function_Code indicates such an IOCtl, it can ignore the pointer
  2472.  fields of the incoming packet.
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  See Also
  2478.  
  2479.  Command codes 0DH (OpenDevice) and 0FH (RemovableMedia)
  2480.  
  2481.  
  2482.  █    ResetMedia
  2483.  ────────────────────────────────────────────────────────────────────────────
  2484.  
  2485.  
  2486.  +-----------------------------+
  2487.  |     Request Header          |    13 BYTEs
  2488.  +-----------------------------+
  2489.  
  2490.  
  2491.  The ResetMedia request tells a block driver to reset the Uncertain media
  2492.  error condition and allow MS OS/2 to identify the media. The Command_Code
  2493.  value in the Request Header is 11H.
  2494.  
  2495.  
  2496.  Comments
  2497.  
  2498.  On entry, the Block_Device_Unit_Code field in the Request Header identifies
  2499.  the unit number to be reset.
  2500.  
  2501.  This request occurs after the device driver returns an Uncertain media error
  2502.  code (10H) for a MediaCheck request or for some other request. An incoming
  2503.  ResetMedia informs the device driver that it need not return this error any
  2504.  longer. The device driver must do the following:
  2505.  
  2506.    ■   Reset the error condition for the drive.
  2507.  
  2508.    ■   Set the done bit (8) in the Status field of the Request Header.
  2509.  
  2510.  
  2511.  Note that a device driver for a fixed disk must begin in an uncertain-media
  2512.  state to have the media correctly labeled.
  2513.  
  2514.  
  2515.  
  2516.  
  2517.  See Also
  2518.  
  2519.  Command codes 00 (Init), 01 (MediaCheck)
  2520.  
  2521.  
  2522.  █    GetLogicalDriveMapping
  2523.  ────────────────────────────────────────────────────────────────────────────
  2524.  
  2525.  
  2526.  +-----------------------------+
  2527.  |    Request Header           |   13 BYTEs
  2528.  +-----------------------------+
  2529.  
  2530.  
  2531.  MS OS/2 issues the GetLogicalDriveMapping request to determine which logical
  2532.  drive is currently mapped to a particular physical unit. The Command_Code
  2533.  value in the Request Header is 12H.
  2534.  
  2535.  
  2536.  Comments
  2537.  
  2538.  On entry, the Request Header contains the following field as input to the
  2539.  device driver:
  2540.  
  2541.    ■   Block_Device_Unit_Code identifies the physical drive.
  2542.  
  2543.  
  2544.  The device driver must do the following:
  2545.  
  2546.    ■   Set the Block_Device_Unit_Code field to the logical drive that is
  2547.        mapped onto the physical drive if the driver has more than one logical
  2548.        drive mapped onto the given physical drive.
  2549.  
  2550.    ■   Clear the Block_Device_Unit_Code field if the driver has only one
  2551.        logical drive mapped onto the given physical drive.
  2552.  
  2553.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  2554.        field of the Request Header if there is an error.
  2555.  
  2556.    ■   Set the done bit (8) in the Status field.
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  See Also
  2565.  
  2566.  Command code 13H (SetLogicalDriveMapping)
  2567.  
  2568.  
  2569.  █    SetLogicalDriveMapping
  2570.  ────────────────────────────────────────────────────────────────────────────
  2571.  
  2572.  
  2573.  +-----------------------------+
  2574.  |    Request Header           |    13 BYTEs
  2575.  +-----------------------------+
  2576.  
  2577.  
  2578.  MS OS/2 issues the SetLogicalDriveMapping request to determine which
  2579.  physical unit is currently mapped to a particular logical drive. The
  2580.  Command_Code value in the Request Header is 13H.
  2581.  
  2582.  
  2583.  Comments
  2584.  
  2585.  On entry, the Request Header contains the following field as input to the
  2586.  device driver:
  2587.  
  2588.    ■   Block_Device_Unit_Code identifies the logical drive.
  2589.  
  2590.  
  2591.  The device driver must do the following:
  2592.  
  2593.    ■   Set the Block_Device_Unit_Code field to the physical drive that has
  2594.        the mapping for the logical drive.
  2595.  
  2596.    ■   Clear the Block_Device_Unit_Code field if there is only one logical
  2597.        drive mapped onto the physical drive.
  2598.  
  2599.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  2600.        field of the Request Header if there is an error.
  2601.  
  2602.    ■   Set the done bit (8) in the Status field.
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  See Also
  2611.  
  2612.  Command code 12H (GetLogicalDriveMapping)
  2613.  
  2614.  
  2615.  █    Deinstall
  2616.  ────────────────────────────────────────────────────────────────────────────
  2617.  
  2618.  
  2619.  +-----------------------------+
  2620.  |    Request Header           |    13 BYTEs
  2621.  +-----------------------------+
  2622.  
  2623.  
  2624.  The Deinstall request asks a character device driver to deinstall itself.
  2625.  The Command_Code value in the Request Header is 14H.
  2626.  
  2627.  
  2628.  Comments
  2629.  
  2630.  MS OS/2 uses the Device_Attribute and Name fields of the device driver
  2631.  header to determine if a newly loaded device driver is attempting to replace
  2632.  an already installed driver. If it is making such an attempt, the system
  2633.  sends a Deinstall request to the installed driver.
  2634.  
  2635.  The already installed device driver can refuse the request and prevent
  2636.  initialization of the new driver. If the driver will deinstall itself, it
  2637.  must do the following:
  2638.  
  2639.    ■   Release any physical memory that it has allocated.
  2640.  
  2641.    ■   Release any hardware interrupt level that it has claimed by calling
  2642.        the UnSetIRQ routine.
  2643.  
  2644.    ■   Make a jump to the previous ROM BIOS interrupt handler if the driver
  2645.        has a ROM BIOS software-interrupt handler. The driver cannot reset the
  2646.        vector.
  2647.  
  2648.    ■   Release any logical ID (LID) that it has claimed by calling the
  2649.        FreeLIDEntry routine if it is an ABIOS device driver. The driver must
  2650.        discontinue support of all units under the LID.
  2651.  
  2652.    ■   Perform any other cleanup that is necessary.
  2653.  
  2654.    ■   Clear the error bit (15) in the Status field of the Request Header to
  2655.        indicate a successful deinstallation.
  2656.  
  2657.    ■   Set the done bit (8) in the Status field.
  2658.  
  2659.  
  2660.  For more information about the FreeLIDEntry and UnSetIRQ routines, see
  2661.  Chapter 3, "Device Helper Services." If the already installed driver
  2662.  determines that it cannot or will not deinstall itself, it must do the
  2663.  following:
  2664.  
  2665.    ■   Set the error bit (15) and set the error code (bits 0 to 7) to 03
  2666.        (Unknown command) in the Status field.
  2667.  
  2668.    ■   Set the done bit (8) in the Status field.
  2669.  
  2670.  
  2671.  A driver that is already installed must refuse the Deinstall request if its
  2672.  device cannot be told to stop (or will not stop) generating interrupts. Such
  2673.  a driver must not remove its interrupt handler.
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  See Also
  2679.  
  2680.  Command code 00 (Init)
  2681.  
  2682.  
  2683.  █    PartitionableFixedDisks
  2684.  ────────────────────────────────────────────────────────────────────────────
  2685.  
  2686.  
  2687.  +-----------------------------+
  2688.  |    Request Header           |   13 BYTEs
  2689.  +-----------------------------+
  2690.  |    Count                    |   BYTE PTR ReqPak+0DH
  2691.  +-----------------------------+
  2692.  |    Reserved                 |   DWORD PTR ReqPak+0EH
  2693.  +-----------------------------+
  2694.  
  2695.  
  2696.  MS OS/2 issues the PartitionableFixedDisks request to get a count of how
  2697.  many partitionable fixed disks the device driver supports. The Command_Code
  2698.  value in the Request Header is 16H.
  2699.  
  2700.  
  2701.  Comments
  2702.  
  2703.  The disk driver must do the following:
  2704.  
  2705.    ■   Set the number of physical partitionable disks it supports in the
  2706.        Count field; the value must be one-based.
  2707.  
  2708.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  2709.        field of the Request Header if there is an error.
  2710.  
  2711.    ■   Set the done bit (8) in the Status field.
  2712.  
  2713.  
  2714.  The reserved dword in the request packet is zero. This value should be
  2715.  preserved.
  2716.  
  2717.  Note that MS OS/2 initiates a PartitionableFixedDisks request as a general
  2718.  query of the driver's device support. The driver returns only a count that
  2719.  is not tied to any particular unit it supports. This allows MS OS/2 to route
  2720.  applications' category 09 IOCtl requests to the correct device driver.
  2721.  
  2722.  
  2723.  
  2724.  
  2725.  See Also
  2726.  
  2727.  Command codes 10H (GenericIOCtl), 17H (GetFixedDisk/LogicalUnitMap)
  2728.  
  2729.  
  2730.  █    GetFixedDisk/LogicalUnitMap
  2731.  ────────────────────────────────────────────────────────────────────────────
  2732.  
  2733.  
  2734.  +-----------------------------------+
  2735.  |    Request Header                 |    13 BYTEs
  2736.  +-----------------------------------+
  2737.  |    Units-supported_Bit_Mask       |    DWORD PTR ReqPak+0DH
  2738.  +-----------------------------------+
  2739.  |    Reserved                       |    DWORD PTR ReqPak+0EH
  2740.  +-----------------------------------+
  2741.  
  2742.  
  2743.  MS OS/2 issues the GetFixedDisk/LogicalUnitMap request to determine which
  2744.  logical units on a given physical partitionable fixed disk are supported by
  2745.  the device driver. The Command_Code value in the Request Header is 17H.
  2746.  
  2747.  
  2748.  Comments
  2749.  
  2750.  On entry, the Request Header contains the following field as input to the
  2751.  device driver:
  2752.  
  2753.    ■   Block_Device_Unit_Code identifies a physical-disk number, not a
  2754.        logical-unit number. This value is zero-based and relative to the
  2755.        number of physical, partitionable fixed disks returned for a preceding
  2756.        PartitionableFixedDisks request.
  2757.  
  2758.  
  2759.  The reserved dword in the request packet is zero. This value should be
  2760.  preserved.
  2761.  
  2762.  The device driver must do the following:
  2763.  
  2764.    ■   Supply a mask in the Units-supported_Bit_Mask field to indicate which
  2765.        of its logical units (if any) exist on the given physical disk.
  2766.  
  2767.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  2768.        field of the Request Header if there is an error.
  2769.  
  2770.    ■   Set the done bit (8) in the Status field.
  2771.  
  2772.  
  2773.  The 4-byte bit mask has the following layout:
  2774.  
  2775.    ■   The least significant bit (bit 0 of the low-address byte) represents
  2776.        the first logical unit that the device driver supports. Bit 1 of the
  2777.        low-address byte represents the second logical unit that the driver
  2778.        supports, and so forth.
  2779.  
  2780.    ■   A cleared bit means that the logical unit does not exist on the given
  2781.        physical disk; a set bit means that it does.
  2782.  
  2783.  
  2784.  For example, suppose a driver supports five logical units spread over two
  2785.  diskette drives and one partitionable fixed disk. Its unit 0 and unit 1 map
  2786.  to the diskette drives while units 2, 3, and 4 map to the fixed disk. In
  2787.  response to a GetFixedDisk/LogicalUnitMap request, this device driver would
  2788.  set the bit mask to one of the following values:
  2789.  
  2790.          0000 0000 0000 0000 0000 0000 0001 1100B
  2791.          00 00 00 1CH
  2792.  
  2793.  
  2794.  All bits in the Units-supported_Bit_Mask field could be zero if the driver
  2795.  has no logical units on a given physical disk because it is not yet
  2796.  initialized.
  2797.  
  2798.  
  2799.  See Also
  2800.  
  2801.  Command code 16H (PartitionableFixedDisks)
  2802.  
  2803.  
  2804.  █    NonCachingRead
  2805.  ────────────────────────────────────────────────────────────────────────────
  2806.  
  2807.  
  2808.  +------------------------+
  2809.  |   Request Header       |   13 BYTEs
  2810.  +------------------------+
  2811.  |   Media_Descriptor     |   BYTE PTR ReqPak+0DH
  2812.  +------------------------+
  2813.  |   Transfer_Address     |   DWORD PTR ReqPak+0EH
  2814.  +------------------------+
  2815.  |   Sector_Count         |   WORD PTR ReqPak+12H
  2816.  +------------------------+
  2817.  |   Start_Sector_Num     |   DWORD PTR ReqPak+14H
  2818.  +------------------------+
  2819.  |   Sys_File_Num         |   WORD PTR ReqPak+18H
  2820.  +------------------------+
  2821.  
  2822.  
  2823.  The NonCachingRead request tells a block driver to read data directly from
  2824.  the device and to bypass the disk cache. The Command_Code value in the
  2825.  Request Header is 18H.
  2826.  
  2827.  
  2828.  Comments
  2829.  
  2830.  On entry, the Command-specific_Data area of the request packet contains the
  2831.  following fields as input to the device driver:
  2832.  
  2833.    ■   Media_Descriptor is set for the drive identified in the Request
  2834.        Header.
  2835.  
  2836.    ■   Transfer_Address has the 32-bit physical address of the data buffer.
  2837.  
  2838.    ■   Sector_Count has the number of sectors to transfer.
  2839.  
  2840.    ■   Start_Sector_Num is set for where to begin the transfer on the device.
  2841.  
  2842.    ■   Sys_File_Num is set to a unique number associated with an OpenDevice
  2843.        request.
  2844.  
  2845.  
  2846.  The device driver must do the following:
  2847.  
  2848.    ■   Perform the requested function.
  2849.  
  2850.    ■   Set the actual number of sectors transferred in the Sector_Count
  2851.        field.
  2852.  
  2853.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  2854.        field of the Request Header if there is an error.
  2855.  
  2856.    ■   Set the done bit (8) in the Status field.
  2857.  
  2858.  
  2859.  Note that the Transfer_Address field on entry contains a locked 32-bit
  2860.  physical address. The device driver can call the PhysToVirt routine to
  2861.  convert this physical address into a selector:offset or segment:offset
  2862.  virtual address, according to the current operating mode. The driver need
  2863.  not unlock the address when it has completed the NonCachingRead request. For
  2864.  more information about PhysToVirt, see Chapter 3, "Device Helper Services."
  2865.  
  2866.  
  2867.  See Also
  2868.  
  2869.  Command codes 04 (Read), 19H (NonCachingWrite), 1AH (NonCachingWriteVerify),
  2870.  0DH (OpenDevice)
  2871.  
  2872.  
  2873.  █    NonCachingWrite
  2874.  ────────────────────────────────────────────────────────────────────────────
  2875.  
  2876.  
  2877.  +------------------------+
  2878.  |   Request Header       |   13 BYTEs
  2879.  +------------------------+
  2880.  |   Media_Descriptor     |   BYTE PTR ReqPak+0DH
  2881.  +------------------------+
  2882.  |   Transfer_Address     |   DWORD PTR ReqPak+0EH
  2883.  +------------------------+
  2884.  |   Sector_Count         |   WORD PTR ReqPak+12H
  2885.  +------------------------+
  2886.  |   Start_Sector_Num     |   DWORD PTR ReqPak+14H
  2887.  +------------------------+
  2888.  |   Sys_File_Num         |   WORD PTR ReqPak+18H
  2889.  +------------------------+
  2890.  
  2891.  
  2892.  The NonCachingWrite request tells a block driver to to write data directly
  2893.  to the device and to bypass the disk cache. The Command_Code value in the
  2894.  Request Header is 19H.
  2895.  
  2896.  
  2897.  Comments
  2898.  
  2899.  On entry, the Command-specific_Data area of the request packet contains the
  2900.  following fields as input to the device driver:
  2901.  
  2902.    ■   Media_Descriptor is set for the drive identified in the Request
  2903.        Header.
  2904.  
  2905.    ■   Transfer_Address has the 32-bit physical address of the data buffer.
  2906.  
  2907.    ■   Sector_Count has the number of sectors to transfer.
  2908.  
  2909.    ■   Start_Sector_Num is set for where to begin the transfer on the device.
  2910.  
  2911.    ■   Sys_File_Num is set to a unique number associated with an OpenDevice
  2912.        request.
  2913.  
  2914.  
  2915.  The device driver must do the following:
  2916.  
  2917.    ■   Perform the requested function.
  2918.  
  2919.    ■   Set the actual number of sectors transferred in the Sector_Count
  2920.        field.
  2921.  
  2922.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  2923.        field of the Request Header if there is an error.
  2924.  
  2925.    ■   Set the done bit (8) in the Status field.
  2926.  
  2927.  
  2928.  Note that the Transfer_Address field on entry contains a locked 32-bit
  2929.  physical address. The device driver can call the PhysToVirt routine to
  2930.  convert this physical address into a selector:offset or segment:offset
  2931.  virtual address, according to the current operating mode. The driver need
  2932.  not unlock the address when it has completed the NonCachingWrite request.
  2933.  For more information about PhysToVirt, see Chapter 3, "Device Helper
  2934.  Services."
  2935.  
  2936.  
  2937.  See Also
  2938.  
  2939.  Command codes 08 (Write), 18H (NonCachingRead), 1AH (NonCachingWriteVerify),
  2940.  0DH (OpenDevice)
  2941.  
  2942.  
  2943.  █    NonCachingWriteVerify
  2944.  ────────────────────────────────────────────────────────────────────────────
  2945.  
  2946.  
  2947.  +------------------------+
  2948.  |   Request Header       |   13 BYTEs
  2949.  +------------------------+
  2950.  |   Media_Descriptor     |   BYTE PTR ReqPak+0DH
  2951.  +------------------------+
  2952.  |   Transfer_Address     |   DWORD PTR ReqPak+0EH
  2953.  +------------------------+
  2954.  |   Sector_Count         |   WORD PTR ReqPak+12H
  2955.  +------------------------+
  2956.  |   Start_Sector_Num     |   DWORD PTR ReqPak+14H
  2957.  +------------------------+
  2958.  |   Sys_File_Num         |   WORD PTR ReqPak+18H
  2959.  +------------------------+
  2960.  
  2961.  
  2962.  The NonCachingWriteVerify request tells a block driver to write data
  2963.  directly to the device, to bypass the disk cache, and to verify the write.
  2964.  The Command_Code value in the Request Header is 1AH.
  2965.  
  2966.  
  2967.  Comments
  2968.  
  2969.  On entry, the Command-specific_Data area of the request packet contains the
  2970.  following fields as input to the device driver:
  2971.  
  2972.    ■   Media_Descriptor is set for the drive identified in the Request
  2973.        Header.
  2974.  
  2975.    ■   Transfer_Address has the 32-bit physical address of the data buffer.
  2976.  
  2977.    ■   Sector_Count has the number of sectors to transfer.
  2978.  
  2979.    ■   Start_Sector_Num is set for where to begin the transfer on the device.
  2980.  
  2981.    ■   Sys_File_Num is set to a unique number associated with an OpenDevice
  2982.        request.
  2983.  
  2984.  
  2985.  The device driver must do the following:
  2986.  
  2987.    ■   Perform the requested function.
  2988.  
  2989.    ■   Set the actual number of sectors transferred in the Sector_Count
  2990.        field.
  2991.  
  2992.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  2993.        field of the Request Header if there is an error.
  2994.  
  2995.    ■   Set the done bit (8) in the Status field.
  2996.  
  2997.  
  2998.  Note that the Transfer_Address field on entry contains a locked 32-bit
  2999.  physical address. The device driver can call the PhysToVirt routine to
  3000.  convert this physical address into a selector:offset or segment:offset
  3001.  virtual address, according to the current operating mode. The driver need
  3002.  not unlock the address when it has completed the NonCachingWriteVerify
  3003.  request. For more information about PhysToVirt, see Chapter 3, "Device
  3004.  Helper Services."
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  See Also
  3010.  
  3011.  Command codes 09 (WriteVerify), 18H (NonCachingRead), 19H (NonCachingWrite),
  3012.  0DH (OpenDevice)
  3013.  
  3014.  
  3015.  █    PrepareForSysShutdown
  3016.  ────────────────────────────────────────────────────────────────────────────
  3017.  
  3018.  
  3019.  +-----------------------------+
  3020.  |   Request Header            |    13 BYTEs
  3021.  +-----------------------------+
  3022.  |   Sub_Req_Code              |    BYTE PTR ReqPak+0DH
  3023.  +-----------------------------+
  3024.  |   Reserved                  |    DWORD PTR ReqPak+0EH
  3025.  +-----------------------------+
  3026.  
  3027.  
  3028.  The PrepareForSysShutdown command tells a device driver that it should
  3029.  transfer buffered data to a storage device before the system powers down.
  3030.  The Command_Code value in the Request Header is 1CH.
  3031.  
  3032.  
  3033.  Comments
  3034.  
  3035.  On entry, the Sub_Req_Code of the request packet contains one of the
  3036.  following values as input to any device driver that transfers buffered data
  3037.  to a long-term storage device:
  3038.  
  3039.  Value                             Means
  3040.  ────────────────────────────────────────────────────────────────────────────
  3041.  
  3042.  0                                 Beginning shutdown.
  3043.  
  3044.  1                                 Shutdown completing.
  3045.  
  3046.  The driver should respond to the beginning-shutdown request by getting
  3047.  itself ready to handle the shutdown-completing request and setting the done
  3048.  bit (8) in the Status word of the Request Header when it has. Only drivers
  3049.  that transfer buffered data to long-term storage devices must ready
  3050.  themselves to flush data to the device. Other drivers should do the
  3051.  following:
  3052.  
  3053.    ■   Set the error bit (15) and set the error code (bits 0 to 7) to 03
  3054.        (Unknown command) in the Status field of the request header.
  3055.  
  3056.    ■   Set the done bit (8) in the Status field.
  3057.  
  3058.  
  3059.  Drivers that transfer buffered data to long-term storage devices should
  3060.  respond to the shutdown-completing request as follows:
  3061.  
  3062.    ■   Flush buffered writes to the storage media. Only data that must be
  3063.        preserved across power downs need be flushed.
  3064.  
  3065.    ■   Set the error bit (15) and error code (bits 0 to 7) in the Status
  3066.        field of the Request Header if there is an error.
  3067.  
  3068.    ■   Set the done bit (8) in the Status field.
  3069.  
  3070.  
  3071.  For all its devices that save data across power downs, the device driver
  3072.  should return from this request with the write buffers flushed. After the
  3073.  driver receives this request, it should also do the following:
  3074.  
  3075.    ■   Process any subsequent write requests synchronously.
  3076.  
  3077.    ■   Do not carry out any operation that could block permanently.
  3078.  
  3079.    ■   Otherwise, continue to perform normally.
  3080.  
  3081.  
  3082.  Drivers that buffer data to non-saving devices should not flush their
  3083.  buffers. In particular, a driver should not carry out any operation that
  3084.  might block permanently, such as flushing to a com port. Drivers that do not
  3085.  buffer data to long-term storage devices should do the following:
  3086.  
  3087.    ■   Set the error bit (15) and set the error code (bits 0 to 7) to 03
  3088.        (Unknown command) in the Status field of the request header.
  3089.  
  3090.    ■   Set the done bit (8) in the Status field.
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  Chapter 3  Device Helper Services
  3101.  ────────────────────────────────────────────────────────────────────────────
  3102.  
  3103.  
  3104.  
  3105.  
  3106.  3.1  Device Helper Services
  3107.  
  3108.  An MS OS/2 device driver needs to do both system-level and hardware-specific
  3109.  operations. Therefore, the DevHlp interface to operating system services is
  3110.  available for device drivers.
  3111.  
  3112.  DevHlp services are available in the following categories:
  3113.  
  3114.  Category                          Routines
  3115.  ────────────────────────────────────────────────────────────────────────────
  3116.  
  3117.  System-clock management           SchedClockAddr
  3118.  
  3119.  Process management                Block, DevDone, Run, TCYield, Yield
  3120.  
  3121.  Semaphore management              SemClear, SemHandle, SemRequest
  3122.  
  3123.  Request-queue management          AllocReqPacket, FreeReqPacket,
  3124.                                    PullParticular, PullReqPacket,
  3125.                                    PushReqPacket, SortReqPacket
  3126.  
  3127.  Character-queue management        QueueFlush, QueueInit, QueueRead,
  3128.                                    QueueWrite
  3129.  
  3130.  Memory management                 AllocateGDTSelector, AllocPhys, FreePhys,
  3131.                                    Lock, PhysToGDTSelector, PhysToUVirt,
  3132.                                    PhysToVirt, Unlock, UnPhysToVirt,
  3133.                                    VerifyAccess, VirtToPhys
  3134.  
  3135.  Interrupt management              EOI, RegisterStackUsage, SetIRQ,
  3136.                                    SetROMVector, UnSetIRQ
  3137.  
  3138.  Timer services                    ResetTimer, SetTimer, TickCount
  3139.  
  3140.  Processor-mode services           ProtToReal, RealToProt
  3141.  
  3142.  Monitor management                DeRegister, MonFlush, MonitorCreate,
  3143.                                    MonWrite, Register
  3144.  
  3145.  System services                   ABIOSCall, ABIOSCommonEntry, AttachDD,
  3146.                                    FreeLIDEntry, GetDosVar, GetLIDEntry,
  3147.                                    LogEntry, ROMCritSection, SendEvent
  3148.  
  3149.  Access to these system services is obtained at device driver initialization.
  3150.  The request packet for the Init command contains a bimodal pointer to the
  3151.  DevHlp interface. Because the pointer is bimodal, the device driver can
  3152.  request DevHlp services without being sensitive to whether the current
  3153.  operating mode is protected or real.
  3154.  
  3155.  The device driver calls a service by setting up the appropriate registers,
  3156.  loading a function code into the dl register, and making a far call to the
  3157.  DevHlp interface routine, whose address was supplied at device
  3158.  initialization time.
  3159.  
  3160.  Table 3.1 lists in numeric order the DevHlp function codes, the
  3161.  corresponding services, and a short description of each service.
  3162.  <TT>Function Codes for DevHlp Services" ""</TT>
  3163.  
  3164.  Code                              DevHlp      Description
  3165.                                    service
  3166.  ────────────────────────────────────────────────────────────────────────────
  3167.  
  3168.  00                                SchedClock  Gets address of system's
  3169.                                    Addr        clock-tick handler.
  3170.  
  3171.  01                                DevDone     Signals that device I/O is
  3172.                                                complete.
  3173.  
  3174.  02                                Yield       Yields the CPU.
  3175.  
  3176.  03                                TCYield     Yields the CPU to a
  3177.                                                time-critical thread.
  3178.  
  3179.  04                                Block       Blocks a thread from running.
  3180.  
  3181.  05                                Run         Releases a blocked thread.
  3182.  
  3183.  06                                SemRequest  Requests a semaphore.
  3184.  
  3185.  07                                SemClear    Releases a semaphore.
  3186.  
  3187.  08                                SemHandle   Gets a semaphore handle.
  3188.  
  3189.  09                                PushReqPac  Pushes a request packet onto
  3190.                                    ket         a queue.
  3191.  
  3192.  0AH                               PullReqPac  Pulls a request packet from
  3193.                                    ket         a queue.
  3194.  
  3195.  0BH                               PullPartic  Pulls a specific request
  3196.                                    ular        packet from a queue.
  3197.  
  3198.  0CH                               SortReqPac  Inserts a request packet in
  3199.                                    ket         sorted order.
  3200.  
  3201.  0DH                               AllocReqPa  Allocates a request packet.
  3202.                                    cket
  3203.  
  3204.  0EH                               FreeReqPac  Frees an allocated request
  3205.                                    ket         packet.
  3206.  
  3207.  0FH                               QueueInit   Initializes a character
  3208.                                                queue.
  3209.  
  3210.  10H                               QueueFlush  Flushes a character queue.
  3211.  
  3212.  11H                               QueueWrite  Inserts a character in a
  3213.                                                queue.
  3214.  
  3215.  12H                               QueueRead   Reads a character from a
  3216.                                                queue.
  3217.  
  3218.  13H                               Lock        Locks a memory segment.
  3219.  
  3220.  14H                               Unlock      Unlocks a memory segment.
  3221.  
  3222.  15H                               PhysToVirt  Maps a physical address to a
  3223.                                                virtual address.
  3224.  
  3225.  16H                               VirtToPhys  Maps a virtual address to a
  3226.                                                physical address.
  3227.  
  3228.  17H                               PhysToUVir  Maps a physical address to a
  3229.                                    t           user virtual address.
  3230.  
  3231.  18H                               AllocPhys   Allocates a physical memory
  3232.                                                block.
  3233.  
  3234.  19H                               FreePhys    Frees a physical memory
  3235.                                                block.
  3236.  
  3237.  1AH                               SetROMVect  Sets a ROM BIOS interrupt
  3238.                                    or          handler.
  3239.  
  3240.  1BH                               SetIRQ      Sets a hardware-interrupt
  3241.                                                handler.
  3242.  
  3243.  1CH                               UnSetIRQ    Resets a hardware-interrupt
  3244.                                                handler.
  3245.  
  3246.  1DH                               SetTimer    Sets a timer handler.
  3247.  
  3248.  1EH                               ResetTimer  Resets a timer handler.
  3249.  
  3250.  1FH                               MonitorCre  Creates a monitor.
  3251.                                    ate
  3252.  
  3253.  20H                               Register    Registers a monitor.
  3254.  
  3255.  21H                               DeRegister  Deregisters a monitor.
  3256.  
  3257.  22H                               MonWrite    Writes data records to a
  3258.                                                monitor.
  3259.  
  3260.  23H                               MonFlush    Flushes data from a monitor
  3261.                                                stream. ,
  3262.  
  3263.  24H                               GetDosVar   Gets a pointer to a DOS
  3264.                                                variable.
  3265.  
  3266.  25H                               SendEvent   Sends an event.
  3267.  
  3268.  26H                               ROMCritSec  Flags a critical section of
  3269.                                    tion        execution.
  3270.  
  3271.  27H                               VerifyAcce  Verifies memory access.
  3272.                                    ss
  3273.  
  3274.  2AH                               AttachDD    Attaches to another device
  3275.                                                driver.
  3276.  
  3277.  2DH                               AllocGDTSe  Allocates a set of GDT
  3278.                                    lector      selectors.
  3279.  
  3280.  2EH                               PhysToGDTS  Converts a physical address
  3281.                                    elector     to a GDT selector.
  3282.  
  3283.  2FH                               RealToProt  Changes from real to
  3284.                                                protected mode.
  3285.  
  3286.  30H                               ProtToReal  Changes from protected to
  3287.                                                real mode.
  3288.  
  3289.  31H                               EOI         Issues an end-of-interrupt.
  3290.  
  3291.  32H                               UnPhysToVi  Marks completion of virtual
  3292.                                    rt          address use.
  3293.  
  3294.  33H                               TickCount   Modifies a timer.
  3295.  
  3296.  34H                               GetLIDEntr  Gets a logical ID.
  3297.                                    y
  3298.  
  3299.  35H                               FreeLIDEnt  Releases a logical ID.
  3300.                                    ry
  3301.  
  3302.  36H                               ABIOSCall   Calls an ABIOS service.
  3303.  
  3304.  37H                               ABIOSCommo  Calls an ABIOS common entry
  3305.                                    nEntry      point.
  3306.  
  3307.  3AH                               RegisterSt  Registers a device driver's
  3308.                                    ackUsage    stack usage.
  3309.  
  3310.  3BH                               LogEntry    Places data in the system
  3311.                                                error-log buffer.
  3312.  
  3313.  3CH                               VideoPause  Suspends or resumes video
  3314.                                                DMA transfers.
  3315.  
  3316.  3DH                               DispMsg     Displays a message from a
  3317.                                                device driver after
  3318.                                                initialization.
  3319.  
  3320.  At any given moment, device driver code runs in one of four contexts:
  3321.  
  3322.    ■   Kernel mode─the context in which the device driver's strategy routine
  3323.        runs.
  3324.  
  3325.    ■   Interrupt mode─the context in which the device driver's
  3326.        hardware-interrupt handler runs.
  3327.  
  3328.    ■   User mode─the context in which the device driver's handler for a
  3329.        real-mode ROM BIOS interrupt runs.
  3330.  
  3331.    ■   Initialization mode─the context in which the device driver's strategy
  3332.        routine runs when it is called by the Init request packet.
  3333.  
  3334.  
  3335.  Certain restrictions apply to when individual DevHlp services may be used.
  3336.  Table 3.2 summarizes these restrictions for the DevHlp routines, listed in
  3337.  alphabetic order. For each routine, a valid context can be one or more of
  3338.  the following: kernel (KNL), interrupt (ITR), user (USR), or initialization
  3339.  (INI). <TT>DevHlp Services and Corresponding States" ""</TT>
  3340.  
  3341.  DevHlp service                    Code        Valid in context
  3342.  ────────────────────────────────────────────────────────────────────────────
  3343.  
  3344.  ABIOSCall                         36H         KNL, ITR, USR, INI
  3345.  
  3346.  ABIOSCommonEntry                  37H         KNL, ITR, USR, INI
  3347.  
  3348.  AllocGDTSelector                  2DH         INI
  3349.  
  3350.  AllocPhys                         18H         KNL, INI
  3351.  
  3352.  AllocReqPacket                    0DH         KNL
  3353.  
  3354.  AttachDD                          2AH         KNL, INI
  3355.  
  3356.  Block                             04          KNL, USR
  3357.  
  3358.  DeRegister                        21H         KNL
  3359.  
  3360.  DevDone                           01          KNL, ITR
  3361.  
  3362.  DispMsg                           3DH         INI
  3363.  
  3364.  EOI                               31H         ITR, INI
  3365.  
  3366.  FreeLIDEntry                      35H         KNL, INI
  3367.  
  3368.  FreePhys                          19H         KNL, INI
  3369.  
  3370.  FreeReqPacket                     0EH         KNL
  3371.  
  3372.  GetDosVar                         24H         KNL, INI
  3373.  
  3374.  GetLIDEntry                       34H         KNL, INI
  3375.  
  3376.  Lock                              13H         KNL, INI
  3377.  
  3378.  LogEntry                          39H         KNL, ITR, USR
  3379.  
  3380.  MonFlush                          23H         KNL
  3381.  
  3382.  MonitorCreate                     1FH         KNL, INI
  3383.  
  3384.  MonWrite                          22H         KNL, ITR, USR
  3385.  
  3386.  PhysToGDTSelector                 2EH         KNL, ITR, USR, INI
  3387.  
  3388.  PhysToUVirt                       17H         KNL, INI
  3389.  
  3390.  PhysToVirt                        15H         KNL, ITR, INI
  3391.  
  3392.  ProtToReal                        30H         ITR
  3393.  
  3394.  PullParticular                    0BH         KNL, ITR
  3395.  
  3396.  PullReqPacket                     0AH         KNL, ITR
  3397.  
  3398.  PushReqPacket                     09          KNL
  3399.  
  3400.  QueueFlush                        10H         KNL, ITR, USR
  3401.  
  3402.  QueueInit                         0FH         KNL, ITR, USR, INI
  3403.  
  3404.  QueueRead                         12H         KNL, ITR, USR
  3405.  
  3406.  QueueWrite                        11H         KNL, ITR, USR
  3407.  
  3408.  RealToProt                        2FH         ITR
  3409.  
  3410.  Register                          20H         KNL
  3411.  
  3412.  RegisterStackUsage                3AH         INI
  3413.  
  3414.  ResetTimer                        1EH         KNL, ITR, INI
  3415.  
  3416.  ROMCritSection                    26H         USR
  3417.  
  3418.  Run                               05          KNL, ITR, USR
  3419.  
  3420.  SchedClockAddr                    00          INI
  3421.  
  3422.  SemClear                          07          KNL, ITR, USR
  3423.  
  3424.  SemHandle                         08          KNL, ITR
  3425.  
  3426.  SemRequest                        06          KNL, USR
  3427.  
  3428.  SendEvent                         25H         KNL, ITR
  3429.  
  3430.  SetIRQ                            1BH         KNL, INI
  3431.  
  3432.  SetROMVector                      1AH         KNL, INI
  3433.  
  3434.  SetTimer                          1DH         KNL, INI
  3435.  
  3436.  SortReqPacket                     0CH         KNL
  3437.  
  3438.  TCYield                           03          KNL
  3439.  
  3440.  TickCount                         33H         KNL, ITR, USR, INI
  3441.  
  3442.  Unlock                            14H         KNL, INI
  3443.  
  3444.  UnPhysToVirt                      32H         KNL, ITR, INI
  3445.  
  3446.  UnSetIRQ                          1CH         KNL, ITR, INI
  3447.  
  3448.  VerifyAccess                      27H         KNL
  3449.  
  3450.  VideoPause                        3CH         KNL, ITR, INI
  3451.  
  3452.  VirtToPhys                        16H         KNL, INI
  3453.  
  3454.  Yield                             02          KNL
  3455.  
  3456.  
  3457.  
  3458.  3.2  Using DevHlp Routines
  3459.  
  3460.  Your device driver calls a DevHlp routine by setting up the appropriate
  3461.  registers, loading the appropriate function code into the dl register, and
  3462.  making a far call to the DevHlp interface routine.
  3463.  
  3464.  In addition to the return values for each routine, the interrupt and carry
  3465.  flags can be set or cleared by some routines. Other flags can also be
  3466.  affected by the calls. Some routines require that the interrupt flag be
  3467.  clear (interrupts disabled) when they are called.
  3468.  
  3469.  For your device driver, you can assume the following:
  3470.  
  3471.    ■   All registers except flags are preserved across DevHlp calls unless
  3472.        they contain return parameters.
  3473.  
  3474.    ■   A DevHlp routine will preserve the state of the interrupt flag and
  3475.        will not enable interrupts unless explicitly stated otherwise in the
  3476.        functional description of the routine.
  3477.  
  3478.  
  3479.  A functional description follows for each DevHlp routine, in alphabetic
  3480.  order. The assembly code example for each routine loads specific registers
  3481.  with named parameters. However, these names are metasymbols rather than
  3482.  names that you must use for the parameters your driver passes to the DevHlp
  3483.  routines. The Parameters section for each routine defines each parameter
  3484.  that must be passed. You can name a parameter anything you like, as long as
  3485.  you load it into the register shown in the assembly example before calling
  3486.  the DevHlp entry point.
  3487.  
  3488.  
  3489.  █    ABIOSCall
  3490.  ────────────────────────────────────────────────────────────────────────────
  3491.  
  3492.  
  3493.  MOV  AX,LID                 ; logical ID for device
  3494.  MOV  SI,RBOffset            ; offset in data segment
  3495.                              ; to ABIOS request block
  3496.  MOV  DH,EntryPoint          ; ABIOS service entry point:
  3497.                              ; 0 = start, 1 = interrupt, 2 = timeout
  3498.  MOV  DL,DEVHLP_ABIOSCALL    ; DEVHLP_ABIOSCALL EQU 36H
  3499.  CALL [Device_Help]
  3500.  
  3501.  
  3502.  The ABIOSCall routine calls an ABIOS service for a device driver that uses
  3503.  the Operating System Transfer Convention. Under this convention, MS OS/2
  3504.  determines the effective address of the ABIOS-service entry point. This
  3505.  convention is generally used for handling interrupts from character and
  3506.  programmed I/O devices that repeatedly call a single ABIOS subroutine. The
  3507.  ABIOS services are not available for AT-class machines.
  3508.  
  3509.  
  3510.  Parameters
  3511.  
  3512.  LID  the logical ID for the device requiring ABIOS service. The LID value is
  3513.  obtained by a call to GetLIDEntry when the driver initializes.
  3514.  
  3515.  RBOffset  the offset of the ABIOS request block within the device driver's
  3516.  data segment.
  3517.  
  3518.  EntryPoint  the code for the ABIOS-service entry point. It may be one of the
  3519.  following values:
  3520.  
  3521.  Value                             Meaning
  3522.  ────────────────────────────────────────────────────────────────────────────
  3523.  
  3524.  0                                 Start - make a service request.
  3525.  
  3526.  1                                 Interrupt - resume a multi-staged
  3527.                                    request.
  3528.  
  3529.  2                                 Timeout - terminate a request that fails
  3530.                                    to receive an interrupt in a specified
  3531.                                    time.
  3532.  
  3533.  DEVHLP_ABIOSCALL  the function code; its value is 36H.
  3534.  
  3535.  
  3536.  Return Value
  3537.  
  3538.  The carry (C) flag is cleared if the routine successfully calls the ABIOS
  3539.  service. Otherwise, the C flag is set and the ax register may have one of
  3540.  the following error values:
  3541.  
  3542.    ■   ABIOS not present.
  3543.  
  3544.    ■   Unknown ABIOS command.
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  Comments
  3550.  
  3551.  This routine determines the mode-dependent address of the requested ABIOS
  3552.  service, sets up the stack for the call to ABIOS, and calls the specified
  3553.  ABIOS service for the device driver. The driver must initialize the
  3554.  return-code field of its ABIOS request block to 0FFFFH before issuing
  3555.  ABIOSCall for the Start service.
  3556.  
  3557.  The ds register must point to the device driver's low-memory data segment.
  3558.  If the driver has already called the PhysToVirt routine with ds, this
  3559.  register must be reset to the driver's low-memory data segment.
  3560.  
  3561.  The driver's low-memory data segment is the first-linked segment that
  3562.  contains the device header. This segment contains one or more ABIOS request
  3563.  blocks and usually contains the driver's data transfer buffers as well. When
  3564.  the buffers are in this segment, the driver creates logical addressability
  3565.  to its buffers for ABIOS without having to consider the current operating
  3566.  mode or interrupt disable time. For performance reasons, a device driver
  3567.  should call ABIOS services with processor interrupts enabled.
  3568.  
  3569.  The driver can use an intermediate buffer located in its low-memory data
  3570.  segment for the data transfer performed by ABIOS. The data can be
  3571.  transferred later to a logically addressed buffer (selector:offset or
  3572.  segment:offset according to the current operating mode). In other words, the
  3573.  device driver must double buffer data transferred by ABIOS if the target
  3574.  location could be high memory while running in real mode or if the driver
  3575.  needs to run with interrupts enabled.
  3576.  
  3577.  In a multi-staged data transfer request, the driver might have to change the
  3578.  address of a logically addressed data buffer in the ABIOS request block from
  3579.  stage to stage (at each change in operating mode). However, the driver must
  3580.  call Lock for all stages of a transfer to or from devices that require
  3581.  physical-address data transfers, such as DMA devices.
  3582.  
  3583.  If the driver calls ABIOS services in user mode, it can call ROMCritSection
  3584.  immediately before ABIOSCall to keep the ABIOS service from being suspended
  3585.  in the background. Without the call to ROMCritSection, a foreground
  3586.  real-mode process would be suspended indefinitely if a request for a context
  3587.  switch to a protected-mode application occurs.
  3588.  
  3589.  When the ABIOS service returns, ABIOSCall cleans up the stack before
  3590.  relinquishing control to the device driver. The return code of the ABIOS
  3591.  service will be in the ABIOS request block.
  3592.  
  3593.  However, the driver cannot assume that the return codes for ABIOS requests
  3594.  occur in any given order. Consider the case of a staged-on-interrupt request
  3595.  where the device driver's strategy routine calls the ABIOS Start service. If
  3596.  a device interrupt occurs after ABIOS Start has updated its return code but
  3597.  the device driver's strategy routine has not yet examined it, the interrupt
  3598.  handler would process the ABIOS request block. The interrupt handler should
  3599.  flag whether it has already processed the request to completion when it
  3600.  returns control to the strategy routine. Then, the strategy routine need not
  3601.  examine the ABIOSCall return code because it can check the flag.
  3602.  
  3603.  If the request is complete, the strategy routine can clean up its
  3604.  request-packet queue and pull the next request packet for an ABIOSCall to
  3605.  Start service on another ABIOS request block. For a multi-staged request
  3606.  where the strategy routine is expected to call Block on interrupt, the
  3607.  strategy routine can ignore the ABIOSCall return code by checking the flag,
  3608.  but it may still have to call Block if the interrupt handler returns control
  3609.  without processing the request to completion.
  3610.  
  3611.  The ABIOSCall Start service sets the return code to staged-on-interrupt for
  3612.  a request that must wait for an interrupt associated with a particular
  3613.  device. In fact, several requests for the same LID may be started and
  3614.  waiting for the device interrupt. When this interrupt occurs, the interrupt
  3615.  handler must call the ABIOS Interrupt service for every outstanding
  3616.  staged-on-interrupt request block in order to completely process the LID;
  3617.  this includes any ABIOS request blocks in which the Start service has
  3618.  changed the return code from 0FFFFH but not yet returned control to the
  3619.  caller. The interrupt handler may call EOI only after completely processing
  3620.  the LID associated with the interrupt.
  3621.  
  3622.  To minimize pre-EOI processing time, the interrupt handler may call EOI
  3623.  before it sets the return information in the system request packet or before
  3624.  it begins processing a request packet queued by the device driver's strategy
  3625.  routine. After it issues the EOI, the interrupt handler can be reentered at
  3626.  its entry point.
  3627.  
  3628.  Device drivers can also make multi-staged data transfers with the ABIOSCall
  3629.  Timeout service. The driver can call SetTimer or TickCount to force its
  3630.  timer-tick entry point to receive control as infrequently as possible. The
  3631.  granularity of the ABIOS Timeout service is in one-second increments.
  3632.  
  3633.  MS OS/2 device drivers must support both protected- and real-mode
  3634.  operations. For devices whose state information is kept internally in the
  3635.  ABIOS and BIOS device blocks (such as diskettes and disks), the device
  3636.  driver must reset the device when switching between ABIOS and compatibility
  3637.  BIOS operations.
  3638.  
  3639.  
  3640.  See Also
  3641.  
  3642.  Block, EOI, GetLIDEntry, Lock, ROMCritSection, SetTimer, TickCount
  3643.  
  3644.  
  3645.  █    ABIOSCommonEntry
  3646.  ────────────────────────────────────────────────────────────────────────────
  3647.  
  3648.  
  3649.  MOV  AX,LID                     ; logical ID for device
  3650.  MOV  SI,RBOffset                ; offset in data segment
  3651.                                  ; to ABIOS request block
  3652.  MOV  DH,EntryPoint              ; ABIOS common entry point:
  3653.                                  ; 0 = start, 1 = interrupt, 2 = timeout
  3654.  MOV  DL,DEVHLP_ABIOSCOMMONENTRY ; DEVHLP_ABIOSCOMMONENTRY EQU 37H
  3655.  CALL [Device_Help]
  3656.  
  3657.  
  3658.  The ABIOSCommonEntry routine calls an ABIOS service for a device driver that
  3659.  uses the Advanced BIOS Transfer Convention. ABIOS services are not available
  3660.  for AT-class machines.
  3661.  
  3662.  
  3663.  Parameters
  3664.  
  3665.  LID  the logical ID for the device requiring ABIOS service. The LID value is
  3666.  obtained by a call to GetLIDEntry when the driver initializes.
  3667.  
  3668.  RBOffset  the offset of the ABIOS request block within the device driver's
  3669.  data segment.
  3670.  
  3671.  EntryPoint  the code for the ABIOS common entry point. It may be one of the
  3672.  following values:
  3673.  
  3674.  Value                             Meaning
  3675.  ────────────────────────────────────────────────────────────────────────────
  3676.  
  3677.  0                                 Start - make a service request.
  3678.  
  3679.  1                                 Interrupt - resume a multi-staged
  3680.                                    request.
  3681.  
  3682.  2                                 Timeout - terminate a request that fails
  3683.                                    to receive an interrupt in a specified
  3684.                                    time.
  3685.  
  3686.  DEVHLP_ABIOSCOMMONENTRY  the function code; its value is 37H.
  3687.  
  3688.  
  3689.  Return Value
  3690.  
  3691.  The carry (C) flag is cleared if the routine successfully calls the ABIOS
  3692.  service. Otherwise, the C flag is set and the ax register may have one of
  3693.  the following error values:
  3694.  
  3695.    ■   ABIOS not present.
  3696.  
  3697.    ■   Unknown ABIOS command.
  3698.  
  3699.  
  3700.  
  3701.  
  3702.  Comments
  3703.  
  3704.  This routine determines the mode-dependent address of the requested ABIOS
  3705.  common entry point, sets up the stack for the call to ABIOS, and calls the
  3706.  specified ABIOS common entry point for the device driver. The driver must
  3707.  initialize the return-code field of its ABIOS request block to 0FFFFH before
  3708.  issuing ABIOSCommonEntry for the Start service.
  3709.  
  3710.  The ds register must point to the device driver's low-memory data segment.
  3711.  If the driver has already called the PhysToVirt routine with ds, this
  3712.  register must be reset to the driver's low-memory data segment.
  3713.  
  3714.  The driver's low-memory data segment is the first-linked segment that
  3715.  contains the device header. This segment contains one or more ABIOS request
  3716.  blocks and usually contains the driver's data transfer buffers as well. When
  3717.  the buffers are in this segment, the driver creates logical addressability
  3718.  to its buffers for ABIOS without having to consider the current operating
  3719.  mode or the interrupt disable time. For performance reasons, a device driver
  3720.  should call ABIOS services with processor interrupts enabled.
  3721.  
  3722.  The driver can use an intermediate buffer located in its low-memory data
  3723.  segment for the data transfer performed by ABIOS. The data can be
  3724.  transferred later to a logically addressed buffer (selector:offset or
  3725.  segment:offset according to the current operating mode). In other words, the
  3726.  device driver must double buffer data transferred by ABIOS if the target
  3727.  location could be high memory while running in real mode or if the driver
  3728.  needs to run with interrupts enabled.
  3729.  
  3730.  In a multi-staged data transfer request, the driver might have to change the
  3731.  address of a logically addressed data buffer in the ABIOS request block from
  3732.  stage to stage (at each change in operating mode). However, the driver must
  3733.  call Lock for all stages of a transfer to or from devices that require
  3734.  physical-address data transfers, such as DMA devices.
  3735.  
  3736.  If the driver calls ABIOS services in user mode, it can call ROMCritSection
  3737.  immediately before ABIOSCommonEntry to keep the ABIOS routine from being
  3738.  suspended in the background. Without the call to ROMCritSection, a
  3739.  foreground real-mode process would be suspended indefinitely if a request
  3740.  for a context switch to a protected-mode application occurs.
  3741.  
  3742.  When the ABIOS routine returns, ABIOSCommonEntry cleans up the stack before
  3743.  relinquishing control to the device driver. The return code of the ABIOS
  3744.  routine will be in the ABIOS request block.
  3745.  
  3746.  However, the driver cannot assume that the return codes for ABIOS requests
  3747.  occur in any given order. Consider the case of a staged-on-interrupt request
  3748.  where the device driver's strategy routine calls the ABIOS Start service. If
  3749.  a device interrupt occurs after ABIOS Start has updated its return code but
  3750.  the driver's strategy routine has not yet examined it, the interrupt handler
  3751.  would process the ABIOS request block. The interrupt handler should flag
  3752.  whether it has already processed the request to completion when it returns
  3753.  control to the strategy routine. Then, the strategy routine need not examine
  3754.  the return-code field because it can check the flag.
  3755.  
  3756.  If the request is complete, the strategy routine can clean up its
  3757.  request-packet queue and pull the next request packet for an
  3758.  ABIOSCommonEntry call to the Start service on another ABIOS request block.
  3759.  For a multi-staged request where the strategy routine is expected to call
  3760.  Block on interrupt, the strategy routine can ignore the return code by
  3761.  checking the flag, but it may still have to call Block if the interrupt
  3762.  handler returns control without processing the request to completion.
  3763.  
  3764.  The ABIOSCommonEntry Start service sets the return code to
  3765.  staged-on-interrupt for a request that must wait for an interrupt associated
  3766.  with a particular device. In fact, several requests for the same LID may be
  3767.  started and waiting for the device interrupt. When this interrupt occurs,
  3768.  the interrupt handler must call the ABIOS Interrupt service for every
  3769.  outstanding staged-on-interrupt request block in order to completely process
  3770.  the LID; this includes any ABIOS request blocks in which the Start service
  3771.  has changed the return code from 0FFFFH but not yet returned control to the
  3772.  caller. The interrupt handler may call EOI only after completely processing
  3773.  the LID associated with the interrupt.
  3774.  
  3775.  To minimize pre-EOI processing time, the interrupt handler may call EOI
  3776.  before it sets the return information in the system request packet or before
  3777.  it begins processing a request packet queued by the device driver's strategy
  3778.  routine. After it issues EOI, the interrupt handler can be reentered at its
  3779.  entry point.
  3780.  
  3781.  Device drivers can also make multi-staged data transfers with the
  3782.  ABIOSCommonEntry Timeout service. The driver can call SetTimer or TickCount
  3783.  to force its timer-tick entry point to receive control as infrequently as
  3784.  possible. The granularity of the ABIOS Timeout service is in one-second
  3785.  increments.
  3786.  
  3787.  MS OS/2 device drivers must support both protected- and real-mode
  3788.  operations. For devices whose state information is kept internally in the
  3789.  ABIOS and BIOS device blocks (such as diskettes and disks), the device
  3790.  driver must reset the device when switching between ABIOS and compatibility
  3791.  BIOS operations.
  3792.  
  3793.  
  3794.  
  3795.  
  3796.  See Also
  3797.  
  3798.  Block, EOI, GetLIDEntry, Lock, ROMCritSection, SetTimer, TickCount
  3799.  
  3800.  
  3801.  █    AllocGDTSelector
  3802.  ────────────────────────────────────────────────────────────────────────────
  3803.  
  3804.  
  3805.  MOV ES,AddressHigh              ; 32-bit address
  3806.  MOV DI,AddressLow               ; of GDT selector array
  3807.  MOV CX,Number                   ; number of selectors requested
  3808.  MOV DL,DEVHLP_ALLOCGDTSELECTOR  ; DEVHLP_ALLOCGDTSELECTOR EQU 2DH
  3809.  CALL [Device_Help]
  3810.  
  3811.  
  3812.  The AllocGDTSelector routine allocates a set of GDT (global descriptor
  3813.  table) selectors for use by a device driver. The allocation occurs when the
  3814.  driver initializes.
  3815.  
  3816.  
  3817.  Parameters
  3818.  
  3819.  AddressHigh  the high word (selector or segment) of the memory address where
  3820.  a word array will be filled with allocated GDT selectors.
  3821.  
  3822.  AddressLow  the low word (offset) of the memory address where the array will
  3823.  be filled with allocated GDT selectors.
  3824.  
  3825.  Number  the number of selectors to allocate.
  3826.  
  3827.  DEVHLP_ALLOCGDTSELECTOR  the function code; its value is 2DH.
  3828.  
  3829.  
  3830.  Return Value
  3831.  
  3832.  The carry (C) flag is cleared if the routine is successful. Otherwise, the C
  3833.  flag is set and the ax register may have one of the following error values:
  3834.  
  3835.    ■   Invalid address.
  3836.  
  3837.    ■   Zero selectors requested.
  3838.  
  3839.    ■   Not enough selectors available.
  3840.  
  3841.  
  3842.  
  3843.  
  3844.  Comments
  3845.  
  3846.  This routine allocates a set of GDT selectors that a device driver can use
  3847.  for bimodal task- and interrupt-time operations. The address passed into
  3848.  es:di locates the first word of an array to be filled with GDT selectors by
  3849.  AllocGDTSelector. Note that the returned selectors are not necessarily
  3850.  contiguous.
  3851.  
  3852.  The task handler of a bimodal device driver can transfer data without being
  3853.  dependent on the current operating mode. MS OS/2 device drivers must support
  3854.  both protected- and real-mode I/O.
  3855.  
  3856.  The task handler may use the RealToProt and ProtToReal routines to change
  3857.  the current operating mode. If it calls RealToProt or ProtToReal, the driver
  3858.  must restore the original operating mode before relinquishing control.
  3859.  
  3860.  The interrupt handler of a bimodal device driver can address data buffers
  3861.  through the GDT regardless of the context of the current process. The driver
  3862.  might need to access a buffer that is not within the data space addressed by
  3863.  the current LDT (local descriptor table).
  3864.  
  3865.  The interrupt handler may use the PhysToGDTSelector routine to establish the
  3866.  addressability of a GDT selector. For a fixed memory area, the returned
  3867.  selector remains valid until the handler calls PhysToGDTSelector for the
  3868.  same selector.
  3869.  
  3870.  
  3871.  
  3872.  
  3873.  See Also
  3874.  
  3875.  Lock, PhysToGDTSelector, ProtToReal, RealToProt, Unlock
  3876.  
  3877.  
  3878.  █    AllocReqPacket
  3879.  ────────────────────────────────────────────────────────────────────────────
  3880.  
  3881.  
  3882.  MOV  DH,WaitFlag                ; wait for available request packet:
  3883.                                  ; 0 = wait, 1 = no wait
  3884.  MOV  DL,DEVHLP_ALLOCREQPACKET   ; DEVHLP_ALLOCREQPACKET EQU 0DH
  3885.  CALL [Device_Help]
  3886.  
  3887.  
  3888.  The AllocReqPacket routine returns a bimodal pointer to a request packet.
  3889.  
  3890.  
  3891.  Parameters
  3892.  
  3893.  WaitFlag  whether to wait for an available request packet. It may be one of
  3894.  the following:
  3895.  
  3896.  Value                             Meaning
  3897.  ────────────────────────────────────────────────────────────────────────────
  3898.  
  3899.  0                                 Wait for request packet.
  3900.  
  3901.  1                                 Return immediately if packet not
  3902.                                    available.
  3903.  
  3904.  DEVHLP_ALLOCREQPACKET  the function code; its value is 0DH.
  3905.  
  3906.  
  3907.  Return Value
  3908.  
  3909.  The carry (C) flag is cleared and the es:bx register pair contains the
  3910.  address of the allocated request packet if the routine is successful.
  3911.  Otherwise, the C flag is set.
  3912.  
  3913.  
  3914.  Comments
  3915.  
  3916.  This routine returns a bimodal pointer to a request packet. The bimodal
  3917.  pointer is a virtual address that is valid for both protected and real
  3918.  modes.
  3919.  
  3920.  MS OS/2 device drivers must support both protected- and real-mode
  3921.  operations. A driver cannot use request packets stored in its data segment
  3922.  because the pointers would not be bimodal. Instead, the driver allocates a
  3923.  dword queue header in its (ds) data segment to point to a bimodal
  3924.  request-packet list. It initializes the queue header to zero before its
  3925.  first call to AllocReqPacket.
  3926.  
  3927.  Because the pointer returned by AllocReqPacket is bimodal, the driver can
  3928.  use its own request-queue management to place and maintain the
  3929.  request-packet pointers and linkage fields. The queue header points to the
  3930.  next packet to be serviced by the device; a queue header value of zero
  3931.  indicates an empty request queue. The queue-linkage field of the request
  3932.  packet contains a pointer to the next packet in the queue; a queue-linkage
  3933.  value of zero indicates the end of the queue. For more information about the
  3934.  layout of request packets, see Chapter 2, "Device Commands."
  3935.  
  3936.  The device driver can queue request packets that cannot be serviced
  3937.  immediately whenever the device is busy. For example, a disk device driver
  3938.  that supports more than one device would allocate a queue header and
  3939.  maintain a request-packet list for each device it supports.
  3940.  
  3941.  After a call to AllocReqPacket, the driver can place the allocated packet in
  3942.  the queue with a call to PushReqPacket. Certain device drivers such as disk
  3943.  drivers need additional request packets to service task-time requests. Disk
  3944.  (block) device drivers can use SortReqPacket to place an allocated packet in
  3945.  the request queue.
  3946.  
  3947.  Device drivers remove a request packet from the queue with PullReqPacket or
  3948.  PullParticular. Already serviced (or unused) request packets should be
  3949.  released as soon as possible with a call to FreeReqPacket so that the next
  3950.  call to AllocReqPacket is more likely to find a packet available.
  3951.  
  3952.  The AllocReqPacket routine does not preserve the state of the interrupt
  3953.  flag.
  3954.  
  3955.  
  3956.  
  3957.  
  3958.  See Also
  3959.  
  3960.  FreeReqPacket, PullParticular, PullReqPacket, PushReqPacket, SortReqPacket
  3961.  
  3962.  
  3963.  █    AllocPhys
  3964.  ────────────────────────────────────────────────────────────────────────────
  3965.  
  3966.  
  3967.  MOV  BX,SizeLow                 ; 32-bit block size in bytes
  3968.  MOV  AX,SizeHigh
  3969.  MOV  DH,HighOrLow               ; position relative to 1 megabyte:
  3970.                                  ; 0 = above 1 meg, 1 = below 1 meg
  3971.  MOV  DL,DEVHLP_ALLOCPHYS        ; DEVHLP_ALLOCPHYS EQU 18H
  3972.  CALL [Device_Help]
  3973.  
  3974.  
  3975.  The AllocPhys routine allocates a block of fixed memory.
  3976.  
  3977.  
  3978.  Parameters
  3979.  
  3980.  SizeLow  the low word of the 32-bit block size in bytes.
  3981.  
  3982.  SizeHigh  the high word of the 32-bit block size in bytes.
  3983.  
  3984.  HighOrLow  the position of the allocated memory relative to the one-megabyte
  3985.  memory boundary. This value may be one of the following:
  3986.  
  3987.  Value                             Meaning
  3988.  ────────────────────────────────────────────────────────────────────────────
  3989.  
  3990.  0                                 Allocated memory is above one megabyte.
  3991.  
  3992.  1                                 Allocated memory is below one megabyte.
  3993.  
  3994.  DEVHLP_ALLOCPHYS  the function code; its value is 18H.
  3995.  
  3996.  
  3997.  Return Value
  3998.  
  3999.  The carry (C) flag is cleared and the ax:bx register pair contains the
  4000.  32-bit physical address if the routine is successful. Otherwise, the C flag
  4001.  is set and the ax register may have the following error value:
  4002.  
  4003.    ■   Memory not allocated.
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  Comments
  4009.  
  4010.  This routine allocates fixed memory that cannot be moved by a call to
  4011.  Unlock. Call FreePhys to release memory allocated by AllocPhys.
  4012.  
  4013.  AllocPhys returns an error if the device driver clears HighOrLow and there
  4014.  is no available memory above one megabyte. The driver could then attempt to
  4015.  allocate low memory.
  4016.  
  4017.  The routine also returns an error if the device driver sets HighOrLow and
  4018.  there is no available memory below one megabyte. The driver could then
  4019.  attempt to allocate high memory.
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  See Also
  4025.  
  4026.  FreePhys, Unlock
  4027.  
  4028.  
  4029.  █    AttachDD
  4030.  ────────────────────────────────────────────────────────────────────────────
  4031.  
  4032.  
  4033.  MOV  BX,OFFSET DDName        ; name of device driver
  4034.                               ; to get IDC from
  4035.  MOV  DI,OFFSET DD@           ; data area to hold IDC addresses
  4036.  MOV  DL,DEVHLP_ATTACHDD      ; DEVHLP_ATTACHDD EQU 2AH
  4037.  CALL [Device_Help]
  4038.  
  4039.  
  4040.  The AttachDD routine gets addressability to the inter-device driver
  4041.  communication (IDC) entry point of a specified device driver for the calling
  4042.  device driver.
  4043.  
  4044.  
  4045.  Parameters
  4046.  
  4047.  DDName  Specifies the ASCII name of the target device driver. For a target
  4048.  character device driver, DDName must match the name in the device header.
  4049.  
  4050.  DD@  Specifies a 12-byte field with the following layout:
  4051.  
  4052.  Length                            Description
  4053.  ────────────────────────────────────────────────────────────────────────────
  4054.  
  4055.  word                              Real-mode offset of IDC entry point.
  4056.  
  4057.  word                              Real-mode cs segment of IDC entry point.
  4058.  
  4059.  word                              Real-mode ds of target IDC device driver.
  4060.  
  4061.  word                              Protected-mode offset of IDC entry point.
  4062.  
  4063.  word                              Protected-mode cs selector of IDC entry
  4064.                                    point.
  4065.  
  4066.  word                              Protected-mode ds of IDC device driver.
  4067.  
  4068.  DEVHLP_ATTACHDD  the function code; its value is 2AH.
  4069.  
  4070.  
  4071.  Return Value
  4072.  
  4073.  The carry (C) flag is cleared and the data area at DD@ is filled if the
  4074.  routine is successful. Otherwise, the C flag is set and the ax register has
  4075.  one of the following error values:
  4076.  
  4077.    ■   Device driver not found.
  4078.  
  4079.    ■   No IDC entry point.
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  Comments
  4085.  
  4086.  This routine allows device drivers to communicate and to pass data among
  4087.  themselves. However, communicating drivers must set up their device headers
  4088.  as follows:
  4089.  
  4090.    ■   The Attribute field must indicate that the driver can participate in
  4091.        the inter-device driver communication.
  4092.  
  4093.    ■   The offset to a target driver's IDC-entry-point data area must be
  4094.        identified for the device driver that calls it.
  4095.  
  4096.  
  4097.  In addition, the calling driver must initialize storage for the target
  4098.  driver's name (DDName) and must allocate storage for the target's IDC
  4099.  addresses (DD@) in the low-memory data segment. The calling driver's
  4100.  low-memory data segment is its first-linked segment that contains the device
  4101.  header. This segment is accessed by the ds register. For more information
  4102.  about device headers, see Chapter 1, "Overview of Base and Installable
  4103.  Device Drivers."
  4104.  
  4105.  After a successful call to AttachDD, the calling device driver must verify
  4106.  that it obtained a nonzero IDC-entry-point value for the operating mode in
  4107.  which it will make the IDC call. The calling driver must also set the ds
  4108.  register for the target device driver. If the source driver passes
  4109.  parameters to the target driver, the target must define the other registers
  4110.  used in the calling convention.
  4111.  
  4112.  The IDC entry point of the target device driver must follow the far call/ret
  4113.  model.
  4114.  
  4115.  
  4116.  █    Block
  4117.  ────────────────────────────────────────────────────────────────────────────
  4118.  
  4119.  
  4120.  MOV  BX,EventIDLow          ; low word of event ID
  4121.  MOV  AX,EventIDHigh         ; high word of event ID
  4122.  MOV  DI,TimeLimitHigh       ; time-out interval in milliseconds
  4123.  MOV  CX,TimeLimitLow        ; with -1 = never time-out
  4124.  MOV  DH,InterruptibleFlag   ; interruptible sleep:
  4125.                              ; 0 = interruptible, 1 = not interruptible
  4126.  MOV  DL,DEVHLP_PROCBLOCK    ; DEVHLP_PROCBLOCK EQU 04H
  4127.  CALL [Device_Help]
  4128.  
  4129.  
  4130.  The Block routine "sleeps" (suspends) the current device driver thread until
  4131.  the driver calls Run on the event identifier or until a time-out occurs.
  4132.  
  4133.  
  4134.  Parameters
  4135.  
  4136.  EventIDLow  the low word of the event identifier.
  4137.  
  4138.  EventIDHigh  the high word of the event identifier. By convention, an event
  4139.  identifier is the physical address of some structure or memory location
  4140.  associated with the reason for blocking.
  4141.  
  4142.  TimeLimitHigh  the high word of the time-out interval in milliseconds. If
  4143.  the value is -1 for both time-limit parameters, the thread sleeps
  4144.  indefinitely until the device driver calls Run if the block is not
  4145.  interruptible.
  4146.  
  4147.  TimeLimitLow  the low word of the time-out interval in milliseconds. If the
  4148.  value is -1, the thread sleeps indefinitely until the device driver calls
  4149.  Run if the block is not interruptible.
  4150.  
  4151.  InterruptibleFlag  whether the thread's sleep is interruptible. This
  4152.  parameter may be one of the following values:
  4153.  
  4154.  Value                             Meaning
  4155.  ────────────────────────────────────────────────────────────────────────────
  4156.  
  4157.  0                                 Interruptible: MS OS/2 can return from
  4158.                                    the block if some internal event
  4159.                                    requires the driver's attention.
  4160.  
  4161.  1                                 Not interruptible: the thread sleeps
  4162.                                    until the driver calls Run or the
  4163.                                    time-out interval expires.
  4164.  
  4165.  DEVHLP_PROCBLOCK  the function code; its value is 4.
  4166.  
  4167.  
  4168.  Return Value
  4169.  
  4170.  The carry (C) flag is cleared and the al register contains zero if the
  4171.  driver called Run on an event. Otherwise, the C flag is set, indicating an
  4172.  unusual wake-up and the al register contains a nonzero error code.
  4173.  
  4174.  The zero (Z) flag is cleared if the wake-up was due to a time-out, and the Z
  4175.  flag is set if the wake-up was due to an interrupt.
  4176.  
  4177.  
  4178.  Comments
  4179.  
  4180.  This routine can be called only by the task-time portion of a device driver.
  4181.  The Run routine is its companion routine, usually called by the driver's
  4182.  interrupt handler. Device drivers coordinate Block and Run calls by an
  4183.  EventID value that is, if possible, used only by the driver's blocking and
  4184.  running routines.
  4185.  
  4186.  EventID specifies an arbitrary 32-bit value, so the system cannot guarantee
  4187.  immunity from a spurious wake-up if some unrelated thread happens to run
  4188.  with an EventID value that matches a driver's call to Block. Choose an
  4189.  EventID value for block/run operations that is likely to be unique, such as
  4190.  the 32-bit physical address of some structure or memory location associated
  4191.  with the reason for blocking. For example, a thread blocking until a
  4192.  resource is cleared could use the physical address of the ownership flag for
  4193.  that resource.
  4194.  
  4195.  Note that a device driver could be blocked in protected mode but run in real
  4196.  mode (and vice versa), so you should not use a virtual address for an
  4197.  EventID. The logical address of an item in one mode is not the same as its
  4198.  logical address in the other mode.
  4199.  
  4200.  Before calling Run for a block-on-event, check the reason for the wake-up to
  4201.  be sure that the event occurred. If your EventID value was not unique, the
  4202.  wake-up might have been accidental.
  4203.  
  4204.  MS OS/2 will not immediately return from Block. Instead, it removes the
  4205.  current thread from the run queue and starts executing some other thread. In
  4206.  other words, a call to Block causes a context switch. Depending on the
  4207.  parameter values, the thread is reactivated and Block returns when the
  4208.  driver calls Run, the time-out interval expires, or an interrupt causes a
  4209.  return from Block.
  4210.  
  4211.  Use the following sequence when calling Block:
  4212.  
  4213.  Disable interrupts
  4214.  while (need to wait)
  4215.      Block (value)
  4216.      Disable interrupts
  4217.  
  4218.  
  4219.  First, disable interrupts before checking the wait-condition (such as I/O
  4220.  done, resource freed, or any other), to avoid deadlock if an interrupt-time
  4221.  Run call occurs before the call to Block completes. The Block routine
  4222.  re-enables interrupts.
  4223.  
  4224.  Second, check the wait-condition repeatedly and call block again, if
  4225.  necessary.
  4226.  
  4227.  If the TimeLimit specification is -1, Block waits indefinitely until the
  4228.  driver calls Run or the sleep is interrupted. If the InterruptibleFlag value
  4229.  is zero, MS OS/2 can abort the blocked thread and return from Block to the
  4230.  caller.
  4231.  
  4232.  On return from Block, the C and Z flags indicate what caused the wake-up.
  4233.  
  4234.  If C is set, check the Z flag to determine whether the sleep was
  4235.  interrupted. If it was, an internal event occurred that requires the
  4236.  driver's attention, such as a signal, a process death, or some other forced
  4237.  action. The driver can perform any necessary clean-up, set the error code in
  4238.  the Status field of the request packet, and call DevDone to return the
  4239.  packet to the kernel. Calls to Block should be interruptible unless the
  4240.  blocked thread will sleep for less than one second.
  4241.  
  4242.  
  4243.  
  4244.  
  4245.  See Also
  4246.  
  4247.  DevDone, GetDosVar, Run, TCYield, Yield
  4248.  
  4249.  
  4250.  █    DeRegister
  4251.  ────────────────────────────────────────────────────────────────────────────
  4252.  
  4253.  
  4254.  MOV  BX,MonitorPID          ; process ID of monitor task
  4255.  MOV  AX,MonHandle           ; handle for chain
  4256.                              ; returned by MonitorCreate
  4257.  MOV  DL,DEVHLP_DEREGISTER   ; DEVHLP_DEREGISTER EQU 21H
  4258.  CALL [Device_Help]
  4259.  
  4260.  
  4261.  The DeRegister routine removes the monitors associated with a monitor task
  4262.  from the monitor chain.
  4263.  
  4264.  
  4265.  Parameters
  4266.  
  4267.  MonitorPID  the process identifier of the monitor task. The device driver
  4268.  called GetDosVar to get LocINFOSeg access and obtained this value from the
  4269.  current LDT (local descriptor table).
  4270.  
  4271.  MonHandle  the monitor chain.
  4272.  
  4273.  DEVHLP_DEREGISTER  the function code; its value is 21H.
  4274.  
  4275.  
  4276.  Return Value
  4277.  
  4278.  The carry (C) flag is cleared if the routine is successful, and the ax
  4279.  register contains the number of monitors that are still registered in the
  4280.  monitor chain, if any. Otherwise, the C flag is set and the ax register may
  4281.  have the following error value:
  4282.  
  4283.    ■   Invalid monitor handle.
  4284.  
  4285.  
  4286.  
  4287.  
  4288.  Comments
  4289.  
  4290.  This routine removes one or more monitors from a monitor chain for a given
  4291.  monitor task. The monitor task calls DosMonClose, passing the monitor
  4292.  handle, to request removal of its monitors. The MS OS/2 monitor dispatcher
  4293.  forwards the request to the appropriate driver.
  4294.  
  4295.  The device driver may call DeRegister only at task time in protected mode.
  4296.  The device driver supplies the monitor-chain handle and the process
  4297.  identifier (PID) of the requesting monitor task when it calls DeRegister.
  4298.  The driver determines the PID of the requesting task by calling GetDosVar
  4299.  for access to LocINFOSeg (the current LDT).
  4300.  
  4301.  Note that DeRegister removes all monitors for the specified PID from the
  4302.  specified monitor chain. However, the monitor chain might not be empty when
  4303.  DeRegister returns. If the driver registered monitors for another monitor
  4304.  task (with a different PID) in the same chain, DeRegister returns a count of
  4305.  the remaining monitors in the ax register. The driver must remove all
  4306.  monitors from a chain before calling MonitorCreate to remove the chain
  4307.  itself.
  4308.  
  4309.  
  4310.  
  4311.  
  4312.  See Also
  4313.  
  4314.  GetDosVar, MonitorCreate, Register
  4315.  
  4316.  
  4317.  █    DevDone
  4318.  ────────────────────────────────────────────────────────────────────────────
  4319.  
  4320.  
  4321.  LES  BX,ReqPacket       ; pointer to I/O request packet
  4322.  MOV  DL,DEVHLP_DEVDONE  ; DEVHLP_DEVDONE EQU 01H
  4323.  CALL [Device_Help]
  4324.  
  4325.  
  4326.  The DevDone routine indicates that an I/O request packet has been fully
  4327.  serviced. A device driver calls DevDone for just completed requests that had
  4328.  been returned to the kernel at strategy time because they were incomplete.
  4329.  
  4330.  
  4331.  Parameters
  4332.  
  4333.  ReqPacket  to an I/O request packet.
  4334.  
  4335.  DEVHLP_DEVDONE  the function code; its value is 1.
  4336.  
  4337.  
  4338.  Return Value
  4339.  
  4340.  DevDone does not return a value.
  4341.  
  4342.  
  4343.  Comments
  4344.  
  4345.  DevDone boosts the priority of all threads that are blocked in the kernel
  4346.  waiting for the driver to service the request packet, as well as setting the
  4347.  Done bit in the Status field of the request-packet header and calling Run
  4348.  for the blocked threads. Unlike DevDone, Run merely releases a blocked
  4349.  thread at its original priority. DevDone is usually called by the driver's
  4350.  interrupt handler, but it can be called in kernel mode. For more information
  4351.  about request packets, see Chapter 2, "Device Commands."
  4352.  
  4353.  The interrupt handler should set appropriate error flags in the Status field
  4354.  of the request-packet header before it calls DevDone. The ReqPacket pointer
  4355.  is bimodal, valid in both protected and real modes.
  4356.  
  4357.  If the device driver's strategy routine completes a request, the driver need
  4358.  not call DevDone for that request. The strategy routine simply sets the done
  4359.  bit (8) in the request packet and returns it to the kernel.
  4360.  
  4361.  Call DevDone only for I/O request packets that were returned incomplete by
  4362.  the strategy routine or for unusual wake-ups of blocked threads. Do not call
  4363.  DevDone for request packets allocated by a call to AllocReqPacket.
  4364.  
  4365.  
  4366.  
  4367.  
  4368.  See Also
  4369.  
  4370.  AllocReqPacket, Block
  4371.  
  4372.  
  4373.  █    EOI
  4374.  ────────────────────────────────────────────────────────────────────────────
  4375.  
  4376.  
  4377.  MOV  AL,IRQNum          ; interrupt level number (0-0FH)
  4378.  MOV  DL,DEVHLP_EOI      ; DEVHLP_EOI EQU 31H
  4379.  CALL [Device_Help]
  4380.  
  4381.  
  4382.  The EOI routine issues an end-of-interrupt (EOI) to the master or slave PIC
  4383.  (programmable interrupt controller) as appropriate to the specified
  4384.  interrupt level.
  4385.  
  4386.  
  4387.  Parameters
  4388.  
  4389.  IRQNum  the interrupt-level number, in the range 00 to 0FH.
  4390.  
  4391.  DEVHLP_EOI  the function code; its value is 31H.
  4392.  
  4393.  
  4394.  Return Value
  4395.  
  4396.  EOI does not return a value.
  4397.  
  4398.  
  4399.  Comments
  4400.  
  4401.  This routine issues an end-of-interrupt to the PIC(s) when the interrupt
  4402.  handler has processed requests for that interrupt level.
  4403.  
  4404.  If the specified IRQNum is for the slave PIC, EOI issues the
  4405.  end-of-interrupt to both master and slave PICs.
  4406.  
  4407.  EOI preserves the state of the interrupt flag. However, the interrupt
  4408.  handler should disable interrupts with the cli instruction before calling
  4409.  EOI if the handler will return immediately to the operating system from the
  4410.  EOI call. Then, the processing of interrupts completes before the system
  4411.  must service the next interrupt, thus reducing the chance of stack overflow.
  4412.  
  4413.  
  4414.  Device drivers that use this routine to send an end-of-interrupt are upward
  4415.  compatible under MS OS/2. EOI is bimodal and can be called both during
  4416.  device driver initialization and for interrupt processing.
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  See Also
  4422.  
  4423.  RegisterStackUsage, SetIRQ, SetROMVector
  4424.  
  4425.  
  4426.  █    FreeLIDEntry
  4427.  ────────────────────────────────────────────────────────────────────────────
  4428.  
  4429.  
  4430.  MOV  AX,LID                 ; logical ID from GetLIDEntry
  4431.  MOV  DL,DEVHLP_FREELIDENTRY ; DEVHLP_FREELIDENTRY EQU 35H
  4432.  CALL [Device_Help]
  4433.  
  4434.  
  4435.  The FreeLIDEntry routine releases a logical ID when an ABIOS device driver
  4436.  deinstalls. ABIOS services are not available for AT-class machines.
  4437.  
  4438.  
  4439.  Parameters
  4440.  
  4441.  LID  the logical ID for a device that was associated with the device driver
  4442.  by a call to GetLIDEntry when the driver initialized.
  4443.  
  4444.  DEVHLP_FREELIDENTRY  the function code; its value is 35H.
  4445.  
  4446.  
  4447.  Return Value
  4448.  
  4449.  The carry (C) flag is cleared if the routine is successful. Otherwise, the C
  4450.  flag is set and the ax register may have one of the following error values:
  4451.  
  4452.    ■   Not your LID.
  4453.  
  4454.    ■   LID does not exist.
  4455.  
  4456.    ■   ABIOS not present.
  4457.  
  4458.  
  4459.  
  4460.  
  4461.  Comments
  4462.  
  4463.  The device driver must release its LID(s) when it terminates. The attempt to
  4464.  free a logical ID will fail if the driver is not associated (by GetLIDEntry)
  4465.  with the specified LID value or if the LID does not exist.
  4466.  
  4467.  When FreeLIDEntry is called, the ds register must point to the device
  4468.  driver's low-memory data segment. The driver's low-memory data segment is
  4469.  the first-linked segment that contains the device header. If the driver has
  4470.  called the PhysToVirt routine with ds, this register must be reset to the
  4471.  driver's low-memory data segment.
  4472.  
  4473.  
  4474.  
  4475.  
  4476.  See Also
  4477.  
  4478.  GetLIDEntry, ABIOSCall, ABIOSCommonEntry, PhysToVirt
  4479.  
  4480.  
  4481.  █    FreeReqPacket
  4482.  ────────────────────────────────────────────────────────────────────────────
  4483.  
  4484.  
  4485.  LES  BX,ReqPacket               ; pointer to request packet
  4486.                                  ; provided by AllocReqPacket
  4487.  MOV  DL,DEVHLP_FREEREQPACKET    ; DEVHLP_FREEREQPACKET EQU 0EH
  4488.  CALL [Device_Help]
  4489.  
  4490.  
  4491.  The FreeReqPacket routine releases a request packet that was allocated by
  4492.  AllocReqPacket.
  4493.  
  4494.  
  4495.  Parameters
  4496.  
  4497.  ReqPacket  to the request packet that will be released to the system.
  4498.  
  4499.  DEVHLP_FREEREQPACKET  the function code; its value is 0EH.
  4500.  
  4501.  
  4502.  Return Value
  4503.  
  4504.  FreeReqPacket does not return a value.
  4505.  
  4506.  
  4507.  Comments
  4508.  
  4509.  This routine releases a request packet when a device driver no longer needs
  4510.  it. The request packet must have been allocated by the AllocReqPacket
  4511.  routine. Call FreeReqPacket as soon as the packet is not in use, rather than
  4512.  allocating request packets to hold for future use. If you allocate packets
  4513.  as needed and free them promptly, your calls to AllocReqPacket are more
  4514.  likely to find request packets available.
  4515.  
  4516.  FreeReqPacket does not preserve the state of the interrupt flag.
  4517.  
  4518.  Use FreeReqPacket, not the DevDone routine, to return request packets
  4519.  allocated by AllocReqPacket.
  4520.  
  4521.  
  4522.  
  4523.  
  4524.  See Also
  4525.  
  4526.  AllocReqPacket, DevDone
  4527.  
  4528.  
  4529.  █    FreePhys
  4530.  ────────────────────────────────────────────────────────────────────────────
  4531.  
  4532.  
  4533.  MOV  BX,AddressLow          ; 32-bit physical address
  4534.  MOV  AX,AddressHigh
  4535.  MOV  DL,DEVHLP_FREEPHYS     ; DEVHLP_FREEPHYS EQU 19H
  4536.  CALL [Device_Help]
  4537.  
  4538.  
  4539.  The FreePhys routine releases memory allocated by a call to AllocPhys.
  4540.  
  4541.  
  4542.  Parameters
  4543.  
  4544.  AddressLow  the low word of the 32-bit physical address of a memory block
  4545.  allocated by AllocPhys.
  4546.  
  4547.  AddressHigh  the high word of the 32-bit physical address of a memory block
  4548.  allocated by AllocPhys.
  4549.  
  4550.  DEVHLP_FREEPHYS  the function code; its value is 19H.
  4551.  
  4552.  
  4553.  Return Value
  4554.  
  4555.  The carry (C) flag is cleared if the routine is successful. Otherwise, the
  4556.  memory is not released and the C flag is set, indicating the following
  4557.  error:
  4558.  
  4559.    ■   Cannot free memory not allocated by AllocPhys.
  4560.  
  4561.  
  4562.  
  4563.  
  4564.  Comments
  4565.  
  4566.  Any memory block allocated by AllocPhys should be released with a call to
  4567.  FreePhys before the device driver terminates.
  4568.  
  4569.  
  4570.  
  4571.  
  4572.  See Also
  4573.  
  4574.  AllocPhys
  4575.  
  4576.  
  4577.  █    GetDosVar
  4578.  ────────────────────────────────────────────────────────────────────────────
  4579.  
  4580.  
  4581.  MOV  AL,VarNumber           ; index of variable
  4582.  MOV  DL,DEVHLP_GETDOSVAR    ; DEVHLP_GETDOSVAR EQU 24H
  4583.  CALL [Device_Help]
  4584.  
  4585.  
  4586.  The GetDosVar routine returns a bimodal pointer to an internal
  4587.  DOS-compatibility variable.
  4588.  
  4589.  
  4590.  Parameters
  4591.  
  4592.  VarNumber  the index of the MS OS/2 variable. It can be one of the following
  4593.  values:
  4594.  
  4595.  Index                             Description
  4596.  ────────────────────────────────────────────────────────────────────────────
  4597.  
  4598.  1                                 Specifies the SysINFOSeg, a word that is
  4599.                                    the bimodal selector or segment address
  4600.                                    of the system global descriptor table
  4601.                                    (GDT) INFO segment. This index
  4602.                                    specification is valid at task time and
  4603.                                    interrupt time.
  4604.  
  4605.  2                                 Specifies the LocINFOSeg, a dword that
  4606.                                    is the selector:offset or segment:offset
  4607.                                    of the local descriptor table (LDT) INFO
  4608.                                    segment. This index specification is
  4609.                                    valid only task time.
  4610.  
  4611.  4                                 Specifies the VectorSDF, a dword that is
  4612.                                    the vector to the stand-alone dump
  4613.                                    facility. This index specification is
  4614.                                    valid at task time and interrupt time.
  4615.  
  4616.  5                                 Specifies the VectorReboot, a dword that
  4617.                                    is the vector to reboot DOS. This index
  4618.                                    is valid at task time and interrupt time.
  4619.  
  4620.  6                                 Specifies the VectorMSATS, a qword that
  4621.                                    contains the protected-and real-mode
  4622.                                    pointers to the MSATS facility. This
  4623.                                    index specification is valid at task
  4624.                                    time and interrupt time.
  4625.  
  4626.  7                                 Specifies the YieldFlag, a byte that
  4627.                                    indicates whether to yield the CPU; if
  4628.                                    this flag is set, a thread of equal or
  4629.                                    higher priority is waiting to run. This
  4630.                                    index specification is valid only at
  4631.                                    task time.
  4632.  
  4633.  8                                 Specifies the TCYieldFlag, a byte that
  4634.                                    indicates whether to yield the CPU; if
  4635.                                    this flag is set, a time-critical thread
  4636.                                    of equal or higher priority is waiting
  4637.                                    to run. This index specification is
  4638.                                    valid only at task time.
  4639.  
  4640.  11                                Specifies the CodePageTagPtr, a dword
  4641.                                    that is the segment:offset of the
  4642.                                    current real-mode code page. This index
  4643.                                    specification is valid only at task time.
  4644.  
  4645.  12                                Specifies the VectorRIPL, a dword that
  4646.                                    points to the boot environment
  4647.                                    descriptor table; if this pointer is
  4648.                                    nonzero, the boot environment is an RIPL
  4649.                                    (remote initial program load). This
  4650.                                    index specification is valid at task
  4651.                                    time and interrupt time.
  4652.  
  4653.  DEVHLP_GETDOSVAR  the function code; its value is 24H.
  4654.  
  4655.  
  4656.  Return Value
  4657.  
  4658.  The carry (C) flag is cleared and the ax:bx register pair points to the
  4659.  specified variable if the routine is successful. Otherwise, the C flag is
  4660.  set.
  4661.  
  4662.  
  4663.  Comments
  4664.  
  4665.  This routine returns a bimodal pointer to an indexed variable. Note that
  4666.  this pointer sometimes accesses a data structure and sometimes is a vector
  4667.  to a facility. All indexed variables are read-only. Index values 3, 9, and
  4668.  10 are reserved. The list of available variables might change in future
  4669.  versions of MS OS/2.
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  See Also
  4675.  
  4676.  TCYield, Yield
  4677.  
  4678.  
  4679.  █    GetLIDEntry
  4680.  ────────────────────────────────────────────────────────────────────────────
  4681.  
  4682.  
  4683.  MOV  AL,DeviceID        ; device type ID
  4684.  MOV  BL,RelativeLIDNum  ; Nth logical ID of this device ID:
  4685.                          ; 0 = first available LID, 1 = first LID,
  4686.                          ; 2 = second LID, ...,
  4687.                          ; 0FFH = max LID value
  4688.  MOV  DH,DeviceState     ; requested LID indicator:
  4689.                          ; 1 = DMA or POS, 0 = all other device types
  4690.  MOV  DL,GETLIDENTRY     ; GETLIDENTRY EQU 34H
  4691.  CALL [Device_Help]
  4692.  
  4693.  
  4694.  The GetLIDEntry routine associates the logical ID of an existing device with
  4695.  a device driver when the ABIOS driver initializes. ABIOS services are not
  4696.  available on AT-class machines.
  4697.  
  4698.  
  4699.  Parameters
  4700.  
  4701.  DeviceID  the kind of device for which the device driver requests an LID.
  4702.  This parameter may be one of the following values:
  4703.  
  4704.  Value                             Meaning
  4705.  ────────────────────────────────────────────────────────────────────────────
  4706.  
  4707.  01                                Diskette
  4708.  
  4709.  02                                Disk
  4710.  
  4711.  03                                Video
  4712.  
  4713.  04                                Keyboard
  4714.  
  4715.  05                                Parallel port
  4716.  
  4717.  06                                Asynchronous communications
  4718.  
  4719.  07                                System timer
  4720.  
  4721.  08                                Real-time clock timer
  4722.  
  4723.  0AH                               Nonmaskable interrupt
  4724.  
  4725.  0BH                               Pointing device
  4726.  
  4727.  0EH                               Nonvolatile Random Access Memory (NVRAM)
  4728.  
  4729.  0FH                               Direct Memory Access (DMA)
  4730.  
  4731.  10H                               Programmable Option Select (POS)
  4732.  
  4733.  16H                               Keyboard security
  4734.  
  4735.  All other DeviceID values are reserved.
  4736.  
  4737.  RelativeLIDNum  either the first available LID for the device (value 0) or a
  4738.  particular LID for the device (nonzero values). The range of LID values for
  4739.  each device type depends on how many devices of that type are available in
  4740.  the system.
  4741.  
  4742.  DeviceState  whether the device type is shared among drivers (value 1 for
  4743.  DMA and POS device types) or whether each driver is associated with an
  4744.  exclusive LID entry for the device type (value zero for all non-DMA and
  4745.  non-POS device types).
  4746.  
  4747.  DEVHLP_GETLIDENTRY  the function code; its value is 34H.
  4748.  
  4749.  
  4750.  Return Value
  4751.  
  4752.  The carry (C) flag is cleared and the ax register contains the LID number
  4753.  associated with the device driver if the routine is successful. Otherwise,
  4754.  the C flag is set and the ax register may have one of the following error
  4755.  values:
  4756.  
  4757.    ■   Not your LID.
  4758.  
  4759.    ■   LID does not exist.
  4760.  
  4761.    ■   ABIOS not present.
  4762.  
  4763.  
  4764.  
  4765.  
  4766.  Comments
  4767.  
  4768.  This routine associates an available LID with a device driver when it
  4769.  initializes at system boot. An available LID is "awake" in the system and
  4770.  not already claimed for the exclusive use of another device driver.
  4771.  
  4772.  The device driver can use this routine in two different ways:
  4773.  
  4774.    ■   One way is for the driver to specify a particular relative logical ID
  4775.        for the device type specified. Because the ordering of LIDs
  4776.        corresponds to the ordering of the physical devices, the device driver
  4777.        can determine if the specified LID entry is available. For example, a
  4778.        character device driver that supports com4 would specify 04 for the
  4779.        parameter RelativeLIDNum in order to get the LID entry for the fourth
  4780.        com port if it is available or to get a message if it isn't.
  4781.  
  4782.    ■   The other way is for the driver to request the first available logical
  4783.        ID for the specified device type. For example, a block device driver
  4784.        for diskettes would specify zero for the parameter Relative LIDNum in
  4785.        order to get the first available LID entry for the DeviceID value 01.
  4786.  
  4787.  
  4788.  In either case, GetLIDEntry will search the Advanced BIOS Common Data Area
  4789.  table for an entry corresponding to the specified RelativeLIDNum value and
  4790.  return the LID if an entry is available. The routine returns an error if no
  4791.  entry is available or if the specified LID is nonsharable and associated
  4792.  with a previously initialized device driver.
  4793.  
  4794.  The DMA and POS device types are shared among device drivers. For these
  4795.  DeviceID values, GetLIDEntry will allow multiple device drivers to access
  4796.  the LID concurrently. It is up to each device driver to determine whether
  4797.  the device is available for use when necessary. GetLIDEntry must be called
  4798.  with DeviceState set to obtain an LID for DMA and POS devices. For all other
  4799.  DeviceID specifications, DeviceState must be zero.
  4800.  
  4801.  When GetLIDEntry is called, the ds register must point to the device
  4802.  driver's low-memory data segment. The low-memory data segment is the
  4803.  first-linked segment that contains the device header. If the driver has
  4804.  already called the PhysToVirt routine with ds, this register must be reset
  4805.  to the driver's low-memory data segment.
  4806.  
  4807.  
  4808.  
  4809.  
  4810.  See Also
  4811.  
  4812.  ABIOSCall, ABIOSCommonEntry, FreeLIDEntry, PhysToVirt
  4813.  
  4814.  
  4815.  █    Lock
  4816.  ────────────────────────────────────────────────────────────────────────────
  4817.  
  4818.  
  4819.  MOV  AX,MemSeg@         ; selector or segment
  4820.  MOV  BH,TypeLock        ; duration (bit 0) of lock:
  4821.                          ; 0 = short-term, 1 = long-term
  4822.                          ; memory location (bit 1) of lock:
  4823.                          ; 0 = any location, 1 = high memory
  4824.                          ; type (bit 2) of lock:
  4825.                          ; 0 = fixed, 1 = verify
  4826.  MOV  BL,WaitFlag        ; wait or return:
  4827.                          ; 0 = block until locked,
  4828.                          ; 1 = return if MemSeg not available
  4829.  MOV  DL,DEVHLP_LOCK     ; DEVHLP_LOCK EQU 13H
  4830.  CALL [Device_Help]
  4831.  
  4832.  
  4833.  The Lock routine guarantees that access to a memory segment will not change.
  4834.  
  4835.  
  4836.  
  4837.  Parameters
  4838.  
  4839.  MemSeg@  the selector or segment value for the segment to be locked.
  4840.  
  4841.  TypeLock  where (bit 1) the segment should be located and the duration (bit
  4842.  0) and type (bit 2) of the lock. This parameter may have one of the
  4843.  following values:
  4844.  
  4845.  Value                             Meaning
  4846.  ────────────────────────────────────────────────────────────────────────────
  4847.  
  4848.  00                                Any memory location for a short-term,
  4849.                                    fixed lock: mark the segment as fixed at
  4850.                                    its current physical address.
  4851.  
  4852.  01                                Any memory location for a long-term,
  4853.                                    fixed lock: mark the segment as fixed,
  4854.                                    but it can be moved into the system's
  4855.                                    fixed-segment region and given a new
  4856.                                    physical address.
  4857.  
  4858.  03                                High memory location for a long-term,
  4859.                                    fixed, and irreversible lock: mark the
  4860.                                    segment as fixed when the device driver
  4861.                                    initializes, move it into the system's
  4862.                                    high-memory, fixed-segment region until
  4863.                                    a reboot occurs, and do not return a
  4864.                                    lock handle for this segment. This
  4865.                                    specification is valid only in a device
  4866.                                    driver's initialization routine and only
  4867.                                    if the MemSeg@ value is the
  4868.                                    selector of a segment in the driver's
  4869.                                    load image.
  4870.  
  4871.  04                                Any memory location for a short-term,
  4872.                                    verify lock: mark the segment as
  4873.                                    swappable but neither shrinkable nor
  4874.                                    freeable until the lock is removed
  4875.                                    explicitly. Access to the segment
  4876.                                    remains valid even after the driver
  4877.                                    blocks.
  4878.  
  4879.  WaitFlag  whether to block until the segment has been locked. This parameter
  4880.  may be one of the following values:
  4881.  
  4882.  Value                             Meaning
  4883.  ────────────────────────────────────────────────────────────────────────────
  4884.  
  4885.  0                                 Wait (block) until memory segment is
  4886.                                    locked.
  4887.  
  4888.  1                                 Return immediately if memory segment is
  4889.                                    not available.
  4890.  
  4891.  DEVHLP_LOCK  the function code; its value is 13H.
  4892.  
  4893.  
  4894.  Return Value
  4895.  
  4896.  The carry (C) flag is cleared if the routine is successful, and the ax:bx
  4897.  register pair contains the lock handle for reversible locks. Otherwise, the
  4898.  C flag is set if the segment is unavailable or the handle is invalid.
  4899.  
  4900.  
  4901.  Comments
  4902.  
  4903.  For TypeLock values 00 and 01, this routine locks a segment in memory at
  4904.  task time so a device driver can use physical addresses to access the
  4905.  segment at interrupt time. A driver must specify whether Lock should return
  4906.  immediately if the segment is not available (there is not enough memory or
  4907.  the segment is swapped out).
  4908.  
  4909.  Lock does not block on a long-term lock request if it cannot lock the
  4910.  segment specified. The routine returns immediately with the C flag set, even
  4911.  if the WaitFlag was clear for a long-term lock request that fails.
  4912.  
  4913.  For the TypeLock value 04, this routine guarantees access to the segment.
  4914.  Calling Lock with TypeLock value 04 does not make the segment present, and
  4915.  it can be swapped out, but it cannot be resized or freed. MS OS/2 guarantees
  4916.  valid access to this segment until the driver calls Unlock to release the
  4917.  verify lock.
  4918.  
  4919.  Use a long-term lock (TypeLock value 01 or 03) in the following
  4920.  circumstances:
  4921.  
  4922.    ■   An operation on a locked segment could last more than two seconds.
  4923.  
  4924.    ■   The routine that calls Lock might not call Unlock before it returns to
  4925.        its caller.
  4926.  
  4927.  
  4928.  Using short-term locks for longer than two seconds might hang the system.
  4929.  For any segment with a short-term lock (TypeLock values 00 and 04), call
  4930.  Unlock before two seconds elapse or before the driver returns control to its
  4931.  caller, whichever comes first.
  4932.  
  4933.  If a fixed-memory operation will take more than two seconds, call Lock with
  4934.  a TypeLock specification of 01. Then, the system can (but might not) move
  4935.  the segment into a region it reserves for fixed, protected-mode segments. If
  4936.  the call is successful, Lock returns a lock handle for the driver to use
  4937.  until it calls Unlock.
  4938.  
  4939.  A driver need not call Lock for segments that the MS OS/2 kernel has already
  4940.  locked. For example, any segment address passed to a device driver in a
  4941.  read/write request gives access to an already locked segment.
  4942.  
  4943.  However, addresses passed to a device driver via an IOCtl call should be
  4944.  verified after a task-time call to Lock. Call VerifyAccess in protected mode
  4945.  to confirm that the user process has correct access rights to the memory
  4946.  segment (call RealToProt before VerifyAccess, if necessary).
  4947.  
  4948.  If the segment must be fixed and present (TypeLock 00 or 01), call Lock and
  4949.  then call VerifyAccess. When the segment is locked and user access is
  4950.  verified, a device driver can call VirtToPhys to access the locked segment
  4951.  by its physical address. Such an access verification remains valid for the
  4952.  duration of the lock.
  4953.  
  4954.  During initialization, a device driver may request a permanent, locked
  4955.  segment in the system's reserved region for fixed, protected-mode segments.
  4956.  The device driver conserves low-memory space for real mode operations by
  4957.  using this type of lock. The Lock routine does not return a handle when the
  4958.  TypeLock value is 03, but the segment is guaranteed to be in high memory if
  4959.  the call succeeds.
  4960.  
  4961.  
  4962.  
  4963.  
  4964.  See Also
  4965.  
  4966.  Block, RealToProt, TCYield, Unlock, VerifyAccess, VirtToPhys, Yield
  4967.  
  4968.  
  4969.  █    LogEntry
  4970.  ────────────────────────────────────────────────────────────────────────────
  4971.  
  4972.  
  4973.  MOV  CX,FCode           ; 0 = reserved, 1 = log data to buffer
  4974.  LES  BX,DataPtr         ; pointer to data
  4975.  MOV  DL,DEVHLP_LOGENTRY ; DEVHLP_LOGENTRY EQU 3BH
  4976.  CALL [Device_Help]
  4977.  
  4978.  
  4979.  The LogEntry routine places data in the system's error-log buffer.
  4980.  
  4981.  
  4982.  Parameters
  4983.  
  4984.  FCode  be 1, requesting that data be placed in the error-log buffer.
  4985.  
  4986.  DataPtr  the virtual address of a buffer in the device driver's primary data
  4987.  segment. This buffer contains data to be placed in the system error-log
  4988.  buffer.
  4989.  
  4990.  DEVHLP_LOGENTRY  the function code; its value is 3BH.
  4991.  
  4992.  
  4993.  Return Value
  4994.  
  4995.  LogEntry does not return a value.
  4996.  
  4997.  
  4998.  Comments
  4999.  
  5000.  A device driver may call this routine at interrupt, user, or task time.
  5001.  
  5002.  The es register must be set to the driver's primary data segment. The
  5003.  primary data segment is the driver's first-linked segment that contains the
  5004.  device header.
  5005.  
  5006.  A mode switch occurs when a device driver calls LogEntry in real mode.
  5007.  However, the driver always regains control in its calling mode.
  5008.  
  5009.  
  5010.  █    MonitorCreate
  5011.  ────────────────────────────────────────────────────────────────────────────
  5012.  
  5013.  
  5014.  LES  SI,FinalBuffer            ; pointer to final buffer in chain
  5015.  PUSH CS
  5016.  POP  DS
  5017.  MOV  DI,OFFSET NotifyRtn       ; pointer to notification routine
  5018.  MOV  AX,MonHandle              ; handle for this monitor chain:
  5019.                                 ; 0 = create chain, nonzero = remove chain
  5020.  MOV  DL,DEVHLP_MONITORCREATE   ; DEVHLP_MONITORCREATE EQU 1FH
  5021.  CALL ES:[Device_Help]
  5022.  
  5023.  
  5024.  The MonitorCreate routine either creates or destroys a monitor chain. The
  5025.  routine creates an initially empty chain of monitors with the device
  5026.  driver's buffer and notification entry point as the last element in the
  5027.  chain. The routine destroys an existing monitor chain after all monitor
  5028.  tasks registered with this chain have been deregistered.
  5029.  
  5030.  
  5031.  Parameters
  5032.  
  5033.  FinalBuffer  the final buffer for the monitor chain. The device driver's
  5034.  data segment contains the final buffer; the buffer's first word contains the
  5035.  length in bytes of the buffer, including its first word.
  5036.  
  5037.  NotifyRtn  the entry point of the notification routine. The driver's code
  5038.  segment contains the notification routine.
  5039.  
  5040.  MonHandle  the monitor handle. This parameter may be either a zero or
  5041.  nonzero value with the following meanings:
  5042.  
  5043.  Value                             Meaning
  5044.  ────────────────────────────────────────────────────────────────────────────
  5045.  
  5046.  0                                 Create new monitor chain and return a
  5047.                                    handle for it.
  5048.  
  5049.  Nonzero                           Remove the monitor chain for the
  5050.                                    specified handle.
  5051.  
  5052.  DEVHLP_MONITORCREATE  the function code; its value is 1FH.
  5053.  
  5054.  
  5055.  Return Value
  5056.  
  5057.  The carry (C) flag is cleared if the routine is successful, and the ax
  5058.  register contains the new monitor chain handle if MonHandle was zero.
  5059.  Otherwise, the C flag is set and the ax register has one of the following
  5060.  error values:
  5061.  
  5062.    ■   Not enough memory.
  5063.  
  5064.    ■   Monitor chain not empty.
  5065.  
  5066.    ■   Invalid monitor handle.
  5067.  
  5068.  
  5069.  
  5070.  
  5071.  Comments
  5072.  
  5073.  This routine creates or removes a monitor chain for a device that performs
  5074.  synchronous I/O. A monitor chain is a list of monitors, with a device
  5075.  driver's buffer address and code address as the last element in this list.
  5076.  At creation, a monitor chain is empty so that data written into the chain is
  5077.  placed immediately in the output buffer.
  5078.  
  5079.  The device driver may call MonitorCreate only at task time in protected
  5080.  mode, and it must call MonitorCreate before calling Register to add a
  5081.  monitor to the monitor chain. The device driver must call DeRegister for
  5082.  each monitor task associated with the chain before it calls MonitorCreate to
  5083.  remove the monitor chain.
  5084.  
  5085.  The MonWrite routine places data in a monitor chain. The MS OS/2 monitor
  5086.  dispatcher feeds the data through all registered monitors in the chain. It
  5087.  puts the resulting data, if any, into the device driver's monitor buffer and
  5088.  calls the driver's notification routine at task time in protected mode. An
  5089.  interrupt-time notification call occurs only if MonWrite is called at
  5090.  interrupt time and the monitor chain is empty.
  5091.  
  5092.  When the system monitor dispatcher places a data record in the driver's
  5093.  monitor buffer, it also does the following:
  5094.  
  5095.    ■   Fills the first word of the buffer with the length in bytes of the
  5096.        record.
  5097.  
  5098.    ■   Holds the address of the buffer in es:si.
  5099.  
  5100.    ■   Sets the ds register to the driver's data segment.
  5101.  
  5102.    ■   Calls the driver's notification routine in protected mode.
  5103.  
  5104.  
  5105.  The device driver must process the contents of the monitor buffer as quickly
  5106.  as possible and return control to the monitor dispatcher. Note that the
  5107.  driver's notification routine must save and restore es and si if it uses
  5108.  these registers.
  5109.  
  5110.  The driver can call MonitorCreate at initialization or at task time in
  5111.  response to a monitor task's DosMonOpen or DosMonReg request, but the driver
  5112.  must call MonitorCreate once to obtain a chain handle before it can call
  5113.  Register in order to add monitors to the chain. The driver should keep track
  5114.  of the monitors it registers with each monitor chain that it supports for a
  5115.  given process. When a monitor task calls DosMonClose, the driver must call
  5116.  DeRegister to remove every monitor associated with the process from the
  5117.  chain. However, the chain must have no monitors when the driver calls
  5118.  MonitorCreate to remove the chain itself.
  5119.  
  5120.  
  5121.  
  5122.  
  5123.  See Also
  5124.  
  5125.  DeRegister, DosMonClose, DosMonOpen, DosMonReg, MonFlush, MonWrite, Register
  5126.  
  5127.  
  5128.  
  5129.  █    MonFlush
  5130.  ────────────────────────────────────────────────────────────────────────────
  5131.  
  5132.  
  5133.  MOV  AX,MonHandle       ; handle for chain
  5134.                          ; returned by MonitorCreate
  5135.  MOV  DL,DEVHLP_MONFLUSH ; DEVHLP_MONFLUSH EQU 23H
  5136.  CALL [Device_Help]
  5137.  
  5138.  
  5139.  The MonFlush routine removes all data from the specified monitor chain.
  5140.  
  5141.  
  5142.  Parameters
  5143.  
  5144.  MonHandle  the monitor chain.
  5145.  
  5146.  DEVHLP_MONFLUSH  the function code; its value is 23H.
  5147.  
  5148.  
  5149.  Return Value
  5150.  
  5151.  The carry (C) flag cleared if the routine is successful. Otherwise, the C
  5152.  flag is set and the ax register may have the following error value:
  5153.  
  5154.    ■   Invalid monitor handle.
  5155.  
  5156.  
  5157.  
  5158.  
  5159.  Comments
  5160.  
  5161.  This routine tells the system monitor dispatcher to place a monitor-flush
  5162.  record in the monitor chain. This record passes through every monitor in the
  5163.  chain, and every monitor should discard any current data to pass the
  5164.  monitor-flush record along. The system monitor dispatcher places no new data
  5165.  records into the chain of monitors until the monitor-flush record reaches
  5166.  the device driver's monitor chain buffer.
  5167.  
  5168.  A device driver may call MonFlush only at task time. Subsequent calls to
  5169.  MonWrite will fail (or block) until the flush completes.
  5170.  
  5171.  The MonFlush routine does not preserve the state of the interrupt flag.
  5172.  
  5173.  
  5174.  
  5175.  
  5176.  See Also
  5177.  
  5178.  MonitorCreate, MonWrite
  5179.  
  5180.  
  5181.  █    MonWrite
  5182.  ────────────────────────────────────────────────────────────────────────────
  5183.  
  5184.  
  5185.  MOV  SI,OFFSET DataRecord     ; offset to data record
  5186.                                ; in driver's DS segment
  5187.  MOV  CX,Count                 ; count of bytes in data record
  5188.  MOV  AX,MonHandle             ; handle for chain
  5189.                                ; returned by MonitorCreate
  5190.  MOV  DH,WaitFlag              ; for monitor dispatcher synchronization:
  5191.                                ; 0 = wait, 1 = no wait required
  5192.  MOV  DL,DEVHLP_MONWRITE       ; DEVHLP_MONWRITE EQU 22H
  5193.  CALL [Device_Help]
  5194.  
  5195.  
  5196.  The MonWrite routine passes data records from a device driver to the chain
  5197.  of monitors for filtering.
  5198.  
  5199.  
  5200.  Parameters
  5201.  
  5202.  DataRecord  the data record to be written into the driver's monitor buffer
  5203.  and passed to the next monitor in the chain.
  5204.  
  5205.  Count  the size in bytes of the data record. The maximum size for a valid
  5206.  data record is two bytes less than the size of the device driver's monitor
  5207.  buffer.
  5208.  
  5209.  MonHandle  the monitor chain.
  5210.  
  5211.  WaitFlag  whether the routine should wait until the system monitor
  5212.  dispatcher performs synchronization. This parameter may be one of the
  5213.  following values:
  5214.  
  5215.  Value                             Meaning
  5216.  ────────────────────────────────────────────────────────────────────────────
  5217.  
  5218.  0                                 Wait until the monitor dispatcher
  5219.                                    performs synchronization (at task or
  5220.                                    user time).
  5221.  
  5222.  1                                 No wait required (at task or interrupt
  5223.                                    time).
  5224.  
  5225.  DEVHLP_MONWRITE  the function code; its value is 22H.
  5226.  
  5227.  
  5228.  Return Value
  5229.  
  5230.  The carry (C) flag is cleared if the routine is successful. Otherwise, the C
  5231.  flag is set and the ax register may have one of the following error values:
  5232.  
  5233.    ■   Invalid monitor handle.
  5234.  
  5235.    ■   Not enough memory.
  5236.  
  5237.    ■   Data record too large.
  5238.  
  5239.  
  5240.  
  5241.  
  5242.  Comments
  5243.  
  5244.  This routine transfers a single, complete data record to the monitor chain.
  5245.  
  5246.  The driver may call MonWrite at task time or interrupt time. The ds register
  5247.  must point to the driver's low-memory data segment when the call occurs.
  5248.  This low-memory data segment is the first-linked segment that contains the
  5249.  device header. If the driver has already called PhysToVirt with ds, this
  5250.  register must be reset before the call to MonWrite.
  5251.  
  5252.  The not-enough-memory error condition occurs when the MonWrite call is made
  5253.  and the buffer did not contain sufficient free space to receive the data. If
  5254.  this condition occurs at interrupt time, there is an overrun. If it occurs
  5255.  at task time, the process can block.
  5256.  
  5257.  An in-progress MonFlush call can also cause a not-enough-memory condition.
  5258.  Waiting until the MonFlush call has completed may correct this condition.
  5259.  
  5260.  The MonWrite routine does not preserve the state of the interrupt flag.
  5261.  
  5262.  
  5263.  
  5264.  
  5265.  See Also
  5266.  
  5267.  MonitorCreate, MonFlush, PhysToVirt
  5268.  
  5269.  
  5270.  █    PhysToGDTSelector
  5271.  ────────────────────────────────────────────────────────────────────────────
  5272.  
  5273.  
  5274.  MOV AX,AddressHigh              ; 32-bit physical address
  5275.  MOV BX,AddressLow
  5276.  MOV CX,Length                   ; length in bytes of segment
  5277.  MOV SI,Selector                 ; selector to be set up
  5278.  MOV DL,DEVHLP_PHYSTOGDTSELECTOR ; DEVHLP_PHYSTOGDTSELECTOR EQU 2EH
  5279.  CALL [Device_Help]
  5280.  
  5281.  
  5282.  The PhysToGDTSelector routine converts a 32-bit physical address into a GDT
  5283.  (global descriptor table) selector:offset pair.
  5284.  
  5285.  
  5286.  Parameters
  5287.  
  5288.  AddressHigh  the high-order word of the 32-bit physical address.
  5289.  
  5290.  AddressLow  the low-order word of the 32-bit physical address.
  5291.  
  5292.  Length  the length in bytes of the data segment to be accessed.
  5293.  
  5294.  Selector  a selector returned by AllocGDTSelector; the selector will index
  5295.  the GDT entry.
  5296.  
  5297.  DEVHLP_PHYSTOGDTSELECTOR  the function code; its value is 2EH.
  5298.  
  5299.  
  5300.  Return Value
  5301.  
  5302.  The carry (C) flag is cleared if the routine is successful. Otherwise, the C
  5303.  flag is set and the ax register may have one of the following error values:
  5304.  
  5305.    ■   Invalid address.
  5306.  
  5307.    ■   Invalid selector.
  5308.  
  5309.  
  5310.  
  5311.  
  5312.  Comments
  5313.  
  5314.  This routine maps a physical address to one of the GDT selectors allocated
  5315.  by AllocGDTSelector when the device driver was intitialized. The driver can
  5316.  then fetch data through the returned GDT selector.
  5317.  
  5318.  PhysToGDTSelector creates selector:offset addressability for a 32-bit
  5319.  physical address. However, the returned GDT selector and offset does not
  5320.  represent a normal MS OS/2 memory segment: the selector cannot be passed in
  5321.  system calls. Instead, this selector represents a fabricated segment for
  5322.  private use by the device driver. Only the driver can use it to fetch data.
  5323.  
  5324.  Call the Lock routine before calling PhysToGDTSelector at task time if the
  5325.  memory being addressed is not a fixed memory area, such as ROM or video. The
  5326.  lock may be long-term or short-term.
  5327.  
  5328.  The selector returned by PhysToGDTSelector remains valid until the device
  5329.  driver calls Unlock or calls PhysToGDTSelector again for the same selector.
  5330.  
  5331.  
  5332.  
  5333.  
  5334.  See Also
  5335.  
  5336.  AllocGDTSelector, Lock, Unlock
  5337.  
  5338.  
  5339.  █    PhysToUVirt
  5340.  ────────────────────────────────────────────────────────────────────────────
  5341.  
  5342.  
  5343.  MOV  AX,AddressHigh         ; 32-bit physical address
  5344.  MOV  BX,AddressLow          ; or selector if ReqType = 2
  5345.  MOV  CX,Length              ; length of area (max 65535)
  5346.                              ; with 0 = 65536 bytes
  5347.  MOV  DH,ReqType             ; type of request:
  5348.                              ; 0 = get virtual & make seg ExecuteRead
  5349.                              ; at application privilege level (IOPL=3)
  5350.                              ; 1 = get virtual & make seg ReadWrite
  5351.                              ; at application privilege level (IOPL=3)
  5352.                              ; 2 = free virtual (protected mode only)
  5353.                              ; 3 = get virtual & make seg ExecuteRead
  5354.                              ; with protected I/O access (IOPL=2)
  5355.                              ; 4 = get virtual & make seg ReadWrite
  5356.                              ; with protected I/O access (IOPL=2)
  5357.                              ; 5 = get virtual & make seg ReadWrite
  5358.                              ; at application privilege level (IOPL=3)
  5359.                              ; with associated TagType
  5360.  MOV  SI,TagType             ; if ReqType = 5:
  5361.                              ; 0 = foreground-only PVB selector
  5362.  MOV  DL,DEVHLP_PHYSTOUVIRT  ; DEVHLP_PHYSTOUVIRT EQU 17H
  5363.  CALL [Device_Help]
  5364.  
  5365.  
  5366.  The PhysToUVirt routine converts a 32-bit physical address into a virtual
  5367.  address. It converts the physical address into a valid selector:offset that
  5368.  can be addressed from the current LDT (local descriptor table) in protected
  5369.  mode, or it converts the physical address into a valid segment:offset if the
  5370.  physical address is below one megabyte in real mode.
  5371.  
  5372.  The PhysToUVirt routine can also free a selector that was returned by a
  5373.  preceding call to this routine.
  5374.  
  5375.  
  5376.  Parameters
  5377.  
  5378.  AddressHigh  the high word of the 32-bit physical address, or the selector
  5379.  if the ReqType value is 2.
  5380.  
  5381.  AddressLow  the low word of the 32-bit physical address. This parameter is
  5382.  ignored if the ReqType value is 2.
  5383.  
  5384.  Length  the size in bytes of the segment accessed by the physical address;
  5385.  it may any value in the range 0 to 65,535. If this parameter is 0, the
  5386.  routine uses 65,536 bytes. This parameter is ignored if the ReqType value is
  5387.  2.
  5388.  
  5389.  ReqType  the type of request. It may be one of the following values:
  5390.  
  5391.  Value                             Meaning
  5392.  ────────────────────────────────────────────────────────────────────────────
  5393.  
  5394.  0                                 Get virtual address, make segment er
  5395.                                    (executable-readable), and mark LDT
  5396.                                    selector with I/O privilege level 3
  5397.                                    (application program IOPL, least
  5398.                                    protected, cannot access physical I/O
  5399.                                    ports directly under MS OS/2).
  5400.  
  5401.  1                                 Get virtual address, make segment rw
  5402.                                    (readable-writable), and mark LDT
  5403.                                    selector with I/O privilege level 3
  5404.                                    (application program IOPL, least
  5405.                                    protected, cannot access physical I/O
  5406.                                    ports directly under MS OS/2).
  5407.  
  5408.  2                                 Free protected-mode virtual address
  5409.                                    (selector).
  5410.  
  5411.  3                                 Get virtual address, make segment er,
  5412.                                    and mark LDT selector with I/O privilege
  5413.                                    level 2 (protected from accidental
  5414.                                    modification by any program with IOPL
  5415.                                    equal to 3, may access physical I/O
  5416.                                    ports directly under MS OS/2).
  5417.  
  5418.  4                                 Get virtual address, make segment rw,
  5419.                                    and mark LDT selector with I/O privilege
  5420.                                    level 2 (protected from accidental
  5421.                                    modification by any program with IOPL
  5422.                                    equal to 3, may access physical I/O
  5423.                                    ports directly under MS OS/2).
  5424.  
  5425.  5                                 Get virtual address, make segment rw,
  5426.                                    mark LDT selector with I/O privilege
  5427.                                    level 3 (application program IOPL, least
  5428.                                    protected) and check the associated
  5429.                                    TagType for what kind of special
  5430.                                    processing is required.
  5431.  
  5432.  TagType  what kind of special processing the system should supply for a
  5433.  ReqType value 5. Currently, the TagType value must be 0, indicating a
  5434.  foreground-only PVB (physical video buffer) selector.
  5435.  
  5436.  DEVHLP_PHYSTOUVIRT  the function code; its value is 17H.
  5437.  
  5438.  
  5439.  Return Value
  5440.  
  5441.  The carry (C) flag is cleared if the routine is successful, and the es:bx
  5442.  register pair contains the selector:offset or segment:offset virtual address
  5443.  for ReqType 0, 1, 3, 4, or 5. Otherwise, the C flag is set for an invalid
  5444.  address specification.
  5445.  
  5446.  
  5447.  Comments
  5448.  
  5449.  This routine is typically used to provide a caller of the device driver with
  5450.  addressability to a fixed memory area, such as ROM code or data. The device
  5451.  driver must know the physical address of the memory area in order to provide
  5452.  addressability to an application or to a dynamic-link-library routine.
  5453.  
  5454.  PhysToUVirt leaves its result in es:bx for every ReqType specification
  5455.  except 2. In protected mode, the routine returns a zero offset to bx and
  5456.  creates selector:offset LDT addressability for the 32-bit physical address.
  5457.  In real mode, the routine creates segment:offset addressability for the
  5458.  32-bit physical address if it is below one megabyte. It is an error to call
  5459.  PhysToUVirt in real mode for an address above one megabyte.
  5460.  
  5461.  A selector or segment:offset returned by PhysToUVirt represents the virtual
  5462.  address of a fabricated segment for private use between the driver and a
  5463.  client process. The data within such a segment cannot be passed in system
  5464.  calls; it may be used only by the receiving application to retrieve data.
  5465.  
  5466.  With a ReqType value of 0 or 1, the driver can give an application process
  5467.  addressability to a fixed memory area, such as the BIOS-reserved range from
  5468.  640K bytes to one megabyte or the device driver's primary data segment.
  5469.  
  5470.  With a ReqType value of 3 or 4, the driver can give a dynamic-link-library
  5471.  routine addressability to such a fixed memory area so that the routine can
  5472.  perform I/O. These ReqType specifications keep the area from being accessed
  5473.  by "runaway" applications.
  5474.  
  5475.  With a ReqType value of 5, the driver tags the selector as requiring special
  5476.  handling by the system. You must specify 0 for TagType if you specify 5 for
  5477.  ReqType. For all other values of ReqType, PhysToUVirt preserves the si
  5478.  register. However, subsequent versions of MS OS/2 might define additional
  5479.  values for TagType.
  5480.  
  5481.  PhysToUVirt frees a selector in the ax register for a ReqType value of 2
  5482.  (protected mode only). It ignores the specifications for AddressLow (assumed
  5483.  to be zero) in bx and for Length in cx. When the ReqType value is 2, this
  5484.  routine releases a virtual address that was returned by a preceding
  5485.  PhysToUVirt call.
  5486.  
  5487.  
  5488.  
  5489.  
  5490.  See Also
  5491.  
  5492.  PhysToVirt, UnPhysToVirt
  5493.  
  5494.  
  5495.  █    PhysToVirt
  5496.  ────────────────────────────────────────────────────────────────────────────
  5497.  
  5498.  
  5499.  MOV  BX,AddressLow          ; lower 16 bits of physical address
  5500.  MOV  AX,AddressHigh         ; upper 16 bits of physical address
  5501.  MOV  CX,Length              ; length of segment in bytes
  5502.  MOV  DH,Result              ; leave result:
  5503.                              ; 0 = in DS:SI, 1 = in ES:DI
  5504.  MOV  DL,DEVHLP_PHYSTOVIRT   ; DEVHLP_PHYSTOVIRT EQU 15H
  5505.  CALL [Device_Help]
  5506.  
  5507.  
  5508.  The PhysToVirt routine converts a 32-bit physical address into a virtual
  5509.  address, a selector:offset in protected mode or a segment:offset in real
  5510.  mode. When PhysToVirt is called in real mode and the physical address is
  5511.  above one megabyte, a mode switch occurs.
  5512.  
  5513.  
  5514.  Parameters
  5515.  
  5516.  AddressLow  the low word of the 32-bit physical address.
  5517.  
  5518.  AddressHigh  the high word of the 32-bit physical address.
  5519.  
  5520.  Length  the size in bytes of the memory location (buffer) accessed by the
  5521.  physical address.
  5522.  
  5523.  Result  where the converted-to-virtual address should be be returned. This
  5524.  parameter may be one of the following values:
  5525.  
  5526.  Value                             Meaning
  5527.  ────────────────────────────────────────────────────────────────────────────
  5528.  
  5529.  0                                 Return result in ds:si register pair.
  5530.  
  5531.  1                                 Return result in es:di register pair.
  5532.  
  5533.  DEVHLP_PHYSTOVIRT  the function code; its value is 15H.
  5534.  
  5535.  
  5536.  Return Value
  5537.  
  5538.  The carry (C) flag is cleared and the ds:si or es:di register pair receives
  5539.  a valid virtual address if the routine is successful. Otherwise, the C flag
  5540.  is set if the address was invalid.
  5541.  
  5542.  For a successful call, the zero (Z) flag is cleared if the operating mode is
  5543.  unchanged. The Z flag is set if a mode switch occurred, and previously
  5544.  stored addresses must be recalculated.
  5545.  
  5546.  
  5547.  Comments
  5548.  
  5549.  This routine provides addressability to data for bimodal operations
  5550.  performed during task time and interrupt time. At task time, the driver
  5551.  calls PhysToVirt to perform mode-dependent addressing, relieving it of the
  5552.  need to recognize the CPU mode and the consequent effects on accessing
  5553.  memory.
  5554.  
  5555.  However, this routine is essential when the device driver must access a
  5556.  memory location at both task and interrupt times. The interrupt handler of a
  5557.  bimodal device driver must be able to address data regardless of the context
  5558.  of the current process. The current LDT (local descriptor table) will not
  5559.  necessarily address the data space that the interrupt handler needs to
  5560.  access.
  5561.  
  5562.  The ds register must point to the segment containing the device driver's
  5563.  header when the driver calls PhysToVirt for the first time and whenever it
  5564.  calls PhysToVirt for the first time after a call to UnPhysToVirt.
  5565.  
  5566.  If a driver routine is in real mode when it calls PhysToVirt, a mode switch
  5567.  occurs if the physical-address parameter is above one megabyte. The routine
  5568.  can make multiple calls to PhysToVirt, but it must call the companion
  5569.  routine UnPhysToVirt once before the routine exits.
  5570.  
  5571.  PhysToVirt preserves the state of the cs, ss, and sp registers and preserves
  5572.  the state of ds when results are in es:di or of es when results are in
  5573.  ds:si, provided that no mode switch occurs. Depending on the value of Result
  5574.  and whether a mode switch occurs, PhysToVirt returns the following:
  5575.  
  5576.  Value                             PhysToVirt effect on registers:
  5577.  ────────────────────────────────────────────────────────────────────────────
  5578.  
  5579.  0                                 The ds:si register pair contains the
  5580.                                    valid virtual address. The cs, ss, sp,
  5581.                                    and es registers are preserved if no
  5582.                                    mode switch occurred. Otherwise, the cs
  5583.                                    and ss addresses are converted to
  5584.                                    protected mode, the sp address is
  5585.                                    preserved, and the es address is
  5586.                                    converted only if it accessed the device
  5587.                                    driver's primary data segment when the
  5588.                                    driver first calls PhysToVirt.
  5589.  
  5590.  1                                 The es:di register pair contains the
  5591.                                    valid virtual address. The cs, ss, sp,
  5592.                                    and ds registers are preserved if no
  5593.                                    mode switch occurred. Otherwise, the cs
  5594.                                    and ss addresses are converted to
  5595.                                    protected mode, the sp address is
  5596.                                    preserved, and the ds address is
  5597.                                    converted only if it accesses the device
  5598.                                    driver's primary data segment.
  5599.  
  5600.  Note that all real-mode addresses that PhysToVirt returned are no longer
  5601.  valid if a subsequent call causes a mode switch. Such addresses must be
  5602.  converted to protected mode by calls to PhysToVirt. Note also that
  5603.  previously stored address pointers that contain the real-mode ds value of
  5604.  the driver's data segment must be converted to protected mode before use.
  5605.  Check the Z flag to determine whether PhysToVirt caused a switch to
  5606.  protected mode. Then call PhysToVirt to convert each necessary address into
  5607.  a selector:offset.
  5608.  
  5609.  Converted addresses are valid as long as the device driver retains control
  5610.  of the CPU; calls to Block, TCYield, and Yield, and execution of the ret
  5611.  instruction invalidate the addresses supplied by PhysToVirt. An interrupt
  5612.  handler can use these addresses with interrupts enabled until it calls EOI.
  5613.  If the handler will use PhysToVirt addresses after the EOI, it must disable
  5614.  interrupts before calling EOI to keep these addresses valid.
  5615.  
  5616.  For performance reasons, a device driver routine can optimize its use of
  5617.  PhysToVirt calls as follows:
  5618.  
  5619.    ■   If the ds register does not point to the driver's primary data segment
  5620.        (containing the device header), reset it to this segment.
  5621.  
  5622.    ■   Choose an address that is most likely to cause a mode switch and
  5623.        specify Result as 1 for the first call to PhysToVirt. If the call is
  5624.        successful, results are in es:di. If a mode switch occurred, the Z
  5625.        flag is set and the ds segment value for the driver's primary data
  5626.        segment has been converted to a protected-mode selector.
  5627.  
  5628.    ■   While the pointer returned by PhysToVirt is in use, do not enable
  5629.        interrupts, change the returned es or ds value, save the returned es
  5630.        or ds values on the stack and restore them, or call another DevHlp
  5631.        routine. The returned pointer may be saved in the driver's data
  5632.        segment before another call to PhysToVirt. The driver can make
  5633.        multiple calls to PhysToVirt.
  5634.  
  5635.    ■   Call UnPhysToVirt to release all the addresses returned by calls to
  5636.        PhysToVirt before returning control.
  5637.  
  5638.  
  5639.  Because PhysToVirt leaves its results in es:di or ds:si, the driver can move
  5640.  strings from buffer to buffer in either direction, without having to convert
  5641.  real-mode addresses if the first PhysToVirt call switched modes.
  5642.  
  5643.  
  5644.  
  5645.  
  5646.  See Also
  5647.  
  5648.  Block, EOI, PhysToUVirt, TCYield, UnPhysToVirt, Yield
  5649.  
  5650.  
  5651.  █    ProtToReal
  5652.  ────────────────────────────────────────────────────────────────────────────
  5653.  
  5654.  
  5655.  MOV DL,DEVHLP_PROTTOREAL        ; DEVHLP_PROTTOREAL EQU 30H
  5656.  CALL [Device_Help]
  5657.  
  5658.  
  5659.  The ProtToReal routine changes the operating mode from protected to real for
  5660.  an interrupt handler.
  5661.  
  5662.  
  5663.  Parameters
  5664.  
  5665.  DEVHLP_PROTTOREAL  the function code; its value is 30H.
  5666.  
  5667.  
  5668.  Return Value
  5669.  
  5670.  The carry (C) flag is cleared if the routine is successful. Otherwise, the C
  5671.  flag is set and the operating mode has not changed to real mode. Note that
  5672.  the C flag is set for a real mode call of ProtToReal, and the ax register
  5673.  has the following error value:
  5674.  
  5675.    ■   Stack in high memory.
  5676.  
  5677.  
  5678.  
  5679.  
  5680.  Comments
  5681.  
  5682.  This routine changes the operating mode from protected to real at interrupt
  5683.  time so that the device driver can service a device interrupt. On entry, the
  5684.  ds register should be set to the device driver's low-memory data segment.
  5685.  ProtToReal does not preserve the contents of the es register.
  5686.  
  5687.  When it has finished servicing the device, the interrupt handler must
  5688.  restore the original operating mode before relinquishing control.
  5689.  
  5690.  
  5691.  Example
  5692.  
  5693.  The following example shows how to determine whether the processor must be
  5694.  switched from protected mode to real mode and back by checking the machine
  5695.  status word (MSW):
  5696.  
  5697.      SMSW AX                     ; get current MSW
  5698.      PUSH AX                     ; save original MSW
  5699.      RCR  AX,1                   ; shift Protect Enabled bit into Carry Flag
  5700.      JNC  RM1                    ; jump if already in real mode
  5701.      MOV  DL,DEVHLP_PROTTOREAL   ; DEVHLP_PROTTOREAL EQU 30H
  5702.      CALL [Device_Help]          ; if in protected mode
  5703.  
  5704.  RM1: ; process in real mode
  5705.          .
  5706.          .
  5707.      POP  AX                     ; retrieve original MSW
  5708.      RCR  AX,1                   ; shift PE bit into CF
  5709.      JNC  RM2                    ; jump if originally in real mode
  5710.      MOV  DL,DEVHLP_REALTOPROT
  5711.      CALL [Device_Help]          ; switch back to protected mode
  5712.  RM2:
  5713.          .
  5714.          .
  5715.  
  5716.  
  5717.  
  5718.  
  5719.  
  5720.  
  5721.  
  5722.  See Also
  5723.  
  5724.  RealToProt
  5725.  
  5726.  
  5727.  █    PullParticular
  5728.  ────────────────────────────────────────────────────────────────────────────
  5729.  
  5730.  
  5731.  MOV  SI,OFFSET Queue            ; offset to queue header that
  5732.                                  ; points to next request
  5733.  LES  BX,ReqPacket               ; pointer to request packet
  5734.                                  ; to be pulled from queue
  5735.  MOV  DL,DEVHLP_PULLPARTICULAR   ; DEVHLP_PULLPARTICULAR EQU 0BH
  5736.  CALL [Device_Help]
  5737.  
  5738.  
  5739.  The PullParticular routine pulls the specified request packet from the
  5740.  specified queue.
  5741.  
  5742.  
  5743.  Parameters
  5744.  
  5745.  Queue  the queue header in the device driver's data segment (accessed by
  5746.  ds). The queue header points to the next request for the device to service.
  5747.  
  5748.  ReqPacket  to the request packet to be removed from the queue.
  5749.  
  5750.  DEVHLP_PULLPARTICULAR  the function code; its value is 0BH.
  5751.  
  5752.  
  5753.  Return Value
  5754.  
  5755.  The carry (C) flag is cleared if the routine is successful. Otherwise, the C
  5756.  flag is set if the specified request packet is not found.
  5757.  
  5758.  
  5759.  Comments
  5760.  
  5761.  This routine removes the specified request packet when this packet is not
  5762.  necessarily the first element in the request queue. The first element can be
  5763.  removed by a call to PullReqPacket.
  5764.  
  5765.  
  5766.  
  5767.  
  5768.  See Also
  5769.  
  5770.  AllocReqPacket, PullReqPacket, PushReqPacket
  5771.  
  5772.  
  5773.  █    PullReqPacket
  5774.  ────────────────────────────────────────────────────────────────────────────
  5775.  
  5776.  
  5777.  MOV  SI,OFFSET Queue            ; offset to queue header that
  5778.                                  ; points to next request
  5779.  MOV  DL,DEVHLP_PULLREQUEST      ; DEVHLP_PULLREQUEST EQU 0AH
  5780.  CALL [Device_Help]
  5781.  
  5782.  
  5783.  The PullReqPacket routine pulls the next request packet waiting for device
  5784.  service in the specified queue.
  5785.  
  5786.  
  5787.  Parameters
  5788.  
  5789.  Queue  the queue header in the device driver's data segment (accessed by
  5790.  ds). The queue header points to the next request for the device to service.
  5791.  
  5792.  DEVHLP_PULLREQUEST  the function code; its value is 0AH.
  5793.  
  5794.  
  5795.  Return Value
  5796.  
  5797.  The carry (C) flag is cleared and the es:bx register pair contains the
  5798.  address of the first request packet in the queue if the routine is
  5799.  successful. Otherwise, the C flag is set if the queue is empty.
  5800.  
  5801.  
  5802.  Comments
  5803.  
  5804.  This routine removes the next request packet from the request list for
  5805.  device service. The device driver uses the PushReqPacket and PullReqPacket
  5806.  routines to maintain a request queue for each device it supports.
  5807.  
  5808.  
  5809.  
  5810.  
  5811.  See Also
  5812.  
  5813.  AllocReqPacket, FreeReqPacket, PullParticular, PushReqPacket, SortReqPacket
  5814.  
  5815.  
  5816.  █    PushReqPacket
  5817.  ────────────────────────────────────────────────────────────────────────────
  5818.  
  5819.  
  5820.  MOV  SI,OFFSET Queue            ; offset to queue header that
  5821.                                  ; points to next request
  5822.  LES  BX,ReqPacket               ; pointer to request packet that
  5823.                                  ; goes into the queue
  5824.  MOV  DL,DEVHLP_PUSHREQUEST      ; DEVHLP_PUSHREQUEST EQU 09H
  5825.  CALL [Device_Help]
  5826.  
  5827.  
  5828.  The PushReqPacket routine adds the specified device request packet to the
  5829.  list of packets waiting for device service.
  5830.  
  5831.  
  5832.  Parameters
  5833.  
  5834.  Queue  the queue header in the device driver's data segment (accessed by
  5835.  ds). The queue header points to the next request for the device to service.
  5836.  
  5837.  ReqPacket  to the request packet to be added to the list.
  5838.  
  5839.  DEVHLP_PUSHREQUEST  the function code; its value is 09.
  5840.  
  5841.  
  5842.  Return Value
  5843.  
  5844.  PushReqPacket does not return a value.
  5845.  
  5846.  
  5847.  Comments
  5848.  
  5849.  This routine places request packets allocated by AllocReqPacket into the
  5850.  request queue for device service.
  5851.  
  5852.  The device driver task-time thread adds all incoming read/write requests to
  5853.  its request list. This thread then determines whether the interrupt-time
  5854.  thread is active. If not, it sends the request to the device. Since the
  5855.  device may be active at this point, the task-time thread must turn off
  5856.  interrupts before calling the device. Otherwise, a window exists in which
  5857.  the device finishes before the request packet is put on the list.
  5858.  
  5859.  
  5860.  
  5861.  
  5862.  See Also
  5863.  
  5864.  AllocReqPacket, PullParticular, PullReqPacket, SortReqPacket
  5865.  
  5866.  
  5867.  █    QueueFlush
  5868.  ────────────────────────────────────────────────────────────────────────────
  5869.  
  5870.  
  5871.  MOV  BX,OFFSET ChQueue      ; offset to character buffer
  5872.  MOV  DL,DEVHLP_QUEUEFLUSH   ; DEVHLP_QUEUEFLUSH EQU 10H
  5873.  CALL [Device_Help]
  5874.  
  5875.  
  5876.  The QueueFlush routine clears the specified character-queue buffer.
  5877.  
  5878.  
  5879.  Parameters
  5880.  
  5881.  ChQueue  the character-queue buffer in the device driver's data segment
  5882.  (accessed by ds).
  5883.  
  5884.  DEVHLP_QUEUEFLUSH  the function code; its value is 10H.
  5885.  
  5886.  
  5887.  Return Value
  5888.  
  5889.  QueueFlush does not return a value.
  5890.  
  5891.  
  5892.  Comments
  5893.  
  5894.  This routine empties the character-queue buffer. The buffer must have been
  5895.  initialized by QueueInit before the call to QueueFlush.
  5896.  
  5897.  
  5898.  
  5899.  
  5900.  See Also
  5901.  
  5902.  QueueInit, QueueRead, QueueWrite
  5903.  
  5904.  
  5905.  █    QueueInit
  5906.  ────────────────────────────────────────────────────────────────────────────
  5907.  
  5908.  
  5909.  MOV  BX,OFFSET ChQueue      ; offset to character buffer
  5910.                              ; to be initialized with
  5911.                              ; QSize field already set up
  5912.  MOV  DL,DEVHLP_QUEUEINIT    ; DEVHLP_QUEUEINIT EQU 0FH
  5913.  CALL [Device_Help]
  5914.  
  5915.  
  5916.  The QueueInit routine initializes the specified character-queue buffer.
  5917.  
  5918.  
  5919.  Parameters
  5920.  
  5921.  ChQueue  the character-queue buffer whose structure is defined as follows:
  5922.  
  5923.  CharQueue STRUC
  5924.      QSize    DW ?    ; size of queue in bytes
  5925.      QChrOut  DW ?    ; index of next char out
  5926.      QCount   DW ?    ; count of chars in queue
  5927.      QBase    DB ?    ; start of queue buffer
  5928.  CharQueue ENDS
  5929.  
  5930.  
  5931.  The buffer resides in the device driver's low-memory data segment (accessed
  5932.  by ds). The QSize field of the character buffer must be initialized before
  5933.  the call to QueueInit.
  5934.  
  5935.  DEVHLP_QUEUEINIT  the function code; its value is 0FH.
  5936.  
  5937.  
  5938.  Return Value
  5939.  
  5940.  QueueInit does not return a value.
  5941.  
  5942.  
  5943.  Comments
  5944.  
  5945.  This routine initializes a simple circular buffer of characters for a device
  5946.  driver. The driver does the following:
  5947.  
  5948.    ■   Defines the buffer structure.
  5949.  
  5950.    ■   Allocates one or more character-queue buffers.
  5951.  
  5952.    ■   Initializes the QSize field for each buffer.
  5953.  
  5954.    ■   Calls QueueInit for each buffer before calling other character-queue
  5955.        routines that operate on the buffer.
  5956.  
  5957.  
  5958.  The routines QueueWrite, QueueRead, and QueueFlush operate on the
  5959.  uninitialized fields of the structure. The driver can ignore these fields.
  5960.  
  5961.  Note that the driver always has addressability to its low-memory data
  5962.  segment (accessed by ds), so a character-queue buffer is accessible in both
  5963.  protected and real modes.
  5964.  
  5965.  
  5966.  
  5967.  
  5968.  See Also
  5969.  
  5970.  QueueFlush, QueueRead, QueueWrite
  5971.  
  5972.  
  5973.  █    QueueRead
  5974.  ────────────────────────────────────────────────────────────────────────────
  5975.  
  5976.  
  5977.  MOV  BX,OFFSET ChQueue      ; offset to character buffer
  5978.  MOV  DL,DEVHLP_QUEUEREAD    ; DEVHLP_QUEUEREAD EQU 12H
  5979.  CALL [Device_Help]
  5980.  
  5981.  
  5982.  The QueueRead routine removes a character from the beginning of the
  5983.  specified character-queue buffer.
  5984.  
  5985.  
  5986.  Parameters
  5987.  
  5988.  ChQueue  the character-queue buffer in the device driver's data segment
  5989.  (accessed by ds).
  5990.  
  5991.  DEVHLP_QUEUEREAD  the function code; its value is 12H.
  5992.  
  5993.  
  5994.  Return Value
  5995.  
  5996.  The carry (C) flag is cleared and the al register contains the character
  5997.  removed from the queue if the routine is successful. Otherwise, the C flag
  5998.  is set if the queue is empty.
  5999.  
  6000.  
  6001.  Comments
  6002.  
  6003.  This routine removes a character from a character device driver's data
  6004.  buffer. The buffer must have been initialized by QueueInit before the call
  6005.  to QueueRead, but the buffer remains empty until a character is inserted by
  6006.  QueueWrite.
  6007.  
  6008.  
  6009.  
  6010.  
  6011.  See Also
  6012.  
  6013.  QueueFlush, QueueInit, QueueWrite
  6014.  
  6015.  
  6016.  █    QueueWrite
  6017.  ────────────────────────────────────────────────────────────────────────────
  6018.  
  6019.  
  6020.  MOV  BX,OFFSET ChQueue      ; offset to character buffer
  6021.  MOV  AL,Character           ; character to insert into queue
  6022.  MOV  DL,DEVHLP_QUEUEWRITE   ; DEVHLP_QUEUEWRITE EQU 11H
  6023.  CALL [Device_Help]
  6024.  
  6025.  
  6026.  The QueueWrite routine inserts a character at the end of the specified
  6027.  character-queue buffer.
  6028.  
  6029.  
  6030.  Parameters
  6031.  
  6032.  ChQueue  the character-queue buffer in the device driver's data segment
  6033.  (accessed by ds).
  6034.  
  6035.  Character  the character to be inserted at the end of the queue.
  6036.  
  6037.  DEVHLP_QUEUEWRITE  the function code; its value is 11H.
  6038.  
  6039.  
  6040.  Return Value
  6041.  
  6042.  The carry (C) flag is cleared if the routine is successful. Otherwise, the C
  6043.  flag is set if the queue is full.
  6044.  
  6045.  
  6046.  Comments
  6047.  
  6048.  This routine adds a character to the device driver's data buffer. The buffer
  6049.  must have been initialized by QueueInit before the call to QueueWrite.
  6050.  
  6051.  
  6052.  
  6053.  
  6054.  See Also
  6055.  
  6056.  QueueFlush, QueueInit, QueueRead
  6057.  
  6058.  
  6059.  █    RealToProt
  6060.  ────────────────────────────────────────────────────────────────────────────
  6061.  
  6062.  
  6063.  MOV  DL,DEVHLP_REALTOPROT       ; DEVHLP_REALTOPROT EQU 2FH
  6064.  CALL [Device_Help]
  6065.  
  6066.  
  6067.  The RealToProt routine changes the operating mode from real to protected for
  6068.  an interrupt handler.
  6069.  
  6070.  
  6071.  Parameters
  6072.  
  6073.  DEVHLP_REALTOPROT  the function code; its value is 2FH.
  6074.  
  6075.  
  6076.  Return Value
  6077.  
  6078.  The carry (C) flag is cleared if the routine is successful. Otherwise, the C
  6079.  flag is set and the operating mode has not changed to protected mode. Note
  6080.  that the C flag is set for a protected-mode call of RealToProt.
  6081.  
  6082.  
  6083.  Comments
  6084.  
  6085.  This routine changes the operating mode from real to protected at interrupt
  6086.  time so that the device driver can service a device interrupt. On entry, the
  6087.  ds register should be set to the device driver's data segment. RealToProt
  6088.  does not preserve the contents of the es register.
  6089.  
  6090.  When it has serviced the device, the interrupt handler must restore the
  6091.  original operating mode before relinquishing control.
  6092.  
  6093.  
  6094.  Example
  6095.  
  6096.  The following example shows how to determine whether the processor must be
  6097.  switched from protected mode to real mode and back by checking the machine
  6098.  status word (MSW):
  6099.  
  6100.       SMSW AX                    ; get current MSW
  6101.       PUSH AX                    ; save original MSW
  6102.       RCR  AX,1                  ; shift Protect Enabled bit into Carry Flag
  6103.       JC   PM1                   ; jump if already in protected mode
  6104.       MOV  DL,DEVHLP_REALTOPROT  ; DEVHLP_REALTOPROT EQU 2FH
  6105.       CALL [Device_Help]         ; if in real mode
  6106.  PM1: ; process in protected mode
  6107.          .
  6108.          .
  6109.       POP  AX                    ; retrieve original MSW
  6110.       RCR  AX,1                  ; shift PE bit into CF
  6111.       JC   PM2                   ; jump if originally in protected mode
  6112.       MOV  DL,DEVHLP_PROTTOREAL
  6113.       CALL [Device_Help]         ; switch back to real mode
  6114.  PM2:
  6115.          .
  6116.          .
  6117.  
  6118.  
  6119.  
  6120.  
  6121.  
  6122.  
  6123.  
  6124.  See Also
  6125.  
  6126.  ProtToReal
  6127.  
  6128.  
  6129.  █    Register
  6130.  ────────────────────────────────────────────────────────────────────────────
  6131.  
  6132.  
  6133.  LES  SI,InBuff          ; pointer to input buffer
  6134.  MOV  DI,OutBuffOffset   ; offset of output buffer
  6135.  MOV  CX,MonitorPID      ; Process ID of monitor task
  6136.  MOV  AX,MonHandle       ; handle for chain
  6137.                          ; returned by MonitorCreate
  6138.  MOV  DH,PlacementFlag   ; high or low place in chain
  6139.  MOV  DL,DEVHLP_REGISTER ; DEVHLP_REGISTER EQU 20H
  6140.  CALL [Device_Help]
  6141.  
  6142.  
  6143.  The Register routine adds a monitor to a chain of monitors that the device
  6144.  driver supports.
  6145.  
  6146.  
  6147.  Parameters
  6148.  
  6149.  InBuff  to the input buffer. The monitor task's DosMonReg request supplied
  6150.  this value in the IOCtl request packet.
  6151.  
  6152.  OutBuffOffset  the offset to the output buffer. The monitor task's request
  6153.  also supplied this value.
  6154.  
  6155.  MonitorPID  the process identifier of the monitor task. The driver called
  6156.  GetDosVar to get LocINFOSeg access and obtained this value from the current
  6157.  LDT (local descriptor table).
  6158.  
  6159.  MonHandle  the monitor chain. The device driver called MonitorCreate to
  6160.  obtain this value.
  6161.  
  6162.  PlacementFlag  where to place the monitor in the chain. The monitor task's
  6163.  request also supplied this value.
  6164.  
  6165.  DEVHLP_REGISTER  the function code; its value is 20H.
  6166.  
  6167.  
  6168.  Return Value
  6169.  
  6170.  The carry (C) flag is cleared if the routine is successful. Otherwise, the C
  6171.  flag is set and the ax register may have one of the following error values:
  6172.  
  6173.    ■   Invalid monitor handle.
  6174.  
  6175.    ■   Not enough memory.
  6176.  
  6177.    ■   Monitor buffer too small.
  6178.  
  6179.  
  6180.  
  6181.  
  6182.  Comments
  6183.  
  6184.  This routine adds a monitor to a monitor chain whose last element is two
  6185.  addresses: the device driver's monitor buffer and notification routine. The
  6186.  driver may call Register only at task time in protected mode.
  6187.  
  6188.  A monitor task supplies a pointer to its input buffer, its output buffer
  6189.  offset, and a placement flag when it calls DosMonReg to request monitor
  6190.  registration. Each buffer's first word must contain the length in bytes of
  6191.  the supplied buffer. A monitor's input and output buffers must be at least
  6192.  twenty bytes greater than the length of the device driver's monitor buffer.
  6193.  
  6194.  MS OS/2 forwards a monitor task's registration request to the appropriate
  6195.  device driver. The device driver supplies the monitor-chain handle returned
  6196.  by MonitorCreate and the process identifier (PID) of the requesting monitor
  6197.  task when it calls Register. The driver determines the PID of the requesting
  6198.  monitor task by calling GetDosVar for access to the LocINFOSeg (current
  6199.  LDT).
  6200.  
  6201.  Note that a process may make more than one monitor-registration request,
  6202.  supplying different input- and output-buffer parameters in each request
  6203.  forwarded to the driver by the system monitor dispatcher. A process may also
  6204.  register different monitors in different monitor chains.
  6205.  
  6206.  The device driver should keep track of the monitors registered for each
  6207.  monitor chain it supports. When a monitor task calls DosMonClose, the driver
  6208.  must call DeRegister to remove the task's monitors from the chain. A chain
  6209.  must be empty when the device driver calls MonitorCreate to remove the chain
  6210.  itself.
  6211.  
  6212.  
  6213.  
  6214.  
  6215.  See Also
  6216.  
  6217.  DeRegister, GetDosVar, MonCreate, MonFlush, MonWrite
  6218.  
  6219.  
  6220.  █    RegisterStackUsage
  6221.  ────────────────────────────────────────────────────────────────────────────
  6222.  
  6223.  
  6224.  MOV  BX,OFFSET StackUse             ; offset in DS data segment
  6225.  MOV  DL,DEVHLP_REGISTERSTACKUSAGE   ; DEVHLP_REGISTERSTACKUSAGE EQU 3AH
  6226.  CALL [Device_Help]
  6227.  
  6228.  
  6229.  The RegisterStackUsage routine tells the system interrupt manager the device
  6230.  driver's expected stack requirements when it initializes.
  6231.  
  6232.  
  6233.  Parameters
  6234.  
  6235.  StackUse  the driver's expected interrupt stack usage as structured data,
  6236.  defined as follows:
  6237.  
  6238.  StackUsage  STRUC
  6239.      SU_cbStruc      DW 14
  6240.      SU_Flags        DW  ?
  6241.      SU_iIRQ         DW  ?
  6242.      SU_cbStackCLI   DW  ?
  6243.      SU_cbStackSTI   DW  ?
  6244.      SU_cbStackEOI   DW  ?
  6245.      SU_cNest        DW  ?
  6246.  StackUsage ENDS
  6247.  
  6248.  
  6249.  The StackUse fields specify the following:
  6250.  
  6251.  Field                             Specifies
  6252.  ────────────────────────────────────────────────────────────────────────────
  6253.  
  6254.  SU_cbStruc                        Number of bytes in structure, including
  6255.                                    this field.
  6256.  
  6257.  SU_Flags                          Value 0001H if the interrupt handler
  6258.                                    enables interrupts; otherwise, 0000H
  6259.                                    (reserved).
  6260.  
  6261.  SU_iIRQ                           IRQ level (0-0FH) for the interrupt
  6262.                                    handler described by the next three
  6263.                                    fields:
  6264.  
  6265.  SU_cbStackCLI                     Number of stack bytes that the interrupt
  6266.                                    handler uses when interrupts are
  6267.                                    disabled.
  6268.  
  6269.  SU_cbStackSTI                     Number of stack bytes that the interrupt
  6270.                                    handler uses after it enables interrupts.
  6271.  
  6272.  SU_cbStackEOI                     Number of stack bytes used after the
  6273.                                    interrupt handler calls the EOI routine.
  6274.  
  6275.  SU_cNest                          Maximum number of levels that the driver
  6276.                                    expects interrupt routines to nest.
  6277.  
  6278.  DEVHLP_REGISTERSTACKUSAGE  the function code; its value is 3AH.
  6279.  
  6280.  
  6281.  Return Value
  6282.  
  6283.  The carry (C) flag is cleared if the routine is successful. Otherwise, the C
  6284.  flag is set if the stack usage exceeds the system maximum (8K for the
  6285.  interrupt stack).
  6286.  
  6287.  
  6288.  Comments
  6289.  
  6290.  This routine registers a device driver's interrupt stack requirements with
  6291.  the system interrupt manager when the driver initializes. The maximum
  6292.  interrupt stack is 8K, so the driver must call UnSetIRQ if its stack usage
  6293.  specification exceeds the system maximum.
  6294.  
  6295.  If the device driver services multiple IRQs, it must call RegisterStackUsage
  6296.  for each IRQ it handles.
  6297.  
  6298.  If the driver underestimates the maximum number of levels that its interrupt
  6299.  routines nest, the system interrupt manager disables the IRQ at the PIC
  6300.  (programmable interrupt controller) until a reboot occurs.
  6301.  
  6302.  
  6303.  
  6304.  
  6305.  See Also
  6306.  
  6307.  EOI, SetIRQ, UnSetIRQ
  6308.  
  6309.  
  6310.  █    ResetTimer
  6311.  ────────────────────────────────────────────────────────────────────────────
  6312.  
  6313.  
  6314.  MOV  AX,OFFSET CS:TimerHandler    ; offset to driver's timer handler
  6315.  MOV  DL,DEVHLP_RESETTIMER         ; DEVHLP_RESETTIMER EQU 1EH
  6316.  CALL [Device_Help]
  6317.  
  6318.  
  6319.  The ResetTimer routine releases a device driver's registered timer handler.
  6320.  The routine removes the specified timer handler from the list of timer
  6321.  handlers to be called on a tick count.
  6322.  
  6323.  
  6324.  Parameters
  6325.  
  6326.  TimerHandler  the offset in the driver's code segment to the timer handler.
  6327.  
  6328.  DEVHLP_RESETTIMER  the function code; its value is 1EH.
  6329.  
  6330.  
  6331.  Return Value
  6332.  
  6333.  The carry (C) flag is cleared if the routine is successful. Otherwise, the C
  6334.  flag is set if the specified TimerHandler address is not found in the list
  6335.  of registered timer handlers.
  6336.  
  6337.  
  6338.  Comments
  6339.  
  6340.  This routine removes a timer handler from the system list of registered
  6341.  timer handlers when a device driver does not need it. The driver may call
  6342.  SetTimer or TickCount to reregister the timer handler when it needs the
  6343.  handler again. MS OS/2 timer handlers are analogous to the user timer
  6344.  interrupt (INT 1CH).
  6345.  
  6346.  The ds register must point to the device driver's low-memory data segment
  6347.  when the driver calls ResetTimer. This low-memory data segment is the
  6348.  first-linked segment that contains the device header. If the driver has
  6349.  already called PhysToVirt with ds, this register must be reset before the
  6350.  call to ResetTimer.
  6351.  
  6352.  
  6353.  
  6354.  
  6355.  See Also
  6356.  
  6357.  PhysToVirt, SetTimer, TickCount
  6358.  
  6359.  
  6360.  █    ROMCritSection
  6361.  ────────────────────────────────────────────────────────────────────────────
  6362.  
  6363.  
  6364.  MOV  AL,EnterOrExit             ; critical section flag:
  6365.                                  ; 0 = exit, nonzero = enter
  6366.  MOV  DL,DEVHLP_ROMCRITSECTION   ; DEVHLP_ROMCRITSECTION EQU 26H
  6367.  CALL [Device_Help]
  6368.  
  6369.  
  6370.  The ROMCritSection routine flags a critical section of execution in the ROM
  6371.  BIOS to prevent the real-mode session from being suspended in the
  6372.  background. Device drivers' ROM BIOS compatibility handlers call this
  6373.  routine.
  6374.  
  6375.  
  6376.  Parameters
  6377.  
  6378.  EnterOrExit  a critical-section flag with one of the following values:
  6379.  
  6380.  Value                             Meaning
  6381.  ────────────────────────────────────────────────────────────────────────────
  6382.  
  6383.  0                                 Exit critical section.
  6384.  
  6385.  Nonzero                           Enter critical section.
  6386.  
  6387.  DEVHLP_ROMCRITSECTION  the function code; its value is 26H.
  6388.  
  6389.  
  6390.  Return Value
  6391.  
  6392.  ROMCritSection does not return a value.
  6393.  
  6394.  
  6395.  Comments
  6396.  
  6397.  This routine protects a critical section of execution in the ROM BIOS.
  6398.  
  6399.  Certain sections of ROM BIOS code must be protected from the preemption that
  6400.  would occur if a user starts a protected-mode application, causing the
  6401.  real-mode session to be suspended in the background. Some real-mode I/O
  6402.  processing should never be suspended, in particular, the printer (BIOS INT
  6403.  17H), disk (BIOS INT 13H), and screen (BIOS INT 10H).
  6404.  
  6405.  The device driver must intercept the appropriate ROM BIOS interrupt and call
  6406.  ROMCritSection to protect the ROM BIOS critical section of execution.
  6407.  
  6408.  ────────────────────────────────────────────────────────────────────────────
  6409.  Warning
  6410.  
  6411.  When the driver's interrupt handler calls ROMCritSection to enter a critical
  6412.  section, the foreground real-mode session will remain in the foreground.
  6413.  This can cause problems for the user.
  6414.  ────────────────────────────────────────────────────────────────────────────
  6415.  
  6416.  
  6417.  
  6418.  For example, if a real-mode terminate-and-stay-resident (TSR) program takes
  6419.  control while the CPU is executing the ROM BIOS, time spent in the critical
  6420.  section will be longer and the user will be unable to switch screens. The
  6421.  worst case occurs when the TSR program is interactive, thus preventing the
  6422.  interrupt handler from calling ROMCritSection in order to exit. Under these
  6423.  conditions, the user cannot switch screens until the TSR program ends.
  6424.  
  6425.  
  6426.  
  6427.  
  6428.  
  6429.  See Also
  6430.  
  6431.  SetROMVector
  6432.  
  6433.  
  6434.  █    Run
  6435.  ────────────────────────────────────────────────────────────────────────────
  6436.  
  6437.  
  6438.  MOV  BX,EventIDLow      ; low word of event ID
  6439.  MOV  AX,EventIDHigh     ; high word of event ID
  6440.  MOV  DL,DEVHLP_PROCRUN  ; DEVHLP_PROCRUN EQU 05H
  6441.  CALL [Device_Help]
  6442.  
  6443.  
  6444.  The Run routine releases a thread that was suspended by a call to Block.
  6445.  
  6446.  
  6447.  Parameters
  6448.  
  6449.  EventIDLow  the low word of the event identifier.
  6450.  
  6451.  EventIDHigh  the high word of the event identifier.
  6452.  
  6453.  DEVHLP_PROCRUN  the function code; its value is 05.
  6454.  
  6455.  
  6456.  Return Value
  6457.  
  6458.  The ax register contains a count of the threads released by Run. If none
  6459.  were released, the zero (Z) flag is cleared. Otherwise, the Z flag is set.
  6460.  
  6461.  
  6462.  Comments
  6463.  
  6464.  This routine awakens all threads that were blocked for the specified event
  6465.  identifier and returns immediately to its caller, usually an interrupt
  6466.  handler. Run is the companion routine to Block.
  6467.  
  6468.  MS OS/2 puts the awakened threads into the run queue to be executed at the
  6469.  next available opportunity.
  6470.  
  6471.  
  6472.  
  6473.  
  6474.  See Also
  6475.  
  6476.  Block
  6477.  
  6478.  
  6479.  █    SchedClockAddr
  6480.  ────────────────────────────────────────────────────────────────────────────
  6481.  
  6482.  
  6483.  MOV  AX,OFFSET PtrSave      ; offset to DWORD in driver's DS data segment
  6484.  MOV  DL,DEVHLP_SCHEDCLOCK   ; DEVHLP_SCHEDCLOCK EQU 00H
  6485.  CALL [Device_Help]
  6486.  
  6487.  
  6488.  The SchedClockAddr routine returns an indirect pointer to the address of the
  6489.  MS OS/2 clock-tick handler, SchedClock, for a clock device driver to use.
  6490.  The clock driver must call SchedClock on each occurrence of a periodic clock
  6491.  tick.
  6492.  
  6493.  
  6494.  Parameters
  6495.  
  6496.  PtrSave  the offset to a dword allocated in the clock driver's low-memory
  6497.  data segment (accessed by ds).
  6498.  
  6499.  DEVHLP_SCHEDCLOCK  the function code; its value is 00.
  6500.  
  6501.  
  6502.  Return Value
  6503.  
  6504.  The PtrSave location contains an indirect bimodal pointer to the system tick
  6505.  handler SchedClock.
  6506.  
  6507.  
  6508.  Comments
  6509.  
  6510.  The SchedClockAddr routine is called during a clock device driver's
  6511.  initialization. The driver must do the following:
  6512.  
  6513.    ■   Before it calls SchedClockAddr, allocate a dword PtrSave area in its
  6514.        first-linked segment that contains the device header.
  6515.  
  6516.    ■   When it calls SchedClockAddr, ensure that the ds register points to
  6517.        this data segment and supply the offset to the PtrSave area.
  6518.  
  6519.  
  6520.  The SchedClockAddr routine then fills the PtrSave area with a bimodal
  6521.  pointer to a dword in system memory that contains the pointer to the
  6522.  SchedClock routine. Because the returned pointer is bimodal, the clock
  6523.  driver need not perform conversions for protected- and real-mode operations
  6524.  with this pointer. The driver uses the PtrSave pointer to call the
  6525.  SchedClock routine.
  6526.  
  6527.  The driver's interrupt handler must call SchedClock for each periodic clock
  6528.  tick in order to indicate the passage of system time. The handler makes the
  6529.  call as follows:
  6530.  
  6531.  MOV  AL,Millisecs       ; milliseconds since last call
  6532.  MOV  DH,EOIFlag         ; this tick relative to EOI:
  6533.                          ; 0 = before EOI, 1 = after EOI
  6534.  CALL [PtrSaveValue]     ; pointer returned by SchedClockAddr
  6535.                          ; to system pointer to SchedClock routine
  6536.  
  6537.  
  6538.  Note that the driver's interrupt handler must use the pointer returned by
  6539.  SchedClockAddr to make a far indirect call to the system's SchedClock
  6540.  routine.
  6541.  
  6542.  The clock driver's interrupt handler must run with interrupts enabled before
  6543.  it calls EOI for the timer interrupt. The handler must also do any critical
  6544.  processing, such as updating the fraction-of-seconds count, before it calls
  6545.  the SchedClock routine. SchedClock disperses the tick to appropriate
  6546.  components of the system prior to dismissal of the interrupt. When
  6547.  SchedClock returns, the clock driver must call EOI and then call SchedClock
  6548.  again.
  6549.  
  6550.  Note that the device driver's interrupt handler can be reentered after the
  6551.  EOI call. The system's SchedClock routine is also reentrant.
  6552.  
  6553.  
  6554.  
  6555.  
  6556.  See Also
  6557.  
  6558.  EOI
  6559.  
  6560.  
  6561.  █    SemClear
  6562.  ────────────────────────────────────────────────────────────────────────────
  6563.  
  6564.  
  6565.  MOV  BX,SemHandleLow    ; system or RAM semaphore handle
  6566.  MOV  AX,SemHandleHigh
  6567.  MOV  DL,DEVHLP_SEMCLEAR ; DEVHLP_SEMCLEAR EQU 07H
  6568.  CALL [Device_Help]
  6569.  
  6570.  
  6571.  The SemClear routine releases ownership of a semaphore and restarts any
  6572.  blocked threads waiting on the semaphore.
  6573.  
  6574.  
  6575.  Parameters
  6576.  
  6577.  SemHandleLow  the low word of the semaphore handle.
  6578.  
  6579.  SemHandleHigh  the high word of the semaphore handle.
  6580.  
  6581.  DEVHLP_SEMCLEAR  the function code; its value is 07.
  6582.  
  6583.  
  6584.  Return Value
  6585.  
  6586.  The carry (C) flag is cleared if the routine is successful. Otherwise, the C
  6587.  flag is set and the ax register may have one of the following error values:
  6588.  
  6589.    ■   Invalid handle.
  6590.  
  6591.    ■   Exclusive semaphore already owned.
  6592.  
  6593.    ■   Invalid at interrupt time.
  6594.  
  6595.    ■   Protection violation.
  6596.  
  6597.  
  6598.  
  6599.  
  6600.  Comments
  6601.  
  6602.  This routine releases the ownership of a semaphore that was claimed by a
  6603.  call to SemRequest. A device driver may clear either a RAM semaphore in a
  6604.  user, task, or interrupt routine or a system semaphore in a task or
  6605.  interrupt routine.
  6606.  
  6607.  For a system semaphore, the original handle was passed to the device driver
  6608.  by an application via an IOCtl routine. However, the driver must pass a
  6609.  valid system semaphore handle to SemClear. Before calling SemClear, the
  6610.  driver must have marked the handle as "in use" with a SemHandle call,
  6611.  claimed the semaphore with a SemRequest call, and marked the handle as no
  6612.  longer "in use" with another SemHandle call.
  6613.  
  6614.  For a RAM semaphore, the handle is the virtual address of the dword that the
  6615.  driver allocated for the semaphore, usually in the driver's low-memory data
  6616.  segment (containing the device header). This virtual address is a
  6617.  selector:offset in protected mode or a segment:offset in real mode.
  6618.  
  6619.  If the device driver calls SemClear for the RAM semaphore at interrupt time,
  6620.  the semaphore must be in the device driver's low-memory data segment so that
  6621.  it is directly addressable.
  6622.  
  6623.  
  6624.  See Also
  6625.  
  6626.  SemHandle, SemRequest
  6627.  
  6628.  
  6629.  █    SemHandle
  6630.  ────────────────────────────────────────────────────────────────────────────
  6631.  
  6632.  
  6633.  MOV  BX,SemHandleLow        ; application semaphore identifier
  6634.  MOV  AX,SemHandleHigh       ; passed to device driver
  6635.  MOV  DH,UsageFlag           ; mark driver's usage:
  6636.                              ; 0 = not in use, 1 = in use
  6637.  MOV  DL,DEVHLP_SEMHANDLE    ; DEVHLP_SEMHANDLE EQU 08H
  6638.  CALL [Device_Help]
  6639.  
  6640.  
  6641.  The SemHandle routine converts an application's task-specific semaphore
  6642.  handle, passed in an IOCtl call to a device driver, into a system semaphore
  6643.  handle for the driver to use; the routine later marks the system semaphore
  6644.  as no longer "in use" by the driver. SemHandle returns a RAM semaphore
  6645.  handle unchanged.
  6646.  
  6647.  
  6648.  Parameters
  6649.  
  6650.  SemHandleLow  the low word of the semaphore handle.
  6651.  
  6652.  SemHandleHigh  the high word of the semaphore handle.
  6653.  
  6654.  UsageFlag  whether to mark the semaphore as "in use" by the driver. This
  6655.  parameter may be one of the following values:
  6656.  
  6657.  Value                             Meaning
  6658.  ────────────────────────────────────────────────────────────────────────────
  6659.  
  6660.  0                                 Not in use (no longer needed by the
  6661.                                    driver).
  6662.  
  6663.  1                                 In use by the driver.
  6664.  
  6665.  DEVHLP_SEMHANDLE  the function code; its value is 08.
  6666.  
  6667.  
  6668.  Return Value
  6669.  
  6670.  The carry (C) flag is cleared and the ax:bx register pair is set to the
  6671.  system handle for the semaphore if the routine is successful and the
  6672.  UsageFlag is equal to 1. Otherwise, the C flag is set if the semaphore
  6673.  handle is invalid.
  6674.  
  6675.  
  6676.  Comments
  6677.  
  6678.  This routine maps an application's task-specific semaphore handle to a
  6679.  system-specific semaphore handle that the device driver can use at interrupt
  6680.  time. At task time, the driver can also use the system handle returned by
  6681.  SemHandle safely. If the driver used the application's task-specific
  6682.  semaphore handle, the application could delete the semaphore while the
  6683.  driver was using it.
  6684.  
  6685.  The device driver calls SemHandle once at task time to mark the
  6686.  system-specific semaphore as "in use" and again at task or interrupt time to
  6687.  mark the semaphore as "not in use." For each in-use call to SemHandle, there
  6688.  must be a corresponding not-in-use call to indicate that the driver has
  6689.  finished with the system semaphore.
  6690.  
  6691.  A driver can call SemHandle for a RAM semaphore, but the routine merely
  6692.  returns the original handle, a virtual address value.
  6693.  
  6694.  If the semaphore handle returned by SemHandle is changed by the routine, it
  6695.  is a system semaphore. However, the device driver should call VerifyAccess
  6696.  with the TypeOfAccess parameter set for read/write before assuming that the
  6697.  returned handle is a RAM semaphore when the C flag is set by a SemHandle
  6698.  call. A RAM semaphore handle must be accessed only at task time unless it is
  6699.  in locked memory.
  6700.  
  6701.  The SemHandle routine does not preserve the state of the interrupt flag.
  6702.  
  6703.  
  6704.  
  6705.  
  6706.  See Also
  6707.  
  6708.  Lock, SemClear, SemRequest, VerifyAccess
  6709.  
  6710.  
  6711.  █    SemRequest
  6712.  ────────────────────────────────────────────────────────────────────────────
  6713.  
  6714.  
  6715.  MOV  BX,SemHandleLow        ; system or RAM semaphore handle
  6716.  MOV  AX,SemHandleHigh
  6717.  MOV  CX,SemTimeoutLow       ; time-out value:
  6718.  MOV  DI,SemTimeoutHigh      ; 0 = no wait if semaphore owned
  6719.                              ; -1 = wait forever
  6720.                              ; > 0 = time-out in milliseconds
  6721.  MOV  DL,DEVHLP_SEMREQUEST   ; DEVHLP_SEMREQUEST EQU 06H
  6722.  CALL [Device_Help]
  6723.  
  6724.  
  6725.  The SemRequest routine claims a semaphore. If the semaphore is already
  6726.  owned, the device driver thread can be placed in a wait state until the
  6727.  semaphore is released or until a time-out occurs.
  6728.  
  6729.  
  6730.  Parameters
  6731.  
  6732.  SemHandleLow  the low word of the system or RAM semaphore handle.
  6733.  
  6734.  SemHandleHigh  the high word of the system or RAM semaphore handle.
  6735.  
  6736.  SemTimeoutLow  the low word of the value for the time-out limit.
  6737.  
  6738.  SemTimeoutHigh  the high word of the value for the time-out limit. The
  6739.  combined low and high words can be one of the following values:
  6740.  
  6741.  Value                             Meaning
  6742.  ────────────────────────────────────────────────────────────────────────────
  6743.  
  6744.  0                                 Return immediately if the semaphore is
  6745.                                    already owned.
  6746.  
  6747.  -1                                Wait indefinitely for the semaphore
  6748.                                    (time-out never occurs).
  6749.  
  6750.  > 0                               Time-out limit in milliseconds.
  6751.  
  6752.  DEVHLP_SEMREQUEST  the function code; its value is 06.
  6753.  
  6754.  
  6755.  Return Value
  6756.  
  6757.  The carry (C) flag is cleared if the routine is successful. Otherwise, the C
  6758.  flag is set and the ax register may have one of the following error values:
  6759.  
  6760.    ■   Semaphore time-out.
  6761.  
  6762.    ■   Interrupt.
  6763.  
  6764.    ■   Semaphore owner died.
  6765.  
  6766.    ■   Invalid handle.
  6767.  
  6768.    ■   Too many semaphore requests.
  6769.  
  6770.  
  6771.  
  6772.  
  6773.  Comments
  6774.  
  6775.  SemRequest first checks the status of a semaphore. If it is unowned, then
  6776.  SemRequest marks it as owned and returns immediately to the caller. If the
  6777.  semaphore is already owned, SemRequest does one of three things, depending
  6778.  on the value of the time-out parameter:
  6779.  
  6780.    ■   Returns immediately.
  6781.  
  6782.    ■   Blocks the device driver thread until the semaphore is released.
  6783.  
  6784.    ■   Blocks the device driver thread until the semaphore is released or the
  6785.        time-out occurs.
  6786.  
  6787.  
  6788.  The time-out parameter places an upper bound on the amount of time for
  6789.  SemRequest to block before returning to the requesting device driver thread.
  6790.  The device driver releases ownership of a claimed semaphore by calling the
  6791.  SemClear routine either at task time or at interrupt time.
  6792.  
  6793.  For a system semaphore, the device driver's task or interrupt handler must
  6794.  do the following:
  6795.  
  6796.    ■   Call SemHandle to make any semaphore passed to the driver via an IOCtl
  6797.        system-specific (rather than task-specific) and to indicate that this
  6798.        system semaphore is "in use" before the handler calls SemRequest to
  6799.        claim semaphore ownership.
  6800.  
  6801.    ■   Call SemHandle again and clear the usage flag before the handler calls
  6802.        SemClear to release system semaphore ownership.
  6803.  
  6804.  
  6805.  Note that system semaphores are created by an application process through a
  6806.  system call. The driver cannot create a system semaphore. System semaphores
  6807.  are not available to a device driver's user-mode routines.
  6808.  
  6809.  However, a device driver can create RAM semaphores to control user-mode
  6810.  operations within itself. For a RAM semaphore, the device driver must do the
  6811.  following:
  6812.  
  6813.    ■   Allocate a dword of storage, initialize it to zero, and use its
  6814.        virtual address (selector:offset or segment:offset) as the semaphore
  6815.        handle for calls to SemRequest or SemClear.
  6816.  
  6817.    ■   Manage the addressability to the RAM semaphore, allocating it in the
  6818.        device driver's low-memory data segment (containing the device header)
  6819.        if the driver references the semaphore at interrupt time.
  6820.  
  6821.  
  6822.  Note that the driver need not call SemHandle with a RAM semaphore, and that
  6823.  it may make user-mode calls to SemRequest and SemClear only for RAM
  6824.  semaphores.
  6825.  
  6826.  The SemRequest routine does not preserve the state of the interrupt flag.
  6827.  
  6828.  
  6829.  
  6830.  
  6831.  See Also
  6832.  
  6833.  SemClear, SemHandle
  6834.  
  6835.  
  6836.  █    SendEvent
  6837.  ────────────────────────────────────────────────────────────────────────────
  6838.  
  6839.  
  6840.  MOV  AH,Event               ; event to signal
  6841.  MOV  BX,Argument            ; for event being signaled
  6842.  MOV  DL,DEVHLP_SENDEVENT    ; DEVHLP_SENDEVENT EQU 25H
  6843.  CALL [Device_Help]
  6844.  
  6845.  
  6846.  The SendEvent routine tells the system that an event occurred.
  6847.  
  6848.  
  6849.  Parameters
  6850.  
  6851.  Event  the event being signaled. This parameter can be one of the following
  6852.  values:
  6853.  
  6854.  Value                             Meaning
  6855.  ────────────────────────────────────────────────────────────────────────────
  6856.  
  6857.  1                                 CTRL+BREAK
  6858.  
  6859.  2                                 CTRL+C
  6860.  
  6861.  3                                 CTRL+NUMLOCK
  6862.  
  6863.  4                                 CTRL+PRTSC
  6864.  
  6865.  5                                 SHIFT+PRTSC
  6866.  
  6867.  6                                 Session Manager keyboard hot key
  6868.  
  6869.  7                                 CTRL+ALT+DEL (reboot)
  6870.  
  6871.  Argument  a parameter for the event being signaled. Its value and meaning
  6872.  depend on the Event parameter, as follows:
  6873.  
  6874.  Value                             Meaning
  6875.  ────────────────────────────────────────────────────────────────────────────
  6876.  
  6877.  1                                 Zero (reserved).
  6878.  
  6879.  2                                 Zero (reserved).
  6880.  
  6881.  3                                 Foreground session number.
  6882.  
  6883.  4                                 Zero (reserved).
  6884.  
  6885.  5                                 Zero (reserved).
  6886.  
  6887.  6                                 HotkeyID set by a call to the IOCtl
  6888.                                    function, KBD_SETSESMGRHOTKEY (category
  6889.                                    4, function 56).
  6890.  
  6891.  7                                 Zero (reserved).
  6892.  
  6893.  DEVHLP_SENDEVENT  the function code; its value is 25H.
  6894.  
  6895.  
  6896.  Return Value
  6897.  
  6898.  The C flag is cleared if the routine is successful. Otherwise, the C flag is
  6899.  set if the signal is in error.
  6900.  
  6901.  
  6902.  Comments
  6903.  
  6904.  The Event value 0 is reserved.
  6905.  
  6906.  The keyboard driver should dismiss the interrupt after calling SendEvent for
  6907.  a reboot (Event value 7).
  6908.  
  6909.  
  6910.  
  6911.  
  6912.  See Also
  6913.  
  6914.  EOI
  6915.  
  6916.  
  6917.  █    SetIRQ
  6918.  ────────────────────────────────────────────────────────────────────────────
  6919.  
  6920.  
  6921.  MOV  AX,OFFSET CS:Handler       ; offset to interrupt handler
  6922.  MOV  BX,IRQNum                  ; interrupt-level number (0-0FH)
  6923.  MOV  DH,ShareFlag               ; interrupt sharing:
  6924.                                  ; 0 = not shared, 1 = shared
  6925.  MOV  DL,DEVHLP_SETIRQ           ; DEVHLP_SETIRQ EQU 1BH
  6926.  CALL [Device_Help]
  6927.  
  6928.  
  6929.  The SetIRQ routine registers a device interrupt handler for a hardware
  6930.  interrupt level.
  6931.  
  6932.  
  6933.  Parameters
  6934.  
  6935.  Handler  the offset in the device driver's code segment to the interrupt
  6936.  handler.
  6937.  
  6938.  IRQNum  the interrupt-level number, in the range 00 to 0FH.
  6939.  
  6940.  ShareFlag  whether interrupt sharing is available. This flag can be one of
  6941.  the following values:
  6942.  
  6943.  Value                             Meaning
  6944.  ────────────────────────────────────────────────────────────────────────────
  6945.  
  6946.  0                                 Not shared.
  6947.  
  6948.  1                                 Shared.
  6949.  
  6950.  DEVHLP_SETIRQ  the function code; its value is 1BH.
  6951.  
  6952.  
  6953.  Return Value
  6954.  
  6955.  The C flag is cleared if the routine is successful. Otherwise, the C flag is
  6956.  set if the specified IRQ is not available.
  6957.  
  6958.  
  6959.  Comments
  6960.  
  6961.  This routine enables the interrupt level at the PIC (programmable interrupt
  6962.  controller) on behalf of the device driver's interrupt handler if the IRQ is
  6963.  available.
  6964.  
  6965.  The ds register must point to the device driver's low-memory data segment
  6966.  when the driver calls SetIRQ. This low-memory data segment is the
  6967.  first-linked segment that contains the device header. If the driver has
  6968.  already called PhysToVirt with ds, this register must be reset before the
  6969.  call to SetIRQ.
  6970.  
  6971.  Whatever the value of ShareFlag, a call to SetIRQ will fail if the value
  6972.  specified for the IRQNum parameter is one of the following:
  6973.  
  6974.    ■   An IRQ owned by a real-mode interrupt handler.
  6975.  
  6976.    ■   The IRQ used to cascade the slave PIC.
  6977.  
  6978.  
  6979.  Otherwise, the value of ShareFlag affects the success of a call to SetIRQ as
  6980.  follows:
  6981.  
  6982.    ■   If ShareFlag is set, the call will fail if IRQNum is already owned by
  6983.        another device driver as "not shared."
  6984.  
  6985.    ■   If ShareFlag is clear, the call will fail if IRQNum is already owned
  6986.        by another device driver, whatever its shared status.
  6987.  
  6988.  
  6989.  The device driver's interrupt handler need not save registers on entry nor
  6990.  restore them on exit. The MS OS/2 interrupt manager does this for the
  6991.  driver.
  6992.  
  6993.  
  6994.  
  6995.  
  6996.  See Also
  6997.  
  6998.  PhysToVirt, RegisterStackUsage, UnSetIRQ
  6999.  
  7000.  
  7001.  █    SetROMVector
  7002.  ────────────────────────────────────────────────────────────────────────────
  7003.  
  7004.  
  7005.  MOV  AX,OFFSET CS:Handler       ; offset to new interrupt handler
  7006.  MOV  BX,IntNum                  ; interrupt number
  7007.  MOV  SI,OFFSET CS:SaveDS        ; offset to WORD in code segment
  7008.                                  ; where real-mode DS saved
  7009.  MOV  DL,DEVHLP_SETROMVECTOR     ; DEVHLP_SETROMVECTOR EQU 1AH
  7010.  CALL [Device_Help]
  7011.  
  7012.  
  7013.  The SetROMVector routine returns a real-mode pointer to a DOS software
  7014.  interrupt handler for chaining. Use this routine to replace the previous
  7015.  handler with a handler in your device driver.
  7016.  
  7017.  
  7018.  Parameters
  7019.  
  7020.  Handler  the offset in the device driver's code segment to the new interrupt
  7021.  handler.
  7022.  
  7023.  IntNum  the software-interrupt number. It may be any interrupt vector that
  7024.  is not reserved for hardware interrupts. Do not specify numbers in the
  7025.  following reserved ranges:
  7026.  
  7027.    ■   08H-0FH.
  7028.  
  7029.    ■   50H-57H.
  7030.  
  7031.    ■   70H-77H.
  7032.  
  7033.  
  7034.  SaveDS  the offset to a word in the device driver's code segment.
  7035.  SetROMVector saves the real-mode ds segment value of the previous interrupt
  7036.  handler in SaveDS.
  7037.  
  7038.  DEVHLP_SETROMVECTOR  the function code; its value is 1AH.
  7039.  
  7040.  
  7041.  Return Value
  7042.  
  7043.  If the routine is successful, the following conditions apply:
  7044.  
  7045.    ■   The carry (C) flag is cleared.
  7046.  
  7047.    ■   The ax:dx register pair contains the real-mode pointer to the previous
  7048.        handler.
  7049.  
  7050.    ■   The cs:si register pair contains the real-mode pointer to the previous
  7051.        handler's data segment.
  7052.  
  7053.  
  7054.  Otherwise, the C flag is set when an invalid interrupt number is specified
  7055.  for the parameter IntNum.
  7056.  
  7057.  
  7058.  Comments
  7059.  
  7060.  SetROMVector allows a bimodal device driver to hook a real-mode ROM BIOS
  7061.  interrupt and to perform any interlocking necessary to coordinate device I/O
  7062.  between the driver and ROM BIOS.
  7063.  
  7064.  The ds register must point to the device driver's low-memory data segment
  7065.  when the driver calls SetROMVector. This low-memory data segment is the
  7066.  first-linked segment that contains the device header. If the driver has
  7067.  already called PhysToVirt with ds, this register must be reset before the
  7068.  call to SetROMVector.
  7069.  
  7070.  The device driver's handler for the specified interrupt gets control
  7071.  directly when this interrupt occurs. Consequently, the ds register is not
  7072.  set up for the handler on entry. Instead, the handler must load the ds
  7073.  register with the data segment value that SetROMVector saved in the
  7074.  handler's code segment.
  7075.  
  7076.  
  7077.  
  7078.  
  7079.  See Also
  7080.  
  7081.  EOI, PhysToVirt, RegisterStackUsage, ROMCritSection
  7082.  
  7083.  
  7084.  █    SetTimer
  7085.  ────────────────────────────────────────────────────────────────────────────
  7086.  
  7087.  
  7088.  MOV  AX,OFFSET CS:TimerHandler    ; offset to driver's timer handler
  7089.  MOV  DL,DEVHLP_SETTIMER           ; DEVHLP_SETTIMER EQU 1DH
  7090.  CALL [Device_Help]
  7091.  
  7092.  
  7093.  The SetTimer routine registers a new timer handler: it adds the specified
  7094.  timer handler to the list of timer handlers to be called on a timer tick.
  7095.  
  7096.  
  7097.  Parameters
  7098.  
  7099.  TimerHandler  the offset in the driver's code segment to the timer handler.
  7100.  
  7101.  DEVHLP_SETTIMER  the function code; its value is 1DH.
  7102.  
  7103.  
  7104.  Return Value
  7105.  
  7106.  The carry (C) flag is cleared if the routine is successful. Otherwise, the C
  7107.  flag is set if the specified timer handler cannot be registered. If C is
  7108.  set, either the timer handler is already registered or the system has
  7109.  already registered its maximum number of timer handlers, 32.
  7110.  
  7111.  
  7112.  Comments
  7113.  
  7114.  This routine is a subset of the TickCount routine. SetTimer registers a
  7115.  timer handler to be called on every tick count; TickCount registers or
  7116.  changes a registered timer handler to be called on a specified tick count.
  7117.  
  7118.  A device driver may use a timer handler to drive a non-interrupt device
  7119.  rather than calling Block and Run with time-outs. Character device drivers,
  7120.  in particular, can minimize task switches by not calling Block and Run for
  7121.  character-by-character I/O. However, a device driver's timer routine must
  7122.  save any registers it uses and restore them on exit.
  7123.  
  7124.  A timer handler has the form of a call/ret routine, but it operates in
  7125.  interrupt mode. An MS OS/2 timer handler is analogous to an INT 1CH user
  7126.  timer handler. An MS OS/2 device driver should not remain in a timer handler
  7127.  very long, definitely less than the tick resolution of 31.25 milliseconds.
  7128.  
  7129.  The ds register must point to the device driver's low-memory data segment
  7130.  when the driver calls SetTimer. This low-memory data segment is the
  7131.  first-linked segment that contains the device header. If the driver has
  7132.  already called PhysToVirt with ds, this register must be reset before the
  7133.  call to SetTimer.
  7134.  
  7135.  MS OS/2 has a maximum of 32 different timer handlers.
  7136.  
  7137.  
  7138.  
  7139.  
  7140.  See Also
  7141.  
  7142.  Block, PhysToVirt, ResetTimer, Run, TickCount
  7143.  
  7144.  
  7145.  █    SortReqPacket
  7146.  ────────────────────────────────────────────────────────────────────────────
  7147.  
  7148.  
  7149.  MOV  SI,OFFSET Queue            ; offset to queue header that
  7150.                                  ; points to next request
  7151.  LES  BX,ReqPacket               ; pointer request packet
  7152.                                  ; that goes into sorted queue
  7153.  MOV  DL,DEVHLP_SORTREQUEST      ; DEVHLP_SORTREQUEST EQU 0CH
  7154.  CALL [Device_Help]
  7155.  
  7156.  
  7157.  The SortReqPacket routine inserts the specified request packet into a queue
  7158.  that is ordered from high to low by starting sector number. Disk (block)
  7159.  device drivers can use this routine instead of PushReqPacket to add elements
  7160.  to the request list.
  7161.  
  7162.  
  7163.  Parameters
  7164.  
  7165.  Queue  the queue header in the device driver's data segment (accessed by
  7166.  ds). The queue header points to the next request for the device to service.
  7167.  
  7168.  ReqPacket  to the request packet to be inserted in the list.
  7169.  
  7170.  DEVHLP_SORTREQUEST  the function code; its value is 0CH.
  7171.  
  7172.  
  7173.  Return Value
  7174.  
  7175.  SortReqPacket does not return a value.
  7176.  
  7177.  
  7178.  Comments
  7179.  
  7180.  This routine places I/O request packets allocated by AllocReqPacket into the
  7181.  request queue for a disk device. It inserts the request packet into the
  7182.  specified, ordered queue according to the starting sector number of the new
  7183.  packet.
  7184.  
  7185.  A request list sorted by sector number reduces the length and number of head
  7186.  seeks. However, SortReqPacket does not take into account multiple heads on
  7187.  the media or the target drive in the request packet.
  7188.  
  7189.  
  7190.  
  7191.  
  7192.  See Also
  7193.  
  7194.  AllocReqPacket, PushReqPacket, PullParticular, PullReqPacket
  7195.  
  7196.  
  7197.  █    TCYield
  7198.  ────────────────────────────────────────────────────────────────────────────
  7199.  
  7200.  
  7201.  MOV  DL,DEVHLP_TCYIELD  ; DEVHLP_TCYIELD EQU 03H
  7202.  CALL [Device_Help]
  7203.  
  7204.  
  7205.  The TCYield routine yields the CPU to a time-critical thread of equal or
  7206.  higher priority if one is scheduled for execution.
  7207.  
  7208.  
  7209.  Parameters
  7210.  
  7211.  DEVHLP_TCYIELD  the function code; its value is 03.
  7212.  
  7213.  
  7214.  Return Value
  7215.  
  7216.  TCYield does not return a value.
  7217.  
  7218.  
  7219.  Comments
  7220.  
  7221.  This routine is a subset of the Yield routine: it yields the CPU to a
  7222.  scheduled thread of equal or higher priority only if it is a time-critical
  7223.  thread. If it calls TCYield, a device driver need not call Yield as well.
  7224.  
  7225.  MS OS/2 is designed so that the CPU is never preemptively scheduled while in
  7226.  kernel mode. Most kernel routines perform their job and exit quickly.
  7227.  However, kernel routines usually must block while waiting for I/O to
  7228.  complete and sometimes must block while waiting for a resource. Device
  7229.  drivers that perform I/O on long strings of data or that poll the device in
  7230.  kernel mode can tie up a lot of CPU time.
  7231.  
  7232.  For best performance, such drivers can call GetDosVar to obtain the address
  7233.  of the TCYieldFlag and check the flag value every three milliseconds. If the
  7234.  TCYieldFlag is set, the driver should call TCYield to allow the
  7235.  time-critical thread to execute. This thread can change the state of the
  7236.  interrupt flag, so the driver must check and possibly adjust this flag when
  7237.  it regains the CPU.
  7238.  
  7239.  
  7240.  
  7241.  
  7242.  See Also
  7243.  
  7244.  GetDosVar, Yield
  7245.  
  7246.  
  7247.  █    TickCount
  7248.  ────────────────────────────────────────────────────────────────────────────
  7249.  
  7250.  
  7251.  MOV  AX,OFFSET CS:TimerHandler    ; offset to driver's timer handler
  7252.  MOV  BX,Count                     ; N tick counts (0-0FFFFH)
  7253.                                    ; with 0 = 0FFFFH+1 ticks
  7254.  MOV  DL,DEVHLP_TICKCOUNT          ; DEVHLP_TICKCOUNT EQU 33H
  7255.  CALL [Device_Help]
  7256.  
  7257.  
  7258.  The TickCount routine either registers a new timer handler or changes the
  7259.  count of ticks until a registered timer handler is called.
  7260.  
  7261.  
  7262.  Parameters
  7263.  
  7264.  TimerHandler  the offset in the driver's code segment to the timer handler.
  7265.  
  7266.  Count  the number of ticks at which the handler is called. Count is a number
  7267.  in the range 00 to 0FFFFH, where zero means 0FFFFH+1.
  7268.  
  7269.  DEVHLP_TICKCOUNT  the function code; its value is 33H.
  7270.  
  7271.  
  7272.  Return Value
  7273.  
  7274.  The carry (C) flag is cleared if the routine is successful. Otherwise, the C
  7275.  flag is set if the timer handler cannot be registered or changed. The
  7276.  specified timer handler cannot be registered if it is already registered or
  7277.  if MS OS/2 has registered 32 timer handlers (system maximum). The specified
  7278.  timer handler cannot be changed if it is not registered by the calling
  7279.  driver.
  7280.  
  7281.  
  7282.  Comments
  7283.  
  7284.  This routine registers a new timer handler or changes the tick-count
  7285.  interval of a registered timer handler. TickCount is a superset of the
  7286.  SetTimer routine.
  7287.  
  7288.  A device driver may use a timer handler to drive a noninterrupt device
  7289.  rather than calling Block and Run with time-outs. Character device drivers,
  7290.  in particular, can minimize task switches by not calling Block and Run for
  7291.  character-by-character I/O. However, a device driver's timer routine must
  7292.  save any registers it uses and restore them on exit.
  7293.  
  7294.  A timer handler has the form of a call/ret routine, but it operates in
  7295.  interrupt mode. An MS OS/2 timer handler is analogous to an INT 1CH user
  7296.  timer handler. An MS OS/2 device driver should not remain in a timer handler
  7297.  very long, definitely less than the tick resolution of 31.25 milliseconds.
  7298.  
  7299.  The ds register must point to the device driver's low-memory data segment
  7300.  when the driver calls TickCount. This low-memory data segment is the
  7301.  first-linked segment that contains the device header. If the driver has
  7302.  already called PhysToVirt with ds, this register must be reset before the
  7303.  call to TickCount.
  7304.  
  7305.  The device driver may call TickCount to register a new timer handler only at
  7306.  task time (not in user or interrupt mode). The driver may modify a handler
  7307.  that was registered by SetTimer at task time also.
  7308.  
  7309.  In user and interrupt modes, the driver can call TickCount only to change
  7310.  the number of ticks that must occur before a registered timer handler gets
  7311.  control. In this way, the driver can support the time-outs without needing
  7312.  to count timer ticks.
  7313.  
  7314.  Note that the SetTimer routine sets a Count of 1 when it registers a timer
  7315.  handler. The driver can call TickCount many times to modify a registered
  7316.  handler, but only the last TickCount setting will be in effect for the
  7317.  handler. A TickCount call for a timer handler has no effect on other timer
  7318.  handlers in the system. MS OS/2 has a maximum of 32 different timer
  7319.  handlers.
  7320.  
  7321.  
  7322.  
  7323.  
  7324.  See Also
  7325.  
  7326.  Block, PhysToVirt, ResetTimer, Run, SetTimer
  7327.  
  7328.  
  7329.  █    Unlock
  7330.  ────────────────────────────────────────────────────────────────────────────
  7331.  
  7332.  
  7333.  MOV  BX,LockHandleLow       ; handle returned by Lock
  7334.  MOV  AX,LockHandleHigh      ; for segment
  7335.  MOV  DL,DEVHLP_UNLOCK       ; DEVHLP_UNLOCK EQU 14H
  7336.  CALL [Device_Help]
  7337.  
  7338.  
  7339.  The Unlock routine releases a lock on a memory segment.
  7340.  
  7341.  
  7342.  Parameters
  7343.  
  7344.  LockHandleLow  the low word of the segment handle returned by Lock.
  7345.  
  7346.  LockHandleHigh  the high word of the segment handle returned by Lock.
  7347.  
  7348.  DEVHLP_UNLOCK  the function code; its value is 14H.
  7349.  
  7350.  
  7351.  Return Value
  7352.  
  7353.  The carry (C) flag is cleared if the routine is successful. Otherwise, the C
  7354.  flag is set if the segment remains locked.
  7355.  
  7356.  
  7357.  Comments
  7358.  
  7359.  This routine unlocks a memory segment that was locked at task time. Unlock
  7360.  does not return if the lock handle is invalid. An invalid lock handle can
  7361.  hang the system, so take care that the handle passed to Unlock matches the
  7362.  handle obtained from Lock.
  7363.  
  7364.  A driver should call Unlock for each short-term lock (Lock TypeLock values
  7365.  00 or 04) that it sets, before either of the following occurs:
  7366.  
  7367.    ■   Two seconds elapse.
  7368.  
  7369.    ■   The driver returns control to its caller.
  7370.  
  7371.  
  7372.  A segment that was locked during device driver initialization (Lock TypeLock
  7373.  value 03) is permanently locked until reboot occurs. It cannot be released
  7374.  by a call to Unlock.
  7375.  
  7376.  
  7377.  
  7378.  
  7379.  See Also
  7380.  
  7381.  Lock, VerifyAccess
  7382.  
  7383.  
  7384.  █    UnPhysToVirt
  7385.  ────────────────────────────────────────────────────────────────────────────
  7386.  
  7387.  
  7388.  MOV  DL,DEVHLP_UNPHYSTOVIRT ; DEVHLP_UNPHYSTOVIRT EQU 32H
  7389.  CALL [Device_Help]
  7390.  
  7391.  
  7392.  The UnPhysToVirt routine marks completion of the address conversions done by
  7393.  PhysToVirt calls.
  7394.  
  7395.  
  7396.  Parameters
  7397.  
  7398.  DEVHLP_UNPHYSTOVIRT  the function code; its value is 32H.
  7399.  
  7400.  
  7401.  Return Value
  7402.  
  7403.  The zero (Z) flag is cleared if the operating mode is unchanged. The Z flag
  7404.  is set if a mode switch occurred.
  7405.  
  7406.  
  7407.  Comments
  7408.  
  7409.  This routine undoes one or more preceding PhysToVirt calls just before a
  7410.  device driver exits a routine. PhysToVirt and UnPhysToVirt relieve the
  7411.  driver of the need to recognize the CPU mode and the consequent effects on
  7412.  accessing memory.
  7413.  
  7414.  UnPhysToVirt must be called by the same routine that called PhysToVirt when
  7415.  use of converted addresses is completed and before the routine returns to
  7416.  its caller. The driver routine that had called PhysToVirt may call other
  7417.  driver routines before calling UnPhysToVirt, but it should not call other
  7418.  DevHlp routines except PhysToVirt. In fact, multiple PhysToVirt calls may be
  7419.  made prior to the UnPhysToVirt call. Only one UnPhysToVirt call is needed to
  7420.  undo multiple PhysToVirt calls.
  7421.  
  7422.  If a call to PhysToVirt caused a switch to protected mode, UnPhysToVirt will
  7423.  switch back to real mode. The Z flag is set if such a mode switch occurred.
  7424.  
  7425.  When a switch to real mode occurs, UnPhysToVirt converts the cs and ss
  7426.  values to real-mode segment addresses, preserves the sp address, and resets
  7427.  the ds and es registers to the segment address of the device driver's
  7428.  primary data segment, which contains the device header.
  7429.  
  7430.  
  7431.  
  7432.  
  7433.  See Also
  7434.  
  7435.  PhysToUVirt, PhysToVirt
  7436.  
  7437.  
  7438.  █    UnSetIRQ
  7439.  ────────────────────────────────────────────────────────────────────────────
  7440.  
  7441.  
  7442.  MOV  BX,IRQNum                  ; interrupt level number (0-0FH)
  7443.  MOV  DL,DEVHLP_UNSETIRQ         ; DEVHLP_UNSETIRQ EQU 1CH
  7444.  CALL [Device_Help]
  7445.  
  7446.  
  7447.  The UnSetIRQ routine removes the specified hardware-interrupt handler.
  7448.  
  7449.  
  7450.  Parameters
  7451.  
  7452.  IRQNum  the interrupt level number in the range 00 to 0FH.
  7453.  
  7454.  DEVHLP_UNSETIRQ  the function code; its value is 1CH.
  7455.  
  7456.  
  7457.  Return Value
  7458.  
  7459.  UnSetIRQ does not return a value.
  7460.  
  7461.  
  7462.  Comments
  7463.  
  7464.  This routine deinstalls a hardware interrupt handler.
  7465.  
  7466.  The ds register must point to the device driver's low-memory data segment
  7467.  when the driver calls UnSetIRQ. This low-memory data segment is the
  7468.  first-linked segment that contains the device header. If the driver has
  7469.  already called PhysToVirt with ds, this register must be reset before the
  7470.  call to UnSetIRQ.
  7471.  
  7472.  
  7473.  
  7474.  
  7475.  See Also
  7476.  
  7477.  PhysToVirt, SetIRQ
  7478.  
  7479.  
  7480.  █    VerifyAccess
  7481.  ────────────────────────────────────────────────────────────────────────────
  7482.  
  7483.  
  7484.  MOV AX,MemSeg@              ; selector
  7485.  MOV CX,MemLength            ; length of memory area
  7486.                              ; with 0 = 64K bytes
  7487.  MOV DI,MemOffset            ; offset to memory area
  7488.  MOV DH,TypeOfAccess         ; verify access for:
  7489.                              ; 0 = read-only, 1 = read/write
  7490.  MOV DL,DEVHLP_VERIFYACCESS  ; DEVHLP_VERIFYACCESS EQU 27H
  7491.  CALL [Device_Help]
  7492.  
  7493.  
  7494.  The VerifyAccess routine confirms whether a user process has the correct
  7495.  access rights for a memory area passed to the device driver via an IOCtl
  7496.  call. If the process does not have the correct access rights, it will be
  7497.  terminated when the driver returns.
  7498.  
  7499.  
  7500.  Parameters
  7501.  
  7502.  MemSeg@  the selector of the memory segment passed by the user process.
  7503.  
  7504.  MemLength  the length in bytes of the memory area to be verified for access.
  7505.  Zero means 64K bytes.
  7506.  
  7507.  MemOffset  the offset in the memory segment passed by the user process.
  7508.  
  7509.  TypeOfAccess  access privileges of the memory segment. This parameter has
  7510.  one of the following values:
  7511.  
  7512.  Value                             Meaning
  7513.  ────────────────────────────────────────────────────────────────────────────
  7514.  
  7515.  0                                 Read only segment.
  7516.  
  7517.  1                                 Read/write segment.
  7518.  
  7519.  DEVHLP_VERIFYACCESS  the function code; its value is 27H.
  7520.  
  7521.  
  7522.  Return Value
  7523.  
  7524.  The carry (C) flag is cleared if the routine confirms the user process's
  7525.  access rights to the segment. Otherwise, the C flag is set and the user
  7526.  process killed.
  7527.  
  7528.  
  7529.  Comments
  7530.  
  7531.  This routine protects a device driver from attempting to use invalid data
  7532.  that was passed to it by an erroneous or malicious user process. MS OS/2
  7533.  cannot verify addresses embedded in an application IOCtl call.
  7534.  
  7535.  A device driver may call VerifyAccess to confirm that a user process passed
  7536.  a valid address. When a VerifyAccess call succeeds, it guarantees that the
  7537.  device driver has valid access to the segment until the driver blocks.
  7538.  
  7539.  A device driver can block by touching a not-present segment, by exiting its
  7540.  strategy routine, or by calling another DevHlp routine. If the driver calls
  7541.  Lock for a user-supplied address, it should place the Lock call before the
  7542.  call to VerifyAccess. Otherwise, the segment might be resized or freed if a
  7543.  block occurs during the lock. The device driver should call Unlock for the
  7544.  segment immediately if VerifyAccess fails the user address. For a successful
  7545.  lock and verification, the device driver's access remains valid until it
  7546.  calls Unlock for the segment.
  7547.  
  7548.  Call VerifyAccess only in protected mode. A real-mode call supplies no
  7549.  information because VerifyAccess always returns with the C flag clear from a
  7550.  real-mode call. If necessary, call the RealToProt routine before calling
  7551.  VerifyAccess.
  7552.  
  7553.  
  7554.  
  7555.  
  7556.  See Also
  7557.  
  7558.  Lock, RealToProt, TCYield, Unlock, Yield
  7559.  
  7560.  
  7561.  █    VirtToPhys
  7562.  ────────────────────────────────────────────────────────────────────────────
  7563.  
  7564.  
  7565.  PUSH DS                     ; save DS
  7566.  LDS  SI,VirtAddr            ; virtual address is
  7567.                              ; selector:offset or segment:offset
  7568.  MOV  DL,DEVHLP_VIRTTOPHYS   ; DEVHLP_VIRTTOPHYS EQU 16H
  7569.  POP  ES                     ; ES gets old DS to driver's data segment
  7570.  CALL ES:[Device_Help]
  7571.  
  7572.  
  7573.  The VirtToPhys routine converts a virtual address into a 32-bit physical
  7574.  address. A virtual address is a selector:offset in protected mode or a
  7575.  segment:offset in real mode.
  7576.  
  7577.  
  7578.  Parameters
  7579.  
  7580.  VirtAddr  the virtual address as a selector:offset or segment:offset.
  7581.  
  7582.  DEVHLP_VIRTTOPHYS  the function code; its value is 16H.
  7583.  
  7584.  
  7585.  Return Value
  7586.  
  7587.  The carry (C) flag is cleared and the ax:bx register pair contains the
  7588.  physical address (32 bits) if the routine is successful. Otherwise, the C
  7589.  flag is set.
  7590.  
  7591.  
  7592.  Comments
  7593.  
  7594.  This routine converts a virtual address, usually passed to a device driver
  7595.  from a user process via an IOCtl call, into a physical address at task time.
  7596.  The driver's interrupt handler can use the converted address to access user
  7597.  memory and service the IOCtl request.
  7598.  
  7599.  Before it calls VirtToPhys, the handler should do the following:
  7600.  
  7601.    ■   Call Lock to keep the segment from being moved or swapped while the
  7602.        handler accesses it if the process-supplied location is not already
  7603.        locked. Note that MS OS/2 locks memory for addresses passed as
  7604.        read/write requests but not for user-process addresses passed via an
  7605.        IOCtl to the handler.
  7606.  
  7607.    ■   Call VerifyAccess in protected mode to confirm the validity and
  7608.        segment access rights of any user address passed via an IOCtl. If it
  7609.        is necessary to change operating modes, call RealToProt before
  7610.        VerifyAccess. To change back to real mode when access is confirmed,
  7611.        call ProtToReal.
  7612.  
  7613.  
  7614.  The physical address returned by VirtToPhys remains valid while the segment
  7615.  is locked.
  7616.  
  7617.  
  7618.  
  7619.  
  7620.  See Also
  7621.  
  7622.  Lock, ProtToReal, RealToProt, Unlock, VerifyAccess
  7623.  
  7624.  
  7625.  █    Yield
  7626.  ────────────────────────────────────────────────────────────────────────────
  7627.  
  7628.  
  7629.  MOV  DL,DEVHLP_YIELD        ; DEVHLP_YIELD EQU 02H
  7630.  CALL [Device_Help]
  7631.  
  7632.  
  7633.  The Yield routine yields the CPU to a thread of equal or higher priority if
  7634.  one is scheduled for execution.
  7635.  
  7636.  
  7637.  Parameters
  7638.  
  7639.  DEVHLP_YIELD  the function code; its value is 02.
  7640.  
  7641.  
  7642.  Return Value
  7643.  
  7644.  Yield does not return a value.
  7645.  
  7646.  
  7647.  Comments
  7648.  
  7649.  This routine is a superset of the TCYield routine: it yields the CPU to a
  7650.  scheduled thread of equal or higher priority. If it calls Yield, a device
  7651.  driver need not call TCYield as well.
  7652.  
  7653.  MS OS/2 is designed so that the CPU is never preemptively scheduled while in
  7654.  kernel mode. Most kernel routines perform their job and exit quickly.
  7655.  However, kernel routines usually must block while waiting for I/O to
  7656.  complete and sometimes must block while waiting for a resource. Device
  7657.  drivers that perform I/O on long strings of data or that poll the device in
  7658.  kernel mode can tie up a lot of CPU time.
  7659.  
  7660.  For best performance, such drivers can call GetDosVar to obtain the
  7661.  YieldFlag address value and check this flag every three milliseconds. If the
  7662.  YieldFlag is set, the driver should call Yield. When the driver yields,
  7663.  another thread can change the state of the interrupt flag, so the driver
  7664.  must check and possibly adjust the interrupt flag when it regains the CPU.
  7665.  
  7666.  
  7667.  
  7668.  
  7669.  See Also
  7670.  
  7671.  GetDosVar, TCYield
  7672.  
  7673.  
  7674.  
  7675.  
  7676.  
  7677.  
  7678.  Chapter 4  Base Video Device Handlers
  7679.  ────────────────────────────────────────────────────────────────────────────
  7680.  
  7681.  
  7682.  
  7683.  
  7684.  4.1  Introduction
  7685.  
  7686.  MS OS/2 version 1.2 base video device handlers manage text-mode displays for
  7687.  their adapters. A BVH (base video handler) consists of one or more
  7688.  dynamic-link libraries coded in C or assembly language, or in both. A BVH
  7689.  can also have one or more ring-0 components that are character device
  7690.  drivers; a BVH must have a ring-0 component for certain kinds of adapters.
  7691.  BVHs execute in protected mode.
  7692.  
  7693.  At system boot, MS OS/2 first loads the base drivers, including the driver
  7694.  named screen$, and then loads the boot-up text-display handler when it
  7695.  processes the config.sys file. The boot-up text-display handler supports
  7696.  screen output for the system during config.sys processing. This BVH (and
  7697.  every other BVH) is an installable device driver, consisting of at least one
  7698.  dynamic-link library component and possibly a ring-0 component. For example,
  7699.  the following lines in config.sys set up the dynamic-link library named
  7700.  BVHMyDll to be the boot-up text-display handler:
  7701.  
  7702.  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  7703.  ; following lines set video environment variables for a system      ;
  7704.  ; configured with two displays                                      ;
  7705.  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  7706.  
  7707.  set video_devices=VIO_MyBVH,VIO_OtherBVH
  7708.  set vio_MyBVH=device(BVHMyDll,MyAdptr) ptrdevp(MyPrtPt) ptrdevr(MyRlPt)
  7709.  set vio_OtherBVH=device(BVHEGA,OtherDll)
  7710.  
  7711.  
  7712.  Because the MyBVH handler defines the first BVH dynamic-link library
  7713.  component in config.sys, it becomes the boot-up text-display handler if it
  7714.  installs successfully. This BVH has two components, bvhmydll.dll and a
  7715.  ring-0 myadptr.sys, defining a single logical BVH. It also specifies custom
  7716.  protected- and real-mode pointer drivers (MyPrtPt and MyRlPt) with the
  7717.  keywords ptrdevp and ptrdevr.
  7718.  
  7719.  A BVH must have a ring-0 component if its adapter's native mode cannot be
  7720.  changed by the real-mode interrupt 10H. Otherwise, a BVH need not have a
  7721.  ring-0 component because its dynamic-link library component(s) may call the
  7722.  screen$ driver to provide ring-0 support. For more information about BVH
  7723.  ring-0 components, see Section 4.2.4.
  7724.  
  7725.  MS OS/2 version 1.2 uses the default system driver named pointer$ if the
  7726.  optional keywords ptrdevr and ptrdevp are not specified with replacement
  7727.  pointer drivers for the BVH in config.sys.
  7728.  
  7729.  The BVH that loads after MyBVH uses the default pointer driver pointer$. If
  7730.  this BVH came before the "set vio_MyBVH..." statement in config.sys and
  7731.  installed successfully, the OtherBVH handler would become the boot-up
  7732.  text-display handler.
  7733.  
  7734.  The OtherBVH has two dynamic-link library components, bvhega.dll and
  7735.  otherdll.dll. The second of these components is "chained to" the existing
  7736.  EGA driver. For more information about chaining base video device handlers,
  7737.  see Section 4.2.3.
  7738.  
  7739.  By convention, base video device handlers name their dynamic-link library
  7740.  components with the prefix BVH in config.sys (and in the Microsoft
  7741.  Segmented-Executable Linker, version 5.0, definition file). They name the
  7742.  C-language modules that make up such a component with the prefix VDH (video
  7743.  device handler).
  7744.  
  7745.  
  7746.  4.2  BVH Installation and the DevEnable Function
  7747.  
  7748.  During system boot, MS OS/2 reads in config.sys and calls each BVH
  7749.  dynamic-link library component, in turn, through its entry point, the
  7750.  DevEnable function. The first-linked module of each BVH dynamic-link library
  7751.  component must contain its DevEnable function.
  7752.  
  7753.  This function has the following syntax if it is coded in the C language:
  7754.  
  7755.  USHORT EXPENTRY DevEnable(Parm2, Parm1, Subfunction)
  7756.                           /* EXPENTRY forces Pascal FAR calling       */
  7757.                           /*     conventions in C-language modules    */
  7758.  Dev_Parm2 FAR *pParm2;   /* Parm2 packet has two FAR pointers,       */
  7759.                           /*     FAR *pfsFlags and                    */
  7760.                           /*     FAR *paCallVectorTable               */
  7761.  Dev_Parm1 FAR *pParm1;   /* Parm1 packet has two ULONGS,             */
  7762.                           /*     ULONG EngineVersion (PM's Gre)       */
  7763.                           /*     ULONG cTableEntries                  */
  7764.  ULONG ulSubfunction;     /* ulSubfunction has two possible values,   */
  7765.                           /*     3L=FnFillInitDevBlock or             */
  7766.                           /*     1L=FnFillLogicalDevBlock             */
  7767.  
  7768.  
  7769.  The initial call to DevEnable has one purpose: to put symbolic far pointers
  7770.  into the system's video call vector table for those VDH functions that the
  7771.  BVH component supplies. A BVH dynamic-link library component supplies its
  7772.  symbolic pointers to VDH functions only once at system boot. (At subsequent
  7773.  calls to DevEnable, the dynamic-link library component may do per-process
  7774.  initialization, such as getting a handle for the screen$ driver.) If the
  7775.  initial call is successful, DevEnable returns zero (to the ax register for
  7776.  assembly-language modules); otherwise, it returns the value for
  7777.  PMERR_DEV_FUNC_NOT_INSTALLED.
  7778.  
  7779.  The Parm2 packet contains a far pointer to a USHORT Boolean flag, indicating
  7780.  whether this BVH component has initialized already, and another far pointer
  7781.  to the BVS (base video subsystem) dispatch table, itself an array of far
  7782.  pointers that is indexed by VDH function codes. For more information about
  7783.  the VDH functions, see Sections 4.3 and 4.5.
  7784.  
  7785.  The Parm1 packet supplies the version number for the Presentation Manager
  7786.  graphics engine, which the BVH component may ignore, and a count of the
  7787.  number of BVS entries in the system's video call vector table. This value
  7788.  defines the maximum number of pointers that the BVH may put into the BVS
  7789.  range of the system's video call vector table.
  7790.  
  7791.  The ulSubfunction value is either 3L or 1L, depending on whether the BVH is
  7792.  to be the boot-up display handler. MS OS/2 calls each dynamic-link library
  7793.  component of the first BVH in config.sys, using its DevEnable entry point
  7794.  with ulSubfunction 3L, until the BVH's dynamic-link library component(s)
  7795.  initialize successfully. After that, it calls the remaining BVH components,
  7796.  if any, using their DevEnable entry points with ulSubfunction 1L. MS OS/2
  7797.  loads a default BVH (bvhinit.dll, supplied with the system) if there are no
  7798.  BVHs in config.sys to drive the boot-up display. However, the system crashes
  7799.  if a BVH specified in config.sys fails the call to DevEnable, ulSubfunction
  7800.  3L. The system does not load a BVH if one of its dynamic-link library
  7801.  components fails the call to DevEnable, ulSubfunction 1L, or if a ring-0
  7802.  component fails to initialize (for more information about ring-0 components,
  7803.  see Section 4.2.4).
  7804.  
  7805.  
  7806.  4.2.1  BVS/VDH Functions in the Video Call Vector Table
  7807.  
  7808.  MS OS/2 version 1.2 dedicates the function-code range from 256L to 287L
  7809.  (hexadecimal 100 to 11F) to BVS in the system's video call vector table. (MS
  7810.  OS/2 version 1.2 also reserves the function-code range from 000 to 255 for
  7811.  the Presentation Manager, and the range from 288 to 319 for other purposes.)
  7812.  
  7813.  
  7814.  BVS routes application VIO calls through this call vector table to the
  7815.  appropriate BVH dynamic-link library component that supplies an entry point
  7816.  for the corresponding VDH function.
  7817.  
  7818.  BVS supplies system default routines for 24 VDH functions in the range from
  7819.  256L to 279L, although most of its default routines merely return an error.
  7820.  This subrange of the system's video call vector table defines the MS OS/2
  7821.  version 1.2 BVS dispatch table for VDH function calls.
  7822.  
  7823.  All BVHs must supply a subset of these functions, and a BVH may supply all
  7824.  of them. The VDH functions, listed in function-code order, are as follows:
  7825.  
  7826.  Function code                     Function description
  7827.  ────────────────────────────────────────────────────────────────────────────
  7828.  
  7829.  256L                              TextBufferUpdate Reads from, scrolls, or
  7830.                                    writes to the display.
  7831.  
  7832.  257L                              InitializeEnvironment Sets up the
  7833.                                    environment buffer for a new session.
  7834.  
  7835.  258L                              SaveEnvironment Saves the foreground
  7836.                                    session's environment when a session
  7837.                                    switch is about to occur.
  7838.  
  7839.  259L                              RestoreEnvironment Restores a background
  7840.                                    session's environment when a session
  7841.                                    switch is about to occur.
  7842.  
  7843.  260L                              RetConfigInfo Returns information that
  7844.                                    identifies the current adapter and
  7845.                                    display.
  7846.  
  7847.  261L                              GetDBCSDisplayInfo Returns the range of
  7848.                                    double-cell DBCS (double-byte character
  7849.                                    set) characters.
  7850.  
  7851.  262L                              GetColorLookup Returns color definitions
  7852.                                    from the color lookup table for VGA-type
  7853.                                    adapters.
  7854.  
  7855.  263L                              SetColorLookup Sets color definitions
  7856.                                    from the color lookup table for VGA-type
  7857.                                    adapters.
  7858.  
  7859.  264L                              GetCursorInfo Returns information about
  7860.                                    the cursor's position, its type, or both.
  7861.  
  7862.  265L                              SetCursorInfo Sets the cursor's position,
  7863.                                    its type, or both.
  7864.  
  7865.  266L                              GetFont Returns a user-defined,
  7866.                                    code-page, or ROM font compatible with
  7867.                                    the current mode.
  7868.  
  7869.  267L                              SetFont Sets up a user-font definition
  7870.                                    and loads a font compatible with the
  7871.                                    current mode.
  7872.  
  7873.  268L                              GetMode Returns information about the
  7874.                                    current video mode.
  7875.  
  7876.  269L                              SetMode Sets or changes the video mode.
  7877.  
  7878.  270L                              GetPaletteRegisters Reads the current
  7879.                                    palette register settings into the
  7880.                                    palette buffer.
  7881.  
  7882.  271L                              SetPaletteRegisters Loads palette
  7883.                                    settings from the palette buffer.
  7884.  
  7885.  272L                              GetPhysBuf Returns LDT (local descriptor
  7886.                                    table) access to the PVB (physical video
  7887.                                    buffer).
  7888.  
  7889.  273L                              FreePhysBuf Releases an LDT selector
  7890.                                    allocated by GetPhysBuf.
  7891.  
  7892.  274L                              GetVariableInfo Returns information
  7893.                                    about selected adapter features, such as
  7894.                                    blink state, border color (overscan),
  7895.                                    video enable state, etc.
  7896.  
  7897.  275L                              SetVariableInfo Sets selected adapter
  7898.                                    features, such as blink, border color,
  7899.                                    video enable, etc.
  7900.  
  7901.  276L                              TerminateEnvironment Cleans up the
  7902.                                    environment before a session terminates.
  7903.  
  7904.  277L                              PrintScreen Sends a copy of a text-mode
  7905.                                    display to a printer.
  7906.  
  7907.  278L                              WriteTTY Writes a character string to
  7908.                                    the display.
  7909.  
  7910.  279L                              GetLVBInfo Returns information about an
  7911.                                    LVB (logical video buffer).
  7912.  
  7913.  The VDH functions TerminateEnvironment, PrintScreen, and WriteTTY are
  7914.  optional, and the functions GetColorLookup and SetColorLookup are required
  7915.  only for BVHs that support VGA-type adapters.
  7916.  
  7917.  Each VDH function must be callable both from ring-2 and from ring-3. For
  7918.  this reason, a BVH dynamic-link library component must place at least the
  7919.  entry points for its VDH functions in a conforming code segment with I/O
  7920.  privilege. For more information about the VDH functions, see Sections 4.3
  7921.  and 4.5.
  7922.  
  7923.  
  7924.  4.2.2  BVH Component Installation
  7925.  
  7926.  Each BVH dynamic-link library component overwrites one or more of the VDH
  7927.  function addresses in the BVS dispatch table when its DevEnable function
  7928.  executes at system boot. Each component usually keeps a static copy of the
  7929.  BVS dispatch table in its data segment with the names (symbolic addresses)
  7930.  of the VDH functions it supports and the zero-valued constant
  7931.  UNSUPPORTED_FUNCTION for those VDH functions that it does not support. At
  7932.  the DevEnable call, the component assigns the names of its functions
  7933.  (nonzero values) to the corresponding slots in the BVS dispatch table.
  7934.  
  7935.  When a BVH has more than one dynamic-link library component, each subsequent
  7936.  component also overwrites one or more symbolic addresses in the BVS dispatch
  7937.  table as its DevEnable function executes. Each dynamic-link library
  7938.  component supplies symbolic addresses for the VDH functions that it supports
  7939.  until the BVH, as a whole, has supplied all the required VDH entry points,
  7940.  plus entry points for any optional VDH functions that it cares to supply.
  7941.  
  7942.  For more information about ring-0 component installation, see Section 4.2.4.
  7943.  
  7944.  
  7945.  If a BVH is the boot-up text-display handler, its first-installed
  7946.  dynamic-link library component must supply the following VDH functions:
  7947.  
  7948.  Function                          Support required
  7949.  ────────────────────────────────────────────────────────────────────────────
  7950.  
  7951.  TextBufferUpdate                  Full implementation
  7952.  
  7953.  InitializeEnvironment             Full implementation
  7954.  
  7955.  SaveEnvironment                   Full implementation
  7956.  
  7957.  RestoreEnvironment                Full implementation
  7958.  
  7959.  GetDBCSInfo                       Full implemenatation
  7960.  
  7961.  GetCursorInfo                     Full implementation
  7962.  
  7963.  SetCursorInfo                     Full implemenatation
  7964.  
  7965.  GetMode                           80 * 25 text or equivalent only
  7966.  
  7967.  SetMode                           80 * 25 text or equivalent only
  7968.  
  7969.  GetVariableInfo                   Code page only
  7970.  
  7971.  SetVariableInfo                   Code page only
  7972.  
  7973.  GetLVBInfo                        Full implementation
  7974.  
  7975.  However, a subsequent dynamic-link library component can overwrite any VDH
  7976.  function addresses that were supplied by the first component in the BVS
  7977.  dispatch table. Note that a subsequent component for the boot-up BVH might
  7978.  do this in order to supply more powerful versions of the GetMode, SetMode,
  7979.  GetVariableInfo, and SetVariableInfo VDH functions after the first component
  7980.  installs.
  7981.  
  7982.  
  7983.  4.2.3  Chained BVHs
  7984.  
  7985.  After the first dynamic-link library component of a logical BVH installs, a
  7986.  subsequent dynamic-link library component need not destroy any of the first
  7987.  component's addresses, even if the subsequent component supplies versions of
  7988.  the same functions.
  7989.  
  7990.  Instead, the subsequent component can do the following:
  7991.  
  7992.    ■   Keep a copy of the prior component's call vector table that is already
  7993.        initialized with pointers to the VDH functions supplied by the prior
  7994.        component.
  7995.  
  7996.    ■   Put its own addresses into the BVS dispatch table, overwriting the
  7997.        prior component's symbolic addresses in the system's call vector
  7998.        table.
  7999.  
  8000.    ■   Pre-process VDH function calls as they come in with its own functions.
  8001.        Then, route calls through the copied dispatch table to the prior
  8002.        component's corresponding function, and let it process the request
  8003.        from BVS.
  8004.  
  8005.    ■   Do any post-processing necessary after the prior component's function
  8006.        returns control. Then, return control to BVS.
  8007.  
  8008.  
  8009.  This technique, called "chaining," allows a BVH to add features to a basic
  8010.  dynamic-link library component (whose VDH functions are merely adequate to
  8011.  handle BVS calls) by adding a subsequent dynamic-link library component.
  8012.  
  8013.  A chained BVH must also allocate an environment buffer that contains the
  8014.  chainee's environment buffer as a proper subset.
  8015.  
  8016.  
  8017.  4.2.4  Ring-0 Components
  8018.  
  8019.  Most BVHs have only dynamic-link library components. However, a BVH must
  8020.  have a ring-0 component if its adapter does not recognize the real-mode
  8021.  interrupt 10H at system boot. The ring-0 component is a character device
  8022.  driver that can force the adapter out of its native mode and pass control to
  8023.  BVS's real-mode PanicWrite function (INT 10H WriteTTY) in case MS OS/2 must
  8024.  terminate abnormally before it loads the video subsystem. Then, MS OS/2 can
  8025.  send a termination message to the screen.
  8026.  
  8027.  A BVH may have a ring-0 component in order to take advantage of an adapter's
  8028.  special features, such as paged-memory support.
  8029.  
  8030.  A BVH ring-0 component is required to support the Init, OpenDevice, and
  8031.  GenericIOCtl requests. It should return "Unknown command" (standard error
  8032.  code 03) and "done" in the Status word of the request packet for any device
  8033.  commands that it does not support.
  8034.  
  8035.  The ring-0 component must verify that the adapter is present at the Init
  8036.  request, and it must also process the IOCtl category 03, function 73H,
  8037.  GenericIOCtl request (and verify that the adapter is present at this request
  8038.  also). The category 03, function 73H, GenericIOCtl request is a ring-0
  8039.  version of the DevEnable function for a BVH dynamic-link library component.
  8040.  The Ptr_To_Data_Buff in the GenericIOCtl request packet accesses a data
  8041.  packet with the following layout:
  8042.  
  8043.  +-------------------+
  8044.  |  Subfunction      |   DWORD
  8045.  +-------------------+
  8046.  |  Parm1            |   DWORD PTR Ptr_To_Data_Buff+4
  8047.  +-------------------+
  8048.  |  Parm2            |   DWORD PTR Ptr_To_Data_Buff+8
  8049.  +-------------------+
  8050.  |  FnReturnCode     |   WORD PTR Ptr_To_Data_Buff+0CH
  8051.  +-------------------+
  8052.  
  8053.  
  8054.  The Subfunction, Parm1, and Parm2 parameters are identical to those of the
  8055.  DevEnable function (see Section 4.2). The input Subfunction value is 1H. On
  8056.  exit, the FnReturnCode field should contain a zero for success or the value
  8057.  ERROR_VIO_BAD_ADAPTER.
  8058.  
  8059.  However, the ring-0 component must set up a call gate if it overwrites any
  8060.  VDH function address in the BVS dispatch table, because all VDH functions
  8061.  must be callable from both ring-2 and ring-3.
  8062.  
  8063.  Rather than setting up a call gate, the BVH can use either of the following
  8064.  techniques:
  8065.  
  8066.    ■   Code at least an initial dynamic-link library component that specifies
  8067.        entry points for the VDH functions in a conforming code segment with
  8068.        I/O privilege. If the BVH is the boot-up text-display handler, this
  8069.        component must be the initial dynamic-link library that supplies the
  8070.        required boot-up VDH functions (see Section 4.2.2). Put support
  8071.        routines for the VDH functions into the ring-0 component. Call
  8072.        DosDevIOCtl or DosDevIOCtl2 from a dynamic-link library component when
  8073.        one of your VDH functions needs ring-0 support.
  8074.  
  8075.    ■   If a ring-0 component is optional, install it as a separate
  8076.        screen/adapter device driver with its own device statement in
  8077.        config.sys. Put support routines for the VDH functions into this
  8078.        driver for the VDH functions in your BVH dynamic-link library
  8079.        components. Call DosDevIOCtl or DosDevIOCtl2 when a VDH function needs
  8080.        ring-0 support.
  8081.  
  8082.  
  8083.  Note that dynamic-link library code must call DosOpen or DosOpen2 to obtain
  8084.  a device handle before making an IOCtl call to a ring-0 component or driver.
  8085.  Device handles are system resources, so the BVH code should be designed to
  8086.  release device handles as quickly as possible. A ring-0 replacement screen$
  8087.  driver must handle the following category 03 IOCtl calls that support BVHs:
  8088.  
  8089.  Function                          Description
  8090.  ────────────────────────────────────────────────────────────────────────────
  8091.  
  8092.  70H                               Allocates an LDT selector (supports VDH
  8093.                                    GetPhysBuf).
  8094.  
  8095.  75H                               Allocates an LDT selector with offset
  8096.                                    (supports VDH GetPhysBuf).
  8097.  
  8098.  71H                               Deallocates an LDT selector (supports
  8099.                                    VDH FreePhysBuf).
  8100.  
  8101.  For more information about the Init, OpenDevice, and GenericIOCtl requests,
  8102.  see Chapter 2, "Device Commands." For general information about installable
  8103.  ring-0 drivers, see Chapter 1, "Overview of Base and Installable Device
  8104.  Drivers." For more information about the DosOpen, DosOpen2, DosDevIOCtl, and
  8105.  DosDevIOCtl2 functions, see Appendix C, "Dos Functions for Installable
  8106.  Device Drivers." Note that a BVH dynamic-link library component runs at
  8107.  ring-2, not at ring-0, so it can call these functions after the BVH is
  8108.  installed.
  8109.  
  8110.  
  8111.  4.3  VDH Function Calls
  8112.  
  8113.  BVS passes three parameters to every VDH function on the application's
  8114.  stack. The following is a C-language template for a BVH's declaration of
  8115.  every VDH function:
  8116.  
  8117.  USHORT  Function_Name(pEnvironment, pParmBlock, ulFunction)
  8118.  ENVIRONMENT far *pEnvironment;      /* pointer to environment buffer */
  8119.                                      /*    for this session           */
  8120.  VDH_xxx far *pParmBlock;            /* pointer to function-specific  */
  8121.                                      /*    parameter block            */
  8122.  ULONG ulFunction;                   /* VDH function code (index)     */
  8123.  
  8124.  
  8125.  The pEnvironment pointer is a huge selector that accesses the environment
  8126.  buffer for the calling application's session. The environment buffer has a
  8127.  maximum size of one megabyte, so the pEnvironment selector accesses the
  8128.  first 64K segment of this buffer.
  8129.  
  8130.  The format of the environment buffer is BVH-specific. The BVH developer
  8131.  defines the ENVIRONMENT structure to suit the needs of the adapter and his
  8132.  or her code. However, every BVH ENVIRONMENT structure must contain certain
  8133.  fields, including a copy of the VIOMODEINFO structure. For more information
  8134.  about the format of the environment buffer, see the InitializeEnvironment
  8135.  function in Section 4.5.
  8136.  
  8137.  All pointer parameters to VDH functions are protected-mode virtual
  8138.  addresses. Pointers to the environment or logical video buffers are huge
  8139.  selectors, because MS OS/2 calls DosAllocHuge to set up these buffers for
  8140.  each new session. If the environment buffer or LVB is greater than 64K in
  8141.  length, use the value returned by the DosGetHugeShift function to access the
  8142.  next segment.
  8143.  
  8144.  The format of the parameter block (pointed to by pParmBlock) is
  8145.  function-specific. The general structure of the parameter block is as
  8146.  follows:
  8147.  
  8148.  typedef struct {
  8149.      USHORT usLength;      /* bytes in ParmBlock, including usLength*/
  8150.      USHORT fsFlags;       /* bit 0=0--operate on environment       */
  8151.                            /*          buffer or on LVB only        */
  8152.                            /* bit 0=1--operate on adapter and update*/
  8153.                            /*          environment buffer and/or    */
  8154.                            /*          LVB also                     */
  8155.                            /* bits 1-15 function-specific           */
  8156.      /* additional fields are function-specific                     */
  8157.  } VDH_xxx;
  8158.  
  8159.  
  8160.  The parameter block for every VDH function always contains the first two
  8161.  fields. The least significant bit of the fsFlags field tells the BVH whether
  8162.  the calling application is running in the foreground. If bit 0 of fsFlags is
  8163.  set on entry to a VDH function, the BVH must access the adapter to perform
  8164.  the operation and must update the environment buffer with the changes it
  8165.  makes on the adapter. BVHs that handle DBCS (double-byte character set) text
  8166.  display, must update the LVB before the PVB (physical video buffer).
  8167.  
  8168.  The ulFunction value identifies the VDH function by its function code in the
  8169.  BVS dispatch table. For a list of the VDH function codes, see Section 4.2.1.
  8170.  
  8171.  
  8172.  Every VDH function returns a value (to the ax register, if it is coded in
  8173.  assembly language). Each function returns zero if it is successful. For more
  8174.  information about function-specific errors that a BVH should return, see
  8175.  Section 4.5.
  8176.  
  8177.  
  8178.  4.4  LVB Formats
  8179.  
  8180.  The contents of the LVB are a sequence of character-attribute pairs that map
  8181.  to cells on the display.
  8182.  
  8183.  MS OS/2 version 1.2 defines two basic formats for LVBs, so that a BVH can
  8184.  map an LVB to the PVB and vice versa. BVS passes LVB selectors to the BVH
  8185.  for many VDH functions. The BVH manages its own PVB addresses.
  8186.  
  8187.  
  8188.  4.4.1  Default LVB Format
  8189.  
  8190.  A BVH that uses the MS OS/2 default LVB format must supply its code values
  8191.  for some VDH functions. The following constants define these values:
  8192.  
  8193.  #define DefaultFormat     0x00
  8194.  #define DefaultAttrCount  0x01
  8195.  
  8196.  
  8197.  An LVB in the default format is a stream of two-byte character-attribute
  8198.  pairs. The first byte is a character code point. The second is an attribute
  8199.  byte, specifying the appearance of the character on the display. Each
  8200.  character-attribute pair in the LVB maps to one cell on the display, as is
  8201.  common for US-standard adapters.
  8202.  
  8203.  However, BVHs that handle DBCS (double-byte character set) displays must
  8204.  sometimes handle characters that require two cells to display, as well as
  8205.  those that require one cell. For these BVHs, the default LVB format is
  8206.  inadequate.
  8207.  
  8208.  
  8209.  4.4.2  World-wide LVB Format
  8210.  
  8211.  A BVH that uses the MS OS/2 world-wide LVB format must also supply its code
  8212.  values for some VDH functions. The following constants define these values:
  8213.  
  8214.  #define WorldFormat     0x70
  8215.  #define WorldAttrCount  0x03
  8216.  
  8217.  
  8218.  An LVB in the world-wide format is a stream of four-byte character-attribute
  8219.  pairs. The first byte is a character code point, as for the default format.
  8220.  The next three bytes specify attributes. Each character-attribute pair in
  8221.  the world-wide LVB format is defined as follows: <TT>World-wide LVB
  8222.  Character-attribute Format" ""</TT>
  8223.  
  8224.  Byte                              Bit         Meaning
  8225.  ────────────────────────────────────────────────────────────────────────────
  8226.  
  8227.  First                                         Character code point (for
  8228.                                                example, SHIFTJIS if the
  8229.                                                code page is DBCS 93
  8230.  
  8231.  Second                                        CGA attributes (background
  8232.                                                and foreground color)
  8233.  
  8234.  Third                             0-1         Reserved (must be zero)
  8235.  
  8236.                                    2           Top horizontal grid
  8237.                                                attribute
  8238.  
  8239.                                    3           Left vertical grid attribute
  8240.  
  8241.                                    4           Background transparency (set
  8242.                                                has meaning in AVIO context
  8243.                                                only)
  8244.  
  8245.                                    5           Blinking
  8246.  
  8247.                                    6           Reverse video
  8248.  
  8249.                                    7           Underscore
  8250.  
  8251.  Fourth                            0           DBCS byte (set for DBCS byte)
  8252.  
  8253.                                    1-6         Reserved (must be zero)
  8254.  
  8255.                                    7           Trailing byte, DBCS
  8256.                                                double-cell character (set
  8257.                                                for trailing byte)
  8258.  
  8259.  In this format, a single-cell DBCS character also has three attribute bytes
  8260.  per character code point in the LVB. The attribute bytes for a single-cell
  8261.  DBCS character contain the font-identification code.
  8262.  
  8263.  In MS OS/2 world-wide format, a character code point can represent an SBCS
  8264.  (single-byte character set) character, the leading or trailing byte of a
  8265.  double-cell DBCS character, or a DBCS single-cell character. The fourth
  8266.  attribute byte of a DBCS character is sometimes called the "system byte,"
  8267.  because it is read-only at the calling application's level; the BVH has
  8268.  read-write access to the system byte.
  8269.  
  8270.  A BVH that defines an LVB format identical to that of its adapter should use
  8271.  the value 0x80 as the format ID. It should use an attribute-count value
  8272.  identical to the number of attribute bytes per character code point.
  8273.  
  8274.  
  8275.  4.4.3  Shadow LVBs
  8276.  
  8277.  A BVH that uses only the default LVB format may write character-attribute
  8278.  pairs directly to the display for the current foreground session. It need
  8279.  not maintain an LVB for this session, since the default format maps
  8280.  one-to-one to single cells on the display. When a session switch occurs, the
  8281.  BVH saves the PVB to an LVB for the about-to-go-background session. When BVS
  8282.  calls the BVH to restore an LVB for a background session, BVS supplies the
  8283.  corresponding LVB selector to the BVH.
  8284.  
  8285.  A BVH that uses only the default LVB format need not maintain an LVB, called
  8286.  a "shadow LVB," for the current foreground session, but it may do so.
  8287.  
  8288.  However, a BVH that uses world-wide LVB format must maintain one or more
  8289.  shadow LVBs for the foreground session. Such BVHs sometimes overlay the
  8290.  display with a conversion rectangle. Each conversion rectangle must have its
  8291.  own LVB, so that the calling application's LVB is intact when a conversion
  8292.  rectangle is dismissed, and so the BVH can refresh any conversion rectangle
  8293.  after it scrolls the display or writes to it at an application's VIO call.
  8294.  
  8295.  
  8296.  4.4.4  DBCS Text Display Updates
  8297.  
  8298.  A BVH that handles DBCS displays must handle double-cell DBCS characters
  8299.  correctly when the following problems occur:
  8300.  
  8301.    ■   A read or write request begins or ends at a position that would bisect
  8302.        a double-cell character.
  8303.  
  8304.    ■   An application's input buffer ends on the leading byte of a
  8305.        double-cell character, or a write operation ends at the last cell of
  8306.        the LVB/PVB and this last cell is the leading byte of a double-cell
  8307.        character.
  8308.  
  8309.    ■   A write operation is about to bisect a double-cell character at the
  8310.        edge of the screen.
  8311.  
  8312.  
  8313.  To handle such problems correctly, the BVH must obey the following general
  8314.  rules:
  8315.  
  8316.    ■   Always update the LVB before updating the PVB.
  8317.  
  8318.    ■   Replace any bisected double-cell character with single-cell space
  8319.        characters in the destination buffer, except at the edge of the
  8320.        screen. At a screen edge, retain the double-cell character in the LVB;
  8321.        the BVH should (but not must) replace the bisected character with a
  8322.        space in the PVB.
  8323.  
  8324.    ■   When a conversion rectangle is dismissed, restore any bisected
  8325.        double-cell characters that were overlaid by a border of the
  8326.        conversion rectangle when refreshing the PVB from the LVB.
  8327.  
  8328.  
  8329.  For function-specific information about DBCS update rules, see the
  8330.  TextBufferUpdate and WriteTTY in Section 4.5, next. MS OS/2 guarantees
  8331.  compatibility across DBCS displays for BVHs that obey these
  8332.  function-specific DBCS update rules.
  8333.  
  8334.  
  8335.  4.5  VDH Function Reference
  8336.  
  8337.  This section describes the VDH functions in alphabetic order.
  8338.  
  8339.  
  8340.  █    FreePhysBuf
  8341.  ────────────────────────────────────────────────────────────────────────────
  8342.  
  8343.  USHORT FreePhysBuf  (pEnvironment, pParmBlock, ulFunction)
  8344.  
  8345.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  8346.  
  8347.  VDH_FREEPVB far * pParmBlock;     /*pointer to parameter block */
  8348.  
  8349.  ULONG  ulFunction;                /*function index */
  8350.  
  8351.  
  8352.  The FreePhysBuf function deallocates an LDT (local descriptor table)
  8353.  selector that was allocated by the GetPhysBuf function.
  8354.  
  8355.  
  8356.  Parameters
  8357.  
  8358.  pEnvironment  to the environment buffer.
  8359.  
  8360.  pParmBlock  to the parameter block for FreePhysBuf, defined by the following
  8361.  structure:
  8362.  
  8363.  typedef struct {
  8364.      USHORT usLength;                 /* ParmBlock = 6 bytes         */
  8365.      USHORT fsFlags;                  /* must be zero                */
  8366.      USHORT selLDTSelector;           /* allocated by GetPhysBuf     */
  8367.  } VDH_FREEPVB;
  8368.  
  8369.  
  8370.  ulFunction  FreePhysBuf in the call vector table; its value is 273L
  8371.  (0x0111).
  8372.  
  8373.  
  8374.  Return Value
  8375.  
  8376.  If it is successful, FreePhysBuff should return zero (to the ax register
  8377.  when coded in assembly language). Otherwise, it should return one of the
  8378.  following errors when it encounters any one of the following conditions:
  8379.  
  8380.  Return                            Conditions
  8381.  ────────────────────────────────────────────────────────────────────────────
  8382.  
  8383.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  8384.                                    except 273L (0x0111); if the ParmBlock
  8385.                                    fsFlags value is nonzero; or if the
  8386.                                    pEnvironment value is zero.
  8387.  
  8388.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not 6.
  8389.  
  8390.  ERROR_VIO_PTR                     If the ParmBlock selLDTSelector passed
  8391.                                    to a ring-0 BVH component is not a
  8392.                                    ring-3 selector.
  8393.  
  8394.  
  8395.  
  8396.  Comments
  8397.  
  8398.  The FreePhysBuf function may use either of the following methods to release
  8399.  the LDT selector:
  8400.  
  8401.    ■   Call the DosFreeSeg function to release the input selector.
  8402.  
  8403.    ■   Call the DosDevIOCtl or DosDevIOCtl2 function with the input physical
  8404.        address, the screen$ driver handle, and the IOCtl code combination
  8405.        category 0x0003 and function 0x0071 to free the selector or selector
  8406.        with offset that was obtained by GetPhysBuf.
  8407.  
  8408.  
  8409.  For more information about DosDevIOCtl and DosDevIOCtl2, see Appendix C,
  8410.  "Dos Functions for Installable Device Drivers." Note that a BVH dynamic-link
  8411.  library component runs at ring-2, not at ring-0, so it can call these
  8412.  functions after the BVH is installed.
  8413.  
  8414.  Otherwise, the FreePhysBuf function must have support from a BVH ring-0
  8415.  component that calls the DevHlp routine PhysToUVirt to release the LDT
  8416.  selector. In this case, the ring-0 support routine must check the input LDT
  8417.  selector's RPL (requested privilege level) before calling PhysToUVirt; if
  8418.  the RPL value is not 3, FreePhysBuf should not release the input selector.
  8419.  For more information about PhysToUVirt, see Chapter 3, "Device Helper
  8420.  Services."
  8421.  
  8422.  
  8423.  
  8424.  
  8425.  See Also
  8426.  
  8427.  DosFreeSeg, GetPhysBuf
  8428.  
  8429.  
  8430.  █    GetColorLookup
  8431.  ────────────────────────────────────────────────────────────────────────────
  8432.  
  8433.  USHORT GetColorLookup  (pEnvironment, pParmBlock, ulFunction)
  8434.  
  8435.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  8436.  
  8437.  VDH_CLUT far * pParmBlock;        /*pointer to parameter block */
  8438.  
  8439.  ULONG  ulFunction;                /*function index */
  8440.  
  8441.  
  8442.  The GetColorLookup function reads a specified number of color definitions
  8443.  from the color lookup table for VGA-type or VGA-compatible adapters.
  8444.  
  8445.  
  8446.  Parameters
  8447.  
  8448.  pEnvironment  to the environment buffer.
  8449.  
  8450.  pParmBlock  to the parameter block for GetColorLookup, defined as the
  8451.  following structure:
  8452.  
  8453.  typedef struct {
  8454.      USHORT usLength;            /* ParmBlock = 12 bytes              */
  8455.      USHORT fsFlags;             /* 0x0000=read from environment buf  */
  8456.                                  /* 0x0001=read adapter and update    */
  8457.                                  /*        environment buffer also    */
  8458.      CLUTDATA far *pLookupTable  /* pointer to device-dependent CLUT  */
  8459.      USHORT iFirstEntry;         /* index to first entry to read      */
  8460.      USHORT usNumEntries;        /* how many entries to read          */
  8461.  } VDH_CLUT;
  8462.  
  8463.  
  8464.  ulFunction  GetColorLookup in the call vector table; its value is 262L
  8465.  (0x0106).
  8466.  
  8467.  
  8468.  Return Value
  8469.  
  8470.  If it is successful, GetColorLookup should return zero (to the ax register
  8471.  when coded in assembly language). Otherwise, it should return one of the
  8472.  following errors when it encounters any one of the following conditions:
  8473.  
  8474.  Return                            Conditions
  8475.  ────────────────────────────────────────────────────────────────────────────
  8476.  
  8477.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  8478.                                    except 262L (0x0106); if the ParmBlock
  8479.                                    fsFlags value is greater than 1; if the
  8480.                                    ParmBlock iFirstEntry value is outside
  8481.                                    the range of entries in the color lookup
  8482.                                    table; if the ParmBlock usNumEntries
  8483.                                    value is less than 1; or if the
  8484.                                    pEnvironment value is zero.
  8485.  
  8486.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not
  8487.                                    12; or if the ParmBlock usNumEntries
  8488.                                    value is too large, either greater than
  8489.                                    the number of entries in the color
  8490.                                    lookup table or greater than the total
  8491.                                    entries following iFirstEntry.
  8492.  
  8493.  
  8494.  
  8495.  Comments
  8496.  
  8497.  Only BVHs that support VGA-type adapters need supply a GetColorLookup
  8498.  function.
  8499.  
  8500.  An odd value for the fsFlags field implies that the calling application is
  8501.  running in the foreground. If all ParmBlock fields are valid, GetColorLookup
  8502.  should do the following:
  8503.  
  8504.    ■   Read the adapter's color registers into the specified range of the
  8505.        environment buffer's color lookup table.
  8506.  
  8507.    ■   Update the parameter block's color lookup table with these settings.
  8508.  
  8509.  
  8510.  If the input fsFlags value is zero, GetColorLookup must return values from
  8511.  the environment buffer.
  8512.  
  8513.  The format of the color lookup table is device-dependent.
  8514.  
  8515.  
  8516.  
  8517.  
  8518.  See Also
  8519.  
  8520.  SetColorLookup
  8521.  
  8522.  
  8523.  █    GetCursorInfo
  8524.  ────────────────────────────────────────────────────────────────────────────
  8525.  
  8526.  USHORT GetCursorInfo  (pEnvironment, pParmBlock, ulFunction)
  8527.  
  8528.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  8529.  
  8530.  VDH_CURSOR far * pParmBlock;      /*pointer to parameter block */
  8531.  
  8532.  ULONG  ulFunction;                /*function index */
  8533.  
  8534.  
  8535.  The GetCursorInfo function returns selected information about the cursor's
  8536.  position, its type, or both.
  8537.  
  8538.  
  8539.  Parameters
  8540.  
  8541.  pEnvironment  to the environment buffer.
  8542.  
  8543.  pParmBlock  to the parameter block for GetCursorInfo, defined as the
  8544.  following structure:
  8545.  
  8546.  typedef struct {
  8547.      USHORT usLength;            /* ParmBlock = 16 bytes            */
  8548.      USHORT fsFlags;             /* bit 0=0--get from environ buf   */
  8549.                                  /* bit 0=1--read from HW state, if */
  8550.                                  /*          possible               */
  8551.                                  /* bit 1=1--get cursor position    */
  8552.                                  /* bit 2=1--get cursor type        */
  8553.                                  /* bits 3-15 must be zero          */
  8554.      USHORT usRow;               /* 0=top row                       */
  8555.      USHORT usColumn;            /* 0=leftmost column               */
  8556.      USHORT usTopScanLine;       /* 0=top scan line of n scan       */
  8557.      USHORT usBottomScanLine;    /* lines,(n-1)=bottom scan line    */
  8558.      USHORT usWidth;             /* in columns for text mode        */
  8559.      USHORT usAttribute;         /* -1=hidden for text mode         */
  8560.  } VDH_CURSOR;
  8561.  
  8562.  
  8563.  ulFunction  GetCursorInfo in the call vector table; its value is 264L
  8564.  (0x0108).
  8565.  
  8566.  
  8567.  Return Value
  8568.  
  8569.  If it is successful, GetCursorInfo should return zero (to the ax register
  8570.  when coded in assembly language). Otherwise, it should return one of the
  8571.  following errors when it encounters any one of the following conditions:
  8572.  
  8573.  Return                            Conditions
  8574.  ────────────────────────────────────────────────────────────────────────────
  8575.  
  8576.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  8577.                                    except 264L (0x0108); if the ParmBlock
  8578.                                    fsFlags value is greater than 7; or if
  8579.                                    the pEnvironment value is zero.
  8580.  
  8581.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not
  8582.                                    16.
  8583.  
  8584.  ERROR_VIO_MODE                    If a check of the fbType value in the
  8585.                                    environment buffer's VDHMODEINFO data
  8586.                                    indicates graphics mode.
  8587.  
  8588.  
  8589.  
  8590.  
  8591.  Comments
  8592.  
  8593.  The ParmBlock usRow and usColumn fields contain the cursor position
  8594.  information.
  8595.  
  8596.  The fsFlags field may be a combination (OR) of the following values:
  8597.  
  8598.  Value                             Meaning
  8599.  ────────────────────────────────────────────────────────────────────────────
  8600.  
  8601.  0x0001                            Read in values from the adapter, if
  8602.                                    possible. Otherwise, return cursor
  8603.                                    information from the environment buffer.
  8604.  
  8605.  0x0002                            Get the cursor position values.
  8606.  
  8607.  0x0004                            Get the cursor type values.
  8608.  
  8609.  An odd value for fsFlags implies that the calling application is running in
  8610.  the foreground. In this case, GetCursorInfo should do the following:
  8611.  
  8612.    ■   Read the cursor information from the adapter, if possible.
  8613.  
  8614.    ■   Update the environment buffer with this information.
  8615.  
  8616.    ■   Return the cursor information to the appropriate fields of ParmBlock.
  8617.  
  8618.  
  8619.  If the adapter is write-only or if the fsFlags value is even, GetCursorInfo
  8620.  must return the cursor information from the environment buffer.
  8621.  
  8622.  If the fsFlags value is one or zero, GetCursorInfo may ignore the adapter
  8623.  and environment-buffer settings and return success.
  8624.  
  8625.  
  8626.  
  8627.  
  8628.  See Also
  8629.  
  8630.  GetModeInfo, SetCursorInfo, VioGetCurPos, VioGetCurType
  8631.  
  8632.  
  8633.  █    GetDBCSDisplayInfo
  8634.  ────────────────────────────────────────────────────────────────────────────
  8635.  
  8636.  USHORT GetDBCSDisplayInfo  (pEnvironment, pParmBlock, ulFunction)
  8637.  
  8638.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  8639.  
  8640.  VDH_DBCS far * pParmBlock;        /*pointer to parameter block */
  8641.  
  8642.  ULONG  ulFunction;                /*function index */
  8643.  
  8644.  
  8645.  The GetDBCSDisplayInfo function returns DBCS (double-byte character set)
  8646.  information about characters that require two cells each to display.
  8647.  
  8648.  
  8649.  Parameters
  8650.  
  8651.  pEnvironment  to the environment buffer.
  8652.  
  8653.  pParmBlock  to the parameter block for GetDBCSDisplayInfo, defined as the
  8654.  following structure:
  8655.  
  8656.  typedef struct {
  8657.      USHORT usLength;            /* minimum, 2 bytes                */
  8658.      USHORT fsFlags;             /* must be zero                    */
  8659.      USHORT cbCellTableLen;      /* number of bytes in double-cell  */
  8660.                                  /*   character table               */
  8661.      USHORT cbCellTableOFF;      /* offset to double-cell table     */
  8662.  } VDH_DBCS;
  8663.  
  8664.  
  8665.  ulFunction  GetDBCSDisplayInfo in the call vector table; its value is 261L
  8666.  (0x0105).
  8667.  
  8668.  
  8669.  Return Value
  8670.  
  8671.  If it is successful, GETDBCSDisplayInfo should return zero (to the ax
  8672.  register when coded in assembly language). Otherwise, it should return one
  8673.  of the following errors when it encounters any one of the following
  8674.  conditions:
  8675.  
  8676.  Return                            Conditions
  8677.  ────────────────────────────────────────────────────────────────────────────
  8678.  
  8679.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  8680.                                    except 261L (0x0105); if the ParmBlock
  8681.                                    fsFlags value is not zero; or if the
  8682.                                    pEnvironment value is zero.
  8683.  
  8684.  ERROR_INVALID_LENGTH              If the ParmBlock usLength field is less
  8685.                                    than 2 or if the value is less than 8
  8686.                                    plus the size of the double-cell table
  8687.                                    in the environment buffer and the BVH
  8688.                                    supports DBCS code pages.
  8689.  
  8690.  ERROR_VIO_MODE                    If a check of the fbType value in the
  8691.                                    environment buffer's VDHMODEINFO data
  8692.                                    indicates graphics mode.
  8693.  
  8694.  
  8695.  
  8696.  Comments
  8697.  
  8698.  If the ParmBlock usLength value is 2, GetDBCSDisplayInfo should return the
  8699.  number of bytes that it needs to return the double-cell table data.
  8700.  
  8701.  For US-standard adapter types, this value is 6, since GetDBCSDisplayInfo
  8702.  need only return a zero to the cbCellTableLen field of the VDH_DBCS
  8703.  structure.
  8704.  
  8705.  For international adapter types that display double-cell DBCS characters,
  8706.  GetDBCSDisplayInfo should return the sum of the ParmBlock size (8 bytes) and
  8707.  the length of the double-cell table when the input usLength value is 2. When
  8708.  the input usLength value is greater than 2, it defines the maximum amount of
  8709.  data for GetDBCSDisplayInfo to return. If this usLength specification is too
  8710.  short to return the double-cell table, GetDBCSDisplayInfo should return an
  8711.  error.
  8712.  
  8713.  Otherwise, GetDBCSDisplayInfo should return the length and offset of the
  8714.  double-cell character table, which it obtains from the environment buffer.
  8715.  The double-cell character table is an array of paired USHORT values. Each
  8716.  USHORT pair defines the low and high characters of a range of double-cell
  8717.  characters. Each double-cell DBCS character requires two cells on the
  8718.  display.
  8719.  
  8720.  
  8721.  
  8722.  
  8723.  See Also
  8724.  
  8725.  GetLVBInfo
  8726.  
  8727.  
  8728.  █    GetFont
  8729.  ────────────────────────────────────────────────────────────────────────────
  8730.  
  8731.  USHORT GetFont  (pEnvironment, pParmBlock, ulFunction)
  8732.  
  8733.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  8734.  
  8735.  VDH_FONT far * pParmBlock;        /*pointer to parameter block */
  8736.  
  8737.  ULONG  ulFunction;                /*function index */
  8738.  
  8739.  
  8740.  The GetFont function returns either the currently active font or a selected
  8741.  font that is compatible with the current mode.
  8742.  
  8743.  
  8744.  Parameters
  8745.  
  8746.  pEnvironment  to the environment buffer.
  8747.  
  8748.  pParmBlock  to the parameter block for GetFont, defined as the following
  8749.  structure:
  8750.  
  8751.  typedef struct {
  8752.      USHORT usLength;           /* ParmBlock = 14 bytes              */
  8753.      USHORT fsFlags;            /* bit 0=0--read from environment buf*/
  8754.                                 /* bit 0=1--read from adapter and    */
  8755.                                 /*          update environ buf also  */
  8756.                                 /* bit 1=0--return current font      */
  8757.                                 /* bit 1=1--return selected font for */
  8758.                                 /*          current mode             */
  8759.                                 /* bits 2-15 must be zero            */
  8760.      UCHAR  far *pFontBuf;      /* pointer to font buffer for        */
  8761.                                 /*   returned font definition        */
  8762.      USHORT cbFontLen;          /* length of font buffer or zero     */
  8763.      USHORT usPelColumns;       /* pels per character cell in width  */
  8764.                                 /*   for selected font               */
  8765.      USHORT usPelRows;          /* pels per character cell in height */
  8766.                                 /*   for selected font               */
  8767.  } VDH_FONT;
  8768.  
  8769.  
  8770.  ulFunction  GetFont in the call vector table; its value is 266L (0x010A).
  8771.  
  8772.  
  8773.  Return Value
  8774.  
  8775.  If it is successful, GetFont should return zero (to the ax register when
  8776.  coded in assembly language). Otherwise, it should return one of the
  8777.  following errors when it encounters any one of the following conditions:
  8778.  
  8779.  Return                            Conditions
  8780.  ────────────────────────────────────────────────────────────────────────────
  8781.  
  8782.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  8783.                                    except 266L (0x010A); if the ParmBlock
  8784.                                    fsFlags value is greater than 3; if the
  8785.                                    ParmBlock cbFontLen value is zero but
  8786.                                    pFontBuf is a nonzero value; or if the
  8787.                                    pEnvironment value is zero.
  8788.  
  8789.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not
  8790.                                    14; or if the ParmBlock cbFontLen value
  8791.                                    is too small to define a font, given the
  8792.                                    value of usPelRows.
  8793.  
  8794.  ERROR_VIO_MODE                    If a check of the fbType value in the
  8795.                                    environment buffer's VDHMODEINFO data
  8796.                                    indicates graphics mode.
  8797.  
  8798.  ERROR_VIO_FONT                    If the ParmBlock usPelColumns and
  8799.                                    usPelRows values specify a font that
  8800.                                    does not match any user, code-page, or
  8801.                                    ROM font supported in the current mode.
  8802.  
  8803.  
  8804.  
  8805.  Comments
  8806.  
  8807.  The type of adapter determines the format of the font definition.
  8808.  
  8809.  The fsFlags field may be a combination (OR) of the following values:
  8810.  
  8811.  Value                             Meaning
  8812.  ────────────────────────────────────────────────────────────────────────────
  8813.  
  8814.  0x0001                            Read the adapter state, if possible, and
  8815.                                    update the environment buffer before
  8816.                                    returning the data. Otherwise, return
  8817.                                    data from the environment buffer.
  8818.  
  8819.  0x0002                            Return the font definition selected by
  8820.                                    the ParmBlock usPelColumns and usPelRows
  8821.                                    values. Otherwise, return the current
  8822.                                    font definition.
  8823.  
  8824.  An odd value for the fsFlags field implies that the calling application is
  8825.  running in the foreground. If all other ParmBlock fields are valid, GetFont
  8826.  should do the following:
  8827.  
  8828.    ■   Read the current or selected font from the adapter, if possible, and
  8829.        update the environment buffer. If the adapter is write-only, get the
  8830.        font definition from the environment buffer.
  8831.  
  8832.    ■   If the input cbFontLen and pFontBuf values are zero, return the buffer
  8833.        length needed for a font definition to cbFontLen. Otherwise, return
  8834.        the font definition to the buffer accessed by pFontBuf.
  8835.  
  8836.  
  8837.  
  8838.  
  8839.  
  8840.  
  8841.  
  8842.  See Also
  8843.  
  8844.  InitializeEnvironment, SetFont, SetMode, VioSetFont
  8845.  
  8846.  
  8847.  █    GetLVBInfo
  8848.  ────────────────────────────────────────────────────────────────────────────
  8849.  
  8850.  USHORT GetLVBInfo  (pEnvironment, pParmBlock, ulFunction)
  8851.  
  8852.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  8853.  
  8854.  VDH_LVB far * pParmBlock;         /*pointer to parameter block */
  8855.  
  8856.  ULONG  ulFunction;                /*function index */
  8857.  
  8858.  
  8859.  The GetLVBInfo function returns selected information associated with an LVB
  8860.  (logical video buffer), such as the allocation size and default character
  8861.  attributes for a specified LVB.
  8862.  
  8863.  
  8864.  Parameters
  8865.  
  8866.  pEnvironment  to the environment buffer.
  8867.  
  8868.  pParmBlock  to the parameter block for GetLVBInfo, defined by the following
  8869.  structure:
  8870.  
  8871.  typedef struct {
  8872.      USHORT usLength;        /* value (min. 14) selects information   */
  8873.      USHORT fsFlags;         /* 0x0000=read from environment buf only */
  8874.                              /* 0x0001=read from adapter and update   */
  8875.                              /*        environment buf also           */
  8876.      UCHAR  uchFormatID;     /* 0x00=default (US)                     */
  8877.                              /* 0x70=world (international)            */
  8878.                              /* 0x80=identical to adapter's (DBCS)    */
  8879.      UCHAR  uchAttrCount;    /* 0x01=default,0x03=world; otherwise,   */
  8880.                              /*   adapter-specific for DBCS           */
  8881.      USHORT usLVBWidth;      /* number of cells in current mode       */
  8882.      USHORT usLBVHeight;     /* number of cells in current mode       */
  8883.      ULONG  ulLVBSize;       /* size for current mode (returned)      */
  8884.      USHORT cbAttrBufSize;   /* bytes in default attribute return buf */
  8885.      UCHAR far *pafbAttrBufAddr; /* pointer to default attribute buf  */
  8886.                                  /* (array of char-attribute bytes)   */
  8887.  } VDH_LVB;
  8888.  
  8889.  
  8890.  ulFunction  GetLVBInfo in the call vector table; its value is 279L (0x0117).
  8891.  
  8892.  
  8893.  
  8894.  Return Value
  8895.  
  8896.  If it is successful, GetLVBInfo should return zero (to the ax register when
  8897.  coded in assembly language). Otherwise, it should return one of the
  8898.  following errors when it encounters any one of the following conditions:
  8899.  
  8900.  Return                            Conditions
  8901.  ────────────────────────────────────────────────────────────────────────────
  8902.  
  8903.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  8904.                                    except 279L (0x0117); if the ParmBlock
  8905.                                    fsFlags field has any of bits 1 to 15
  8906.                                    set; if the (input) ParmBlock
  8907.                                    uchFormatID and uchAttrCount pair are
  8908.                                    mismatched (not 0x00 and 0x01, or 0x70
  8909.                                    and 0x03); if an input, nonzero
  8910.                                    ParmBlock cbAttrBufSize value is less
  8911.                                    than the corresponding cbAttrBufSize
  8912.                                    value in the environment buffer; or if
  8913.                                    the pEnvironment value is zero.
  8914.  
  8915.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is less
  8916.                                    than 14, does not fall on a ParmBlock
  8917.                                    field boundary, or is greater than 20;
  8918.                                    or if an input, nonzero ParmBlock
  8919.                                    cbAttrBufSize value is too small to
  8920.                                    return the data for an input, nonzero
  8921.                                    pafbAttrBufAddr.
  8922.  
  8923.  ERROR_VIO_MODE                    If a check of the fbType value in the
  8924.                                    environment buffer's VDHMODEINFO data
  8925.                                    indicates graphics mode.
  8926.  
  8927.  
  8928.  
  8929.  Comments
  8930.  
  8931.  The input ParmBlock usLength value determines how much information
  8932.  GetLVBInfo should return. Note that the input usLength value has a minimum
  8933.  of 14 and must fall on a ParmBlock field boundary (14, 16, or 20);
  8934.  GetLVBInfo need not attempt to return partial information in a field.
  8935.  
  8936.  The ParmBlock fsFlags value determines whether GetLVBInfo calculates the LVB
  8937.  information from the adapter and updates the environment buffer before
  8938.  returning values to the ParmBlock fields.
  8939.  
  8940.  If both the ParmBlock uchFormatID and uchAttrCount fields contain input
  8941.  zeros, GetLVBInfo should return the LVB allocation size values for the
  8942.  current mode, including the current mode's values for these two fields.
  8943.  
  8944.  GetLVBInfo should also return the current mode's value when the input
  8945.  ParmBlock chAttrBufSize is zero. However, an input zero for pafbAttrBufAddr
  8946.  indicates that GetLVBInfo need not return character-attribute data.
  8947.  
  8948.  If the input values for cbAttrBufSize and pafbAttrBufAddr are nonzero,
  8949.  GetLVBInfo must check the cbAttrBufSize value and return an error when this
  8950.  value is too small to return all the attribute data.
  8951.  
  8952.  The adapter-specific uchFormatID value 0x80 requires the BVH to set a
  8953.  corresponding value for its default uchAttrCount. By convention, this value
  8954.  represents the number of attribute bytes per character byte for BVHs that
  8955.  support DBCS (double-byte character set) text display.
  8956.  
  8957.  
  8958.  
  8959.  
  8960.  See Also
  8961.  
  8962.  GetMode, InitializeEnvironment
  8963.  
  8964.  
  8965.  █    GetMode
  8966.  ────────────────────────────────────────────────────────────────────────────
  8967.  
  8968.  USHORT GetMode  (pEnvironment, pParmBlock, ulFunction)
  8969.  
  8970.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  8971.  
  8972.  VDH_MODE far * pParmBlock;        /*pointer to parameter block */
  8973.  
  8974.  ULONG  ulFunction;                /*function index */
  8975.  
  8976.  
  8977.  The GetMode function returns the current video mode information.
  8978.  
  8979.  
  8980.  Parameters
  8981.  
  8982.  pEnvironment  to the environment buffer.
  8983.  
  8984.  pParmBlock  to the parameter block for GetMode, defined as the following
  8985.  structure:
  8986.  
  8987.  typedef struct {
  8988.      USHORT usLength;           /* ParmBlock = 8 bytes               */
  8989.      USHORT fsFlags;            /* bit 0=0--get from environment buf */
  8990.                                 /* bit 0=1--get from adapter, if     */
  8991.                                 /*          possible, and update     */
  8992.                                 /*          environment buf also     */
  8993.                                 /* bits 1-15 must be zero (reserved) */
  8994.      PVIOMODEINFO;              /* pointer to VIOMODEINFO data       */
  8995.  } VDH_MODE;
  8996.  
  8997.  
  8998.  ulFunction  GetMode in the call vector table; its value is 268L (0x010C).
  8999.  
  9000.  
  9001.  Return Value
  9002.  
  9003.  If it is successful, GetMode should return zero (to the ax register when
  9004.  coded in assembly language). Otherwise, it should return one of the
  9005.  following errors when it encounters any one of the following conditions:
  9006.  
  9007.  Return                            Conditions
  9008.  ────────────────────────────────────────────────────────────────────────────
  9009.  
  9010.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  9011.                                    except 268L (0x010C); if the ParmBlock
  9012.                                    fsFlags value is greater than 1; or if
  9013.                                    the pEnvironment value is zero.
  9014.  
  9015.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not
  9016.                                    8; or if the calling application's mode
  9017.                                    data (pointed to by the ParmBlock
  9018.                                    PVIOMODEINFO field) has a cb length
  9019.                                    value that is not 2 or is not at least
  9020.                                    34.
  9021.  
  9022.  
  9023.  
  9024.  Comments
  9025.  
  9026.  The GetMode function returns the current mode settings to the buffer
  9027.  accessed by ParmBlock PVIOMODEINFO. This pointer must access a buffer that
  9028.  specifies a cb length value that is either 2 or at least the length of the
  9029.  _VDHMODEINFO structure (34) when GetMode is called. If the cb value is 2 or
  9030.  greater than the largest possible length, GetMode returns the length of the
  9031.  _VDHMODEINFO structure to the cb field. The _VDHMODEINFO structure is
  9032.  equivalent to VIOMODEINFO.
  9033.  
  9034.  An odd value for the fsFlags field implies that the calling application is
  9035.  running in the foreground. In this case, GetMode should do the following:
  9036.  
  9037.    ■   Read in the current mode settings from the adapter, if possible.
  9038.  
  9039.    ■   Update the mode data in the environment buffer with these settings and
  9040.        return the information to the buffer accessed by PVIOMODEINFO.
  9041.  
  9042.  
  9043.  If the adapter is write-only or if the fsFlags field is zero, GetMode must
  9044.  return values from the environment buffer.
  9045.  
  9046.  
  9047.  
  9048.  
  9049.  See Also
  9050.  
  9051.  InitializeEnvironment, SetMode, VioGetMode
  9052.  
  9053.  
  9054.  █    GetPaletteRegisters
  9055.  ────────────────────────────────────────────────────────────────────────────
  9056.  
  9057.  USHORT GetPaletteRegisters  (pEnvironment, pParmBlock, ulFunction)
  9058.  
  9059.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  9060.  
  9061.  VDH_PALET far * pParmBlock;       /*pointer to parameter block */
  9062.  
  9063.  ULONG  ulFunction;                /*function index */
  9064.  
  9065.  
  9066.  The GetPaletteRegisters function reads a specified number of palette
  9067.  register settings from the adapter or from the environment buffer into the
  9068.  palette buffer.
  9069.  
  9070.  
  9071.  Parameters
  9072.  
  9073.  pEnvironment  to the environment buffer.
  9074.  
  9075.  pParmBlock  to the parameter block for GetPaletteRegisters, defined as the
  9076.  following structure:
  9077.  
  9078.  typedef struct {
  9079.      USHORT usLength;           /* ParmBlock = 12 bytes              */
  9080.      USHORT fsFlags;            /* 0x0000=read environment buf only  */
  9081.                                 /* 0x0001=read adapter's palette regs*/
  9082.                                 /* if possible, and update           */
  9083.                                 /* environment buffer's pointer to   */
  9084.      USHORT far *pPalDataBuf;   /* palette buffer (array)            */
  9085.      USHORT iFirstEntry;        /* index of first register to read   */
  9086.      USHORT usNumEntries;       /* number of entries to read in      */
  9087.  } VDH_PALETTE;
  9088.  
  9089.  
  9090.  ulFunction  GetPaletteRegisters in the call vector table; its value is 270L
  9091.  (0x010E).
  9092.  
  9093.  
  9094.  Return Value
  9095.  
  9096.  If it is successful, GetPaletteRegisters should return zero (to the ax
  9097.  register when coded in assembly language). Otherwise, it should return one
  9098.  of the following errors when it encounters any one of the following
  9099.  conditions:
  9100.  
  9101.  Return                            Conditions
  9102.  ────────────────────────────────────────────────────────────────────────────
  9103.  
  9104.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  9105.                                    except 270L (0x010E); if the ParmBlock
  9106.                                    fsFlags value is greater than 1; if the
  9107.                                    ParmBlock iFirstEntry value is outside
  9108.                                    the range of index values for the
  9109.                                    palette registers; if the ParmBlock
  9110.                                    usNumEntries is less than 1; or if the
  9111.                                    pEnvironment value is zero.
  9112.  
  9113.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not
  9114.                                    12; or if the ParmBlock usNumEntries
  9115.                                    value is too large, either greater than
  9116.                                    the number of entries in the palette
  9117.                                    buffer array or greater than the total
  9118.                                    entries following iFirstEntry.
  9119.  
  9120.  
  9121.  
  9122.  Comments
  9123.  
  9124.  An odd value for the fsFlags field implies that the calling application is
  9125.  running in the foreground. If all ParmBlock fields are valid,
  9126.  GetPaletteRegisters should do the following:
  9127.  
  9128.    ■   Read the specified range of palette-register settings into the
  9129.        corresponding area of the environment buffer, if possible.
  9130.  
  9131.    ■   Update the palette buffer with these settings.
  9132.  
  9133.  
  9134.  If the adapter is write-only or if the input fsFlags field is zero,
  9135.  GetPaletteRegisters must return values from the environment buffer.
  9136.  
  9137.  The ParmBlock pPalDataBuf field points to a buffer that is an array of
  9138.  USHORT values.
  9139.  
  9140.  The GetPaletteRegisters function should not change the video-enable state of
  9141.  the adapter.
  9142.  
  9143.  
  9144.  
  9145.  
  9146.  See Also
  9147.  
  9148.  SetPaletteRegisters, VioSetState
  9149.  
  9150.  
  9151.  █    GetPhysBuf
  9152.  ────────────────────────────────────────────────────────────────────────────
  9153.  
  9154.  USHORT GetPhysBuf  (pEnvironment, pParmBlock, ulFunction)
  9155.  
  9156.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  9157.  
  9158.  VDH_GETPVB far * pParmBlock;      /*pointer to parameter block */
  9159.  
  9160.  ULONG  ulFunction;                /*function index */
  9161.  
  9162.  
  9163.  The GetPhysBuf function returns one or more LDT (local descriptor table)
  9164.  selectors that access the physical video buffer in 64K-sized blocks. Unless
  9165.  a specific address range is requested, this function returns selectors to
  9166.  the current PVB (physical video buffer).
  9167.  
  9168.  
  9169.  Parameters
  9170.  
  9171.  pEnvironment  to the environment buffer.
  9172.  
  9173.  pParmBlock  to the parameter block for GetPhysBuf, defined by the following
  9174.  structure:
  9175.  
  9176.  typedef struct {
  9177.      USHORT usLength;                    /* ParmBlock = 8 bytes         */
  9178.      USHORT fsFlags;                     /* must be zero                */
  9179.      PVIOPHYSBUF pPVBDataPTR;            /* pointer to VDHVIOPHYSBUF    */
  9180.                                          /* or to ALT_VIOPHYSBUF data   */
  9181.  } VDH_GETPVB;
  9182.  
  9183.  
  9184.  ulFunction  GetPhysBuf in the call vector table; its value is 272L (0x0110).
  9185.  
  9186.  
  9187.  
  9188.  Return Value
  9189.  
  9190.  If it is successful, GetPhysBuf should return zero (to the ax register when
  9191.  coded in assembly language). Otherwise, it should return one of the
  9192.  following errors when it encounters any one of the following conditions:
  9193.  
  9194.  Return                            Conditions
  9195.  ────────────────────────────────────────────────────────────────────────────
  9196.  
  9197.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  9198.                                    except 272L (0x0110); if the ParmBlock
  9199.                                    fsFlags value is nonzero; or if the
  9200.                                    pEnvironment value is zero.
  9201.  
  9202.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not 8.
  9203.  
  9204.  ERROR_VIO_PTR                     If the input physical address is outside
  9205.                                    the valid range for the device.
  9206.  
  9207.  
  9208.  
  9209.  Comments
  9210.  
  9211.  VDHVIOPHYSBUF and ALT_VIOPHYSBUF contain the MS OS/2 version 1.2 VIOPHYSBUF
  9212.  structure. PVIOPHYSBUF is a far pointer to the VDHVIOPHYSBUF structure,
  9213.  defined as follows:
  9214.  
  9215.  struct _VDHVIOPHYSBUF {
  9216.      PBYTE pBuf;       /* 32-bit pointer to PVB      */
  9217.      ULONG cb;         /* length in bytes of PVB     */
  9218.      SEL   aSel[4];    /* array of max=4 selectors   */
  9219.  };
  9220.  
  9221.  
  9222.  However, if the application passes a length value of zero for VIOPHYSBUF,
  9223.  PVIOPHYSBUF points to the ALT_VIOPHYSBUF structure, defined as follows:
  9224.  
  9225.  typedef struct {
  9226.      USHORT cb;        /* length in bytes of PBV     */
  9227.      SEL    aSel[2];   /* array of max=2 selectors   */
  9228.  } ALT_VIOPHYSBUF;
  9229.  
  9230.  
  9231.  If the PVB address and length passed on input are zero, this function should
  9232.  return one or more LDT selectors that correspond to the adapter's current
  9233.  mode, which the BVH can obtain from the environment buffer.
  9234.  
  9235.  If the input PVB address is nonzero, the BVH should do one of the following:
  9236.  
  9237.  
  9238.    ■   Provide read/write access to the physical-address range where the PVB
  9239.        is located (within 0xA0000 to 0xBFFFF).
  9240.  
  9241.    ■   Provide read-only access to the physical-address range where the ROM
  9242.        fonts are located (within 0x00000 to 0xFFFFF).
  9243.  
  9244.    ■   Return an error if the input physical address is not within the PVB or
  9245.        ROM-font ranges.
  9246.  
  9247.  
  9248.  GetPhysBuf may obtain the LDT selector(s) from the base device driver named
  9249.  screen$, as follows:
  9250.  
  9251.    ■   Call the DosOpen or DosOpen2 function to obtain a handle for the base
  9252.        screen device driver.
  9253.  
  9254.    ■   Call the DosDevIOCtl or DosDevIOCtl2 function with the input physical
  9255.        address, the screen-driver handle, and either of the IOCtl code
  9256.        combinations category 0x0003 and function 0x0070, or category 0x0003
  9257.        and function 0x0075. The category 0x0003 IOCtl function 0x0070 returns
  9258.        a 16-bit selector. Function 0x0075 returns a 16-bit selector with an
  9259.        offset; this function enhances the portability of BVH components that
  9260.        use it.
  9261.  
  9262.  
  9263.  The base screen driver must return a selector with the correct access rights
  9264.  for valid PVB or ROM-font addresses, or it returns an error in the ax
  9265.  register. For more information about the DosOpen, DosOpen2, DosDevIOCtl, and
  9266.  DosDevIOCtl2 functions, see Appendix C, "Dos Functions for Installable
  9267.  Device Drivers." Note that a BVH dynamic-link library component runs at
  9268.  ring-2, not at ring-0, so it can call these functions after the BVH is
  9269.  installed.
  9270.  
  9271.  Otherwise, the GetPhysBuf function must have support from a BVH ring-0
  9272.  component that calls the DevHlp routine PhysToUVirt to convert the input
  9273.  physical address into an LDT selector with the correct access rights. Note
  9274.  that a ring-0 support routine must check that the input physical address is
  9275.  within the PVB or ROM-font range before it calls PhysToUVirt. For more
  9276.  information about PhysToUVirt, see Chapter 3, "Device Helper Services."
  9277.  
  9278.  
  9279.  
  9280.  
  9281.  See Also
  9282.  
  9283.  FreePhysBuff, VioGetPhysBuf
  9284.  
  9285.  
  9286.  █    GetVariableInfo
  9287.  ────────────────────────────────────────────────────────────────────────────
  9288.  
  9289.  USHORT GetVariableInfo  (pEnvironment, pParmBlock, ulFunction)
  9290.  
  9291.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  9292.  
  9293.  VDH_VARIABLE far * pParmBlock;    /*pointer to parameter block */
  9294.  
  9295.  ULONG  ulFunction;                /*function index */
  9296.  
  9297.  
  9298.  The GetVariableInfo function returns information about selected features of
  9299.  the video adapter, including the blink state, overscan (border color),
  9300.  underscore line, video enable, plane enable, code page, scrollable
  9301.  rectangle, and the number of text rows and columns of the display.
  9302.  
  9303.  
  9304.  Parameters
  9305.  
  9306.  pEnvironment  to the environment buffer.
  9307.  
  9308.  pParmBlock  to the parameter block for GetVariableInfo, defined by the
  9309.  following structure:
  9310.  
  9311.  typedef struct {
  9312.      USHORT usLength;        /* value (6-30) selects information      */
  9313.      USHORT fsFlags;         /* 0x0000=read from environment buf only,*/
  9314.                              /* 0x0001=read from hardware, if possible*/
  9315.                              /* bits 1-15 must be zero                */
  9316.      USHORT fsBlink;         /* 0x0000=blink highlights selected cell */
  9317.                              /* 0x0001=background intensity highlights*/
  9318.      USHORT usOverscan;      /* border color                          */
  9319.      USHORT usUnderscore;    /* n=scan line for underscore (n=0-31),  */
  9320.                              /* 32=no underscore                      */
  9321.      USHORT fsVideoEnable;   /* 0x0000=disabled,0x0001=enabled        */
  9322.      ULONG  flDisplayMask;   /* bit n=1 implies plane n enabled       */
  9323.                              /* (n=0-31); otherwise, plane n disabled */
  9324.      USHORT usCodePageID;    /* current ROM-font or user-font ID      */
  9325.      USHORT usScrlLeft;      /* 0=leftmost column of current mode's   */
  9326.                              /*   scrollable rectangle                */
  9327.      USHORT usSrclTop;       /* 0=top row                             */
  9328.      USHORT usScrlRight;     /* right column                          */
  9329.      USHORT usSrclBottom;    /* bottom row                            */
  9330.      USHORT usScreenRows;    /* number of rows in current mode        */
  9331.      USHORT usScreenColumns; /* number of columns in current mode     */
  9332.  } VDH_VARIABLE;
  9333.  
  9334.  
  9335.  ulFunction  GetVariableInfo in the call vector table; its value is 274L
  9336.  (0x0112).
  9337.  
  9338.  
  9339.  Return Value
  9340.  
  9341.  If it is successful, GetVariableInfo should return zero (to the ax register
  9342.  when coded in assembly language). Otherwise, it should return one of the
  9343.  following errors when it encounters any one of the following conditions:
  9344.  
  9345.  Return                            Conditions
  9346.  ────────────────────────────────────────────────────────────────────────────
  9347.  
  9348.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  9349.                                    except 274L (0x0112); if the ParmBlock
  9350.                                    usFlags field has any of bits 1 through
  9351.                                    15 set; or if the pEnvironment value is
  9352.                                    zero.
  9353.  
  9354.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is less
  9355.                                    than 6, does not fall on a ParmBlock
  9356.                                    field boundary, or is greater than 30;
  9357.                                    or if GetVariableInfo reads in a field
  9358.                                    value that is out of range for the
  9359.                                    current mode.
  9360.  
  9361.  ERROR_VIO_MODE                    If a check of the fbType value in the
  9362.                                    environment buffer's VDHMODEINFO data
  9363.                                    indicates graphics mode.
  9364.  
  9365.  
  9366.  
  9367.  Comments
  9368.  
  9369.  The input value for the usLength field determines how much information
  9370.  GetVariableInfo should return. Note that the input usLength value must fall
  9371.  on a ParmBlock field boundary (6, 8, 10, 12, 16, 18, ...); GetVariableInfo
  9372.  need not attempt to return partial information in a field.
  9373.  
  9374.  An odd value for the fsFlags field implies that the calling application is
  9375.  running in the foreground. In this case, GetVariableInfo should do the
  9376.  following:
  9377.  
  9378.    ■   Read the information in from the adapter, if possible. A BVH for a
  9379.        write-only adapter must get information from the environment buffer.
  9380.  
  9381.    ■   Update the environment buffer with information that is read from the
  9382.        adapter.
  9383.  
  9384.    ■   Return information to the appropriate fields of ParmBlock.
  9385.  
  9386.  
  9387.  The GetVariableInfo function should return 32 to the usUnderscore field when
  9388.  there is no underscore.
  9389.  
  9390.  If the usLength value is 18 or more, a BVH that does not support an
  9391.  8514-compatible adapter may ignore the flDisplayMask field.
  9392.  
  9393.  
  9394.  
  9395.  
  9396.  See Also
  9397.  
  9398.  GetMode, SetVariableInfo, TextBufferUpdate (Scrolls)
  9399.  
  9400.  
  9401.  █    InitializeEnvironment
  9402.  ────────────────────────────────────────────────────────────────────────────
  9403.  
  9404.  USHORT InitializeEnvironment  (pEnvironment, pParmBlock, ulFunction)
  9405.  
  9406.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  9407.  
  9408.  VDH_ENVRN far * pParmBlock;       /*pointer to parameter block */
  9409.  
  9410.  ULONG  ulFunction;                /*function index */
  9411.  
  9412.  
  9413.  The InitializeEnvironment function sets up the environment buffer and
  9414.  optionally the adapter state for a new session.
  9415.  
  9416.  
  9417.  Parameters
  9418.  
  9419.  pEnvironment  to the environment buffer.
  9420.  
  9421.  pParmBlock  to the parameter block for InitializeEnvironment, defined as the
  9422.  following structure:
  9423.  
  9424.  typedef struct {
  9425.      USHORT usLength;           /* ParmBlock = 6 bytes               */
  9426.      USHORT fsFlags;            /* bit 0=0--init envirn buf only     */
  9427.                                 /* bit 0=1--init adapter state also  */
  9428.                                 /* bit 1=0--3xBox not being          */
  9429.                                 /*          initialized
  9430.                                 /* bit 1=1--3xBox being initialized  */
  9431.                                 /* bits 2-15 must be zero (reserved) */
  9432.      USHORT selLVBSel;          /* huge (max 1MB) LVB selector       */
  9433.  } VDH_ENVRN;
  9434.  
  9435.  
  9436.  ulFunction  InitializeEnvironment in the call vector table; its value is
  9437.  257L (0x0101).
  9438.  
  9439.  
  9440.  Return Value
  9441.  
  9442.  If it is successful, InitializeEnvironment should return zero (to the ax
  9443.  register when coded in assembly language). Otherwise, it should return one
  9444.  of the following errors when it encounters any one of the following
  9445.  conditions:
  9446.  
  9447.  Return                            Conditions
  9448.  ────────────────────────────────────────────────────────────────────────────
  9449.  
  9450.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  9451.                                    except 257L (0x0101); if the ParmBlock
  9452.                                    fsFlags value is greater than 3; or if
  9453.                                    the pEnvironment value is zero.
  9454.  
  9455.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not 6.
  9456.  
  9457.  
  9458.  
  9459.  Comments
  9460.  
  9461.  The BVH determines the size of its environment buffer. The maximum size is
  9462.  one megabyte, so the pEnvironment value is a huge selector.
  9463.  
  9464.  The layout of data in the environment buffer is, to a certain extent,
  9465.  adapter-specific. However, all MS OS/2 version 1.2 adapters use an
  9466.  environment buffer that contains the data defined in the following
  9467.  structure:
  9468.  
  9469.  typedef struct {
  9470.      USHORT       usModeDataOff;     /* offset to _VDHMODEINFO data   */
  9471.      UCHAR        iModeIndex;        /* indexes current mode          */
  9472.      UCHAR        iROMFontIndex      /* index in ROM font table       */
  9473.      _VDHMODEINFO ModeData;          /* identical to VIOMODEINFO      */
  9474.      SCROLRECT    ScrollRect;        /* scrollable area of screen,    */
  9475.                                      /*   defined as 0x0000=leftmost  */
  9476.                                      /*   column,0x0000=topmost row,  */
  9477.                                      /*   rightmost col and bottom row*/
  9478.                                      /*   are adapter-dependent       */
  9479.                                      /*********************************/
  9480.                                      /*  ScrollRect MUST follow       */
  9481.                                      /*   ModeData                    */
  9482.                                      /*********************************/
  9483.      USHORT       cbAttrBufSize;     /* char-attribute bytes in       */
  9484.                                      /*  current mode                 */
  9485.      UCHAR        uchAttrBuf[4];     /* default for current mode      */
  9486.                                      /*  (2 or 4 bytes)               */
  9487.      USHORT       fsEnvFlags;        /* flag for this environment,    */
  9488.                                      /* 0x0001=3xBox, default zero    */
  9489.      USHORT       usCursorAttributes;/* 0xFFFF=hidden, otherwise      */
  9490.                                      /*  value (default) and visible  */
  9491.      HWREGS       Hardware;          /* adapter's registers           */
  9492.      USHORT       fsVideoEnable;     /* 0x0001=enabled,0x0000=disabled*/
  9493.      UCHAR far    *pActiveFontPTR;   /* to currently active font      */
  9494.      SHORT        sCodePageID;       /* current code-page number or   */
  9495.                                      /*  0x0000=not selectable        */
  9496.      SHORT        sUserFont;         /* -1=selectable,-2=not selectabl*/
  9497.      /*****************************************************************/
  9498.      /* The following fields are defined only if the BVH supports     */
  9499.      /* user-defined fonts; these fields MUST be last in environment  */
  9500.      /* buffer, so that the user-font table is expandable             */
  9501.      /*****************************************************************/
  9502.      USHORT       usNumUserFonts;    /* number of entries in array    */
  9503.      USHORT       UserFonts;         /* first entry, user-font        */
  9504.                                      /*   definitions                 */
  9505.  } VDH_ENVIRONMENT;
  9506.  
  9507.  
  9508.  Note that this structure contains a copy of the _VDHMODEINFO structure, that
  9509.  the scrollable-text region of the screen must be defined following the mode
  9510.  data, and that user-font definitions, if supported, must be the located at
  9511.  the end of the environment buffer.
  9512.  
  9513.  If a BVH must add adapter-specific data areas in the environment buffer or
  9514.  if it is chained to another BVH, it may modify the VDH_ENVIRONMENT structure
  9515.  in one of the following ways:
  9516.  
  9517.    ■   Define all new fields and append VDH_ENVIRONMENT as the last field of
  9518.        the adapter-specific structure if the BVH supports user-defined fonts.
  9519.  
  9520.    ■   Add new fields at the end of VDH_ENVIRONMENT if the BVH does not
  9521.        support user-defined fonts.
  9522.  
  9523.    ■   Insert new fields into VDH_ENVIRONMENT without separating the mode
  9524.        information from the scrollable-rectangle data and without separating
  9525.        a "length" field from the following field or buffer (for example,
  9526.        uchAttrBufSize belongs with uchAttrBuf[4]).
  9527.  
  9528.  
  9529.  A chained BVH must allocate an environment buffer that contains the
  9530.  chainee's VDH_ENVIRONMENT as a proper subset. For more information about
  9531.  chained BVHs, see Section 4.2.3.
  9532.  
  9533.  InitializeEnviroment sets up the default mode data, active font support (ROM
  9534.  or code page), cursor attributes, video enable, and scrollable rectangle for
  9535.  each session. A BVH need not support any scrollable region other than the
  9536.  entire display area, but it may limit the scrollable area.
  9537.  
  9538.  Bit 1 of the fsFlags field tells the BVH whether a DOS real-mode session
  9539.  (3xBox) is also being initialized for the new session. A BVH saves and
  9540.  restores a DOS session as a part of the physical display, but it provides no
  9541.  other support for DOS applications since BVHs run only in protected mode.
  9542.  
  9543.  An odd value for the fsFlags field implies that the new session will run in
  9544.  the foreground. In this case, InitializeEnvironment also must set up the
  9545.  adapter state, not just the environment buffer, for the new session.
  9546.  
  9547.  A BVH that supports DBCS (double-byte character set) code pages or DBCS
  9548.  user-defined fonts must maintain an LVB (logical video buffer) that maps to
  9549.  (or "shadows") its PVB (physical video buffer) for each active session. The
  9550.  selLVBSel field should access an LVB in the world-wide format, if possible.
  9551.  For more information about world-wide LVB format, see Section 4.4.2.
  9552.  
  9553.  A BVH that supports only SBCS (single-byte character set) fonts may maintain
  9554.  an LVB that shadows its PVB, but it need not do so.
  9555.  
  9556.  MS OS/2 allocates the buffer accessed by selLVBSel by calling the
  9557.  DosAllocHuge function. The BVH must define the number of huge selectors it
  9558.  needs to shadow or to save the display when it initializes at system boot.
  9559.  For the InitializeEnvironment function, the selLVBSel accesses the first
  9560.  segment of the buffer. To calculate the selector value for each segment
  9561.  following selLVBSel, use the value returned by the DosGetHugeShift function.
  9562.  
  9563.  
  9564.  
  9565.  
  9566.  
  9567.  See Also
  9568.  
  9569.  DosAllocHuge, DosGetHugeShift, RestoreEnvironment, SaveEnvironment, SetMode,
  9570.  SetVariableInfo, TerminateEnvironment, VioSetMode
  9571.  
  9572.  
  9573.  █    PrintScreen
  9574.  ────────────────────────────────────────────────────────────────────────────
  9575.  
  9576.  USHORT PrintScreen  (pEnvironment, pParmBlock, ulFunction)
  9577.  
  9578.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  9579.  
  9580.  VDH_PRTSCRN far * pParmBlock;     /*pointer to parameter block */
  9581.  
  9582.  ULONG  ulFunction;                /*function index */
  9583.  
  9584.  
  9585.  The PrintScreen function writes the contents of the current screen to the
  9586.  specified printer.
  9587.  
  9588.  
  9589.  Parameters
  9590.  
  9591.  pEnvironment  to the environment buffer.
  9592.  
  9593.  pParmBlock  to the parameter block for PrintScreen, defined as the following
  9594.  structure:
  9595.  
  9596.  typedef struct {
  9597.      USHORT usLength;           /* ParmBlock = 8 bytes               */
  9598.      USHORT fsFlags;            /* 0x0000=print LVB contents only    */
  9599.                                 /* 0x0001=print PVB contents         */
  9600.                                 /* bits 1-15 must be zero            */
  9601.      USHORT selLVBSel;          /* huge (max 1MB) LVB selector       */
  9602.      USHORT hfPrinter;          /* printer-device handle             */
  9603.  } VDH_PRTSCRN;
  9604.  
  9605.  
  9606.  ulFunction  PrintScreen in the call vector table; its value is 277L
  9607.  (0x0115).
  9608.  
  9609.  
  9610.  Return Value
  9611.  
  9612.  If it is successful, PrintScreen should return zero (to the ax register when
  9613.  coded in assembly language). Otherwise, it should return one of the
  9614.  following errors when it encounters any one of the following conditions:
  9615.  
  9616.  Return                            Conditions
  9617.  ────────────────────────────────────────────────────────────────────────────
  9618.  
  9619.  ERROR_VIO_INVALID_PARMS           If the BVH provides a PrintScreen
  9620.                                    function and if the ulFunction value is
  9621.                                    anything except 277L (0x0115); if the
  9622.                                    ParmBlock fsFlags value is greater than
  9623.                                    1; or if the pEnvironment value is zero.
  9624.  
  9625.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not 8.
  9626.  
  9627.  ERROR_VIO_MODE                    If a check of the fbType value in the
  9628.                                    environment buffer's VDHMODEINFO data
  9629.                                    indicates graphics mode.
  9630.  
  9631.  
  9632.  
  9633.  Comments
  9634.  
  9635.  A PrintScreen function is optional. Most BVHs can use the default
  9636.  print-screen support provided by BVS. BVS supplies a default (text-mode)
  9637.  print-screen routine with the same level of support as MS OS/2 version 1.1.
  9638.  The default BVS routine must be called by the currently active (foreground)
  9639.  session.
  9640.  
  9641.  A BVH may supply a PrintScreen of its own to replace the default BVS routine
  9642.  if its adapter has unique print-screen needs.
  9643.  
  9644.  The PrintScreen function may check the environment buffer to determine
  9645.  whether a DOS real-mode session (3xBox) was initialized for the session it
  9646.  will print. This function may call DosBeep if it cannot open the printer and
  9647.  if it runs at ring-3 (application privilege level).
  9648.  
  9649.  
  9650.  
  9651.  
  9652.  See Also
  9653.  
  9654.  WriteTTY
  9655.  
  9656.  
  9657.  █    RestoreEnvironment
  9658.  ────────────────────────────────────────────────────────────────────────────
  9659.  
  9660.  USHORT RestoreEnvironment  (pEnvironment, pParmBlock, ulFunction)
  9661.  
  9662.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  9663.  
  9664.  VDH_ENVRN far * pParmBlock;       /*pointer to parameter block */
  9665.  
  9666.  ULONG  ulFunction;                /*function index */
  9667.  
  9668.  
  9669.  The RestoreEnvironment function restores one or more of the adapter state
  9670.  and the full physical display or partial physical display when a session
  9671.  switch is about to occur.
  9672.  
  9673.  
  9674.  Parameters
  9675.  
  9676.  pEnvironment  to the environment buffer.
  9677.  
  9678.  pParmBlock  to the parameter block for RestoreEnvironment, defined as the
  9679.  following structure:
  9680.  
  9681.  typedef struct {
  9682.      USHORT usLength;           /* ParmBlock = 6 bytes               */
  9683.      USHORT fsFlags;            /* bit 0 must be zero (reserved)     */
  9684.                                 /* bit 1=0--do not restore adapter   */
  9685.                                 /*          state                    */
  9686.                                 /* bit 1=1--restore adapter state    */
  9687.                                 /* bit 2=0--do not restore full      */
  9688.                                 /*          physical display         */
  9689.                                 /* bit 2=1--restore full physical    */
  9690.                                 /*          display                  */
  9691.                                 /* bit 3=0--do not restore partial   */
  9692.                                 /*          physical display         */
  9693.                                 /* bit 3=1--restore partial physical */
  9694.                                 /*          display (popup window)   */
  9695.                                 /* bits 4-15 must be zero (reserved) */
  9696.      USHORT selLVBSel;          /* huge (max 1MB) LVB selector       */
  9697.  } VDH_ENVRN;
  9698.  
  9699.  
  9700.   ulFunction  RestoreEnvironment in the call vector table; its value is
  9701.  259L (0x0103).
  9702.  
  9703.  
  9704.  Return Value
  9705.  
  9706.  If it is successful, RestoreEnvironment should return zero (to the ax
  9707.  register when coded in assembly language). Otherwise, it should return one
  9708.  of the following errors when it encounters any one of the following
  9709.  conditions:
  9710.  
  9711.  Return                            Conditions
  9712.  ────────────────────────────────────────────────────────────────────────────
  9713.  
  9714.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  9715.                                    except 259L (0x0103); if the ParmBlock
  9716.                                    fsFlags field has both bits 2 and 3 set,
  9717.                                    or if it has any of bits 4 to 15 or 0
  9718.                                    set; or if the pEnvironment value is
  9719.                                    zero.
  9720.  
  9721.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not 6.
  9722.  
  9723.  ERROR_VIO_MODE                    If RestoreEnvironment fails to restore
  9724.                                    the adapter state and/or display from
  9725.                                    the environment buffer.
  9726.  
  9727.  
  9728.  
  9729.  Comments
  9730.  
  9731.  Bits 2 and 3 of the fsFlags field are mutually exclusive. Otherwise, this
  9732.  field may be a combination (OR) of the following values:
  9733.  
  9734.  Value                             Meaning
  9735.  ────────────────────────────────────────────────────────────────────────────
  9736.  
  9737.  0x0002                            Restore the adapter state. Otherwise,
  9738.                                    restore only one of the full or partial
  9739.                                    physical display.
  9740.  
  9741.  0x0004                            Restore the full physical display for a
  9742.                                    session switch, provided that bit 3 is
  9743.                                    clear.
  9744.  
  9745.  0x0008                            Restore the partial physical display for
  9746.                                    a popup window, provided that bit 2 is
  9747.                                    clear.
  9748.  
  9749.  In most cases, the input selLVBSel field accesses the first of the segments
  9750.  that map to a full or partial display state. To calculate the selector value
  9751.  for each segment following selLVBSel, use the value returned by the
  9752.  DosGetHugeShift function.
  9753.  
  9754.  However, RestoreEnvironment can be called for an environment that has never
  9755.  been saved. For example, RestoreEnvironment must handle the situation when
  9756.  InitializeEnvironment has set up the environment, but the SaveEnvironment
  9757.  function has never been called for a given session.
  9758.  
  9759.  
  9760.  
  9761.  
  9762.  See Also
  9763.  
  9764.  DosAllocHuge, DosGetHugeShift, InitializeEnvironment, SaveEnvironment
  9765.  
  9766.  
  9767.  █    RetConfigInfo
  9768.  ────────────────────────────────────────────────────────────────────────────
  9769.  
  9770.  USHORT RetConfigInfo  (pEnvironment, pParmBlock, ulFunction)
  9771.  
  9772.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  9773.  
  9774.  VDH_CONFIG far * pParmBlock;      /*pointer to parameter block */
  9775.  
  9776.  ULONG  ulFunction;                /*function index */
  9777.  
  9778.  
  9779.  The RetConfigInfo function returns all of the information necessary to
  9780.  identify the current video adapter and display.
  9781.  
  9782.  
  9783.  Parameters
  9784.  
  9785.  pEnvironment  to the environment buffer. This address should be zero for the
  9786.  RetConfigInfo function.
  9787.  
  9788.  pParmBlock  to the parameter block for RetConfigInfo, defined as the
  9789.  following structure:
  9790.  
  9791.  typedef struct {
  9792.      USHORT usLength;                /* ParmBlock = 8 bytes         */
  9793.      USHORT fsFlags;                 /* must be zero                */
  9794.      VDHCONFIGINFO far *pConfigData; /* pointer to config info data */
  9795.  } VDH_CONFIG;
  9796.  
  9797.  
  9798.  ulFunction  RetConfigInfo in the call vector table; its value is 260L
  9799.  (0x0104).
  9800.  
  9801.  
  9802.  Return Value
  9803.  
  9804.  If it is successful, RetConfigInfo should return zero (to the ax register
  9805.  when coded in assembly language). Otherwise, it should return one of the
  9806.  following errors when it encounters any one of the following conditions:
  9807.  
  9808.  Return                            Conditions
  9809.  ────────────────────────────────────────────────────────────────────────────
  9810.  
  9811.  ERROR_VIO_INVALID_PARMS           If the ulFunction value if not 260L
  9812.                                    (0x0104); if the ParmBlock fsFlags value
  9813.                                    is not zero; or if the pEnvironment
  9814.                                    value is not zero.
  9815.  
  9816.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not
  9817.                                    8; or if the cb length value (in
  9818.                                    VDHCONFIGINFO) is less than 2.
  9819.  
  9820.  
  9821.  
  9822.  Comments
  9823.  
  9824.  This function does not use the environment buffer, so the pEnvironment
  9825.  address value should be zero.
  9826.  
  9827.  The VDHCONFIGINFO structure contains the MS OS/2 version 1.2 VIOCONFIGINFO
  9828.  structure. Your VDHCONFIGINFO must contain at least the first twelve fields
  9829.  that are defined in the following structure:
  9830.  
  9831.  typedef struct {
  9832.      USHORT cb     ;            /* length of structure (min = 34,     */
  9833.                                 /* max = 42 bytes)                    */
  9834.      USHORT usAdapter;          /* display-adapter type: 0=MPA,1=CGA, */
  9835.                                 /* 2=EGA,3=VGA or PS/2,4=IBMJapanG,   */
  9836.                                 /* 5=IBMJapanH,6=IBMJapanST,7=8514a   */
  9837.      USHORT usDisplay;          /* display-monitor type: 0=5051mono,  */
  9838.                                 /* 1=5153color,2=5154enhanced,        */
  9839.                                 /* 4=8512/8513color,5=Japan5550mono,  */
  9840.                                 /* 6=Japan5550color,7=Japan5570color, */
  9841.                                 /* 8=Japan5570fullpage,9=8514color    */
  9842.      ULONG  cbMemory;           /* adapter's memory (in bytes)        */
  9843.      USHORT usConfiguration;    /* should be 0=unknown                */
  9844.      USHORT usDeviceDriver;     /* DD version number                  */
  9845.      USHORT usFlags;            /* 1=boot-up display, 0=other         */
  9846.      ULONG  ulHWBufferSize;     /* sizeof HW state buff in bytes      */
  9847.      ULONG  ulFullSaveSize;     /* sizeof PVB for current mode        */
  9848.      ULONG  ulPartSaveSize;     /* sizeof PVB for popup mode          */
  9849.      USHORT usEMAdaptersOFF;    /* offset to usLEMulatedAdapterData   */
  9850.      USHORT usEMDisplaysOFF;    /* offset to usLEMulatedDisplayData   */
  9851.                                 /* preceding fields are required,     */
  9852.                                 /* following fields may follow your   */
  9853.                                 /* VDHCONFIGINFO in same data segment */
  9854.      USHORT usLEMAdapterData;   /* length of emulated-adapter data    */
  9855.      USHORT usEMAdapters;       /* AND mask 0x008F extracts standard  */
  9856.                                 /* US adapter types emulated          */
  9857.      USHORT usLEMDisplayData;   /* length of emulated-display data    */
  9858.      USHORT usEMDisplays;       /* AND mask 0x021F extracts standard  */
  9859.                                 /* US display types emulated          */
  9860.  } VDHCONFIGINFO;
  9861.  
  9862.  
  9863.  You may define the last four fields of VDHCONFIGINFO in one or two separate
  9864.  data structures for emulated adapters and displays. If you do, the following
  9865.  constraints apply for these structures:
  9866.  
  9867.    ■   The emulated-adapter data and emulated-display data structure(s) must
  9868.        be defined in the same data segment following your VDHCONFIGINFO
  9869.        structure.
  9870.  
  9871.    ■   The usEMAdaptersOFF field of your VDHCONFIGINFO must contain the
  9872.        offset, in bytes, to the length field of your emulated-adapter data
  9873.        structure.
  9874.  
  9875.    ■   The usEMDisplaysOFF field of your VDHCONFIGINGO must contain the
  9876.        offset, in bytes, to the length field of your emulated-display data
  9877.        structure.
  9878.  
  9879.  
  9880.  If the length specified for the first field of VDHCONFIGINFO either is 2 or
  9881.  is larger than the maximum possible length (42 bytes), RetConfigInfo should
  9882.  replace this value with the largest valid length.
  9883.  
  9884.  
  9885.  
  9886.  
  9887.  See Also
  9888.  
  9889.  VioGetConfig
  9890.  
  9891.  
  9892.  █    SaveEnvironment
  9893.  ────────────────────────────────────────────────────────────────────────────
  9894.  
  9895.  USHORT SaveEnvironment  (pEnvironment, pParmBlock, ulFunction)
  9896.  
  9897.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  9898.  
  9899.  VDH_ENVRN far * pParmBlock;       /*pointer to parameter block */
  9900.  
  9901.  ULONG  ulFunction;                /*function index */
  9902.  
  9903.  
  9904.  The SaveEnvironment function saves one or more of the adapter state and the
  9905.  full physical display or the partial physical display when a session switch
  9906.  is about to occur.
  9907.  
  9908.  
  9909.  Parameters
  9910.  
  9911.  pEnvironment  to the environment buffer.
  9912.  
  9913.  pParmBlock  to the parameter block for SaveEnvironment, defined as the
  9914.  following structure:
  9915.  
  9916.  typedef struct {
  9917.      USHORT usLength;           /* ParmBlock = 6 bytes                */
  9918.      USHORT fsFlags;            /* bit 0 must be zero (reserved)      */
  9919.                                 /* bit 1=0--do not save adapter state */
  9920.                                 /* bit 1=1--save adapter state        */
  9921.                                 /* bit 2=0--do not save full physical */
  9922.                                 /*          display                   */
  9923.                                 /* bit 2=1--save full phys. display   */
  9924.                                 /* bit 3=0--do not save partial       */
  9925.                                 /*          physical display          */
  9926.                                 /* bit 3=1--save partial physical     */
  9927.                                 /*          display (popup window)    */
  9928.                                 /* bits 4-15 must be zero (reserved)  */
  9929.      USHORT selLVBSel;          /* huge (max 1MB) LVB selector        */
  9930.  } VDH_ENVRN;
  9931.  
  9932.  
  9933.  ulFunction  SaveEnvironment in the call vector table; its value is 258L
  9934.  (0x0102).
  9935.  
  9936.  
  9937.  Return Value
  9938.  
  9939.  If it is successful, SaveEnvironment should return zero (to the ax register
  9940.  when coded in assembly language). Otherwise, it should return one of the
  9941.  following errors when it encounters any one of the following conditions:
  9942.  
  9943.  Return                            Conditions
  9944.  ────────────────────────────────────────────────────────────────────────────
  9945.  
  9946.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  9947.                                    except 258L (0x0102); if the ParmBlock
  9948.                                    fsFlags field has both bits 2 and 3 set,
  9949.                                    or if it has any of bits 4 to 15 or 0
  9950.                                    set; or if the pEnvironment value is
  9951.                                    zero.
  9952.  
  9953.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not 6.
  9954.  
  9955.  ERROR_VIO_MODE                    If SaveEnvironment fails to save the
  9956.                                    adapter state and/or display buffer in
  9957.                                    the environment buffer.
  9958.  
  9959.  
  9960.  
  9961.  Comments
  9962.  
  9963.  Bits 2 and 3 of the fsFlags field are mutually exclusive. Otherwise, this
  9964.  field may be a combination (OR) of the following values:
  9965.  
  9966.  Value                             Meaning
  9967.  ────────────────────────────────────────────────────────────────────────────
  9968.  
  9969.  0x0002                            Save the adapter state, including
  9970.                                    everything except the PVB. Otherwise,
  9971.                                    save only one of the full or partial
  9972.                                    display.
  9973.  
  9974.  0x0004                            Save the full display for a session
  9975.                                    switch, provided that bit 3 is clear.
  9976.  
  9977.  0x0008                            Save the partial display (area
  9978.                                    overwritten) for a popup window,
  9979.                                    provided that bit 2 is clear.
  9980.  
  9981.  MS OS/2 allocates the LVB and (environment buffer) by calling the
  9982.  DosAllocHuge function. The BVH must define the number of huge selectors it
  9983.  requires for a full-display save and for a partial-display save when it
  9984.  initializes at system boot. The ParmBlock selLVBSel field accesses the first
  9985.  of the segments in which SaveEnvironment shadows or stores the display. To
  9986.  calculate the selector value for each segment following selLVBSel, use the
  9987.  value returned by the DosGetHugeShift function.
  9988.  
  9989.  A BVH must save whatever portion of the display could be overlaid by a popup
  9990.  window. When a hard-error popup occurs before a VIO popup has been cleared,
  9991.  BVS calls SaveEnvironment twice before calling the RestoreEnvironment
  9992.  function. For this reason, the SaveEnvironment function must be prepared to
  9993.  handle both a partial save of a graphics-mode popup and a full save of a
  9994.  text-mode user popup. A BVH may set its partial-save size to zero only if
  9995.  its display cannot be overlaid by a popup window.
  9996.  
  9997.  If the BVH initialized the environment for a session that has a DOS
  9998.  real-mode session (3xBox) present on the display, SaveEnviroment must also
  9999.  do one of the following when bit 1 of the fsFlags field is set:
  10000.  
  10001.    ■   Read in the adapter's state, update the environment buffer, and update
  10002.        the video BIOS data area (based at 0x0040:0000) for the DOS session.
  10003.  
  10004.    ■   If the adapter is write-only, copy the DOS session's information from
  10005.        the video BIOS data area to the environment buffer.
  10006.  
  10007.  
  10008.  Note that SaveEnvironment must obtain selector:offset access to the video
  10009.  BIOS data area in order to do this. BVHs run only in protected mode.
  10010.  
  10011.  
  10012.  
  10013.  
  10014.  See Also
  10015.  
  10016.  DosAllocHuge, DosGetHugeShift, InitializeEnvironment, RestoreEnvironment
  10017.  
  10018.  
  10019.  █    SetColorLookup
  10020.  ────────────────────────────────────────────────────────────────────────────
  10021.  
  10022.  USHORT SetColorLookup  (pEnvironment, pParmBlock, ulFunction)
  10023.  
  10024.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  10025.  
  10026.  VDH_CLUT far * pParmBlock;        /*pointer to parameter block */
  10027.  
  10028.  ULONG  ulFunction;                /*function index */
  10029.  
  10030.  
  10031.  The SetColorLookup function sets a specified number of colors from the color
  10032.  lookup table for VGA-type or VGA-compatible adapters.
  10033.  
  10034.  
  10035.  Parameters
  10036.  
  10037.  pEnvironment  to the environment buffer.
  10038.  
  10039.  pParmBlock  to the parameter block for SetColorLookup, defined as the
  10040.  following structure:
  10041.  
  10042.  typedef struct {
  10043.      USHORT usLength;            /* ParmBlock = 12 bytes              */
  10044.      USHORT fsFlags;             /* 0x0000=set environment buffer only*/
  10045.                                  /* 0x0001=set adapter and environ buf*/
  10046.      CLUTDATA far *pLookupTable  /* pointer to device-dependent CLUT  */
  10047.      USHORT iFirstEntry;         /* index to first entry to set       */
  10048.      USHORT usNumEntries;        /* how many entries to set           */
  10049.  } VDH_CLUT;
  10050.  
  10051.  
  10052.  ulFunction  SetColorLookup in the call vector table; its value is 263L
  10053.  (0x0107).
  10054.  
  10055.  
  10056.  Return Value
  10057.  
  10058.  If it is successful, SetColorLookup should return zero (to the ax register
  10059.  when coded in assembly language). Otherwise, it should return one of the
  10060.  following errors when it encounters any one of the following conditions:
  10061.  
  10062.  Return                            Conditions
  10063.  ────────────────────────────────────────────────────────────────────────────
  10064.  
  10065.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  10066.                                    except 263L (0x0107); if the ParmBlock
  10067.                                    fsFlags value is greater than 1; if the
  10068.                                    ParmBlock iFirstEntry value is outside
  10069.                                    the range of entries in the color lookup
  10070.                                    table; if the ParmBlock usNumEntries
  10071.                                    value is less than 1; or if the
  10072.                                    pEnvironment value is zero.
  10073.  
  10074.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not
  10075.                                    12; or if the ParmBlock usNumEntries
  10076.                                    value is too large, either greater than
  10077.                                    the number of entries in the color
  10078.                                    lookup table or greater than the total
  10079.                                    entries following iFirstEntry.
  10080.  
  10081.  
  10082.  
  10083.  Comments
  10084.  
  10085.  Only BVHs that support VGA-type adapters need supply a SetColorLookup
  10086.  function.
  10087.  
  10088.  An odd value for the fsFlags field implies that the calling application is
  10089.  running in the foreground. If all ParmBlock fields are valid, SetColorLookup
  10090.  should do the following:
  10091.  
  10092.    ■   Load the specified range of entries from the color lookup table into
  10093.        the adapter's color registers.
  10094.  
  10095.    ■   Update the environment buffer's color lookup table with these settings
  10096.        also.
  10097.  
  10098.  
  10099.  If the fsFlags value is zero, SetColorLookup sets values only in the
  10100.  environment buffer.
  10101.  
  10102.  The format of the color lookup table is device-dependent. For example, the
  10103.  following structure defines the format of each entry in the color lookup
  10104.  table for a VGA adapter:
  10105.  
  10106.  typedef struct {
  10107.      UCHAR uchRed;     /* color index */
  10108.      UCHAR uchGreen;
  10109.      UCHAR uchBlue;
  10110.  }  CLUTDATA_VGA;
  10111.  
  10112.  
  10113.  The VGA format has three bytes containing, respectively, the red, green, and
  10114.  blue indices for each color being set.
  10115.  
  10116.  
  10117.  
  10118.  
  10119.  See Also
  10120.  
  10121.  GetColorLookup
  10122.  
  10123.  
  10124.  █    SetCursorInfo
  10125.  ────────────────────────────────────────────────────────────────────────────
  10126.  
  10127.  USHORT SetCursorInfo  (pEnvironment, pParmBlock, ulFunction)
  10128.  
  10129.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  10130.  
  10131.  VDH_CURSOR far * pParmBlock;      /*pointer to parameter block */
  10132.  
  10133.  ULONG  ulFunction;                /*function index */
  10134.  
  10135.  
  10136.  The SetCursorInfo function sets selected information about the cursor's
  10137.  position, its type, or both.
  10138.  
  10139.  
  10140.  Parameters
  10141.  
  10142.  pEnvironment  to the environment buffer.
  10143.  
  10144.  pParmBlock  to the parameter block for SetCursorInfo, defined as the
  10145.  following structure:
  10146.  
  10147.  typedef struct {
  10148.      USHORT usLength;              /* ParmBlock = 16 bytes            */
  10149.      USHORT fsFlags;               /* bit 0=0--set environ buf only   */
  10150.                                    /* bit 0=1--set HW state also      */
  10151.                                    /* bit 1=1--set cursor position    */
  10152.                                    /* bit 2=1--set cursor type        */
  10153.                                    /* bits 3-15 must be zero          */
  10154.      USHORT usRow;                 /* 0=top row                       */
  10155.      USHORT usColumn;              /* 0=leftmost column               */
  10156.      USHORT usTopScanLine;         /* 0=top scan line of n scan       */
  10157.      USHORT usBottomScanLine;      /* lines,(n-1)=bottom scan line    */
  10158.      USHORT usWidth;               /* in columns for text mode        */
  10159.      USHORT usAttribute;           /* -1=hidden for text mode         */
  10160.  } VDH_CURSOR;
  10161.  
  10162.  
  10163.  ulFunction  SetCursorInfo in the call vector table; its value is 265L
  10164.  (0x0109).
  10165.  
  10166.  
  10167.  Return Value
  10168.  
  10169.  If it is successful, SetCursorInfo should return zero (to the ax register
  10170.  when coded in assembly language). Otherwise, it should return one of the
  10171.  following errors when it encounters any one of the following conditions:
  10172.  
  10173.  Return                            Conditions
  10174.  ────────────────────────────────────────────────────────────────────────────
  10175.  
  10176.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  10177.                                    except 265L (0x0109); if the ParmBlock
  10178.                                    fsFlags value is greater than 7; if the
  10179.                                    ParmBlock usTopScanLine or
  10180.                                    usBottomScanLine values are out of
  10181.                                    range; or if the pEnvironment value is
  10182.                                    zero.
  10183.  
  10184.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not
  10185.                                    16.
  10186.  
  10187.  ERROR_VIO_MODE                    If a check of the fbType value in the
  10188.                                    environment buffer's VDHMODEINFO data
  10189.                                    indicates graphics mode.
  10190.  
  10191.  ERROR_VIO_ROW                     If the value of ParmBlock usRow is out
  10192.                                    of range for the current mode.
  10193.  
  10194.  ERROR_VIO_COLUMN                  If the value of ParmBlock usColumn is
  10195.                                    out of range for the current mode.
  10196.  
  10197.  ERROR_VIO_WIDTH                   If the value of ParmBlock usWidth is
  10198.                                    greater than 1.
  10199.  
  10200.  
  10201.  
  10202.  Comments
  10203.  
  10204.  The ParmBlock usRow and usColumn fields contain the cursor-position
  10205.  information.
  10206.  
  10207.  The fsFlags field may be a combination (OR) of the following values:
  10208.  
  10209.  Value                             Meaning
  10210.  ────────────────────────────────────────────────────────────────────────────
  10211.  
  10212.  0x0001                            Set values in the adapter and in the
  10213.                                    enviroment buffer. Otherwise, set values
  10214.                                    in the environment buffer only.
  10215.  
  10216.  0x0002                            Set the cursor position values.
  10217.  
  10218.  0x0004                            Set the cursor type values.
  10219.  
  10220.  If the value of fsFlags is one or zero, SetCursorInfo should return success
  10221.  without updating the adapter or environment buffer. Note that an odd value
  10222.  for fsFlags implies that the calling application is running in the
  10223.  foreground and that the hardware state and environment buffer should be
  10224.  updated with new cursor settings.
  10225.  
  10226.  Before writing the input usRow and usColumn values, SetCursorInfo should
  10227.  check ranges as follows:
  10228.  
  10229.    ■   If the fsFlags value is odd, use the adapter's settings to determine
  10230.        whether the row and column values are in range.
  10231.  
  10232.    ■   If the fsFlags value is even, use the environment buffer's settings to
  10233.        determine whether the row and column values are in range.
  10234.  
  10235.  
  10236.  The ParmBlock usWidth value must be 1 in text mode.
  10237.  
  10238.  
  10239.  
  10240.  
  10241.  See Also
  10242.  
  10243.  GetCursorInfo, SetModeInfo, VioSetCurPos, VioSetCurType
  10244.  
  10245.  
  10246.  █    SetFont
  10247.  ────────────────────────────────────────────────────────────────────────────
  10248.  
  10249.  USHORT SetFont  (pEnvironment, pParmBlock, ulFunction)
  10250.  
  10251.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  10252.  
  10253.  VDH_FONT far * pParmBlock;        /*pointer to parameter block */
  10254.  
  10255.  ULONG  ulFunction;                /*function index */
  10256.  
  10257.  
  10258.  The SetFont function sets up a new user-font definition. Then, SetFont
  10259.  either resets the current font in the environment buffer, or it loads a
  10260.  user-defined, code-page, or ROM font that is compatible with the current
  10261.  mode into the adapter and updates the environment buffer.
  10262.  
  10263.  
  10264.  Parameters
  10265.  
  10266.  pEnvironment  to the environment buffer.
  10267.  
  10268.  pParmBlock  to the parameter block for SetFont, defined as the following
  10269.  structure:
  10270.  
  10271.  typedef struct {
  10272.      USHORT usLength;            /* ParmBlock = 14 bytes              */
  10273.      USHORT fsFlags;             /* 0x0000=update environment buf only*/
  10274.                                  /* 0x0001=update adapter state also  */
  10275.                                  /* bits 1-15 must be 0 (reserved)    */
  10276.      UCHAR far *pFontBuf;        /* pointer to font buffer data       */
  10277.      USHORT cbFontLen;           /* length of font buffer             */
  10278.      USHORT usPelColumns;        /* pels per character cell in width  */
  10279.      USHORT usPelRows;           /* pels per character cell in height */
  10280.  } VDH_FONT;
  10281.  
  10282.  
  10283.  ulFunction  SetFont in the call vector table; its value is 267L (0x010B).
  10284.  
  10285.  
  10286.  Return Value
  10287.  
  10288.  If it is successful, SetFont should return zero (to the ax register when
  10289.  coded in assembly language). Otherwise, it should return one of the
  10290.  following errors when it encounters any one of the following conditions:
  10291.  
  10292.  Return                            Conditions
  10293.  ────────────────────────────────────────────────────────────────────────────
  10294.  
  10295.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  10296.                                    except 267L (0x010B); if the ParmBlock
  10297.                                    fsFlags value is greater than 1; or if
  10298.                                    the pEnvironment value is zero.
  10299.  
  10300.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not
  10301.                                    14; or if the ParmBlock cbFontLen value
  10302.                                    is too small to define a user font,
  10303.                                    given the value of usPelRows.
  10304.  
  10305.  ERROR_VIO_MODE                    If a check of the fbType value in the
  10306.                                    environment buffer's VDHMODEINFO data
  10307.                                    indicates graphics mode.
  10308.  
  10309.  ERROR_VIO_USER_FONT               If the specified user font is not
  10310.                                    compatible with the current mode.
  10311.  
  10312.  ERROR_NOT_ENOUGH_MEMORY           If the environment buffer is too small
  10313.                                    to contain another new user-font
  10314.                                    definition.
  10315.  
  10316.  
  10317.  
  10318.  Comments
  10319.  
  10320.  The type of adapter determines the format of the font definition. The BVH
  10321.  determines how many user-defined fonts it supports when it allocates the
  10322.  environment buffer. The SetFont function adds entries to the user-font
  10323.  table, which must be located at the end of the environment buffer.
  10324.  
  10325.  If the user-font table contains a font with the same dimensions as the
  10326.  ParmBlock usPelColumns and usPelRows values, SetFont replaces the existing
  10327.  entry. Otherwise, SetFont adds the new font to the user-font table. When a
  10328.  new font is inappropriate for the current mode, SetFont should save the font
  10329.  definition for possible use when a subsequent SetMode call occurs. However,
  10330.  SetFont should return an error when the font definition is incompatible with
  10331.  the current mode and reset the current font to the nearest match it can find
  10332.  for the specified font.
  10333.  
  10334.  An odd value for the fsFlags field implies that the calling application is
  10335.  running in the foreground. If all other ParmBlock fields are valid, the
  10336.  SetFont function should do the following:
  10337.  
  10338.    ■   Load the new user font into the adapter if it is appropriate for the
  10339.        current mode.
  10340.  
  10341.    ■   Otherwise, search the user-font table for an appropriate font and load
  10342.        it into the adapter if one is found. If not, load an appropriate
  10343.        code-page font if one can be found. If not, load an appropriate ROM
  10344.        font.
  10345.  
  10346.  
  10347.  Whatever the value of the fsFlags field, SetFont must update the environment
  10348.  buffer.
  10349.  
  10350.  
  10351.  
  10352.  
  10353.  See Also
  10354.  
  10355.  GetFont, InitializeEnvironment, SetMode, VioSetFont
  10356.  
  10357.  
  10358.  █    SetMode
  10359.  ────────────────────────────────────────────────────────────────────────────
  10360.  
  10361.  USHORT SetMode  (pEnvironment, pParmBlock, ulFunction)
  10362.  
  10363.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  10364.  
  10365.  VDH_MODE far * pParmBlock;        /*pointer to parameter block */
  10366.  
  10367.  ULONG  ulFunction;                /*function index */
  10368.  
  10369.  
  10370.  The SetMode function either sets up a video mode in the environment buffer
  10371.  or loads a video mode into the adapter and updates the environment buffer.
  10372.  
  10373.  
  10374.  Parameters
  10375.  
  10376.  pEnvironment  to the environment buffer.
  10377.  
  10378.  pParmBlock  to the parameter block for SetMode, defined as the following
  10379.  structure:
  10380.  
  10381.  typedef struct {
  10382.      USHORT usLength;           /* ParmBlock = 8 bytes               */
  10383.      USHORT fsFlags;            /* bit 0=0--update environment buf   */
  10384.                                 /* bit 0=1--load the adapter also    */
  10385.                                 /* bits 1-15 must be zero (reserved) */
  10386.      PVIOMODEINFO;              /* pointer to VDHMODEINFO data       */
  10387.  } VDH_MODE;
  10388.  
  10389.  
  10390.  ulFunction  SetMode in the call vector table; its value is 269L (0x010D).
  10391.  
  10392.  
  10393.  Return Value
  10394.  
  10395.  If it is successful, SetMode should return zero (to the ax register when
  10396.  coded in assembly language). Otherwise, it should return one of the
  10397.  following errors when it encounters any one of the following conditions:
  10398.  
  10399.  Return                            Conditions
  10400.  ────────────────────────────────────────────────────────────────────────────
  10401.  
  10402.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  10403.                                    except 269L (0x010D); if the ParmBlock
  10404.                                    fsFlags value is greater than 1; or if
  10405.                                    the pEnvironment value is zero.
  10406.  
  10407.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not
  10408.                                    8; or if the calling application's mode
  10409.                                    data (pointed to by ParmBlock
  10410.                                    PVIOMODEINFO) has a cb length value that
  10411.                                    is less than 3, does not fall on a field
  10412.                                    boundary of the VIOMODEINFO structure,
  10413.                                    or is greater than 34.
  10414.  
  10415.  ERROR_VIO_MODE                    If SetMode cannot find a match for the
  10416.                                    requested mode among the modes it
  10417.                                    supports.
  10418.  
  10419.  
  10420.  
  10421.  Comments
  10422.  
  10423.  For a BVH, the video mode includes not only the text-display characteristics
  10424.  that it can support but also the ROM, code-page, and user-defined fonts that
  10425.  it has available.
  10426.  
  10427.  SetMode must validate the mode data without using the environment buffer,
  10428.  because the buffer might not have been initialized or might not be valid for
  10429.  the adapter. This function implicitly initializes the environment buffer, if
  10430.  it is not already initialized; it initializes the buffer to its default mode
  10431.  if the requested mode is not valid for the adapter.
  10432.  
  10433.  The ParmBlock PVIOMODEINFO field points to the calling application's mode
  10434.  data. The mode data must specify values for at least the first two fields
  10435.  and may specify values for up to the first nine fields of the following
  10436.  structure:
  10437.  
  10438.  struct _VDHMODEINFO {
  10439.      USHORT cb;              /* length, in bytes, of mode data        */
  10440.      UCHAR  fbType;          /* bit 0=0--Mono-compatible              */
  10441.                              /* bit 0=1--Other (not mono)             */
  10442.                              /* bit 1=0--Text mode                    */
  10443.                              /* bit 1=1--Graphics mode                */
  10444.                              /* bit 2=0--Color burst enabled          */
  10445.                              /* bit 2=1--Color burst disabled         */
  10446.                              /* bit 3=0--Adapter native mode disabled */
  10447.                              /*          or none available            */
  10448.                              /* bit 3=1--Adapter native (advanced     */
  10449.                              /*          function) mode enabled       */
  10450.                              /* bits 4-7 must be zero (reserved)      */
  10451.      UCHAR  color;           /* number of colors (power of 2)         */
  10452.      USHORT usCol;           /* number of text columns                */
  10453.      USHORT usRow;           /* number of text rows                   */
  10454.      USHORT usHRes;          /* pel columns (horizontal resolution)   */
  10455.      USHORT usVRes;          /* pel rows (vertical resolution)        */
  10456.      UCHAR  uchFormatID;     /* 0x00=default (US, single-byte chars)  */
  10457.                              /* 0x70=world (international, DBCS)      */
  10458.      UCHAR  uchAttrCount;    /* 0x01=default, 0x03=world              */
  10459.      UCHAR  far *pBuffAddr;  /* (returned) 32-bit address of PVB      */
  10460.      ULONG  ulBufferLen;     /* (returned) length, in bytes, of PVB   */
  10461.      ULONG  ulFullBufSize;   /* (returned) bytes needed for saving    */
  10462.                              /*   full video display                  */
  10463.      ULONG  ulPartialBufSize;/* (returned) bytes needed for saving    */
  10464.                              /*   parital display if popup occurs     */
  10465.      UCHAR  far *pExtDataArea;/* pointer to adapter's native mode     */
  10466.                              /*   data, if any; otherwise, zero       */
  10467.  };
  10468.  
  10469.  
  10470.  Note that the VDH_ENVIRONMENT structure includes the field ModeData, whose
  10471.  structure (VIOMODEINFO) is equivalent to _VDHMODEINFO.
  10472.  
  10473.  The input ParmBlock PVIOMODEINFO field must access a buffer that contains at
  10474.  least an fbType value, so the input cb length must be at least 3 when
  10475.  SetMode is called. If the cb length value does not fall on a _VDHMODEINFO
  10476.  field boundary, SetMode returns an error. (The function need not attempt to
  10477.  set a mode from incomplete mode information for any field.) SetMode also
  10478.  returns an error if the cb length value is greater than the length of the
  10479.  _VDHMODEINFO structure.
  10480.  
  10481.  The value of the ParmBlock uchAttrCount field must be appropriate to the
  10482.  value of uchFormatID. The uchAttrCount value must be 0x01 when uchFormatID
  10483.  is 0x00 (default); 0x03 when uchFormatID is 0x70 (world-wide); or an
  10484.  appropriate value when uchFormatID is 0x80 (identical to adapter format).
  10485.  Note that the uchFormatID value determines the value of the environment
  10486.  buffer's cbAttrBufSize, with one attribute byte per character byte for the
  10487.  default format and three attribute bytes per character byte for the world
  10488.  format.
  10489.  
  10490.  An odd value for the fsFlags field implies that the calling application is
  10491.  running in the foreground. In this case, SetMode must do the following:
  10492.  
  10493.    ■   Load a matching mode into the adapter if the PVIOMODEINFO field
  10494.        accesses mode data values that are valid and a match can be found
  10495.        among the supported modes.
  10496.  
  10497.    ■   Update the environment buffer with the new mode.
  10498.  
  10499.  
  10500.  
  10501.  
  10502.  
  10503.  
  10504.  
  10505.  See Also
  10506.  
  10507.  GetMode, InitializeEnvironment, SetFont, SetVariableInfo, VioSetMode
  10508.  
  10509.  
  10510.  █    SetPaletteRegisters
  10511.  ────────────────────────────────────────────────────────────────────────────
  10512.  
  10513.  USHORT SetPaletteRegisters  (pEnvironment, pParmBlock, ulFunction)
  10514.  
  10515.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  10516.  
  10517.  VDH_PALETTE far * pParmBlock;     /*pointer to parameter block */
  10518.  
  10519.  ULONG  ulFunction;                /*function index */
  10520.  
  10521.  
  10522.  The SetPaletteRegisters function sets a specified number of entries from the
  10523.  palette buffer into the environment buffer or into the adapter's palette
  10524.  registers and the environment buffer. Palette buffer entries define the
  10525.  relationship between text attributes and the color registers.
  10526.  
  10527.  
  10528.  Parameters
  10529.  
  10530.  pEnvironment  to the environment buffer.
  10531.  
  10532.  pParmBlock  to the parameter block for SetPaletteRegisters, defined as the
  10533.  following structure:
  10534.  
  10535.  typedef struct {
  10536.      USHORT usLength;           /* ParmBlock = 12 bytes              */
  10537.      USHORT fsFlags;            /* 0x0000=set environment buffer only*/
  10538.                                 /* 0x0001=set adapter's palette regs */
  10539.                                 /*         and update enviroment buf */
  10540.      USHORT far *pPalDataBuf;   /* pointer to palette buf (array)    */
  10541.      USHORT iFirstEntry;        /* index of first register to set    */
  10542.      USHORT usNumEntries;       /* number of entries to set          */
  10543.  } VDH_PALETTE;
  10544.  
  10545.  
  10546.  ulFunction  SetPaletteRegisters in the call vector table; its value is 271L
  10547.  (0x010F).
  10548.  
  10549.  
  10550.  Return Value
  10551.  
  10552.  If it is successful, SetPaletteRegisters should return zero (to the ax
  10553.  register when coded in assembly language). Otherwise, it should return one
  10554.  of the following errors when it encounters any one of the following
  10555.  conditions:
  10556.  
  10557.  Return                            Conditions
  10558.  ────────────────────────────────────────────────────────────────────────────
  10559.  
  10560.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  10561.                                    except 271L (0x010F); if the ParmBlock
  10562.                                    fsFlags value is greater than 1; if the
  10563.                                    ParmBlock iFirstEntry value is outside
  10564.                                    the range of index values for the
  10565.                                    palette registers; if the ParmBlock
  10566.                                    usNumEntries is less than 1; or if the
  10567.                                    pEnvironment value is zero.
  10568.  
  10569.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not
  10570.                                    12; or if the ParmBlock usNumEntries
  10571.                                    value is too large, either greater than
  10572.                                    the number of entries in the palette
  10573.                                    buffer array or greater than the total
  10574.                                    entries following iFirstEntry.
  10575.  
  10576.  
  10577.  
  10578.  
  10579.  Comments
  10580.  
  10581.  An odd value for the fsFlags field implies that the calling application is
  10582.  running in the foreground. If all ParmBlock fields are valid,
  10583.  SetPaletteRegisters should do the following:
  10584.  
  10585.    ■   Load the specified range of entries from the palette buffer into the
  10586.        adapter's palette registers.
  10587.  
  10588.    ■   Update the environment buffer with these settings also.
  10589.  
  10590.  
  10591.  If the fsFlags value is zero, SetPaletteRegisters sets values only in the
  10592.  environment buffer.
  10593.  
  10594.  The ParmBlock pPalDataBuf field points to a buffer containing a USHORT color
  10595.  value for each register being set.
  10596.  
  10597.  The SetPaletteRegisters function should not change the video-enable state of
  10598.  the adapter.
  10599.  
  10600.  
  10601.  
  10602.  
  10603.  See Also
  10604.  
  10605.  GetPaletteRegisters, VioSetState
  10606.  
  10607.  
  10608.  █    SetVariableInfo
  10609.  ────────────────────────────────────────────────────────────────────────────
  10610.  
  10611.  USHORT SetVariableInfo  (pEnvironment, pParmBlock, ulFunction)
  10612.  
  10613.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  10614.  
  10615.  VDH_VARIABLE far * pParmBlock;    /*pointer to parameter buffer */
  10616.  
  10617.  ULONG  ulFunction;                /*function index */
  10618.  
  10619.  
  10620.  The SetVariableInfo function sets selected features of the video adapter,
  10621.  including one or more of the blink state, border color, underscore line,
  10622.  video enable, plane enable, code page, scrollable rectangle, and the number
  10623.  of text rows and columns of the display.
  10624.  
  10625.  
  10626.  Parameters
  10627.  
  10628.  pEnvironment  to the environment buffer.
  10629.  
  10630.  pParmBlock  to the parameter block for SetVariableInfo, defined by the
  10631.  following structure:
  10632.  
  10633.  typedef struct {
  10634.      USHORT usLength;        /* ParmBlock = 6-30 bytes                   */
  10635.      USHORT fsFlags;         /* bit 0=0--set environ buf only            */
  10636.                              /* bit 0=1--set adapter state also          */
  10637.                              /* bit 1=1--set blink or                    */
  10638.                              /* bit 1=0--set background intensity        */
  10639.                              /* bit 2=1--set overscan (border) color     */
  10640.  
  10641.                              /* bit 3=1--set underscore scan line        */
  10642.                              /* bit 4=1--set video enabled               */
  10643.                              /* bit 5=1--set display mask (plane enable) */
  10644.                              /* bit 6=1--set code-pageID without change  */
  10645.                              /*        from SBCS to DBCS or vice versa   */
  10646.                              /* bit 7=1--set code-pageID, change from    */
  10647.                              /*   SBCS to DBCS or vice versa if bit 6=1  */
  10648.                              /* bit 8=1--set scrollable rectangle        */
  10649.                              /* bit 9=1--set screen dimensions           */
  10650.                              /* bits 10-15 must be zero (reserved)       */
  10651.      USHORT fsBlink;         /* 0x0000=blink highlights selected cell    */
  10652.                              /* 0x0001=background intensity highlights   */
  10653.      USHORT usOverscan;      /* border color                             */
  10654.      USHORT usUnderscore;    /* n=scan line for underscore (n=0-31),     */
  10655.                              /* 32=no underscore                         */
  10656.      USHORT fsVideoEnable;   /* 0x0000=disabled,0x0001=enabled           */
  10657.      ULONG  flDisplayMask;   /* bit n=1 implies plane n to be enabled    */
  10658.                              /* (n=0-31); otherwise, plane n disabled    */
  10659.      USHORT usCodePageID;    /* valid ROM-font or user-font ID           */
  10660.      USHORT usScrlLeft;      /* 0=leftmost column of current mode's      */
  10661.                              /*   scrollable rectangle                   */
  10662.      USHORT usSrclTop;       /* 0=top row                                */
  10663.      USHORT usScrlRight;     /* right column                             */
  10664.      USHORT usSrclBottom;    /* bottom row                               */
  10665.      USHORT usScreenRows;    /* number of rows in current mode           */
  10666.      USHORT usScreenColumns; /* number of columns in current mode        */
  10667.  } VDH_VARIABLE;
  10668.  
  10669.  
  10670.  ulFunction  SetVariableInfo in the call vector table; its value is 275L
  10671.  (0x0113).
  10672.  
  10673.  
  10674.  Return Value
  10675.  
  10676.  If it is successful, SetVariableInfo should return zero (to the ax register
  10677.  when coded in assembly language). Otherwise, it should return one of the
  10678.  following errors when it encounters any one of the following conditions:
  10679.  
  10680.  Return                            Conditions
  10681.  ────────────────────────────────────────────────────────────────────────────
  10682.  
  10683.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  10684.                                    except 275L (0x0113); if the ParmBlock
  10685.                                    fsFlags field has any of bits 10 through
  10686.                                    15 set; if bit 5 of fsFlags is set and
  10687.                                    the BVH does not support an
  10688.                                    8514-compatible adapter; or if the
  10689.                                    pEnvironment value is zero.
  10690.  
  10691.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not
  10692.                                    at least 6 or is greater than 30; if any
  10693.                                    valid bit of fsFlags is set and the
  10694.                                    usLength value is too small to include
  10695.                                    the corresponding field; or if any valid
  10696.                                    bit of fsFlags is set and the
  10697.                                    corresponding field in ParmBlock has a
  10698.                                    value that out of range.
  10699.  
  10700.  ERROR_VIO_MODE                    If a check of the fbType value in the
  10701.                                    environment buffer's VDHMODEINFO data
  10702.                                    indicates graphics mode.
  10703.  
  10704.  ERROR_VIO_BAD_CP                  If bit 6 of fsFlags is set, bit 7 is
  10705.                                    clear, and the BVH must call SetMode to
  10706.                                    change the code page.
  10707.  
  10708.  
  10709.  
  10710.  Comments
  10711.  
  10712.  The ParmBlock fsFlags value indicates what SetVariableInfo should set. An
  10713.  odd value implies that the calling application is running in the foreground
  10714.  and that SetVariableInfo should update the hardware state, as well as the
  10715.  environment buffer. The fsFlags field may be a combination (OR) of the
  10716.  following values:
  10717.  
  10718.  Value                             Meaning
  10719.  ────────────────────────────────────────────────────────────────────────────
  10720.  
  10721.  0x0001                            Set values in the hardware state and in
  10722.                                    the environment buffer. Otherwise, set
  10723.                                    values in the environment buffer only.
  10724.  
  10725.  0x0002                            Set blink; otherwise, set background
  10726.                                    intensity.
  10727.  
  10728.  0x0004                            Set overscan (border) color.
  10729.  
  10730.  0x0008                            Set underscore scan line.
  10731.  
  10732.  0x0010                            Set video enable.
  10733.  
  10734.  0x0020                            Set display mask, where bits 0 to 31, if
  10735.                                    set, enable the corresponding plane.
  10736.  
  10737.  0x0040                            Set the code page, if possible, without
  10738.                                    changing the display mode, provided that
  10739.                                    bit 7 is clear. (Setting a DBCS code
  10740.                                    page from an SBCS mode forces a mode
  10741.                                    change, and vice versa.)
  10742.  
  10743.  0x0080                            Set the code page and force a mode
  10744.                                    change, if necessary, in order to set a
  10745.                                    DBCS or SBCS code page, provided that
  10746.                                    bit 6 is set.
  10747.  
  10748.  0x0100                            Set the scrollable rectangle values,
  10749.                                    where zero represents the leftmost
  10750.                                    column and top row for the current
  10751.                                    display mode.
  10752.  
  10753.  0x0200                            Set the usScreenRows and usScreenColumns
  10754.                                    fields (screen dimensions) to the
  10755.                                    current mode's values.
  10756.  
  10757.  After SetVariableInfo disables video signals, the signal must remain
  10758.  disabled until SetVariableInfo is called again to enable it. In other words,
  10759.  the SetMode function should not re-enable video signals when SetVariableInfo
  10760.  has disabled them.
  10761.  
  10762.  If bit 5 of fsFlags is set, the SetVariableInfo function should write the
  10763.  flDisplayMask value to an 8514-compatible adapter. Otherwise, it should
  10764.  return an error.
  10765.  
  10766.  A BVH that supports a US-standard type of adapter may ignore bit 7 of the
  10767.  ParmBlock fsFlags field; bit 7 has meaning only if the BVH handles DBCS
  10768.  (double-byte character set) text displays.
  10769.  
  10770.  If bit 6 of fsFlags is set and bit 7 is clear, SetVariableInfo should set
  10771.  the code page only if the international-type adapter can use the new code
  10772.  page without changing from a DBCS to an SBCS (single-byte character set)
  10773.  mode or vice versa. It should return an error if a mode switch would be
  10774.  required to change the code page.
  10775.  
  10776.  If both bits 6 and 7 of fsFlags are set, SetVariableInfo may call the
  10777.  SetMode or InitializeEnvironment function to force a mode switch when
  10778.  setting a DBCS code page from a SBCS mode, or vice versa. It should ignore
  10779.  bit 7 when bit 6 is clear.
  10780.  
  10781.  The scrollable rectangle fields indicate the area of the screen that may
  10782.  scroll during scroll and write TTY operations. A BVH need not support any
  10783.  scrollable region other than the entire display area, but it may constrain
  10784.  the scrolling region by setting the scrollable rectangle fields. All
  10785.  coordinates are in text display cells, where (0,0) represents the leftmost
  10786.  column and top row of the current mode.
  10787.  
  10788.  
  10789.  
  10790.  
  10791.  See Also
  10792.  
  10793.  GetVariableInfo, InitializeEnvironment, SetMode, TextBufferUpdate (Scrolls),
  10794.  WriteTTY
  10795.  
  10796.  
  10797.  █    TerminateEnvironment
  10798.  ────────────────────────────────────────────────────────────────────────────
  10799.  
  10800.  USHORT TerminateEnvironment  (pEnvironment, pParmBlock, ulFunction)
  10801.  
  10802.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  10803.  
  10804.  VDH_ENVRN far * pParmBlock;       /*pointer to parameter block */
  10805.  
  10806.  ULONG  ulFunction;                /*function index */
  10807.  
  10808.  
  10809.  The TerminateEnvironment function tells a VDH that the environment is about
  10810.  to be freed, allowing the VDH to perform any necessary cleanup.
  10811.  
  10812.  
  10813.  Parameters
  10814.  
  10815.  pEnvironment  to the environment buffer.
  10816.  
  10817.  pParmBlock  to the parameter block for TerminateEnvironment, defined as the
  10818.  following structure:
  10819.  
  10820.  typedef struct {
  10821.      USHORT usLength;           /* ParmBlock = 6 bytes               */
  10822.      USHORT fsFlags;            /* must be zero (reserved)           */
  10823.      USHORT selLVBSel;          /* huge (max 1MB) LVB selector       */
  10824.  } VDH_ENVRN;
  10825.  
  10826.  
  10827.  ulFunction  TerminateEnvironment in the call vector table; its value is 276L
  10828.  (0x0114).
  10829.  
  10830.  
  10831.  Return Value
  10832.  
  10833.  If it is successful, TerminateEnvironment should return zero (to the ax
  10834.  register when coded in assembly language). Otherwise, it should return one
  10835.  of the following errors when it encounters any one of the following
  10836.  conditions:
  10837.  
  10838.  Return                            Conditions
  10839.  ────────────────────────────────────────────────────────────────────────────
  10840.  
  10841.  ERROR_VIO_INVALID_PARMS           If the VDH provides a
  10842.                                    TerminateEnvironment function and if the
  10843.                                    ulFunction value is anything except 276L
  10844.                                    (0x0114); if the ParmBlock fsFlags value
  10845.                                    is not zero; or if the pEnvironment
  10846.                                    value is zero.
  10847.  
  10848.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not 6.
  10849.  
  10850.  
  10851.  
  10852.  Comments
  10853.  
  10854.  A VDH need not provide a TerminateEnvironment function if it has no cleanup
  10855.  to do when a session ends and before the environment buffer is freed.
  10856.  
  10857.  
  10858.  
  10859.  
  10860.  See Also
  10861.  
  10862.  InitializeEnvironment, RestoreEnvironment, SaveEnvironment
  10863.  
  10864.  
  10865.  █    TextBufferUpdate (Reads)
  10866.  ────────────────────────────────────────────────────────────────────────────
  10867.  
  10868.  USHORT TextBufferUpdate  (pEnvironment, pParmBlock, ulFunction)
  10869.  
  10870.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  10871.  
  10872.  VDH_FULLBUFUP far * pParmBlock;   /*pointer to parameter block */
  10873.  
  10874.  ULONG  ulFunction;                /*function index */
  10875.  
  10876.  
  10877.  The TextBufferUpdate function performs text updates to the LVB (logical
  10878.  video buffer) or to both the LVB and PVB (physical video buffer). An index
  10879.  value in the parameter block determines whether TextBufferUpdate reads from,
  10880.  writes to, or scrolls and fills the logical or physical display. For MS OS/2
  10881.  version 1.2, the TextBufferUpdate function handles 13 possible index values.
  10882.  
  10883.  
  10884.  Two kinds of text updates require TextBufferUpdate to read the LVB/PVB
  10885.  information into the application's data buffer. A third requires
  10886.  TextBufferUpdate to read the LVB or PBV and return information about a
  10887.  specified cell to the application data buffer.
  10888.  
  10889.  
  10890.  Parameters
  10891.  
  10892.  pEnvironment  to the environment buffer.
  10893.  
  10894.  pParmBlock  to the parameter block for TextBufferUpdate, defined by the
  10895.  following structure:
  10896.  
  10897.  typedef struct {
  10898.      USHORT usLength;         /* 26-44 bytes
  10899.      USHORT fsFlags;          /* bit 0=0--do not update PVB             */
  10900.                               /* bit 0=1--must update PVB               */
  10901.                               /* bit 1=0--may update LVB also           */
  10902.                               /* bit 1=1--must update LVB               */
  10903.                               /* bit 2=0--use current attribute format  */
  10904.                               /* bit 2=1--translate current attribute   */
  10905.                               /*  format to CGA, if necessary           */
  10906.                               /* bits 3-15 must be zero (reserved)      */
  10907.      UCHAR far *pAppDataAddr; /* return data here for reads             */
  10908.      UCHAR far *pAppCellAddr; /*  (not used for reads)                  */
  10909.      USHORT iIndex;           /* 0x0000--read cell at (usStartRow,      */
  10910.                               /*   usStartCol) and return USHORT flag   */
  10911.                               /*   of single/double-cell character info */
  10912.                               /* 0x0001--read characters from           */
  10913.                               /*   (usStartRow,usStartCol)              */
  10914.                               /* 0x0002--read cells from (usStartRow,   */
  10915.                               /*    usStartCol)                         */
  10916.                               /* index values 3-13 for scrolls, writes  */
  10917.      USHORT usStartRow;       /* starting row for update                */
  10918.      USHORT usStartCol;       /* starting column for update             */
  10919.      USHORT usSecondRow;      /*  (not used for reads)                  */
  10920.      USHORT usSecondCol;      /*  (not used for reads)                  */
  10921.      USHORT usRepeatFactor;   /* number of chars/cells to read          */
  10922.                               /*  (not used for iIndex=0x0000)          */
  10923.      USHORT selLogicalBufSel; /* huge LVB selector (min 64K,max 1MB)    */
  10924.                               /******************************************/
  10925.                               /* MINIMUM INPUT ParmBlock ENDS HERE      */
  10926.                               /******************************************/
  10927.      SHORT  sTouchXLeft;      /* return -1 for reads (no cells touched) */
  10928.      SHORT  sTouchYTop;       /* return -1 for reads                    */
  10929.      SHORT  sTouchXRight;     /* return -1 for reads                    */
  10930.      SHORT  sTouchYBottom;    /* return -1 for reads                    */
  10931.      /*******************************************************************/
  10932.      /* The following fields specify an LVB that maps to a conversion   */
  10933.      /* rectangle (window) within the full display area for DBCS BVHs.  */
  10934.      /*******************************************************************/
  10935.      USHORT usLVBRowOff;     /* upper-left corner (row offset for LVB)  */
  10936.                              /*  expressed as a PVB coordinate          */
  10937.      USHORT usLVBColOff;     /* upper-left corner (column offset for    */
  10938.                              /*  LVB) expressed as a PVB coordinate     */
  10939.      USHORT usLVBWidth;      /* width in cells of LVB (must be > 0)     */
  10940.      USHORT usLVBHeight;     /* height in cells of LVB (must be > 0)    */
  10941.      UCHAR  uchLVBFormatID;  /* 0x00--use current value, or one of      */
  10942.                              /*   0x00=default (US), 0x70=world, or     */
  10943.                              /*   0x80=identical to adapter's format    */
  10944.      UCHAR uchAttrCount;     /* 0x00--use current value, or must be     */
  10945.                              /*   0x01 if default format ID, 0x03 if    */
  10946.                              /*   if world format ID; otherwise, is     */
  10947.                              /*   adapter-specific                      */
  10948.  } VDH_FULLBUFUP;
  10949.  
  10950.  
  10951.  ulFunction  TextBufferUpdate in the call vector table; its value is 256L
  10952.  (0x0100).
  10953.  
  10954.  
  10955.  Return Value
  10956.  
  10957.  If it is successful, TextBufferUpdate should return zero (to the ax register
  10958.  when coded in assembly language). Otherwise, it should return one of the
  10959.  following errors when it encounters any one of the following conditions:
  10960.  
  10961.  Return                            Conditions
  10962.  ────────────────────────────────────────────────────────────────────────────
  10963.  
  10964.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  10965.                                    except 256L (0x0100); if the ParmBlock
  10966.                                    fsFlags field has bit 1 set but bit 0
  10967.                                    clear, or if it has any of bits 3 to 15
  10968.                                    set; if the ParmBlock iIndex value is
  10969.                                    greater than 13; if any of the
  10970.                                    usLVBRowOff through usLVBHeight values
  10971.                                    are invalid; if the (input) ParmBlock
  10972.                                    uchFormatID and uchAttrCount pair are
  10973.                                    nonzero but mismatched (not 0x00 and
  10974.                                    0x01, or 0x70 and 0x03); or if the
  10975.                                    pEnvironment value is zero.
  10976.  
  10977.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is less
  10978.                                    than 26, does not fall on a ParmBlock
  10979.                                    field boundary, does not include
  10980.                                    sufficient data for optional but
  10981.                                    logically grouped fields of
  10982.                                    VDH_FULLBUFUP, or is greater than 44.
  10983.  
  10984.  ERROR_VIO_MODE                    If a check of the fbType value in the
  10985.                                    environment buffer's VDHMODEINFO data
  10986.                                    indicates graphics mode.
  10987.  
  10988.  ERROR_VIO_ROW                     If the ParmBlock usStartRow value is out
  10989.                                    of range for the current mode.
  10990.  
  10991.  ERROR_VIO_COLUMN                  If the ParmBlock usStartColumn value is
  10992.                                    out of range for the current mode.
  10993.  
  10994.  ERROR_VIO_INTERNAL_RESOURCE       If a check of the environment buffer
  10995.                                    reveals that the calling application
  10996.                                    either has a null PVB selector or has
  10997.                                    made a SetMode call (so the PVB selector
  10998.                                    in the environment buffer is
  10999.                                    out-of-date), and an attempt to allocate
  11000.                                    a current PVB selector fails.
  11001.  
  11002.  
  11003.  
  11004.  Comments
  11005.  
  11006.  The usLength value determines whether TextBufferUpdate may assume the
  11007.  default values for this environment. If usLength is greater than 26,
  11008.  TextBufferUpdate must validate input data and return values for additional
  11009.  fields passed in the call.
  11010.  
  11011.  TextBufferUpdate reads should return -1 to the sTouchXLeft through
  11012.  sTouchYBottom fields of ParmBlock.
  11013.  
  11014.  If ParmBlock includes LVB data for a conversion rectangle and uchLVBFormatID
  11015.  is a nonzero value, TextBufferUpdate must validate the input LVB dimensions
  11016.  and either return an error or use the specified LVB to read the data.
  11017.  
  11018.  For TextBufferUpdate reads, bit 1 of the fsFlags field has meaning only if
  11019.  bit 0 is set. Otherwise, this field may be a combination (OR) of the
  11020.  following values:
  11021.  
  11022.  Value                             Meaning
  11023.  ────────────────────────────────────────────────────────────────────────────
  11024.  
  11025.  0x0001                            Read the PVB to obtain return
  11026.                                    information, because the calling
  11027.                                    application is running in the foreground.
  11028.                                    Otherwise, get information from the LVB.
  11029.  
  11030.  0x0002                            Update the LVB with the information read
  11031.                                    from the PVB. Otherwise, an update to
  11032.                                    the LVB is optional.
  11033.  
  11034.  0x0004                            Translate LVB or PVB information into
  11035.                                    CGA format (if the LVB/PVB does not use
  11036.                                    CGA format) before returning the
  11037.                                    information to the application's data
  11038.                                    buffer (ANSI is enabled if bit 3 of
  11039.                                    fsFlags is set). Otherwise, return
  11040.                                    information in the current format.
  11041.  
  11042.  For TextBufferUpdate reads, the ParmBlock iIndex field is one of three
  11043.  possible values:
  11044.  
  11045.  Value                             Meaning
  11046.  ────────────────────────────────────────────────────────────────────────────
  11047.  
  11048.  0x0000                            If the BVH supports only SBCS
  11049.                                    (single-byte character set) text display,
  11050.                                    return 0x0000 to the application's data
  11051.                                    buffer at pAppDataAddr.
  11052.  
  11053.                                    If the BVH also supports DBCS
  11054.                                    (double-byte character set) text display,
  11055.                                    read the cell specified by the (
  11056.                                    usStartRow,usStartColumn) values.
  11057.  
  11058.                                    Return 0x0000 when ParmBlock either does
  11059.                                    not include the uchLVBFormatID and
  11060.                                    uchAttrCount fields or their values are
  11061.                                    zero, and a check of the environment
  11062.                                    buffer's mode data indicates that the
  11063.                                    current uchFormatID is 0x00 (default US
  11064.                                    format).
  11065.  
  11066.                                    Otherwise, examine the specified cell's
  11067.                                    character-attribute bytes to determine
  11068.                                    whether it is an SCBS character or a
  11069.                                    double-cell or single-cell DBCS
  11070.                                    character. Return 0x0000 to the
  11071.                                    application's data buffer if it is an
  11072.                                    SCBS character; return 0x0001 if it is a
  11073.                                    single-cell DBCS character. Otherwise,
  11074.                                    continue examining the specified cell's
  11075.                                    character-attribute bytes to determine
  11076.                                    whether it is the leading or trailing
  11077.                                    cell of the double-cell character.
  11078.                                    Return 0x0002 if it is the leading cell
  11079.                                    or 0x0003 if it is the trailing cell of
  11080.                                    the double-cell character. ]
  11081.  
  11082.  0x0001                            If the BVH supports only SBCS text
  11083.                                    display or if the current code page is
  11084.                                    SCBS, read the number of characters
  11085.                                    specified by usRepeatFactor (or until
  11086.                                    the end of the PVB/LVB) and start
  11087.                                    reading at (usStartRow,usStartColumn).
  11088.                                    Return the characters to the
  11089.                                    application's data buffer at
  11090.                                    pAppDataAddr and return the number of
  11091.                                    characters that were read to
  11092.                                    usRepeatFactor.
  11093.  
  11094.                                    If ParmBlock does not include LVB data
  11095.                                    (last six fields of VDH_FULLBUFUP) or if
  11096.                                    both the uchLVBFormatID and uchAttrCount
  11097.                                    fields are zero, use the current
  11098.                                    uchFormatID value, obtained from the
  11099.                                    environment buffer's mode data.
  11100.  
  11101.                                    If the current code page is DBCS, a
  11102.                                    single character can require two display
  11103.                                    cells. If the read operation starts on a
  11104.                                    trailing byte or ends on a leading byte
  11105.                                    of a double-cell character, replace this
  11106.                                    character with a blank (single-cell
  11107.                                    space character) before returning data
  11108.                                    at pAppDataAddr.
  11109.  
  11110.  0x0002                            If the BVH supports only SBCS text
  11111.                                    display or if the current code page is
  11112.                                    SBCS, read the number of cells specified
  11113.                                    by usRepeatFactor (or until the end of
  11114.                                    the PVB/LVB) and start reading at (
  11115.                                    usStartRow,usStartColumn). Return the
  11116.                                    cells read to the application's data
  11117.                                    buffer at pAppDataAddr and return the
  11118.                                    number of cells that were read to
  11119.                                    usRepeatFactor.
  11120.  
  11121.                                    If ParmBlock does not include LVB data
  11122.                                    (last six fields of VDH_FULLBUFUP) or if
  11123.                                    both the uchLVBFormatID and uchAttrCount
  11124.                                    fields are zero, use the current
  11125.                                    uchFormatID value, obtained from the
  11126.                                    environment buffer's mode data.
  11127.  
  11128.                                    If the current code page is DBCS, a
  11129.                                    single DBCS character can require two
  11130.                                    display cells. If the read operation
  11131.                                    starts on a trailing byte or ends on a
  11132.                                    leading byte of a double-cell character,
  11133.                                    replace this character with a blank
  11134.                                    (single-cell space character) before
  11135.                                    returning data at pAppDataAddr. ,
  11136.  
  11137.  Note that the usLVBRowOff through usLVBHeight fields of a conversion
  11138.  rectangle allow an LVB to map to a display area that does not have its
  11139.  upper-left corner at (0,0) on the physical display and that such an LVB
  11140.  might have different row and column dimensions than other LVBs that map to
  11141.  the same display.
  11142.  
  11143.  
  11144.  
  11145.  
  11146.  See Also
  11147.  
  11148.  InitializeEnvironment, SetMode, TextBufferUpdate (Scrolls), TextBufferUpdate
  11149.  (Writes), VioReadCellStr, VioReadCharStr
  11150.  
  11151.  
  11152.  █    TextBufferUpdate (Scrolls)
  11153.  ────────────────────────────────────────────────────────────────────────────
  11154.  
  11155.  USHORT TextBufferUpdate  (pEnvironment, pParmBlock, ulFunction)
  11156.  
  11157.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  11158.  
  11159.  VDH_FULLBUFUP far * pParmBlock;   /*pointer to parameter block */
  11160.  
  11161.  ULONG  ulFunction;                /*function index */
  11162.  
  11163.  
  11164.  The TextBufferUpdate function performs text updates to the LVB (logical
  11165.  video buffer) or to both the LVB and PVB (physical video buffer). An index
  11166.  value in the parameter block determines whether TextBufferUpdate reads from,
  11167.  writes to, or scrolls and fills the logical or physical display. For MS OS/2
  11168.  version 1.2, the TextBufferUpdate function handles 13 possible index values.
  11169.  
  11170.  
  11171.  Four kinds of scrolling operations require TextBufferUpdate to update the
  11172.  LVB or the LVB and PVB.
  11173.  
  11174.  
  11175.  Parameters
  11176.  
  11177.  pEnvironment  to the environment buffer.
  11178.  
  11179.  pParmBlock  to the parameter block for TextBufferUpdate, defined by the
  11180.  following structure:
  11181.  
  11182.  typedef struct {
  11183.      USHORT usLength;         /* 26-44 bytes
  11184.      USHORT fsFlags;          /* bit 0=0--do not update PVB            */
  11185.                               /* bit 0=1--must update PVB              */
  11186.                               /* bit 1=0--may update LVB also          */
  11187.                               /* bit 1=1--must update LVB              */
  11188.                               /* bit 2=0--use current attribute format */
  11189.                               /* bit 2=1--translate from CGA attribute */
  11190.                               /*  format, if necessary                 */
  11191.                               /* bits 3-15 must be zero (reserved)     */
  11192.      UCHAR far *pAppDataAddr; /*   (not used for scrolls)              */
  11193.      UCHAR far *pAppCellAddr; /* pointer to cell used to fill void in  */
  11194.                               /*    scrolled area (rectangle bounded   */
  11195.                               /*    by (usStartRow,usStartColumn) and  */
  11196.                               /*    (usSecondRow,usSecondColumn))      */
  11197.      USHORT iIndex;           /* 0x0003--scroll up                     */
  11198.                               /* 0x0004--scroll down                   */
  11199.                               /* 0x0005--scroll left                   */
  11200.                               /* 0x0006--scroll right                  */
  11201.                               /* iIndex 0-2 for reads,7-13 for writes  */
  11202.      USHORT usStartRow;       /* starting row for scroll update        */
  11203.      USHORT usStartCol;       /* starting column for scroll            */
  11204.      USHORT usSecondRow;      /* ending row for scroll                 */
  11205.      USHORT usSecondCol;      /* ending column for scroll              */
  11206.      USHORT usRepeatFactor;   /* number of rows/columns to scroll      */
  11207.      USHORT selLogicalBufSel; /* huge LVB selector (min 64K,max 1MB)   */
  11208.  .ET
  11209.                               /*****************************************/
  11210.                               /* MINIMUM INPUT ParmBlock ENDS HERE     */
  11211.                               /*****************************************/
  11212.                               /* return following TouchXXX values for  */
  11213.                               /*  smallest rectangle enclosing all     */
  11214.                               /*  cells affected by scroll operations  */
  11215.      SHORT  sTouchXLeft;      /* x-coordinate, upper leftmost cell     */
  11216.      SHORT  sTouchYTop;       /* y-coordinate, upper leftmost cell     */
  11217.      SHORT  sTouchXRight;     /* x-coordinate, lower rightmost cell    */
  11218.      SHORT  sTouchYBottom;    /* y-coordinate, lower rightmost cell    */
  11219.      /******************************************************************/
  11220.      /* The following fields specify an LVB that maps to a conversion  */
  11221.      /* rectangle (window) within the full display area for DBCS BVHs. */
  11222.      /******************************************************************/
  11223.      USHORT usLVBRowOff;      /*   (not used for scrolls)              */
  11224.      USHORT usLVBColOff;      /*   (not used for scrolls)              */
  11225.      USHORT usLVBWidth;       /*   (not used for scrolls)              */
  11226.      USHORT usLVBHeight;      /*   (not used for scrolls)              */
  11227.      UCHAR  uchLVBFormatID;   /*   (not used for scrolls)              */
  11228.      UCHAR  uchAttrCount;     /*   (not used for scrolls)              */
  11229.                               /*   (not used for scrolls)              */
  11230.  } VDH_FULLBUFUP;
  11231.  
  11232.  
  11233.  ulFunction  TextBufferUpdate in the call vector table; its value is 256L
  11234.  (0x0100).
  11235.  
  11236.  
  11237.  Return Value
  11238.  
  11239.  If it is successful, TextBufferUpdate should return zero (to the ax register
  11240.  when coded in assembly language). Otherwise, it should return one of the
  11241.  following errors when it encounters any one of the following conditions:
  11242.  
  11243.  Return                            Conditions
  11244.  ────────────────────────────────────────────────────────────────────────────
  11245.  
  11246.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  11247.                                    except 256L (0x0100); if the ParmBlock
  11248.                                    fsFlags field has both bits 0 and 1
  11249.                                    clear or any of bits 3 to 15 set; if the
  11250.                                    ParmBlock iIndex value is greater than
  11251.                                    13; if the ParmBlock usRepeatFactor
  11252.                                    value is zero; or if the pEnvironment
  11253.                                    value is zero.
  11254.  
  11255.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is less
  11256.                                    than 26, does not fall on a ParmBlock
  11257.                                    field boundary, does not include
  11258.                                    sufficient data for optional but
  11259.                                    logically grouped fields of
  11260.                                    VDH_FULLBUFUP, or is greater than 44.
  11261.  
  11262.  ERROR_VIO_MODE                    If a check of the fbType value in the
  11263.                                    environment buffer's VDHMODEINFO data
  11264.                                    indicates graphics mode.
  11265.  
  11266.  ERROR_VIO_ROW                     If the ParmBlock usStartRow or
  11267.                                    usSecondRow value is out of range for
  11268.                                    the current mode.
  11269.  
  11270.  ERROR_VIO_COLUMN                  If the ParmBlock usStartColumn or
  11271.                                    usSecondColumn value is out of range for
  11272.                                    the current mode.
  11273.  
  11274.  ERROR_VIO_INTERNAL_RESOURCE       If a check of the environment buffer
  11275.                                    reveals that the calling application
  11276.                                    either has a null PVB selector or has
  11277.                                    made a SetMode call (so the PVB selector
  11278.                                    in the environment buffer is
  11279.                                    out-of-date), and an attempt to allocate
  11280.                                    a current PVB selector fails.
  11281.  
  11282.  
  11283.  
  11284.  
  11285.  Comments
  11286.  
  11287.  If the usLength value is greater than 26, TextBufferUpdate must calculate
  11288.  and return values for additional fields passed in the call.
  11289.  
  11290.  TextBufferUpdate scrolls must return values to the sTouchXLeft, sTouchYTop,
  11291.  sTouchXRight, and sTouchYBottom fields if ParmBlock includes a touch
  11292.  rectangle (usLength is at least 34). These values should specify the
  11293.  smallest possible rectangle that encloses all cells affected by the scroll
  11294.  operation. BVS uses the touched coordinates if it must call the BVH again to
  11295.  refresh a display area that was overwritten by the scroll.
  11296.  
  11297.  For TextBufferUpdate scrolls, bit 1 of the fsFlags field has meaning only if
  11298.  bit 0 is set. Otherwise, fsFlags may be a combination (OR) of the following
  11299.  values:
  11300.  
  11301.  Value                             Meaning
  11302.  ────────────────────────────────────────────────────────────────────────────
  11303.  
  11304.  0x0001                            Update the display (PVB) with the
  11305.                                    scrolling information, because the
  11306.                                    calling application is running in the
  11307.                                    foreground. Otherwise, update the LVB.
  11308.  
  11309.  0x0002                            Update the LVB with the scrolling
  11310.                                    information. Otherwise, the PVB has been
  11311.                                    updated and an update to the LVB is
  11312.                                    optional.
  11313.  
  11314.  0x0004                            Translate the value at pAppCellAddr from
  11315.                                    CGA attribute format (if the LVB/PVB
  11316.                                    does not use CGA format) before updating
  11317.                                    the PVB or the LVB. Otherwise, use this
  11318.                                    value in its current attribute format.
  11319.  
  11320.  For TextBufferUpdate scrolls, the iIndex field is one of four possible
  11321.  values, each indicating the direction for the scroll:
  11322.  
  11323.  Value                             Meaning
  11324.  ────────────────────────────────────────────────────────────────────────────
  11325.  
  11326.  0x0003                            Scroll text up within the specified
  11327.                                    rectangle for the specified number of
  11328.                                    rows.
  11329.  
  11330.                                    The rectangle bounded at the upper-left
  11331.                                    corner by (usStartRow,usStartColumn) and
  11332.                                    at the lower-right corner by (
  11333.                                    usSecondRow,usSecondColumn) is the area
  11334.                                    to be scrolled up. The usRepeatFactor
  11335.                                    value is the number of rows to scroll.
  11336.                                    The rectangle bounded by ((usSecondRow -
  11337.                                    usRepeatFactor + 1),usStartColumn) and (
  11338.                                    usSecondRow,usSecondColumn) is the area
  11339.                                    to be filled.
  11340.  
  11341.                                    If the usRepeatFactor value is greater
  11342.                                    than or equal to (usSecondRow -
  11343.                                    usStartRow + 1), TextBufferUpdate may
  11344.                                    simply fill the specified rectangle with
  11345.                                    the cell at pAppCellAddr. Otherwise,
  11346.                                    TextBufferUpdate must move data in the
  11347.                                    specified rectangle and fill part of the
  11348.                                    scroll rectangle at the bottom.
  11349.  
  11350.  0x0004                            Scroll text down within the specified
  11351.                                    rectangle for the specified number of
  11352.                                    rows.
  11353.  
  11354.                                    The rectangle bounded at the upper-left
  11355.                                    corner by (usStartRow,usStartColumn) and
  11356.                                    at the lower-right corner by (
  11357.                                    usSecondRow,usSecondColumn) is the area
  11358.                                    to be scrolled down. The usRepeatFactor
  11359.                                    value is the number of rows to scroll.
  11360.                                    The rectangle bounded by (usStartRow,
  11361.                                    usStartColumn) and ((usStartRow +
  11362.                                    usRepeatFactor - 1),usSecondColumn) is
  11363.                                    the area to be filled.
  11364.  
  11365.                                    If the usRepeatFactor value is greater
  11366.                                    than or equal to (usSecondRow -
  11367.                                    usStartRow + 1), TextBufferUpdate may
  11368.                                    simply fill the specified rectangle with
  11369.                                    the cell at pAppCellAddr. Otherwise,
  11370.                                    TextBufferUpdate must move data in the
  11371.                                    specified rectangle and fill part of the
  11372.                                    scroll rectangle at the top.
  11373.  
  11374.  0x0005                            Scroll text left within the specified
  11375.                                    rectangle for the specified number of
  11376.                                    columns.
  11377.  
  11378.                                    The rectangle bounded at the upper-left
  11379.                                    corner by (usStartRow,usStartColumn) and
  11380.                                    at the lower-right corner by (
  11381.                                    usSecondRow,usSecondColumn) is the area
  11382.                                    to be scrolled left. The usRepeatFactor
  11383.                                    value is the number of columns to scroll.
  11384.                                    The rectangle bounded by (usStartRow, (
  11385.                                    usSecondColumnusRepeatFactor + 1)) and (
  11386.                                    usSecondRow,usSecondColumn) is the area
  11387.                                    to be filled.
  11388.  
  11389.                                    If the usRepeatFactor value is greater
  11390.                                    than or equal to (usSecondColumn -
  11391.                                    usStartColumn + 1), TextBufferUpdate may
  11392.                                    simply fill the specified rectangle with
  11393.                                    the cell at pAppCellAddr. Otherwise,
  11394.                                    TextBufferUpdate must move data in the
  11395.                                    specified rectangle and fill part of the
  11396.                                    scroll rectangle at the right.
  11397.  
  11398.  0x0006                            Scroll text right within the specified
  11399.                                    rectangle for the specified number of
  11400.                                    columns.
  11401.  
  11402.                                    The rectangle bounded at the upper-left
  11403.                                    corner by (usStartRow,usStartColumn) and
  11404.                                    at the lower-right corner by (
  11405.                                    usSecondRow,usSecondColumn) is the area
  11406.                                    to be scrolled right. The usRepeatFactor
  11407.                                    value is the number of columns to scroll.
  11408.                                    The rectangle bounded by (usStartRow,
  11409.                                    usStartColumn) and (usSecondRow,(
  11410.                                    usStartColumn + usRepeatFactor - 1)) is
  11411.                                    the area to be filled.
  11412.  
  11413.                                    If the usRepeatFactor value is greater
  11414.                                    than or equal to (usSecondColumn -
  11415.                                    usStartColumn + 1), TextBufferUpdate may
  11416.                                    simply fill the specified rectangle with
  11417.                                    the cell at pAppCellAddr. Otherwise,
  11418.                                    TextBufferUpdate must move data in the
  11419.                                    specified rectangle and fill part of the
  11420.                                    scroll rectangle at the right.
  11421.  
  11422.  The BVH must support scrolling operations within the scrollable rectangle
  11423.  for the current mode (see SetVariableInfo). The upper-left cell of the full
  11424.  display has the coordinates (0,0).
  11425.  
  11426.  If the BVH supports DBCS text display, TextBufferUpdate must not bisect a
  11427.  double-cell DBCS character on the display. The scroll operations should
  11428.  substitute a single-cell space character for any double-cell DBCS character
  11429.  that would otherwise be bisected at the edge of the screen or at the border
  11430.  of a conversion rectangle, including the input fill-cell character.
  11431.  
  11432.  If the BVH supports DBCS text display, TextBufferUpdate must sometimes
  11433.  scroll text on a display where one or more conversion rectangles cover all
  11434.  or part of the scroll rectangle. A conversion rectangle uses its own LVB
  11435.  when it overwrites a display area, so the BVH retains the original LVB for
  11436.  the display. When it writes the formerly hidden characters from the LVB to
  11437.  the PVB, TextBufferUpdate restores bisected double-cell DBCS characters that
  11438.  were displayed as single-cell blanks at a border of the conversion
  11439.  rectangle.
  11440.  
  11441.  For scrolls, TextBufferUpdate may ignore the usLVBRowOff through
  11442.  uchAttrCount fields of VDH_FULLBUFUP, since MS OS/2 version 1.2 does not
  11443.  allow scrolling within conversion rectangles.
  11444.  
  11445.  
  11446.  
  11447.  
  11448.  See Also
  11449.  
  11450.  InitializeEnvironment, SetMode, SetVariableInfo, TextBufferUpdate (Reads),
  11451.  TextBufferUpdate (Writes), VioScrollDn, VioScrollLf, VioScrollRt,
  11452.  VioScrollUp
  11453.  
  11454.  
  11455.  █    TextBufferUpdate (Writes)
  11456.  ────────────────────────────────────────────────────────────────────────────
  11457.  
  11458.  USHORT TextBufferUpdate  (pEnvironment, pParmBlock, ulFunction)
  11459.  
  11460.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  11461.  
  11462.  VDH_FULLBUFUP far * pParmBlock;   /*pointer to parameter block */
  11463.  
  11464.  ULONG  ulFunction;                /*function index */
  11465.  
  11466.  
  11467.  The TextBufferUpdate function performs text updates to the LVB (logical
  11468.  video buffer) or to both the LVB and PVB (physical video buffer). An index
  11469.  value in the parameter block determines whether TextBufferUpdate reads from,
  11470.  writes to, or scrolls and fills the logical or physical display. For MS OS/2
  11471.  version 1.2, the TextBufferUpdate function handles 13 possible index values.
  11472.  
  11473.  
  11474.  Three kinds of text updates require TextBufferUpdate to write characters or
  11475.  cells from the application's data buffer to the LVB or to the LVB and PVB.
  11476.  Three more require TextBufferUpdate to write a repeated character,
  11477.  attribute, or cell from the application's data buffer to the LVB or to the
  11478.  LVB and PVB. Another requires TextBufferUpdate to copy an LVB rectangle to
  11479.  the PVB.
  11480.  
  11481.  
  11482.  Parameters
  11483.  
  11484.  pEnvironment  to the environment buffer.
  11485.  
  11486.  pParmBlock  to the parameter block for TextBufferUpdate, defined by the
  11487.  following structure:
  11488.  
  11489.  typedef struct {
  11490.      USHORT usLength;         /* 26-44 bytes
  11491.      USHORT fsFlags;          /* bit 0=0--do not update PVB            */
  11492.                               /* bit 0=1--must update PVB              */
  11493.                               /* bit 1=0--may update LVB also          */
  11494.                               /* bit 1=1--must update LVB              */
  11495.                               /* bit 2=0--use current attribute format */
  11496.                               /* bit 2=1--translate from CGA attribute */
  11497.                               /*  format, if necessary                 */
  11498.                               /* bits 3-15 must be zero (reserved)     */
  11499.      UCHAR far *pAppDataAddr; /* get characters/cells here for         */
  11500.                               /*   iIndex=7-12 writes                  */
  11501.      UCHAR far *pAppCellAddr; /* get attribute here, iIndex=9 writes   */
  11502.      /******************************************************************/
  11503.      /* Writes either to rectangle bounded by (usStartRow,             */
  11504.      /* usStartColumn) and (usSecondRow,usSecondColumn) or starting    */
  11505.      /* at (usStartRow,usStartColumn)                                  */
  11506.      /******************************************************************/
  11507.      USHORT iIndex;           /* 0x0007--write cells                   */
  11508.                               /* 0x0008--write characters              */
  11509.                               /* 0x0009--write characters with         */
  11510.                               /*   constant attribute                  */
  11511.                               /* 0x0010--write repeated character      */
  11512.                               /* 0x0011--write repeated attribute      */
  11513.                               /* 0x0012--write repeated cell           */
  11514.                               /* 0x0013--copy LVB rectangle to PVB     */
  11515.                               /* iIndex values 0-6 for reads,scrolls   */
  11516.      USHORT usStartRow;       /* starting row iIndex=7-12, upper-left  */
  11517.                               /*  row for start-cell iIndex=13         */
  11518.      USHORT usStartCol;       /* starting column iIndex=7-12, upper-   */
  11519.                               /*  left column for start-cell iIndex=13 */
  11520.      USHORT usSecondRow;      /* ending row iIndex=7-9, (not used      */
  11521.                               /*  iIndex=10-12), lower-right row for   */
  11522.                               /*  end-cell iIndex=13                   */
  11523.      USHORT usSecondCol;      /* ending column iIndex=7-9, (not used   */
  11524.                               /*  iIndex=10-12), lower-right column    */
  11525.                               /*  for end-cell iIndex=13               */
  11526.      USHORT usRepeatFactor;   /* number of chars/cells to write        */
  11527.                               /*  (zero for iIndex=13)                 */
  11528.      USHORT selLogicalBufSel; /* huge LVB selector (min 64K,max 1MB)   */
  11529.  .ET
  11530.                               /*****************************************/
  11531.                               /* MINIMUM INPUT ParmBlock ENDS HERE     */
  11532.                               /*****************************************/
  11533.                               /* return following TouchXXX values for  */
  11534.                               /*  smallest rectangle enclosing all     */
  11535.                               /*  cells affected by write operations   */
  11536.      SHORT  sTouchXLeft;      /* x-coordinate, upper-leftmost cell     */
  11537.      SHORT  sTouchYTop;       /* y-coordinate, upper-leftmost cell     */
  11538.      SHORT  sTouchXRight;     /* x-coordinate, lower-rightmost cell    */
  11539.      SHORT  sTouchYBottom;    /* y-coordinate, lower-rightmost cell    */
  11540.      /******************************************************************/
  11541.      /* The following fields specify an LVB that maps to a conversion  */
  11542.      /* rectangle (window) within the full display area for DBCS BVHs. */
  11543.      /******************************************************************/
  11544.      USHORT usLVBRowOff;      /* upper-left corner (row offset for LVB)*/
  11545.                               /*  expressed as a PVB coordinate        */
  11546.      USHORT usLVBColOff;      /* upper-left corner (column offset for  */
  11547.                               /*  LVB) expressed as a PVB coordinate   */
  11548.      USHORT usLVBWidth;       /* width in cells of LVB (must be > 0)   */
  11549.      USHORT usLVBHeight;      /* height in cells of LVB (must be > 0)  */
  11550.      UCHAR  uchLVBFormatID;   /* 0x00--use current value, or one of    */
  11551.                               /*   0x00=default (US), 0x70=world, or   */
  11552.                               /*   0x80=identical to adapter's format  */
  11553.      UCHAR uchAttrCount;      /* 0x00--use current value, or must be   */
  11554.                               /*   0x01 if default formatID, 0x03      */
  11555.                               /*   if world formatID; otherwise, is    */
  11556.                               /*   adapter-specific                    */
  11557.  } VDH_FULLBUFUP;
  11558.  
  11559.  
  11560.  ulFunction  TextBufferUpdate in the call vector table; its value is 256L
  11561.  (0x0100).
  11562.  
  11563.  
  11564.  Return Value
  11565.  
  11566.  If it is successful, TextBufferUpdate should return zero (to the ax register
  11567.  when coded in assembly language). Otherwise, it should return one of the
  11568.  following errors when it encounters any one of the following conditions:
  11569.  
  11570.  Return                            Conditions
  11571.  ────────────────────────────────────────────────────────────────────────────
  11572.  
  11573.  ERROR_VIO_INVALID_PARMS           If the ulFunction value is anything
  11574.                                    except 256L (0x0100); if the ParmBlock
  11575.                                    fsFlags field has any of bits 3 to 15
  11576.                                    set; if the ParmBlock iIndex value is
  11577.                                    greater than 13; if any of the
  11578.                                    usLVBRowOff through usLBVHeight values
  11579.                                    are invalid; if  the (input)
  11580.                                    ParmBlock uchFormatID and uchAttrCount
  11581.                                    pair are nonzero but mismatched (not
  11582.                                    0x00 and 0x01, or 0x70 and 0x03); or if
  11583.                                    the pEnvironment value is zero.
  11584.  
  11585.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is less
  11586.                                    than 26, does not fall on a ParmBlock
  11587.                                    field boundary, does not include
  11588.                                    sufficient data for optional but
  11589.                                    logically grouped fields of
  11590.                                    VDH_FULLBUFUP, or is greater than 44.
  11591.  
  11592.  ERROR_VIO_MODE                    If a check of the fbType value in the
  11593.                                    environment buffer's VDHMODEINFO data
  11594.                                    indicates graphics mode.
  11595.  
  11596.  ERROR_VIO_ROW                     If the ParmBlock usStartRow or
  11597.                                    usSecondRow value is out of range for
  11598.                                    the current mode.
  11599.  
  11600.  ERROR_VIO_COLUMN                  If the ParmBlock usStartColumn
  11601.                                    usSecondColumn value is out of range for
  11602.                                    the current mode.
  11603.  
  11604.  ERROR_VIO_INTERNAL_RESOURCE       If a check of the environment buffer
  11605.                                    reveals that the calling application
  11606.                                    either has a null PVB selector or has
  11607.                                    made a SetMode call (so the PVB selector
  11608.                                    in the environment buffer is
  11609.                                    out-of-date), and an attempt to allocate
  11610.                                    a current PVB selector fails.
  11611.  
  11612.  
  11613.  
  11614.  Comments
  11615.  
  11616.  The usLength value determines whether TextBufferUpdate may assume the
  11617.  default values for this environment. If usLength is greater than 26,
  11618.  TextBufferUpdate must validate input data and calculate return values for
  11619.  additional fields passed in the call.
  11620.  
  11621.  TextBufferUpdate writes must return values to the sTouchXLeft, sTouchYTop,
  11622.  sTouchXRight, and sTouchYBottom fields if ParmBlock includes a touch
  11623.  rectangle (usLength is at least 34). These values should specify the
  11624.  smallest possible rectangle that encloses all cells affected by the write
  11625.  operation. BVS uses the touched coordinates if it must call TextBufferUpdate
  11626.  again (iIndex value of 13) to refresh a display area that was overwritten.
  11627.  
  11628.  If ParmBlock includes LVB data, TextBufferUpdate must validate the input LVB
  11629.  dimensions and return an error if any dimension is invalid. Otherwise, it
  11630.  must use the values of (usLVBRowOff,usLVBColOff), usLVBWidth, and
  11631.  usLVBHeight to determine a rectangle that contains the rectangle to be
  11632.  written (bounded by (usStartRow,usStartColumn) and (usSecondRow,
  11633.  usSecondColumn)).
  11634.  
  11635.  For TextBufferUpdate writes, bit 1 of the fsFlags field has meaning only if
  11636.  bit 0 is set. Otherwise, this field may be a combination (OR) of the
  11637.  following values:
  11638.  
  11639.  Value                             Meaning
  11640.  ────────────────────────────────────────────────────────────────────────────
  11641.  
  11642.  0x0001                            Write to the PVB, because the calling
  11643.                                    application is running in the foreground.
  11644.                                    Otherwise, write to the LVB.
  11645.  
  11646.  0x0002                            Update the LVB before writing to the PVB.
  11647.                                    (If the BVH supports DBCS text display,
  11648.                                    its LVB should retain double-cell
  11649.                                    characters that it must write to the PVB
  11650.                                    as blanks, rather than bisecting such
  11651.                                    characters at a border of the display
  11652.                                    area.) Otherwise, an update to the LVB
  11653.                                    is optional.
  11654.  
  11655.  0x0004                            Translate data at ParmBlock pAppDataAddr
  11656.                                    from CGA format (ANSI is enabled if bit
  11657.                                    3 of fsFlags is set), if the LVB/PVB
  11658.                                    does not use CGA format. Otherwise, use
  11659.                                    the data in its current format.
  11660.  
  11661.  For TextBufferUpdate writes, the iIndex field is one of seven possible
  11662.  values:
  11663.  
  11664.  Value                             Meaning
  11665.  ────────────────────────────────────────────────────────────────────────────
  11666.  
  11667.  0x0007                            If the BVH supports only SBCS text
  11668.                                    display or if the current code page is
  11669.                                    SBCS, get the number of cells specified
  11670.                                    by usRepeatFactor from the buffer at
  11671.                                    pAppDataAddr or get all cells in the
  11672.                                    buffer if there are fewer than the value
  11673.                                    of usRepeatFactor. Write the cells to
  11674.                                    the rectangle bounded by (usStartRow,
  11675.                                    usStartColumn) on the upper left and by
  11676.                                    (usSecondRow,usSecondColumn) on the
  11677.                                    lower right. Return the number of cells
  11678.                                    that were written to usRepeatFactor.
  11679.  
  11680.                                    If ParmBlock does not include LVB data
  11681.                                    (last six fields of VDH_FULLBUFUP) or if
  11682.                                    both the uchLVBFormatID and uchAttrCount
  11683.                                    values are zero, use the current
  11684.                                    uchFormatID value, obtained from the
  11685.                                    environment buffer's mode data.
  11686.  
  11687.                                    If the current code page is DBCS, a
  11688.                                    single character can require two display
  11689.                                    cells. If the pAppCellAddr field
  11690.                                    contains a selector that matches the LVB
  11691.                                    selector in the environment buffer and
  11692.                                    the current value of uchFormatID is 0x70,
  11693.                                    restore each DBCS character's
  11694.                                    system-attribute byte when updating the
  11695.                                    LVB; as always, update the LVB before
  11696.                                    updating the PVB. If a write operation
  11697.                                    starts on a trailing byte or ends on a
  11698.                                    leading byte of a double-cell character,
  11699.                                    replace this character with a blank
  11700.                                    (single-cell space character).
  11701.  
  11702.  0x0008                            If the BVH supports only SBCS text
  11703.                                    display or if the current code page is
  11704.                                    SBCS, get the number of characters
  11705.                                    specified by usRepeatFactor from the
  11706.                                    buffer at pAppDataAddr or get all
  11707.                                    characters in the buffer if there are
  11708.                                    fewer than the value of usRepeatFactor.
  11709.                                    Write the characters to the rectangle
  11710.                                    bounded by (usStartRow,usStartColumn) on
  11711.                                    the upper left and by (usSecondRow,
  11712.                                    usSecondColumn) on the lower right.
  11713.                                    Return the number of characters that
  11714.                                    were written to usRepeatFactor.
  11715.  
  11716.                                    If ParmBlock does not include LVB data
  11717.                                    (last six fields of VDH_FULLBUFUP) or if
  11718.                                    both the uchLVBFormatID and uchAttrCount
  11719.                                    values are zero, use the current
  11720.                                    uchFormatID value, obtained from the
  11721.                                    environment buffer's mode data.
  11722.  
  11723.                                    If the current code page is DBCS, a
  11724.                                    single character can require two display
  11725.                                    cells. Update the LVB before updating
  11726.                                    the PVB if bit 0 of usFlags is set. If a
  11727.                                    write operation starts on a trailing
  11728.                                    byte or ends on a leading byte of a
  11729.                                    double-cell character, replace this
  11730.                                    character with a blank (single-cell
  11731.                                    space character).
  11732.  
  11733.  0x0009                            If the BVH supports only SBCS text
  11734.                                    display or if the current code page is
  11735.                                    SBCS, get the number of characters
  11736.                                    specified by usRepeatFactor from the
  11737.                                    buffer at pAppDataAddr or get all
  11738.                                    characters in the buffer if there are
  11739.                                    fewer than the value of usRepeatFactor.
  11740.                                    Get the attribute to be applied to each
  11741.                                    character from the buffer at
  11742.                                    pAppCellAddr. Write the characters to
  11743.                                    the rectangle bounded by (usStartRow,
  11744.                                    usStartColumn) on the upper left and by
  11745.                                    (usSecondRow,usSecondColumn) on the
  11746.                                    lower right. Return the number of
  11747.                                    characters that were written to
  11748.                                    usRepeatFactor.
  11749.  
  11750.                                    If ParmBlock does not include LVB data
  11751.                                    (last six fields of VDH_FULLBUFUP) or if
  11752.                                    both the uchLVBFormatID and uchAttrCount
  11753.                                    values are zero, use the current
  11754.                                    uchFormatID value, obtained from the
  11755.                                    environment buffer's mode data.
  11756.  
  11757.                                    If the current code page is DBCS, a
  11758.                                    single character can require two display
  11759.                                    cells. Update the LVB before updating
  11760.                                    the PVB if bit 0 of usFlags is set. If a
  11761.                                    write operation starts on a trailing
  11762.                                    byte or ends on a leading byte of a
  11763.                                    double-cell character, replace this
  11764.                                    character with a blank (single-cell
  11765.                                    space character).
  11766.  
  11767.  0x0010                            If the BVH supports only SBCS text
  11768.                                    display or if the current code page is
  11769.                                    SBCS, get the the character to be
  11770.                                    written from the buffer at pAppDataAddr
  11771.                                    and the number of times to write it from
  11772.                                    usRepeatFactor. Write the character
  11773.                                    repeatedly, starting at (usStartRow,
  11774.                                    usStartColumn) on the upper left until
  11775.                                    usRepeatFactor characters are written or
  11776.                                    until the end of the LVB/PVB. Return the
  11777.                                    number of characters that were written
  11778.                                    to usRepeatFactor.
  11779.  
  11780.                                    If ParmBlock does not include LVB data
  11781.                                    (last six fields of VDH_FULLBUFUP) or if
  11782.                                    both the uchLVBFormatID and uchAttrCount
  11783.                                    values are zero, use the current
  11784.                                    uchFormatID value, obtained from the
  11785.                                    environment buffer's mode data.
  11786.  
  11787.                                    If the current code page is DBCS, a
  11788.                                    single character can require two display
  11789.                                    cells. Update the LVB before updating
  11790.                                    the PVB if bit 0 of usFlags is set. If a
  11791.                                    write operation starts on a trailing
  11792.                                    byte or ends on a leading byte of a
  11793.                                    double-cell character, replace this
  11794.                                    character with a blank (single-cell
  11795.                                    space character).
  11796.  
  11797.  0x0011                            If the BVH supports only SBCS text
  11798.                                    display or if the current code page is
  11799.                                    SBCS, get the the attribute to be
  11800.                                    written from the buffer at pAppDataAddr
  11801.                                    and the number of times to write it from
  11802.                                    usRepeatFactor. Write the attribute
  11803.                                    repeatedly, starting at (usStartRow,
  11804.                                    usStartColumn) on the upper left until
  11805.                                    usRepeatFactor attributes are written or
  11806.                                    until the end of the LVB/PVB. Return the
  11807.                                    number of attributes that were written
  11808.                                    to usRepeatFactor.
  11809.  
  11810.                                    If ParmBlock does not include LVB data
  11811.                                    (last six fields of VDH_FULLBUFUP) or if
  11812.                                    both the uchLVBFormatID and uchAttrCount
  11813.                                    values are zero, use the current
  11814.                                    uchFormatID value, obtained from the
  11815.                                    environment buffer's mode data.
  11816.  
  11817.                                    If the current code page is DBCS, update
  11818.                                    the LVB before updating the PVB if bit 0
  11819.                                    of usFlags is set.
  11820.  
  11821.  0x0012                            If the BVH supports only SBCS text
  11822.                                    display or if the current code page is
  11823.                                    SBCS, get the the cell to be written
  11824.                                    from the buffer at pAppDataAddr and the
  11825.                                    number of times to write it from
  11826.                                    usRepeatFactor. Write the cell
  11827.                                    repeatedly, starting at (usStartRow,
  11828.                                    usStartColumn) on the upper left until
  11829.                                    usRepeatFactor cells are written or
  11830.                                    until the end of the LVB/PVB. Return the
  11831.                                    number of cells that were written to
  11832.                                    usRepeatFactor.
  11833.  
  11834.                                    If ParmBlock does not include LVB data
  11835.                                    (last six fields of VDH_FULLBUFUP) or if
  11836.                                    both the uchLVBFormatID and uchAttrCount
  11837.                                    values are zero, use the current
  11838.                                    uchFormatID value, obtained from the
  11839.                                    environment buffer's mode data.
  11840.  
  11841.                                    If the current code page is DBCS, a
  11842.                                    single character can require two display
  11843.                                    cells. Update the LVB before updating
  11844.                                    the PVB if bit 0 of usFlags is set. If a
  11845.                                    write operation starts on a trailing
  11846.                                    byte or ends on a leading byte of a
  11847.                                    double-cell character, replace this
  11848.                                    character with a blank (single-cell
  11849.                                    space character).
  11850.  
  11851.  0x0013                            If the BVH supports only SBCS text
  11852.                                    display, it may or may not implement
  11853.                                    TextBufferUpdate for iIndex 0x0013,
  11854.                                    depending on whether the BVH maintains a
  11855.                                    shadow LVB for sessions running in the
  11856.                                    foreground and whether it returns touch
  11857.                                    rectangle values that are less than a
  11858.                                    full-screen display. If it does, the (
  11859.                                    usStartRow, usStartColumn) coordinates
  11860.                                    determine the upper-left corner, and the
  11861.                                    (usSecondRow,usSecondColumn) coordinates
  11862.                                    determine the lower-right corner of the
  11863.                                    rectangle to be copied from the LVB to
  11864.                                    the PVB.
  11865.  
  11866.                                    If ParmBlock does not include LVB data
  11867.                                    (last six fields of VDH_FULLBUFUP) or if
  11868.                                    both the uchLVBFormatID and uchAttrCount
  11869.                                    values are zero, use the current
  11870.                                    uchFormatID value, obtained from the
  11871.                                    environment buffer's mode data.
  11872.  
  11873.                                    If the current code page is SBCS, copy
  11874.                                    the rectangle bounded by (usStartRow,
  11875.                                    usStartColumn) and (usSecondRow,
  11876.                                    usSecondColumn) from the LVB to the PVB.
  11877.  
  11878.                                    Otherwise, a single DBCS character can
  11879.                                    require two display cells. If a write
  11880.                                    operation starts on a trailing byte of a
  11881.                                    double-cell character at a coordinate
  11882.                                    that is not the leftmost column of the
  11883.                                    LVB, write both the leading and trailing
  11884.                                    cells to the PVB. If a write operation
  11885.                                    ends on a leading byte of a double-cell
  11886.                                    character at a coordinate that is not
  11887.                                    the rightmost column of the LVB, write
  11888.                                    both the leading and trailing cells to
  11889.                                    the PVB.
  11890.  
  11891.  A BVH must maintain the integrity of its LVBs. The BVH should refuse to
  11892.  write any application-supplied data that would result in malformed display
  11893.  output. In particular, BVHs that support DBCS text displays must do the
  11894.  following:
  11895.  
  11896.    ■   Update the LVB before writing to the PVB when bit 0 is set in the
  11897.        fsFlags field, in order to retain full double-cell DBCS characters in
  11898.        the LVB. TextBufferUpdate writes must retain a full double-cell DBCS
  11899.        character in the LVB for each such character that should be written as
  11900.        a blank at the edge of the display.
  11901.  
  11902.    ■   Keep either a full single-cell SBCS character or the leading cell of a
  11903.        DBCS double-cell character as the initial character of the LVB. Except
  11904.        for this initial character, DBCS double-cell characters may occur at
  11905.        any location in the LVB.
  11906.  
  11907.  
  11908.   Note that the usLVBRowOff through usLVBHeight fields of a conversion
  11909.  rectangle allow an LVB to map to a display area that does not have its
  11910.  upper-left corner at (0,0) on the physical display and that such an LVB
  11911.  might have different row and column dimensions than other LVBs that map to
  11912.  the same display.
  11913.  
  11914.  When a DBCS conversion rectangle is dismissed, the subsequent write
  11915.  operation (TextBufferUpdate with iIndex value 0x0013) should restore the
  11916.  formerly bisected double-cell DBCS characters that were covered by a border
  11917.  column of the conversion rectangle. For this reason, TextBufferUpdate should
  11918.  return values for the touch rectangle fields sTouchXLeft through
  11919.  sTouchYBottom that allow this restoration when a conversion rectangle is
  11920.  dismissed.
  11921.  
  11922.  
  11923.  
  11924.  
  11925.  See Also
  11926.  
  11927.  InitializeEnvironment, SetMode, TextBufferUpdate (Reads), TextBufferUpdate
  11928.  (Scrolls), VioWrtCellStr, VioWrtCharStr, VioWrtCharStrAtt, VioWrtNAttr,
  11929.  VioWrtNCell, VioWrtNChar, WriteTTY
  11930.  
  11931.  
  11932.  █    WriteTTY
  11933.  ────────────────────────────────────────────────────────────────────────────
  11934.  
  11935.  USHORT WriteTTY  (pEnvironment, pParmBlock, ulFunction)
  11936.  
  11937.  ENVIRONMENT far * pEnvironment;   /*pointer to environment buffer */
  11938.  
  11939.  VDH_WRTTTY far * pParmBlock;      /*pointer to parameter block */
  11940.  
  11941.  ULONG  ulFunction;                /*function index */
  11942.  
  11943.  
  11944.  The WriteTTY function writes a character string to the screen, starting at
  11945.  the current cursor position, and optionally does a print screen as well.
  11946.  
  11947.  
  11948.  Parameters
  11949.  
  11950.  pEnvironment  to the environment buffer.
  11951.  
  11952.  pParmBlock  to the parameter block for WriteTTY, defined as the following
  11953.  structure:
  11954.  
  11955.  typedef struct {
  11956.      USHORT usLength;            /* ParmBlock = 14 bytes              */
  11957.      USHORT fsFlags;             /* bit 0=0--do not update PVB        */
  11958.                                  /* bit 0=1--update the PVB also      */
  11959.                                  /* bit 1=0--may update LVB also      */
  11960.                                  /* bit 1=1--must update LVB          */
  11961.                                  /* bit 2=0--ANSI not enabled         */
  11962.                                  /* bit 2=1--ANSI enabled             */
  11963.                                  /* bit 3=0--Ctrl+PrtSc not enabled   */
  11964.                                  /* bit 3=1--Ctrl+PrtSc enabled       */
  11965.                                  /* bits 4-15 must be 0 (reserved)    */
  11966.      USHORT selLVBSel;           /* huge (max 1MB) LVB selector       */
  11967.      ULONG  pchString;           /* far pointer to character string   */
  11968.                                  /*    to be written                  */
  11969.      USHORT cbStrLen;            /* length of character string        */
  11970.      USHORT hfPrinter;           /* printer device handle if          */
  11971.                                  /*   Ctrl+PrtSc enabled              */
  11972.  } VDH_WRTTTY;
  11973.  
  11974.  
  11975.  ulFunction  WriteTTY in the call vector table; its value is 278L (0x0116).
  11976.  
  11977.  
  11978.  Return Value
  11979.  
  11980.  If it is successful, WriteTTY should return zero (to the ax register when
  11981.  coded in assembly language). Otherwise, it should return one of the
  11982.  following errors when it encounters any one of the following conditions:
  11983.  
  11984.  Return                            Conditions
  11985.  ────────────────────────────────────────────────────────────────────────────
  11986.  
  11987.  ERROR_VIO_INVALID_PARMS           If the BVH provides a WriteTTY function
  11988.                                    and if the ulFunction value is anything
  11989.                                    except 278L (0x0116); if the ParmBlock
  11990.                                    fsFlags field has any of bits 4 to 15
  11991.                                    set; or if the pEnvironment value is
  11992.                                    zero.
  11993.  
  11994.  ERROR_INVALID_LENGTH              If the ParmBlock usLength value is not
  11995.                                    14; or if the cbStrLen value is zero.
  11996.  
  11997.  ERROR_VIO_MODE                    If a check of the fbType value in the
  11998.                                    environment buffer's VDHMODEINFO data
  11999.                                    indicates graphics mode.
  12000.  
  12001.  
  12002.  
  12003.  
  12004.  Comments
  12005.  
  12006.  A WriteTTY function is optional. Most BVHs can use the default WriteTTY
  12007.  support provided by BVS. BVS supplies a default (text-mode) WriteTTY routine
  12008.  with the same level of support as MS OS/2 version 1.1.
  12009.  
  12010.  However, unique video adapters can have unique needs, so a BVH may supply a
  12011.  WriteTTY of its own to replace the default BVS routine.
  12012.  
  12013.  An odd value for the fsFlags field implies that the calling application is
  12014.  running in the foreground and that WriteTTY must send output to the physical
  12015.  display. This field may be a combination (OR) of the following values:
  12016.  
  12017.  Value                             Meaning
  12018.  ────────────────────────────────────────────────────────────────────────────
  12019.  
  12020.  0x0001                            The PVB must be updated. Otherwise, the
  12021.                                    PVB may not be updated.
  12022.  
  12023.  0x0002                            The LVB must be updated. Otherwise, the
  12024.                                    LVB may be updated.
  12025.  
  12026.  0x0004                            ANSI is enabled, so the BVH must process
  12027.                                    any ANSI escape sequences in the string
  12028.                                    accessed by the ParmBlock pchString
  12029.                                    value. Otherwise, ANSI is disabled, and
  12030.                                    the WriteTTY function should handle any
  12031.                                    ANSI escape sequences as text data.
  12032.  
  12033.  0x0008                            CTRL+PRTSC is active, and WriteTTY must
  12034.                                    echo its output to the printer specified
  12035.                                    by the ParmBlock hfPrinter parameter.
  12036.  
  12037.  If CTRL+PRTSC is active but WriteTTY cannot open the device specified in the
  12038.  hfPrinter field, this routine may call DosBeep to indicate an error.
  12039.  
  12040.  For a BVH that supports DBCS (double-byte character set) text display,
  12041.  WriteTTY should do the following:
  12042.  
  12043.    ■   Substitute a blank (single-cell space character) for any double-cell
  12044.        DBCS character that would be bisected at the last column of the
  12045.        display, and write the full double-cell character in the following
  12046.        row.
  12047.  
  12048.    ■   Save any double-cell DBCS leading byte that occurs as the last
  12049.        character in an application-supplied string until it can be written
  12050.        with its corresponding trailing byte when WriteTTY is called again.
  12051.  
  12052.    ■   Ignore control codes (carriage return, linefeed, backspace, tab, or
  12053.        bell characters) that are passed as the trailing byte of a double-cell
  12054.        character.
  12055.  
  12056.    ■   Process every backspace one at a time, even if a backspace positions
  12057.        the cursor at the trailing byte of a double-cell character. It is the
  12058.        application's responsibility to supply backspace control codes that
  12059.        maintain a correct cursor position with respect to double-cell
  12060.        characters.
  12061.  
  12062.  
  12063.  
  12064.  
  12065.  
  12066.  
  12067.  
  12068.  See Also
  12069.  
  12070.  DosBeep, PrintScreen, VioWrtTTY
  12071.  
  12072.  
  12073.  
  12074.  
  12075.  
  12076.  
  12077.  Chapter 5  Mouse Device Drivers
  12078.  ────────────────────────────────────────────────────────────────────────────
  12079.  
  12080.  
  12081.  
  12082.  
  12083.  5.1  Introduction
  12084.  
  12085.  MS OS/2 version 1.2 supplies the driver named mouse$ that provides all
  12086.  device-independent support for mouse devices. The mouse$ driver supports all
  12087.  of the following:
  12088.  
  12089.    ■   MS OS/2 standard category 07 IOCtl functions.
  12090.  
  12091.    ■   An IDC (inter-device driver communication) interface to the
  12092.        pointer-draw driver (named pointer$).
  12093.  
  12094.    ■   The standard Int 33H interface to the real-mode mouse.
  12095.  
  12096.    ■   An IDC interface with the system's device-dependent mouse drivers and
  12097.        to any device-dependent drivers that are add-ons.
  12098.  
  12099.  
  12100.  The mouse$ driver must be specified following the device-dependent driver in
  12101.  the config.sys file so that mouse$ can establish IDC to the newly installed
  12102.  device-dependent driver.
  12103.  
  12104.  A device-dependent driver communicates directly only with the kernel, with
  12105.  its device, and with the system's mouse$ driver.
  12106.  
  12107.  
  12108.  5.2  System-supplied IDC Functions
  12109.  
  12110.  The mouse$ driver's IDC interface to device-dependent drivers includes the
  12111.  following two callable functions:
  12112.  
  12113.  Function code                     Function
  12114.  ────────────────────────────────────────────────────────────────────────────
  12115.  
  12116.  00001H                            ProcessPacket Processes a packet of data
  12117.                                    that is gotten from the device when an
  12118.                                    interrupt occurs, formatted, and written
  12119.                                    into a shared data buffer by the
  12120.                                    device-dependent driver.
  12121.  
  12122.  0002H                             DisableSupport Stops the mouse$ driver
  12123.                                    from routing API calls to the
  12124.                                    device-dependent driver as it processes
  12125.                                    a Deinstall request from the kernel. For
  12126.                                    more information about Deinstall, see
  12127.                                    Section 5.3.2.2.
  12128.  
  12129.  The device-dependent driver must pass required parameters in specific
  12130.  registers when it calls these functions. For detailed information about
  12131.  ProcessPacket and DisableSupport, see Section 5.4.
  12132.  
  12133.  
  12134.  5.3  Device-dependent Driver Requirements
  12135.  
  12136.  Device-dependent mouse drivers also have an IDC interface to the system's
  12137.  mouse$ driver. Such a driver must set up its header indicating that it
  12138.  participates in inter-device driver communication.
  12139.  
  12140.  Such a driver also must allocate storage in its primary data segment for the
  12141.  mouse$'s IDC addresses, as defined by the following structure:
  12142.  
  12143.  Attach_DD  struc
  12144.      RealEntry   dd  ?       ; real-mode entry point
  12145.      RealDS      dw  ?       ; real-mode data segment
  12146.      ProtEntry   dd  ?       ; protected-mode entry point
  12147.      ProtDS      dw  ?       ; protected-mode data selector
  12148.  Attach_DD ends
  12149.  
  12150.  
  12151.  For more information about device driver headers and drivers' primary data
  12152.  segments, see Chapter 1, "Overview of Base and Installable Device Drivers."
  12153.  
  12154.  
  12155.  5.3.1  Driver-supplied IDC Functions
  12156.  
  12157.  The device-dependent driver must supply the following five IDC functions
  12158.  that the mouse$ driver calls:
  12159.  
  12160.  Function code                     Function
  12161.  ────────────────────────────────────────────────────────────────────────────
  12162.  
  12163.  0001H                             Query_Config Returns device
  12164.                                    configuration data for the attached
  12165.                                    device.
  12166.  
  12167.  0002H                             Read_Enable Calls the DevHlp routine
  12168.                                    AttachDD if the device-dependent driver
  12169.                                    has not yet established IDC to mouse$;
  12170.                                    always updates a flag indicating that
  12171.                                    the device-dependent driver may transfer
  12172.                                    data from the device into a shared
  12173.                                    buffer in the mouse$ driver's data
  12174.                                    segment and may call the ProcessPacket
  12175.                                    function (see Section 5.2).
  12176.  
  12177.  0003H                             Read_Disable Updates a flag indicating
  12178.                                    that the device-dependent driver must
  12179.                                    wait for a Read_Enable call before it
  12180.                                    transfers data from the device into the
  12181.                                    shared buffer and calls ProcessPacket.
  12182.  
  12183.  0004H                             Enable_Device Re-enables or reactivates
  12184.                                    the device, if necessary; enables
  12185.                                    interrupts at the port or at the device.
  12186.  
  12187.  0005H                             Disable_Device Disables interrupts at
  12188.                                    the port or the device; makes the device
  12189.                                    quiescent, if necessary. ,
  12190.  
  12191.  The device-dependent driver finds required parameters in specific registers
  12192.  when these functions are called. For detailed information about the
  12193.  Query_Config, Read_Enable, Read_Disable, Enable_Device, and Disable_Device
  12194.  functions, see Section 5.4.
  12195.  
  12196.  For more information about the AttachDD routine, see Chapter 3, "Device
  12197.  Helper Services."
  12198.  
  12199.  
  12200.  5.3.2  Driver Command Support
  12201.  
  12202.  The device-dependent driver must provide full support for Init and Deinstall
  12203.  requests from the kernel. For all other requests, the driver's strategy
  12204.  routine may return the request packet with the standard error "Unknown
  12205.  command" (error code 03) and the error and done bits set in the Status field
  12206.  of the request packet.
  12207.  
  12208.  For more information about Init, Deinstall, and the request packet's Status
  12209.  field, see Chapter 2, "Device Commands."
  12210.  
  12211.  
  12212.  5.3.2.1  Driver Initialization
  12213.  
  12214.  When the device-dependent driver installs, it must do the following:
  12215.  
  12216.    ■   Validate the machine it is loading on (IBM PC-AT, PS/2, Model 30-286,
  12217.        etc.).
  12218.  
  12219.    ■   Validate the presence of its device (adapter, ports, etc.).
  12220.  
  12221.    ■   Claim an exclusive or shared IRQ, as appropriate to the machine class.
  12222.        A serial driver is guaranteed exclusive access to the requested I/O
  12223.        port, but it cannot have exclusive access to a device interrupt.
  12224.        Drivers on a PS/2 that use ABIOS (advanced basic I/O system) services
  12225.        must not request a predetermined interrupt level and must share the
  12226.        IRQ level.
  12227.  
  12228.    ■   Disable the device until IDC initialization is complete (when the
  12229.        device-dependent driver's Read_Enable function has established IDC to
  12230.        the mouse$ driver).
  12231.  
  12232.    ■   Process the serial configuration command, if any, in config.sys. The
  12233.        default value for serial is com1; this value may be com1 or com2 on
  12234.        AT-class machines and may be com1 through com8 on PS/2 machines. The
  12235.        model parameter is valid only for the system-supplied drivers msser$
  12236.        (model=099) and msbus$ (model=199).
  12237.  
  12238.  
  12239.  The mouse$ driver processes the mode, qsize, and type configuration commands
  12240.  in config.sys. The device-dependent driver's file name is the required
  12241.  parameter to the type command.
  12242.  
  12243.  Device-dependent drivers should follow the MS OS/2 standard naming
  12244.  convention for their file names. The format of a driver file name is a
  12245.  six-letter name, followed by a two-digit version number, followed by the
  12246.  extension sys.
  12247.  
  12248.  
  12249.  5.3.2.2  Driver Deinstallation
  12250.  
  12251.  If the kernel sends a Deinstall request to the device-dependent driver, it
  12252.  must do the following:
  12253.  
  12254.    ■   Call the DisableSupport function through the IDC entry point for the
  12255.        current mode (protected or real).
  12256.  
  12257.    ■   Deinstall itself, releasing its IRQ, allocated memory, LID (logical
  12258.        ID) if the driver uses ABIOS services, etc.
  12259.  
  12260.  
  12261.  For more information about DisableSupport, see Sections 5.2 and 5.4. For
  12262.  more information about IDC entry points, see Section 5.3.
  12263.  
  12264.  
  12265.  5.3.3  Interrupt Handling
  12266.  
  12267.  The device-dependent driver must supply an interrupt handler to service
  12268.  interrupts from its device. Once it has established IDC with the mouse$
  12269.  driver, the device-dependent driver's interrupt handler must keep track of
  12270.  two things:
  12271.  
  12272.    ■   Whether the mouse$ driver is ready to process data from the device.
  12273.  
  12274.    ■   Whether the interrupt is enabled for its device.
  12275.  
  12276.  
  12277.  To track these states, the device-dependent driver maintains a DevStatus
  12278.  flag that may be a combination of the following values:
  12279.  
  12280.  Value                             Meaning
  12281.  ────────────────────────────────────────────────────────────────────────────
  12282.  
  12283.  0001H                             READENABLE─The mouse$ driver is ready to
  12284.                                    receive data from the device-dependent
  12285.                                    driver.
  12286.  
  12287.  0002H                             ATTACHED─IDC has been established with
  12288.                                    the mouse$ driver (the device-dependent
  12289.                                    driver has IDC addresses stored in its
  12290.                                    primary data segment).
  12291.  
  12292.  0004H                             IRQENABLED─The driver has claimed an IRQ
  12293.                                    for the device.
  12294.  
  12295.  0008H                             DEINSTALLED─The device-dependent driver
  12296.                                    has deinstalled itself (the mouse$
  12297.                                    driver must deinstall itself next).
  12298.  
  12299.  0010H                             DEVICEENABLED─Interrupts are enabled at
  12300.                                    the port or the device, and the device
  12301.                                    itself is enabled.
  12302.  
  12303.  When DEVICEENABLED and IRQENABLED are set, the device-dependent driver may
  12304.  get data from its device and store it in a common format (for details, see
  12305.  the ProcessPacket function in Section 5.4) in the driver's data segment.
  12306.  However, the device-dependent driver may not transfer this data into the
  12307.  shared buffer provided by the mouse$ driver, nor may it call ProcessPacket,
  12308.  unless ATTACHED and READENABLE are also set.
  12309.  
  12310.  When an interrupt occurs, the device-dependent driver's interrupt handler
  12311.  should do the following:
  12312.  
  12313.    ■   Check whether the interrupt belongs to its device. If the interrupt
  12314.        does not belong, set the carry flag and return. Note that this
  12315.        interrupt handler, like every MS OS/2 interrupt handler, must use an
  12316.        inter-segment (far) ret instruction to return control to the system.
  12317.  
  12318.    ■   Otherwise, disable the device and call the DevHlp routine EOI. The
  12319.        interrupt handler should disable its device in the same manner as the
  12320.        driver's Disable_Device function, which must preserve the state of the
  12321.        interrupt flag (see Section 5.4).
  12322.  
  12323.    ■   Transfer formatted data to the shared buffer in the mouse$ driver's
  12324.        data segment, using the mouse$ driver's IDC ds address for the current
  12325.        mode. Call the ProcessPacket function when data transfer is complete.
  12326.  
  12327.    ■   If the device is disabled on return from ProcessPacket, re-enable the
  12328.        device. The interrupt handler should enable its device in the same
  12329.        manner as the driver's Enable_Device function, which must preserve the
  12330.        state of the interrupt flag (see Section 5.4).
  12331.  
  12332.    ■   Disable interrupts and clear the carry flag just before the interrupt
  12333.        handler returns control to the system.
  12334.  
  12335.  
  12336.  The device-dependent driver may call its own Disable_Device and
  12337.  Enable_Device functions, as long as these functions do not call any DevHlp
  12338.  routines that are illegal at interrupt time.
  12339.  
  12340.  For more information about EOI and the other interrupt-time DevHlp routines,
  12341.  see Chapter 3, "Device Helper Services."
  12342.  
  12343.  
  12344.  5.4  Mouse IDC Function Reference
  12345.  
  12346.  The following sections describe both the system-supplied and driver-required
  12347.  mouse IDC functions, in alphabetic order.
  12348.  
  12349.  For the system-supplied functions ProcessPacket and DisableSupport, this
  12350.  section shows which registers must contain particular parameters when the
  12351.  device-dependent driver makes the call.
  12352.  
  12353.  For the driver-supplied functions Query_Config, Read_Enable, Read_Disable,
  12354.  Enable_Device, and Disable_Device, this section shows the contents of
  12355.  particular registers that each function can use when it is called.
  12356.  
  12357.  
  12358.  █    Disable_Device (0005H)
  12359.  ────────────────────────────────────────────────────────────────────────────
  12360.  
  12361.  
  12362.  AX =  0005H                 ; Disable_Device function code
  12363.  DS =  DD's DataSeg          ; (called) device-dependent driver's DS
  12364.  ES =  mouse$'s DataSeg      ; (caller) device-independent driver's DS
  12365.                              ; BX, CX, DX, DI, and SI undefined
  12366.  
  12367.  
  12368.  The Disable_Device function disables interrupts from the device, either at
  12369.  the port or at the device. If necessary, Disable_Device "sleeps" the device
  12370.  as well.
  12371.  
  12372.  
  12373.  Return Value
  12374.  
  12375.  
  12376.  AX = nonzero (error) if carry flag set, undefined if carry clear
  12377.  ES = mouse$'s DataSeg       ; (caller) device-independent driver's DS
  12378.                              ; (unchanged or restored to input value)
  12379.                              ; BX, CX, DX, SI, DI, and DS undefined
  12380.  
  12381.  
  12382.  
  12383.  
  12384.  
  12385.  Comments
  12386.  
  12387.  The device-dependent driver supplies the Disable_Device function.
  12388.  
  12389.  Disable_Device must preserve the state of the interrupt flag, but it may
  12390.  disable interrupts using the cli instruction while it disables the device.
  12391.  
  12392.  Disable_Device updates the device-dependent driver's DevStatus flag with the
  12393.  following value:
  12394.  
  12395.  Value                             Meaning
  12396.  ────────────────────────────────────────────────────────────────────────────
  12397.  
  12398.  NOT DEVICEENABLED                 Bit 4 clear─The device-dependent driver
  12399.                                    has disabled interrupts from its device.
  12400.                                    Disable_Device has also put the device
  12401.                                    into an inactive state, if disabling its
  12402.                                    interrupt does not make the device
  12403.                                    quiescent.
  12404.  
  12405.  The mouse$ driver calls Disable_Device when it must have interrupts from the
  12406.  device disabled at task or interrupt time.
  12407.  
  12408.  
  12409.  
  12410.  
  12411.  See Also
  12412.  
  12413.  Enable_Device
  12414.  
  12415.  
  12416.  █    DisableSupport (0002H)
  12417.  ────────────────────────────────────────────────────────────────────────────
  12418.  
  12419.  
  12420.  
  12421.  
  12422.  Parameters
  12423.  
  12424.  ax  the value 0002H, which is the function code for DisableSupport.
  12425.  
  12426.  es  the selector or segment for the device-dependent driver's primary data
  12427.  segment. This value depends on the current operating mode (protected or
  12428.  real).
  12429.  
  12430.  IDC_DataSeg  the IDC (inter-device driver communication) selector or segment
  12431.  value for the mouse$ driver's data segment. The device-dependent driver
  12432.  stored the IDC addresses in its own data segment at the initial call to
  12433.  Read_Enable; it must use the appropriate value for the current operating
  12434.  mode.
  12435.  
  12436.  IDC_Entry  the selector:offset or segment:offset value for the mouse$
  12437.  driver's IDC entry point. The device-dependent driver must use the
  12438.  appropriate value for the current operating mode.
  12439.  
  12440.  
  12441.  Return Value
  12442.  
  12443.  
  12444.  AX = nonzero (error) if carry flag set, undefined if carry clear
  12445.  DS = mouse$'s DataSeg       ; (called) device-independent driver's DS
  12446.  ES = DD's DataSeg           ; (unchanged or restored to input value)
  12447.                              ; BX, CX, DX, DI, and SI undefined
  12448.  
  12449.  
  12450.  
  12451.  
  12452.  
  12453.  Comments
  12454.  
  12455.  The mouse$ driver supplies the DisableSupport function.
  12456.  
  12457.  The device-dependent driver calls DisableSupport if it gets a Deinstall
  12458.  request from the kernel. For more information about deinstallation, see
  12459.  Section 5.3.2.2.
  12460.  
  12461.  The device-dependent driver cannot make this call if its DevStatus flag
  12462.  shows the following value:
  12463.  
  12464.  Value                             Meaning
  12465.  ────────────────────────────────────────────────────────────────────────────
  12466.  
  12467.  NOT ATTACHED                      Bit 1 clear─The device-dependent driver
  12468.                                    has not yet called the DevHlp routine
  12469.                                    AttachDD, or the call failed, so IDC has
  12470.                                    not been established with the mouse$
  12471.                                    driver. For more information about
  12472.                                    AttachDD, see Chapter 3, "Device Helper
  12473.                                    Services."
  12474.  
  12475.  DisableSupport prevents the mouse$ driver from routing API calls to the
  12476.  device-dependent driver while it shuts down its device and releases the IRQ
  12477.  level that it claimed at initialization.
  12478.  
  12479.  
  12480.  █    Enable_Device (0004H)
  12481.  ────────────────────────────────────────────────────────────────────────────
  12482.  
  12483.  
  12484.  AX =  0004H                 ; Enable_Device function code
  12485.  DS =  DD's DataSeg          ; (called) device-dependent driver's DS
  12486.  ES =  mouse$'s DataSeg      ; (caller) device-independent driver's DS
  12487.                              ; BX, CX, DX, DI, and SI undefined
  12488.  
  12489.  
  12490.  The Enable_Device function enables interrupts from the device, either at the
  12491.  port or at the device itself, and, if necessary, reactivates the device as
  12492.  well.
  12493.  
  12494.  
  12495.  Return Value
  12496.  
  12497.  
  12498.  AX = nonzero (error) if carry flag set, undefined if carry clear
  12499.  ES = mouse$'s DataSeg       ; (caller) device-independent driver's DS
  12500.                              ; (unchanged or restored to input value)
  12501.                              ; BX, CX, DX, SI, DI, and DS undefined
  12502.  
  12503.  
  12504.  
  12505.  
  12506.  
  12507.  Comments
  12508.  
  12509.  The device-dependent driver supplies the Enable_Device function.
  12510.  
  12511.  Enable_Device must preserve the state of the interrupt flag, but it may
  12512.  disable interrupts using the cli instruction while it enables the device.
  12513.  
  12514.  Enable_Device updates the device-dependent driver's DevStatus flag with the
  12515.  following value:
  12516.  
  12517.  Value                             Meaning
  12518.  ────────────────────────────────────────────────────────────────────────────
  12519.  
  12520.  DEVICEENABLED                     Bit 4 set─The device-dependent driver
  12521.                                    has enabled interrupts from the device
  12522.                                    and restored it to the operational state
  12523.                                    that existed before the Disable_Device
  12524.                                    function was called.
  12525.  
  12526.  The mouse$ driver calls Enable_Device when it has completed task-time or
  12527.  interrupt-time operations that required interrupts from the device to be
  12528.  disabled.
  12529.  
  12530.  
  12531.  
  12532.  
  12533.  See Also
  12534.  
  12535.  Disable_Device
  12536.  
  12537.  
  12538.  █    ProcessPacket (0001H)
  12539.  ────────────────────────────────────────────────────────────────────────────
  12540.  
  12541.  
  12542.  
  12543.  
  12544.  Parameters
  12545.  
  12546.  ax  the value 0001H, which is the function code for ProcessPacket.
  12547.  
  12548.  es  the selector or segment for the device-dependent driver's primary data
  12549.  segment. This value depends on the current operating mode (protected or
  12550.  real).
  12551.  
  12552.  IDC_DataSeg  the IDC (inter-device driver communication) selector or segment
  12553.  value for the mouse$ driver's data segment. The device-dependent driver
  12554.  stored the IDC addresses in its own data segment at the initial call to
  12555.  Read_Enable; it must use the appropriate value for the current operating
  12556.  mode.
  12557.  
  12558.  IDC_Entry  the selector:offset or segment:offset value for the mouse$
  12559.  driver's IDC entry point. The device-dependent driver must use the
  12560.  appropriate value for the current operating mode.
  12561.  
  12562.  
  12563.  Return Value
  12564.  
  12565.  
  12566.  AX = nonzero (error) if carry flag set, undefined if carry clear
  12567.  DS = mouse$'s DataSeg       ; (called) device-independent driver's DS
  12568.  ES = DD's DataSeg           ; (unchanged or restored to input value)
  12569.                              ; BX, CX, DX, DI, and SI undefined
  12570.  
  12571.  
  12572.  
  12573.  
  12574.  
  12575.  Comments
  12576.  
  12577.  The mouse$ driver supplies the ProcessPacket function.
  12578.  
  12579.  When an interrupt occurs, the device-dependent driver puts device data into
  12580.  a shared buffer in the mouse$ driver's data segment. The offset to this
  12581.  buffer was passed in the Read_Enable call.
  12582.  
  12583.  The device-dependent driver's interrupt handler calls ProcessPacket when it
  12584.  has completed getting, formatting, and transferring device data into this
  12585.  buffer. The buffer has the following structure:
  12586.  
  12587.  mouse_data  struc
  12588.     butn_stat  dw  ?  ; button-status flags:
  12589.                       ; bit 0=1--pure motion (no buttons pressed)
  12590.                       ; bit 1=1--button 1 pressed with motion
  12591.                       ; bit 2=1--button 1 pressed without motion
  12592.                       ; bit 3=1--button 2 pressed with motion
  12593.                       ; bit 4=1--button 2 pressed without motion
  12594.                       ; bit 5=1--button 3 pressed with motion
  12595.                       ; bit 6=1--button 3 pressed without motion
  12596.     col_micks  dw  ?  ; relative column mickey motion:
  12597.                       ; +cols/pels = to right, -cols/pels = to left
  12598.     row_micks  dw  ?  ; relative row mickey motion:
  12599.                       ; +rows/pels = up, -rows/pels = down
  12600.  mouse_data  ends
  12601.  
  12602.  
  12603.  The device-dependent driver reports mickey motion to the right or up as
  12604.  positive. It reports motion down or to the left as negative.
  12605.  
  12606.  The device-dependent driver must have its device disabled when it calls
  12607.  ProcessPacket.
  12608.  
  12609.  For more information about interrupt-handling requirements, see Section
  12610.  5.3.3.
  12611.  
  12612.  
  12613.  
  12614.  
  12615.  See Also
  12616.  
  12617.  Disable_Device, Read_Enable
  12618.  
  12619.  
  12620.  █    Query_Config (0001H)
  12621.  ────────────────────────────────────────────────────────────────────────────
  12622.  
  12623.  
  12624.  AX =  0001H                 ; Query_Config function code
  12625.  DS =  DD's DataSeg          ; (called) device-dependent driver's DS
  12626.  ES =  mouse$'s DataSeg      ; (caller) device-independent driver's DS
  12627.  DI =  OFFSET Buffer         ; in mouse$'s DataSeg (shared)
  12628.                              ; BX, CX, DX, and SI undefined
  12629.  
  12630.  
  12631.  The Query_Config function returns configuration data for the attached device
  12632.  after the mouse$ driver has initialized IDC (inter-device driver
  12633.  communication) with the device-dependent driver and vice versa.
  12634.  
  12635.  
  12636.  Parameters
  12637.  
  12638.  es:di  a protected-mode selector offset. On entry, this register pair points
  12639.  to a buffer in the mouse$ driver's data segment. The device-dependent driver
  12640.  returns the configuration data to this shared buffer when the call to
  12641.  Query_Config occurs. This buffer has the following structure:
  12642.  
  12643.  config_data struc
  12644.      length    dw  ?  ; max=6 bytes (length of structure)
  12645.      num_micks db  ?  ; device resolution, mickeys/cm
  12646.      num_butn  db  ?  ; number of device buttons
  12647.      dev_irq   db  ?  ; device IRQ level
  12648.      mousetype db  ?  ; 0=unknown, 1=bus, 2=serial, 3=inport,
  12649.                       ; 4=inboard (5-255 reserved)
  12650.  config_data  ends
  12651.  
  12652.  
  12653.  On entry, the length field specifies the number of bytes of data to be
  12654.  returned.
  12655.  
  12656.  
  12657.  Return Value
  12658.  
  12659.  
  12660.  AX = nonzero (error) if carry flag set, undefined if carry clear
  12661.  ES = mouse$'s DataSeg ; (caller) device-independent driver's DS
  12662.  DI = OFFSET Buffer    ; in mouse$'s DataSeg (shared)
  12663.                        ; (ES:DI unchanged or restored to input values)
  12664.                        ; BX, CX, DX, SI, and DS undefined
  12665.  
  12666.  
  12667.  
  12668.  
  12669.  
  12670.  Comments
  12671.  
  12672.  The device-dependent driver supplies the Query_Config function.
  12673.  
  12674.  Query_Config writes the device-dependent driver's configuration data into a
  12675.  buffer in the mouse$ driver's data segment.
  12676.  
  12677.  
  12678.  
  12679.  
  12680.  See Also
  12681.  
  12682.  Read_Enable
  12683.  
  12684.  
  12685.  █    Read_Disable (0003H)
  12686.  ────────────────────────────────────────────────────────────────────────────
  12687.  
  12688.  
  12689.  AX =  0003H                 ; Read_Disable function code
  12690.  DS =  DD's DataSeg          ; (called) device-dependent driver's DS
  12691.  ES =  mouse$'s DataSeg      ; (caller) device-independent driver's DS
  12692.                              ; BX, CX, DX, DI and SI undefined
  12693.  
  12694.  
  12695.  The Read_Disable function updates a software flag to disable data transfers
  12696.  from the device until a subsequent Read_Enable call occurs.
  12697.  
  12698.  
  12699.  Return Value
  12700.  
  12701.  
  12702.  AX = nonzero (error) if carry flag set, undefined if carry clear
  12703.  ES = mouse$'s DataSeg       ; (caller) device-independent driver's DS
  12704.                              ; (unchanged or restored to input value)
  12705.                              ; BX, CX, DX, SI, DI, and DS undefined
  12706.  
  12707.  
  12708.  
  12709.  
  12710.  
  12711.  Comments
  12712.  
  12713.  The device-dependent driver supplies the Read_Disable function.
  12714.  
  12715.  Read_Disable updates the device-dependent driver's DevStatus flag with the
  12716.  following value:
  12717.  
  12718.  Value                             Meaning
  12719.  ────────────────────────────────────────────────────────────────────────────
  12720.  
  12721.  NOT READENABLE                    Bit 0 clear─The device-dependent
  12722.                                    driver's interrupt handler may get data
  12723.                                    if an interrupt occurs at the device,
  12724.                                    but it may not reference the shared
  12725.                                    buffer in the mouse$ driver's data
  12726.                                    segment, and it may not call the
  12727.                                    ProcessPacket function. '
  12728.  
  12729.  Read_Disable should disable interrupts, reset bit 0 of the DevStatus flag,
  12730.  and enable interrupts again.
  12731.  
  12732.  The interrupt handler must save any data that it gets locally until
  12733.  Read_Enable has been called to set bit 0 of the DevStatus flag. In
  12734.  particular, the device-dependent driver must not reference the shared data
  12735.  buffer in the mouse$ driver's data segment.
  12736.  
  12737.  The MS OS/2 mouse$ driver calls Read_Disable if it suspends data-packet
  12738.  processing and is not ready to receive data transferred from the device.
  12739.  
  12740.  
  12741.  
  12742.  
  12743.  See Also
  12744.  
  12745.  Enable_Device, ProcessPacket, Read_Enable
  12746.  
  12747.  
  12748.  █    Read_Enable (0002H)
  12749.  ────────────────────────────────────────────────────────────────────────────
  12750.  
  12751.  
  12752.  AX =  0002H                 ; Read_Enable function code
  12753.  DS =  DD's DataSeg          ; (called) device-dependent driver's DS
  12754.  ES =  mouse$'s DataSeg      ; (caller) device-independent driver's DS
  12755.  DI =  OFFSET Buffer         ; in mouse$'s DataSeg (shared)
  12756.                              ; BX, CX, DX, and SI undefined
  12757.  
  12758.  
  12759.  The Read_Enable function updates a software flag that enables the
  12760.  device-dependent driver to transfer data to the mouse$ driver. Read_Enable
  12761.  also attaches the device-dependent driver to mouse$, if it is not already
  12762.  attached, in order to get IDC (inter-device driver communication) entry
  12763.  addresses for the ProcessPacket function and IDC selector and segment values
  12764.  for the mouse$ driver's data segment.
  12765.  
  12766.  
  12767.  Parameters
  12768.  
  12769.  es:di  a protected-mode selector:offset, since Read_Enable is called just
  12770.  after the mouse$ driver installs. On entry, this register pair points to a
  12771.  shared buffer in the mouse$ driver's data segment. The device-dependent
  12772.  driver should save the offset value so that its interrupt handler can return
  12773.  data to the buffer, using the mouse$ driver's IDC ds value for the current
  12774.  mode. For more information about the structure of the buffer, see the
  12775.  ProcessPacket function.
  12776.  
  12777.  
  12778.  Return Value
  12779.  
  12780.  
  12781.  AX = nonzero (error) if carry flag set, undefined if carry clear
  12782.  ES = mouse$'s DataSeg       ; (caller) device-independent driver's DS
  12783.                              ; (unchanged or restored to input value)
  12784.                              ; BX, CX, DX, SI, DI, and DS undefined
  12785.  
  12786.  
  12787.  
  12788.  
  12789.  
  12790.  Comments
  12791.  
  12792.  The device-dependent driver supplies the Read_Enable function.
  12793.  
  12794.  Read_Enable updates the device-dependent driver's DevStatus flag with one or
  12795.  both of the following values:
  12796.  
  12797.  Value                             Meaning
  12798.  ────────────────────────────────────────────────────────────────────────────
  12799.  
  12800.  READENABLE                        Bit 0 set─The device-dependent driver's
  12801.                                    interrupt handler may write device data
  12802.                                    into the shared buffer and call the
  12803.                                    ProcessPacket function.
  12804.  
  12805.  ATTACHED                          Bit 1 set─The device-dependent driver
  12806.                                    has copies of the mouse$ driver's IDC
  12807.                                    addresses stored in its primary data
  12808.                                    segment.
  12809.  
  12810.  If the device-dependent driver does not have copies of the mouse$ driver's
  12811.  IDC addresses already, Read_Enable must call the DevHlp routine AttachDD to
  12812.  get these addresses. Read_Enable sets bit 1 of the DevStatus flag when the
  12813.  AttachDD call succeeds. If the AttachDD call fails, the kernel sends a
  12814.  Deinstall request to the device-dependent driver.
  12815.  
  12816.  For more information about IDC addresses, see Section 5.3. For more
  12817.  information about AttachDD, see Chapter 3, "Device Helper Services." For
  12818.  more information about deinstallation, see Section 5.3.2.2.
  12819.  
  12820.  The driver's interrupt handler must use the mouse$ driver's IDC ds value for
  12821.  the current mode (protected or real) with the offset value passed in the si
  12822.  register to transfer data into the shared buffer. It must also use the IDC
  12823.  entry address for the current mode when it calls the ProcessPacket function.
  12824.  
  12825.  
  12826.  The MS OS/2 mouse$ driver calls Read_Enable when it has set up data-packet
  12827.  processing and is ready to receive data from the device.
  12828.  
  12829.  
  12830.  
  12831.  
  12832.  See Also
  12833.  
  12834.  Enable_Device, ProcessPacket, Read_Disable
  12835.  
  12836.  
  12837.  
  12838.  
  12839.  
  12840.  
  12841.  Chapter 6  Overview of Presentation Manager Device Drivers
  12842.  ────────────────────────────────────────────────────────────────────────────
  12843.  
  12844.  
  12845.  
  12846.  
  12847.  6.1  Introduction
  12848.  
  12849.  This chapter describes MS OS/2 Presentation Manager device drivers, the
  12850.  graphics engine, installed simulations, and the components of a Presentation
  12851.  Manager device driver.
  12852.  
  12853.  
  12854.  6.2  Overview
  12855.  
  12856.  To create output on a device, Presentation Manager applications call down to
  12857.  the graphics engine through the window manager and the graphics programming
  12858.  interface (GPI). The graphics engine is the heart of Presentation Manager
  12859.  graphics. It processes many graphics requests from GPI and the window
  12860.  manager and passes other calls to a device driver. A device driver, in turn,
  12861.  converts the calls to device-specific instructions and passes those
  12862.  instructions to the device, which creates output. The following illustration
  12863.  shows the relationship between a Presentation Manager application, the
  12864.  window manager, the graphics programming interface, the graphics engine, the
  12865.  installed simulations, a device driver, and a device:
  12866.  
  12867.  (This figure may be found in the printed book).
  12868.  
  12869.  .AR 168p
  12870.  
  12871.  
  12872.  6.3  The Graphics Engine
  12873.  
  12874.  The graphics engine is a dynamic-link library containing functions that do
  12875.  the following tasks:
  12876.  
  12877.    ■   Process graphics requests from GPI and the window manager using the
  12878.        dispatch table.
  12879.  
  12880.    ■   Manage the engine's device context (DC).
  12881.  
  12882.    ■   Manage local identifiers (LCIDs) for fonts and bitmaps.
  12883.  
  12884.    ■   Create, alter, and destroy journal files.
  12885.  
  12886.  
  12887.  
  12888.  
  12889.  6.3.1  Graphics Engine Functions
  12890.  
  12891.  The graphics engine functions, like most API functions, are device
  12892.  independent. These functions process data for any output device that a
  12893.  Presentation Manager device driver supports.
  12894.  
  12895.  
  12896.  6.3.2  Graphics Engine Dispatch Table
  12897.  
  12898.  The graphics engine processes some graphics requests from GPI and the window
  12899.  manager and passes other calls to a device driver. The engine keeps track of
  12900.  which calls it should process and which calls it should pass─via a dispatch
  12901.  table─to the driver. A dispatch table is an array of function addresses that
  12902.  resides in the engine's heap. When GPI or the window manager calls the
  12903.  engine, the engine locates the address of the corresponding function in the
  12904.  dispatch table and passes execution to that address.
  12905.  
  12906.  
  12907.  6.3.2.1  Device Context Management Functions
  12908.  
  12909.  The engine's device context is a data structure that contains attribute
  12910.  bundles, an LCID table, and graphics data structures─for example, arc
  12911.  parameters and transformation matrices. The graphics engine manages its
  12912.  device context by altering its fields when an application changes
  12913.  corresponding fields in its presentation space. For example, when an
  12914.  application changes character colors or line styles, graphics engine
  12915.  functions alter the fields in the corresponding attribute bundles.
  12916.  
  12917.  
  12918.  6.3.2.2  LCID Management Functions
  12919.  
  12920.  When an application creates a font or a fill pattern (from a bitmap), it
  12921.  identifies that font or fill pattern with a local identifier. However, a
  12922.  device driver identifies bitmaps and fonts with handles, not LCIDs. The
  12923.  graphics engine contains functions that translate a local identifier into a
  12924.  handle that a device driver can use.
  12925.  
  12926.  
  12927.  6.3.2.3  Journal Functions
  12928.  
  12929.  A journal file is a special file that raster printers use for banding
  12930.  operations. Banding operations make it possible for some raster printers to
  12931.  create complex line output even though they cannot scroll backwards. The
  12932.  graphics engine contains functions that create, alter, and destroy journal
  12933.  files.
  12934.  
  12935.  
  12936.  6.4  Presentation Manager Device Drivers
  12937.  
  12938.  A Presentation Manager device driver is a dynamic-link library containing
  12939.  functions that do the following tasks:
  12940.  
  12941.    ■   Enable a device driver.
  12942.  
  12943.    ■   Retrieve device capabilities (or modes).
  12944.  
  12945.    ■   Retrieve the names of supported devices.
  12946.  
  12947.    ■   Set pels on a device.
  12948.  
  12949.    ■   Draw lines, bitmaps, and text on a device.
  12950.  
  12951.    ■   Disable a device driver.
  12952.  
  12953.  
  12954.  
  12955.  
  12956.  6.4.1  Device Driver Functions
  12957.  
  12958.  The device driver functions are device dependent. Unlike the graphic engine
  12959.  functions, which process data for any output device, Presentation Manager
  12960.  device driver functions support only a certain device, or certain type of
  12961.  device. For example, a driver for the HP laser printer may support several
  12962.  printer models.
  12963.  
  12964.  
  12965.  6.4.1.1  Enable Functions
  12966.  
  12967.  When an application calls the DevOpenDC function, the graphics engine loads
  12968.  a device driver and calls the driver's OS2_PM_DRV_ENABLE function. All
  12969.  Presentation Manager device drivers contain a function with the name
  12970.  OS2_PM_DRV_ENABLE, which calls four subfunctions to enable the driver. This
  12971.  function is not found in the dispatch table. Instead, the device driver
  12972.  exports the function in its module definition file. The following excerpt
  12973.  from a module definition file shows how one device driver exports the enable
  12974.  function and assigns it the optional ordinal value 200:
  12975.  
  12976.      .
  12977.      .
  12978.      .
  12979.  EXPORTS
  12980.      OS2_PM_DRV_ENABLE   @200
  12981.  
  12982.  
  12983.  To enable a device driver, OS2_PM_DRV_ENABLE calls the following four
  12984.  subfunctions:
  12985.  
  12986.  Subfunction name                  Description
  12987.  ────────────────────────────────────────────────────────────────────────────
  12988.  
  12989.  FILL_LOGICAL_DEVICE_BLOCK         Constructs a dispatch table and
  12990.                                    initializes the device driver.
  12991.  
  12992.  FILL_PHYS_DEVICE_BLOCK            Constructs a data structure for the
  12993.                                    physical device that describes the
  12994.                                    current drawing environment.
  12995.  
  12996.  ENABLE_DDC                        Reserves memory for and initializes a
  12997.                                    device's instance data.
  12998.  
  12999.  COMPLETE_OPEN_DDC                 Performs additional driver
  13000.                                    initialization after a device context is
  13001.                                    complete.
  13002.  
  13003.  
  13004.  
  13005.  6.4.1.2  Modes Function
  13006.  
  13007.  When an application calls the DevPostDeviceModes function, the graphics
  13008.  engine calls the driver's OS2_PM_DRV_DEVMODE function, which retrieves
  13009.  device capabilities, or modes. This function, like the enable function, is
  13010.  exported by the device driver (and is not found in the dispatch table); it
  13011.  copies mode data into the abGeneralData field of a DRIVDATA structure. This
  13012.  structure has the following form:
  13013.  
  13014.  typedef struct _DRIVDATA {      /* driv */
  13015.      LONG cb;
  13016.      LONG lVersion;
  13017.      CHAR szDeviceName[32];
  13018.      CHAR abGeneralData[1];
  13019.  } DRIVDATA;
  13020.  
  13021.  
  13022.  When an application calls DevPostDeviceModes and sets the pbDriverData
  13023.  parameter to NULL, OS2_PM_DRV_DEVMODE returns the length of the DRIVDATA
  13024.  structure. When the application allocates space for the data and calls
  13025.  DevPostDeviceModes a second time, OS2_PM_DRV_DEVMODE fills abGeneralData,
  13026.  the last field in the structure, with device-specific information.
  13027.  
  13028.  
  13029.  6.4.1.3  Names Function
  13030.  
  13031.  When an application calls the DevOpenDC function, the graphics engine loads
  13032.  a device driver and calls the driver's OS2_PM_DRV_ENABLE function. When an
  13033.  application calls the DevQueryDeviceNames function, the graphics engine
  13034.  calls the driver's OS2_PM_DRV_DEVICENAMES function, which retrieves a list
  13035.  of names of the devices that a device driver supports. A Presentation
  13036.  Manager device driver must export this function, also, in its module
  13037.  definition file. OS2_PM_DRV_DEVICENAMES corresponds to the
  13038.  DevQueryDeviceNames function. When an application calls DevQueryDeviceNames
  13039.  and sets the pdn and pdt parameters to zero, OS2_PM_DEVICNAMES returns the
  13040.  number of devices supported by the driver. When the application allocates
  13041.  space for these device names and types, OS2_PM_DEVICENAMES returns the name
  13042.  of each device that the driver supports.
  13043.  
  13044.  
  13045.  6.4.1.4  Output Functions
  13046.  
  13047.  A device driver contains a number of functions that convert graphics
  13048.  requests from the engine into device-specific instructions that set pels and
  13049.  draw lines, bitmaps, and text. The device driver adds the addresses of these
  13050.  functions to the engine's dispatch table when Presentation Manager calls the
  13051.  driver's enable function.
  13052.  
  13053.  
  13054.  6.4.1.5  Disable Functions
  13055.  
  13056.  To disable a driver, OS2_PM_DRV_ENABLE calls the following three
  13057.  subfunctions:
  13058.  
  13059.  Subfunction name                  Description
  13060.  ────────────────────────────────────────────────────────────────────────────
  13061.  
  13062.  DISABLE_PHYS_DEVICE_BLOCK         Disables a device and deallocates the
  13063.                                    memory that the device driver used.
  13064.  
  13065.  DISABLE_DDC                       Informs a device driver that it should
  13066.                                    deallocate the memory that it allocated
  13067.                                    for a device context.
  13068.  
  13069.  BEGIN_CLOSE_DDC                   Signals a device driver that a device
  13070.                                    context is about to close.
  13071.  
  13072.  
  13073.  
  13074.  6.4.2  Presentation Manager Display Drivers
  13075.  
  13076.  Together, a display driver and the graphics engine provide the code and
  13077.  entry points for 212 functions. A Presentation Manager display driver must
  13078.  provide code and entry points for 69 of these functions; the graphics engine
  13079.  provides the code and entry points for the remaining 143. The 69 required
  13080.  functions are in the following categories:
  13081.  
  13082.  Function category                 Description
  13083.  ────────────────────────────────────────────────────────────────────────────
  13084.  
  13085.  Drawing                           The drawing functions set and retrieve
  13086.                                    the current position, draw lines and
  13087.                                    arcs, set individual pels, clear the
  13088.                                    display, and save and restore screens.
  13089.  
  13090.  Bitmap                            The bitmap functions perform bit block
  13091.                                    transfers (bitblt operations) and create,
  13092.                                    delete, and select bitmaps.
  13093.  
  13094.  Text                              The text functions draw strings of text.
  13095.  
  13096.  Font                              The font functions retrieve information
  13097.                                    about available display fonts, set the
  13098.                                    code page, retrieve the current
  13099.                                    code-page identifier, and perform other
  13100.                                    font operations.
  13101.  
  13102.  Attribute                         The attribute functions set and retrieve
  13103.                                    line, character, image, marker, and area
  13104.                                    attributes.
  13105.  
  13106.  Bounds                            The bounds functions retrieve and set
  13107.                                    the dimensions of the current boundary
  13108.                                    rectangle.
  13109.  
  13110.  Correlation                       The correlation functions retrieve and
  13111.                                    set the dimensions of the current
  13112.                                    pick-aperture rectangle.
  13113.  
  13114.  Escape                            The escape functions create documents,
  13115.                                    print horizontal "bands" of a bitmap or
  13116.                                    document, and delete documents.
  13117.  
  13118.  Window management                 The window-management functions prevent
  13119.                                    other processes from drawing to the
  13120.                                    display, set the device-context origin,
  13121.                                    and invalidate the current visible
  13122.                                    region.
  13123.  
  13124.  Optimization                      The optimization functions provide
  13125.                                    notification of clipping or
  13126.                                    transformation changes.
  13127.  
  13128.  Color table                       The color-table functions retrieve and
  13129.                                    set color information.
  13130.  
  13131.  Query                             The query functions retrieve bitmap and
  13132.                                    display information.
  13133.  
  13134.  For a list of function names in each of these categories, see Chapter 7,
  13135.  "Graphics Functions."
  13136.  
  13137.  
  13138.  6.4.3  Presentation Manager Printer and Plotter Drivers
  13139.  
  13140.  Together, a Presentation Manager printer or plotter driver and the graphics
  13141.  engine must support a total of 199 functions.
  13142.  
  13143.  There are three types of Presentation Manager printer and plotter drivers.
  13144.  Each provides code and entry points for a specific set of functions. The
  13145.  first type of driver is called a minimal driver because it provides code and
  13146.  entry points for the required minimum 56 functions. The graphics engine
  13147.  provides the code and entry points for the remaining 143 functions needed
  13148.  for graphics operations.
  13149.  
  13150.  The second type of driver is called a lazy driver because it relies on a
  13151.  second device driver to provide the code and entry points for most of the 56
  13152.  required functions. The graphics engine supports the remaining 143 functions
  13153.  that are not supported by the lazy driver or its counterpart.
  13154.  
  13155.  The third type of driver is called a sophisticated driver because it
  13156.  provides code and entry points for the 56 required functions as well as many
  13157.  of the functions that the graphics engine typically supports. The actual
  13158.  number of functions supported by a sophisticated driver varies, depending on
  13159.  the capabilities of the device. (Of the remaining 199 functions, the
  13160.  graphics engine supports any that a sophisticated driver does not support.)
  13161.  
  13162.  The following list describes the categories of functions that a Presentation
  13163.  Manager printer driver and the graphics engine support:
  13164.  
  13165.  Function category                 Description
  13166.  ────────────────────────────────────────────────────────────────────────────
  13167.  
  13168.  Arc                               The arc functions set and retrieve the
  13169.                                    arc parameters and draw partial arcs and
  13170.                                    ellipses, fillets and splines, paths,
  13171.                                    and rectangles (with rounded or square
  13172.                                    corners).
  13173.  
  13174.  Line                              The line functions set and retrieve the
  13175.                                    current position, draw connected line
  13176.                                    segments, and draw the short line
  13177.                                    segments that construct an arc.
  13178.  
  13179.  Scan                              The scan function draws multiple
  13180.                                    scan-lines. This is the function that
  13181.                                    fills the interior of areas.
  13182.  
  13183.  Bitmap                            The bitmap functions create and destroy
  13184.                                    bitmaps on a device, set single pels,
  13185.                                    and copy bitmap bits to memory.
  13186.  
  13187.  String                            The string functions draw character
  13188.                                    strings and retrieve character-string
  13189.                                    information.
  13190.  
  13191.  Marker                            The marker function draws one or more
  13192.                                    markers.
  13193.  
  13194.  Path                              The path functions create, modify, draw,
  13195.                                    and destroy paths and areas.
  13196.  
  13197.  Region                            The region functions create, fill, and
  13198.                                    combine regions and compute their
  13199.                                    dimensions.
  13200.  
  13201.  Clip                              The clip functions create clipping
  13202.                                    regions, save and restore regions, and
  13203.                                    determine whether points lie within a
  13204.                                    region.
  13205.  
  13206.  Transformation                    The transformation functions set scaling,
  13207.                                    rotation, translation, reflection, and
  13208.                                    shear transformations.
  13209.  
  13210.  Color                             The color functions create color tables
  13211.                                    and set and retrieve color information.
  13212.  
  13213.  Device                            The device functions retrieve
  13214.                                    device-specific bitmap information,
  13215.                                    device capabilities (such as aspect
  13216.                                    ratios, color capabilities, and default
  13217.                                    page sizes), and perform escape
  13218.                                    operations such as creating and closing
  13219.                                    documents and banding (printing
  13220.                                    horizontal "bands" of a bitmap or
  13221.                                    document).
  13222.  
  13223.  Miscellaneous                     The miscellaneous functions set and
  13224.                                    retrieve device attributes (such as pen
  13225.                                    color and fill-pattern texture), select
  13226.                                    a code page, retrieve the current code
  13227.                                    page identifier, select a font, retrieve
  13228.                                    information about available fonts, and
  13229.                                    lock and unlock a device.
  13230.  
  13231.  
  13232.  
  13233.  6.4.3.1  Minimal Presentation Manager Drivers
  13234.  
  13235.  Minimal printer or plotter drivers must provide the code and entry points
  13236.  for 56 required functions. These 56 functions are in the following
  13237.  categories:
  13238.  
  13239.    ■   Line
  13240.  
  13241.    ■   Scan
  13242.  
  13243.    ■   Bitmap
  13244.  
  13245.    ■   String
  13246.  
  13247.    ■   Marker
  13248.  
  13249.    ■   Color
  13250.  
  13251.    ■   Device
  13252.  
  13253.    ■   Miscellaneous
  13254.  
  13255.  
  13256.  For a list of these required functions, see Chapter 7, "Graphics Functions."
  13257.  
  13258.  
  13259.  A minimal driver relies on the graphics engine to provide the code and entry
  13260.  points for the functions in the following categories:
  13261.  
  13262.    ■   Arc
  13263.  
  13264.    ■   Path
  13265.  
  13266.    ■   Region
  13267.  
  13268.    ■   Clip
  13269.  
  13270.    ■   Transformation
  13271.  
  13272.  
  13273.  
  13274.  
  13275.  6.4.3.2  Lazy Presentation Manager Drivers
  13276.  
  13277.  Lazy Presentation Manager printer or plotter drivers rely on a second device
  13278.  driver and the graphics engine to provide code and entry points for the most
  13279.  of the dispatch-table functions. The sample Epson printer driver that ships
  13280.  with this package is a lazy driver. The Epson driver provides the code and
  13281.  entry points for 13 of the required functions.
  13282.  
  13283.  The Epson driver relies on a display driver to provide the code and entry
  13284.  points for 43 additional functions. The graphics engine provides the code
  13285.  and entry points for the remaining functions.
  13286.  
  13287.  
  13288.  6.4.3.3  Sophisticated Presentation Manager Drivers
  13289.  
  13290.  Sophisticated Presentation Manager printer or plotter drivers support
  13291.  devices that use private page-description languages such as PostScript.
  13292.  These drivers provide the code and entry points for many functions that are
  13293.  supported by the graphics engine. For example, minimal and lazy drivers rely
  13294.  on graphics-engine code and entry points for the FullArcBoundary,
  13295.  FullArcInterior, and FullArcBoth functions. Sophisticated drivers, however,
  13296.  often provide code and entry points for these functions. The PostScript
  13297.  driver that ships with this package is a sophisticated driver.
  13298.  
  13299.  
  13300.  6.5  Installed Simulations
  13301.  
  13302.  The engine's dispatch table may contain addresses of installed simulations
  13303.  that the system loaded at boot time. An installed simulation is a graphics
  13304.  function that replaces a graphics-engine simulation in order to enhance the
  13305.  performance of Presentation Manager applications. For example, the
  13306.  graphics-engine simulations that perform geometric transformations do not
  13307.  use an 80387 math coprocessor for floating-point computations. Instead, they
  13308.  use special 32-bit values called fixed values. However, floating-point
  13309.  computations performed with fixed values are significantly slower than
  13310.  computations performed with an 80387 math coprocessor. Therefore, to take
  13311.  advantage of the speed improvements offered by an 80387 coprocessor, a user
  13312.  would load the dispatch table with the addresses of installed simulations
  13313.  that would replace the graphics engine's transformation simulations. To load
  13314.  these simulations, the user would create appropriate entries in the
  13315.  config.sys file.
  13316.  
  13317.  
  13318.  6.6  Device Driver Components
  13319.  
  13320.  A module definition file for a Presentation Manager device-driver describes
  13321.  the components that form the driver. These components include code and data
  13322.  segments, a heap, a stack, exported and imported functions, and a stub
  13323.  program. Some of these components are commmon to all types of drivers;
  13324.  others are found only in one type. Some components are optional; some are
  13325.  required.
  13326.  
  13327.  
  13328.  6.6.1  Components Common to All Drivers
  13329.  
  13330.  There are five components common to all Presentation Manager drivers:
  13331.  
  13332.    ■   At least one ring-3 code segment
  13333.  
  13334.    ■   One or more ring-2 code segments
  13335.  
  13336.    ■   At least one data segment that contains driver instance data
  13337.  
  13338.    ■   An exported call to the OS2_PM_DRV_ENABLE function
  13339.  
  13340.    ■   A stub program that executes from real mode
  13341.  
  13342.  
  13343.  
  13344.  
  13345.  6.6.1.1  Ring-3 Code Segments
  13346.  
  13347.  Most Presentation Manager drivers declare one ring-3 code segment in the
  13348.  module definition file. This code segment, which executes at ring-3,
  13349.  contains a module entry point that the graphics engine uses to initialize
  13350.  the driver, This initialization code is necessary if the driver will
  13351.  maintain an instance data structure in its heap. An instance data structure
  13352.  contains information about the current drawing environment, including line,
  13353.  arc, and text drawing information, color table information, and so on. The
  13354.  following excerpt from a driver's module definition file shows the
  13355.  declaration of a ring-3 code segment:
  13356.  
  13357.  SEGMENTS
  13358.      .
  13359.      .
  13360.      .
  13361.      _TEXTRING3  CLASS  'CODE'    SHARED
  13362.  
  13363.  
  13364.  
  13365.  
  13366.  
  13367.  6.6.1.2  Ring-2 Code Segments
  13368.  
  13369.  Every Presentation Manager driver declares one or more ring-2 code segments
  13370.  in its module definition file. These code segments, which execute at ring-2,
  13371.  contain the graphics code that accesses the device's I/O ports. (In order to
  13372.  access I/O ports, these functions must execute at ring-2.) The following
  13373.  excerpt from a driver's module definition file shows the declaration of a
  13374.  ring-2 code segment:
  13375.  
  13376.  SEGMENTS
  13377.      .
  13378.      .
  13379.      .
  13380.      _TEXT  CLASS  'CODE'    SHARED  IOPL CONFORMING
  13381.  
  13382.  
  13383.  The IOPL constant specifies that the code segment executes at ring-2. The
  13384.  CONFORMING constant specifies that either ring-2 or ring-3 code segments can
  13385.  call functions in this segment.
  13386.  
  13387.  
  13388.  6.6.1.3  Instance Data
  13389.  
  13390.  Most Presentation Manager drivers create at least one data segment that
  13391.  contains the driver's instance data. The following excerpt from a driver's
  13392.  module definition file shows the declaration for this data segment:
  13393.  
  13394.  SEGMENTS
  13395.      .
  13396.      .
  13397.      .
  13398.      _DATA  CLASS  'DATA'   SHARED
  13399.  
  13400.  
  13401.  
  13402.  
  13403.  
  13404.  6.6.1.4  Enable Function
  13405.  
  13406.  All Presentation Manager drivers (whether they are printer, plotter, or
  13407.  display drivers) must export the enable function OS2_PM_DRV_ENABLE. This is
  13408.  the function that the graphics engine calls after an application issues the
  13409.  DevOpenDC call for a particular device. The following excerpt from a
  13410.  driver's module definition file shows the declaration that exports this
  13411.  call:
  13412.  
  13413.  EXPORTS
  13414.      OS2_PM_DRV_ENABLE
  13415.  
  13416.  
  13417.  
  13418.  
  13419.  
  13420.  6.6.2  Components Common to Printer or Plotter Drivers
  13421.  
  13422.  There are five components common to printer and plotter drivers but not
  13423.  display drivers:
  13424.  
  13425.    ■   Two exported calls to the OS2_PM_DRV_DEVMODE and
  13426.        OS2_PM_DRV_DEVICENAMES functions
  13427.  
  13428.    ■   At least one exported call to a dialog procedure
  13429.  
  13430.    ■   A resource that defines the printer dialog boxes
  13431.  
  13432.    ■   Two imported calls to the GetDriverInfo and SetDriverInfo functions
  13433.  
  13434.    ■   An imported call to the GreEntry functions
  13435.  
  13436.  
  13437.  
  13438.  
  13439.  6.6.2.1  Exported Calls
  13440.  
  13441.  Most printer and plotter drivers export two functions: OS2_PM_DRV_DEVMODE
  13442.  and OS2_PM_DRV_DEVICENAMES. An application or the Control Panel calls these
  13443.  functions to display a dialog that identifies job properties or to retrieve
  13444.  the names of devices that a driver supports. The graphics engine calls
  13445.  OS2_PM_DRV_DEVMODE after an application calls DevPostDeviceModes, and calls
  13446.  OS2_PM_DRV_DEVICENAMES after an application calls DevQueryDeviceNames. The
  13447.  following excerpt from a driver's module definition file shows the
  13448.  declaration that exports these two functions:
  13449.  
  13450.  EXPORTS
  13451.      .
  13452.      .
  13453.      .
  13454.      OS2_PM_DRV_DEVMODE
  13455.      OS2_PM_DRV_DEVICENAMES
  13456.  
  13457.  
  13458.  
  13459.  
  13460.  
  13461.  6.6.2.2  Exported Dialog Procedure
  13462.  
  13463.  If a printer or plotter driver exports OS2_PM_DRV_DEVMODE, it should either
  13464.  export its dialog procedure or define the procedure with the _loadds
  13465.  keyword. This dialog procedure processes messages for the dialog controls.
  13466.  The following excerpt from a driver's module definition file shows the
  13467.  declaration that exports a driver's dialog procedure:
  13468.  
  13469.  EXPORTS
  13470.      .
  13471.      .
  13472.      .
  13473.      DrvDlgProc      @32
  13474.  
  13475.  
  13476.  This declaration uses the optional ordinal value 32.
  13477.  
  13478.  
  13479.  6.6.2.3  Dialog Resources
  13480.  
  13481.  In addition to exporting a dialog procedure, a printer or plotter driver
  13482.  should also provide a resource that describes the dialog. The resource
  13483.  defines the size and style of the dialog-window frame and specifies each
  13484.  control item. For more information about dialogs and dialog procedures, see
  13485.  the Microsoft Operating System/2 Programmer's Reference, Volume 1.
  13486.  
  13487.  
  13488.  6.6.2.4  Imported Information Functions
  13489.  
  13490.  A printer or plotter driver should import the engine functions GetDriverInfo
  13491.  and SetDriverInfo. GetDriverInfo validates an engine device context or
  13492.  bitmap handle. SetDriverInfo associates driver instance data with an engine
  13493.  device context or bitmap. The following excerpt from a driver's module
  13494.  definition file shows the declarations that import the GetDriverInfo and
  13495.  SetDriverInfo functions:
  13496.  
  13497.  IMPORTS
  13498.      .
  13499.      .
  13500.      .
  13501.      GetDriverInfo   =PMGRE.GETDRIVERINFO
  13502.      SetDriverInfo   =PMGRE.SETDRIVERINFO
  13503.  
  13504.  
  13505.  
  13506.  
  13507.  
  13508.  6.6.2.5  Imported Callback Functions
  13509.  
  13510.  If it calls back to the graphics engine, a printer or plotter driver should
  13511.  import the graphics engine's GreEntry functions. There are nine GreEntry
  13512.  functions, each identified by a number in the function name that specifies
  13513.  the number of arguments that the function handles. The following excerpt
  13514.  from a driver's module definition file shows the declarations that import
  13515.  the GreEntry functions:
  13516.  
  13517.  IMPORTS
  13518.      .
  13519.      .
  13520.      .
  13521.      GreEntry2   =PMGRE.GREENTRY2
  13522.      GreEntry3   =PMGRE.GREENTRY3
  13523.      GreEntry4   =PMGRE.GREENTRY4
  13524.      GreEntry5   =PMGRE.GREENTRY5
  13525.      GreEntry6   =PMGRE.GREENTRY6
  13526.      GreEntry7   =PMGRE.GREENTRY7
  13527.      GreEntry8   =PMGRE.GREENTRY8
  13528.      GreEntry9   =PMGRE.GREENTRY9
  13529.      GreEntry10  =PMGRE.GREENTRY0
  13530.  
  13531.  
  13532.  
  13533.  
  13534.  
  13535.  6.6.3  Components Common to Display Drivers
  13536.  
  13537.  There are three components common to display drivers but not printer and
  13538.  plotter drivers:
  13539.  
  13540.    ■   A resource that defines system pointer shapes, system bitmaps, and
  13541.        system fonts
  13542.  
  13543.    ■   A ring-2 code segment that contains cursor-drawing functions
  13544.  
  13545.    ■   A ring-2 data segment that contains cursor-drawing data
  13546.  
  13547.  
  13548.  
  13549.  
  13550.  
  13551.  6.6.3.1  Display Resources
  13552.  
  13553.  All display drivers must provide a resource that defines system pointers,
  13554.  system bitmaps, and system fonts.
  13555.  
  13556.  
  13557.  6.6.3.2  Cursor Code Segment
  13558.  
  13559.  All display drivers must place cursor-drawing functions in code segments
  13560.  that are not movable. The following excerpt from a display-driver's module
  13561.  definition file shows the declaration that exports the code segment
  13562.  containing the cursor code:
  13563.  
  13564.  EXPORTS
  13565.      .
  13566.      .
  13567.      .
  13568.      _POINTER    CLASS 'CODE' SHARED PRELOAD IOPL
  13569.  
  13570.  
  13571.  
  13572.  
  13573.  
  13574.  6.6.3.3  Cursor Data Segment
  13575.  
  13576.  All display drivers must place cursor data structures in a data segment that
  13577.  is not movable. The following excerpt from a display-driver's module
  13578.  definition file shows the declaration that exports the data segment
  13579.  containing the cursor data structures:
  13580.  
  13581.  EXPORTS
  13582.      .
  13583.      .
  13584.      .
  13585.      _POINTERDT    CLASS 'DATA' SHARED PRELOAD IOPL
  13586.  
  13587.  
  13588.  
  13589.  
  13590.  
  13591.  
  13592.  
  13593.  
  13594.  
  13595.  Chapter 7  Graphics Functions
  13596.  ────────────────────────────────────────────────────────────────────────────
  13597.  
  13598.  
  13599.  
  13600.  
  13601.  7.1  Introduction
  13602.  
  13603.  This chapter describes the functions for graphics device drivers as used by
  13604.  MS OS/2 Presentation Manager. These drivers provide graphics, alphanumerics,
  13605.  and raster operations to output devices (for example, screen windows) and to
  13606.  bitmaps. A graphics device driver is a dynamic-link library, a collection of
  13607.  code and data segments that applications access at run time. The code
  13608.  segments in a device driver's dynamic-link library contain the functions
  13609.  that convert application requests for graphics operations into actual device
  13610.  commands.
  13611.  
  13612.  
  13613.  7.1.1  Function Definitions
  13614.  
  13615.  The function definitions in this chapter give a function name, function
  13616.  syntax in C format, and function operation. The definition also gives a
  13617.  detailed explanation of the function parameters.
  13618.  
  13619.  All handles and pointers are passed to functions as 32-bit values.
  13620.  
  13621.  Coordinates passed to functions are 28-bit values in world or model space,
  13622.  as defined by the function call. After transformation to device space,
  13623.  coordinate values must be in the range -32,768 to 32,767, inclusive. The
  13624.  error condition PMERR_COORDINATE_OVERFLOW should be raised when the (x,y)
  13625.  coordinate is too large to handle.
  13626.  
  13627.  Parameters are passed using the Pascal calling convention. This means the
  13628.  parameters in the function syntax are pushed in left-to-right order. The
  13629.  function must pop the parameters off the stack before returning.
  13630.  
  13631.  The last parameter passed to most of the functions is the ulFunN parameter.
  13632.  The high word of this parameter contains a mask of the following flags,
  13633.  which may be set by the graphics programming interface (GPI), the engine, or
  13634.  a driver:
  13635.  
  13636.  Flag                              Description
  13637.  ────────────────────────────────────────────────────────────────────────────
  13638.  
  13639.  COM_DRAW                          Indicates that primitives should be
  13640.                                    drawn on the output device.
  13641.  
  13642.  COM_BOUND                         Indicates that boundary data should be
  13643.                                    collected for the application.
  13644.  
  13645.  COM_CORRELATE                     Indicates that correlation should be
  13646.                                    performed.
  13647.  
  13648.  COM_ALT_BOUND                     Indicates that boundary data should be
  13649.                                    collected for the window manager.
  13650.  
  13651.  COM_AREA                          Indicates that an area bracket is open.
  13652.  
  13653.  COM_PATH                          Indicates that a path bracket is open.
  13654.  
  13655.  COM_TRANSFORM                     Indicates that transformations should be
  13656.                                    performed.
  13657.  
  13658.  COM_RECORDING                     Indicates that journaling is in progress.
  13659.  
  13660.  COM_DEVICE                        Indicates that the driver must handle
  13661.                                    this call. (The driver cannot pass the
  13662.                                    call back to the engine if this bit is
  13663.                                    set.)
  13664.  
  13665.  The functions should also save and restore the si, di, ds, and bp registers.
  13666.  The dx:ax register may need to be used for return values. Registers bx, cx,
  13667.  and es may be destroyed.
  13668.  
  13669.  
  13670.  7.1.2  Function Categories
  13671.  
  13672.  This chapter contains an alphabetic list of engine, installed-simulation,
  13673.  and device driver functions. These functions are divided into two
  13674.  categories:
  13675.  
  13676.    1.  Functions handled only by the engine or by installed simulations.
  13677.  
  13678.    2.  Functions handled by the engine, by installed simulations, or by the
  13679.        device driver.
  13680.  
  13681.  
  13682.  The functions in the first category either process information that isn't
  13683.  available to a device driver, or they perform device-independent operations.
  13684.  For example, the OpenDC, CloseDC, and ResetDC functions are in the first
  13685.  category because they process device-context information (device drivers
  13686.  cannot access device contexts). In addition to the device-context functions,
  13687.  the first category includes the local identifier (LCID) functions,
  13688.  journaling functions, and all of the device-independent graphics-engine
  13689.  functions.
  13690.  
  13691.  The functions in the second category include the required device driver
  13692.  functions as well as the engine-simulation functions that a device driver or
  13693.  an installed simulation can hook. (A device driver or installed simulation
  13694.  "hooks" a function when it replaces that function in the device driver's
  13695.  dispatch table.) The functions in the second category can be subdivided into
  13696.  subcategories (or groups). For example, the second category contains arc,
  13697.  logical-color-table, transformation, bitmap, region, and other function
  13698.  groups.
  13699.  
  13700.  The following section lists all of the functions by group and specifies
  13701.  whether they belong to the first or the second category.
  13702.  
  13703.  
  13704.  7.2  Function Groups
  13705.  
  13706.  The graphic functions are grouped as follows:
  13707.  
  13708.    ■   Arc functions
  13709.  
  13710.    ■   Line functions
  13711.  
  13712.    ■   Scanning functions
  13713.  
  13714.    ■   Bitmap functions
  13715.  
  13716.    ■   Window-pointer functions
  13717.  
  13718.    ■   String functions
  13719.  
  13720.    ■   Marker functions
  13721.  
  13722.    ■   Path functions
  13723.  
  13724.    ■   Region functions
  13725.  
  13726.    ■   Clipping functions
  13727.  
  13728.    ■   Transformation functions
  13729.  
  13730.    ■   Miscellaneous functions
  13731.  
  13732.    ■   Pick-window functions
  13733.  
  13734.    ■   Logical-color-table functions
  13735.  
  13736.    ■   Device functions
  13737.  
  13738.    ■   Device-context functions
  13739.  
  13740.    ■   Device-support functions
  13741.  
  13742.    ■   SetId and LCID functions
  13743.  
  13744.    ■   Font functions
  13745.  
  13746.    ■   Journaling functions
  13747.  
  13748.  
  13749.  The following sections list the functions in each group, with a brief
  13750.  description of the group as a whole. Each list specifies whether a function
  13751.  belongs to category one or two and whether the function is display specific
  13752.  or is used in both display and printer drivers. The following designators
  13753.  are used:
  13754.  
  13755.  Designator                        Meaning
  13756.  ────────────────────────────────────────────────────────────────────────────
  13757.  
  13758.  [ENGINE]                          The function belongs to category one and
  13759.                                    is not hookable. Only the graphics
  13760.                                    engine or an installed simulation will
  13761.                                    handle these functions.
  13762.  
  13763.  [REQUIRED]                        The function belongs to category two and
  13764.                                    is hookable. Printer, plotter, and
  13765.                                    display device drivers must handle these
  13766.                                    functions since there are no
  13767.                                    corresponding graphics-engine
  13768.                                    simulations.
  13769.  
  13770.  [REQUIRED/DISPLAY]                The function belongs to category two and
  13771.                                    is hookable. Display device drivers must
  13772.                                    handle these functions since there are
  13773.                                    no corresponding graphics-engine
  13774.                                    simulations. These functions are not
  13775.                                    required by printer or plotter device
  13776.                                    drivers.
  13777.  
  13778.  Unless designated as an ENGINE function, every function listed is
  13779.  "hookable."
  13780.  
  13781.  
  13782.  7.2.1  Arc Functions
  13783.  
  13784.  The arc functions draw arcs, such as circles, ellipses, fillets, splines,
  13785.  and other curved figures. There are the following arc functions:
  13786.  
  13787.  Arc
  13788.  
  13789.  BoxBoth
  13790.  
  13791.  BoxBoundary
  13792.  
  13793.  BoxInterior
  13794.  
  13795.  CookPathCurves
  13796.  
  13797.  CookWholePath
  13798.  
  13799.  DrawConicsInPath
  13800.  
  13801.  FullArcBoth
  13802.  
  13803.  FullArcBoundary
  13804.  
  13805.  FullArcInterior
  13806.  
  13807.  GetArcParameters
  13808.  
  13809.  GetDefaultArcParameters
  13810.  
  13811.  PartialArc
  13812.  
  13813.  PolyFillet
  13814.  
  13815.  PolyFilletSharp
  13816.  
  13817.  PolySpline
  13818.  
  13819.  RenderPath
  13820.  
  13821.  SetArcParameters
  13822.  
  13823.  SetDefaultArcParameters
  13824.  
  13825.  
  13826.  
  13827.  7.2.2  Line Functions
  13828.  
  13829.  The line functions draw straight lines and set the current position. There
  13830.  are the following line functions:
  13831.  
  13832.  DisjointLines
  13833.  
  13834.  DrawLinesInPath                   [REQUIRED]
  13835.  
  13836.  GetCurrentPosition                [REQUIRED]
  13837.  
  13838.  PolyLine
  13839.  
  13840.  PolyShortLine                     [REQUIRED]
  13841.  
  13842.  SetCurrentPosition                [REQUIRED]
  13843.  
  13844.  
  13845.  
  13846.  7.2.3  Scanning Functions
  13847.  
  13848.  The scanning function draws rows of bits on a page of printer paper or the
  13849.  video display. There is one scanning function:
  13850.  
  13851.  PolyScanline                      [REQUIRED]
  13852.  
  13853.  
  13854.  
  13855.  
  13856.  7.2.4  Bitmap Functions
  13857.  
  13858.  The bitmap functions set bitmap bits, draw bitmapped images, set individual
  13859.  pels on a display, retrieve the state of pels on the display, and perform
  13860.  other related bitmap operations. There are the following bitmap functions:
  13861.  
  13862.  Bitblt                            [REQUIRED]
  13863.  
  13864.  DeviceCreateBitmap                [REQUIRED]
  13865.  
  13866.  DeviceDeleteBitmap                [REQUIRED]
  13867.  
  13868.  DeviceSelectBitmap                [REQUIRED]
  13869.  
  13870.  DeviceSetCursor                   [REQUIRED/DISPLAY]
  13871.  
  13872.  DrawBorder                        [REQUIRED/DISPLAY]
  13873.  
  13874.  GetBitmapBits                     [REQUIRED]
  13875.  
  13876.  GetPel                            [REQUIRED]
  13877.  
  13878.  ImageData                         [REQUIRED]
  13879.  
  13880.  RestoreScreenBits                 [REQUIRED/DISPLAY]
  13881.  
  13882.  SaveScreenBits                    [REQUIRED/DISPLAY]
  13883.  
  13884.  SetBitmapBits                     [REQUIRED]
  13885.  
  13886.  SetPel                            [REQUIRED]
  13887.  
  13888.  
  13889.  
  13890.  7.2.5  Window-Pointer Functions
  13891.  
  13892.  The window-pointer function repositions and redraws a color-cursor bitmap.
  13893.  There is one window-pointer function:
  13894.  
  13895.  SetColorCursor
  13896.  
  13897.  
  13898.  
  13899.  7.2.6  String Functions
  13900.  
  13901.  The display functions draw strings of text output and retrieve text and
  13902.  character information. There are the following string functions:
  13903.  
  13904.  CharRect                          [REQUIRED/DISPLAY]
  13905.  
  13906.  CharStr                           [REQUIRED/DISPLAY]
  13907.  
  13908.  CharString                        [REQUIRED]
  13909.  
  13910.  CharStringPos                     [REQUIRED]
  13911.  
  13912.  QueryCharPositions
  13913.  
  13914.  QueryTextBox
  13915.  
  13916.  QueryWidthTable
  13917.  
  13918.  ScrollRect                        [REQUIRED/DISPLAY]
  13919.  
  13920.  UpdateCursor                      [REQUIRED/DISPLAY]
  13921.  
  13922.  
  13923.  
  13924.  7.2.7  Marker Functions
  13925.  
  13926.  The marker function draws one or more special characters called a marker.
  13927.  There is one marker function:
  13928.  
  13929.  PolyMarker                        [REQUIRED]
  13930.  
  13931.  
  13932.  
  13933.  
  13934.  7.2.8  Path Functions
  13935.  
  13936.  The path functions create, modify, and draw paths and areas. There are the
  13937.  following path functions:
  13938.  
  13939.  AreaSetAttributes
  13940.  
  13941.  BeginArea
  13942.  
  13943.  BeginPath
  13944.  
  13945.  Clip1DPath
  13946.  
  13947.  CloseFigure
  13948.  
  13949.  DrawCookedPath
  13950.  
  13951.  DrawRawPath
  13952.  
  13953.  EndArea
  13954.  
  13955.  EndPath
  13956.  
  13957.  FillPath
  13958.  
  13959.  ModifyPath
  13960.  
  13961.  OutlinePath
  13962.  
  13963.  RestorePath
  13964.  
  13965.  SavePath
  13966.  
  13967.  SelectClipPath
  13968.  
  13969.  StrokePath
  13970.  
  13971.  
  13972.  
  13973.  7.2.9  Region Functions
  13974.  
  13975.  The region functions create, combine, offset, and draw regions. There are
  13976.  the following region functions:
  13977.  
  13978.  CombineRectRegion
  13979.  
  13980.  CombineRegion
  13981.  
  13982.  CombineShortLineRegion
  13983.  
  13984.  CreateRectRegion
  13985.  
  13986.  DestroyRegion
  13987.  
  13988.  EqualRegion
  13989.  
  13990.  GetRegionBox
  13991.  
  13992.  GetRegionRects
  13993.  
  13994.  OffsetRegion
  13995.  
  13996.  PaintRegion
  13997.  
  13998.  PtInRegion
  13999.  
  14000.  RectInRegion
  14001.  
  14002.  SetRectRegion
  14003.  
  14004.  SetRegionOwner
  14005.  
  14006.  
  14007.  
  14008.  
  14009.  7.2.10  Clipping Functions
  14010.  
  14011.  The clipping functions create and alter clipping regions and perform related
  14012.  operations. There are the following clipping functions:
  14013.  
  14014.  ClipPathCurves
  14015.  
  14016.  CopyClipRegion
  14017.  
  14018.  ExcludeClipRectangle
  14019.  
  14020.  GetClipBox
  14021.  
  14022.  GetClipRects
  14023.  
  14024.  IntersectClipRectangle
  14025.  
  14026.  OffsetClipRegion
  14027.  
  14028.  PtVisible
  14029.  
  14030.  QueryClipRegion
  14031.  
  14032.  RectVisible
  14033.  
  14034.  RegionSelectBitmap
  14035.  
  14036.  RestoreRegion
  14037.  
  14038.  SaveRegion
  14039.  
  14040.  SelectClipRegion
  14041.  
  14042.  SelectPathRegion
  14043.  
  14044.  SetupDC
  14045.  
  14046.  SetXformRect
  14047.  
  14048.  
  14049.  
  14050.  
  14051.  7.2.11  Transformation Functions
  14052.  
  14053.  The transformation functions set transformations and retrieve information
  14054.  about current transformation settings. There are the following
  14055.  transformation functions:
  14056.  
  14057.  Convert
  14058.  
  14059.  ConvertPath
  14060.  
  14061.  ConvertWithMatrix
  14062.  
  14063.  GetDefaultViewingLimits
  14064.  
  14065.  GetGlobalViewingXform
  14066.  
  14067.  GetGraphicsField
  14068.  
  14069.  GetModelXform
  14070.  
  14071.  GetPageUnits
  14072.  
  14073.  GetPageViewport
  14074.  
  14075.  GetViewingLimits
  14076.  
  14077.  GetWindowViewportXform
  14078.  
  14079.  MultiplyXforms
  14080.  
  14081.  QueryViewportSize
  14082.  
  14083.  RestoreXform
  14084.  
  14085.  RestoreXformData
  14086.  
  14087.  SaveXform
  14088.  
  14089.  SaveXformData
  14090.  
  14091.  SetDefaultViewingLimits
  14092.  
  14093.  SetGlobalViewingXform
  14094.  
  14095.  SetGraphicsField
  14096.  
  14097.  SetModelXform
  14098.  
  14099.  SetPageUnits
  14100.  
  14101.  SetPageViewport
  14102.  
  14103.  SetViewingLimits
  14104.  
  14105.  SetWindowViewportXform
  14106.  
  14107.  
  14108.  
  14109.  
  14110.  7.2.12  Miscellaneous Functions
  14111.  
  14112.  This group of functions performs a variety of tasks, such as computing
  14113.  boundary data, retrieving font information, clearing the contents of a
  14114.  display, retrieving device-context information, and so on. These
  14115.  miscellaneous functions are listed as follows:
  14116.  
  14117.  AccumulateBounds                  [REQUIRED]
  14118.  
  14119.  Death                             [REQUIRED/DISPLAY]
  14120.  
  14121.  DeviceGetAttributes               [REQUIRED]
  14122.  
  14123.  DeviceInvalidateVisRegion         [REQUIRED/DISPLAY]
  14124.  
  14125.  DeviceQueryFontAttributes         [REQUIRED]
  14126.  
  14127.  DeviceQueryFonts                  [REQUIRED]
  14128.  
  14129.  DeviceSetAttributes               [REQUIRED]
  14130.  
  14131.  DeviceSetAVIOFont                 [REQUIRED/DISPLAY]
  14132.  
  14133.  DeviceSetDCOrigin                 [REQUIRED]
  14134.  
  14135.  DeviceSetGlobalAttribute          [REQUIRED]
  14136.  
  14137.  ErasePS                           [REQUIRED]
  14138.  
  14139.  GetBoundsData                     [REQUIRED]
  14140.  
  14141.  GetCodePage                       [REQUIRED]
  14142.  
  14143.  GetDCOrigin
  14144.  
  14145.  GetLineOrigin                     [REQUIRED]
  14146.  
  14147.  GetPairKerningTable               [REQUIRED]
  14148.  
  14149.  GetStyleRatio                     [REQUIRED]
  14150.  
  14151.  LockDevice                        [REQUIRED]
  14152.  
  14153.  NotifyClipChange                  [REQUIRED for clipping optimizations]
  14154.  
  14155.  NotifyTransformChange             [REQUIRED for transformation
  14156.                                    optimizations]
  14157.  
  14158.  RealizeFont                       [REQUIRED]
  14159.  
  14160.  ResetBounds                       [REQUIRED]
  14161.  
  14162.  Resurrection                      [REQUIRED/DISPLAY]
  14163.  
  14164.  SetCodePage                       [REQUIRED]
  14165.  
  14166.  SetLineOrigin                     [REQUIRED]
  14167.  
  14168.  SetStyleRatio                     [REQUIRED]
  14169.  
  14170.  UnlockDevice                      [REQUIRED]
  14171.  
  14172.  
  14173.  
  14174.  
  14175.  7.2.13  Pick-Window Functions
  14176.  
  14177.  The pick-window functions set the pick window and retrieve its current
  14178.  dimensions. There are the following pick-window functions:
  14179.  
  14180.  GetPickWindow                     [REQUIRED/DISPLAY]
  14181.  
  14182.  SetPickWindow                     [REQUIRED/DISPLAY]
  14183.  
  14184.  
  14185.  
  14186.  7.2.14  Logical-Color-Table Functions
  14187.  
  14188.  The logical-color-table functions create, alter, and retrieve information
  14189.  about logical color tables. There are the following logical-color-table
  14190.  functions:
  14191.  
  14192.  CreateLogColorTable               [REQUIRED]
  14193.  
  14194.  QueryColorData                    [REQUIRED]
  14195.  
  14196.  QueryColorIndex                   [REQUIRED]
  14197.  
  14198.  QueryLogColorTable                [REQUIRED]
  14199.  
  14200.  QueryNearestColor                 [REQUIRED]
  14201.  
  14202.  QueryRealColors                   [REQUIRED]
  14203.  
  14204.  QueryRGBColor                     [REQUIRED]
  14205.  
  14206.  RealizeColorTable                 [REQUIRED]
  14207.  
  14208.  UnrealizeColorTable               [REQUIRED]
  14209.  
  14210.  
  14211.  
  14212.  7.2.15  Device Functions
  14213.  
  14214.  The device functions set and retrieve device-dependent data. There are the
  14215.  following device functions:
  14216.  
  14217.  Escape                            [REQUIRED]
  14218.  
  14219.  QueryDeviceBitmaps                [REQUIRED]
  14220.  
  14221.  QueryDeviceCaps                   [REQUIRED]
  14222.  
  14223.  QueryDevResource                  [REQUIRED]
  14224.  
  14225.  QueryHardcopyCaps                 [REQUIRED]
  14226.  
  14227.  
  14228.  
  14229.  
  14230.  7.2.16  Device-Context Functions
  14231.  
  14232.  The device-context functions open, close, and alter an engine device context
  14233.  (DC). There are the following device-context functions:
  14234.  
  14235.  CloseDC                           [ENGINE]
  14236.  
  14237.  GetHandle                         [ENGINE]
  14238.  
  14239.  GetProcessControl                 [ENGINE]
  14240.  
  14241.  OpenDC                            [ENGINE]
  14242.  
  14243.  QueryDeviceNames                  [ENGINE]
  14244.  
  14245.  QueryEngineVersion                [ENGINE]
  14246.  
  14247.  ResetDC                           [ENGINE]
  14248.  
  14249.  RestoreDC                         [ENGINE]
  14250.  
  14251.  SaveDC                            [ENGINE]
  14252.  
  14253.  SetDCOwner                        [ENGINE]
  14254.  
  14255.  SetHandle                         [ENGINE]
  14256.  
  14257.  SetProcessControl                 [ENGINE]
  14258.  
  14259.  
  14260.  
  14261.  7.2.17  Device-Support Functions
  14262.  
  14263.  The device-support functions perform operations on a device. There are the
  14264.  following device-support functions:
  14265.  
  14266.  CreateBitmap                      [ENGINE]
  14267.  
  14268.  DeleteBitmap                      [ENGINE]
  14269.  
  14270.  GetAttributes                     [ENGINE]
  14271.  
  14272.  GetBitmapDimension                [ENGINE]
  14273.  
  14274.  GetBitmapParameters               [ENGINE]
  14275.  
  14276.  GetDefaultAttributes              [ENGINE]
  14277.  
  14278.  InvalidateVisRegion               [ENGINE]
  14279.  
  14280.  SelectBitmap                      [ENGINE]
  14281.  
  14282.  SetAttributes                     [ENGINE]
  14283.  
  14284.  SetBitmapDimension                [ENGINE]
  14285.  
  14286.  SetBitmapOwner                    [ENGINE]
  14287.  
  14288.  SetCursor                         [ENGINE]
  14289.  
  14290.  SetDefaultAttributes              [ENGINE]
  14291.  
  14292.  SetGlobalAttribute                [ENGINE]
  14293.  
  14294.  
  14295.  
  14296.  7.2.18  SetId and LCID Functions
  14297.  
  14298.  The SetId and LCID functions set, delete, and retrieve information about
  14299.  local identifiers (LCIDs). There are the following SetId and LCID functions:
  14300.  
  14301.  
  14302.  CopyDCLoadData                    [ENGINE]
  14303.  
  14304.  DeleteSetId                       [ENGINE]
  14305.  
  14306.  QueryBitmapHandle                 [ENGINE]
  14307.  
  14308.  QueryNumberSetIds                 [ENGINE]
  14309.  
  14310.  QuerySetIds                       [ENGINE]
  14311.  
  14312.  SetBitmapID                       [ENGINE]
  14313.  
  14314.  
  14315.  
  14316.  
  14317.  7.2.19  Font Functions
  14318.  
  14319.  The font functions create, load, unload, and retrieve information about
  14320.  fonts. There are the following font functions:
  14321.  
  14322.  CreateLogicalFont                 [ENGINE]
  14323.  
  14324.  LoadFont                          [ENGINE]
  14325.  
  14326.  LoadPublicFont                    [ENGINE]
  14327.  
  14328.  QueryCodePageVector               [ENGINE]
  14329.  
  14330.  QueryFontAttributes               [ENGINE]
  14331.  
  14332.  QueryFontFileDescriptions         [ENGINE]
  14333.  
  14334.  QueryFonts                        [ENGINE]
  14335.  
  14336.  QueryLogicalFont                  [ENGINE]
  14337.  
  14338.  UnloadFont                        [ENGINE]
  14339.  
  14340.  UnLoadPublicFont                  [ENGINE]
  14341.  
  14342.  
  14343.  
  14344.  
  14345.  7.2.20  Journaling Functions
  14346.  
  14347.  The journaling functions create, delete, alter, and play journal files.
  14348.  There are the following journal functions:
  14349.  
  14350.  AccumulateJournalFile             [ENGINE]
  14351.  
  14352.  CreateJournalFile                 [ENGINE]
  14353.  
  14354.  DeleteJournalFile                 [ENGINE]
  14355.  
  14356.  OpenJournalFile                   [ENGINE]
  14357.  
  14358.  PlayJournalFile                   [ENGINE]
  14359.  
  14360.  StartJournalFile                  [ENGINE]
  14361.  
  14362.  StopJournalFile                   [ENGINE]
  14363.  
  14364.  
  14365.  
  14366.  7.3  Function Directory
  14367.  
  14368.  This section describes the graphics device functions, in alphabetic order.
  14369.  
  14370.  
  14371.  █    AccumulateBounds
  14372.  ────────────────────────────────────────────────────────────────────────────
  14373.  
  14374.  ULONG AccumulateBounds  (hdc, prcl, hddc, ulFunN)
  14375.  
  14376.  HDC  hdc;                         /*handle of engine's device context */
  14377.  
  14378.  PRECTL  prcl;                     /*pointer to RECTL structure */
  14379.  
  14380.  ULONG  hddc;                      /*handle of device driver's device
  14381.                                    context */
  14382.  
  14383.  ULONG  ulFunN;                    /*flags and function number */
  14384.  
  14385.  
  14386.  The AccumulateBounds function computes the dimensions of the smallest
  14387.  rectangle that will completely surround existing output. The coordinates of
  14388.  the rectangle's lower-left and upper-right corners are stored in a RECTL
  14389.  structure pointed to by the prcl parameter.
  14390.  
  14391.  
  14392.  Parameters
  14393.  
  14394.  hdc  the engine's device context.
  14395.  
  14396.  prcl  to a RECTL structure that contains the coordinates of the rectangle's
  14397.  lower-left and upper-right corners in device space.
  14398.  
  14399.  hddc  the device driver's device context.
  14400.  
  14401.  ulFunN  the function number and a mask of various flags. The low word
  14402.  contains the function number; the high word contains a mask of flags, which
  14403.  may be set by the graphics programming interface (GPI), the engine, or a
  14404.  driver. For a description of these flags, see Section 7.1.1.
  14405.  
  14406.  
  14407.  Return Value
  14408.  
  14409.  The return value is TRUE if the function is successful or FALSE if an error
  14410.  occurs.
  14411.  
  14412.  
  14413.  Errors
  14414.  
  14415.  If an error occurs during the execution of this function, the device driver
  14416.  calls the WinSetErrorInfo function and records the associated error code.
  14417.  The following list contains possible error codes that the device driver may
  14418.  record:
  14419.  
  14420.       PMERR_COORDINATE_OVERFLOW
  14421.       PMERR_DEV_FUNC_NOT_INSTALLED
  14422.       PMERR_HDC_BUSY
  14423.       PMERR_INV_COORD_SPACE
  14424.       PMERR_INV_HDC
  14425.       PMERR_INV_LENGTH_OR_COUNT
  14426.       PMERR_INV_RECT
  14427.  
  14428.  
  14429.  
  14430.  
  14431.  
  14432.  Comments
  14433.  
  14434.  This is a required device driver function. Any engine simulations that
  14435.  collect bounds data call this function.
  14436.  
  14437.  The engine, a simulation, or a device driver can accumulate boundary data.
  14438.  
  14439.  
  14440.  █    AccumulateJournalFile
  14441.  ────────────────────────────────────────────────────────────────────────────
  14442.  
  14443.  ULONG AccumulateJournalFile  (ulParam1, ..., ulParamN, hddc, ulFunN)
  14444.  
  14445.  TYPE  ulParam1;                   /*first parameter of journaled function
  14446.                                    */
  14447.  
  14448.  TYPE  ulParamN;                   /*last parameter of journaled function
  14449.                                    */
  14450.  
  14451.  ULONG  hddc;                      /*handle of device driver's device
  14452.                                    context */
  14453.  
  14454.  ULONG  ulFunN;                    /*flags and function number */
  14455.  
  14456.  
  14457.  The AccumulateJournalFile function creates a journal record for the
  14458.  specified function and stores the record on disk in a journal file.
  14459.  
  14460.  
  14461.  Parameters
  14462.  
  14463.  ulParam1  the first parameter of the journaled function.
  14464.  
  14465.  ulParamN  the last parameter of the journaled function.
  14466.  
  14467.  hddc  the device driver's device context.
  14468.  
  14469.  ulFunN  the function number and a mask of various flags. The low word
  14470.  contains the function number; the high word contains a mask of flags, which
  14471.  may be set by the graphics programming interface (GPI), the engine, or a
  14472.  driver. For a description of these flags, see Section 7.1.1.
  14473.  
  14474.  
  14475.  Return Value
  14476.  
  14477.  This function returns the return value of the journaled function.
  14478.  
  14479.  
  14480.  Errors
  14481.  
  14482.  If an error occurs during the execution of this function, the graphics
  14483.  engine calls the WinSetErrorInfo function and records the associated error
  14484.  code. The following list contains possible error codes that the engine may
  14485.  record:
  14486.  
  14487.       PMERR_BASE_ERROR
  14488.       PMERR_BITMAP_IS_SELECTED
  14489.       PMERR_BITMAP_NOT_SELECTED
  14490.       PMERR_COORDINATE_OVERFLOW
  14491.       PMERR_DEV_FUNC_NOT_INSTALLED
  14492.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  14493.       PMERR_HBITMAP_BUSY
  14494.       PMERR_HDC_BUSY
  14495.       PMERR_HRGN_BUSY
  14496.       PMERR_HUGE_FONTS_NOT_SUPPORTED
  14497.       PMERR_INCOMPATIBLE_BITMAP
  14498.       PMERR_INCORRECT_DC_TYPE
  14499.       PMERR_INSUFFICIENT_MEMORY
  14500.       PMERR_INV_BACKGROUND_COL_ATTR
  14501.       PMERR_INV_BACKGROUND_MIX_ATTR
  14502.       PMERR_INV_BITBLT_MIX
  14503.       PMERR_INV_BITBLT_STYLE
  14504.       PMERR_INV_BITMAP_DIMENSION
  14505.       PMERR_INV_CHAR_DIRECTION_ATTR
  14506.       PMERR_INV_CHAR_MODE_ATTR
  14507.       PMERR_INV_CHAR_SET_ATTR
  14508.       PMERR_INV_CHAR_SHEAR_ATTR
  14509.       PMERR_INV_CODEPAGE
  14510.       PMERR_INV_COLOR_ATTR
  14511.       PMERR_INV_COLOR_DATA
  14512.       PMERR_INV_COLOR_FORMAT
  14513.       PMERR_INV_COLOR_INDEX
  14514.       PMERR_INV_COLOR_OPTIONS
  14515.       PMERR_INV_COLOR_START_INDEX
  14516.       PMERR_INV_COORD_SPACE
  14517.       PMERR_INV_COORDINATE
  14518.       PMERR_INV_DC_DATA
  14519.       PMERR_INV_DC_TYPE
  14520.       PMERR_INV_DRIVER_NAME
  14521.       PMERR_INV_GEOM_LINE_WIDTH_ATTR
  14522.       PMERR_INV_HBITMAP
  14523.       PMERR_INV_HDC
  14524.       PMERR_INV_HRGN
  14525.       PMERR_INV_ID
  14526.       PMERR_INV_IN_AREA
  14527.       PMERR_INV_IN_PATH
  14528.       PMERR_INV_INFO_TABLE
  14529.  
  14530.       PMERR_INV_LENGTH_OR_COUNT
  14531.       PMERR_INV_LINE_END_ATTR
  14532.       PMERR_INV_LINE_JOIN_ATTR
  14533.       PMERR_INV_LINE_TYPE_ATTR
  14534.       PMERR_INV_LINE_WIDTH_ATTR
  14535.       PMERR_INV_MARKER_SET_ATTR
  14536.       PMERR_INV_MARKER_SYMBOL_ATTR
  14537.       PMERR_INV_METAFILE
  14538.       PMERR_INV_MIX_ATTR
  14539.       PMERR_INV_PATTERN_REF_PT_ATTR
  14540.       PMERR_INV_PATTERN_SET_ATTR
  14541.       PMERR_INV_PATTERN_SET_FONT
  14542.       PMERR_INV_PICK_APERTURE_POSN
  14543.       PMERR_INV_PRIMITIVE_TYPE
  14544.       PMERR_INV_RECT
  14545.       PMERR_INV_REGION_CONTROL
  14546.       PMERR_INV_REGION_MIX_MODE
  14547.       PMERR_INV_SCAN_START
  14548.       PMERR_INV_SETID
  14549.       PMERR_INV_USAGE_PARM
  14550.       PMERR_JFILE_BUSY
  14551.       PMERR_JNL_FUNCTION_DATA_TOO_LONG
  14552.       PMERR_RAM_JNL_FILE_TOO_SMALL
  14553.       PMERR_REALIZE_NOT_SUPPORTED
  14554.       PMERR_REGION_IS_CLIP_REGION
  14555.       PMERR_UNSUPPORTED_ATTR
  14556.       PMERR_UNSUPPORTED_ATTR_VALUE
  14557.  
  14558.  
  14559.  
  14560.  
  14561.  
  14562.  Comments
  14563.  
  14564.  Only the graphics engine calls AccumulateJournalFile. If you develop an
  14565.  installed simulation that handles journaling, you must provide code for this
  14566.  function, in addition to the other journaling functions.
  14567.  
  14568.  
  14569.  █    Arc
  14570.  ────────────────────────────────────────────────────────────────────────────
  14571.  
  14572.  LONG Arc  (hdc, aptl, hddc, ulFunN)
  14573.  
  14574.  HDC  hdc;                         /*handle of engine's device context */
  14575.  
  14576.  PPOINTL  aptl;                    /*address of two-element array of POINTL
  14577.                                    structures */
  14578.  
  14579.  ULONG  hddc;                      /*handle of device driver's device
  14580.                                    context */
  14581.  
  14582.  ULONG  ulFunN;                    /*flags and function number */
  14583.  
  14584.  
  14585.  The Arc function draws an arc using the current arc parameters. It draws the
  14586.  arc through three points: the current position, an intermediate point (which
  14587.  is the first point in the array addressed by the aptl parameter), and an
  14588.  endpoint (which is the last point in the array).
  14589.  
  14590.  
  14591.  Parameters
  14592.  
  14593.  hdc  the engine's device context.
  14594.  
  14595.  aptl  the address of a two-element array. Each element is a POINTL structure
  14596.  that specifies the arc's intermediate point and its endpoint.
  14597.  
  14598.  hddc  the device driver's device context.
  14599.  
  14600.  ulFunN  the function number and a mask of various flags. The low word
  14601.  contains the function number; the high word contains a mask of flags, which
  14602.  may be set by the graphics programming interface (GPI), the engine, or a
  14603.  driver. For a description of these flags, see Section 7.1.1.
  14604.  
  14605.  
  14606.  Return Value
  14607.  
  14608.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  14609.  GPI_HITS if the detectable attribute is set for the presentation space and a
  14610.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  14611.  
  14612.  
  14613.  Errors
  14614.  
  14615.  If an error occurs during the execution of this function, the graphics
  14616.  engine or the device driver calls the WinSetErrorInfo function and records
  14617.  the associated error code. The following list contains possible error codes
  14618.  that the engine or the device driver calls record:
  14619.  
  14620.       PMERR_BASE_ERROR
  14621.       PMERR_BITMAP_NOT_SELECTED
  14622.       PMERR_COORDINATE_OVERFLOW
  14623.       PMERR_DEV_FUNC_NOT_INSTALLED
  14624.       PMERR_HDC_BUSY
  14625.       PMERR_INV_COLOR_DATA
  14626.       PMERR_INV_COLOR_INDEX
  14627.       PMERR_INV_COORD_SPACE
  14628.       PMERR_INV_HDC
  14629.       PMERR_INV_IN_AREA
  14630.       PMERR_INV_IN_PATH
  14631.       PMERR_INV_LENGTH_OR_COUNT
  14632.       PMERR_INV_MATRIX_ELEMENT
  14633.       PMERR_INV_PICK_APERTURE_POSN
  14634.       PMERR_INV_RECT
  14635.       PMERR_PATH_LIMIT_EXCEEDED
  14636.       PMERR_PATH_UNKNOWN
  14637.  
  14638.  
  14639.  
  14640.  
  14641.  
  14642.  Comments
  14643.  
  14644.  If the intermediate point is the same as either the startpoint or the
  14645.  endpoint, a straight line is drawn from the startpoint to the endpoint.
  14646.  
  14647.  The current position is updated to the second point in the array addressed
  14648.  by the aptl parameter.
  14649.  
  14650.  If the determinant of the arc parameters is significantly less than one (|pq
  14651.  - rs| < 1), this function will fail.
  14652.  
  14653.  
  14654.  █    AreaSetAttributes
  14655.  ────────────────────────────────────────────────────────────────────────────
  14656.  
  14657.  BOOL AreaSetAttributes  (hdc, ulType, flDefs, flAttrs, pBundle, hddc,
  14658.  ulFunN)
  14659.  
  14660.  HDC  hdc;                         /*handle of engine's device context */
  14661.  
  14662.  ULONG  ulType;                    /*attribute-bundle type */
  14663.  
  14664.  ULONG  flDefs;                    /*default mask */
  14665.  
  14666.  ULONG  flAttrs;                   /*attribute mask */
  14667.  
  14668.  PBUNDLE  pBundle;                 /*pointer to attribute bundle */
  14669.  
  14670.  ULONG  hddc;                      /*handle of device driver's device
  14671.                                    context */
  14672.  
  14673.  ULONG  ulFunN;                    /*flags and function number */
  14674.  
  14675.  
  14676.  The AreaSetAttributes function sets the fields in the line-attribute bundle
  14677.  when an area bracket is open.
  14678.  
  14679.  
  14680.  Parameters
  14681.  
  14682.  hdc  the engine's device context.
  14683.  
  14684.  ulType  the type of attribute bundle. It can be one of the following values:
  14685.  
  14686.  
  14687.  Value                             Meaning
  14688.  ────────────────────────────────────────────────────────────────────────────
  14689.  
  14690.  PRIM_LINE                         Line-attribute bundle
  14691.  
  14692.  PRIM_CHAR                         Character-attribute bundle
  14693.  
  14694.  PRIM_MARKER                       Marker-attribute bundle
  14695.  
  14696.  PRIM_AREA                         Pattern-attribute bundle
  14697.  
  14698.  PRIM_IMAGE                        Image-attribute bundle
  14699.  
  14700.  flDefs  which attributes to set to their default values.
  14701.  
  14702.  flAttrs  which attributes should be modified with the values in the bundle
  14703.  pointed to by the pBundle parameter.
  14704.  
  14705.  pBundle  to a fixed-format bundle that contains the attribute values to be
  14706.  set, as specified by the flAttrs parameter. In the bundle, only the
  14707.  attribute fields that correspond to the attribute flags set in flAttrs and
  14708.  not set in the flDefs parameter contain valid values.
  14709.  
  14710.  hddc  the device driver's device context.
  14711.  
  14712.  ulFunN  the function number and a mask of various flags. The low word
  14713.  contains the function number; the high word contains a mask of flags, which
  14714.  may be set by the graphics programming interface (GPI), the engine, or a
  14715.  driver. For a description of these flags, see Section 7.1.1.
  14716.  
  14717.  
  14718.  Return Value
  14719.  
  14720.  The return value is TRUE if the function is successful or FALSE if an error
  14721.  occurs.
  14722.  
  14723.  
  14724.  Errors
  14725.  
  14726.  If an error occurs during the execution of this function, the graphics
  14727.  engine or the device driver calls the WinSetErrorInfo function and records
  14728.  the associated error code. The following list contains possible error codes
  14729.  that the engine or the device driver calls record:
  14730.  
  14731.  
  14732.  Comments
  14733.  
  14734.  The SetAttributes function calls AreaSetAttributes if an area bracket is
  14735.  open and an application attempts to modify any of the attribute bundles. If
  14736.  the attribute bundle is a line bundle, the function modifies the appropriate
  14737.  fields. If the attribute bundle is a character, marker, image, or pattern
  14738.  bundle, the function does not modify the bundle and leaves the original
  14739.  fields intact.
  14740.  
  14741.  If a device driver replaces the engine's area functions (such as BeginArea
  14742.  and EndArea), it must also replace the engine's version of AreaSetAttributes
  14743.  with its own code.
  14744.  
  14745.  
  14746.  █    BeginArea
  14747.  ────────────────────────────────────────────────────────────────────────────
  14748.  
  14749.  LONG BeginArea  (hdc, flCmd, hddc, ulFunN)
  14750.  
  14751.  HDC  hdc;                         /*handle of engine's device context */
  14752.  
  14753.  ULONG  flCmd;                     /*command flags */
  14754.  
  14755.  ULONG  hddc;                      /*handle of device driver's device
  14756.                                    context */
  14757.  
  14758.  ULONG  ulFunN;                    /*flags and function number */
  14759.  
  14760.  
  14761.  The BeginArea function defines the beginning of an area bracket. An area
  14762.  bracket is a set of graphic functions that define the shape of an area's
  14763.  borders.
  14764.  
  14765.  
  14766.  Parameters
  14767.  
  14768.  hdc  the engine's device context.
  14769.  
  14770.  flCmd  whether boundary lines are to be drawn, and specifies whether the
  14771.  area is filled using the winding or the alternate mode.
  14772.  
  14773.  Bit                               Setting
  14774.  ────────────────────────────────────────────────────────────────────────────
  14775.  
  14776.  0                                 Set to 1 to draw boundary lines
  14777.                                    (BA_BOUNDARY); set to 0 for no boundary
  14778.                                    lines (BA_NOBOUNDARY).
  14779.  
  14780.  1                                 Set to 1 for winding fill mode
  14781.                                    (BA_WINDING); set to 0 for alternate
  14782.                                    fill mode (BA_ALTERNATE).
  14783.  
  14784.  hddc  the device driver's device context.
  14785.  
  14786.  ulFunN  the function number and a mask of various flags. The low word
  14787.  contains the function number; the high word contains a mask of flags, which
  14788.  may be set by the graphics programming interface (GPI), the engine, or a
  14789.  driver. For a description of these flags, see Section 7.1.1.
  14790.  
  14791.  
  14792.  Return Value
  14793.  
  14794.  The return value is GPI_OK if the function is successful or GPI_ERROR if an
  14795.  error occurs.
  14796.  
  14797.  
  14798.  Errors
  14799.  
  14800.  If an error occurs during the execution of this function, the graphics
  14801.  engine or the device driver calls the WinSetErrorInfo function and records
  14802.  the associated error code. The following list contains possible error codes
  14803.  that the engine or the device driver calls record:
  14804.  
  14805.       PMERR_ALREADY_IN_AREA
  14806.       PMERR_BASE_ERROR
  14807.       PMERR_COORDINATE_OVERFLOW
  14808.       PMERR_DEV_FUNC_NOT_INSTALLED
  14809.       PMERR_HDC_BUSY
  14810.       PMERR_INV_AREA_CONTROL
  14811.       PMERR_INV_COORD_SPACE
  14812.       PMERR_INV_HDC
  14813.       PMERR_INV_IN_PATH
  14814.       PMERR_INV_LENGTH_OR_COUNT
  14815.       PMERR_PATH_LIMIT_EXCEEDED
  14816.  
  14817.  
  14818.  
  14819.  
  14820.  
  14821.  Comments
  14822.  
  14823.  An area is one or more closed figures that are filled or filled and
  14824.  outlined.
  14825.  
  14826.  Although the current (x,y) position is not changed by BeginArea, it will be
  14827.  affected by the drawing orders in the boundary definition.
  14828.  
  14829.  Character, marker, image, and bitblt functions are invalid in an area
  14830.  bracket, as are functions that alter the background color or mix mode. Only
  14831.  line and arc functions are valid in an area bracket.
  14832.  
  14833.  Correlation occurs after the area is drawn. (Correlation cannot occur within
  14834.  an open area bracket.)
  14835.  
  14836.  
  14837.  █    BeginPath
  14838.  ────────────────────────────────────────────────────────────────────────────
  14839.  
  14840.  BOOL BeginPath  (hdc, phid, hddc, ulFunN)
  14841.  
  14842.  HDC  hdc;                         /*handle of engine's device context */
  14843.  
  14844.  PHID  phid;                       /*path identifier (must be 1 for current
  14845.                                    release of PM)*/
  14846.  
  14847.  ULONG  hddc;                      /*handle of device driver's device
  14848.                                    context */
  14849.  
  14850.  ULONG  ulFunN;                    /*flags and function number */
  14851.  
  14852.  
  14853.  The BeginPath function defines the beginning of a path bracket. A path
  14854.  bracket is a set of graphic functions that define the shape of a path.
  14855.  
  14856.  
  14857.  Parameters
  14858.  
  14859.  hdc  the engine's device context.
  14860.  
  14861.  phid  the path. This value must be 1 for the current release of MS OS/2
  14862.  Presentation Manager.
  14863.  
  14864.  hddc  the device driver's device context.
  14865.  
  14866.  ulFunN  the function number and a mask of various flags. The low word
  14867.  contains the function number; the high word contains a mask of flags, which
  14868.  may be set by the graphics programming interface (GPI), the engine, or a
  14869.  driver. For a description of these flags, see Section 7.1.1.
  14870.  
  14871.  
  14872.  Return Value
  14873.  
  14874.  The return value is TRUE if the function is successful or FALSE if an error
  14875.  occurs.
  14876.  
  14877.  
  14878.  Errors
  14879.  
  14880.  If an error occurs during the execution of this function, the graphics
  14881.  engine or the device driver calls the WinSetErrorInfo function and records
  14882.  the associated error code. The following list contains possible error codes
  14883.  that the engine or the device driver calls record:
  14884.  
  14885.       PMERR_ALREADY_IN_PATH
  14886.       PMERR_BASE_ERROR
  14887.       PMERR_COORDINATE_OVERFLOW
  14888.       PMERR_DEV_FUNC_NOT_INSTALLED
  14889.       PMERR_HDC_BUSY
  14890.       PMERR_INV_COORD_SPACE
  14891.       PMERR_INV_HDC
  14892.       PMERR_INV_IN_AREA
  14893.       PMERR_INV_LENGTH_OR_COUNT
  14894.       PMERR_INV_PATH_ID
  14895.       PMERR_PATH_LIMIT_EXCEEDED
  14896.  
  14897.  
  14898.  
  14899.  
  14900.  
  14901.  Comments
  14902.  
  14903.  A path is a figure that is filled or outlined. Applications use paths to
  14904.  draw geometric (wide) lines, create nonrectangular clipping regions, and
  14905.  outline and/or fill irregular shapes and polygons. Paths can be open or
  14906.  closed. An open path is a path that is not terminated by the CloseFigure
  14907.  function. A closed path is one that is terminated by the CloseFigure
  14908.  function.
  14909.  
  14910.  A path bracket typically contains line and arc functions that define the
  14911.  shape of its borders. The EndPath function defines the end of a path
  14912.  bracket. If there are no line or arc functions between a BeginPath and an
  14913.  EndPath function call, a null path is defined. No more than one path bracket
  14914.  can be open at any given time. A path cannot be re-opened after a path
  14915.  bracket is closed (that is, after the EndPath function call.)
  14916.  
  14917.  Note that calling the ResetDC function within the path restores the device
  14918.  context to its original state and deletes all paths, fonts, patterns, etc.
  14919.  
  14920.  The CharString and CharStringPos functions are valid in a path bracket only
  14921.  if the current font is an outline font. Functions that set character
  14922.  attributes are not allowed in a path bracket.
  14923.  
  14924.  A path bracket cannot occur within an area bracket.
  14925.  
  14926.  A single path cannot contain more than 64K of data.
  14927.  
  14928.  
  14929.  █    Bitblt
  14930.  ────────────────────────────────────────────────────────────────────────────
  14931.  
  14932.  LONG Bitblt  (hdc, hdcSrc, cptl, pbbp, lMix, flCmd, pbba, hddc, ulFunN)
  14933.  
  14934.  HDC  hdc;                         /*handle of engine's target device
  14935.                                    context */
  14936.  
  14937.  HDC  hdcSrc;                      /*handle of engine's source device
  14938.                                    context */
  14939.  
  14940.  LONG  cptl;                       /*number of points in array */
  14941.  
  14942.  PBITBLTPARAMETERS  pbbp;          /*pointer to BITBLTPARAMETERS structure
  14943.                                    */
  14944.  
  14945.  LONG  lMix;                       /*color mix mode */
  14946.  
  14947.  ULONG  flCmd;                     /*line and column compression flag */
  14948.  
  14949.  PBITBLTATTRS  pbba;               /*pointer to BITBLTATTRS structure */
  14950.  
  14951.  ULONG  hddc;                      /*handle of device driver's device
  14952.                                    context */
  14953.  
  14954.  ULONG  ulFunN;                    /*flags and function number */
  14955.  
  14956.  
  14957.  The Bitblt function copies a bitmap from one device context to another. It
  14958.  can also modify a bitmap within a rectangle in a single device context. If
  14959.  the function modifies a bitmap within a single device context, the target
  14960.  coordinates can be either device or world coordinates. However, if the
  14961.  target coordinates are world coordinates, rotation transformations have no
  14962.  effect on the Bitblt operation.
  14963.  
  14964.  
  14965.  Parameters
  14966.  
  14967.  hdc  the engine's target device context.
  14968.  
  14969.  hdcSrc  the engine's source device context.
  14970.  
  14971.  cptl  the number of points pointed to by the pbbp parameter. It can be one
  14972.  of the following:
  14973.  
  14974.  Value                             Meaning
  14975.  ────────────────────────────────────────────────────────────────────────────
  14976.  
  14977.  2                                 The points addressed by the pbbp
  14978.                                    parameter are the lower-left and
  14979.                                    upper-right corners of the target
  14980.                                    rectangle. If this value is specified,
  14981.                                    the mix mode must not use a source color.
  14982.  
  14983.  3                                 The points addressed by pbbp are the
  14984.                                    lower-left and upper-right corners of
  14985.                                    the target rectangle, and the lower-left
  14986.                                    corner of the source rectangle. The
  14987.                                    upper-right corner of the target
  14988.                                    rectangle is adjusted so that the
  14989.                                    dimensions of the target rectangle are
  14990.                                    identical to those of the source
  14991.                                    rectangle.
  14992.  
  14993.  4                                 The points addressed by pbbp are the
  14994.                                    lower-left and upper-right corners of
  14995.                                    the target and source rectangles. If the
  14996.                                    dimensions of the rectangles aren't
  14997.                                    equal, the source bitmap is stretched or
  14998.                                    compressed so that it fits the target
  14999.                                    rectangle. Bitblt uses the flCmd flag to
  15000.                                    determine how the bitmap should be
  15001.                                    compressed. If the raster operation does
  15002.                                    not include the source, the source
  15003.                                    coordinates are ignored.
  15004.  
  15005.  pbbp  to a BITBLTPARAMETERS structure that contains the coordinates of the
  15006.  lower-left and upper-right corners of the target and source rectangles.
  15007.  
  15008.  lMix  the raster operation for the function. It can be any value in the
  15009.  range 0 to 255. The raster operation is applied to each color plane in the
  15010.  target rectangle. For any pel in a target plane, three bits together with
  15011.  the raster operation value determine the color of the pel. These three bits
  15012.  specify the pattern color (P), source color (S), and initial value of the
  15013.  target color (T). For any combination of P-S-T values, the final target
  15014.  value is determined by the mix bit, as shown in the following table:
  15015.  
  15016.  (Initial) P-S-T                   (Final) T
  15017.  ────────────────────────────────────────────────────────────────────────────
  15018.  
  15019.  0 0 0                             0 (Mix bit) (LS)
  15020.  
  15021.  0 0 1                             1 (Mix bit)
  15022.  
  15023.  0 1 0                             2 (Mix bit)
  15024.  
  15025.  0 1 1                             3 (Mix bit)
  15026.  
  15027.  1 0 0                             4 (Mix bit)
  15028.  
  15029.  1 0 1                             5 (Mix bit)
  15030.  
  15031.  1 1 0                             6 (Mix bit)
  15032.  
  15033.  1 1 1                             7 (Mix bit) (MS)
  15034.  
  15035.  A special gray raster operation is provided:
  15036.  
  15037.  ROP_GRAY    0x000080CA
  15038.  
  15039.  
  15040.  This option causes alternate pattern background pels to be written in the
  15041.  background color. Pattern foreground pels are left unchanged in the target.
  15042.  The source is ignored for this option. This is required for display device
  15043.  drivers but need not be supported for printer or plotter drivers.
  15044.  
  15045.  flCmd  stretching and compressing options; specifies whether the target
  15046.  rectangle coordinates are world units; specifies whether the source handle
  15047.  is a bitmap handle or a device-context handle; and specifies whether the
  15048.  pbba argument contains the address of a BITBLTATTRS structure.
  15049.  
  15050.  Bits 0 and 1 of this flag have the following meaning:
  15051.  
  15052.  Value                             Meaning
  15053.  ────────────────────────────────────────────────────────────────────────────
  15054.  
  15055.  0x0000L                           If compression is necessary, OR the
  15056.                                    eliminated rows or columns (BBO_OR).
  15057.  
  15058.  0x0001L                           If compression is necessary, AND the
  15059.                                    eliminated rows or columns (BBO_AND).
  15060.  
  15061.  0x0002L                           If compression is necessary, ignore the
  15062.                                    eliminated rows or columns (BBO_IGNORE).
  15063.  
  15064.  0x0003L                           The target rectangle's coordinates are
  15065.                                    world coordinates (BBO_TARGWORLD).
  15066.  
  15067.  Bit 16 of this flag has the following meaning:
  15068.  
  15069.  Value                             Meaning
  15070.  ────────────────────────────────────────────────────────────────────────────
  15071.  
  15072.  0                                 The source handle is a device context
  15073.                                    handle into which the bitmap is selected.
  15074.  
  15075.  1                                 The source handle is a bitmap handle.
  15076.                                    (If this bit is set, the bitmap cannot
  15077.                                    be currently selected into a device
  15078.                                    context).
  15079.  
  15080.  Bit 17 of this flag has the following meaning:
  15081.  
  15082.  Value                             Meaning
  15083.  ────────────────────────────────────────────────────────────────────────────
  15084.  
  15085.  0                                 The pbba parameter is ignored.
  15086.  
  15087.  1                                 The pbba parameter contains the address
  15088.                                    of a BITBLTATTRS structure.
  15089.  
  15090.  pbba  to a BITBLTATTRS structure that contains information about the source
  15091.  bitmap's background and foreground color:
  15092.  
  15093.  typedef struct _BITBLTATTRS { /* bba */
  15094.      LONG cSize;
  15095.      LONG lColor;
  15096.      LONG lBackColor;
  15097.  } BITBLTATTRS;
  15098.  
  15099.  
  15100.  You must provide this structure if the source handle identifies a color
  15101.  bitmap.
  15102.  
  15103.  hddc  the device driver's device context.
  15104.  
  15105.  ulFunN  the function number and a mask of various flags. The low word
  15106.  contains the function number; the high word contains a mask of flags, which
  15107.  may be set by the graphics programming interface (GPI), the engine, or a
  15108.  driver. For a description of these flags, see Section 7.1.1.
  15109.  
  15110.  
  15111.  Return Value
  15112.  
  15113.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  15114.  GPI_HITS if the detectable attribute is set for the presentation space and a
  15115.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  15116.  
  15117.  
  15118.  Errors
  15119.  
  15120.  If an error occurs during the execution of this function, the graphics
  15121.  engine calls the WinSetErrorInfo function and records the associated error
  15122.  code. The following list contains possible error codes that the engine may
  15123.  record:
  15124.  
  15125.       PMERR_BASE_ERROR
  15126.       PMERR_BITMAP_IS_SELECTED
  15127.       PMERR_BITMAP_NOT_SELECTED
  15128.       PMERR_COORDINATE_OVERFLOW
  15129.       PMERR_DEV_FUNC_NOT_INSTALLED
  15130.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  15131.       PMERR_HBITMAP_BUSY
  15132.       PMERR_HDC_BUSY
  15133.       PMERR_HUGE_FONTS_NOT_SUPPORTED
  15134.       PMERR_INCOMPATIBLE_BITMAP
  15135.       PMERR_INCORRECT_DC_TYPE
  15136.       PMERR_INSUFFICIENT_MEMORY
  15137.       PMERR_INV_BACKGROUND_COL_ATTR
  15138.       PMERR_INV_BACKGROUND_MIX_ATTR
  15139.       PMERR_INV_BITBLT_MIX
  15140.       PMERR_INV_BITBLT_STYLE
  15141.       PMERR_INV_BITMAP_DIMENSION
  15142.       PMERR_INV_CHAR_DIRECTION_ATTR
  15143.       PMERR_INV_CHAR_MODE_ATTR
  15144.       PMERR_INV_CHAR_SET_ATTR
  15145.       PMERR_INV_CHAR_SHEAR_ATTR
  15146.       PMERR_INV_CODEPAGE
  15147.       PMERR_INV_COLOR_ATTR
  15148.       PMERR_INV_COLOR_DATA
  15149.       PMERR_INV_COLOR_FORMAT
  15150.       PMERR_INV_COLOR_INDEX
  15151.       PMERR_INV_COLOR_OPTIONS
  15152.       PMERR_INV_COLOR_START_INDEX
  15153.       PMERR_INV_COORD_SPACE
  15154.       PMERR_INV_COORDINATE
  15155.       PMERR_INV_DC_DATA
  15156.       PMERR_INV_DC_TYPE
  15157.       PMERR_INV_DRIVER_NAME
  15158.       PMERR_INV_GEOM_LINE_WIDTH_ATTR
  15159.       PMERR_INV_HBITMAP
  15160.       PMERR_INV_HDC
  15161.       PMERR_INV_HRGN
  15162.       PMERR_INV_ID
  15163.       PMERR_INV_IN_AREA
  15164.       PMERR_INV_IN_PATH
  15165.       PMERR_INV_INFO_TABLE
  15166.       PMERR_INV_LENGTH_OR_COUNT
  15167.       PMERR_INV_LINE_END_ATTR
  15168.       PMERR_INV_LINE_JOIN_ATTR
  15169.       PMERR_INV_LINE_TYPE_ATTR
  15170.       PMERR_INV_LINE_WIDTH_ATTR
  15171.       PMERR_INV_MARKER_SET_ATTR
  15172.       PMERR_INV_MARKER_SYMBOL_ATTR
  15173.       PMERR_INV_MIX_ATTR
  15174.       PMERR_INV_PATTERN_REF_PT_ATTR
  15175.       PMERR_INV_PATTERN_SET_ATTR
  15176.       PMERR_INV_PATTERN_SET_FONT
  15177.       PMERR_INV_PICK_APERTURE_POSN
  15178.       PMERR_INV_PRIMITIVE_TYPE
  15179.       PMERR_INV_RECT
  15180.       PMERR_INV_REGION_CONTROL
  15181.       PMERR_INV_SCAN_START
  15182.       PMERR_INV_SETID
  15183.       PMERR_INV_USAGE_PARM
  15184.       PMERR_REALIZE_NOT_SUPPORTED
  15185.       PMERR_UNSUPPORTED_ATTR
  15186.       PMERR_UNSUPPORTED_ATTR_VALUE
  15187.  
  15188.  
  15189.  
  15190.  
  15191.  
  15192.  Comments
  15193.  
  15194.  If the call to Bitblt modifies a bitmap within a single device context and
  15195.  the source and target rectangles overlap, the copy will be nondestructive.
  15196.  The target coordinates may optionally be specified in world coordinates. In
  15197.  this case, the target rectangle's points are transformed into device
  15198.  coordinates, and the Bitblt operation is performed into an upright rectangle
  15199.  in device space, regardless of whether there were any rotational elements in
  15200.  any transformations. All four target points must be present.
  15201.  
  15202.  The device contexts may be either memory device contexts (with a selected
  15203.  bitmap), or device contexts for devices that support raster operations.
  15204.  
  15205.  Foreground and background bitmap colors may be specified by the pbba
  15206.  parameter; otherwise, the current foreground and background bitmap colors of
  15207.  the target device context are used. Also, if the mix requires both source
  15208.  and pattern then a three-way operation is performed (using the pattern
  15209.  defined by the current pattern of the target device context); otherwise, a
  15210.  two-way operation is performed. Note that for a StretchBlt operation, only
  15211.  the source data and not the pattern is stretched.
  15212.  
  15213.  If any of the source data is not available, for example if the source device
  15214.  context is connected to a screen window, and the source rectangle is not
  15215.  currently all visible, no error code is returned and the operation proceeds
  15216.  by reading what is there.
  15217.  
  15218.  Note that rectangles defined by Bitblt are non-inclusive. They include the
  15219.  left and lower boundaries of the rectangles in device units, but not the
  15220.  right and upper boundaries. Thus, if the lower left maps to the same device
  15221.  pixel as the upper right, that rectangle is considered empty.
  15222.  
  15223.  The color attribute values are used in converting between monochrome and
  15224.  color data. This is the only format conversion performed by Bitblt. The
  15225.  three conversions are as follows:
  15226.  
  15227.  Outputting a monochrome pattern to a color device
  15228.  
  15229.  In this case, the pattern is interpreted in two colors, using the current
  15230.  pattern colors:
  15231.  
  15232.    ■   Pattern ones (1) are interpreted as the pattern foreground color.
  15233.  
  15234.    ■   Pattern zeros (0) are interpreted as the pattern background color.
  15235.  
  15236.  
  15237.  The color pattern is then copied to the target without regard to the
  15238.  pattern's original values.
  15239.  
  15240.  Bltblting from a monochrome bitmap to a color bitmap (or device)
  15241.  
  15242.  The source bits are converted as follows:
  15243.  
  15244.    ■   Source ones (1) are converted to the target image's foreground color.
  15245.  
  15246.    ■   Source zeros (0) are converted to the target image's background color.
  15247.  
  15248.  
  15249.  Bltblting from a color bitmap to a monochrome bitmap (or device)
  15250.  
  15251.    ■   Source pels of the image background color are converted to the target
  15252.        image's background color.
  15253.  
  15254.    ■   All other pels are converted to the target image's foreground color.
  15255.  
  15256.  
  15257.  In all of these cases, it is the attributes of the target presentation space
  15258.  that are used.
  15259.  
  15260.  Note that if the options specify BBO_TARGWORLD, then all of the boundaries
  15261.  of the target rectangle are considered part of its interior; otherwise (if
  15262.  BBO_TARGWORLD is not specified), the lower and left boundaries of the target
  15263.  rectangle are considered to be part of its interior but the upper and right
  15264.  boundaries are not.
  15265.  
  15266.  
  15267.  █    BoxBoth
  15268.  ────────────────────────────────────────────────────────────────────────────
  15269.  
  15270.  LONG BoxBoth  (hdc, pboxp, hddc, ulFunN)
  15271.  
  15272.  HDC  hdc;                         /*handle of engine's device context */
  15273.  
  15274.  PBOXPARAMS  pboxp;                /*pointer to BOXPARAMS structure */
  15275.  
  15276.  ULONG  hddc;                      /*handle of device driver's device
  15277.                                    context */
  15278.  
  15279.  ULONG  ulFunN;                    /*flags and function number */
  15280.  
  15281.  
  15282.  The BoxBoth function draws the outline of a rectangular box and fills its
  15283.  interior using the current area fill pattern. The current position defines
  15284.  the coordinates of one corner of the box. The first field in the structure
  15285.  pointed to by the pboxp parameter contains the coordinates of the opposite
  15286.  corner. The second field in this structure specifies the major and minor
  15287.  axis of an ellipse that is used to draw the box's corners.
  15288.  
  15289.  
  15290.  Parameters
  15291.  
  15292.  hdc  the engine's device context.
  15293.  
  15294.  pboxp  to a BOXPARAMS structure.
  15295.  
  15296.  hddc  the device driver's device context.
  15297.  
  15298.  ulFunN  the function number and a mask of various flags. The low word
  15299.  contains the function number; the high word contains a mask of flags, which
  15300.  may be set by the graphics programming interface (GPI), the engine, or a
  15301.  driver. For a description of these flags, see Section 7.1.1.
  15302.  
  15303.  
  15304.  Return Value
  15305.  
  15306.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  15307.  GPI_HITS if the detectable attribute is set for the presentation space and a
  15308.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  15309.  
  15310.  
  15311.  Errors
  15312.  
  15313.  If an error occurs during the execution of this function, the graphics
  15314.  engine or the device driver calls the WinSetErrorInfo function and records
  15315.  the associated error code. The following list contains possible error codes
  15316.  that the engine or the device driver calls record:
  15317.  
  15318.       PMERR_ALREADY_IN_AREA
  15319.       PMERR_BASE_ERROR
  15320.       PMERR_BITMAP_NOT_SELECTED
  15321.       PMERR_COORDINATE_OVERFLOW
  15322.       PMERR_DEV_FUNC_NOT_INSTALLED
  15323.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  15324.       PMERR_HDC_BUSY
  15325.       PMERR_HRGN_BUSY
  15326.       PMERR_HUGE_FONTS_NOT_SUPPORTED
  15327.       PMERR_INSUFFICIENT_MEMORY
  15328.       PMERR_INV_AREA_CONTROL
  15329.       PMERR_INV_BACKGROUND_COL_ATTR
  15330.       PMERR_INV_BACKGROUND_MIX_ATTR
  15331.       PMERR_INV_BOX_ROUNDING_PARM
  15332.       PMERR_INV_CHAR_DIRECTION_ATTR
  15333.       PMERR_INV_CHAR_MODE_ATTR
  15334.       PMERR_INV_CODEPAGE
  15335.       PMERR_INV_COLOR_ATTR
  15336.       PMERR_INV_COLOR_DATA
  15337.       PMERR_INV_COLOR_INDEX
  15338.       PMERR_INV_COORD_SPACE
  15339.       PMERR_INV_COORDINATE
  15340.       PMERR_INV_HDC
  15341.       PMERR_INV_HRGN
  15342.       PMERR_INV_IN_AREA
  15343.       PMERR_INV_IN_PATH
  15344.       PMERR_INV_LENGTH_OR_COUNT
  15345.       PMERR_INV_LINE_TYPE_ATTR
  15346.       PMERR_INV_MIX_ATTR
  15347.       PMERR_INV_NESTED_FIGURES
  15348.       PMERR_INV_PATTERN_REF_PT_ATTR
  15349.       PMERR_INV_PATTERN_SET_ATTR
  15350.       PMERR_INV_PATTERN_SET_FONT
  15351.       PMERR_INV_PICK_APERTURE_POSN
  15352.       PMERR_INV_RECT
  15353.       PMERR_INV_REGION_CONTROL
  15354.       PMERR_NOT_IN_AREA
  15355.       PMERR_NOT_IN_PATH
  15356.       PMERR_PATH_LIMIT_EXCEEDED
  15357.       PMERR_PATH_UNKNOWN
  15358.       PMERR_REGION_IS_CLIP_REGION
  15359.  
  15360.  
  15361.  
  15362.  
  15363.  
  15364.  Comments
  15365.  
  15366.  If the current position is (x0,y0) and the point specified by the second
  15367.  argument is (x1,y1), the sides of the box are drawn in the following order:
  15368.  
  15369.  (x0,y0)->(x1,y0)->(x1,y1)->(x0,y1)->(x0,y0)
  15370.  
  15371.  
  15372.  The corners of the box may be rounded by means of quarter ellipses, with
  15373.  major and minor axes specified by the second parameter. If the value of
  15374.  either axis is zero, no rounding occurs. If the value of either axis exceeds
  15375.  the length of the corresponding side, that value is used as the diameter
  15376.  instead.
  15377.  
  15378.  Note that for correlation operations, a correlation hit is recorded under
  15379.  the following circumstances:
  15380.  
  15381.    ■   The boundary is being drawn and the pick aperture intersects it.
  15382.  
  15383.    ■   The interior is being filled and the pick aperture intersects or is
  15384.        completely within the interior (even if the transparent mix mode is
  15385.        used for the fill operation).
  15386.  
  15387.    ■   The boundary is being drawn and the interior is being filled, and the
  15388.        pick aperture intersects or is completely within the interior (even if
  15389.        the transparent mix mode is used for the fill operation).
  15390.  
  15391.  
  15392.  The current position is not altered by the BoxBoth function.
  15393.  
  15394.  
  15395.  █    BoxBoundary
  15396.  ────────────────────────────────────────────────────────────────────────────
  15397.  
  15398.  LONG BoxBoundary  (hdc, pboxp, hddc, ulFunN)
  15399.  
  15400.  HDC  hdc;                         /*handle of engine's device context */
  15401.  
  15402.  PBOXPARAMS  pboxp;                /*pointer to BOXPARAMS structure */
  15403.  
  15404.  ULONG  hddc;                      /*handle of device driver's device
  15405.                                    context */
  15406.  
  15407.  ULONG  ulFunN;                    /*flags and function number */
  15408.  
  15409.  
  15410.  The BoxBoundary function draws the outline of a rectangular box. The current
  15411.  position defines the coordinates of one corner of the box. The first field
  15412.  in the structure pointed to by the pboxp parameter contains the coordinates
  15413.  of the opposite corner. The second field in this structure specifies the
  15414.  major and minor axis of an ellipse that is used to draw the box's corners.
  15415.  
  15416.  
  15417.  Parameters
  15418.  
  15419.  hdc  the engine's device context.
  15420.  
  15421.  pboxp  to a BOXPARAMS structure.
  15422.  
  15423.  hddc  the device driver's device context.
  15424.  
  15425.  ulFunN  the function number and a mask of various flags. The low word
  15426.  contains the function number; the high word contains a mask of flags, which
  15427.  may be set by the graphics programming interface (GPI), the engine, or a
  15428.  driver. For a description of these flags, see Section 7.1.1.
  15429.  
  15430.  
  15431.  Return Value
  15432.  
  15433.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  15434.  GPI_HITS if the detectable attribute is set for the presentation space and a
  15435.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  15436.  
  15437.  
  15438.  Errors
  15439.  
  15440.  If an error occurs during the execution of this function, the graphics
  15441.  engine or the device driver calls the WinSetErrorInfo function and records
  15442.  the associated error code. The following list contains possible error codes
  15443.  that the engine or the device driver calls record:
  15444.  
  15445.       PMERR_BASE_ERROR
  15446.       PMERR_BITMAP_NOT_SELECTED
  15447.       PMERR_COORDINATE_OVERFLOW
  15448.       PMERR_DEV_FUNC_NOT_INSTALLED
  15449.       PMERR_HDC_BUSY
  15450.       PMERR_INV_BOX_ROUNDING_PARM
  15451.       PMERR_INV_COLOR_DATA
  15452.       PMERR_INV_COLOR_INDEX
  15453.       PMERR_INV_COORD_SPACE
  15454.       PMERR_INV_HDC
  15455.       PMERR_INV_IN_AREA
  15456.       PMERR_INV_IN_PATH
  15457.       PMERR_INV_LENGTH_OR_COUNT
  15458.       PMERR_INV_NESTED_FIGURES
  15459.       PMERR_INV_PICK_APERTURE_POSN
  15460.       PMERR_INV_RECT
  15461.       PMERR_NOT_IN_PATH
  15462.       PMERR_PATH_LIMIT_EXCEEDED
  15463.       PMERR_PATH_UNKNOWN
  15464.  
  15465.  
  15466.  
  15467.  
  15468.  
  15469.  Comments
  15470.  
  15471.  If the current position is (x0,y0) and the point specified by the second
  15472.  argument is (x1,y1), the sides of the box are drawn in the following order:
  15473.  
  15474.  (x0,y0)->(x1,y0)->(x1,y1)->(x0,y1)->(x0,y0)
  15475.  
  15476.  
  15477.  The corners of the box may be rounded by means of quarter ellipses, with
  15478.  major and minor axes specified by the second parameter. If the value of
  15479.  either axis is zero, no rounding occurs. If the value of either axis exceeds
  15480.  the length of the corresponding side, that value is used as the diameter
  15481.  instead.
  15482.  
  15483.  Note that for correlation operations, a correlation hit is recorded under
  15484.  the following circumstances:
  15485.  
  15486.    ■   The boundary is being drawn and the pick aperture intersects the
  15487.        boundary.
  15488.  
  15489.    ■   The interior is being filled and the pick aperture intersects or is
  15490.        completely within the interior (even if the transparent mix mode is
  15491.        used for the fill operation).
  15492.  
  15493.    ■   The boundary is being drawn and the interior is being filled, and the
  15494.        pick aperture intersects or is completely within the interior (even if
  15495.        the transparent mix mode is used for the fill operation).
  15496.  
  15497.  
  15498.  The current position is not altered by the BoxBoundary function.
  15499.  
  15500.  
  15501.  █    BoxInterior
  15502.  ────────────────────────────────────────────────────────────────────────────
  15503.  
  15504.  LONG BoxInterior  (hdc, pboxp, hddc, ulFunN)
  15505.  
  15506.  HDC  hdc;                         /*handle of engine's device context */
  15507.  
  15508.  PBOXPARAMS  pboxp;                /*pointer to BOXPARAMS structure */
  15509.  
  15510.  ULONG  hddc;                      /*handle of device driver's device
  15511.                                    context */
  15512.  
  15513.  ULONG  ulFunN;                    /*flags and function number */
  15514.  
  15515.  
  15516.  The BoxInterior function fills the interior of a box using the current area
  15517.  fill pattern. The current position defines the coordinates of one corner of
  15518.  the box. The first field in the structure pointed to by the pboxp parameter
  15519.  contains the coordinates of the opposite corner. The second field in this
  15520.  structure specifies the major and minor axes of an ellipse that is used to
  15521.  draw the box's corners.
  15522.  
  15523.  
  15524.  Parameters
  15525.  
  15526.  hdc  the engine's device context.
  15527.  
  15528.  pboxp  to a BOXPARAMS structure.
  15529.  
  15530.  hddc  the device driver's device context.
  15531.  
  15532.  ulFunN  the function number and a mask of various flags. The low word
  15533.  contains the function number; the high word contains a mask of flags, which
  15534.  may be set by the graphics programming interface (GPI), the engine, or a
  15535.  driver. For a description of these flags, see Section 7.1.1.
  15536.  
  15537.  
  15538.  Return Value
  15539.  
  15540.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  15541.  GPI_HITS if the detectable attribute is set for the presentation space and a
  15542.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  15543.  
  15544.  
  15545.  Errors
  15546.  
  15547.  If an error occurs during the execution of this function, the graphics
  15548.  engine or the device driver calls the WinSetErrorInfo function and records
  15549.  the associated error code. The following list contains possible error codes
  15550.  that the engine or the device driver calls record:
  15551.  
  15552.       PMERR_ALREADY_IN_AREA
  15553.       PMERR_BASE_ERROR
  15554.       PMERR_BITMAP_NOT_SELECTED
  15555.       PMERR_COORDINATE_OVERFLOW
  15556.       PMERR_DEV_FUNC_NOT_INSTALLED
  15557.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  15558.       PMERR_HDC_BUSY
  15559.       PMERR_HRGN_BUSY
  15560.       PMERR_HUGE_FONTS_NOT_SUPPORTED
  15561.       PMERR_INSUFFICIENT_MEMORY
  15562.       PMERR_INV_AREA_CONTROL
  15563.       PMERR_INV_BACKGROUND_COL_ATTR
  15564.       PMERR_INV_BACKGROUND_MIX_ATTR
  15565.       PMERR_INV_BOX_ROUNDING_PARM
  15566.       PMERR_INV_CHAR_DIRECTION_ATTR
  15567.       PMERR_INV_CHAR_MODE_ATTR
  15568.       PMERR_INV_CODEPAGE
  15569.       PMERR_INV_COLOR_ATTR
  15570.       PMERR_INV_COLOR_DATA
  15571.       PMERR_INV_COLOR_INDEX
  15572.       PMERR_INV_COORD_SPACE
  15573.       PMERR_INV_COORDINATE
  15574.       PMERR_INV_HDC
  15575.       PMERR_INV_HRGN
  15576.       PMERR_INV_IN_AREA
  15577.       PMERR_INV_IN_PATH
  15578.       PMERR_INV_LENGTH_OR_COUNT
  15579.       PMERR_INV_LINE_TYPE_ATTR
  15580.       PMERR_INV_MIX_ATTR
  15581.       PMERR_INV_NESTED_FIGURES
  15582.       PMERR_INV_PATTERN_REF_PT_ATTR
  15583.       PMERR_INV_PATTERN_SET_ATTR
  15584.       PMERR_INV_PATTERN_SET_FONT
  15585.       PMERR_INV_PICK_APERTURE_POSN
  15586.       PMERR_INV_RECT
  15587.       PMERR_INV_REGION_CONTROL
  15588.       PMERR_NOT_IN_AREA
  15589.       PMERR_NOT_IN_PATH
  15590.       PMERR_PATH_LIMIT_EXCEEDED
  15591.       PMERR_PATH_UNKNOWN
  15592.       PMERR_REGION_IS_CLIP_REGION
  15593.  
  15594.  
  15595.  
  15596.  
  15597.  
  15598.  Comments
  15599.  
  15600.  If the current position is (x0,y0) and the point specified by the second
  15601.  argument is (x1,y1), the sides of the box are drawn in the following order:
  15602.  
  15603.  (x0,y0)->(x1,y0)->(x1,y1)->(x0,y1)->(x0,y0)
  15604.  
  15605.  
  15606.  The corners of the box may be rounded by means of quarter ellipses, with
  15607.  major and minor axes specified by the second parameter. If the value of
  15608.  either axis is zero, no rounding occurs. If the value of either axis exceeds
  15609.  the length of the corresponding side, that value is used as the diameter
  15610.  instead.
  15611.  
  15612.  Note that for correlation operations, a correlation hit is recorded under
  15613.  the following circumstances:
  15614.  
  15615.    ■   The boundary is being drawn and the pick aperture intersects the
  15616.        boundary.
  15617.  
  15618.    ■   The interior is being filled and the pick aperture intersects or is
  15619.        completely within the interior (even if the transparent mix mode is
  15620.        used for the fill operation).
  15621.  
  15622.    ■   The boundary is being drawn and the interior is being filled, and the
  15623.        pick aperture intersects or is completely within the interior (even if
  15624.        the transparent mix mode is used for the fill operation).
  15625.  
  15626.  
  15627.  The current position is not altered by the BoxInterior function.
  15628.  
  15629.  
  15630.  █    CharRect
  15631.  ────────────────────────────────────────────────────────────────────────────
  15632.  
  15633.  ULONG CharRect  (hdc, phvps, pGridRectRef, hddc, ulFunN)
  15634.  
  15635.  HDC  hdc;                         /*handle of engine's device context */
  15636.  
  15637.  ULONG FAR * phvps;                /*address of AVIO presentation space */
  15638.  
  15639.  ULONG FAR * pGridRectRef;         /*address of GridRectRef structure */
  15640.  
  15641.  ULONG  hddc;                      /*handle of device driver's device
  15642.                                    context */
  15643.  
  15644.  ULONG  ulFunN;                    /*flags and function number */
  15645.  
  15646.  
  15647.  The CharRect function writes a rectangle of alphanumeric characters to the
  15648.  specified device context.
  15649.  
  15650.  
  15651.  Parameters
  15652.  
  15653.  hdc  the engine's device context.
  15654.  
  15655.  phvps  to an AVIO presentation-space handle.
  15656.  
  15657.  pGridRectRef  to a GridRectRef structure that contains information about the
  15658.  character rectangle. The structure has the following form:
  15659.  
  15660.  typedef struct _GridRectRef { /* cellrect */
  15661.      ULONG StartRow;
  15662.      ULONG StartColumn;
  15663.      ULONG RectWidth;
  15664.      ULONG RectDepth;
  15665.  } GridRectRef;
  15666.  
  15667.  
  15668.  The following list describes the fields in this structure:
  15669.  
  15670.  Field                             Description
  15671.  ────────────────────────────────────────────────────────────────────────────
  15672.  
  15673.  StartRow                          Specifies the starting row.
  15674.  
  15675.  StartCol                          Specifies the starting column in the
  15676.                                    presentation space of the character
  15677.                                    rectangle to be output.
  15678.  
  15679.  RectWidth                         Specifies the width of the rectangle to
  15680.                                    be updated.
  15681.  
  15682.  RectHeight                        Specifies the height of the rectangle to
  15683.                                    be updated.
  15684.  
  15685.  hddc  the device driver's device context.
  15686.  
  15687.  ulFunN  the function number and a mask of various flags. The low word
  15688.  contains the function number; the high word contains a mask of flags, which
  15689.  may be set by the graphics programming interface (GPI), the engine, or a
  15690.  driver. For a description of these flags, see Section 7.1.1.
  15691.  
  15692.  
  15693.  Return Value
  15694.  
  15695.  The return value is zero if the function is successful or nonzero if an
  15696.  error occurs.
  15697.  
  15698.  
  15699.  Errors
  15700.  
  15701.  If an error occurs during the execution of this function, the device driver
  15702.  calls the WinSetErrorInfo function and records the associated error code.
  15703.  The following list contains possible error codes that the device driver may
  15704.  record:
  15705.  
  15706.       PMERR_COORDINATE_OVERFLOW
  15707.       PMERR_DEV_FUNC_NOT_INSTALLED
  15708.       PMERR_HDC_BUSY
  15709.       PMERR_INV_COORD_SPACE
  15710.       PMERR_INV_COORDINATE
  15711.       PMERR_INV_HDC
  15712.       PMERR_INV_LENGTH_OR_COUNT
  15713.       PMERR_INV_RECT
  15714.       PMERR_INV_REGION_CONTROL
  15715.  
  15716.  
  15717.  
  15718.  
  15719.  
  15720.  Comments
  15721.  
  15722.  The set of characters and attributes for the rectangle is taken from the
  15723.  presentation-space cell buffer. The characters are drawn and clipped
  15724.  according to the window's cell-buffer origin, the location of the rectangle
  15725.  relative to that origin, and the size of the window.
  15726.  
  15727.  Note that this call will be used to implement the advanced
  15728.  video-input-and-output (AVIO) function VioSetOrg.
  15729.  
  15730.  
  15731.  █    CharStr
  15732.  ────────────────────────────────────────────────────────────────────────────
  15733.  
  15734.  ULONG CharStr  (hdc, phvps, pch, hddc, ulFunN)
  15735.  
  15736.  HDC  hdc;                         /*handle of engine's device context */
  15737.  
  15738.  ULONG FAR * phvps;                /*pointer to AVIO presentation space */
  15739.  
  15740.  PCH  pch;                         /*address of character string */
  15741.  
  15742.  ULONG  hddc;                      /*handle of device driver's device
  15743.                                    context */
  15744.  
  15745.  ULONG  ulFunN;                    /*flags and function number */
  15746.  
  15747.  
  15748.  The CharStr function draws a character string, positioning the first
  15749.  character in the string at the current row and column position in the
  15750.  advanced video input-and-output (AVIO) presentation space.
  15751.  
  15752.  
  15753.  Parameters
  15754.  
  15755.  hdc  the engine's device context.
  15756.  
  15757.  phvps  to an AVIO presentation-space handle.
  15758.  
  15759.  pch  to a string of characters.
  15760.  
  15761.  hddc  the device driver's device context.
  15762.  
  15763.  ulFunN  the function number and a mask of various flags. The low word
  15764.  contains the function number; the high word contains a mask of flags, which
  15765.  may be set by the graphics programming interface (GPI), the engine, or a
  15766.  driver. For a description of these flags, see Section 7.1.1.
  15767.  
  15768.  
  15769.  Return Value
  15770.  
  15771.  The return value is TRUE if the function is successful or FALSE if an error
  15772.  occurs.
  15773.  
  15774.  
  15775.  Errors
  15776.  
  15777.  If an error occurs during the execution of this function, the device driver
  15778.  calls the WinSetErrorInfo function and records the associated error code.
  15779.  The following list contains possible error codes that the device driver may
  15780.  record:
  15781.  
  15782.       PMERR_COORDINATE_OVERFLOW
  15783.       PMERR_DEV_FUNC_NOT_INSTALLED
  15784.       PMERR_HDC_BUSY
  15785.       PMERR_INV_COORD_SPACE
  15786.       PMERR_INV_COORDINATE
  15787.       PMERR_INV_HDC
  15788.       PMERR_INV_LENGTH_OR_COUNT
  15789.       PMERR_INV_RECT
  15790.       PMERR_INV_REGION_CONTROL
  15791.  
  15792.  
  15793.  
  15794.  
  15795.  
  15796.  █    CharString
  15797.  ────────────────────────────────────────────────────────────────────────────
  15798.  
  15799.  LONG CharString  (hdc, cch, pch, hddc, ulFunN)
  15800.  
  15801.  HDC  hdc;                         /*handle of engine's device context */
  15802.  
  15803.  LONG  cch;                        /*character count */
  15804.  
  15805.  PCH  pch;                         /*address of character string */
  15806.  
  15807.  ULONG  hddc;                      /*handle of device driver's device
  15808.                                    context */
  15809.  
  15810.  ULONG  ulFunN;                    /*flags and function number */
  15811.  
  15812.  
  15813.  The CharString function draws a character string, positioning the first
  15814.  character in the string at the current position. The current position is
  15815.  updated each time a character is drawn.
  15816.  
  15817.  
  15818.  Parameters
  15819.  
  15820.  hdc  the engine's device context.
  15821.  
  15822.  cch  the number of characters in the string.
  15823.  
  15824.  pch  to a string of characters which the function will draw.
  15825.  
  15826.  hddc  the device driver's device context.
  15827.  
  15828.  ulFunN  the function number and a mask of various flags. The low word
  15829.  contains the function number; the high word contains a mask of flags, which
  15830.  may be set by the graphics programming interface (GPI), the engine, or a
  15831.  driver. For a description of these flags, see Section 7.1.1.
  15832.  
  15833.  
  15834.  Return Value
  15835.  
  15836.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  15837.  GPI_HITS if the detectable attribute is set for the presentation space and a
  15838.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  15839.  
  15840.  
  15841.  Errors
  15842.  
  15843.  If an error occurs during the execution of this function, the device driver
  15844.  calls the WinSetErrorInfo function and records the associated error code.
  15845.  The following list contains possible error codes that the device driver may
  15846.  record:
  15847.  
  15848.       PMERR_ALREADY_IN_PATH
  15849.       PMERR_BASE_ERROR
  15850.       PMERR_BITMAP_NOT_SELECTED
  15851.  
  15852.  .ET
  15853.       PMERR_COORDINATE_OVERFLOW
  15854.       PMERR_DEV_FUNC_NOT_INSTALLED
  15855.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  15856.       PMERR_FONT_AND_MODE_MISMATCH
  15857.       PMERR_HDC_BUSY
  15858.       PMERR_HRGN_BUSY
  15859.       PMERR_HUGE_FONTS_NOT_SUPPORTED
  15860.       PMERR_INSUFFICIENT_MEMORY
  15861.       PMERR_INV_BACKGROUND_COL_ATTR
  15862.       PMERR_INV_BACKGROUND_MIX_ATTR
  15863.       PMERR_INV_CHAR_ANGLE_ATTR
  15864.       PMERR_INV_CHAR_DIRECTION_ATTR
  15865.       PMERR_INV_CHAR_MODE_ATTR
  15866.       PMERR_INV_CHAR_POS_OPTIONS
  15867.       PMERR_INV_CHAR_SET_ATTR
  15868.       PMERR_INV_CHAR_SHEAR_ATTR
  15869.       PMERR_INV_CLIP_PATH_OPTIONS
  15870.       PMERR_INV_CODEPAGE
  15871.       PMERR_INV_COLOR_ATTR
  15872.       PMERR_INV_COLOR_DATA
  15873.       PMERR_INV_COLOR_INDEX
  15874.       PMERR_INV_COORD_SPACE
  15875.       PMERR_INV_COORDINATE
  15876.       PMERR_INV_DC_TYPE
  15877.       PMERR_INV_END_PATH_OPTIONS
  15878.       PMERR_INV_FILL_PATH_OPTIONS
  15879.       PMERR_INV_GEOM_LINE_WIDTH_ATTR
  15880.       PMERR_INV_HDC
  15881.       PMERR_INV_HRGN
  15882.       PMERR_INV_ID
  15883.       PMERR_INV_IN_AREA
  15884.       PMERR_INV_IN_PATH
  15885.       PMERR_INV_LENGTH_OR_COUNT
  15886.       PMERR_INV_LINE_END_ATTR
  15887.       PMERR_INV_LINE_JOIN_ATTR
  15888.       PMERR_INV_LINE_TYPE_ATTR
  15889.       PMERR_INV_LINE_WIDTH_ATTR
  15890.       PMERR_INV_MARKER_SET_ATTR
  15891.       PMERR_INV_MARKER_SYMBOL_ATTR
  15892.       PMERR_INV_MATRIX_ELEMENT
  15893.       PMERR_INV_MIX_ATTR
  15894.       PMERR_INV_PATH_ID
  15895.       PMERR_INV_PATTERN_REF_PT_ATTR
  15896.       PMERR_INV_PATTERN_SET_ATTR
  15897.       PMERR_INV_PATTERN_SET_FONT
  15898.       PMERR_INV_PICK_APERTURE_POSN
  15899.       PMERR_INV_PRIMITIVE_TYPE
  15900.       PMERR_INV_RECT
  15901.       PMERR_INV_REGION_CONTROL
  15902.       PMERR_INV_SETID
  15903.       PMERR_INV_TRANSFORM_TYPE
  15904.       PMERR_NOT_IN_PATH
  15905.       PMERR_PATH_LIMIT_EXCEEDED
  15906.       PMERR_PATH_UNKNOWN
  15907.       PMERR_REGION_IS_CLIP_REGION
  15908.       PMERR_UNSUPPORTED_ATTR
  15909.       PMERR_UNSUPPORTED_ATTR_VALUE
  15910.  
  15911.  
  15912.  
  15913.  
  15914.  
  15915.  █    CharStringPos
  15916.  ────────────────────────────────────────────────────────────────────────────
  15917.  
  15918.  LONG CharStringPos  (hdc, pptlStart, prclOpaque, flCmd, cch, pch, pdx, pcsp,
  15919.  hddc, ulFunN)
  15920.  
  15921.  HDC  hdc;                         /*handle of engine's device context */
  15922.  
  15923.  PPOINTL  pptlStart;               /*address of POINTL structure */
  15924.  
  15925.  PRECTL  prclOpaque;               /*address of RECTL structure */
  15926.  
  15927.  ULONG  flCmd;                     /*option flags */
  15928.  
  15929.  LONG  cch;                        /*character count */
  15930.  
  15931.  PCH  pch;                         /*address of characters to be drawn */
  15932.  
  15933.  PLONG  pdx;                       /*pointer to array of increment values
  15934.                                    */
  15935.  
  15936.  PCSP_INFO  pcsp;                  /*pointer to CSP_INFO structure */
  15937.  
  15938.  ULONG  hddc;                      /*handle of device driver's device
  15939.                                    context */
  15940.  
  15941.  ULONG  ulFunN;                    /*flags and function number */
  15942.  
  15943.  
  15944.  The CharStringPos function draws a character string starting at the current
  15945.  position and using one or more formatting options. The options direct the
  15946.  function to draw a background for the string, clip the string to the given
  15947.  rectangle, or position the characters in the string using distances given in
  15948.  an array. After drawing the string, the function either leaves the current
  15949.  position at the end of the string or resets it to the beginning of the
  15950.  string.
  15951.  
  15952.  
  15953.  Parameters
  15954.  
  15955.  hdc  the engine's device context.
  15956.  
  15957.  pptlStart  to a POINTL structure that contains the coordinates of the
  15958.  optional starting position.
  15959.  
  15960.  prclOpaque  to a RECTL structure that contains the coordinates of the
  15961.  optional background rectangle. Depending on the options specified, this
  15962.  rectangle can be drawn opaque, used to clip characters, or both.
  15963.  
  15964.  flCmd  the control flags. This parameter can be one of the following:
  15965.  
  15966.  Value                             Meaning
  15967.  ────────────────────────────────────────────────────────────────────────────
  15968.  
  15969.  CHS_OPAQUE                        Draw an opaque rectangle. If not given,
  15970.                                    do not draw opaque.
  15971.  
  15972.  CHS_VECTOR                        Use the increment vector. If this value
  15973.                                    is not given, do not use the vector.
  15974.  
  15975.  CHS_LEAVEPOS                      Leave the current position at the start
  15976.                                    of character string. If this value is
  15977.                                    not given, move the current position to
  15978.                                    end of the character string.
  15979.  
  15980.  CHS_CLIP                          Clip the string to a rectangle. If this
  15981.                                    value is not given, do not clip.
  15982.  
  15983.  CHS_START_XY                      Use the start position. If this value is
  15984.                                    not given, do not use the start position.
  15985.  
  15986.  CHS_ATTR_INFO                     Use the attributes structure. If this
  15987.                                    value is not given, do not use the
  15988.                                    attributes structure.
  15989.  
  15990.   If a rectangle is not present, CHS_OPAQUE and CHS_CLIP must not be used.
  15991.  
  15992.  
  15993.  cch  the number of characters (bytes) in the character string.
  15994.  
  15995.  pch  to the string of character code points.
  15996.  
  15997.  pdx  to an array of character increments. Each character increment is given
  15998.  in world coordinates. The current position may optionally be moved to the
  15999.  end of the character string, according to the flCmd parameter.
  16000.  
  16001.  pcsp  to a CSP_INFO structure that contains attributes to be used in the
  16002.  operation.
  16003.  
  16004.  hddc  the device driver's device context.
  16005.  
  16006.  ulFunN  the function number and a mask of various flags. The low word
  16007.  contains the function number; the high word contains a mask of flags, which
  16008.  may be set by the graphics programming interface (GPI), the engine, or a
  16009.  driver. For a description of these flags, see Section 7.1.1.
  16010.  
  16011.  
  16012.  Return Value
  16013.  
  16014.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  16015.  GPI_HITS if the detectable attribute is set for the presentation space and a
  16016.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  16017.  
  16018.  
  16019.  Errors
  16020.  
  16021.  If an error occurs during the execution of this function, the device driver
  16022.  calls the WinSetErrorInfo function and records the associated error code.
  16023.  The following list contains possible error codes that the device driver may
  16024.  record:
  16025.  
  16026.       PMERR_ALREADY_IN_PATH
  16027.       PMERR_BASE_ERROR
  16028.       PMERR_BITMAP_NOT_SELECTED
  16029.       PMERR_COORDINATE_OVERFLOW
  16030.       PMERR_DEV_FUNC_NOT_INSTALLED
  16031.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  16032.       PMERR_FONT_AND_MODE_MISMATCH
  16033.       PMERR_HDC_BUSY
  16034.       PMERR_HRGN_BUSY
  16035.       PMERR_HUGE_FONTS_NOT_SUPPORTED
  16036.       PMERR_INSUFFICIENT_MEMORY
  16037.       PMERR_INV_BACKGROUND_COL_ATTR
  16038.       PMERR_INV_BACKGROUND_MIX_ATTR
  16039.       PMERR_INV_CHAR_ANGLE_ATTR
  16040.       PMERR_INV_CHAR_DIRECTION_ATTR
  16041.       PMERR_INV_CHAR_MODE_ATTR
  16042.       PMERR_INV_CHAR_POS_OPTIONS
  16043.       PMERR_INV_CHAR_SET_ATTR
  16044.       PMERR_INV_CHAR_SHEAR_ATTR
  16045.       PMERR_INV_CLIP_PATH_OPTIONS
  16046.       PMERR_INV_CODEPAGE
  16047.       PMERR_INV_COLOR_ATTR
  16048.       PMERR_INV_COLOR_DATA
  16049.       PMERR_INV_COLOR_INDEX
  16050.       PMERR_INV_COORD_SPACE
  16051.       PMERR_INV_COORDINATE
  16052.       PMERR_INV_DC_TYPE
  16053.       PMERR_INV_END_PATH_OPTIONS
  16054.       PMERR_INV_FILL_PATH_OPTIONS
  16055.       PMERR_INV_GEOM_LINE_WIDTH_ATTR
  16056.       PMERR_INV_HDC
  16057.       PMERR_INV_HRGN
  16058.       PMERR_INV_ID
  16059.       PMERR_INV_IN_AREA
  16060.       PMERR_INV_IN_PATH
  16061.       PMERR_INV_LENGTH_OR_COUNT
  16062.       PMERR_INV_LINE_END_ATTR
  16063.       PMERR_INV_LINE_JOIN_ATTR
  16064.       PMERR_INV_LINE_TYPE_ATTR
  16065.  
  16066.       PMERR_INV_LINE_WIDTH_ATTR
  16067.       PMERR_INV_MARKER_SET_ATTR
  16068.       PMERR_INV_MARKER_SYMBOL_ATTR
  16069.       PMERR_INV_MATRIX_ELEMENT
  16070.       PMERR_INV_MIX_ATTR
  16071.       PMERR_INV_PATH_ID
  16072.       PMERR_INV_PATTERN_REF_PT_ATTR
  16073.       PMERR_INV_PATTERN_SET_ATTR
  16074.       PMERR_INV_PATTERN_SET_FONT
  16075.       PMERR_INV_PICK_APERTURE_POSN
  16076.       PMERR_INV_PRIMITIVE_TYPE
  16077.       PMERR_INV_RECT
  16078.       PMERR_INV_REGION_CONTROL
  16079.       PMERR_INV_SETID
  16080.       PMERR_INV_TRANSFORM_TYPE
  16081.       PMERR_NOT_IN_PATH
  16082.       PMERR_PATH_LIMIT_EXCEEDED
  16083.       PMERR_PATH_UNKNOWN
  16084.       PMERR_REGION_IS_CLIP_REGION
  16085.       PMERR_UNSUPPORTED_ATTR
  16086.       PMERR_UNSUPPORTED_ATTR_VALUE
  16087.  
  16088.  
  16089.  
  16090.  
  16091.  
  16092.  Comments
  16093.  
  16094.  To control the positioning of characters after the first, you can specify
  16095.  (optionally) a vector of increments. These increments are measured in world
  16096.  coordinates (along the baseline for left-to-right and right-to-left
  16097.  character directions, and along the shearline for top-to-bottom and
  16098.  bottom-to-top). The ith increment is the distance of the reference point
  16099.  (for example, the lower-left corner) of the (i+1)th character from the
  16100.  reference point of the ith. The last increment may be needed to update the
  16101.  current position.
  16102.  
  16103.  These increments, if specified, set the widths of each character.
  16104.  
  16105.  A further option allows you to specify a rectangle, which you may use as a
  16106.  clip rectangle─and as the background of the string, rather than using the
  16107.  normal method of defining the background. The points on the borders of the
  16108.  rectangle are included within the rectangle.
  16109.  
  16110.  You may use the optional CSP_INFO structure to specify the foreground and
  16111.  background colors for the operation. Otherwise, the characters are drawn
  16112.  using the current character-attribute values, and the background is drawn
  16113.  using the current character background color and an overpaint mix mode. Both
  16114.  corners of the rectangle are specified, so that the rectangle is positioned
  16115.  independently of the current position.
  16116.  
  16117.  A further option allows you to clip the string to the rectangle. This
  16118.  clipping is independent of whether the rectangle is actually drawn.
  16119.  
  16120.  You may (optionally) update the current position to the point at which the
  16121.  next character would have been drawn, had there been one; or you can leave
  16122.  the current position at the start of the string.
  16123.  
  16124.  The opaque rectangle (which is drawn if bit 0 is equal to 1) will ignore any
  16125.  background mix attributes, and be drawn using overpaint and the character's
  16126.  background color attribute.
  16127.  
  16128.  The current character mode affects how the function applies the character
  16129.  increment when it draws each character. For a complete description of the
  16130.  character modes and their affect on text output, see the Microsoft Operating
  16131.  System/2 Programmer's Reference, Volume 1.
  16132.  
  16133.  
  16134.  █    Clip1DPath
  16135.  ────────────────────────────────────────────────────────────────────────────
  16136.  
  16137.  BOOL Clip1DPath  (hdc, pph, api, hddc, ulFunN)
  16138.  
  16139.  HDC  hdc;                         /*handle of engine's device context */
  16140.  
  16141.  PPATH  pph;                       /*pointer to PATH structure */
  16142.  
  16143.  PPIPELINEINFO  api;               /*pointer to array of PIPELINEINFO
  16144.                                    structs */
  16145.  
  16146.  ULONG  hddc;                      /*handle of device driver's device
  16147.                                    context */
  16148.  
  16149.  ULONG  ulFunN;                    /*flags and function number */
  16150.  
  16151.  
  16152.  The Clip1DPath function clips a path against the current clip path,
  16153.  producing new records of clipped curves in the PATH structure.
  16154.  
  16155.  
  16156.  Parameters
  16157.  
  16158.  hdc  the engine's device context.
  16159.  
  16160.  pph  to a PATH structure.
  16161.  
  16162.  api  to an array of two PIPELINEINFO structures.
  16163.  
  16164.  hddc  the device driver's device context.
  16165.  
  16166.  ulFunN  the function number and a mask of various flags. The low word
  16167.  contains the function number; the high word contains a mask of flags, which
  16168.  may be set by the graphics programming interface (GPI), the engine, or a
  16169.  driver. For a description of these flags, see Section 7.1.1.
  16170.  
  16171.  
  16172.  Return Value
  16173.  
  16174.  The return value is TRUE if the function is successful or FALSE if an error
  16175.  occurs.
  16176.  
  16177.  
  16178.  Errors
  16179.  
  16180.  If an error occurs during the execution of this function, the graphics
  16181.  engine or the device driver calls the WinSetErrorInfo function and records
  16182.  the associated error code. The following is a possible error code that the
  16183.  engine or the device driver calls record:
  16184.  
  16185.       PMERR_DEV_FUNC_NOT_INSTALLED
  16186.  
  16187.  
  16188.  
  16189.  
  16190.  
  16191.  Comments
  16192.  
  16193.  The Clip1DPath function never uses more than half of the available records
  16194.  in the path segment.
  16195.  
  16196.  
  16197.  █    ClipPathCurves
  16198.  ────────────────────────────────────────────────────────────────────────────
  16199.  
  16200.  BOOL ClipPathCurves  (hdc, pph, api, hddc, ulFunN)
  16201.  
  16202.  HDC  hdc;                         /*handle of engine's device context */
  16203.  
  16204.  PPATH  pph;                       /*pointer to PATH structure */
  16205.  
  16206.  PIPELINEINFO  api;                /*pointer to array of PIPELINEINFO
  16207.                                    structs */
  16208.  
  16209.  ULONG  hddc;                      /*handle of device driver's device
  16210.                                    context */
  16211.  
  16212.  ULONG  ulFunN;                    /*flags and function number */
  16213.  
  16214.  
  16215.  The ClipPathCurves function clips a path against the current region,
  16216.  producing new records of clipped curves in the PATH structure.
  16217.  
  16218.  
  16219.  Parameters
  16220.  
  16221.  hdc  the engine's device context.
  16222.  
  16223.  pph  to a PATH structure. This structure contains pointers to one or more
  16224.  SUBPATH structures, which in turn point to one or more LINE and/or CURVE
  16225.  structures that define the shape of the path.
  16226.  
  16227.  api  to an array of two PIPELINEINFO structures.
  16228.  
  16229.  hddc  the device driver's device context.
  16230.  
  16231.  ulFunN  the function number and a mask of various flags. The low word
  16232.  contains the function number; the high word contains a mask of flags, which
  16233.  may be set by the graphics programming interface (GPI), the engine, or a
  16234.  driver. For a description of these flags, see Section 7.1.1.
  16235.  
  16236.  
  16237.  Return Value
  16238.  
  16239.  The return value is TRUE if the function is successful or FALSE if an error
  16240.  occurs.
  16241.  
  16242.  
  16243.  Errors
  16244.  
  16245.  If an error occurs during the execution of this function, the graphics
  16246.  engine or the device driver calls the WinSetErrorInfo function and records
  16247.  the associated error code. The following list contains possible error codes
  16248.  that the engine or the device driver calls record:
  16249.  
  16250.       PMERR_BASE_ERROR
  16251.       PMERR_COORDINATE_OVERFLOW
  16252.       PMERR_HDC_BUSY
  16253.       PMERR_INV_HDC
  16254.  
  16255.  
  16256.  
  16257.  
  16258.  
  16259.  Comments
  16260.  
  16261.  The function performs bounds and correlation (if required).
  16262.  
  16263.  
  16264.  █    CloseDC
  16265.  ────────────────────────────────────────────────────────────────────────────
  16266.  
  16267.  BOOL CloseDC  (hdc, hddc, ulFunN)
  16268.  
  16269.  HDC  hdc;                         /*handle of engine's device context */
  16270.  
  16271.  ULONG  hddc;                      /*handle of device driver's device
  16272.                                    context */
  16273.  
  16274.  ULONG  ulFunN;                    /*flags and function number */
  16275.  
  16276.  
  16277.  The CloseDC function closes a device context. If the device context is a
  16278.  memory device context with a selected bitmap, then this function
  16279.  automatically deselects the bitmap before destroying the device context.
  16280.  
  16281.  
  16282.  Parameters
  16283.  
  16284.  hdc  the engine's device context.
  16285.  
  16286.  hddc  the device driver's device context.
  16287.  
  16288.  ulFunN  the function number and a mask of various flags. The low word
  16289.  contains the function number; the high word contains a mask of flags, which
  16290.  may be set by the graphics programming interface (GPI), the engine, or a
  16291.  driver. For a description of these flags, see Section 7.1.1.
  16292.  
  16293.  
  16294.  Return Value
  16295.  
  16296.  The return value is TRUE if the function is successful or FALSE if an error
  16297.  occurs.
  16298.  
  16299.  
  16300.  Errors
  16301.  
  16302.  If an error occurs during the execution of this function, the graphics
  16303.  engine calls the WinSetErrorInfo function and records the associated error
  16304.  code. The following list contains possible error codes that the engine may
  16305.  record:
  16306.  
  16307.       PMERR_BASE_ERROR
  16308.       PMERR_BITMAP_IS_SELECTED
  16309.       PMERR_DEV_FUNC_NOT_INSTALLED
  16310.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  16311.       PMERR_HBITMAP_BUSY
  16312.       PMERR_HDC_BUSY
  16313.  
  16314.       PMERR_INSUFFICIENT_MEMORY
  16315.       PMERR_INV_BITMAP_DIMENSION
  16316.       PMERR_INV_CODEPAGE
  16317.       PMERR_INV_COORDINATE
  16318.       PMERR_INV_DC_TYPE
  16319.       PMERR_INV_HBITMAP
  16320.       PMERR_INV_HDC
  16321.       PMERR_INV_HRGN
  16322.       PMERR_INV_ID
  16323.       PMERR_INV_IN_AREA
  16324.       PMERR_INV_IN_PATH
  16325.       PMERR_INV_INFO_TABLE
  16326.       PMERR_INV_LENGTH_OR_COUNT
  16327.       PMERR_INV_RECT
  16328.       PMERR_INV_REGION_CONTROL
  16329.       PMERR_INV_SCAN_START
  16330.  
  16331.  
  16332.  
  16333.  
  16334.  
  16335.  Comments
  16336.  
  16337.  This function will delete regions (clip regions and visible regions)
  16338.  selected into the device context.
  16339.  
  16340.  
  16341.  █    CloseFigure
  16342.  ────────────────────────────────────────────────────────────────────────────
  16343.  
  16344.  BOOL CloseFigure  (hdc, hddc, ulFunN)
  16345.  
  16346.  HDC  hdc;                         /*handle of engine's device context */
  16347.  
  16348.  ULONG  hddc;                      /*handle of device driver's device
  16349.                                    context */
  16350.  
  16351.  ULONG  ulFunN;                    /*flags and function number */
  16352.  
  16353.  
  16354.  The CloseFigure function closes a figure within a path bracket.
  16355.  
  16356.  
  16357.  Parameters
  16358.  
  16359.  hdc  the engine's device context.
  16360.  
  16361.  hddc  the device driver's device context.
  16362.  
  16363.  ulFunN  the function number and a mask of various flags. The low word
  16364.  contains the function number; the high word contains a mask of flags, which
  16365.  may be set by the graphics programming interface (GPI), the engine, or a
  16366.  driver. For a description of these flags, see Section 7.1.1.
  16367.  
  16368.  
  16369.  Return Value
  16370.  
  16371.  The return value is TRUE if the function is successful or FALSE if an error
  16372.  occurs.
  16373.  
  16374.  
  16375.  Errors
  16376.  
  16377.  If an error occurs during the execution of this function, the graphics
  16378.  engine or the device driver calls the WinSetErrorInfo function and records
  16379.  the associated error code. The following list contains possible error codes
  16380.  that the engine or the device driver calls record:
  16381.  
  16382.       PMERR_BASE_ERROR
  16383.       PMERR_COORDINATE_OVERFLOW
  16384.       PMERR_DEV_FUNC_NOT_INSTALLED
  16385.       PMERR_HDC_BUSY
  16386.       PMERR_INV_COORD_SPACE
  16387.       PMERR_INV_HDC
  16388.       PMERR_INV_LENGTH_OR_COUNT
  16389.       PMERR_NOT_IN_PATH
  16390.       PMERR_PATH_LIMIT_EXCEEDED
  16391.  
  16392.  
  16393.  
  16394.  
  16395.  
  16396.  Comments
  16397.  
  16398.  The current figure is closed by means of appending a straight line from the
  16399.  current position to the starting point of the figure. An "open" figure may
  16400.  be generated by starting a new figure (with a "move" function), or by ending
  16401.  the path, without first issuing the CloseFigure function.
  16402.  
  16403.  If this function occurs outside a path bracket, it has no effect.
  16404.  
  16405.  
  16406.  █    CombineRectRegion
  16407.  ────────────────────────────────────────────────────────────────────────────
  16408.  
  16409.  LONG CombineRectRegion  (hdc, hrgnDst, prcl, hrgnSrc, ulMode, hddc, ulFunN)
  16410.  
  16411.  HDC  hdc;                         /*handle of engine's device context */
  16412.  
  16413.  HRGN  hrgnDst;                    /*handle of destination region */
  16414.  
  16415.  PRECTL  prcl;                     /*pointer to RECTL structure */
  16416.  
  16417.  HRGN  hrgnSrc;                    /*handle of source region */
  16418.  
  16419.  ULONG  ulMode;                    /*combining flag */
  16420.  
  16421.  ULONG  hddc;                      /*handle of device driver's device
  16422.                                    context */
  16423.  
  16424.  ULONG  ulFunN;                    /*flags and function number */
  16425.  
  16426.  
  16427.  The CombineRectRegion function combines a source region with a rectangle to
  16428.  form a final destination region.
  16429.  
  16430.  
  16431.  Parameters
  16432.  
  16433.  hdc  the engine's device context.
  16434.  
  16435.  hrgnDst  the final destination region.
  16436.  
  16437.  prcl  to a RECTL structure that contains the coordinates of the rectangle
  16438.  that the function combines with the source region in order to create the
  16439.  destination region.
  16440.  
  16441.  hrgnSrc  the second source region that the function combines with the first
  16442.  source region in order to create the destination region.
  16443.  
  16444.  ulMode  the region combining method. It can be one of the following:
  16445.  
  16446.  Value                             Meaning
  16447.  ────────────────────────────────────────────────────────────────────────────
  16448.  
  16449.  CRGN_OR (1)                       Specifies the union of Src1 and Src2.
  16450.  
  16451.  CRGN_COPY (2)                     Specifies Src1 only (Src2 is ignored).
  16452.  
  16453.  CRGN_XOR (4)                      Specifies the symmetric difference of
  16454.                                    Src1 and Src2.
  16455.  
  16456.  CRGN_AND (6)                      Specifies the intersection of Src1 and
  16457.                                    Src2.
  16458.  
  16459.  CRGN_DIFF (7)                     Specifies Src1 and not(Src2).
  16460.  
  16461.  hddc  the device driver's device context.
  16462.  
  16463.  ulFunN  the function number and a mask of various flags. The low word
  16464.  contains the function number; the high word contains a mask of flags, which
  16465.  may be set by the graphics programming interface (GPI), the engine, or a
  16466.  driver. For a description of these flags, see Section 7.1.1.
  16467.  
  16468.  
  16469.  Return Value
  16470.  
  16471.  The return value is RGN_NULL, RGN_RECT, or RGN_COMPLEX if the function is
  16472.  successful. The return value is RGN_ERROR if an error occurs.
  16473.  
  16474.  
  16475.  Errors
  16476.  
  16477.  If an error occurs during the execution of this function, the graphics
  16478.  engine or the device driver calls the WinSetErrorInfo function and records
  16479.  the associated  error code. The following list contains possible error
  16480.  codes that the engine or the device driver calls record:
  16481.  
  16482.       PMERR_HRGN_BUSY
  16483.       PMERR_INSUFFICIENT_MEMORY
  16484.       PMERR_INV_COORDINATE
  16485.       PMERR_INV_HRGN
  16486.       PMERR_INV_RECT
  16487.       PMERR_INV_REGION_MIX_MODE
  16488.       PMERR_REGION_IS_CLIP_REGION
  16489.  
  16490.  
  16491.  
  16492.  
  16493.  
  16494.  █    CombineRegion
  16495.  ────────────────────────────────────────────────────────────────────────────
  16496.  
  16497.  LONG CombineRegion  (hdc, hrgnDst, hrgnSrc1, hrgnSrc2, ulMode, hddc, ulFunN)
  16498.  
  16499.  HDC  hdc;                         /*handle of engine's device context */
  16500.  
  16501.  HRGN  hrgnDst;                    /*handle of destination region */
  16502.  
  16503.  HRGN  hrgnSrc1;                   /*handle of source region 1 */
  16504.  
  16505.  HRGN  hrgnSrc2;                   /*handle of source region 2 */
  16506.  
  16507.  ULONG  ulMode;                    /*region combining flag */
  16508.  
  16509.  ULONG  hddc;                      /*handle of device driver's device
  16510.                                    context */
  16511.  
  16512.  ULONG  ulFunN;                    /*flags and function number */
  16513.  
  16514.  
  16515.  The CombineRegion function combines two regions to form a third, final
  16516.  region.
  16517.  
  16518.  
  16519.  Parameters
  16520.  
  16521.  hdc  the engine's device context.
  16522.  
  16523.  hrgnDst  the final destination region.
  16524.  
  16525.  hrgnSrc1  the first source region that the function combines with the second
  16526.  source region in order to create the destination region.
  16527.  
  16528.  hrgnSrc2  the second source region that the function combines with the first
  16529.  source region in order to create the destination region.
  16530.  
  16531.  ulMode  the region combining method. It can be one of the following:
  16532.  
  16533.  Value                             Meaning
  16534.  ────────────────────────────────────────────────────────────────────────────
  16535.  
  16536.  CRGN_OR (1)                       Specifies the union of Src1 and Src2.
  16537.  
  16538.  CRGN_COPY (2)                     Specifies Src1 only (Src2 is ignored).
  16539.  
  16540.  CRGN_XOR (4)                      Specifies the symmetric difference of
  16541.                                    Src1 and Src2.
  16542.  
  16543.  CRGN_AND (6)                      Specifies the intersection of Src1 and
  16544.                                    Src2.
  16545.  
  16546.  CRGN_DIFF (7)                     Specifies Src1 and not(Src2).
  16547.  
  16548.  hddc  the device driver's device context.
  16549.  
  16550.  ulFunN  the function number and a mask of various flags. The low word
  16551.  contains the function number; the high word contains a mask of flags, which
  16552.  may be set by the graphics programming interface (GPI), the engine, or a
  16553.  driver. For a description of these flags, see Section 7.1.1.
  16554.  
  16555.  
  16556.  Return Value
  16557.  
  16558.  The return value is RGN_NULL, RGN_RECT, or RGN_COMPLEX if the function is
  16559.  successful. The return value is RGN_ERROR if an error occurs.
  16560.  
  16561.  
  16562.  Errors
  16563.  
  16564.  If an error occurs during the execution of this function, the graphics
  16565.  engine or the device driver calls the WinSetErrorInfo function and records
  16566.  the associated error code. The following list contains possible error codes
  16567.  that the engine or the device driver calls record:
  16568.  
  16569.       PMERR_HRGN_BUSY
  16570.       PMERR_INSUFFICIENT_MEMORY
  16571.       PMERR_INV_COORDINATE
  16572.       PMERR_INV_HRGN
  16573.       PMERR_INV_RECT
  16574.       PMERR_INV_REGION_MIX_MODE
  16575.       PMERR_REGION_IS_CLIP_REGION
  16576.  
  16577.  
  16578.  
  16579.  
  16580.  
  16581.  █    CombineShortLineRegion
  16582.  ────────────────────────────────────────────────────────────────────────────
  16583.  
  16584.  LONG CombineShortLineRegion  (hdc, hrgn, psl, hddc, ulFunN)
  16585.  
  16586.  HDC  hdc;                         /*handle of engine's device context */
  16587.  
  16588.  HRGN  hrgn;                       /*handle of region */
  16589.  
  16590.  PSHORTLINE  psl;                  /*pointer to SHORTLINE structure */
  16591.  
  16592.  ULONG  hddc;                      /*handle of device driver's device
  16593.                                    context */
  16594.  
  16595.  ULONG  ulFunN;                    /*flags and function number */
  16596.  
  16597.  
  16598.  The CombineShortLineRegion function combines the region identified by the
  16599.  hrgn parameter with the polygon specified by the ppsl parameter into a
  16600.  single final region. It combines the region and the polygon using the OR
  16601.  operation, forming the union of the two objects.
  16602.  
  16603.  
  16604.  Parameters
  16605.  
  16606.  hdc  the engine's device context.
  16607.  
  16608.  hrgn  the original region.
  16609.  
  16610.  psl  to a SHORTLINE structure.
  16611.  
  16612.  hddc  the device driver's device context.
  16613.  
  16614.  ulFunN  the function number and a mask of various flags. The low word
  16615.  contains the function number; the high word contains a mask of flags, which
  16616.  may be set by the graphics programming interface (GPI), the engine, or a
  16617.  driver. For a description of these flags, see Section 7.1.1.
  16618.  
  16619.  
  16620.  Return Value
  16621.  
  16622.  The return value is TRUE if the function is successful or FALSE if an error
  16623.  occurs.
  16624.  
  16625.  
  16626.  Errors
  16627.  
  16628.  If an error occurs during the execution of this function, the graphics
  16629.  engine or the device driver calls the WinSetErrorInfo function and records
  16630.  the associated error code. The following list contains possible error codes
  16631.  that the engine or the device driver calls record:
  16632.  
  16633.       PMERR_HRGN_BUSY
  16634.       PMERR_INSUFFICIENT_MEMORY
  16635.       PMERR_INV_HRGN
  16636.       PMERR_REGION_IS_CLIP_REGION
  16637.  
  16638.  
  16639.  
  16640.  
  16641.  
  16642.  █    Convert
  16643.  ────────────────────────────────────────────────────────────────────────────
  16644.  
  16645.  BOOL Convert  (hdc, lSrc, lTarg, pptl, cptl, hddc, ulFunN)
  16646.  
  16647.  HDC  hdc;                         /*handle of engine's device context */
  16648.  
  16649.  LONG  lSrc;                       /*source coordinate space identifier */
  16650.  
  16651.  LONG  lTarg;                      /*target coordinate space identifier */
  16652.  
  16653.  PPOINTL  pptl;                    /*pointer to POINTL structure */
  16654.  
  16655.  LONG  cptl;                       /*count of points */
  16656.  
  16657.  ULONG  hddc;                      /*handle of device driver's device
  16658.                                    context */
  16659.  
  16660.  ULONG  ulFunN;                    /*flags and function number */
  16661.  
  16662.  
  16663.  The Convert function converts the specified coordinates from one coordinate
  16664.  space to another, using the current values of the transformations.
  16665.  
  16666.  
  16667.  Parameters
  16668.  
  16669.  hdc  the engine's device context.
  16670.  
  16671.  lSrc  one of the following source coordinate spaces:
  16672.  
  16673.  Value                             Meaning
  16674.  ────────────────────────────────────────────────────────────────────────────
  16675.  
  16676.  1                                 World space (CVTC_WORLD)
  16677.  
  16678.  2                                 Model space (CVTC_MODEL)
  16679.  
  16680.  3                                 Default page space (CVTC_DEFAULTPAGE)
  16681.  
  16682.  4                                 Page space (CVTC_PAGE)
  16683.  
  16684.  5                                 Device space (CVTC_DEVICE)
  16685.  
  16686.  lTarg  one of the following target coordinate spaces:
  16687.  
  16688.  Value                             Meaning
  16689.  ────────────────────────────────────────────────────────────────────────────
  16690.  
  16691.  1                                 World space
  16692.  
  16693.  2                                 Model space
  16694.  
  16695.  3                                 Default page space
  16696.  
  16697.  4                                 Page space
  16698.  
  16699.  5                                 Device space
  16700.  
  16701.  pptl  to the POINTL structure that contains the coordinates to be converted.
  16702.  The converted coordinates replace the original coordinates.
  16703.  
  16704.  cptl  the number of points.
  16705.  
  16706.  hddc  the device driver's device context.
  16707.  
  16708.  ulFunN  the function number and a mask of various flags. The low word
  16709.  contains the function number; the high word contains a mask of flags, which
  16710.  may be set by the graphics programming interface (GPI), the engine, or a
  16711.  driver. For a description of these flags, see Section 7.1.1.
  16712.  
  16713.  
  16714.  Return Value
  16715.  
  16716.  The return value is TRUE if the function is successful or FALSE if an error
  16717.  occurs.
  16718.  
  16719.  
  16720.  Errors
  16721.  
  16722.  If an error occurs during the execution of this function, the graphics
  16723.  engine or the device driver calls the WinSetErrorInfo function and records
  16724.  the associated error code. The following list contains possible error codes
  16725.  that the engine or the device driver calls record:
  16726.  
  16727.       PMERR_COORDINATE_OVERFLOW
  16728.       PMERR_HDC_BUSY
  16729.       PMERR_INV_COORD_SPACE
  16730.       PMERR_INV_HDC
  16731.       PMERR_INV_LENGTH_OR_COUNT
  16732.  
  16733.  
  16734.  
  16735.  
  16736.  
  16737.  Comments
  16738.  
  16739.  Screen coordinates have the format of 32-bit signed integers and are used by
  16740.  the device driver as screen pixel addresses.
  16741.  
  16742.  
  16743.  █    ConvertPath
  16744.  ────────────────────────────────────────────────────────────────────────────
  16745.  
  16746.  BOOL ConvertPath  (hdc, pph, lSrc, lTarg, pcvFirst, ccv, hddc, ulFunN)
  16747.  
  16748.  HDC  hdc;                         /*handle of engine's device context */
  16749.  
  16750.  PPATH  pph;                       /*pointer to PATH structure */
  16751.  
  16752.  LONG  lSrc;                       /*source coordinate space */
  16753.  
  16754.  LONG  lTarg;                      /*target coordinate space */
  16755.  
  16756.  PCURVE  pcvFirst;                 /*pointer to first curve */
  16757.  
  16758.  LONG  ccv;                        /*count of curves */
  16759.  
  16760.  ULONG  hddc;                      /*handle of device driver's device
  16761.                                    context */
  16762.  
  16763.  ULONG  ulFunN;                    /*flags and function number */
  16764.  
  16765.  
  16766.  The ConvertPath function transforms coordinates in a specified number of
  16767.  curves of the specified path, starting at the first curve (specified in the
  16768.  pcvFirst parameter). If pcvFirst is zero, all the curves in the path are
  16769.  transformed.
  16770.  
  16771.  
  16772.  Parameters
  16773.  
  16774.  hdc  the engine's device context.
  16775.  
  16776.  pph  to a PATH structure, which defines the path to be transformed. The PATH
  16777.  structure contains pointers to one or more SUBPATH structures, which in turn
  16778.  point to one or more LINE and/or CURVE structures that define the shape of
  16779.  the path.
  16780.  
  16781.  lSrc  one of the following source coordinate spaces:
  16782.  
  16783.  Value                             Meaning
  16784.  ────────────────────────────────────────────────────────────────────────────
  16785.  
  16786.  1                                 World space (CVTC_WORLD)
  16787.  
  16788.  2                                 Model space (CVTC_MODEL)
  16789.  
  16790.  3                                 Default page space (CVTC_DEFAULTPAGE)
  16791.  
  16792.  4                                 Page space (CVTC_PAGE)
  16793.  
  16794.  5                                 Device space (CVTC_DEVICE)
  16795.  
  16796.  lTarg  one of the following target coordinate spaces:
  16797.  
  16798.  Value                             Meaning
  16799.  ────────────────────────────────────────────────────────────────────────────
  16800.  
  16801.  1                                 World space
  16802.  
  16803.  2                                 Model space
  16804.  
  16805.  3                                 Default page space
  16806.  
  16807.  4                                 Page space
  16808.  
  16809.  5                                 Device space
  16810.  
  16811.  pcvFirst  to the first curve in the path.
  16812.  
  16813.  ccv  a count of the number of curves to convert.
  16814.  
  16815.  hddc  the device driver's device context.
  16816.  
  16817.  ulFunN  the function number and a mask of various flags. The low word
  16818.  contains the function number; the high word contains a mask of flags, which
  16819.  may be set by the graphics programming interface (GPI), the engine, or a
  16820.  driver. For a description of these flags, see Section 7.1.1.
  16821.  
  16822.  
  16823.  Return Value
  16824.  
  16825.  The return value is TRUE if the function is successful or FALSE if an error
  16826.  occurs.
  16827.  
  16828.  
  16829.  Errors
  16830.  
  16831.  If an error occurs during the execution of this function, the graphics
  16832.  engine or the device driver calls the WinSetErrorInfo function and records
  16833.  the associated error code. The following list contains possible error codes
  16834.  that the engine or the device driver calls record:
  16835.  
  16836.       PMERR_COORDINATE_OVERFLOW
  16837.       PMERR_HDC_BUSY
  16838.       PMERR_INV_COORD_SPACE
  16839.       PMERR_INV_HDC
  16840.       PMERR_INV_LENGTH_OR_COUNT
  16841.       PMERR_PATH_UNKNOWN
  16842.  
  16843.  
  16844.  
  16845.  
  16846.  
  16847.  Comments
  16848.  
  16849.  The ConvertPath function "walks" along the given path and converts the
  16850.  coordinates from one space to another, using the current transformation
  16851.  values. All points in the path are LONG values (they may become FIXED values
  16852.  after the CookPathCurves function is called). This is necessary since there
  16853.  is no way to store points in world coordinates into 16-bit values.
  16854.  
  16855.  
  16856.  █    ConvertWithMatrix
  16857.  ────────────────────────────────────────────────────────────────────────────
  16858.  
  16859.  BOOL ConvertWithMatrix  (hdc, aptl, cptl, pxform, hddc, ulFunN)
  16860.  
  16861.  HDC  hdc;                         /*handle of engine's device context */
  16862.  
  16863.  PPOINTL  aptl;                    /*address of array of POINTL structures
  16864.                                    */
  16865.  
  16866.  LONG  cptl;                       /*count of points */
  16867.  
  16868.  PXFORM  pxform;                   /*pointer to XFORM structure */
  16869.  
  16870.  ULONG  hddc;                      /*handle of device driver's device
  16871.                                    context */
  16872.  
  16873.  ULONG  ulFunN;                    /*flags and function number */
  16874.  
  16875.  
  16876.  The ConvertWithMatrix function uses the supplied matrix to transform points.
  16877.  
  16878.  
  16879.  
  16880.  Parameters
  16881.  
  16882.  hdc  the engine's device context.
  16883.  
  16884.  aptl  to an array of POINTL structures containing the coordinates to be
  16885.  transformed. On completion, the array contains the new coordinates.
  16886.  
  16887.  cptl  the number of points addressed by the aptl parameter.
  16888.  
  16889.  pxform  to an XFORM structure. The structure has the following form:
  16890.  
  16891.  typedef struct _XFORM { /* xform */
  16892.      FIXED fxM11;
  16893.      FIXED fxM12;
  16894.      FIXED fxM21;
  16895.      FIXED fxM22;
  16896.      LONG  lM41;
  16897.      LONG  lM42;
  16898.  } XFORM;
  16899.  
  16900.  
  16901.   hddc  the device driver's device context.
  16902.  
  16903.  ulFunN  the function number and a mask of various flags. The low word
  16904.  contains the function number; the high word contains a mask of flags, which
  16905.  may be set by the graphics programming interface (GPI), the engine, or a
  16906.  driver. For a description of these flags, see Section 7.1.1.
  16907.  
  16908.  
  16909.  Return Value
  16910.  
  16911.  The return value is TRUE if the function is successful or FALSE if an error
  16912.  occurs.
  16913.  
  16914.  
  16915.  Errors
  16916.  
  16917.  If an error occurs during the execution of this function, the graphics
  16918.  engine or the device driver calls the WinSetErrorInfo function and records
  16919.  the associated error code. The following list contains possible error codes
  16920.  that the engine or the device driver calls record:
  16921.  
  16922.       PMERR_COORDINATE_OVERFLOW
  16923.       PMERR_INV_LENGTH_OR_COUNT
  16924.  
  16925.  
  16926.  
  16927.  
  16928.  
  16929.  Comments
  16930.  
  16931.  This function does not take into account any other transformation matrices.
  16932.  
  16933.  
  16934.  █    CookPathCurves
  16935.  ────────────────────────────────────────────────────────────────────────────
  16936.  
  16937.  BOOL CookPathCurves  (hdc, pph, api, hddc, ulFunN)
  16938.  
  16939.  HDC  hdc;                         /*handle of engine's device context */
  16940.  
  16941.  PPATH  pph;                       /*pointer to PATH structure */
  16942.  
  16943.  PPIPELINEINFO  api;               /*pointer to array of PIPELINEINFO
  16944.                                    structures */
  16945.  
  16946.  ULONG  hddc;                      /*handle of device driver's device
  16947.                                    context */
  16948.  
  16949.  ULONG  ulFunN;                    /*flags and function number */
  16950.  
  16951.  
  16952.  The CookPathCurves function starts at the first curve in the array of
  16953.  PIPELINEINFO structures and turns raw conics and lines into cooked conics
  16954.  and lines by filling in equation blocks and style information. (In this
  16955.  context, a curve is either a line or a fillet with a sharpness value.)
  16956.  
  16957.  
  16958.  Parameters
  16959.  
  16960.  hdc  the engine's device context.
  16961.  
  16962.  pph  to a PATH structure. The PATH structure contains pointers to one or
  16963.  more SUBPATH structures, which in turn point to one or more LINE and/or
  16964.  CURVE structures that define the shape of the path.
  16965.  
  16966.  api  the address of an array of PIPELINEINFO structures.
  16967.  
  16968.  hddc  the device driver's device context.
  16969.  
  16970.  ulFunN  the function number and a mask of various flags. The low word
  16971.  contains the function number; the high word contains a mask of flags, which
  16972.  may be set by the graphics programming interface (GPI), the engine, or a
  16973.  driver. For a description of these flags, see Section 7.1.1.
  16974.  
  16975.  
  16976.  Return Value
  16977.  
  16978.  The return value is TRUE if the function is successful or FALSE if an error
  16979.  occurs.
  16980.  
  16981.  
  16982.  Errors
  16983.  
  16984.  If an error occurs during the execution of this function, the graphics
  16985.  engine or the device driver calls the WinSetErrorInfo function and records
  16986.  the associated error code. The following list contains possible error codes
  16987.  that the engine or the device driver calls record:
  16988.  
  16989.       PMERR_BASE_ERROR
  16990.       PMERR_COORDINATE_OVERFLOW
  16991.       PMERR_DEV_FUNC_NOT_INSTALLED
  16992.       PMERR_HDC_BUSY
  16993.       PMERR_INV_COORD_SPACE
  16994.       PMERR_INV_HDC
  16995.       PMERR_INV_LENGTH_OR_COUNT
  16996.       PMERR_PATH_LIMIT_EXCEEDED
  16997.  
  16998.  
  16999.  
  17000.  
  17001.  
  17002.  Comments
  17003.  
  17004.  The graphics engine creates a raw path when it transforms the curves in that
  17005.  path from world space to device space by calling ConvertPath.
  17006.  
  17007.  The graphics engine creates a cooked path by examining each curve in a raw
  17008.  path. If the curve is a line, it passes the coordinates of that line to the
  17009.  device driver and the driver draws the line. If the curve is a sharp fillet,
  17010.  the engine subdivides the curve into extremely short lines that the driver
  17011.  can draw and passes the coordinates of the short lines to the device driver.
  17012.  
  17013.  
  17014.  The CookPathCurves function never uses more than half of the free blocks in
  17015.  the segments.
  17016.  
  17017.  The "cooking" process includes the following:
  17018.  
  17019.    ■   Making the equation blocks for either lines or conics.
  17020.  
  17021.    ■   Carving the conics up if in order to make them octant monotonic.
  17022.  
  17023.    ■   Computing the style─each CURVE structure has the style state─which is
  17024.        basically the length of the curve up to that point calculated with
  17025.        whatever style metric is used.
  17026.  
  17027.  
  17028.  
  17029.  
  17030.  █    CookWholePath
  17031.  ────────────────────────────────────────────────────────────────────────────
  17032.  
  17033.  BOOL CookWholePath  (hdc, pph, hddc, ulFunN)
  17034.  
  17035.  HDC  hdc;                         /*handle of engine's device context */
  17036.  
  17037.  PPATH  pph;                       /*pointer to PATH structure */
  17038.  
  17039.  ULONG  hddc;                      /*handle of device driver's device
  17040.                                    context */
  17041.  
  17042.  ULONG  ulFunN;                    /*flags and function number */
  17043.  
  17044.  
  17045.  The CookWholePath function fills the empty fields in each of the structures
  17046.  associated with a path.
  17047.  
  17048.  
  17049.  Parameters
  17050.  
  17051.  hdc  the engine's device context.
  17052.  
  17053.  pph  to a PATH structure. This structure contains pointers to one or more
  17054.  SUBPATH structures, which in turn point to one or more LINE and/or CURVE
  17055.  structures that define the shape of a path.
  17056.  
  17057.  hddc  the device driver's device context.
  17058.  
  17059.  ulFunN  the function number and a mask of various flags. The low word
  17060.  contains the function number; the high word contains a mask of flags, which
  17061.  may be set by the graphics programming interface (GPI), the engine, or a
  17062.  driver. For a description of these flags, see Section 7.1.1.
  17063.  
  17064.  
  17065.  Return Value
  17066.  
  17067.  The return value is TRUE if the function is successful or FALSE if an error
  17068.  occurs.
  17069.  
  17070.  
  17071.  Errors
  17072.  
  17073.  If an error occurs during the execution of this function, the graphics
  17074.  engine or the device driver calls the WinSetErrorInfo function and records
  17075.  the associated error code. The following list contains possible error codes
  17076.  that the engine or the device driver calls record:
  17077.  
  17078.       PMERR_BASE_ERROR
  17079.       PMERR_COORDINATE_OVERFLOW
  17080.       PMERR_DEV_FUNC_NOT_INSTALLED
  17081.       PMERR_HDC_BUSY
  17082.       PMERR_INV_HDC
  17083.       PMERR_PATH_LIMIT_EXCEEDED
  17084.  
  17085.  
  17086.  
  17087.  
  17088.  
  17089.  Comments
  17090.  
  17091.  On a display or printer, a path is a collection of curves and lines that
  17092.  form a figure. At the device driver level, a path is a collection of
  17093.  structures that describe these curves and lines.
  17094.  
  17095.  Upon creation, a path exists in its raw form. This means that only certain
  17096.  fields in the path's CURVE and LINE structures are initialized. When the
  17097.  engine or a device driver "cooks" a path, it fills in the remaining fields
  17098.  in the CURVE and LINE structures.
  17099.  
  17100.  If the cooking process exhausts memory, this function returns the error
  17101.  PMERR_PATH_LIMIT_EXCEEDED.
  17102.  
  17103.  
  17104.  █    CopyClipRegion
  17105.  ────────────────────────────────────────────────────────────────────────────
  17106.  
  17107.  LONG CopyClipRegion  (hdc, hrgn, prclBounds, flOptions, hddc, ulFunN)
  17108.  
  17109.  HDC  hdc;                         /*handle of engine's device context */
  17110.  
  17111.  HRGN  hrgn;                       /*handle of copied region */
  17112.  
  17113.  PRECTL  prclBounds;               /*address of RECTL structure */
  17114.  
  17115.  ULONG  flOptions;                 /*option flags */
  17116.  
  17117.  ULONG  hddc;                      /*handle of device driver's device
  17118.                                    context */
  17119.  
  17120.  ULONG  ulFunN;                    /*flags and function number */
  17121.  
  17122.  
  17123.  The CopyClipRegion function creates a copy of a device context's visible
  17124.  region and returns a handle identifying the new copy as well as a complexity
  17125.  code describing the new region.
  17126.  
  17127.  
  17128.  Parameters
  17129.  
  17130.  hdc  the engine's device context.
  17131.  
  17132.  hrgn  the new copy of the visible region.
  17133.  
  17134.  prclBounds  to a RECTL structure that contains the lower-left and
  17135.  upper-right coordinates of the region's bounding rectangle.
  17136.  
  17137.  flOptions  the options. This flag can be one of the following:
  17138.  
  17139.  Option                            Meaning
  17140.  ────────────────────────────────────────────────────────────────────────────
  17141.  
  17142.  COPYCRGN_ALLINTERSECT             Returns copy of the "Rao" region: the
  17143.                                    intersection of the million or so
  17144.                                    regions that describe the true clip
  17145.                                    region. The region is returned in screen
  17146.                                    coordinates (0,0 = lower-left corner of
  17147.                                    the screen).
  17148.  
  17149.  COPYCRGN_VISRGN                   Returns copy of the visible region only.
  17150.                                    The region is returned in screen
  17151.                                    coordinates (0,0 = lower-left corner of
  17152.                                    the screen).
  17153.  
  17154.  COPYCRGN_CLIPRGN                  Returns a copy of the clip region only.
  17155.                                    The region is returned in device
  17156.                                    coordinates (0,0 = lower-left corner of
  17157.                                    the device context).
  17158.  
  17159.  hddc  the device driver's device context.
  17160.  
  17161.  ulFunN  the function number and a mask of various flags. The low word
  17162.  contains the function number; the high word contains a mask of flags, which
  17163.  may be set by the graphics programming interface (GPI), the engine, or a
  17164.  driver. For a description of these flags, see Section 7.1.1.
  17165.  
  17166.  
  17167.  Return Value
  17168.  
  17169.  The return value is RGN_NULL, RGN_RECT, or RGN_COMPLEX if the function is
  17170.  successful. The return value is RGN_ERROR if an error occurs.
  17171.  
  17172.  
  17173.  Errors
  17174.  
  17175.  If an error occurs during the execution of this function, the graphics
  17176.  engine or the device driver calls the WinSetErrorInfo function and records
  17177.  the associated error code. The following list contains possible error codes
  17178.  that the engine or the device driver calls record:
  17179.  
  17180.       PMERR_DEV_FUNC_NOT_INSTALLED
  17181.       PMERR_HDC_BUSY
  17182.       PMERR_HRGN_BUSY
  17183.       PMERR_INSUFFICIENT_MEMORY
  17184.       PMERR_INV_COORDINATE
  17185.       PMERR_INV_HDC
  17186.       PMERR_INV_HRGN
  17187.       PMERR_INV_RECT
  17188.       PMERR_REGION_IS_CLIP_REGION
  17189.  
  17190.  
  17191.  If the return value is zero, the region doesn't exist.
  17192.  
  17193.  
  17194.  Comments
  17195.  
  17196.  If the prclBounds parameter points to a RECTL structure, CopyClipRegion
  17197.  copies the coordinates of the region's bounding rectangle into the
  17198.  structure. If prclBounds is NULL, CopyClipRegion does not return the
  17199.  coordinates of the bounding rectangle. The bounding-rectangle coordinates
  17200.  are defined in the same coordinate space in which the region was defined.
  17201.  
  17202.  
  17203.  █    CopyDCLoadData
  17204.  ────────────────────────────────────────────────────────────────────────────
  17205.  
  17206.  BOOL CopyDCLoadData  (hdc, flCmd, hdcSrc, hddc, ulFunN)
  17207.  
  17208.  HDC  hdc;                         /*handle of engine's device context */
  17209.  
  17210.  LONG  flCmd;                      /*option flag for copying fonts */
  17211.  
  17212.  HDC  hdcSrc;                      /*handle of source device context */
  17213.  
  17214.  ULONG  hddc;                      /*handle of device driver's device
  17215.                                    context */
  17216.  
  17217.  ULONG  ulFunN;                    /*flags and function number */
  17218.  
  17219.  
  17220.  The CopyDCLoadData function copies local identifiers, bitmaps, fonts, and
  17221.  the color table from a source device context into a target device context.
  17222.  
  17223.  
  17224.  Parameters
  17225.  
  17226.  hdc  the target device context.
  17227.  
  17228.  flCmd  whether the function should copy AVIO logical fonts, GPI logical
  17229.  fonts, or both types of fonts from the source device context. The following
  17230.  list describes the three possible options:
  17231.  
  17232.  Option                            Meaning
  17233.  ────────────────────────────────────────────────────────────────────────────
  17234.  
  17235.  1                                 Copy only Gpi logical fonts.
  17236.  
  17237.  2                                 Copy only AVIO logical fonts.
  17238.  
  17239.  3                                 Copy both Gpi and AVIO logical fonts.
  17240.  
  17241.  hdcSrc  the source device context.
  17242.  
  17243.  hddc  the device driver's device context.
  17244.  
  17245.  ulFunN  the function number and a mask of various flags. The low word
  17246.  contains the function number; the high word contains a mask of flags, which
  17247.  may be set by the graphics programming interface (GPI), the engine, or a
  17248.  driver. For a description of these flags, see Section 7.1.1.
  17249.  
  17250.  
  17251.  Return Value
  17252.  
  17253.  The return value is TRUE if the function is successful or FALSE if an error
  17254.  occurs.
  17255.  
  17256.  
  17257.  Errors
  17258.  
  17259.  If an error occurs during the execution of this function, the graphics
  17260.  engine calls the WinSetErrorInfo function and records the associated error
  17261.  code. The following list contains possible error codes that the engine may
  17262.  record:
  17263.  
  17264.       PMERR_BASE_ERROR
  17265.       PMERR_BITMAP_IS_SELECTED
  17266.       PMERR_COORDINATE_OVERFLOW
  17267.       PMERR_DEV_FUNC_NOT_INSTALLED
  17268.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  17269.       PMERR_HBITMAP_BUSY
  17270.       PMERR_HDC_BUSY
  17271.       PMERR_INSUFFICIENT_MEMORY
  17272.       PMERR_INV_BITMAP_DIMENSION
  17273.       PMERR_INV_CODEPAGE
  17274.       PMERR_INV_COLOR_DATA
  17275.       PMERR_INV_COLOR_FORMAT
  17276.       PMERR_INV_COLOR_INDEX
  17277.       PMERR_INV_COLOR_OPTIONS
  17278.       PMERR_INV_COLOR_START_INDEX
  17279.       PMERR_INV_COORD_SPACE
  17280.       PMERR_INV_COORDINATE
  17281.       PMERR_INV_DC_TYPE
  17282.       PMERR_INV_EXTENDED_LCID
  17283.       PMERR_INV_FONT_ATTRS
  17284.       PMERR_INV_FONTDEF
  17285.       PMERR_INV_HBITMAP
  17286.       PMERR_INV_HDC
  17287.       PMERR_INV_HRGN
  17288.       PMERR_INV_ID
  17289.       PMERR_INV_IN_AREA
  17290.       PMERR_INV_IN_PATH
  17291.       PMERR_INV_INFO_TABLE
  17292.       PMERR_INV_LENGTH_OR_COUNT
  17293.       PMERR_INV_RECT
  17294.       PMERR_INV_REGION_CONTROL
  17295.       PMERR_INV_SCAN_START
  17296.       PMERR_INV_SETID
  17297.       PMERR_REALIZE_NOT_SUPPORTED
  17298.       PMERR_SETID_IN_USE
  17299.  
  17300.  
  17301.  
  17302.  
  17303.  
  17304.  Comments
  17305.  
  17306.  This function copies the source device context's local identifier (lcid)
  17307.  table into the target device context. CopyDCLoadData will call the
  17308.  CreateLogicalFont function if it is necessary to create matching fonts for
  17309.  the target device context. If bitmaps in the source device context are
  17310.  different than those in the target device context, CreateLogicalFont
  17311.  performs the necessary translations.
  17312.  
  17313.  Upon completion, this function sets the source device context's color table
  17314.  and attribute bundle to their default values.
  17315.  
  17316.  The function fails if the target device context's local identifier table
  17317.  contains values used in the source device context's local identifier table.
  17318.  
  17319.  If the color table was originally created with the LCOL_REALIZABLE option
  17320.  and the device driver of the target device context does not support this
  17321.  option, a warning (PMERR_REALIZE_NOT_SUPPORTED) is logged and the color
  17322.  table is treated as non-realizable. If the device driver does support this
  17323.  option, it treats the color table as realizable.
  17324.  
  17325.  The effect of CopyDCLoadData on fonts is as follows:
  17326.  
  17327.    ■   Any logical fonts that are still in effect for the old device context
  17328.        are effectively reloaded into the new device context, using the same
  17329.        parameters as were used originally by the application.
  17330.  
  17331.    ■   Any generic fonts that were selected by match identification can still
  17332.        be selected that way, unless this font is unsuitable for the new
  17333.        device─for example, it is a raster font and the new device is a
  17334.        plotter.
  17335.  
  17336.    ■   Any device fonts that were selected by match identification may select
  17337.        a device font if the new device happens to have a font with the same
  17338.        match identifier. However, the characteristics of this font may differ
  17339.        from the original font. If the new device does not have a font with
  17340.        this match identifier, the default action is taken.
  17341.  
  17342.        The application must manage this process. If the application must use
  17343.        the font on the new device, then it should reload it, after
  17344.        determining from the QueryFonts function the characteristics and match
  17345.        identifiers of the fonts on the new device. However, if the
  17346.        application does not have to use the font on the new device, but may
  17347.        later to re-associate to the original device, then it need take no
  17348.        action. A warning will be raised if any font could not be reloaded on
  17349.        association (not on disassociation).
  17350.  
  17351.  
  17352.  
  17353.  
  17354.  █    CreateBitmap
  17355.  ────────────────────────────────────────────────────────────────────────────
  17356.  
  17357.  HBITMAP CreateBitmap  (hdc, pbmp, flCmd, pbBits, pbmi, hddc, ulFunN)
  17358.  
  17359.  HDC  hdc;                         /*handle of engine's device context */
  17360.  
  17361.  PBITMAPINFOHEADER  pbmp;          /*pointer to BITMAPINFOHEADER structure
  17362.                                    */
  17363.  
  17364.  ULONG  flCmd;                     /*initialization options */
  17365.  
  17366.  PBYTE  pbBits;                    /*pointer to bitmap bits */
  17367.  
  17368.  PBITMAPINFO  pbmi;                /*pointer to BITMAPINFO structure */
  17369.  
  17370.  ULONG  hddc;                      /*handle of device driver's device
  17371.                                    context */
  17372.  
  17373.  ULONG  ulFunN;                    /*flags and function number */
  17374.  
  17375.  
  17376.  The CreateBitmap function creates a bitmap. If the function is successful,
  17377.  it returns a handle that identifies the new bitmap.
  17378.  
  17379.  
  17380.  Parameters
  17381.  
  17382.  hdc  the engine's device context.
  17383.  
  17384.  pbmp  to a BITMAPINFOHEADER structure that specifies the width and height of
  17385.  the bitmap in pels, the number of color planes in the bitmap, and the number
  17386.  of adjacent color bits per pel. Each bitmap plane has ((cx * cBitCount +
  17387.  31)/32 * 4 * cy) bytes.
  17388.  
  17389.  flCmd  initialization information. This parameter can be one of the
  17390.  following values:
  17391.  
  17392.  Bit                               Meaning
  17393.  ────────────────────────────────────────────────────────────────────────────
  17394.  
  17395.  0                                 Reserved
  17396.  
  17397.  1                                 Reserved
  17398.  
  17399.  2                                 CBM_INIT
  17400.  
  17401.  If bit 2 is set, the function uses the values in the pbBits and pbmi
  17402.  parameters.
  17403.  
  17404.  pbBits  to the bitmap data to be copied. It is assumed that enough data is
  17405.  supplied to initialize the entire bitmap.
  17406.  
  17407.  pbmi  to a BITMAPINFO structure that contains bitmap format and color
  17408.  information.
  17409.  
  17410.  hddc  the device driver's device context.
  17411.  
  17412.  ulFunN  the function number and a mask of various flags. The low word
  17413.  contains the function number; the high word contains a mask of flags, which
  17414.  may be set by the graphics programming interface (GPI), the engine, or a
  17415.  driver. For a description of these flags, see Section 7.1.1.
  17416.  
  17417.  
  17418.  Return Value
  17419.  
  17420.  The return value is the handle of the created bitmap if the function is
  17421.  successful. Otherwise, it is zero.
  17422.  
  17423.  
  17424.  Errors
  17425.  
  17426.  If an error occurs during the execution of this function, the graphics
  17427.  engine calls the WinSetErrorInfo function and records the associated error
  17428.  code. The following list contains possible error codes that the engine may
  17429.  record:
  17430.  
  17431.       PMERR_DEV_FUNC_NOT_INSTALLED
  17432.       PMERR_HDC_BUSY
  17433.       PMERR_INSUFFICIENT_MEMORY
  17434.       PMERR_INV_BITMAP_DIMENSION
  17435.       PMERR_INV_HDC
  17436.       PMERR_INV_INFO_TABLE
  17437.       PMERR_INV_LENGTH_OR_COUNT
  17438.       PMERR_INV_SCAN_START
  17439.       PMERR_INV_USAGE_PARM
  17440.  
  17441.  
  17442.  
  17443.  
  17444.  
  17445.  Comments
  17446.  
  17447.  Bitmap size is limited by available memory; the maximum width and height are
  17448.  64K. There are several standard bitmap formats that should normally be
  17449.  adhered to. These formats are listed as follows:
  17450.  
  17451.  Bitcount                          Planes
  17452.  ────────────────────────────────────────────────────────────────────────────
  17453.  
  17454.  1                                 1
  17455.  
  17456.  4                                 1
  17457.  
  17458.  8                                 1
  17459.  
  17460.  24                                1
  17461.  
  17462.  The only bitmap formats supported are the standard formats (above) plus any
  17463.  that the device supports.
  17464.  
  17465.  The device-context handle supplied to this function must never be NULL. The
  17466.  bitmap will be created on the device specified. The bitmap can be selected
  17467.  to a different device later and the engine will handle transfer of bits from
  17468.  one device to the other but bitmaps always belong to some device.
  17469.  
  17470.  Note that a bitmap information header and a bitmap information table have
  17471.  the following structures, respectively:
  17472.  
  17473.  /* bitmap parameterization used by CreateBitmap and others */
  17474.  typedef struct _BITMAPINFOHEADER {      /* bmp */
  17475.      ULONG  cbFix;
  17476.      USHORT cx;
  17477.      USHORT cy;
  17478.      USHORT cPlanes;
  17479.      USHORT cBitCount;
  17480.  } BITMAPINFOHEADER;
  17481.  typedef BITMAPINFOHEADER FAR *PBITMAPINFOHEADER;
  17482.  
  17483.  /* RGB data for _BITMAPINFO struct */
  17484.  typedef struct _RGB {           /* rgb */
  17485.      BYTE bBlue;
  17486.      BYTE bGreen;
  17487.      BYTE bRed;
  17488.  } RGB;
  17489.  
  17490.  /* bitmap data used by SetBitmapBits and others */
  17491.  typedef struct _BITMAPINFO {    /* bmi */
  17492.      ULONG  cbFix;
  17493.      USHORT cx;
  17494.      USHORT cy;
  17495.      USHORT cPlanes;
  17496.      USHORT cBitCount;
  17497.      RGB    argbColor[1];
  17498.  } BITMAPINFO;
  17499.  typedef BITMAPINFO FAR *PBITMAPINFO;
  17500.  
  17501.  
  17502.  If the value specified for cPlanes or cBitCount is incompatible with the
  17503.  physical device specified by the hdc parameter, the engine returns an error.
  17504.  
  17505.  
  17506.  
  17507.  █    CreateJournalFile
  17508.  ────────────────────────────────────────────────────────────────────────────
  17509.  
  17510.  HJOURNAL CreateJournalFile  (pszFileName, flCmd, cbBufSize, hddc, ulFunN)
  17511.  
  17512.  PSZ  pszFileName;                 /*pointer to journal filename */
  17513.  
  17514.  ULONG  flCmd;                     /*type of journal file */
  17515.  
  17516.  LONG  cbBufSize;                  /*size of journal file (max. of 64K) */
  17517.  
  17518.  ULONG  hddc;                      /*handle of device driver's device
  17519.                                    context */
  17520.  
  17521.  ULONG  ulFunN;                    /*flags and function number */
  17522.  
  17523.  
  17524.  The CreateJournalFile function creates a journal file on a disk.
  17525.  
  17526.  
  17527.  Parameters
  17528.  
  17529.  pszFileName  to a null-terminated string that specifies the name of the
  17530.  journal file.
  17531.  
  17532.  flCmd  the type of journal file. This name can be one of the following:
  17533.  
  17534.  Constant/Value                    Meaning
  17535.  ────────────────────────────────────────────────────────────────────────────
  17536.  
  17537.  JNL_TEMP_FILE                     An temporary journal file will be
  17538.                                    created; the pszFileName parameter is
  17539.                                    ignored. The length of a temporary
  17540.                                    journal file can exceed 64K bytes.
  17541.  
  17542.  JNL_PERM_FILE                     A permanent journal file will be
  17543.                                    created; pszFileName points to a fully
  17544.                                    qualified path/file name. The length of
  17545.                                    permanent journal files can exceed 64K
  17546.                                    bytes.
  17547.  
  17548.  JNL_ENGINERAM_FILE                A memory journal file will be created in
  17549.                                    shared memory allocated by the engine;
  17550.                                    pszFileName is ignored. The length of
  17551.                                    memory journal files cannot exceed 64K
  17552.                                    bytes.
  17553.  
  17554.  JNL_USERRAM_FILE                  A memory journal file will be created in
  17555.                                    memory supplied by the application;
  17556.                                    pszFileName is the pointer to the memory.
  17557.                                    The length of memory journal files
  17558.                                    cannot exceed 64K bytes.
  17559.  
  17560.  JNL_DRAW_OPTIMIZATION             The draw bit will not be modified on
  17561.                                    accumulation or playback (otherwise, the
  17562.                                    draw bit is forced off on accumulation
  17563.                                    and is not modified on playback).
  17564.  
  17565.  JNL_BOUNDS_OPTIMIZATION           The bounds bit will be forced off on
  17566.                                    playback and not modified on
  17567.                                    accumulation (otherwise, the bounds bit
  17568.                                    is not modified on accumulation or
  17569.                                    playback).
  17570.  
  17571.  cbBufSize  the size (in bytes) of the journal file. If the size is greater
  17572.  than zero, it suggests how large the file must be (in the case of the
  17573.  constant JNL_USERRAM_FILE, cbBufSize must be greater than zero and is the
  17574.  size of the buffer, which cannot be extended).
  17575.  
  17576.  hddc  the device driver's device context.
  17577.  
  17578.  ulFunN  the function number and a mask of various flags. The low word
  17579.  contains the function number; the high word contains a mask of flags, which
  17580.  may be set by the graphics programming interface (GPI), the engine, or a
  17581.  driver. For a description of these flags, see Section 7.1.1.
  17582.  
  17583.  
  17584.  Return Value
  17585.  
  17586.  The return value is a handle that identifies the new journal file if the
  17587.  function is successful. Otherwise, it is zero.
  17588.  
  17589.  
  17590.  Errors
  17591.  
  17592.  If an error occurs during the execution of this function, the graphics
  17593.  engine calls the WinSetErrorInfo function and records the associated error
  17594.  code. The following list contains possible error codes that the engine may
  17595.  record:
  17596.  
  17597.       PMERR_BASE_ERROR
  17598.       PMERR_INSUFFICIENT_MEMORY
  17599.       PMERR_INV_IN_AREA
  17600.       PMERR_INV_IN_PATH
  17601.       PMERR_INV_JOURNAL_OPTION
  17602.       PMERR_RAM_JNL_FILE_TOO_SMALL
  17603.  
  17604.  
  17605.  
  17606.  
  17607.  
  17608.  █    CreateLogColorTable
  17609.  ────────────────────────────────────────────────────────────────────────────
  17610.  
  17611.  BOOL CreateLogColorTable  (hdc, flCmd, ulFormat, lStart, clColorData,
  17612.  plColorData, hddc, ulFunN)
  17613.  
  17614.  HDC  hdc;                         /*handle of engine's device context */
  17615.  
  17616.  ULONG  flCmd;                     /*options */
  17617.  
  17618.  ULONG  ulFormat;                  /*color-table format */
  17619.  
  17620.  LONG  lStart;                     /*starting index value */
  17621.  
  17622.  LONG  clColorData;                /*number of color-data entries */
  17623.  
  17624.  PLONG  plColorData;               /*pointer to color data */
  17625.  
  17626.  ULONG  hddc;                      /*handle of device driver's device
  17627.                                    context */
  17628.  
  17629.  ULONG  ulFunN;                    /*flags and function number */
  17630.  
  17631.  
  17632.  The CreateLogColorTable function creates a logical color table in the device
  17633.  context that hdc identifies, or it sets the RGB mode in that device context.
  17634.  A color table is an array of RGB values or an array of (index, RGB) values.
  17635.  
  17636.  
  17637.  Parameters
  17638.  
  17639.  hdc  the engine's device context.
  17640.  
  17641.  flCmd  various options. It can be one of the following:
  17642.  
  17643.  Value                             Meaning
  17644.  ────────────────────────────────────────────────────────────────────────────
  17645.  
  17646.  LCOL_RESET                        Resets the color table to its default
  17647.                                    settings before processing the remainder
  17648.                                    of the data in this function.
  17649.  
  17650.                                    If this option is set, the entry format
  17651.                                    must be LCOLF_INDRGB or LCOLF_CONSECRGB.
  17652.                                    This option is forced if the color table
  17653.                                    is currently in RGB mode and is being
  17654.                                    changed to index mode (that is, if
  17655.                                    either LCOLF_INDRGB or LCOLF_CONSECRGB
  17656.                                    is specified).
  17657.  
  17658.  LCOL_REALIZABLE                   Creates a realizable color table for the
  17659.                                    application. This may affect the way the
  17660.                                    system maps the indices when the logical
  17661.                                    color table is not realized.
  17662.  
  17663.                                    If this option is not set,
  17664.                                    RealizeColorTable may have no effect.
  17665.  
  17666.  LCOL_PURECOLOR                    Does not use color dithering for colors
  17667.                                    not available in the physical palette.
  17668.                                    If this option is set, only pure colors
  17669.                                    are used and no dithering is done.
  17670.  
  17671.                                    The default is color dithering.
  17672.  
  17673.  Other flags are reserved and must be zero.
  17674.  
  17675.  ulFormat  the format of entries in the color table. This parameter can be
  17676.  one of the following:
  17677.  
  17678.  Value                             Meaning
  17679.  ────────────────────────────────────────────────────────────────────────────
  17680.  
  17681.  LCOLF_INDRGB                      Specifies an array of (index,RGB) values.
  17682.                                    Each pair of entries is 8 bytes long: 4
  17683.                                    bytes (local format) index, and 4 bytes
  17684.                                    color value.
  17685.  
  17686.                                    This option sets the color table into
  17687.                                    index mode (and forces the LCOL_RESET
  17688.                                    option) if it is currently in RGB mode. ,
  17689.  
  17690.  LCOLF_CONSECRGB                   Specifies an array of (RGB) values,
  17691.                                    corresponding to color indices lStart
  17692.                                    upwards. Each entry is 4 bytes long.
  17693.  
  17694.                                    This option sets the color table into
  17695.                                    index mode (and forces the LCOL_RESET
  17696.                                    option) if it is currently in RGB mode. ,
  17697.  
  17698.  LCOLF_RGB                         This option sets the RGB mode in a
  17699.                                    device context.
  17700.  
  17701.  lStart  the starting color index (relevant only for the option
  17702.  LCOLF_CONSECRGB).
  17703.  
  17704.  clColorData  the number of elements supplied in the plColorData parameter.
  17705.  This parameter must contain a value that is greater than or equal to zero;
  17706.  if this value is zero, LCOLF_INDRGB and LCOLF_CONSECRGB have the same
  17707.  effect. If the format is LCOLF_INDRGB, the parameter must specify an even
  17708.  number.
  17709.  
  17710.  plColorData  to the application data area that contains the color-table
  17711.  definition data. The format depends on the value of ulFormat.
  17712.  
  17713.  Each RGB value is a 4-byte integer, whose value is determined as follows:
  17714.  
  17715.  (R * 65536) + (G * 256) + B
  17716.  
  17717.  
  17718.  where R is the red intensity value, G is the green intensity value, and B is
  17719.  the blue intensity value (since there are 8 bits for each primary color).
  17720.  The maximum intensity for each primary color is 255.
  17721.  
  17722.  hddc  the device driver's device context.
  17723.  
  17724.  ulFunN  the function number and a mask of various flags. The low word
  17725.  contains the function number; the high word contains a mask of flags, which
  17726.  may be set by the graphics programming interface (GPI), the engine, or a
  17727.  driver. For a description of these flags, see Section 7.1.1.
  17728.  
  17729.  
  17730.  Return Value
  17731.  
  17732.  The return value is TRUE if the function is successful or FALSE if an error
  17733.  occurs.
  17734.  
  17735.  
  17736.  Errors
  17737.  
  17738.  If an error occurs during the execution of this function, the device driver
  17739.  calls the WinSetErrorInfo function and records the associated error code.
  17740.  The following list contains possible error codes that the device driver may
  17741.  record:
  17742.  
  17743.       PMERR_DEV_FUNC_NOT_INSTALLED
  17744.       PMERR_INSUFFICIENT_MEMORY
  17745.       PMERR_INV_COLOR_DATA
  17746.       PMERR_INV_COLOR_FORMAT
  17747.       PMERR_INV_COLOR_INDEX
  17748.       PMERR_INV_COLOR_START_INDEX
  17749.       PMERR_INV_HDC
  17750.       PMERR_INV_IN_AREA
  17751.       PMERR_INV_IN_PATH
  17752.       PMERR_INV_LENGTH_OR_COUNT
  17753.       PMERR_REALIZE_NOT_SUPPORTED
  17754.  
  17755.  
  17756.  
  17757.  
  17758.  
  17759.  Comments
  17760.  
  17761.  When the ulFormat argument is set to LCOLF_RGB, a device driver should
  17762.  ignore the flCmd, lStart, clColorData, and plColorData arguments.
  17763.  
  17764.  When the RGB mode is set in a device context, no color table is associated
  17765.  with that device context and applications select colors using RGB values
  17766.  instead of color table indices.
  17767.  
  17768.  The CreateLogColorTable function may cause the color table to be preset to
  17769.  the default values, listed as follows:
  17770.  
  17771.  Color                             Value
  17772.  ────────────────────────────────────────────────────────────────────────────
  17773.  
  17774.  CLR_BACKGROUND                    0L
  17775.  
  17776.  CLR_BLUE                          1L
  17777.  
  17778.  CLR_RED                           2L
  17779.  
  17780.  CLR_PINK                          3L
  17781.  
  17782.  CLR_GREEN                         4L
  17783.  
  17784.  CLR_CYAN                          5L
  17785.  
  17786.  CLR_YELLOW                        6L
  17787.  
  17788.  CLR_NEUTRAL                       7L
  17789.  
  17790.  CLR_DARKGRAY                      8L
  17791.  
  17792.  CLR_PALEBLUE                      9L
  17793.  
  17794.  CLR_PALERED                       10L
  17795.  
  17796.  CLR_PALEPINK                      11L
  17797.  
  17798.  CLR_DARKGREEN                     12L
  17799.  
  17800.  CLR_DARKCYAN                      13L
  17801.  
  17802.  CLR_BROWN                         14L
  17803.  
  17804.  CLR_PALEGRAY                      15L
  17805.  
  17806.   Valid color table indices (including the default color table) are in the
  17807.  range 0 through 15.
  17808.  
  17809.  If LCOL_REALIZABLE is set, this (flag) is stored by the engine and used
  17810.  whenever the color table is copied to a device context (using the
  17811.  CopyDCLoadData function) owned by a device driver that supports this option.
  17812.  
  17813.  
  17814.  If LCOL_REALIZABLE is set and is not supported by the device driver, a
  17815.  warning (PMERR_REALIZE_NOT_SUPPORTED) is logged and the color table is
  17816.  treated as non-realizable.
  17817.  
  17818.  If LCOL_REALIZABLE is set and is supported by the device driver, this option
  17819.  is honored. All drawing takes place using the index mapping appropriate to
  17820.  the realized table, even when the table is not realized. This includes line
  17821.  drawing, character drawing, and any bitmaps set by the SetBitmapBits
  17822.  function. The colors in a non-realized picture may therefore differ markedly
  17823.  from what is required or expected.
  17824.  
  17825.  When the table is subsequently realized, however, the colors will appear as
  17826.  correctly as is possible on the device. If the logical color table can be
  17827.  completely loaded to the device, the physical color indices used will be
  17828.  such that color mixing will be predictable (that is, a pixel with a logical
  17829.  color index of 2 when mixed [using OR] with one of logical color index 1
  17830.  produces a pixel of logical color index 3), providing the device technology
  17831.  allows this─this would not, for example, be true on a plotter. But if the
  17832.  logical color table is too big to be loaded to the device, the system will
  17833.  perform a mapping, and mixing will be unpredictable. The maximum size which
  17834.  may be loaded to the device can be found by calling the QueryCaps function,
  17835.  with the CAPS_COLOR option set; the option CAPS_COLOR_TABLE_SUPPORT (also
  17836.  returned by QueryCaps) indicates whether color mixing will be predictable.
  17837.  
  17838.  
  17839.  When an application creates a logical color table without specifying the
  17840.  LCOL_REALIZABLE option, the system maps the requested RGB values to those
  17841.  values available in the default palette for the device.
  17842.  
  17843.  The first 16 colors are always available, where physically possible, on the
  17844.  device. On devices that support more than 16 colors, there may be additional
  17845.  colors available to which the requested colors may be mapped. However, there
  17846.  is no guarantee that these additional colors will be the same on different
  17847.  devices; they may also vary from release to release. Applications that
  17848.  depend upon precise colors beyond the first 16 should realize their color
  17849.  tables, unless they can tell from the color queries that the color they
  17850.  require are indeed available without realizing.
  17851.  
  17852.  By default, device contexts are in index mode and have a logical color table
  17853.  consisting of the 16 default values above. In index mode, these entries will
  17854.  always be considered part of the color table, unless they are explicitly
  17855.  overwritten. Color indices outside this range, which have not been loaded,
  17856.  are not considered to be part of the color table. Applications should not
  17857.  use color indices beyond the highest in their color table or the colors will
  17858.  not be guaranteed.
  17859.  
  17860.  
  17861.  █    CreateLogicalFont
  17862.  ────────────────────────────────────────────────────────────────────────────
  17863.  
  17864.  BOOL CreateLogicalFont  (hdc, lcid, pName, pfat, hddc, ulFunN)
  17865.  
  17866.  HDC  hdc;                         /*handle of engine's device context */
  17867.  
  17868.  LCID  lcid;                       /*local identifier of font */
  17869.  
  17870.  PSTR8  pName;                     /*pointer to font's name */
  17871.  
  17872.  PFATTRS  pfat;                    /*pointer to FATTRS structure */
  17873.  
  17874.  ULONG  hddc;                      /*handle of device driver's device
  17875.                                    context */
  17876.  
  17877.  ULONG  ulFunN;                    /*flags and function number */
  17878.  
  17879.  
  17880.  The CreateLogicalFont function selects one font from all of the fonts
  17881.  currently loaded in the system. It makes this selection by comparing
  17882.  requested font attributes to the font attributes of each loaded font. The
  17883.  requested attributes are stored in the FATTRS structure pointed to by the
  17884.  pfat parameter.
  17885.  
  17886.  
  17887.  Parameters
  17888.  
  17889.  hdc  the engine's device context.
  17890.  
  17891.  lcid  the logical font by number. The system assigns this number to the font
  17892.  if the function is successful. Values of -2, -3, and -4 correspond to AVIO
  17893.  local-identifier values of 1, 2, and 3.
  17894.  
  17895.  pName  to a null-terminated string that identifies the logical font by name.
  17896.  The maximum length of this string is eight characters.
  17897.  
  17898.  pfat  to a FATTRS structure that defines the characteristics of the
  17899.  requested font.
  17900.  
  17901.  hddc  the device driver's device context.
  17902.  
  17903.  ulFunN  the function number and a mask of various flags. The low word
  17904.  contains the function number; the high word contains a mask of flags, which
  17905.  may be set by the graphics programming interface (GPI), the engine, or a
  17906.  driver. For a description of these flags, see Section 7.1.1.
  17907.  
  17908.  
  17909.  Return Value
  17910.  
  17911.  The return value is 2 if the function successfully matched the font or 1 if
  17912.  the matching failed─in which case, the default font is used. The return
  17913.  value is zero if an error occurs.
  17914.  
  17915.  
  17916.  Errors
  17917.  
  17918.  If an error occurs during the execution of this function, the graphics
  17919.  engine calls the WinSetErrorInfo function and records the associated error
  17920.  code. The following list contains possible error codes that the engine may
  17921.  record:
  17922.  
  17923.       PMERR_BASE_ERROR
  17924.       PMERR_COORDINATE_OVERFLOW
  17925.       PMERR_DEV_FUNC_NOT_INSTALLED
  17926.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  17927.       PMERR_HDC_BUSY
  17928.       PMERR_INSUFFICIENT_MEMORY
  17929.       PMERR_INV_CODEPAGE
  17930.       PMERR_INV_COORD_SPACE
  17931.       PMERR_INV_EXTENDED_LCID
  17932.       PMERR_INV_FONT_ATTRS
  17933.       PMERR_INV_FONTDEF
  17934.       PMERR_INV_HDC
  17935.       PMERR_INV_IN_AREA
  17936.       PMERR_INV_LENGTH_OR_COUNT
  17937.       PMERR_INV_SETID
  17938.       PMERR_SETID_IN_USE
  17939.  
  17940.  
  17941.  
  17942.  
  17943.  
  17944.  Comments
  17945.  
  17946.  Font Selection
  17947.  
  17948.  When CreateLogicalFont is issued, a physical font is selected which will be
  17949.  used for this logical font. The choice is made in one of two ways:
  17950.  
  17951.    ■   The system examines the specified logical-font attributes and selects,
  17952.        from the available physical fonts, the one that best matches these
  17953.        attributes.
  17954.  
  17955.    ■   The application, having determined (by using the QueryFonts function)
  17956.        which font it requires, specifies the same lMatch value in the
  17957.        logical-font attributes as was retrieved for that font by QueryFonts.
  17958.  
  17959.  
  17960.  Once the choice has been made, it is not changed for a particular logical
  17961.  font.
  17962.  
  17963.  Fonts and Character Attributes
  17964.  
  17965.  The interaction between fonts and character attributes depends upon whether
  17966.  the transformable flag (FATTR_FONTUSE_TRANSFORMABLE) is set in the logical
  17967.  font attributes is set.
  17968.  
  17969.  If FATTR_FONTUSE_TRANSFORMABLE is set, the lAveCharWidth and
  17970.  lMaxBaselineExtent fields in the FATTRS structure are not currently used and
  17971.  should be zero. When character strings are drawn with this logical font, the
  17972.  sizes of the characters are determined by the current values of the
  17973.  character attributes. The characters are positioned, rotated, sheared, etc.,
  17974.  precisely as required; no check is made.
  17975.  
  17976.  The transformation is calculated by mapping, with respect to character angle
  17977.  and shear, the box defined by the lEmInc and lEmHeight fields in the
  17978.  FONTMETRICS structure to the character box.
  17979.  
  17980.  The character mode (precision) must be 3 when character strings are being
  17981.  drawn. The engine verifies this.
  17982.  
  17983.  If FATTR_FONTUSE_TRANSFORMABLE is not set, the lAveCharWidth and
  17984.  lMaxBaselineExtent fields define the size of the font to be used. This size
  17985.  is not affected by the character-box attribute. Either character mode 1 or 2
  17986.  may be used with such a font.
  17987.  
  17988.  In mode 1, the start of the string is positioned precisely (with respect to
  17989.  text alignment), and subsequent characters are positioned according to the
  17990.  characteristics of the font. Character box, angle, shear, extra, break
  17991.  extra, and spacing are all ignored.
  17992.  
  17993.  In mode 2, each character is positioned with respect to all of the character
  17994.  attributes, but the characters themselves are not scaled, rotated, or
  17995.  sheared.
  17996.  
  17997.  Note that an attempt to draw a character string in either of the following
  17998.  cases results in an error:
  17999.  
  18000.    ■   Mode equal to 3 and FATTR_FONTUSE_TRANSFORMABLE not set.
  18001.  
  18002.    ■   Mode not equal to 3 and FATTR_FONTUSE_TRANSFORMABLE set.
  18003.  
  18004.  
  18005.  Also, if CreateLogicalFont uses the default font when FATTRS_TRANSFORMABLE
  18006.  is specified, then mode 3 should be used only if the default font is a
  18007.  vector font or outline font. If the default font is a raster font, mode 3
  18008.  should not be used.
  18009.  
  18010.  Positioning is by the character reference point, which is defined within the
  18011.  font. When non-hollow characters are drawn using outline fonts, they are
  18012.  drawn solid, using the character color and mix mode. If characters with some
  18013.  other fill are required, they can be included within a path bracket using
  18014.  the FillPath function, which uses the pattern attributes.
  18015.  
  18016.  
  18017.  █    CreateRectRegion
  18018.  ────────────────────────────────────────────────────────────────────────────
  18019.  
  18020.  HRGN CreateRectRegion  (hdc, arcl, crcl, hddc, ulFunN)
  18021.  
  18022.  HDC  hdc;                         /*handle of engine's device context */
  18023.  
  18024.  PRECTL  arcl;                     /*pointer to array of RECTL structures
  18025.                                    */
  18026.  
  18027.  LONG  crcl;                       /*count of structures in array */
  18028.  
  18029.  ULONG  hddc;                      /*handle of device driver's device
  18030.                                    context */
  18031.  
  18032.  ULONG  ulFunN;                    /*flags and function number */
  18033.  
  18034.  
  18035.  The CreateRectRegion function creates a region by combining the rectangles
  18036.  in the array pointed to by the arcl parameter. The function creates the
  18037.  region using the OR operator, forming the union of the rectangles.
  18038.  
  18039.  
  18040.  Parameters
  18041.  
  18042.  hdc  the engine's device context.
  18043.  
  18044.  arcl  to an array of RECTL structures.
  18045.  
  18046.  crcl  the number of structures in the array.
  18047.  
  18048.  hddc  the device driver's device context.
  18049.  
  18050.  ulFunN  the function number and a mask of various flags. The low word
  18051.  contains the function number; the high word contains a mask of flags, which
  18052.  may be set by the graphics programming interface (GPI), the engine, or a
  18053.  driver. For a description of these flags, see Section 7.1.1.
  18054.  
  18055.  
  18056.  Return Value
  18057.  
  18058.  The return value is the region handle if the function is successful.
  18059.  Otherwise, it is zero.
  18060.  
  18061.  
  18062.  Errors
  18063.  
  18064.  If an error occurs during the execution of this function, the graphics
  18065.  engine or the device driver calls the WinSetErrorInfo function and records
  18066.  the associated error code. The following list contains possible error codes
  18067.  that the engine or the device driver calls record:
  18068.  
  18069.       PMERR_INSUFFICIENT_MEMORY
  18070.       PMERR_INV_COORDINATE
  18071.       PMERR_INV_HRGN
  18072.       PMERR_INV_LENGTH_OR_COUNT
  18073.       PMERR_INV_RECT
  18074.  
  18075.  
  18076.  
  18077.  
  18078.  
  18079.  Comments
  18080.  
  18081.  Points on the right and upper boundaries of a rectangle are not included in
  18082.  the region. Points on the left and lower boundaries (which are not also on
  18083.  the right and upper boundaries) of a rectangle are included in the region.
  18084.  
  18085.  For each RECTL structure in the array, the xRight field must specify a value
  18086.  greater than or equal to the value of the xLeft field, and the yTop field
  18087.  must specify a value greater than or equal to the value of the yBottom
  18088.  field.
  18089.  
  18090.  If the crcl parameter is zero, an empty region is created.
  18091.  
  18092.  The lower and left boundaries of each rectangle are considered part of the
  18093.  interior of the region, but the upper and right boundaries are not.
  18094.  
  18095.  
  18096.  █    Death
  18097.  ────────────────────────────────────────────────────────────────────────────
  18098.  
  18099.  BOOL Death  (hdc, hddc, ulFunN)
  18100.  
  18101.  HDC  hdc;                         /*handle of engine's device context */
  18102.  
  18103.  ULONG  hddc;                      /*handle of device driver's device
  18104.                                    context */
  18105.  
  18106.  ULONG  ulFunN;                    /*flags and function number */
  18107.  
  18108.  
  18109.  The Death function provides notification of a screen group switch to another
  18110.  screen group.
  18111.  
  18112.  The device driver must track Death and Resurrection calls and must not
  18113.  update the display while "dead."
  18114.  
  18115.  This function, when issued, goes directly to the device driver interface.
  18116.  
  18117.  
  18118.  Parameters
  18119.  
  18120.  hdc  Identifies the engine's device context.
  18121.  
  18122.  hddc  Identifies the device driver's device context.
  18123.  
  18124.  ulFunN  Specifies the function number and a mask of various flags. The low
  18125.  word contains the function number; the high word contains a mask of flags,
  18126.  which may be set by the graphics programming interface (GPI), the engine, or
  18127.  a driver. For a description of these flags, see Section 7.1.1.
  18128.  
  18129.  
  18130.  Return Value
  18131.  
  18132.  The return value is TRUE if the function is successful or FALSE if an error
  18133.  occurs.
  18134.  
  18135.  
  18136.  Errors
  18137.  
  18138.  If an error occurs during the execution of this function, the device driver
  18139.  calls the WinSetErrorInfo function and records the associated error code.
  18140.  The following list contains possible error codes that the device driver may
  18141.  record:
  18142.  
  18143.       PMERR_DEV_FUNC_NOT_INSTALLED
  18144.  
  18145.  
  18146.  
  18147.  
  18148.  
  18149.  
  18150.  
  18151.  █    DeleteBitmap
  18152.  ────────────────────────────────────────────────────────────────────────────
  18153.  
  18154.  BOOL DeleteBitmap  (hbm, hddc, ulFunN)
  18155.  
  18156.  HBITMAP  hbm;                     /*handle of bitmap */
  18157.  
  18158.  ULONG  hddc;                      /*handle of device driver's device
  18159.                                    context */
  18160.  
  18161.  ULONG  ulFunN;                    /*flags and function number */
  18162.  
  18163.  
  18164.  The DeleteBitmap function deletes the bitmap identified by the hbm
  18165.  parameter.
  18166.  
  18167.  
  18168.  Parameters
  18169.  
  18170.  hbm  Identifies the bitmap to be deleted.
  18171.  
  18172.  hddc  Identifies the device driver's device context.
  18173.  
  18174.  ulFunN  Specifies the function number and a mask of various flags. The low
  18175.  word contains the function number; the high word contains a mask of flags,
  18176.  which may be set by the graphics programming interface (GPI), the engine, or
  18177.  a driver. For a description of these flags, see Section 7.1.1.
  18178.  
  18179.  
  18180.  Return Value
  18181.  
  18182.  The return value is TRUE if the function is successful or FALSE if an error
  18183.  occurs.
  18184.  
  18185.  
  18186.  Errors
  18187.  
  18188.  If an error occurs during the execution of this function, the graphics
  18189.  engine calls the WinSetErrorInfo function and records the associated error
  18190.  code. The following list contains possible error codes that the engine may
  18191.  record:
  18192.  
  18193.       PMERR_BITMAP_IS_SELECTED
  18194.       PMERR_DEV_FUNC_NOT_INSTALLED
  18195.       PMERR_HBITMAP_BUSY
  18196.       PMERR_INSUFFICIENT_MEMORY
  18197.       PMERR_INV_HBITMAP
  18198.       PMERR_INV_HDC
  18199.       PMERR_INV_INFO_TABLE
  18200.       PMERR_INV_LENGTH_OR_COUNT
  18201.       PMERR_INV_SCAN_START
  18202.  
  18203.  
  18204.  
  18205.  
  18206.  
  18207.  Comments
  18208.  
  18209.  If the bitmap is currently selected into a device context, this function
  18210.  issues an error.
  18211.  
  18212.  
  18213.  █    DeleteJournalFile
  18214.  ────────────────────────────────────────────────────────────────────────────
  18215.  
  18216.  ULONG DeleteJournalFile  (hfile, hddc, ulFunN)
  18217.  
  18218.  LHANDLE  hfile;                   /*handle of journal file */
  18219.  
  18220.  ULONG  hddc;                      /*handle of device driver's device
  18221.                                    context */
  18222.  
  18223.  ULONG  ulFunN;                    /*flags and function number */
  18224.  
  18225.  
  18226.  The DeleteJournalFile function frees any objects associated with the journal
  18227.  file identified by the hfile parameter. If hfile identifies a file created
  18228.  with the JNL_TEMP_FILE or JNL_ENGINERAM_FILE options, the file is deleted.
  18229.  Finally, the file handle itself is freed.
  18230.  
  18231.  
  18232.  Parameters
  18233.  
  18234.  hfile  the journal file.
  18235.  
  18236.  hddc  the device driver's device context.
  18237.  
  18238.  ulFunN  the function number and a mask of various flags. The low word
  18239.  contains the function number; the high word contains a mask of flags, which
  18240.  may be set by the graphics programming interface (GPI), the engine, or a
  18241.  driver. For a description of these flags, see Section 7.1.1.
  18242.  
  18243.  
  18244.  Return Value
  18245.  
  18246.  The return value is GPI_OK if the function is successful or GPI_ERROR if an
  18247.  error occurs.
  18248.  
  18249.  
  18250.  Errors
  18251.  
  18252.  If an error occurs during the execution of this function, the graphics
  18253.  engine calls the WinSetErrorInfo function and records the associated error
  18254.  code. The following list contains possible error codes that the engine may
  18255.  record:
  18256.  
  18257.       PMERR_BASE_ERROR
  18258.       PMERR_BITMAP_IS_SELECTED
  18259.       PMERR_COORDINATE_OVERFLOW
  18260.       PMERR_DEV_FUNC_NOT_INSTALLED
  18261.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  18262.       PMERR_HBITMAP_BUSY
  18263.       PMERR_HDC_BUSY
  18264.       PMERR_HRGN_BUSY
  18265.       PMERR_HUGE_FONTS_NOT_SUPPORTED
  18266.       PMERR_INSUFFICIENT_MEMORY
  18267.       PMERR_INV_BACKGROUND_COL_ATTR
  18268.       PMERR_INV_BACKGROUND_MIX_ATTR
  18269.       PMERR_INV_BITMAP_DIMENSION
  18270.       PMERR_INV_CHAR_DIRECTION_ATTR
  18271.       PMERR_INV_CHAR_MODE_ATTR
  18272.       PMERR_INV_CHAR_SET_ATTR
  18273.       PMERR_INV_CHAR_SHEAR_ATTR
  18274.       PMERR_INV_CODEPAGE
  18275.       PMERR_INV_COLOR_ATTR
  18276.       PMERR_INV_COORD_SPACE
  18277.       PMERR_INV_COORDINATE
  18278.       PMERR_INV_DC_TYPE
  18279.       PMERR_INV_GEOM_LINE_WIDTH_ATTR
  18280.       PMERR_INV_HBITMAP
  18281.       PMERR_INV_HDC
  18282.       PMERR_INV_HJOURNAL
  18283.       PMERR_INV_HRGN
  18284.       PMERR_INV_ID
  18285.       PMERR_INV_IN_AREA
  18286.       PMERR_INV_IN_PATH
  18287.       PMERR_INV_INFO_TABLE
  18288.       PMERR_INV_LENGTH_OR_COUNT
  18289.       PMERR_INV_LINE_END_ATTR
  18290.       PMERR_INV_LINE_JOIN_ATTR
  18291.       PMERR_INV_LINE_TYPE_ATTR
  18292.       PMERR_INV_LINE_WIDTH_ATTR
  18293.       PMERR_INV_MARKER_SET_ATTR
  18294.       PMERR_INV_MARKER_SYMBOL_ATTR
  18295.       PMERR_INV_METAFILE
  18296.       PMERR_INV_MIX_ATTR
  18297.       PMERR_INV_PATTERN_REF_PT_ATTR
  18298.       PMERR_INV_PATTERN_SET_ATTR
  18299.       PMERR_INV_PATTERN_SET_FONT
  18300.       PMERR_INV_PRIMITIVE_TYPE
  18301.       PMERR_INV_RECT
  18302.       PMERR_INV_REGION_CONTROL
  18303.       PMERR_INV_SCAN_START
  18304.       PMERR_INV_SETID
  18305.       PMERR_JFILE_BUSY
  18306.  
  18307.       PMERR_REGION_IS_CLIP_REGION
  18308.       PMERR_UNSUPPORTED_ATTR
  18309.       PMERR_UNSUPPORTED_ATTR_VALUE
  18310.  
  18311.  
  18312.  
  18313.  
  18314.  
  18315.  █    DeleteSetId
  18316.  ────────────────────────────────────────────────────────────────────────────
  18317.  
  18318.  BOOL DeleteSetId  (hdc, lcid, hddc, ulFunN)
  18319.  
  18320.  HDC  hdc;                         /*handle of engine's device context */
  18321.  
  18322.  LCID  lcid;                       /*local identifier */
  18323.  
  18324.  ULONG  hddc;                      /*handle of device driver's device
  18325.                                    context */
  18326.  
  18327.  ULONG  ulFunN;                    /*flags and function number */
  18328.  
  18329.  
  18330.  The DeleteSetId function deletes the font or bitmap identified by the lcid
  18331.  parameter.
  18332.  
  18333.  
  18334.  Parameters
  18335.  
  18336.  hdc  the engine's device context.
  18337.  
  18338.  lcid  the lcid (local identifier) value for a font or bitmap.
  18339.  
  18340.  hddc  the device driver's device context.
  18341.  
  18342.  ulFunN  the function number and a mask of various flags. The low word
  18343.  contains the function number; the high word contains a mask of flags, which
  18344.  may be set by the graphics programming interface (GPI), the engine, or a
  18345.  driver. For a description of these flags, see Section 7.1.1.
  18346.  
  18347.  
  18348.  Return Value
  18349.  
  18350.  The return value is TRUE if the function is successful or FALSE if an error
  18351.  occurs.
  18352.  
  18353.  
  18354.  Errors
  18355.  
  18356.  If an error occurs during the execution of this function, the graphics
  18357.  engine calls the WinSetErrorInfo function and records the associated error
  18358.  code. The following list contains possible error codes that the engine may
  18359.  record:
  18360.  
  18361.       PMERR_COORDINATE_OVERFLOW
  18362.       PMERR_DEV_FUNC_NOT_INSTALLED
  18363.       PMERR_HDC_BUSY
  18364.       PMERR_INSUFFICIENT_MEMORY
  18365.       PMERR_INV_CODEPAGE
  18366.       PMERR_INV_COORD_SPACE
  18367.       PMERR_INV_EXTENDED_LCID
  18368.       PMERR_INV_FONTDEF
  18369.       PMERR_INV_HDC
  18370.       PMERR_INV_IN_AREA
  18371.       PMERR_INV_LENGTH_OR_COUNT
  18372.       PMERR_INV_SETID
  18373.       PMERR_SETID_IN_USE
  18374.       PMERR_SETID_NOT_FOUND
  18375.  
  18376.  
  18377.  
  18378.  
  18379.  
  18380.  Comments
  18381.  
  18382.  An lcid value of 0xFFFFFFFF (-1 if this were a signed number) causes all
  18383.  loaded graphics lcids (logical fonts and bitmap ids) to be destroyed. AVIO
  18384.  lcids (-2, -3, and -4) are unaffected and can only be deleted explicitly,
  18385.  one at a time.
  18386.  
  18387.  If the lcid to be deleted is selected as the current character, pattern or
  18388.  marker set, an error is logged.
  18389.  
  18390.  The lcids -2, -3, and -4, represent AVIO lcids 1, 2, and 3, respectively
  18391.  (the engine must perform the remapping between these values and 1, 2, and 3
  18392.  for the device driver).
  18393.  
  18394.  
  18395.  █    DestroyRegion
  18396.  ────────────────────────────────────────────────────────────────────────────
  18397.  
  18398.  BOOL DestroyRegion  (hdc, hrgn, hddc, ulFunN)
  18399.  
  18400.  HDC  hdc;                         /*handle of engine's device context */
  18401.  
  18402.  HRGN  hrgn;                       /*handle of region to be destroyed */
  18403.  
  18404.  ULONG  hddc;                      /*handle of device driver's device
  18405.                                    context */
  18406.  
  18407.  ULONG  ulFunN;                    /*flags and function number */
  18408.  
  18409.  
  18410.  The DestroyRegion function destroys the region identified by the hrgn
  18411.  parameter.
  18412.  
  18413.  
  18414.  Parameters
  18415.  
  18416.  hdc  the engine's device context.
  18417.  
  18418.  hrgn  the region that the function will destroy.
  18419.  
  18420.  hddc  the device driver's device context.
  18421.  
  18422.  ulFunN  the function number and a mask of various flags. The low word
  18423.  contains the function number; the high word contains a mask of flags, which
  18424.  may be set by the graphics programming interface (GPI), the engine, or a
  18425.  driver. For a description of these flags, see Section 7.1.1.
  18426.  
  18427.  
  18428.  Return Value
  18429.  
  18430.  The return value is TRUE if the function is successful or FALSE if an error
  18431.  occurs.
  18432.  
  18433.  
  18434.  Errors
  18435.  
  18436.  If an error occurs during the execution of this function, the graphics
  18437.  engine or the device driver calls the WinSetErrorInfo function and records
  18438.  the associated error code. The following list contains possible error codes
  18439.  that the engine or the device driver calls record:
  18440.  
  18441.       PMERR_HRGN_BUSY
  18442.       PMERR_INV_HRGN
  18443.       PMERR_REGION_IS_CLIP_REGION
  18444.  
  18445.  
  18446.  
  18447.  
  18448.  
  18449.  Comments
  18450.  
  18451.  If the region identified by hrgn is a clipping region or a visible region,
  18452.  DestroyRegion fails and issues an error.
  18453.  
  18454.  
  18455.  █    DeviceCreateBitmap
  18456.  ────────────────────────────────────────────────────────────────────────────
  18457.  
  18458.  HBITMAP DeviceCreateBitmap  (hdc, pbmp, flCmd, pbBits, pbmi, hddc, ulFunN)
  18459.  
  18460.  HDC  hdc;                         /*handle of engine's device context */
  18461.  
  18462.  PBITMAPINFOHEADER  pbmp;          /*pointer to BITMAPINFOHEADER structure
  18463.                                    */
  18464.  
  18465.  ULONG  flCmd;                     /*options */
  18466.  
  18467.  PBYTE  pbBits;                    /*pointer to bitmap bits */
  18468.  
  18469.  PBITMAPINFO  pbmi;                /*pointer to BITMAPINFO structure */
  18470.  
  18471.  ULONG  hddc;                      /*handle of device driver's device
  18472.                                    context */
  18473.  
  18474.  ULONG  ulFunN;                    /*flags and function number */
  18475.  
  18476.  
  18477.  The DeviceCreateBitmap function creates a bitmap with the specified format
  18478.  and returns a handle that identifies it.
  18479.  
  18480.  
  18481.  Parameters
  18482.  
  18483.  hdc  Identifies the engine's device context.
  18484.  
  18485.  pbmp  Points to a BITMAPINFOHEADER structure that specifies the width and
  18486.  height of the bitmap in pels, the number of color planes in the bitmap, and
  18487.  the number of adjacent color bits per pel. Each plane has (((cx * cBitCount
  18488.  + 31)/32) * 4 * cy) bytes.
  18489.  
  18490.  flCmd  Specifies additional information to help the device when a new bitmap
  18491.  is being created. This information is interpreted as follows:
  18492.  
  18493.  Bit                               Meaning
  18494.  ────────────────────────────────────────────────────────────────────────────
  18495.  
  18496.  0                                 Reserved.
  18497.  
  18498.  1                                 Reserved.
  18499.  
  18500.  2                                 CBM_INIT. Specifies whether to use
  18501.                                    pbBits and pbmi to initialize the newly
  18502.                                    created bitmap.
  18503.  
  18504.  
  18505.  
  18506.  Value                             Meaning
  18507.  ────────────────────────────────────────────────────────────────────────────
  18508.  
  18509.  0x0                               Do not use pbBits and pbmi to initialize
  18510.                                    the bitmap.
  18511.  
  18512.  0x1                               Use pbBits and pbmi to initialize the
  18513.                                    bitmap.
  18514.  
  18515.  Bits 16-31 may be used for operations specifically supported by the device
  18516.  driver.
  18517.  
  18518.  pbBits  Points to the bitmap data to be copied. It is assumed that enough
  18519.  data is supplied to initialize the whole bitmap.
  18520.  
  18521.  pbmi  Points to a BITMAPINFO structure that describes the format and colors
  18522.  of the data bits.
  18523.  
  18524.  hddc  Identifies the device driver's device context.
  18525.  
  18526.  ulFunN  Specifies the function number and a mask of various flags. The low
  18527.  word contains the function number; the high word contains a mask of flags,
  18528.  which may be set by the graphics programming interface (GPI), the engine, or
  18529.  a driver. For a description of these flags, see Section 7.1.1.
  18530.  
  18531.  
  18532.  Return Value
  18533.  
  18534.  The return value is the handle of the created bitmap if the function is
  18535.  successful. Otherwise, it is zero.
  18536.  
  18537.  
  18538.  Errors
  18539.  
  18540.  If an error occurs during the execution of this function, the graphics
  18541.  engine calls the WinSetErrorInfo function and records the associated error
  18542.  code. The following list contains possible error codes that the engine may
  18543.  record:
  18544.  
  18545.       PMERR_DEV_FUNC_NOT_INSTALLED
  18546.       PMERR_INSUFFICIENT_MEMORY
  18547.       PMERR_INV_BITMAP_DIMENSION
  18548.       PMERR_INV_HDC
  18549.       PMERR_INV_INFO_TABLE
  18550.       PMERR_INV_LENGTH_OR_COUNT
  18551.       PMERR_INV_SCAN_START
  18552.  
  18553.  
  18554.  
  18555.  
  18556.  
  18557.  Comments
  18558.  
  18559.  Bitmap size is limited by available memory; the maximum width and height are
  18560.  64K. There are several standard bitmap formats, which are listed as follows:
  18561.  
  18562.  
  18563.  Bitcount                          Planes
  18564.  ────────────────────────────────────────────────────────────────────────────
  18565.  
  18566.  1                                 1
  18567.  
  18568.  4                                 1
  18569.  
  18570.  8                                 1
  18571.  
  18572.  24                                1
  18573.  
  18574.  The only bitmap formats supported are these standard formats plus any that
  18575.  the device supports.
  18576.  
  18577.  The device-context handle supplied to this function must never be NULL. The
  18578.  bitmap will be created on the device specified. The bitmap can be selected
  18579.  to a different device later, and the engine will handle the transfer of bits
  18580.  from one device to the other, but bitmaps always belong to some device.
  18581.  
  18582.  If the BITMAPINFO value specified for the cPlanes or cBitCount field is
  18583.  incompatible with the physical device specified by hdc, an error occurs.
  18584.  
  18585.  
  18586.  █    DeviceDeleteBitmap
  18587.  ────────────────────────────────────────────────────────────────────────────
  18588.  
  18589.  BOOL DeviceDeleteBitmap  (hdc, hbm, pdr, flCmd, hddc, ulFunN)
  18590.  
  18591.  HDC  hdc;                         /*handle of engine's device context */
  18592.  
  18593.  HBITMAP  hbm;                     /*handle of bitmap to delete */
  18594.  
  18595.  PDELETERETURN  pdr;               /*pointer to DELETERETURN structure */
  18596.  
  18597.  ULONG  flCmd;                     /*options */
  18598.  
  18599.  ULONG  hddc;                      /*device driver's device context */
  18600.  
  18601.  ULONG  ulFunN;                    /*flags and function number */
  18602.  
  18603.  
  18604.  The DeviceDeleteBitmap function deletes the bitmap identified by the hbm
  18605.  parameter.
  18606.  
  18607.  
  18608.  Parameters
  18609.  
  18610.  hdc  the engine's device context.
  18611.  
  18612.  hbm  the bitmap to delete.
  18613.  
  18614.  pdr  to a DELETERETURN structure that contains pointers to the BITMAPINFO
  18615.  structure and the bitmap bits.
  18616.  
  18617.  flCmd  whether the bitmap requires translation. Bits 0 and 1 are reserved.
  18618.  If bit 2 is set, the engine or driver must translate the bitmap into one of
  18619.  the standard formats. Two blocks of memory must be allocated to return the
  18620.  data: one for the bitmap data, and the other for the bitmap parameters and
  18621.  color-translation table. The device driver is free to choose which standard
  18622.  format to translate into, but must take into account the parameters the
  18623.  application originally requested in the DeviceCreateBitmap call. In general,
  18624.  the device should try to use the format that requires the smallest space to
  18625.  store and does not lose any information presently in the bitmap. If this bit
  18626.  is not set, bitmap initialization is device dependent.
  18627.  
  18628.  hddc  the device driver's device context.
  18629.  
  18630.  ulFunN  the function number and a mask of various flags. The low word
  18631.  contains the function number; the high word contains a mask of flags, which
  18632.  may be set by the graphics programming interface (GPI), the engine, or a
  18633.  driver. For a description of these flags, see Section 7.1.1.
  18634.  
  18635.  
  18636.  Return Value
  18637.  
  18638.  The return value is TRUE if the function is successful or FALSE if an error
  18639.  occurs.
  18640.  
  18641.  
  18642.  Errors
  18643.  
  18644.  If an error occurs during the execution of this function, the device driver
  18645.  calls the WinSetErrorInfo function and records the associated error code.
  18646.  The following list contains possible error codes that the device driver may
  18647.  record:
  18648.  
  18649.       PMERR_DEV_FUNC_NOT_INSTALLED
  18650.       PMERR_INSUFFICIENT_MEMORY
  18651.       PMERR_INV_HDC
  18652.       PMERR_INV_INFO_TABLE
  18653.       PMERR_INV_LENGTH_OR_COUNT
  18654.       PMERR_INV_SCAN_START
  18655.  
  18656.  
  18657.  
  18658.  
  18659.  
  18660.  █    DeviceGetAttributes
  18661.  ────────────────────────────────────────────────────────────────────────────
  18662.  
  18663.  BOOL DeviceGetAttributes  (hdc, ulType, flAttrs, pAttrs, hddc, ulFunN)
  18664.  
  18665.  HDC  hdc;                         /*handle of engine's device context */
  18666.  
  18667.  ULONG  ulType;                    /*primitive-type identifier */
  18668.  
  18669.  ULONG  flAttrs;                   /*attributes mask */
  18670.  
  18671.  PBUNDLE  pBundle;                 /*pointer to attribute bundle */
  18672.  
  18673.  ULONG  hddc;                      /*handle of device driver's device
  18674.                                    context */
  18675.  
  18676.  ULONG  ulFunN;                    /*flags and function number */
  18677.  
  18678.  
  18679.  The DeviceGetAttributes function retrieves the current line, character,
  18680.  marker, area, or image attributes. The function stores the attributes in the
  18681.  bundle structure pointed to by the pBundle parameter.
  18682.  
  18683.  
  18684.  Parameters
  18685.  
  18686.  hdc  the engine's device context.
  18687.  
  18688.  ulType  the type of bundle. This parameter can be one of the following
  18689.  values:
  18690.  
  18691.  Value                             Meaning
  18692.  ────────────────────────────────────────────────────────────────────────────
  18693.  
  18694.  PRIM_LINE                         Line-attribute bundle.
  18695.  
  18696.  PRIM_CHAR                         Character-attribute bundle
  18697.  
  18698.  PRIM_MARKER                       Marker-attribute bundle
  18699.  
  18700.  PRIM_AREA                         Pattern-attribute bundle
  18701.  
  18702.  PRIM_IMAGE                        Image-attribute bundle
  18703.  
  18704.  flAttrs  the attributes to be returned. The mask contains a bit
  18705.  corresponding to each attribute in the bundle record. For all the valid bits
  18706.  set to 1 in the mask, the corresponding attribute values and default mask
  18707.  bits are returned. Only the xBB_COLOR and xBB_BACK_COLOR attributes may be
  18708.  requested (where x = L, A, C, I, or M).
  18709.  
  18710.  pBundle  to a buffer in which the current attribute settings are returned.
  18711.  The only fields updated are those corresponding to the attributes to be
  18712.  returned, as specified by the flAttrs parameter.
  18713.  
  18714.  hddc  the device driver's device context.
  18715.  
  18716.  ulFunN  the function number and a mask of various flags. The low word
  18717.  contains the function number; the high word contains a mask of flags, which
  18718.  may be set by the graphics programming interface (GPI), the engine, or a
  18719.  driver. For a description of these flags, see Section 7.1.1.
  18720.  
  18721.  
  18722.  Return Value
  18723.  
  18724.  The return value is TRUE if the function is successful or FALSE if an error
  18725.  occurs.
  18726.  
  18727.  
  18728.  Errors
  18729.  
  18730.  If an error occurs during the execution of this function, the device driver
  18731.  calls the WinSetErrorInfo function and records the associated error code.
  18732.  The following list contains possible error codes that the device driver may
  18733.  record:
  18734.  
  18735.       PMERR_DEV_FUNC_NOT_INSTALLED
  18736.       PMERR_INV_HDC
  18737.  
  18738.  
  18739.  
  18740.  
  18741.  
  18742.  █    DeviceInvalidateVisRegion
  18743.  ────────────────────────────────────────────────────────────────────────────
  18744.  
  18745.  BOOL DeviceInvalidateVisRegion  (hdc, civr, pivr, hddc, ulFunN)
  18746.  
  18747.  HDC  hdc;                         /*handle of engine's device context */
  18748.  
  18749.  ULONG  civr;                      /*count of structures */
  18750.  
  18751.  PDC_BLOCK  pivr;                  /*pointer to array of DC_BLOCK
  18752.                                    structures */
  18753.  
  18754.  ULONG  hddc;                      /*handle of device driver's device
  18755.                                    context */
  18756.  
  18757.  ULONG  ulFunN;                    /*flags and function number */
  18758.  
  18759.  
  18760.  The DeviceInvalidateVisRegion function invalidates visible regions. These
  18761.  regions are in the device contexts identified in the array pointed to by the
  18762.  pivr parameter. Display drivers must support this function.
  18763.  
  18764.  
  18765.  Parameters
  18766.  
  18767.  hdc  the engine's device context.
  18768.  
  18769.  civr  the number of structures in the array pointed to by pivr.
  18770.  
  18771.  pivr  to an array of DC_BLOCK structures. These structures define the device
  18772.  contexts for the visible regions.
  18773.  
  18774.  hddc  the device driver's device context.
  18775.  
  18776.  ulFunN  the function number and a mask of various flags. The low word
  18777.  contains the function number; the high word contains a mask of flags, which
  18778.  may be set by the graphics programming interface (GPI), the engine, or a
  18779.  driver. For a description of these flags, see Section 7.1.1.
  18780.  
  18781.  
  18782.  Return Value
  18783.  
  18784.  The return value is TRUE if this function is successful or FALSE if an error
  18785.  occurs.
  18786.  
  18787.  
  18788.  Errors
  18789.  
  18790.  If an error occurs during the execution of this function, the device driver
  18791.  calls the WinSetErrorInfo function and records the associated error code.
  18792.  The following list contains possible error codes that the device driver may
  18793.  record:
  18794.  
  18795.       PMERR_DEV_FUNC_NOT_INSTALLED
  18796.  
  18797.  
  18798.  
  18799.  
  18800.  
  18801.  █    DeviceQueryFontAttributes
  18802.  ────────────────────────────────────────────────────────────────────────────
  18803.  
  18804.  BOOL DeviceQueryFontAttributes  (hdc, cbfm, pfm, hddc, ulFunN)
  18805.  
  18806.  HDC  hdc;                         /*handle of engine's device context */
  18807.  
  18808.  LONG  cbfm;                       /*count of font metrics */
  18809.  
  18810.  PFONTMETRICS  pfm;                /*pointer to FONTMETRICS structure */
  18811.  
  18812.  ULONG  hddc;                      /*handle of device driver's device
  18813.                                    context */
  18814.  
  18815.  ULONG  ulFunN;                    /*flags and function number */
  18816.  
  18817.  
  18818.  The DeviceQueryFontAttributes function retrieves the metrics of the
  18819.  currently selected font.
  18820.  
  18821.  
  18822.  Parameters
  18823.  
  18824.  hdc  the engine's device context.
  18825.  
  18826.  cbfm  the size of the structure pointed to by the pfm parameter.
  18827.  
  18828.  pfm  to a FONTMETRICS structure where the information is to be returned.
  18829.  
  18830.  hddc  the device driver's device context.
  18831.  
  18832.  ulFunN  the function number and a mask of various flags. The low word
  18833.  contains the function number; the high word contains a mask of flags, which
  18834.  may be set by the graphics programming interface (GPI), the engine, or a
  18835.  driver. For a description of these flags, see Section 7.1.1.
  18836.  
  18837.  
  18838.  Return Value
  18839.  
  18840.  The return value is TRUE if the function is successful or FALSE if an error
  18841.  occurs.
  18842.  
  18843.  
  18844.  Errors
  18845.  
  18846.  If an error occurs during the execution of this function, the device driver
  18847.  calls the WinSetErrorInfo function and records the associated error code.
  18848.  The following list contains possible error codes that the device driver may
  18849.  record:
  18850.  
  18851.       PMERR_DEV_FUNC_NOT_INSTALLED
  18852.       PMERR_INV_HDC
  18853.  
  18854.  
  18855.  
  18856.  
  18857.  
  18858.  █    DeviceQueryFonts
  18859.  ────────────────────────────────────────────────────────────────────────────
  18860.  
  18861.  LONG DeviceQueryFonts  (hdc, flCmd, pszFaceName, afm, cbfm, pcFonts, hddc,
  18862.  ulFunN)
  18863.  
  18864.  HDC  hdc;                         /*handle of engine's device context */
  18865.  
  18866.  ULONG  flCmd;                     /*font options */
  18867.  
  18868.  PSZ  pszFaceName;                 /*pointer to facename string */
  18869.  
  18870.  PFONTMETRICS  afm;                /*pointer to array of FONTMETRICS
  18871.                                    structures */
  18872.  
  18873.  LONG  cbfm;                       /*count of bytes in each structure */
  18874.  
  18875.  PLONG  pcFonts;                   /*number of metrics requested */
  18876.  
  18877.  ULONG  hddc;                      /*handle of device driver's device
  18878.                                    context */
  18879.  
  18880.  ULONG  ulFunN;                    /*flags and function number */
  18881.  
  18882.  
  18883.  The DeviceQueryFonts function retrieves information about fonts on a device.
  18884.  The function fills the array of FONTMETRICS structures (pointed to by the
  18885.  afm parameter) with this font information.
  18886.  
  18887.  All measurements and dimensions are specified in world coordinates.
  18888.  
  18889.  
  18890.  Parameters
  18891.  
  18892.  hdc  Identifies the engine's device context.
  18893.  
  18894.  flCmd  Specifies whether the function should retrieve information about
  18895.  public fonts or private fonts. Public fonts are available to any application
  18896.  running under MS OS/2 Presentation Manager. Private fonts are available only
  18897.  to the application that loads them. The following list describes the two
  18898.  constants associated with this option:
  18899.  
  18900.  Value                             Meaning
  18901.  ────────────────────────────────────────────────────────────────────────────
  18902.  
  18903.  QF_PUBLIC                         Retrieves public fonts. Public fonts
  18904.                                    were loaded by the system and are
  18905.                                    available to all applications.
  18906.  
  18907.  QF_PRIVATE                        Retrieves private fonts. Private fonts
  18908.                                    were loaded by the application and are
  18909.                                    available only to it. .
  18910.  
  18911.  pszFaceName  to a null-terminated string that specifies the font's facename.
  18912.  If a NULL pointer is specified, all available fonts are queried.
  18913.  
  18914.  afm  to an array of FONTMETRICS structures.
  18915.  
  18916.  cbfm  the number of bytes in each FONTMETRICS structure in the array.
  18917.  
  18918.  pcFonts  to a variable that specifies the number of structures the function
  18919.  should fill. Upon completion, the function fills this parameter with the
  18920.  actual number of metrics retrieved.
  18921.  
  18922.  hddc  the device driver's device context.
  18923.  
  18924.  ulFunN  the function number and a mask of various flags. The low word
  18925.  contains the function number; the high word contains a mask of flags, which
  18926.  may be set by the graphics programming interface (GPI), the engine, or a
  18927.  driver. For a description of these flags, see Section 7.1.1.
  18928.  
  18929.  
  18930.  Return Value
  18931.  
  18932.  The return value is the number of fonts not retrieved (this allows the
  18933.  application to determine the number of fonts by specifying a count equal to
  18934.  0 in the pcFonts parameter). The return value is GPI_ALTERROR if an error
  18935.  occurs.
  18936.  
  18937.  
  18938.  Errors
  18939.  
  18940.  If an error occurs during the execution of this function, the device driver
  18941.  calls the WinSetErrorInfo function and records the associated error code.
  18942.  The following list contains possible error codes that the device driver may
  18943.  record:
  18944.  
  18945.       PMERR_DEV_FUNC_NOT_INSTALLED
  18946.       PMERR_INV_HDC
  18947.  
  18948.  
  18949.  
  18950.  
  18951.  
  18952.  █    DeviceSelectBitmap
  18953.  ────────────────────────────────────────────────────────────────────────────
  18954.  
  18955.  ULONG DeviceSelectBitmap  (hdc, hbm, hddc, ulFunN)
  18956.  
  18957.  HDC  hdc;                         /*handle of engine's device context */
  18958.  
  18959.  HBITMAP  hbm;                     /*handle of bitmap */
  18960.  
  18961.  ULONG  hddc;                      /*handle of device driver's device
  18962.                                    context */
  18963.  
  18964.  ULONG  ulFunN;                    /*flags and function number */
  18965.  
  18966.  
  18967.  The DeviceSelectBitmap function selects a bitmap into a device context.
  18968.  
  18969.  
  18970.  Parameters
  18971.  
  18972.  hdc  the engine's device context.
  18973.  
  18974.  hbm  the bitmap to select.
  18975.  
  18976.  hddc  the device driver's device context.
  18977.  
  18978.  ulFunN  the function number and a mask of various flags. The low word
  18979.  contains the function number; the high word contains a mask of flags, which
  18980.  may be set by the graphics programming interface (GPI), the engine, or a
  18981.  driver. For a description of these flags, see Section 7.1.1.
  18982.  
  18983.  
  18984.  Return Value
  18985.  
  18986.  The return value is GPI_OK if the function is successful or GPI_ERROR if an
  18987.  error occurs.
  18988.  
  18989.  
  18990.  Errors
  18991.  
  18992.  If an error occurs during the execution of this function, the device driver
  18993.  calls the WinSetErrorInfo function and records the associated error code.
  18994.  The following list contains possible error codes that the device driver may
  18995.  record:
  18996.  
  18997.       PMERR_DEV_FUNC_NOT_INSTALLED
  18998.       PMERR_INV_HDC
  18999.  
  19000.  
  19001.  
  19002.  
  19003.  
  19004.  Comments
  19005.  
  19006.  It is not necessary for this function to return a handle that identifies the
  19007.  previously selected bitmap.
  19008.  
  19009.  
  19010.  █    DeviceSetAttributes
  19011.  ────────────────────────────────────────────────────────────────────────────
  19012.  
  19013.  ULONG DeviceSetAttributes  (hdc, ulType, flDefs, flAttrs, pBundle, hddc,
  19014.  ulFunN)
  19015.  
  19016.  HDC  hdc;                         /*handle of engine's device context */
  19017.  
  19018.  ULONG  ulType;                    /*type of bundle */
  19019.  
  19020.  ULONG  flDefs;                    /*attributes to default */
  19021.  
  19022.  ULONG  flAttrs;                   /*attributes to modify */
  19023.  
  19024.  PBUNDLE  pBundle;                 /*pointer to bundle structure */
  19025.  
  19026.  ULONG  hddc;                      /*handle of device driver's device
  19027.                                    context */
  19028.  
  19029.  ULONG  ulFunN;                    /*flags and function number */
  19030.  
  19031.  
  19032.  The DeviceSetAttributes function sets the line, character, image, marker, or
  19033.  area attributes in a device context. These attributes are stored in special
  19034.  structures called bundles.
  19035.  
  19036.  
  19037.  Parameters
  19038.  
  19039.  hdc  the engine's device context.
  19040.  
  19041.  ulType  the type of bundle. This parameter can be one of the following
  19042.  values:
  19043.  
  19044.  Value                             Meaning
  19045.  ────────────────────────────────────────────────────────────────────────────
  19046.  
  19047.  PRIM_LINE                         Line-attribute bundle
  19048.  
  19049.  PRIM_CHAR                         Character-attribute bundle
  19050.  
  19051.  PRIM_MARKER                       Marker-attribute bundle
  19052.  
  19053.  PRIM_AREA                         Pattern-attribute bundle
  19054.  
  19055.  PRIM_IMAGE                        Image-attribute bundle
  19056.  
  19057.  flDefs  which attributes to set to their default values.
  19058.  
  19059.  flAttrs  which attributes to modify.
  19060.  
  19061.  pBundle  to the bundle structure that contains the default and modified
  19062.  attributes.
  19063.  
  19064.  hddc  the device driver's device context.
  19065.  
  19066.  ulFunN  the function number and a mask of various flags. The low word
  19067.  contains the function number; the high word contains a mask of flags, which
  19068.  may be set by the graphics programming interface (GPI), the engine, or a
  19069.  driver. For a description of these flags, see Section 7.1.1.
  19070.  
  19071.  
  19072.  Return Value
  19073.  
  19074.  The return value is GPI_OK if the function is successful or GPI_ERROR if an
  19075.  error occurs.
  19076.  
  19077.  
  19078.  Errors
  19079.  
  19080.  If an error occurs during the execution of this function, the device driver
  19081.  calls the WinSetErrorInfo function and records the associated error code.
  19082.  The following list contains possible error codes that the device driver may
  19083.  record:
  19084.  
  19085.       PMERR_COORDINATE_OVERFLOW
  19086.       PMERR_DEV_FUNC_NOT_INSTALLED
  19087.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  19088.       PMERR_HDC_BUSY
  19089.       PMERR_HUGE_FONTS_NOT_SUPPORTED
  19090.       PMERR_INSUFFICIENT_MEMORY
  19091.       PMERR_INV_BACKGROUND_COL_ATTR
  19092.       PMERR_INV_BACKGROUND_MIX_ATTR
  19093.       PMERR_INV_CHAR_DIRECTION_ATTR
  19094.       PMERR_INV_CHAR_MODE_ATTR
  19095.       PMERR_INV_CODEPAGE
  19096.       PMERR_INV_COLOR_ATTR
  19097.       PMERR_INV_COORD_SPACE
  19098.       PMERR_INV_HDC
  19099.       PMERR_INV_LENGTH_OR_COUNT
  19100.       PMERR_INV_LINE_TYPE_ATTR
  19101.       PMERR_INV_MIX_ATTR
  19102.       PMERR_INV_PATTERN_REF_PT_ATTR
  19103.       PMERR_INV_PATTERN_SET_ATTR
  19104.       PMERR_INV_PATTERN_SET_FONT
  19105.  
  19106.  
  19107.  
  19108.  
  19109.  
  19110.  Comments
  19111.  
  19112.  There are the following device bundle structures:
  19113.  
  19114.      DLINEBUNDLE
  19115.      LINEDEFS
  19116.      AREADEFS
  19117.      DAREABUNDLE
  19118.      DCHARBUNDLE
  19119.      CHARDEFS
  19120.      IMAGEDEFS
  19121.      DIMAGEBUNDLE
  19122.      MARKERDEFS
  19123.      DMARKERBUNDLE
  19124.  
  19125.  
  19126.  For more information, see Chapter 9, "Types, Macros, Structures."
  19127.  
  19128.  These structures consist of two bundles: a bundle of logical attributes and
  19129.  a bundle of device information. The logical bundle is the same as that used
  19130.  by the application.
  19131.  
  19132.  For characters, if CBB_SET is specified and the lcid is zero, the global
  19133.  code page should be used; otherwise, the CHARBUNDLE code page should be
  19134.  used.
  19135.  
  19136.  
  19137.  █    DeviceSetAVIOFont
  19138.  ────────────────────────────────────────────────────────────────────────────
  19139.  
  19140.  ULONG DeviceSetAVIOFont  (hdc, pff, lcid, hddc, ulFunN)
  19141.  
  19142.  HDC  hdc;                         /*handle of engine's device context */
  19143.  
  19144.  PFOCAFONT  pff;                   /*pointer to FOCAFONT structure */
  19145.  
  19146.  LCID  lcid;                       /*local identifier */
  19147.  
  19148.  ULONG  hddc;                      /*handle of device driver's device
  19149.                                    context */
  19150.  
  19151.  ULONG  ulFunN;                    /*flags and function number */
  19152.  
  19153.  
  19154.  The DeviceSetAVIOFont function supports loadable cell-image sets for
  19155.  advanced video input-and-output (AVIO) presentation spaces.
  19156.  
  19157.  The function's result is true if the given font can be used with an AVIO
  19158.  presentation space; otherwise, the result is false. The device driver
  19159.  derives a far pointer to the bit array that constitutes the image data for
  19160.  the given font and caches that address within the device context
  19161.  corresponding to the one identified by the hdc parameter.
  19162.  
  19163.  Subsequent CharRect, CharStr, and ScrollRect calls will use those cached
  19164.  addresses in the device context to create character images for local
  19165.  identifiers 1, 2, and 3.
  19166.  
  19167.  
  19168.  Parameters
  19169.  
  19170.  hdc  the engine's device context.
  19171.  
  19172.  pfoca  to a FOCAFONT structure. The structure has the following form:
  19173.  
  19174.  typedef struct _FOCAFONT { /* ff */
  19175.      FONTSIGNATURE     fsSignature;
  19176.      FOCAMETRICS       fmMetrics;
  19177.      FONTDEFINITIONHEADER fdDefinitions;
  19178.  } FOCAFONT;
  19179.  
  19180.  
  19181.  For more information, see Chapter 10, "File Formats."
  19182.  
  19183.  lcid  the font by number. This value can be 1, 2, or 3.
  19184.  
  19185.  hddc  the device driver's device context.
  19186.  
  19187.  ulFunN  the function number and a mask of various flags. The low word
  19188.  contains the function number; the high word contains a mask of flags, which
  19189.  may be set by the graphics programming interface (GPI), the engine, or a
  19190.  driver. For a description of these flags, see Section 7.1.1.
  19191.  
  19192.  
  19193.  Return Value
  19194.  
  19195.  The return value is TRUE if the function is successful or FALSE if an error
  19196.  occurs.
  19197.  
  19198.  
  19199.  Errors
  19200.  
  19201.  If an error occurs during the execution of this function, the device driver
  19202.  calls the WinSetErrorInfo function and records the associated error code.
  19203.  The following list contains possible error codes that the device driver may
  19204.  record:
  19205.  
  19206.       PMERR_DEV_FUNC_NOT_INSTALLED
  19207.       PMERR_HDC_BUSY
  19208.       PMERR_INV_CODEPAGE
  19209.       PMERR_INV_EXTENDED_LCID
  19210.       PMERR_INV_FONTDEF
  19211.       PMERR_INV_HDC
  19212.  
  19213.  
  19214.  
  19215.  
  19216.  
  19217.  █    DeviceSetCursor
  19218.  ────────────────────────────────────────────────────────────────────────────
  19219.  
  19220.  BOOL DeviceSetCursor  (hdc, pptlHotSpot, hbm, hddc, ulFunN)
  19221.  
  19222.  HDC  hdc;                         /*handle of engine's device context */
  19223.  
  19224.  PPOINTL  pptlHotSpot;             /*pointer to POINTL structure */
  19225.  
  19226.  HBITMAP  hbm;                     /*handle of cursor's bitmap */
  19227.  
  19228.  ULONG  hddc;                      /*handle of device driver's device
  19229.                                    context */
  19230.  
  19231.  ULONG  ulFunN;                    /*flags and function number */
  19232.  
  19233.  
  19234.  The DeviceSetCursor function draws the cursor bitmap, positioning its hot
  19235.  spot over the coordinates pointed to by pptlHotSpot. If hbm is NULL, the
  19236.  function removes the cursor from the display.
  19237.  
  19238.  
  19239.  Parameters
  19240.  
  19241.  hdc  the engine's device context.
  19242.  
  19243.  pptlHotSpot  to a POINTL structure that contains the cursor's hot-spot
  19244.  location.
  19245.  
  19246.  hbm  the cursor's bitmap.
  19247.  
  19248.  hddc  the device driver's device context.
  19249.  
  19250.  ulFunN  the function number and a mask of various flags. The low word
  19251.  contains the function number; the high word contains a mask of flags, which
  19252.  may be set by the graphics programming interface (GPI), the engine, or a
  19253.  driver. For a description of these flags, see Section 7.1.1.
  19254.  
  19255.  
  19256.  Return Value
  19257.  
  19258.  The return value is TRUE if the function is successful or FALSE if an error
  19259.  occurs.
  19260.  
  19261.  
  19262.  Errors
  19263.  
  19264.  If an error occurs during the execution of this function, the device driver
  19265.  calls the WinSetErrorInfo function and records the associated error code.
  19266.  The following list contains possible error codes that the device driver may
  19267.  record:
  19268.  
  19269.       PMERR_DEV_FUNC_NOT_INSTALLED
  19270.       PMERR_INV_COORDINATE
  19271.       PMERR_INV_CURSOR_BITMAP
  19272.       PMERR_INV_HDC
  19273.  
  19274.  
  19275.  
  19276.  
  19277.  
  19278.  █    DeviceSetDCOrigin
  19279.  ────────────────────────────────────────────────────────────────────────────
  19280.  
  19281.  BOOL DeviceSetDCOrigin  (hdc, pptl, hddc, ulFunN)
  19282.  
  19283.  HDC  hdc;                         /*handle of engine's device context */
  19284.  
  19285.  PPOINTL  pptl;                    /*pointer to POINTL structure */
  19286.  
  19287.  ULONG  hddc;                      /*handle of device driver's device
  19288.                                    context */
  19289.  
  19290.  ULONG  ulFunN;                    /*flags and function number */
  19291.  
  19292.  
  19293.  The DeviceSetDCOrigin function sets the device-context origin to a specified
  19294.  point, in screen coordinates.
  19295.  
  19296.  
  19297.  Parameters
  19298.  
  19299.  hdc  the engine's device context.
  19300.  
  19301.  pptl  to a POINTL structure that contains the screen coordinates of the
  19302.  device-context origin. The maximum value for these coordinates is 0x7FFE.
  19303.  
  19304.  hddc  the device driver's device context.
  19305.  
  19306.  ulFunN  the function number and a mask of various flags. The low word
  19307.  contains the function number; the high word contains a mask of flags, which
  19308.  may be set by the graphics programming interface (GPI), the engine, or a
  19309.  driver. For a description of these flags, see Section 7.1.1.
  19310.  
  19311.  
  19312.  Return Value
  19313.  
  19314.  The return value is TRUE if the function is successful or FALSE if an error
  19315.  occurs.
  19316.  
  19317.  
  19318.  Errors
  19319.  
  19320.  If an error occurs during the execution of this function, the device driver
  19321.  calls the WinSetErrorInfo function and records the associated error code.
  19322.  The following list contains possible error codes that the device driver may
  19323.  record:
  19324.  
  19325.  
  19326.  Comments
  19327.  
  19328.  The default device-context origin is (0,0). When an application creates a
  19329.  device context, the origin is set to this default value.
  19330.  
  19331.  When the device-context origin is set, the engine will align the clip
  19332.  regions at all saved levels of the device context (if one is set). The Rao
  19333.  region (the region reflecting the visible area on the screen) will not be
  19334.  recomputed until the engine receives an explicit call to do so.
  19335.  
  19336.  
  19337.  █    DeviceSetGlobalAttribute
  19338.  ────────────────────────────────────────────────────────────────────────────
  19339.  
  19340.  BOOL DeviceSetGlobalAttribute  (hdc, ulType, ulAttr, flCmd, hddc, ulFunN)
  19341.  
  19342.  HDC  hdc;                         /*handle of engine's device context */
  19343.  
  19344.  ULONG  ulType;                    /*attribute type */
  19345.  
  19346.  ULONG  ulAttr;                    /*new attribute value */
  19347.  
  19348.  LONG  flCmd;                      /*action to take */
  19349.  
  19350.  ULONG  hddc;                      /*handle of device driver's device
  19351.                                    context */
  19352.  
  19353.  ULONG  ulFunN;                    /*flags and function number */
  19354.  
  19355.  
  19356.  The DeviceSetGlobalAttribute function sets the five individual primitive
  19357.  attributes to the specified value, in the pen, pattern, character, image,
  19358.  and marker bundles.
  19359.  
  19360.  
  19361.  Parameters
  19362.  
  19363.  hdc  the engine's device context.
  19364.  
  19365.  ulType  the attribute. This parameter can be one of the following:
  19366.  
  19367.  Value                             Meaning
  19368.  ────────────────────────────────────────────────────────────────────────────
  19369.  
  19370.  1                                 Foreground color
  19371.  
  19372.  2                                 Background color
  19373.  
  19374.  3                                 Foreground mix mode
  19375.  
  19376.  4                                 Background mix mode
  19377.  
  19378.  ulAttr  the new value of the (RBG color or mix mode) attribute.
  19379.  
  19380.  flCmd  the action to take. If this parameter is GATTR_DEFAULT, the action is
  19381.  to use the default value for the attribute. All other bits are reserved and
  19382.  must be zero.
  19383.  
  19384.  hddc  the device driver's device context.
  19385.  
  19386.  ulFunN  the function number and a mask of various flags. The low word
  19387.  contains the function number; the high word contains a mask of flags, which
  19388.  may be set by the graphics programming interface (GPI), the engine, or a
  19389.  driver. For a description of these flags, see Section 7.1.1.
  19390.  
  19391.  
  19392.  Return Value
  19393.  
  19394.  The return value is TRUE if the function is successful or FALSE if an error
  19395.  occurs.
  19396.  
  19397.  
  19398.  Errors
  19399.  
  19400.  If an error occurs during the execution of this function, the device driver
  19401.  calls the WinSetErrorInfo function and records the associated error code.
  19402.  The following list contains possible error codes that the device driver may
  19403.  record:
  19404.  
  19405.       PMERR_DEV_FUNC_NOT_INSTALLED
  19406.       PMERR_INV_BACKGROUND_COL_ATTR
  19407.       PMERR_INV_BACKGROUND_MIX_ATTR
  19408.       PMERR_INV_COLOR_ATTR
  19409.       PMERR_INV_HDC
  19410.       PMERR_INV_MIX_ATTR
  19411.  
  19412.  
  19413.  
  19414.  
  19415.  
  19416.  █    DisjointLines
  19417.  ────────────────────────────────────────────────────────────────────────────
  19418.  
  19419.  int DisjointLines  (hdc, aptl, cptl, hddc, ulFunN)
  19420.  
  19421.  HDC  hdc;                         /*handle of engine's device context */
  19422.  
  19423.  PPOINTL  aptl;                    /*pointer to array of POINTL structures
  19424.                                    */
  19425.  
  19426.  LONG  cptl;                       /*count of points */
  19427.  
  19428.  ULONG  hddc;                      /*handle of device driver's device
  19429.                                    context */
  19430.  
  19431.  ULONG  ulFunN;                    /*flags and function number */
  19432.  
  19433.  
  19434.  The DisjointLines function draws a series of disjoint line segments,
  19435.  starting at the position specified by the first point in the array pointed
  19436.  to by the aptl parameter. The lines are drawn using the current line
  19437.  attributes. Upon completion, the function sets the current position to the
  19438.  last point in the series.
  19439.  
  19440.  
  19441.  Parameters
  19442.  
  19443.  hdc  the engine's device context.
  19444.  
  19445.  aptl  to an array of POINTL structures. Each structure contains the
  19446.  coordinates of a point. This array must fit within a 64K segment.
  19447.  
  19448.  cptl  the number of points. For DisjointLines, the count must be a positive
  19449.  integer divisible by two.
  19450.  
  19451.  hddc  the device driver's device context.
  19452.  
  19453.  ulFunN  the function number and a mask of various flags. The low word
  19454.  contains the function number; the high word contains a mask of flags, which
  19455.  may be set by the graphics programming interface (GPI), the engine, or a
  19456.  driver. For a description of these flags, see Section 7.1.1.
  19457.  
  19458.  
  19459.  Return Value
  19460.  
  19461.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  19462.  GPI_HITS if the detectable attribute is set for the presentation space and a
  19463.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  19464.  
  19465.  
  19466.  Errors
  19467.  
  19468.  If an error occurs during the execution of this function, the graphics
  19469.  engine calls the WinSetErrorInfo function and records the associated error
  19470.  code. The following list contains possible error codes that the engine may
  19471.  record:
  19472.  
  19473.       PMERR_BASE_ERROR
  19474.       PMERR_BITMAP_NOT_SELECTED
  19475.       PMERR_COORDINATE_OVERFLOW
  19476.       PMERR_DEV_FUNC_NOT_INSTALLED
  19477.       PMERR_HDC_BUSY
  19478.       PMERR_INV_COLOR_DATA
  19479.       PMERR_INV_COLOR_INDEX
  19480.       PMERR_INV_COORD_SPACE
  19481.       PMERR_INV_HDC
  19482.       PMERR_INV_IN_AREA
  19483.       PMERR_INV_IN_PATH
  19484.       PMERR_INV_LENGTH_OR_COUNT
  19485.       PMERR_INV_PICK_APERTURE_POSN
  19486.       PMERR_INV_RECT
  19487.       PMERR_PATH_LIMIT_EXCEEDED
  19488.       PMERR_PATH_UNKNOWN
  19489.  
  19490.  
  19491.  
  19492.  
  19493.  
  19494.  Comments
  19495.  
  19496.  For any array aptl of length n, the starting points for the line segments
  19497.  are defined by aptl[0], aptl[2], aptl[4], ..., aptl[n-1]. The endpoints for
  19498.  the line segments are defined by aptl[1], aptl[3], aptl[5], ..., aptl[n].
  19499.  
  19500.  
  19501.  █    DrawBorder
  19502.  ────────────────────────────────────────────────────────────────────────────
  19503.  
  19504.  BOOL DrawBorder  (hdc, prcl, cx, cy, clrFore, clrBack, flCmd, hddc, ulFunN)
  19505.  
  19506.  HDC  hdc;                         /*handle of engine's device context */
  19507.  
  19508.  PRECTL  prcl;                     /*pointer to RECTL structure */
  19509.  
  19510.  LONG  cx;                         /*width of border */
  19511.  
  19512.  LONG  cy;                         /*height of border */
  19513.  
  19514.  COLOR  clrFore;                   /*border color */
  19515.  
  19516.  COLOR  clrBack;                   /*interior color */
  19517.  
  19518.  ULONG  flCmd;                     /*options */
  19519.  
  19520.  ULONG  hddc;                      /*handle of device driver's device
  19521.                                    context */
  19522.  
  19523.  ULONG  ulFunN;                    /*flags and function number */
  19524.  
  19525.  
  19526.  This function draws a border inside a rectangle and optionally fills the
  19527.  interior. This is a bitblt accelerator function.
  19528.  
  19529.  If DB_INTERIOR is specified, the area contained within the given rectangle
  19530.  and not included within the borders (as given by the cx and cy parameters)
  19531.  will be drawn using the given mix mode.
  19532.  
  19533.  Degenerate cases which must be allowed:
  19534.  
  19535.  Either or both cx or cy may be given as zero. If both are given as zero, the
  19536.  interior must still be drawn. If either the x borders overlap or the y
  19537.  borders overlap, the border is drawn as a single rectangle with no interior.
  19538.  
  19539.  
  19540.  
  19541.  Parameters
  19542.  
  19543.  prcl  to a RECTL structure that contains the (device) coordinates of the
  19544.  rectangle to frame.
  19545.  
  19546.  cx  the thickness (in device coordinates) of the horizontal border segments.
  19547.  
  19548.  
  19549.  cy  the thickness (in device coordinates) of the vertical border segments.
  19550.  
  19551.  clrFore  the color of the border (any valid format).
  19552.  
  19553.  clrBack  the color of the interior (any valid format). This parameter is
  19554.  ignored if DB_AREAATTRS is specified.
  19555.  
  19556.  flCmd  the options. See "Comments" for more information.
  19557.  
  19558.  
  19559.  Return Value
  19560.  
  19561.  The return value is TRUE if the function is successful or FALSE if an error
  19562.  occurs.
  19563.  
  19564.  
  19565.  Errors
  19566.  
  19567.  If an error occurs during the execution of this function, the device driver
  19568.  calls the WinSetErrorInfo function and records the associated error code.
  19569.  The following list contains possible error codes that the device driver may
  19570.  record:
  19571.  
  19572.       PMERR_BASE_ERROR
  19573.       PMERR_BITMAP_IS_SELECTED
  19574.       PMERR_BITMAP_NOT_SELECTED
  19575.       PMERR_COORDINATE_OVERFLOW
  19576.       PMERR_DEV_FUNC_NOT_INSTALLED
  19577.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  19578.       PMERR_HBITMAP_BUSY
  19579.       PMERR_HDC_BUSY
  19580.       PMERR_HUGE_FONTS_NOT_SUPPORTED
  19581.  
  19582.       PMERR_INCOMPATIBLE_BITMAP
  19583.       PMERR_INCORRECT_DC_TYPE
  19584.       PMERR_INSUFFICIENT_MEMORY
  19585.  .ET
  19586.       PMERR_INV_BACKGROUND_COL_ATTR
  19587.       PMERR_INV_BACKGROUND_MIX_ATTR
  19588.       PMERR_INV_BITBLT_MIX
  19589.       PMERR_INV_BITBLT_STYLE
  19590.       PMERR_INV_BITMAP_DIMENSION
  19591.       PMERR_INV_CHAR_DIRECTION_ATTR
  19592.       PMERR_INV_CHAR_MODE_ATTR
  19593.       PMERR_INV_CHAR_SET_ATTR
  19594.       PMERR_INV_CHAR_SHEAR_ATTR
  19595.       PMERR_INV_CODEPAGE
  19596.       PMERR_INV_COLOR_ATTR
  19597.       PMERR_INV_COLOR_DATA
  19598.       PMERR_INV_COLOR_FORMAT
  19599.       PMERR_INV_COLOR_INDEX
  19600.       PMERR_INV_COLOR_OPTIONS
  19601.       PMERR_INV_COLOR_START_INDEX
  19602.       PMERR_INV_COORD_SPACE
  19603.       PMERR_INV_COORDINATE
  19604.       PMERR_INV_DC_DATA
  19605.       PMERR_INV_DC_TYPE
  19606.       PMERR_INV_DRAW_BORDER_OPTION
  19607.       PMERR_INV_DRIVER_NAME
  19608.       PMERR_INV_GEOM_LINE_WIDTH_ATTR
  19609.       PMERR_INV_HBITMAP
  19610.       PMERR_INV_HDC
  19611.       PMERR_INV_HRGN
  19612.       PMERR_INV_ID
  19613.       PMERR_INV_IN_AREA
  19614.       PMERR_INV_IN_PATH
  19615.       PMERR_INV_INFO_TABLE
  19616.       PMERR_INV_LENGTH_OR_COUNT
  19617.       PMERR_INV_LINE_END_ATTR
  19618.       PMERR_INV_LINE_JOIN_ATTR
  19619.       PMERR_INV_LINE_TYPE_ATTR
  19620.       PMERR_INV_LINE_WIDTH_ATTR
  19621.       PMERR_INV_MARKER_SET_ATTR
  19622.       PMERR_INV_MARKER_SYMBOL_ATTR
  19623.       PMERR_INV_MIX_ATTR
  19624.       PMERR_INV_PATTERN_REF_PT_ATTR
  19625.       PMERR_INV_PATTERN_SET_ATTR
  19626.       PMERR_INV_PATTERN_SET_FONT
  19627.       PMERR_INV_PICK_APERTURE_POSN
  19628.       PMERR_INV_PRIMITIVE_TYPE
  19629.       PMERR_INV_RECT
  19630.       PMERR_INV_REGION_CONTROL
  19631.       PMERR_INV_SCAN_START
  19632.       PMERR_INV_SETID
  19633.       PMERR_INV_USAGE_PARM
  19634.       PMERR_REALIZE_NOT_SUPPORTED
  19635.       PMERR_UNSUPPORTED_ATTR
  19636.       PMERR_UNSUPPORTED_ATTR_VALUE
  19637.  
  19638.  
  19639.  
  19640.  
  19641.  
  19642.  Comments
  19643.  
  19644.  If the flCmd parameter is DB_ROP, it specifies the mix for the interior and
  19645.  the border and can be one of the following values:
  19646.  
  19647.  Value                             Meaning
  19648.  ────────────────────────────────────────────────────────────────────────────
  19649.  
  19650.  DB_PATCOPY                        Copies the pattern to the destination
  19651.                                    using the raster operation ROP_PATCOPY
  19652.                                    (performs the operation D = P).
  19653.  
  19654.  DB_PATINVERT                      Performs an exclusive-OR (XOR) operation
  19655.                                    of the pattern with the destination
  19656.                                    using the raster operation ROP_PATINVERT
  19657.                                    (performs the operation D = DPx).
  19658.  
  19659.  DB_DESTINVERT                     Inverts the destination using the raster
  19660.                                    operation ROP_DESTINVERT (performs the
  19661.                                    operation D = Dn).
  19662.  
  19663.  DB_AREAMIXMODE                    Maps the current area foreground mix
  19664.                                    mode into a Bitblt raster operation (the
  19665.                                    area background mix mode is ignored).
  19666.  
  19667.  If the flCmd parameter is DB_AREAATTRS, it specifies that for any border,
  19668.  the pattern used will be the pattern as currently defined in the area
  19669.  attribute. For any interior, the pattern used will be the same as if a
  19670.  SetAttributes call for the area attributes was made with the area
  19671.  attribute's background color being passed for the foreground color, and the
  19672.  area attribute's foreground color being passed as its background color.
  19673.  
  19674.  If flCmd is not DB_AREAATTRS, then for any border or interior, the pattern
  19675.  used will be the same as if a SetAttributes call for the area attributes was
  19676.  made with a foreground color of clrFore and a background color of clrBack.
  19677.  
  19678.  If flCmd is DB_STANDARD or DB_DLGBORDER, the engine and device driver ignore
  19679.  the value.
  19680.  
  19681.  The DB_PATCOPY and DB_PATINVERT mix modes are mutually exclusive.
  19682.  DB_PATINVERT may not be used with either DB_INTERIOR or DB_AREAATTRS.
  19683.  
  19684.  Unless DB_PATCOPY or DB_PATINVERT is specified, the current mix mode is
  19685.  used.
  19686.  
  19687.  
  19688.  █    DrawConicsInPath
  19689.  ────────────────────────────────────────────────────────────────────────────
  19690.  
  19691.  BOOL DrawConicsInPath  (hdc, pph, pcvFirst, ccv, hddc, ulFunN)
  19692.  
  19693.  HDC  hdc;                         /*handle of engine's device context */
  19694.  
  19695.  PPATH  pph;                       /*pointer to PATH structure */
  19696.  
  19697.  PCURVE  pcvFirst;                 /*pointer to first CURVE structure in
  19698.                                    path */
  19699.  
  19700.  LONG  ccv;                        /*count of structures in path */
  19701.  
  19702.  ULONG  hddc;                      /*handle of device driver's device
  19703.                                    context */
  19704.  
  19705.  ULONG  ulFunN;                    /*flags and function number */
  19706.  
  19707.  
  19708.  The DrawConicsInPath function draws the curves in a path.
  19709.  
  19710.  
  19711.  Parameters
  19712.  
  19713.  hdc  the engine's device context.
  19714.  
  19715.  pph  to a PATH structure. This structure is the second in a linked list of
  19716.  structures that form a path. (The first structure is a PATHSEGMENT
  19717.  structure, and the third through last structures are SUBPATH, LINE, and
  19718.  CURVE.)
  19719.  
  19720.  pcvFirst  to the first CURVE structure in a path.
  19721.  
  19722.  ccv  the count of CURVE structures in the path.
  19723.  
  19724.  hddc  the device driver's device context.
  19725.  
  19726.  ulFunN  the function number and a mask of various flags. The low word
  19727.  contains the function number; the high word contains a mask of flags, which
  19728.  may be set by the graphics programming interface (GPI), the engine, or a
  19729.  driver. For a description of these flags, see Section 7.1.1.
  19730.  
  19731.  
  19732.  Return Value
  19733.  
  19734.  The return value is TRUE if the function is successful or FALSE if an error
  19735.  occurs.
  19736.  
  19737.  
  19738.  Errors
  19739.  
  19740.  If an error occurs during the execution of this function, the graphics
  19741.  engine or the device driver calls the WinSetErrorInfo function and records
  19742.  the associated error code. The following list contains possible error codes
  19743.  that the engine or the device driver calls record:
  19744.  
  19745.       PMERR_BITMAP_NOT_SELECTED
  19746.       PMERR_COORDINATE_OVERFLOW
  19747.       PMERR_DEV_FUNC_NOT_INSTALLED
  19748.       PMERR_HDC_BUSY
  19749.       PMERR_INV_COLOR_DATA
  19750.       PMERR_INV_COLOR_INDEX
  19751.       PMERR_INV_COORD_SPACE
  19752.       PMERR_INV_HDC
  19753.       PMERR_INV_IN_AREA
  19754.       PMERR_INV_IN_PATH
  19755.       PMERR_INV_LENGTH_OR_COUNT
  19756.       PMERR_INV_PICK_APERTURE_POSN
  19757.  
  19758.  
  19759.  
  19760.  
  19761.  
  19762.  Comments
  19763.  
  19764.  DrawConicsInPath draws the fillets and lines in a path. (This function
  19765.  passes the endpoints of all lines to the driver, which then draws the
  19766.  lines.)
  19767.  
  19768.  This function processes all coordinates as device coordinates.
  19769.  
  19770.  
  19771.  █    DrawCookedPath
  19772.  ────────────────────────────────────────────────────────────────────────────
  19773.  
  19774.  BOOL DrawCookedPath  (hdc, pph, pcvFirst, ccv, hddc, ulFunN)
  19775.  
  19776.  HDC  hdc;                         /*handle of engine's device context */
  19777.  
  19778.  PPATH  pph;                       /*pointer to PATH structure */
  19779.  
  19780.  PCURVE  pcvFirst;                 /*pointer to first CURVE structure */
  19781.  
  19782.  LONG  ccv;                        /*count of curves */
  19783.  
  19784.  ULONG  hddc;                      /*handle of device driver's device
  19785.                                    context */
  19786.  
  19787.  ULONG  ulFunN;                    /*flags and function number */
  19788.  
  19789.  
  19790.  The DrawCookedPath function draws from the number of curves specified by the
  19791.  ccv parameter. The function calls the Clip1DPath and ClipPathCurves
  19792.  functions to clip batches of curves, uses the DrawLinesInPath and
  19793.  DrawConicsInPath functions to draw the resulting curve, and draws all curves
  19794.  it is given before returning.
  19795.  
  19796.  
  19797.  Parameters
  19798.  
  19799.  hdc  the engine's device context.
  19800.  
  19801.  pph  to a PATH structure that defines the path.
  19802.  
  19803.  pcvFirst  to the first CURVE structure in the path.
  19804.  
  19805.  ccv  a count of the number of curves.
  19806.  
  19807.  hddc  the device driver's device context.
  19808.  
  19809.  ulFunN  the function number and a mask of various flags. The low word
  19810.  contains the function number; the high word contains a mask of flags, which
  19811.  may be set by the graphics programming interface (GPI), the engine, or a
  19812.  driver. For a description of these flags, see Section 7.1.1.
  19813.  
  19814.  
  19815.  Return Value
  19816.  
  19817.  The return value is TRUE if the function is successful or FALSE if an error
  19818.  occurs.
  19819.  
  19820.  
  19821.  Errors
  19822.  
  19823.  If an error occurs during the execution of this function, the graphics
  19824.  engine or the device driver calls the WinSetErrorInfo function and records
  19825.  the associated error code. The following list contains possible error codes
  19826.  that the engine or the device driver calls record:
  19827.  
  19828.       PMERR_BASE_ERROR
  19829.       PMERR_BITMAP_NOT_SELECTED
  19830.       PMERR_COORDINATE_OVERFLOW
  19831.       PMERR_DEV_FUNC_NOT_INSTALLED
  19832.       PMERR_HDC_BUSY
  19833.       PMERR_INV_COLOR_DATA
  19834.       PMERR_INV_COLOR_INDEX
  19835.       PMERR_INV_COORD_SPACE
  19836.       PMERR_INV_HDC
  19837.       PMERR_INV_IN_AREA
  19838.       PMERR_INV_IN_PATH
  19839.       PMERR_INV_LENGTH_OR_COUNT
  19840.       PMERR_INV_PICK_APERTURE_POSN
  19841.       PMERR_INV_RECT
  19842.  
  19843.  
  19844.  
  19845.  
  19846.  
  19847.  █    DrawLinesInPath
  19848.  ────────────────────────────────────────────────────────────────────────────
  19849.  
  19850.  BOOL DrawLinesInPath  (hdc, pph, pcvFirst, ccv, hddc, ulFunN)
  19851.  
  19852.  HDC  hdc;                         /*handle of engine's device context */
  19853.  
  19854.  PPATH  pph;                       /*pointer to PATH structure */
  19855.  
  19856.  PCURVE  pcvFirst;                 /*pointer to first CURVE structure */
  19857.  
  19858.  LONG  ccv;                        /*count of curves */
  19859.  
  19860.  ULONG  hddc;                      /*handle of device driver's device
  19861.                                    context */
  19862.  
  19863.  ULONG  ulFunN;                    /*flags and function number */
  19864.  
  19865.  
  19866.  The DrawLinesInPath function draws lines that it finds in the path specified
  19867.  by the pph parameter. The number of lines drawn is specified in the ccv
  19868.  parameter. This function is on the bottom of the pipeline and the lines have
  19869.  all been clipped to both the region and the clip path.
  19870.  
  19871.  The coordinates for DrawLinesInPath are screen coordinates. Note that this
  19872.  is a required function but that PolyLine is not.
  19873.  
  19874.  This function will be called only if all the curves in a path are lines.
  19875.  
  19876.  
  19877.  Parameters
  19878.  
  19879.  hdc  the engine's device context.
  19880.  
  19881.  pph  to a PATH structure that defines the path.
  19882.  
  19883.  pcvFirst  to the first CURVE structure in the path.
  19884.  
  19885.  ccv  a count of the number of curves.
  19886.  
  19887.  hddc  the device driver's device context.
  19888.  
  19889.  ulFunN  the function number and a mask of various flags. The low word
  19890.  contains the function number; the high word contains a mask of flags, which
  19891.  may be set by the graphics programming interface (GPI), the engine, or a
  19892.  driver. For a description of these flags, see Section 7.1.1.
  19893.  
  19894.  
  19895.  Return Value
  19896.  
  19897.  The return value is TRUE if the function is successful or FALSE if an error
  19898.  occurs.
  19899.  
  19900.  
  19901.  Errors
  19902.  
  19903.  If an error occurs during the execution of this function, the device driver
  19904.  calls the WinSetErrorInfo function and records the associated error code.
  19905.  The following list contains possible error codes that the device driver may
  19906.  record:
  19907.  
  19908.       PMERR_BITMAP_NOT_SELECTED
  19909.       PMERR_COORDINATE_OVERFLOW
  19910.       PMERR_DEV_FUNC_NOT_INSTALLED
  19911.       PMERR_HDC_BUSY
  19912.       PMERR_INV_COLOR_DATA
  19913.       PMERR_INV_COLOR_INDEX
  19914.       PMERR_INV_COORD_SPACE
  19915.       PMERR_INV_HDC
  19916.       PMERR_INV_IN_AREA
  19917.       PMERR_INV_IN_PATH
  19918.       PMERR_INV_LENGTH_OR_COUNT
  19919.       PMERR_INV_PICK_APERTURE_POSN
  19920.  
  19921.  
  19922.  
  19923.  
  19924.  
  19925.  █    DrawRawPath
  19926.  ────────────────────────────────────────────────────────────────────────────
  19927.  
  19928.  BOOL DrawRawPath  (hdc, pph, hddc, ulFunN)
  19929.  
  19930.  HDC  hdc;                         /*handle of engine's device context */
  19931.  
  19932.  PPATH  pph;                       /*pointer to PATH structure */
  19933.  
  19934.  ULONG  hddc;                      /*handle of device driver's device
  19935.                                    context */
  19936.  
  19937.  ULONG  ulFunN;                    /*flags and function number */
  19938.  
  19939.  
  19940.  The DrawRawPath function processes raw paths by calling the CookPathCurves
  19941.  and DrawCookedPath functions. It returns after processing the entire path.
  19942.  
  19943.  
  19944.  Parameters
  19945.  
  19946.  hdc  the engine's device context.
  19947.  
  19948.  pph  to the PATH structure that defines the path.
  19949.  
  19950.  hddc  the device driver's device context.
  19951.  
  19952.  ulFunN  the function number and a mask of various flags. The low word
  19953.  contains the function number; the high word contains a mask of flags, which
  19954.  may be set by the graphics programming interface (GPI), the engine, or a
  19955.  driver. For a description of these flags, see Section 7.1.1.
  19956.  
  19957.  
  19958.  Return Value
  19959.  
  19960.  The return value is TRUE if the function is successful or FALSE if an error
  19961.  occurs.
  19962.  
  19963.  
  19964.  Errors
  19965.  
  19966.  If an error occurs during the execution of this function, the graphics
  19967.  engine or the device driver calls the WinSetErrorInfo function and records
  19968.  the associated error code. The following list contains possible error codes
  19969.  that the engine or the device driver calls record:
  19970.  
  19971.       PMERR_BASE_ERROR
  19972.       PMERR_BITMAP_NOT_SELECTED
  19973.       PMERR_COORDINATE_OVERFLOW
  19974.       PMERR_DEV_FUNC_NOT_INSTALLED
  19975.       PMERR_HDC_BUSY
  19976.       PMERR_INV_COLOR_DATA
  19977.       PMERR_INV_COLOR_INDEX
  19978.       PMERR_INV_COORD_SPACE
  19979.       PMERR_INV_HDC
  19980.       PMERR_INV_IN_AREA
  19981.       PMERR_INV_IN_PATH
  19982.       PMERR_INV_LENGTH_OR_COUNT
  19983.       PMERR_INV_PICK_APERTURE_POSN
  19984.       PMERR_INV_RECT
  19985.       PMERR_PATH_LIMIT_EXCEEDED
  19986.  
  19987.  
  19988.  
  19989.  
  19990.  
  19991.  Comments
  19992.  
  19993.  DrawRawPath processes only paths that have a single subpath.
  19994.  
  19995.  The Arc, PolyFilletSharp, and other curve-drawing functions call the
  19996.  DrawRawPath function.
  19997.  
  19998.  
  19999.  █    EndArea
  20000.  ────────────────────────────────────────────────────────────────────────────
  20001.  
  20002.  int EndArea  (hdc, fCancel, hddc, ulFunN)
  20003.  
  20004.  HDC  hdc;                         /*handle of engine's device context */
  20005.  
  20006.  ULONG  fCancel;                   /*options flag */
  20007.  
  20008.  ULONG  hddc;                      /*handle of device driver's device
  20009.                                    context */
  20010.  
  20011.  ULONG  ulFunN;                    /*flags and function number */
  20012.  
  20013.  
  20014.  The EndArea function defines the end of an area bracket. An area bracket is
  20015.  a set of line and/or arc functions that define the shape of an area's
  20016.  borders.
  20017.  
  20018.  
  20019.  Parameters
  20020.  
  20021.  hdc  the engine's device context.
  20022.  
  20023.  fCancel  whether the function should draw the area. If this parameter is
  20024.  EA_DRAW, the area is to be drawn. If this parameter is EA_CANCEL, the area
  20025.  is to be canceled (terminated without being drawn).
  20026.  
  20027.  hddc  the device driver's device context.
  20028.  
  20029.  ulFunN  the function number and a mask of various flags. The low word
  20030.  contains the function number; the high word contains a mask of flags, which
  20031.  may be set by the graphics programming interface (GPI), the engine, or a
  20032.  driver. For a description of these flags, see Section 7.1.1.
  20033.  
  20034.  
  20035.  Return Value
  20036.  
  20037.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  20038.  GPI_HITS if the detectable attribute is set for the presentation space and a
  20039.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  20040.  
  20041.  
  20042.  Errors
  20043.  
  20044.  If an error occurs during the execution of this function, the graphics
  20045.  engine or the device driver calls the WinSetErrorInfo function and records
  20046.  the associated error code. The following list contains possible error codes
  20047.  that the engine or the device driver calls record:
  20048.  
  20049.       PMERR_BASE_ERROR
  20050.       PMERR_BITMAP_NOT_SELECTED
  20051.       PMERR_COORDINATE_OVERFLOW
  20052.       PMERR_DEV_FUNC_NOT_INSTALLED
  20053.  
  20054.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  20055.       PMERR_HDC_BUSY
  20056.       PMERR_HRGN_BUSY
  20057.       PMERR_HUGE_FONTS_NOT_SUPPORTED
  20058.       PMERR_INSUFFICIENT_MEMORY
  20059.       PMERR_INV_AREA_CONTROL
  20060.       PMERR_INV_BACKGROUND_COL_ATTR
  20061.       PMERR_INV_BACKGROUND_MIX_ATTR
  20062.       PMERR_INV_CHAR_DIRECTION_ATTR
  20063.       PMERR_INV_CHAR_MODE_ATTR
  20064.       PMERR_INV_CODEPAGE
  20065.       PMERR_INV_COLOR_ATTR
  20066.       PMERR_INV_COLOR_DATA
  20067.       PMERR_INV_COLOR_INDEX
  20068.       PMERR_INV_COORD_SPACE
  20069.       PMERR_INV_COORDINATE
  20070.       PMERR_INV_HDC
  20071.       PMERR_INV_HRGN
  20072.       PMERR_INV_IN_AREA
  20073.       PMERR_INV_IN_PATH
  20074.       PMERR_INV_LENGTH_OR_COUNT
  20075.       PMERR_INV_LINE_TYPE_ATTR
  20076.       PMERR_INV_MIX_ATTR
  20077.       PMERR_INV_PATTERN_REF_PT_ATTR
  20078.       PMERR_INV_PATTERN_SET_ATTR
  20079.       PMERR_INV_PATTERN_SET_FONT
  20080.       PMERR_INV_PICK_APERTURE_POSN
  20081.       PMERR_INV_RECT
  20082.       PMERR_INV_REGION_CONTROL
  20083.       PMERR_NOT_IN_AREA
  20084.       PMERR_PATH_LIMIT_EXCEEDED
  20085.       PMERR_REGION_IS_CLIP_REGION
  20086.  
  20087.  
  20088.  
  20089.  
  20090.  
  20091.  Comments
  20092.  
  20093.  By calling EndArea with fCancel set to 1, the area bracket is reset to a
  20094.  known state. (When fCancel is 1, an EndArea call is valid, even when it
  20095.  isn't preceded by a BeginArea call.)
  20096.  
  20097.  If there is a correlation hit on any part of the area interior, it is
  20098.  indicated by a return code. (Correlation hits on the boundary are indicated
  20099.  by a return code of the primitive causing the hit.)
  20100.  
  20101.  If the current figure is not closed, this function generates a closure line
  20102.  from the current position to the start of the current figure. If a
  20103.  correlation hit falls on this line as well as on the area interior, a
  20104.  special return code indicates this double hit.
  20105.  
  20106.  On devices in which the hardware assists in filling areas (such as by using
  20107.  an area fill plane), this assistance may be used, or the area definition may
  20108.  be built up in an area fill plane in ordinary memory. For convex figures, it
  20109.  may be faster to record the starting and ending pel positions across each
  20110.  scan line. Whatever algorithms are used, the area interiors must be filled
  20111.  identically in each case; otherwise, bitmap operations may fail to join
  20112.  correctly when copied to the screen, etc. This identical filling is
  20113.  especially important when the area is being moved around the screen using a
  20114.  mix mode of XOR in order to remove it.
  20115.  
  20116.  Upon completion, the current (x,y) position is the last position specified
  20117.  in the boundary definition, unless the figure was closed, in which case it
  20118.  is the start of the last figure in the area definition.
  20119.  
  20120.  
  20121.  █    EndPath
  20122.  ────────────────────────────────────────────────────────────────────────────
  20123.  
  20124.  BOOL EndPath  (hdc, fCancel, hddc, ulFunN)
  20125.  
  20126.  HDC  hdc;                         /*handle of engine's device context */
  20127.  
  20128.  ULONG  fCancel;                   /*options flag */
  20129.  
  20130.  ULONG  hddc;                      /*handle of device driver's device
  20131.                                    context */
  20132.  
  20133.  ULONG  ulFunN;                    /*flags and function number */
  20134.  
  20135.  
  20136.  The EndPath function defines the end of a path bracket. A path bracket is a
  20137.  set of graphics functions that define the shape of a path.
  20138.  
  20139.  
  20140.  Parameters
  20141.  
  20142.  hdc  the engine's device context.
  20143.  
  20144.  fCancel  whether the function should create the path. If this parameter is
  20145.  zero, the path is created. If the parameter is 1, the path is canceled
  20146.  (terminated without being created).
  20147.  
  20148.  hddc  the device driver's device context.
  20149.  
  20150.  ulFunN  the function number and a mask of various flags. The low word
  20151.  contains the function number; the high word contains a mask of flags, which
  20152.  may be set by the graphics programming interface (GPI), the engine, or a
  20153.  driver. For a description of these flags, see Section 7.1.1.
  20154.  
  20155.  
  20156.  Return Value
  20157.  
  20158.  The return value is TRUE if the function is successful or FALSE if an error
  20159.  occurs.
  20160.  
  20161.  
  20162.  Errors
  20163.  
  20164.  If an error occurs during the execution of this function, the graphics
  20165.  engine or the device driver calls the WinSetErrorInfo function and records
  20166.  the associated error code. The following list contains possible error codes
  20167.  that the engine or the device driver calls record:
  20168.  
  20169.       PMERR_BASE_ERROR
  20170.       PMERR_COORDINATE_OVERFLOW
  20171.       PMERR_DEV_FUNC_NOT_INSTALLED
  20172.       PMERR_HDC_BUSY
  20173.       PMERR_INV_END_PATH_OPTIONS
  20174.       PMERR_INV_HDC
  20175.       PMERR_NOT_IN_PATH
  20176.       PMERR_PATH_LIMIT_EXCEEDED
  20177.  
  20178.  
  20179.  
  20180.  
  20181.  
  20182.  Comments
  20183.  
  20184.  An EndPath call (when fCancel equals 1) without a previous call to the
  20185.  BeginPath function is valid but has no effect. So it is possible to reset
  20186.  the path bracket to a known state without any knowledge of its current
  20187.  state.
  20188.  
  20189.  
  20190.  █    EqualRegion
  20191.  ────────────────────────────────────────────────────────────────────────────
  20192.  
  20193.  int EqualRegion  (hdc, hrgnSrc1, hrgnSrc2, hddc, ulFunN)
  20194.  
  20195.  HDC  hdc;                         /*handle of engine's device context */
  20196.  
  20197.  HRGN  hrgnSrc1;                   /*handle of source region 1 */
  20198.  
  20199.  HRGN  hrgnSrc2;                   /*handle of source region 2 */
  20200.  
  20201.  ULONG  hddc;                      /*handle of device driver's device
  20202.                                    context */
  20203.  
  20204.  ULONG  ulFunN;                    /*flags and function numbers */
  20205.  
  20206.  
  20207.  The EqualRegion function determines whether the same set of points defines
  20208.  two separate regions.
  20209.  
  20210.  
  20211.  Parameters
  20212.  
  20213.  hdc  the engine's device context.
  20214.  
  20215.  hrgnSrc1  the first of two regions.
  20216.  
  20217.  hrgnSrc2  the second of two regions.
  20218.  
  20219.  hddc  the device driver's device context.
  20220.  
  20221.  ulFunN  the function number and a mask of various flags. The low word
  20222.  contains the function number; the high word contains a mask of flags, which
  20223.  may be set by the graphics programming interface (GPI), the engine, or a
  20224.  driver. For a description of these flags, see Section 7.1.1.
  20225.  
  20226.  
  20227.  Return Value
  20228.  
  20229.  The return value is EQRGN_EQUAL if the regions are equal, EQRGN_NOTEQUAL if
  20230.  they are not, and EQRGN_ERROR if an error occurs.
  20231.  
  20232.  
  20233.  Errors
  20234.  
  20235.  If an error occurs during the execution of this function, the graphics
  20236.  engine or the device driver calls the WinSetErrorInfo function and records
  20237.  the associated error code. The following list contains possible error codes
  20238.  that the engine or the device driver calls record:
  20239.  
  20240.       PMERR_HRGN_BUSY
  20241.       PMERR_INV_HRGN
  20242.       PMERR_REGION_IS_CLIP_REGION
  20243.  
  20244.  
  20245.  
  20246.  
  20247.  
  20248.  Comments
  20249.  
  20250.  If the hrgnSrc1 or hrgnSrc2 parameter identifies a clip region, the function
  20251.  fails and returns an error.
  20252.  
  20253.  
  20254.  █    ErasePS
  20255.  ────────────────────────────────────────────────────────────────────────────
  20256.  
  20257.  BOOL ErasePS  (hdc, hddc, ulFunN)
  20258.  
  20259.  HDC  hdc;                         /*handle of engine's device context */
  20260.  
  20261.  ULONG  hddc;                      /*handle of device driver's device
  20262.                                    context */
  20263.  
  20264.  ULONG  ulFunN;                    /*flags and function number */
  20265.  
  20266.  
  20267.  The ErasePS function erases the display associated with the device context
  20268.  identified by the hdc parameter.
  20269.  
  20270.  
  20271.  Parameters
  20272.  
  20273.  hdc  the engine's device context.
  20274.  
  20275.  hddc  the device driver's device context.
  20276.  
  20277.  ulFunN  the function number and a mask of various flags. The low word
  20278.  contains the function number; the high word contains a mask of flags, which
  20279.  may be set by the graphics programming interface (GPI), the engine, or a
  20280.  driver. For a description of these flags, see Section 7.1.1.
  20281.  
  20282.  
  20283.  Return Value
  20284.  
  20285.  The return value is TRUE if the function is successful or FALSE if an error
  20286.  occurs.
  20287.  
  20288.  
  20289.  Errors
  20290.  
  20291.  If an error occurs during the execution of this function, the device driver
  20292.  calls the WinSetErrorInfo function and records the associated error code.
  20293.  The following list contains possible error codes that the device driver may
  20294.  record:
  20295.  
  20296.       PMERR_BASE_ERROR
  20297.       PMERR_BITMAP_IS_SELECTED
  20298.       PMERR_BITMAP_NOT_SELECTED
  20299.       PMERR_COORDINATE_OVERFLOW
  20300.       PMERR_DEV_FUNC_NOT_INSTALLED
  20301.  
  20302.  .ET
  20303.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  20304.       PMERR_HBITMAP_BUSY
  20305.       PMERR_HDC_BUSY
  20306.       PMERR_HUGE_FONTS_NOT_SUPPORTED
  20307.       PMERR_INCOMPATIBLE_BITMAP
  20308.       PMERR_INCORRECT_DC_TYPE
  20309.       PMERR_INSUFFICIENT_MEMORY
  20310.       PMERR_INV_BACKGROUND_COL_ATTR
  20311.       PMERR_INV_BACKGROUND_MIX_ATTR
  20312.       PMERR_INV_BITBLT_MIX
  20313.       PMERR_INV_BITBLT_STYLE
  20314.       PMERR_INV_BITMAP_DIMENSION
  20315.       PMERR_INV_CHAR_DIRECTION_ATTR
  20316.       PMERR_INV_CHAR_MODE_ATTR
  20317.       PMERR_INV_CHAR_SET_ATTR
  20318.       PMERR_INV_CHAR_SHEAR_ATTR
  20319.       PMERR_INV_CODEPAGE
  20320.       PMERR_INV_COLOR_ATTR
  20321.       PMERR_INV_COLOR_DATA
  20322.       PMERR_INV_COLOR_FORMAT
  20323.       PMERR_INV_COLOR_INDEX
  20324.       PMERR_INV_COLOR_OPTIONS
  20325.       PMERR_INV_COLOR_START_INDEX
  20326.       PMERR_INV_COORD_SPACE
  20327.       PMERR_INV_COORDINATE
  20328.       PMERR_INV_DC_DATA
  20329.       PMERR_INV_DC_TYPE
  20330.       PMERR_INV_DRIVER_NAME
  20331.       PMERR_INV_GEOM_LINE_WIDTH_ATTR
  20332.       PMERR_INV_HBITMAP
  20333.       PMERR_INV_HDC
  20334.       PMERR_INV_HRGN
  20335.       PMERR_INV_ID
  20336.       PMERR_INV_IN_AREA
  20337.       PMERR_INV_IN_PATH
  20338.       PMERR_INV_INFO_TABLE
  20339.       PMERR_INV_LENGTH_OR_COUNT
  20340.       PMERR_INV_LINE_END_ATTR
  20341.       PMERR_INV_LINE_JOIN_ATTR
  20342.       PMERR_INV_LINE_TYPE_ATTR
  20343.       PMERR_INV_LINE_WIDTH_ATTR
  20344.       PMERR_INV_MARKER_SET_ATTR
  20345.       PMERR_INV_MARKER_SYMBOL_ATTR
  20346.       PMERR_INV_MIX_ATTR
  20347.       PMERR_INV_PATTERN_REF_PT_ATTR
  20348.       PMERR_INV_PATTERN_SET_ATTR
  20349.       PMERR_INV_PATTERN_SET_FONT
  20350.       PMERR_INV_PICK_APERTURE_POSN
  20351.       PMERR_INV_PRIMITIVE_TYPE
  20352.       PMERR_INV_RECT
  20353.       PMERR_INV_REGION_CONTROL
  20354.       PMERR_INV_SCAN_START
  20355.       PMERR_INV_SETID
  20356.       PMERR_INV_USAGE_PARM
  20357.       PMERR_REALIZE_NOT_SUPPORTED
  20358.       PMERR_UNSUPPORTED_ATTR
  20359.       PMERR_UNSUPPORTED_ATTR_VALUE
  20360.  
  20361.  
  20362.  
  20363.  
  20364.  
  20365.  Comments
  20366.  
  20367.  The ErasePS function erases the display by using the color identified by
  20368.  color index 0.
  20369.  
  20370.  This operation is unaffected by the draw-process control bit and is subject
  20371.  to all clipping (to clip paths, viewing limits, graphics fields, clip
  20372.  regions, and visible regions).
  20373.  
  20374.  This function does not perform any bounds collection or correlation.
  20375.  
  20376.  
  20377.  █    Escape
  20378.  ────────────────────────────────────────────────────────────────────────────
  20379.  
  20380.  LONG Escape  (hdc, lCmd, cbIn, pbIn, pcbOut, pbOut, hddc, ulFunN)
  20381.  
  20382.  HDC  hdc;                         /*handle of engine's device context */
  20383.  
  20384.  ULONG  lCmd;                      /*escape-function identifier */
  20385.  
  20386.  LONG  cbIn;                       /*length of input data */
  20387.  
  20388.  PBYTE  pbIn;                      /*pointer to input data */
  20389.  
  20390.  PLONG  pcbOut;                    /*pointer to length of output data */
  20391.  
  20392.  PBYTE  pbOut;                     /*pointer to output data */
  20393.  
  20394.  ULONG  hddc;                      /*handle of device driver's device
  20395.                                    context */
  20396.  
  20397.  ULONG  ulFunN;                    /*flags and function number */
  20398.  
  20399.  
  20400.  The Escape function accesses special device capabilities that can't be
  20401.  accessed through Gpi functions. These capabilities include banding, sending
  20402.  raw data to the device, and spooling print jobs.
  20403.  
  20404.  
  20405.  Parameters
  20406.  
  20407.  hdc  the engine's device context.
  20408.  
  20409.  lCmd  the escape function to perform. The following predefined functions are
  20410.  available:
  20411.  
  20412.  Function                          Code
  20413.  ────────────────────────────────────────────────────────────────────────────
  20414.  
  20415.  DEVESC_QUERYESCSUPPORT            0L
  20416.  
  20417.  DEVESC_GETSCALINGFACTOR           1L
  20418.  
  20419.  DEVESC_STARTDOC                   8150L
  20420.  
  20421.  DEVESC_ENDDOC                     8151L
  20422.  
  20423.  DEVESC_NEXTBAND                   8152L
  20424.  
  20425.  DEVESC_ABORTDOC                   8153L
  20426.  
  20427.  DEVESC_NEWFRAME                   16300L
  20428.  
  20429.  DEVESC_DRAFTMODE                  16301L
  20430.  
  20431.  DEVESC_FLUSHOUTPUT                16302L
  20432.  
  20433.  DEVESC_RAWDATA                    16303L
  20434.  
  20435.  DEVESC_STD_JOURNAL                32600L
  20436.  
  20437.  Values in the range 0 through 32,767 are reserved for these predefined
  20438.  functions. Devices can define additional escape functions by using lCmd
  20439.  values in the range 32,768 through 65,535.
  20440.  
  20441.  Note that at the applications programming interface (API), for a
  20442.  device-context type of OD_QUEUED with a data type of Q_STD or for a
  20443.  device-context type  of OD_METAFILE, not all DevEscape calls are passed
  20444.  to the engine/device driver. Depending on the value of lCmd, they may be
  20445.  metafiled or recorded as follows:
  20446.  
  20447.  Value                             Meaning
  20448.  ────────────────────────────────────────────────────────────────────────────
  20449.  
  20450.  0-8149                            Not metafiled, not recorded (passed to
  20451.                                    the device context in both cases).
  20452.  
  20453.  8150-16299                        Metafiled but not recorded (passed to
  20454.                                    the device context for Q_STD).
  20455.  
  20456.  16300-24449                       Metafiled and recorded (Not passed to
  20457.                                    the information/device context in either
  20458.                                    case).
  20459.  
  20460.  24450-32599                       Not metafiled but recorded (passed to
  20461.                                    the information/device context for
  20462.                                    OD_METAFILE).
  20463.  
  20464.  32600-32767                       Reserved (for use with Q_ESC spool file).
  20465.  
  20466.  32768-40959                       Not metafiled, not recorded (passed to
  20467.                                    the information/device context in both
  20468.                                    cases).
  20469.  
  20470.  40960-49151                       Metafiled but not recorded (passed to
  20471.                                    the device context for Q_STD).
  20472.  
  20473.  49152-57343                       Metafiled and recorded (Not passed to
  20474.                                    the information/device context in either
  20475.                                    case)
  20476.  
  20477.  57344-65535                       Not metafiled but recorded (passed to
  20478.                                    the information/device context for
  20479.                                    OD_METAFILE).
  20480.  
  20481.  cbIn  the number of bytes of data pointed to by the pbIn parameter.
  20482.  
  20483.  pbIn  to the escape function's input data.
  20484.  
  20485.  pcbOut  to a value that specifies the number of bytes of output data.
  20486.  
  20487.  pbOut  to the escape function's output data.
  20488.  
  20489.  hddc  the device driver's device context.
  20490.  
  20491.  ulFunN  the function number and a mask of various flags. The low word
  20492.  contains the function number; the high word contains a mask of flags, which
  20493.  may be set by the graphics programming interface (GPI), the engine, or a
  20494.  driver. For a description of these flags, see Section 7.1.1.
  20495.  
  20496.  
  20497.  Return Value
  20498.  
  20499.  The return value is DEV_OK if the function is successful,
  20500.  DEVESC_NOTIMPLEMENTED if the escape function does not apply or is not
  20501.  implemented, or DEVESC_ERROR if an error occurs.
  20502.  
  20503.  
  20504.  Errors
  20505.  
  20506.  If an error occurs during the execution of this function, the device driver
  20507.  calls the WinSetErrorInfo function and records the associated error code.
  20508.  The following list contains possible error codes that the device driver may
  20509.  record:
  20510.  
  20511.       PMERR_DEV_FUNC_NOT_INSTALLED
  20512.       PMERR_INV_LENGTH_OR_COUNT
  20513.  
  20514.  
  20515.  
  20516.  
  20517.  
  20518.  Comments
  20519.  
  20520.  The escape functions are described as follows:
  20521.  
  20522.  The DEVESC_ABORTDOC function aborts the current job, erasing everything the
  20523.  application has written to the device since the last DEVESC_STARTDOC escape,
  20524.  including the DEVESC_STARTDOC.
  20525.  
  20526.  The parameters are set as follows:
  20527.  
  20528.  Parameter                         Description
  20529.  ────────────────────────────────────────────────────────────────────────────
  20530.  
  20531.  cbIn                              Not used, and can be zero.
  20532.  
  20533.  pbIn                              Not used, and can be set to NULL.
  20534.  
  20535.  pcbOut                            Not used, and can be zero.
  20536.  
  20537.  pbOut                             Not used, and can be set to NULL.
  20538.  
  20539.  The DEVESC_ENDDOC function ends a print job started by DEVESC_STARTDOC and
  20540.  returns the job identifier for the spooled print job.
  20541.  
  20542.  The parameters are set as follows:
  20543.  
  20544.  Parameter                         Description
  20545.  ────────────────────────────────────────────────────────────────────────────
  20546.  
  20547.  cbIn                              Not used, and can be zero.
  20548.  
  20549.  pbIn                              Not used, and can be set to NULL.
  20550.  
  20551.  pcbOut                            Points to cbOut, which on input is set
  20552.                                    to the size of the buffer pointed to by
  20553.                                    pbOut (in this case, 2 bytes) and on
  20554.                                    output is set to the number of data
  20555.                                    bytes returned in this buffer (that is,
  20556.                                    zero if there is no job identifier).
  20557.  
  20558.  pbOut                             Points to a data area in which the job
  20559.                                    identifier of the spooled print job is
  20560.                                    returned. This parameter is set to NULL
  20561.                                    if there is no job identifier (for
  20562.                                    example, for a direct printer).
  20563.  
  20564.  The DEVESC_DRAFTMODE function turns draft mode on or off. Turning draft mode
  20565.  on instructs the device driver to print faster and with lower quality, if
  20566.  necessary. The draft mode can be changed only at page boundaries (for
  20567.  example, after a call to DEVESC_NEWFRAME).
  20568.  
  20569.  The parameters are set as follows:
  20570.  
  20571.  Parameter                         Description
  20572.  ────────────────────────────────────────────────────────────────────────────
  20573.  
  20574.  cbIn                              Specifies the number of bytes pointed to
  20575.                                    by pbIn.
  20576.  
  20577.  pbIn                              Points to a SHORT value specifying the
  20578.                                    mode: 1 for draft mode on, 0 for off.
  20579.  
  20580.  pcbOut                            Not used, and can be zero.
  20581.  
  20582.  pbOut                             Not used, and can be set to NULL.
  20583.  
  20584.  The DEVESC_FLUSHOUTPUT function flushes any output in the device's buffer.
  20585.  
  20586.  The parameters are set as follows:
  20587.  
  20588.  Parameter                         Description
  20589.  ────────────────────────────────────────────────────────────────────────────
  20590.  
  20591.  cbIn                              Not used, and can be zero.
  20592.  
  20593.  pbIn                              Not used, and can be set to NULL.
  20594.  
  20595.  pcbOut                            Not used, and can be zero.
  20596.  
  20597.  pbOut                             Not used, and can be set to NULL.
  20598.  
  20599.   The DEVESC_GETSCALINGFACTOR function retrieves the scaling factors for
  20600.  the x and y axes of a printing device. For each scaling factor, an exponent
  20601.  of two is put in pcbOut. Thus, the value 3 is used if the scaling factor is
  20602.  8.
  20603.  
  20604.  Scaling factors are used by devices that cannot support graphics at the same
  20605.  resolution as the device resolution.
  20606.  
  20607.  The parameters are set as follows:
  20608.  
  20609.  Parameter                         Description
  20610.  ────────────────────────────────────────────────────────────────────────────
  20611.  
  20612.  cbIn                              Not used, and can be zero.
  20613.  
  20614.  pbIn                              Not used, and can be set to NULL.
  20615.  
  20616.  pcbOut                            Specifies the number of bytes of data
  20617.                                    pointed to by pbOut. On return, this
  20618.                                    parameter is updated to the number of
  20619.                                    bytes returned.
  20620.  
  20621.  pbOut                             Points to a POINTL structure that
  20622.                                    receives the output from this escape
  20623.                                    function: the scaling factors for the x
  20624.                                    and y axes. This structure has the
  20625.                                    following form:
  20626.  
  20627.  
  20628.  
  20629.  typedef struct _POINTL {    /* ptl */
  20630.      LONG  x;
  20631.      LONG  y;
  20632.  } POINTL;
  20633.  The scaling factors are given as exponents of two. </C></ROW>
  20634.  The DEVESC_NEWFRAME function allows the application to specify that it has
  20635.  finished writing to a page. This function, which is similar to the ErasePS
  20636.  function's processing for a screen device context, resets the attributes
  20637.  (for example, color, mix). DEVESC_NEWFRAME is usually used with a printer
  20638.  device to advance to a new page.
  20639.  
  20640.  The parameters are set as follows:
  20641.  
  20642.  Parameter                         Description
  20643.  ────────────────────────────────────────────────────────────────────────────
  20644.  
  20645.  cbIn                              Not used, and can be zero.
  20646.  
  20647.  pbIn                              Not used, and can be set to NULL.
  20648.  
  20649.  pcbOut                            Not used, and can be zero.
  20650.  
  20651.  pbOut                             Not used, and can be set to NULL.
  20652.  
  20653.  The DEVESC_NEXTBAND function allows the application to specify that it has
  20654.  finished writing to a band. The coordinates of the next band are returned.
  20655.  This function is used by applications that handle banding themselves.
  20656.  
  20657.  The parameters are set as follows:
  20658.  
  20659.  Parameter                         Description
  20660.  ────────────────────────────────────────────────────────────────────────────
  20661.  
  20662.  cbIn                              Not used, and can be zero.
  20663.  
  20664.  pbIn                              Not used, and can be set to NULL.
  20665.  
  20666.  pcbOut                            Specifies the number of bytes of data
  20667.                                    pointed to by pbOut. On return, this
  20668.                                    parameter is updated to the number of
  20669.                                    bytes returned.
  20670.  
  20671.  pbOut                             Points to a RECTL structure that
  20672.                                    receives the device coordinates of the
  20673.                                    next band, which is a rectangle. The
  20674.                                    structure has the following form:
  20675.  
  20676.  
  20677.  
  20678.  typedef struct _RECTL {    /* rcl */
  20679.      LONG  xLeft;
  20680.      LONG  yBottom;
  20681.      LONG  xRight;
  20682.      LONG  yTop;
  20683.  } RECTL;
  20684.  An empty rectangle (that is, xLeft greater than xRight, and yTop less than
  20685.  yBottom) marks the end of the banding operation. </C></ROW>
  20686.  The DEVESC_QUERYESCSUPPORT function determines whether a particular escape
  20687.  function is implemented by the device driver. The return value gives the
  20688.  result.
  20689.  
  20690.  The parameters are set as follows:
  20691.  
  20692.  Parameter                         Description
  20693.  ────────────────────────────────────────────────────────────────────────────
  20694.  
  20695.  cbIn                              Specifies the number of bytes pointed to
  20696.                                    by cbIn.
  20697.  
  20698.  pbIn                              Points to an escape-code value that
  20699.                                    specifies the escape function to check.
  20700.  
  20701.  pcbOut                            Not used, and can be zero.
  20702.  
  20703.  pbOut                             Not used, and can be set to NULL.
  20704.  
  20705.  The DEVESC_RAWDATA function allows an application to send data directly to a
  20706.  device driver. For example, in the case of a printer device driver, the data
  20707.  could be a printer data stream.
  20708.  
  20709.  If application data is mixed with other data (for example, from GPI) being
  20710.  sent to the same page of a device context, the results are unpredictable and
  20711.  depend upon the action taken by the device driver. For example, a device
  20712.  driver might ignore GPI data if raw (binary) data is mixed with it on the
  20713.  same page. In general, DEVESC_RAWDATA should be sent either to a separate
  20714.  page, using the DEVESC_NEWFRAME escape to obtain a new page, or to a
  20715.  separate document, using the DEVESC_STARTDOC and DEVESC_ENDDOC escapes to
  20716.  create a new document.
  20717.  
  20718.  The parameters are set as follows:
  20719.  
  20720.  Parameter                         Description
  20721.  ────────────────────────────────────────────────────────────────────────────
  20722.  
  20723.  cbIn                              Specifies the number of bytes pointed to
  20724.                                    by pbIn.
  20725.  
  20726.  pbIn                              Points to the raw data.
  20727.  
  20728.  pcbOut                            Not used, and can be zero.
  20729.  
  20730.  pbOut                             Not used, and can be set to NULL.
  20731.  
  20732.  The DEVESC_STARTDOC function allows an application to specify that a new
  20733.  print job is starting and that all subsequent DEVESC_NEWFRAME calls should
  20734.  be spooled under the same job, until a DEVESC_ENDDOC call occurs.
  20735.  
  20736.  This ensures that documents longer than one page are not interspersed with
  20737.  other jobs.
  20738.  
  20739.  The parameters are set as follows:
  20740.  
  20741.  Parameter                         Description
  20742.  ────────────────────────────────────────────────────────────────────────────
  20743.  
  20744.  cbIn                              Specifies the number of characters in
  20745.                                    the string pointed to by pbIn.
  20746.  
  20747.  pbIn                              Points to a null-terminated string that
  20748.                                    specifies the name of the document.
  20749.  
  20750.  pcbOut                            Not used, and can be zero.
  20751.  
  20752.  pbOut                             Not used, and can be set to NULL.
  20753.  
  20754.  The DEVESC_STD_JOURNAL function allows a print file in Q_ESC/Journal format
  20755.  to be passed to a device driver.
  20756.  
  20757.  The parameters are set as follows:
  20758.  
  20759.  Parameter                         Description
  20760.  ────────────────────────────────────────────────────────────────────────────
  20761.  
  20762.  cbIn                              Specifies the number of bytes pointed to
  20763.                                    by pbIn.
  20764.  
  20765.  pbIn                              Points to the data.
  20766.  
  20767.  pcbOut                            Not used, and can be zero.
  20768.  
  20769.  pbOut                             Not used, and can be set to NULL.
  20770.  
  20771.  
  20772.  
  20773.  █    ExcludeClipRectangle
  20774.  ────────────────────────────────────────────────────────────────────────────
  20775.  
  20776.  int ExcludeClipRectangle  (hdc, prcl, hddc, ulFunN)
  20777.  
  20778.  HDC  hdc;                         /*handle of engine's device context */
  20779.  
  20780.  PRECTL  prcl;                     /*pointer to rectangle structure */
  20781.  
  20782.  ULONG  hddc;                      /*device driver's device context */
  20783.  
  20784.  ULONG  ulFunN;                    /*flags and function number */
  20785.  
  20786.  
  20787.  The ExcludeClipRectangle function excludes the specified rectangle from the
  20788.  clipping region. The bottom and left boundaries of the rectangle are
  20789.  included in the boundary which is to disappear. Note that the rectangle
  20790.  boundaries are considered part of the interior and are clipped.
  20791.  
  20792.  
  20793.  Parameters
  20794.  
  20795.  hdc  the engine's device context.
  20796.  
  20797.  prcl  to a RECTL structure that specifies the coordinates of the rectangle
  20798.  in world coordinates.
  20799.  
  20800.  hddc  the device driver's device context.
  20801.  
  20802.  ulFunN  the function number and a mask of various flags. The low word
  20803.  contains the function number; the high word contains a mask of flags, which
  20804.  may be set by the graphics programming interface (GPI), the engine, or a
  20805.  driver. For a description of these flags, see Section 7.1.1.
  20806.  
  20807.  
  20808.  Return Value
  20809.  
  20810.  The return value is RGN_NULL, RGN_RECT, or RGN_COMPLEX if the function is
  20811.  successful. The return value is RGN_ERROR if an error occurs.
  20812.  
  20813.  
  20814.  Errors
  20815.  
  20816.  If an error occurs during the execution of this function, the graphics
  20817.  engine or the device driver calls the WinSetErrorInfo function and records
  20818.  the associated error code. The following list contains possible error codes
  20819.  that the engine or the device driver calls record:
  20820.  
  20821.       PMERR_COORDINATE_OVERFLOW
  20822.       PMERR_DEV_FUNC_NOT_INSTALLED
  20823.       PMERR_HDC_BUSY
  20824.       PMERR_INSUFFICIENT_MEMORY
  20825.       PMERR_INV_COORD_SPACE
  20826.       PMERR_INV_COORDINATE
  20827.       PMERR_INV_HDC
  20828.       PMERR_INV_HRGN
  20829.       PMERR_INV_IN_AREA
  20830.       PMERR_INV_IN_PATH
  20831.       PMERR_INV_LENGTH_OR_COUNT
  20832.       PMERR_INV_RECT
  20833.       PMERR_INV_REGION_CONTROL
  20834.  
  20835.  
  20836.  
  20837.  
  20838.  
  20839.  █    FillPath
  20840.  ────────────────────────────────────────────────────────────────────────────
  20841.  
  20842.  BOOL FillPath  (hdc, phid, flCmd, hddc, ulFunN)
  20843.  
  20844.  HDC  hdc;                         /*handle of engine's device context */
  20845.  
  20846.  PHID  phid;                       /*path identifier */
  20847.  
  20848.  ULONG  flCmd;                     /*options */
  20849.  
  20850.  ULONG  hddc;                      /*handle of device driver's device
  20851.                                    context */
  20852.  
  20853.  ULONG  ulFunN;                    /*flags and function numbers */
  20854.  
  20855.  
  20856.  The FillPath function fills the interior of closed figures defined within a
  20857.  path bracket. Before filling occurs, this function closes any open figures
  20858.  within the path bracket. After filling the path, the function deletes it.
  20859.  
  20860.  
  20861.  Parameters
  20862.  
  20863.  hdc  the engine's device context.
  20864.  
  20865.  phid  to the path identifier. This value must be 1 for the current release
  20866.  of MS OS/2 Presentation Manager.
  20867.  
  20868.  flCmd  whether the function should fill the path by using the alternate or
  20869.  the winding fill method. This parameter can be one of the following values:
  20870.  
  20871.  Constant                          Meaning
  20872.  ────────────────────────────────────────────────────────────────────────────
  20873.  
  20874.  FPATH_ALTERNATE                   Specifies that the function should fill
  20875.                                    the path by using the alternate fill
  20876.                                    method.
  20877.  
  20878.  FPATH_WINDING                     Specifies that the function should fill
  20879.                                    the path by using the winding fill
  20880.                                    method.
  20881.  
  20882.  hddc  the device driver's device context.
  20883.  
  20884.  ulFunN  the function number and a mask of various flags. The low word
  20885.  contains the function number; the high word contains a mask of flags, which
  20886.  may be set by the graphics programming interface (GPI), the engine, or a
  20887.  driver. For a description of these flags, see Section 7.1.1.
  20888.  
  20889.  
  20890.  Return Value
  20891.  
  20892.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  20893.  GPI_HITS if the detectable attribute is set for the presentation space and a
  20894.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  20895.  
  20896.  
  20897.  Errors
  20898.  
  20899.  If an error occurs during the execution of this function, the graphics
  20900.  engine or the device driver calls the WinSetErrorInfo function and records
  20901.  the associated error code. The following list contains possible error codes
  20902.  that the engine or the device driver calls record:
  20903.  
  20904.       PMERR_BASE_ERROR
  20905.       PMERR_BITMAP_NOT_SELECTED
  20906.       PMERR_COORDINATE_OVERFLOW
  20907.       PMERR_DEV_FUNC_NOT_INSTALLED
  20908.       PMERR_HDC_BUSY
  20909.       PMERR_HRGN_BUSY
  20910.       PMERR_INSUFFICIENT_MEMORY
  20911.       PMERR_INV_COLOR_DATA
  20912.       PMERR_INV_COLOR_INDEX
  20913.       PMERR_INV_COORD_SPACE
  20914.       PMERR_INV_COORDINATE
  20915.       PMERR_INV_FILL_PATH_OPTIONS
  20916.       PMERR_INV_HDC
  20917.       PMERR_INV_HRGN
  20918.       PMERR_INV_IN_AREA
  20919.       PMERR_INV_IN_PATH
  20920.       PMERR_INV_LENGTH_OR_COUNT
  20921.       PMERR_INV_PATH_ID
  20922.       PMERR_INV_PICK_APERTURE_POSN
  20923.       PMERR_INV_RECT
  20924.       PMERR_INV_REGION_CONTROL
  20925.       PMERR_PATH_LIMIT_EXCEEDED
  20926.       PMERR_PATH_UNKNOWN
  20927.       PMERR_REGION_IS_CLIP_REGION
  20928.  
  20929.  
  20930.  
  20931.  
  20932.  
  20933.  █    FullArcBoth
  20934.  ────────────────────────────────────────────────────────────────────────────
  20935.  
  20936.  LONG FullArcBoth  (hdc, fxMult, hddc, ulFunN)
  20937.  
  20938.  HDC  hdc;                         /*handle of engine's device context */
  20939.  
  20940.  FIXED  fxMult;                    /*radius multiplier value */
  20941.  
  20942.  ULONG  hddc;                      /*handle of device driver's device
  20943.                                    context */
  20944.  
  20945.  ULONG  ulFunN;                    /*flags and function number */
  20946.  
  20947.  
  20948.  The FullArcBoth function draws the outline of an ellipse and fills its
  20949.  interior with the current fill pattern. The ellipse is centered at the
  20950.  current position. The fxMult parameter specifies the length of the ellipse's
  20951.  radius.
  20952.  
  20953.  
  20954.  Parameters
  20955.  
  20956.  hdc  the engine's device context.
  20957.  
  20958.  fxMult  the multiplier that determines the size of the arc in relation to an
  20959.  arc with the current arc parameters. The value passed is treated as a 4-byte
  20960.  fixed-point (FIXED) number with the high word as the integer portion, and
  20961.  the low word as the fractional portion. Thus, a value of 65,536 specifies a
  20962.  multiplier of 1. This parameter must be greater than or equal to zero.
  20963.  
  20964.  hddc  the device driver's device context.
  20965.  
  20966.  ulFunN  the function number and a mask of various flags. The low word
  20967.  contains the function number; the high word contains a mask of flags, which
  20968.  may be set by the graphics programming interface (GPI), the engine, or a
  20969.  driver. For a description of these flags, see Section 7.1.1.
  20970.  
  20971.  
  20972.  Return Value
  20973.  
  20974.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  20975.  GPI_HITS if the detectable attribute is set for the presentation space and a
  20976.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  20977.  
  20978.  
  20979.  
  20980.  Errors
  20981.  
  20982.  If an error occurs during the execution of this function, the graphics
  20983.  engine or the device driver calls the WinSetErrorInfo function and records
  20984.  the associated error code. The following list contains possible error codes
  20985.  that the engine or the device driver calls record:
  20986.  
  20987.       PMERR_ALREADY_IN_AREA
  20988.       PMERR_BASE_ERROR
  20989.       PMERR_BITMAP_NOT_SELECTED
  20990.       PMERR_COORDINATE_OVERFLOW
  20991.       PMERR_DEV_FUNC_NOT_INSTALLED
  20992.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  20993.       PMERR_HDC_BUSY
  20994.       PMERR_HRGN_BUSY
  20995.       PMERR_HUGE_FONTS_NOT_SUPPORTED
  20996.       PMERR_INSUFFICIENT_MEMORY
  20997.       PMERR_INV_AREA_CONTROL
  20998.       PMERR_INV_BACKGROUND_COL_ATTR
  20999.       PMERR_INV_BACKGROUND_MIX_ATTR
  21000.       PMERR_INV_CHAR_DIRECTION_ATTR
  21001.       PMERR_INV_CHAR_MODE_ATTR
  21002.       PMERR_INV_CODEPAGE
  21003.       PMERR_INV_COLOR_ATTR
  21004.       PMERR_INV_COLOR_DATA
  21005.       PMERR_INV_COLOR_INDEX
  21006.       PMERR_INV_COORD_SPACE
  21007.       PMERR_INV_COORDINATE
  21008.       PMERR_INV_HDC
  21009.       PMERR_INV_HRGN
  21010.       PMERR_INV_IN_AREA
  21011.       PMERR_INV_IN_PATH
  21012.       PMERR_INV_LENGTH_OR_COUNT
  21013.       PMERR_INV_LINE_TYPE_ATTR
  21014.       PMERR_INV_MIX_ATTR
  21015.       PMERR_INV_MULTIPLIER
  21016.       PMERR_INV_NESTED_FIGURES
  21017.       PMERR_INV_PATTERN_REF_PT_ATTR
  21018.       PMERR_INV_PATTERN_SET_ATTR
  21019.       PMERR_INV_PATTERN_SET_FONT
  21020.       PMERR_INV_PICK_APERTURE_POSN
  21021.       PMERR_INV_RECT
  21022.       PMERR_INV_REGION_CONTROL
  21023.       PMERR_NOT_IN_AREA
  21024.       PMERR_NOT_IN_PATH
  21025.       PMERR_PATH_LIMIT_EXCEEDED
  21026.       PMERR_PATH_UNKNOWN
  21027.       PMERR_REGION_IS_CLIP_REGION
  21028.  
  21029.  
  21030.  
  21031.  
  21032.  
  21033.  Comments
  21034.  
  21035.  The current (x,y) position is not changed by FullArcBoth.
  21036.  
  21037.  The arc parameters determine whether the full arc is drawn clockwise or
  21038.  counterclockwise.
  21039.  
  21040.  Note that for correlation operations, a correlation hit is recorded under
  21041.  the following circumstances:
  21042.  
  21043.    ■   The boundary is being drawn and the pick aperture intersects it.
  21044.  
  21045.    ■   The interior is being filled and the pick aperture intersects or is
  21046.        completely in the interior (even if the transparent mix mode is used
  21047.        for the fill operation).
  21048.  
  21049.    ■   The boundary is being drawn and the interior is being filled and the
  21050.        pick aperture intersects or is completely within the interior (even if
  21051.        the transparent mix mode is used for the fill operation).
  21052.  
  21053.  
  21054.  It is the values of the arc parameters p, q, r, and s that determine the
  21055.  direction in which the arc is drawn (clockwise or counterclockwise), not the
  21056.  value of the arc multiplier.
  21057.  
  21058.  
  21059.  █    FullArcBoundary
  21060.  ────────────────────────────────────────────────────────────────────────────
  21061.  
  21062.  int FullArcBoundary  (hdc, fxMult, hddc, ulFunN)
  21063.  
  21064.  HDC  hdc;                         /*handle of engine's device context */
  21065.  
  21066.  FIXED  fxMult;                    /*radius multiplier value */
  21067.  
  21068.  ULONG  hddc;                      /*handle of device driver's device
  21069.                                    context */
  21070.  
  21071.  ULONG  ulFunN;                    /*flags and function number */
  21072.  
  21073.  
  21074.  The FullArcBoundary function draws the outline of an ellipse. The ellipse is
  21075.  centered at the current position. The fxMult parameter specifies the length
  21076.  of the ellipse's radius.
  21077.  
  21078.  
  21079.  Parameters
  21080.  
  21081.  hdc  the engine's device context.
  21082.  
  21083.  fxMult  the multiplier that determines the size of the arc in relation to an
  21084.  arc with the current arc parameters. The value passed is treated as a 4-byte
  21085.  fixed-point (FIXED) number with the high word as the integer portion, and
  21086.  the low word as the fractional portion. Thus, a value of 65,536 specifies a
  21087.  multiplier of 1. This parameter must be greater than or equal to zero.
  21088.  
  21089.  hddc  the device driver's device context.
  21090.  
  21091.  ulFunN  the function number and a mask of various flags. The low word
  21092.  contains the function number; the high word contains a mask of flags, which
  21093.  may be set by the graphics programming interface (GPI), the engine, or a
  21094.  driver. For a description of these flags, see Section 7.1.1.
  21095.  
  21096.  
  21097.  Return Value
  21098.  
  21099.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  21100.  GPI_HITS if the detectable attribute is set for the presentation space and a
  21101.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  21102.  
  21103.  
  21104.  Errors
  21105.  
  21106.  If an error occurs during the execution of this function, the graphics
  21107.  engine or the device driver calls the WinSetErrorInfo function and records
  21108.  the associated error code. The following list contains possible error codes
  21109.  that the engine or the device driver calls record:
  21110.  
  21111.       PMERR_BASE_ERROR
  21112.       PMERR_BITMAP_NOT_SELECTED
  21113.       PMERR_COORDINATE_OVERFLOW
  21114.       PMERR_DEV_FUNC_NOT_INSTALLED
  21115.       PMERR_HDC_BUSY
  21116.       PMERR_INV_COLOR_DATA
  21117.       PMERR_INV_COLOR_INDEX
  21118.       PMERR_INV_COORD_SPACE
  21119.       PMERR_INV_HDC
  21120.       PMERR_INV_IN_AREA
  21121.       PMERR_INV_IN_PATH
  21122.       PMERR_INV_LENGTH_OR_COUNT
  21123.       PMERR_INV_MULTIPLIER
  21124.       PMERR_INV_NESTED_FIGURES
  21125.       PMERR_INV_PICK_APERTURE_POSN
  21126.       PMERR_INV_RECT
  21127.       PMERR_NOT_IN_PATH
  21128.       PMERR_PATH_LIMIT_EXCEEDED
  21129.       PMERR_PATH_UNKNOWN
  21130.  
  21131.  
  21132.  
  21133.  
  21134.  
  21135.  Comments
  21136.  
  21137.  The current (x,y) position is not changed by FullArcBoundary.
  21138.  
  21139.  The arc parameters determine whether the full arc is drawn clockwise or
  21140.  counterclockwise.
  21141.  
  21142.  Note that for correlation operations, a correlation hit is recorded under
  21143.  the following circumstances:
  21144.  
  21145.    ■   The boundary is being drawn and the pick aperture intersects it.
  21146.  
  21147.    ■   The interior is being filled and the pick aperture intersects or is
  21148.        completely within the interior (even if the transparent mix mode is
  21149.        used for the fill operation).
  21150.  
  21151.    ■   The boundary is being drawn and the interior is being filled and the
  21152.        pick aperture intersects or is completely within the interior (even if
  21153.        the transparent mix mode is used for the fill operation).
  21154.  
  21155.  
  21156.  It is the values of the arc parameters p, q, r, and s that determine the
  21157.  direction in which the arc is drawn (clockwise or counterclockwise), not the
  21158.  value of the arc multiplier.
  21159.  
  21160.  
  21161.  █    FullArcInterior
  21162.  ────────────────────────────────────────────────────────────────────────────
  21163.  
  21164.  LONG FullArcInterior  (hdc, fxMult, hddc, ulFunN)
  21165.  
  21166.  HDC  hdc;                         /*handle of engine's device context */
  21167.  
  21168.  FIXED  fxMult;                    /*radius multiplier value */
  21169.  
  21170.  ULONG  hddc;                      /*handle of device driver's device
  21171.                                    context */
  21172.  
  21173.  ULONG  ulFunN;                    /*flags and function number */
  21174.  
  21175.  
  21176.  The FullArcInterior function fills the interior of an ellipse with the
  21177.  current fill pattern. The ellipse is centered at the current position. The
  21178.  fxMult parameter specifies the length of the ellipse's radius.
  21179.  
  21180.  
  21181.  Parameters
  21182.  
  21183.  hdc  the engine's device context.
  21184.  
  21185.  fxMult  the multiplier that determines the size of the arc in relation to an
  21186.  arc with the current arc parameters. The value passed is treated as a 4-byte
  21187.  fixed-point (FIXED) number with the high word as the integer portion, and
  21188.  the low word as the fractional portion. Thus, a value of 65,536 specifies a
  21189.  multiplier of 1. This parameter must be greater than or equal to zero.
  21190.  
  21191.  hddc  the device driver's device context.
  21192.  
  21193.  ulFunN  the function number and a mask of various flags. The low word
  21194.  contains the function number; the high word contains a mask of flags, which
  21195.  may be set by the graphics programming interface (GPI), the engine, or a
  21196.  driver. For a description of these flags, see Section 7.1.1.
  21197.  
  21198.  
  21199.  Return Value
  21200.  
  21201.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  21202.  GPI_HITS if the detectable attribute is set for the presentation space and a
  21203.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  21204.  
  21205.  
  21206.  Errors
  21207.  
  21208.  If an error occurs during the execution of this function, the graphics
  21209.  engine or the device driver calls the WinSetErrorInfo function and records
  21210.  the associated error code. The following list contains possible error codes
  21211.  that the engine or the device driver calls record:
  21212.  
  21213.       PMERR_ALREADY_IN_AREA
  21214.       PMERR_BASE_ERROR
  21215.       PMERR_BITMAP_NOT_SELECTED
  21216.       PMERR_COORDINATE_OVERFLOW
  21217.       PMERR_DEV_FUNC_NOT_INSTALLED
  21218.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  21219.       PMERR_HDC_BUSY
  21220.       PMERR_HRGN_BUSY
  21221.       PMERR_HUGE_FONTS_NOT_SUPPORTED
  21222.       PMERR_INSUFFICIENT_MEMORY
  21223.       PMERR_INV_AREA_CONTROL
  21224.       PMERR_INV_BACKGROUND_COL_ATTR
  21225.       PMERR_INV_BACKGROUND_MIX_ATTR
  21226.       PMERR_INV_CHAR_DIRECTION_ATTR
  21227.       PMERR_INV_CHAR_MODE_ATTR
  21228.       PMERR_INV_CODEPAGE
  21229.       PMERR_INV_COLOR_ATTR
  21230.       PMERR_INV_COLOR_DATA
  21231.       PMERR_INV_COLOR_INDEX
  21232.       PMERR_INV_COORD_SPACE
  21233.       PMERR_INV_COORDINATE
  21234.       PMERR_INV_HDC
  21235.       PMERR_INV_HRGN
  21236.       PMERR_INV_IN_AREA
  21237.       PMERR_INV_IN_PATH
  21238.       PMERR_INV_LENGTH_OR_COUNT
  21239.       PMERR_INV_LINE_TYPE_ATTR
  21240.       PMERR_INV_MIX_ATTR
  21241.       PMERR_INV_MULTIPLIER
  21242.       PMERR_INV_NESTED_FIGURES
  21243.       PMERR_INV_PATTERN_REF_PT_ATTR
  21244.       PMERR_INV_PATTERN_SET_ATTR
  21245.       PMERR_INV_PATTERN_SET_FONT
  21246.       PMERR_INV_PICK_APERTURE_POSN
  21247.       PMERR_INV_RECT
  21248.       PMERR_INV_REGION_CONTROL
  21249.       PMERR_NOT_IN_AREA
  21250.       PMERR_NOT_IN_PATH
  21251.       PMERR_PATH_LIMIT_EXCEEDED
  21252.       PMERR_PATH_UNKNOWN
  21253.       PMERR_REGION_IS_CLIP_REGION
  21254.  
  21255.  
  21256.  
  21257.  
  21258.  
  21259.  Comments
  21260.  
  21261.  The current (x,y) position is not changed by FullArcInterior.
  21262.  
  21263.  The arc parameters determine whether the full arc is drawn clockwise or
  21264.  counterclockwise.
  21265.  
  21266.  Note that for correlation operations, a correlation hit is recorded under
  21267.  the following circumstances:
  21268.  
  21269.    ■   The boundary is being drawn and the pick aperture intersects it.
  21270.  
  21271.    ■   The interior is being filled and the pick aperture intersects or is
  21272.        completely within the interior (even if the transparent mix mode is
  21273.        used for the fill operation).
  21274.  
  21275.    ■   The boundary is being drawn and the interior is being filled and the
  21276.        pick aperture intersects or is completely within the interior (even if
  21277.        the transparent mix mode is used for the fill operation).
  21278.  
  21279.  
  21280.  It is the values of the arc parameters p, q, r, and s that determine the
  21281.  direction in which the arc is drawn (clockwise or counterclockwise), not the
  21282.  value of the arc multiplier.
  21283.  
  21284.  
  21285.  █    GetArcParameters
  21286.  ────────────────────────────────────────────────────────────────────────────
  21287.  
  21288.  BOOL GetArcParameters  (hdc, parcp, hddc, ulFunN)
  21289.  
  21290.  HDC  hdc;                         /*handle of engine's device context */
  21291.  
  21292.  PARCPARAMS  parcp;                /*pointer to ARCPARAMS structure */
  21293.  
  21294.  ULONG  hddc;                      /*handle of device driver's device
  21295.                                    context */
  21296.  
  21297.  ULONG  ulFunN;                    /*flags and function number */
  21298.  
  21299.  
  21300.  The GetArcParameters function retrieves the current values of the arc
  21301.  parameters: p, q, r, and s.
  21302.  
  21303.  
  21304.  Parameters
  21305.  
  21306.  hdc  the engine's device context.
  21307.  
  21308.  parcp  to an ARCPARAMS structure that contains the arc parameters.
  21309.  
  21310.  hddc  the device driver's device context.
  21311.  
  21312.  ulFunN  the function number and a mask of various flags. The low word
  21313.  contains the function number; the high word contains a mask of flags, which
  21314.  may be set by the graphics programming interface (GPI), the engine, or a
  21315.  driver. For a description of these flags, see Section 7.1.1.
  21316.  
  21317.  
  21318.  Return Value
  21319.  
  21320.  The return value is TRUE if the function is successful or FALSE if an error
  21321.  occurs.
  21322.  
  21323.  
  21324.  Errors
  21325.  
  21326.  If an error occurs during the execution of this function, the graphics
  21327.  engine or the device driver calls the WinSetErrorInfo function and records
  21328.  the associated error code. The following list contains possible error codes
  21329.  that the engine or the driver may record:
  21330.  
  21331.       PMERR_HDC_BUSY
  21332.       PMERR_INV_HDC
  21333.  
  21334.  
  21335.  
  21336.  
  21337.  
  21338.  █    GetAttributes
  21339.  ────────────────────────────────────────────────────────────────────────────
  21340.  
  21341.  LONG GetAttributes  (hdc, ulType, flAttrs, pBundle, hddc, ulFunN)
  21342.  
  21343.  HDC  hdc;                         /*handle of engine's device context */
  21344.  
  21345.  ULONG  ulType;                    /*primitive type identifier */
  21346.  
  21347.  ULONG  flAttrs;                   /*attributes mask */
  21348.  
  21349.  PBUNDLE  pBundle;                 /*pointer to attribute bundle */
  21350.  
  21351.  ULONG  hddc;                      /*handle of device driver's device
  21352.                                    context */
  21353.  
  21354.  ULONG  ulFunN;                    /*flags and function number */
  21355.  
  21356.  
  21357.   The GetAttributes function retrieves the current values for attributes
  21358.  specified by the flAttrs parameter.
  21359.  
  21360.  
  21361.  Parameters
  21362.  
  21363.  hdc  the engine's device context.
  21364.  
  21365.  ulType  the type of attributes that the function should retrieve. The
  21366.  function places the attributes in a special attribute bundle. This parameter
  21367.  can be one of the following values:
  21368.  
  21369.  Value                             Meaning
  21370.  ────────────────────────────────────────────────────────────────────────────
  21371.  
  21372.  PRIM_LINE                         Line-attribute bundle
  21373.  
  21374.  PRIM_CHAR                         Character-attribute bundle
  21375.  
  21376.  PRIM_MARKER                       Marker-attribute bundle
  21377.  
  21378.  PRIM_AREA                         Area-attribute bundle
  21379.  
  21380.  PRIM_IMAGE                        Image-attribute bundle
  21381.  
  21382.  flAttrs  which fields (in the attribute bundle) that the function should
  21383.  fill. The fields in each bundle are represented by specific bits. The
  21384.  function will retrieve information for each bit that is set.
  21385.  
  21386.  pBundle  to a copy of an attribute bundle. Valid information only appears in
  21387.  fields that have a corresponding bit set in the flAttrs parameter.
  21388.  
  21389.  hddc  the device driver's device context.
  21390.  
  21391.  ulFunN  the function number and a mask of various flags. The low word
  21392.  contains the function number; the high word contains a mask of flags, which
  21393.  may be set by the graphics programming interface (GPI), the engine, or a
  21394.  driver. For a description of these flags, see Section 7.1.1.
  21395.  
  21396.  
  21397.  Return Value
  21398.  
  21399.  The return value is the default mask if the function is successful.
  21400.  Otherwise, it is GPI_ALTERROR.
  21401.  
  21402.  
  21403.  Errors
  21404.  
  21405.  If an error occurs during the execution of this function, the graphics
  21406.  engine calls the WinSetErrorInfo function and records the associated error
  21407.  code. The following list contains possible error codes that the engine may
  21408.  record:
  21409.  
  21410.       PMERR_HDC_BUSY
  21411.       PMERR_INV_HDC
  21412.  
  21413.  
  21414.  
  21415.  
  21416.  
  21417.  Comments
  21418.  
  21419.  Only those flags with the corresponding bit set in flAttrs will be updated;
  21420.  other returned flags are undefined.
  21421.  
  21422.  This function retrieves the current value of the attributes specified in
  21423.  flAttrs. If a specified attribute is currently set to its standard default
  21424.  value, the corresponding flag is set in the returned defaults mask and the
  21425.  returned value for this attribute is undefined.
  21426.  
  21427.  For each attribute specified, the engine either returns the value of the
  21428.  attribute─in which case, the corresponding bit in the return value will not
  21429.  be set─or sets the bit in the return value indicating that the attribute
  21430.  specified is set to the default. The corresponding value in the buffer is
  21431.  not valid and may even have been overwritten by the engine.
  21432.  
  21433.  
  21434.  █    GetBitmapBits
  21435.  ────────────────────────────────────────────────────────────────────────────
  21436.  
  21437.  LONG GetBitmapBits  (hdc, hbm, iScanStart, cScanCount, pbBits, pbmi, hddc,
  21438.  ulFunN)
  21439.  
  21440.  HDC  hdc;                         /*handle of engine's device context */
  21441.  
  21442.  HBITMAP  hbm;                     /*handle of bitmap */
  21443.  
  21444.  LONG  iScanStart;                 /*starting scan-line number */
  21445.  
  21446.  LONG  cScanCount;                 /*scan-line count */
  21447.  
  21448.  PBYTE  pbBits;                    /*pointer to bitmap bits */
  21449.  
  21450.  PBITMAPINFO  pbmi;                /*pointer to BITMAPINFO structure */
  21451.  
  21452.  ULONG  hddc;                      /*handle of device driver's device
  21453.                                    context */
  21454.  
  21455.  ULONG  ulFunN;                    /*flags and function number */
  21456.  
  21457.  
  21458.  The GetBitmapBits function copies color information from an image on a
  21459.  display into a bitmap.
  21460.  
  21461.  
  21462.  Parameters
  21463.  
  21464.  hdc  the engine's device context.
  21465.  
  21466.  hbm  the bitmap. If this parameter is NULL, the hdc parameter must identify
  21467.  a memory device context that will receive the bitmap information.
  21468.  
  21469.  iScanStart  the number of the scan line where the function will begin
  21470.  collecting color information. If this value is 0, the function begins with
  21471.  the first scan line.
  21472.  
  21473.  cScanCount  the total number of scan lines.
  21474.  
  21475.  pbBits  to the bitmap.
  21476.  
  21477.  pbmi  to a BITMAPINFO structure that defines the format of the bitmap.
  21478.  
  21479.  hddc  the device driver's device context.
  21480.  
  21481.  ulFunN  the function number and a mask of various flags. The low word
  21482.  contains the function number; the high word contains a mask of flags, which
  21483.  may be set by the graphics programming interface (GPI), the engine, or a
  21484.  driver. For a description of these flags, see Section 7.1.1.
  21485.  
  21486.  
  21487.  Return Value
  21488.  
  21489.  The return value is the number of scan lines returned if the function is
  21490.  successful; otherwise, it is GPI_ALTERROR.
  21491.  
  21492.  
  21493.  Errors
  21494.  
  21495.  If an error occurs during the execution of this function, the device driver
  21496.  calls the WinSetErrorInfo function and records the associated error code.
  21497.  The following list contains possible error codes that the device driver may
  21498.  record:
  21499.  
  21500.       PMERR_BITMAP_NOT_SELECTED
  21501.       PMERR_DEV_FUNC_NOT_INSTALLED
  21502.       PMERR_INCORRECT_DC_TYPE
  21503.       PMERR_INV_HBITMAP
  21504.       PMERR_INV_IN_AREA
  21505.       PMERR_INV_IN_PATH
  21506.  
  21507.       PMERR_INV_INFO_TABLE
  21508.       PMERR_INV_LENGTH_OR_COUNT
  21509.       PMERR_INV_SCAN_START
  21510.  
  21511.  
  21512.  
  21513.  
  21514.  
  21515.  Comments
  21516.  
  21517.  This function transfers bitmap data from the specified bitmap to application
  21518.  storage. The bitmap may be specified by a bitmap handle or, if the handle is
  21519.  NULL, by a device-context handle. The device context must be a memory device
  21520.  context, with a bitmap currently selected.
  21521.  
  21522.  The BITMAPINFO structure must be initialized with the values of the cPlanes
  21523.  and cBitCount fields set to the applicable bitmap format, which must be a
  21524.  standard format. On return, the cx, cy, and argbColor fields will have been
  21525.  filled by the system. Also, the system will convert the bitmap data, if
  21526.  necessary.
  21527.  
  21528.  The bitmap address specified by pbBits must point to a storage area large
  21529.  enough to contain data for the requested number of scan lines. The amount of
  21530.  storage required for one scan line can be determined by calling the
  21531.  GetBitmapParameters function. This amount is given by the following formula:
  21532.  
  21533.  
  21534.  ((cBitCount * cx + 31)/32) * cPlanes * 4 (bytes)
  21535.  
  21536.  
  21537.  The total amount of storage required for the complete bitmap can be
  21538.  determined by multiplying this by the height of the bitmap (cy).
  21539.  
  21540.  There are four standard bitmap formats. All device drivers are required to
  21541.  be able to translate between any of these formats and their own internal
  21542.  formats. The standard formats are as follows:
  21543.  
  21544.  Format                            Description
  21545.  ────────────────────────────────────────────────────────────────────────────
  21546.  
  21547.  Monochrome                        1 bit per pel and 1 color plane
  21548.  
  21549.  16-color                          4 bits per pel and 1 color plane
  21550.  
  21551.  256-color                         8 bits per pel and 1 color plane
  21552.  
  21553.  Full-color                        24 bits per pel and 1 color plane
  21554.  
  21555.  These formats are chosen because they are identical or similar to all
  21556.  formats commonly used by raster devices. Only single-plane formats are
  21557.  standard, but it is very easy to convert these to any multiple-plane format
  21558.  used internally by a device.
  21559.  
  21560.  The pixel data is stored in the bitmap in the order of the coordinates as
  21561.  they would appear on a display screen. That is, the pixel in the lower-left
  21562.  corner is the first in the bitmap. Pixels are scanned from left to right and
  21563.  up. The first pixel's bits are stored beginning in the most significant bits
  21564.  of the first byte. The data for pixels in each scan line is packed tightly.
  21565.  Each scan line, however, is padded at the end so that each scan line begins
  21566.  on a DWORD boundary.
  21567.  
  21568.  Bitmap Color Tables
  21569.  
  21570.  Each standard-format bitmap must be accompanied by a BITMAPINFO structure.
  21571.  Because these bitmaps are intended to be traded between devices, the color
  21572.  indices in the bitmap are meaningless without more information.
  21573.  
  21574.  For a description of the BITMAPINFOHEADER and BITMAPINFO structures, see
  21575.  Chapter 9, "Types, Macros, Structures."
  21576.  
  21577.  The argbColor field is a packed array of 24-bit RGB values. If there are n
  21578.  bits per pixel, argbColor would contain %2 sup n% RGB values, unless n = 24.
  21579.  The standard-format bitmap with 24 bits per pixel is assumed to contain RGB
  21580.  values and does not require the argbColor array.
  21581.  
  21582.  
  21583.  Example
  21584.  
  21585.  To make the ordering of all the bytes clear, consider the following simple
  21586.  example of a 5 * 3 array of colored pixels that uses the format of 4 bits
  21587.  per pixel:
  21588.  
  21589.                Red   Green Blue  Red   Green
  21590.                Blue  Red   Green Blue  Red
  21591.                Green Blue  Red   Green Blue
  21592.  
  21593.  ExampleBitmap   =
  21594.  
  21595.      0x23, 0x12, 0x30, 0x00      /* bottom line */
  21596.      0x31, 0x23, 0x10, 0x00      /* middle line */
  21597.      0x12, 0x31, 0x20, 0x00      /* top line    */
  21598.  
  21599.  
  21600.  #define BLACK  0x000000L
  21601.  #define RED    0xFF0000L
  21602.  #define GREEN  0x00FF00L
  21603.  #define BLUE   0x0000FFL
  21604.  
  21605.  struct _BITMAPINFO {
  21606.      12,                         /* length of structure, fixed portion */
  21607.      5,                          /* width                              */
  21608.      3,                          /* height                             */
  21609.      1,                          /* planes                             */
  21610.      4,                          /* bit count                          */
  21611.      BLACK, RED, GREEN, BLUE,    /* color-table array                  */
  21612.      BLACK, BLACK, BLACK, BLACK,
  21613.      BLACK, BLACK, BLACK, BLACK,
  21614.      BLACK, BLACK, BLACK, BLACK
  21615.   };
  21616.  
  21617.  
  21618.  
  21619.  
  21620.  
  21621.  █    GetBitmapDimension
  21622.  ────────────────────────────────────────────────────────────────────────────
  21623.  
  21624.  BOOL GetBitmapDimension  (hbm, psizl, hddc, ulFunN)
  21625.  
  21626.  HBITMAP  hbm;                     /*handle of bitmap */
  21627.  
  21628.  PSIZEL  psizl;                    /*pointer to PSIZEL structure for
  21629.                                    dimensions */
  21630.  
  21631.  ULONG  hddc;                      /*handle of device driver's device
  21632.                                    context */
  21633.  
  21634.  ULONG  ulFunN;                    /*flags and function number */
  21635.  
  21636.  
  21637.  The GetBitmapDimension function retrieves a previously associated width and
  21638.  height from the specified bitmap, in 0.1 mm units. These dimensions can be
  21639.  associated by the SetBitmapDimension function and is not used by the engine.
  21640.  
  21641.  
  21642.  
  21643.  Parameters
  21644.  
  21645.  hbm  the bitmap whose width and height are retrieved.
  21646.  
  21647.  psizl  to a PSIZEL structure that contains the width and height (in 0.1 mm
  21648.  units) of the bitmap.
  21649.  
  21650.  hddc  the device driver's device context.
  21651.  
  21652.  ulFunN  the function number and a mask of various flags. The low word
  21653.  contains the function number; the high word contains a mask of flags, which
  21654.  may be set by the graphics programming interface (GPI), the engine, or a
  21655.  driver. For a description of these flags, see Section 7.1.1.
  21656.  
  21657.  
  21658.  Return Value
  21659.  
  21660.  The return value is TRUE if the function is successful or FALSE if an error
  21661.  occurs.
  21662.  
  21663.  
  21664.  Errors
  21665.  
  21666.  If an error occurs during the execution of this function, the graphics
  21667.  engine calls the WinSetErrorInfo function and records the associated error
  21668.  code. The following list contains possible error codes that the engine may
  21669.  record:
  21670.  
  21671.       PMERR_BITMAP_IS_SELECTED
  21672.       PMERR_HBITMAP_BUSY
  21673.       PMERR_INV_HBITMAP
  21674.  
  21675.  
  21676.  
  21677.  
  21678.  
  21679.  █    GetBitmapParameters
  21680.  ────────────────────────────────────────────────────────────────────────────
  21681.  
  21682.  BOOL GetBitmapParameters  (hbm, pbmih, hddc, ulFunN)
  21683.  
  21684.  HBM  hbm;                         /*handle of bitmap */
  21685.  
  21686.  PBITMAPINFOHEADER  pbmih;         /*pointer to BITMAPINFOHEADER structure
  21687.                                    */
  21688.  
  21689.  ULONG  hddc;                      /*handle of device driver's device
  21690.                                    context */
  21691.  
  21692.  ULONG  ulFunN;                    /*flags and function number */
  21693.  
  21694.  
  21695.  The GetBitmapParameters function retrieves information about a bitmap's
  21696.  width, height, number of color planes, and number of bits per pel.
  21697.  
  21698.  
  21699.  Parameters
  21700.  
  21701.  hbm  the bitmap.
  21702.  
  21703.  pbmih  to a BITMAPINFOHEADER structure that receives the bitmap information.
  21704.  
  21705.  
  21706.  hddc  the device driver's device context.
  21707.  
  21708.  ulFunN  the function number and a mask of various flags. The low word
  21709.  contains the function number; the high word contains a mask of flags, which
  21710.  may be set by the graphics programming interface (GPI), the engine, or a
  21711.  driver. For a description of these flags, see Section 7.1.1.
  21712.  
  21713.  
  21714.  Return Value
  21715.  
  21716.  The return value is TRUE if the function is successful or FALSE if an error
  21717.  occurs.
  21718.  
  21719.  
  21720.  Errors
  21721.  
  21722.  If an error occurs during the execution of this function, the graphics
  21723.  engine calls the WinSetErrorInfo function and records the associated error
  21724.  code. The following list contains possible error codes that the engine may
  21725.  record:
  21726.  
  21727.       PMERR_BITMAP_IS_SELECTED
  21728.       PMERR_HBITMAP_BUSY
  21729.       PMERR_INV_HBITMAP
  21730.  
  21731.  
  21732.  
  21733.  
  21734.  
  21735.  █    GetBoundsData
  21736.  ────────────────────────────────────────────────────────────────────────────
  21737.  
  21738.  BOOL GetBoundsData  (hdc, ulType, prcl, hddc, ulFunN)
  21739.  
  21740.  HDC  hdc;                         /*handle of engine's device context */
  21741.  
  21742.  ULONG  ulType;                    /*boundary-type identifier */
  21743.  
  21744.  PRECTL  prcl;                     /*pointer to RECTL structure */
  21745.  
  21746.  ULONG  hddc;                      /*handle of device driver's device
  21747.                                    context */
  21748.  
  21749.  ULONG  ulFunN;                    /*flags and function number */
  21750.  
  21751.  
  21752.  The GetBoundsData function retrieves the coordinates of two opposite corners
  21753.  for a bounding rectangle. A bounding rectangle is the smallest rectangle
  21754.  that completely encloses graphics output in either page or device space.
  21755.  
  21756.  
  21757.  
  21758.  Parameters
  21759.  
  21760.  hdc  the engine's device context.
  21761.  
  21762.  ulType  whether the rectangle coordinates are in page space or device space.
  21763.  
  21764.  
  21765.  Value                             Meaning
  21766.  ────────────────────────────────────────────────────────────────────────────
  21767.  
  21768.  GBD_GPI                           Specifies page coordinates, indicating
  21769.                                    that the bounding rectangle applies to
  21770.                                    Gpi functions.
  21771.  
  21772.  GBD_USER                          Specifies device coordinates, indicating
  21773.                                    that the bounding rectangle applies to
  21774.                                    user functions.
  21775.  
  21776.   prcl  to a RECTL structure that receives the coordinates of two opposite
  21777.  corners for the bounding rectangle.
  21778.  
  21779.  hddc  the device driver's device context.
  21780.  
  21781.  ulFunN  the function number and a mask of various flags. The low word
  21782.  contains the function number; the high word contains a mask of flags, which
  21783.  may be set by the graphics programming interface (GPI), the engine, or a
  21784.  driver. For a description of these flags, see Section 7.1.1.
  21785.  
  21786.  
  21787.  Return Value
  21788.  
  21789.  The return value is TRUE if the function is successful or FALSE if an error
  21790.  occurs.
  21791.  
  21792.  
  21793.  Errors
  21794.  
  21795.  If an error occurs during the execution of this function, the device driver
  21796.  calls the WinSetErrorInfo function and records the associated error code.
  21797.  The following list contains possible error codes that the device driver may
  21798.  record:
  21799.  
  21800.       PMERR_COORDINATE_OVERFLOW
  21801.       PMERR_DEV_FUNC_NOT_INSTALLED
  21802.       PMERR_INV_HDC
  21803.  
  21804.  
  21805.  
  21806.  
  21807.  
  21808.  Comments
  21809.  
  21810.  Note that the bounds are inclusive. A NULL boundary is represented by the
  21811.  minimum boundary greater than the maximum boundary. After a call to the
  21812.  ResetBounds function, minimum values will be 0x7FFFFFFF, and the maximum
  21813.  values will be 0x80000000.
  21814.  
  21815.  
  21816.  █    GetClipBox
  21817.  ────────────────────────────────────────────────────────────────────────────
  21818.  
  21819.  int GetClipBox  (hdc, prcl, hddc, ulFunN)
  21820.  
  21821.  HDC  hdc;                         /*handle of engine's device context */
  21822.  
  21823.  PRECTL  prcl;                     /*pointer to RECTL structure */
  21824.  
  21825.  ULONG  hddc;                      /*handle of device driver's device
  21826.                                    context */
  21827.  
  21828.  ULONG  ulFunN;                    /*flags and function number */
  21829.  
  21830.  
  21831.  The GetClipBox function returns the coordinates for two opposite corners of
  21832.  a special rectangle. This rectangle is the smallest rectangle that
  21833.  completely surrounds the intersection of the visible region, the clip
  21834.  region, the viewing limits, the graphics field, and the clip area.
  21835.  
  21836.  
  21837.  Parameters
  21838.  
  21839.  hdc  the engine's device context.
  21840.  
  21841.  prcl  to a RECTL structure that receives the coordinates of a special
  21842.  rectangle.
  21843.  
  21844.  hddc  the device driver's device context.
  21845.  
  21846.  ulFunN  the function number and a mask of various flags. The low word
  21847.  contains the function number; the high word contains a mask of flags, which
  21848.  may be set by the graphics programming interface (GPI), the engine, or a
  21849.  driver. For a description of these flags, see Section 7.1.1.
  21850.  
  21851.  
  21852.  Return Value
  21853.  
  21854.  The return value is RGN_NULL, RGN_RECT, or RGN_COMPLEX if the function is
  21855.  successful. The return value is RGN_ERROR if an error occurs.
  21856.  
  21857.  
  21858.  Errors
  21859.  
  21860.  If an error occurs during the execution of this function, the graphics
  21861.  engine or the device driver calls the WinSetErrorInfo function and records
  21862.  the associated error code. The following list contains possible error codes
  21863.  that the engine or the device driver calls record:
  21864.  
  21865.       PMERR_COORDINATE_OVERFLOW
  21866.       PMERR_DEV_FUNC_NOT_INSTALLED
  21867.       PMERR_HDC_BUSY
  21868.       PMERR_INV_COORD_SPACE
  21869.       PMERR_INV_HDC
  21870.       PMERR_INV_LENGTH_OR_COUNT
  21871.       PMERR_INV_RECT
  21872.  
  21873.  
  21874.  
  21875.  
  21876.  
  21877.  Comments
  21878.  
  21879.  The return value is the complexity of the Rao region (that is, the
  21880.  intersection of all clipping operations: clip path, viewing limits, graphics
  21881.  field, clip region and visible region).
  21882.  
  21883.  The bounding rectangle is inclusive─that is, points on the boundary of the
  21884.  rectangle are considered inside the rectangle.
  21885.  
  21886.  If the intersection is null, the rectangle returned has the right boundary
  21887.  less than the left, and the top boundary less than the bottom.
  21888.  
  21889.  
  21890.  █    GetClipRects
  21891.  ────────────────────────────────────────────────────────────────────────────
  21892.  
  21893.  int GetClipRects  (hdc, prcl, prgnrect, arcl, hddc, ulFunN)
  21894.  
  21895.  HDC  hdc;                         /*handle of engine's device context */
  21896.  
  21897.  PRECTL  prcl;                     /*pointer to RECTL structure */
  21898.  
  21899.  PRGNRECT  prgnrect;               /*pointer to REGIONRECT structure */
  21900.  
  21901.  PRECTL  arcl;                     /*pointer to array of RECTL structures
  21902.                                    */
  21903.  
  21904.  ULONG  hddc;                      /*handle of device driver's device
  21905.                                    context */
  21906.  
  21907.  ULONG  ulFunN;                    /*flags and function number */
  21908.  
  21909.  
  21910.  The GetClipRects function retrieves the coordinates of the rectangle or
  21911.  rectangles that compose the current clipping region and intersect the
  21912.  rectangle specified by the prcl parameter. The current clipping region is
  21913.  the intersection of the visible region, the clip region, the viewing limit,
  21914.  the graphics field, and the clip path.
  21915.  
  21916.  
  21917.  Parameters
  21918.  
  21919.  hdc  the engine's device context.
  21920.  
  21921.  prcl  to a RECTL structure that defines the area of interest.
  21922.  
  21923.  prgnrect  to a REGIONRECT structure that contains fields specifying how this
  21924.  function should enumerate multiple clipping rectangles.
  21925.  
  21926.  arcl  to an array of RECTL structures that define the clipping region.
  21927.  
  21928.  hddc  the device driver's device context.
  21929.  
  21930.  ulFunN  the function number and a mask of various flags. The low word
  21931.  contains the function number; the high word contains a mask of flags, which
  21932.  may be set by the graphics programming interface (GPI), the engine, or a
  21933.  driver. For a description of these flags, see Section 7.1.1.
  21934.  
  21935.  
  21936.  Return Value
  21937.  
  21938.  The return value is RGN_NULL, RGN_RECT, or RGN_COMPLEX if the function is
  21939.  successful or RGN_ERROR if an error occurs.
  21940.  
  21941.  
  21942.  Errors
  21943.  
  21944.  If an error occurs during the execution of this function, the graphics
  21945.  engine or the device driver calls the WinSetErrorInfo function and records
  21946.  the associated error code. The following list contains possible error codes
  21947.  that the engine or the device driver calls record:
  21948.  
  21949.       PMERR_DEV_FUNC_NOT_INSTALLED
  21950.       PMERR_HDC_BUSY
  21951.       PMERR_INV_COORDINATE
  21952.       PMERR_INV_HDC
  21953.       PMERR_INV_RECT
  21954.       PMERR_INV_REGION_CONTROL
  21955.  
  21956.  
  21957.  
  21958.  
  21959.  
  21960.  █    GetCodePage
  21961.  ────────────────────────────────────────────────────────────────────────────
  21962.  
  21963.  LONG GetCodePage  (hdc, hddc, ulFunN)
  21964.  
  21965.  HDC  hdc;                         /*handle of engine's device context */
  21966.  
  21967.  ULONG  hddc;                      /*handle of device driver's device
  21968.                                    context */
  21969.  
  21970.  ULONG  ulFunN;                    /*flags and function number */
  21971.  
  21972.  
  21973.  The GetCodePage function retrieves a value that identifies the current code
  21974.  page.
  21975.  
  21976.  
  21977.  Parameters
  21978.  
  21979.  hdc  the engine's device context.
  21980.  
  21981.  hddc  the device driver's device context.
  21982.  
  21983.  ulFunN  the function number and a mask of various flags. The low word
  21984.  contains the function number; the high word contains a mask of flags, which
  21985.  may be set by the graphics programming interface (GPI), the engine, or a
  21986.  driver. For a description of these flags, see Section 7.1.1.
  21987.  
  21988.  
  21989.  Return Value
  21990.  
  21991.  The return value identifies the code page if the function is successful;
  21992.  otherwise, it is zero.
  21993.  
  21994.  
  21995.  Errors
  21996.  
  21997.  If an error occurs during the execution of this function, the device driver
  21998.  calls the WinSetErrorInfo function and records the associated error code.
  21999.  The following list contains possible error codes that the device driver may
  22000.  record:
  22001.  
  22002.       PMERR_DEV_FUNC_NOT_INSTALLED
  22003.  
  22004.  
  22005.  
  22006.  
  22007.  
  22008.  Comments
  22009.  
  22010.  The code page returned by this function applies only to the default font.
  22011.  
  22012.  
  22013.  █    GetCurrentPosition
  22014.  ────────────────────────────────────────────────────────────────────────────
  22015.  
  22016.  BOOL GetCurrentPosition  (hdc, pptl, hddc, ulFunN)
  22017.  
  22018.  HDC  hdc;                         /*handle of engine's device context */
  22019.  
  22020.  PPOINTL  pptl;                    /*pointer to POINTL structure */
  22021.  
  22022.  ULONG  hddc;                      /*handle of device driver's device
  22023.                                    context */
  22024.  
  22025.  ULONG  ulFunN;                    /*flags and function number */
  22026.  
  22027.  
  22028.  The GetCurrentPosition function retrieves the coordinates of the current
  22029.  position.
  22030.  
  22031.  
  22032.  Parameters
  22033.  
  22034.  hdc  the engine's device context.
  22035.  
  22036.  pptl  to a POINTL structure that receives the coordinates of the current
  22037.  position.
  22038.  
  22039.  hddc  the device driver's device context.
  22040.  
  22041.  ulFunN  the function number and a mask of various flags. The low word
  22042.  contains the function number; the high word contains a mask of flags,
  22043.  which may be set by the graphics programming interface (GPI), the engine, or
  22044.  a driver. For a description of these flags, see Section 7.1.1.
  22045.  
  22046.  
  22047.  Return Value
  22048.  
  22049.  The return value is TRUE if the function is successful or FALSE if an error
  22050.  occurs.
  22051.  
  22052.  
  22053.  Errors
  22054.  
  22055.  If an error occurs during the execution of this function, the device driver
  22056.  calls the WinSetErrorInfo function and records the associated error code.
  22057.  The following list contains possible error codes that the device driver may
  22058.  record:
  22059.  
  22060.       PMERR_DEV_FUNC_NOT_INSTALLED
  22061.       PMERR_INV_HDC
  22062.  
  22063.  
  22064.  
  22065.  
  22066.  
  22067.  █    GetDCOrigin
  22068.  ────────────────────────────────────────────────────────────────────────────
  22069.  
  22070.  BOOL GetDCOrigin  (hdc, pptl, hddc, ulFunN)
  22071.  
  22072.  HDC  hdc;                         /*handle of engine's device context */
  22073.  
  22074.  PPOINTL  pptl;                    /*pointer to POINTL structure */
  22075.  
  22076.  ULONG  hddc;                      /*handle of device driver's device
  22077.                                    context */
  22078.  
  22079.  ULONG  ulFunN;                    /*flags and function number */
  22080.  
  22081.  
  22082.  The GetDCOrigin function retrieves the coordinates of the device context
  22083.  origin. (These coordinates are specified in device units.)
  22084.  
  22085.  
  22086.  Parameters
  22087.  
  22088.  hdc  the engine's device context.
  22089.  
  22090.  pptl  to a POINTL structure that receives the coordinates of the device
  22091.  context origin in device units.
  22092.  
  22093.  hddc  the device driver's device context.
  22094.  
  22095.  ulFunN  the function number and a mask of various flags. The low word
  22096.  contains the function number; the high word contains a mask of flags, which
  22097.  may be set by the graphics programming interface (GPI), the engine, or a
  22098.  driver. For a description of these flags, see Section 7.1.1.
  22099.  
  22100.  
  22101.  Return Value
  22102.  
  22103.  The return value is TRUE if the function is successful or FALSE if an error
  22104.  occurs.
  22105.  
  22106.  
  22107.  Errors
  22108.  
  22109.  If an error occurs during the execution of this function, the device driver
  22110.  calls the WinSetErrorInfo function and records the associated error code.
  22111.  The following list contains possible error codes that the device driver may
  22112.  record:
  22113.  
  22114.       PMERR_DEV_FUNC_NOT_INSTALLED
  22115.       PMERR_INV_HDC
  22116.  
  22117.  
  22118.  
  22119.  
  22120.  
  22121.  █    GetDefaultArcParameters
  22122.  ────────────────────────────────────────────────────────────────────────────
  22123.  
  22124.  BOOL GetDefaultArcParameters  (hdc, parcp, hddc, ulFunN)
  22125.  
  22126.  HDC  hdc;                         /*handle of engine's device context */
  22127.  
  22128.  PARCPARAMS  parcp;                /*pointer to ARCPARAMS structure */
  22129.  
  22130.  ULONG  hddc;                      /*handle of device driver's device
  22131.                                    context */
  22132.  
  22133.  ULONG  ulFunN;                    /*flags and function number */
  22134.  
  22135.  
  22136.  The GetDefaultArcParameters function retrieves the current values of the
  22137.  default arc parameters: p, q, r, and s.
  22138.  
  22139.  
  22140.  Parameters
  22141.  
  22142.  hdc  the engine's device context.
  22143.  
  22144.  parcp  to an ARCPARAMS structure that contains the arc parameters.
  22145.  
  22146.  hddc  the device driver's device context.
  22147.  
  22148.  ulFunN  the function number and a mask of various flags. The low word
  22149.  contains the function number; the high word contains a mask of flags, which
  22150.  may be set by the graphics programming interface (GPI), the engine, or a
  22151.  driver. For a description of these flags, see Section 7.1.1.
  22152.  
  22153.  
  22154.  Return Value
  22155.  
  22156.  The return value is TRUE if the function is successful or FALSE if an error
  22157.  occurs.
  22158.  
  22159.  
  22160.  Comments
  22161.  
  22162.  The engine assigns the default arc parameters to a device context when GPI
  22163.  calls the InitializeAttributes function and sets the INAT_CURRENTATTRIBUTES
  22164.  option.
  22165.  
  22166.  The arc parameters define the shape and orientation of an ellipse that the
  22167.  engine uses when it receives subsequent Arc, FullArc, and PartialArc calls.
  22168.  For all of these functions except Arc, the parameters also determine the
  22169.  direction in which the device draws the arc:
  22170.  
  22171.  Parameters                        Direction
  22172.  ────────────────────────────────────────────────────────────────────────────
  22173.  
  22174.  p * q > r * s                     Counterclockwise
  22175.  
  22176.  p * q < r * s                     Clockwise
  22177.  
  22178.  p * q = r * s                     Straight line
  22179.  
  22180.  Also, except in the case of Arc, these parameters define the nominal size of
  22181.  the ellipse, although this may be changed by using the multiplier. For the
  22182.  Arc function, the size of the ellipse is determined by the three points
  22183.  specified in the Arc parameters.
  22184.  
  22185.  The arc parameters define a transformation that maps the unit circle to the
  22186.  required ellipse, placed at the origin (0,0):
  22187.  
  22188.  x' = p * x + r * y
  22189.  y' = s * x + q * y
  22190.  
  22191.  
  22192.  If p * r plus q * s is equal to zero, the transformation is termed
  22193.  orthogonal and the line from the origin (0,0) to the point (p,s) is either
  22194.  the radius of the circle or half the major or minor axis of the ellipse. The
  22195.  line from the origin to the point (r,q) is either the radius of the circle
  22196.  or half the other axis of the ellipse.
  22197.  
  22198.  To ensure maximum accuracy, use orthogonal transformations.
  22199.  
  22200.  The standard default values of arc parameters (that define a unit circle)
  22201.  are as follows:
  22202.  
  22203.  p = 1   r = 0
  22204.  s = 0   q = 1
  22205.  
  22206.  
  22207.  Arc parameters are transformed in world coordinates. Any other non-square
  22208.  transformations in effect will change the shape of the figure accordingly.
  22209.  
  22210.  
  22211.  
  22212.  █    GetDefaultAttributes
  22213.  ────────────────────────────────────────────────────────────────────────────
  22214.  
  22215.  BOOL GetDefaultAttributes  (hdc, ulType, flAttrs, pBundle, hddc, ulFunN)
  22216.  
  22217.  HDC  hdc;                         /*handle of engine's device context */
  22218.  
  22219.  ULONG  ulType;                    /*attribute-bundle type */
  22220.  
  22221.  ULONG  flAttrs;                   /*attribute mask */
  22222.  
  22223.  PBUNDLE  pBundle;                 /*pointer to attribute bundle */
  22224.  
  22225.  ULONG  hddc;                      /*handle of device driver's device
  22226.                                    context */
  22227.  
  22228.  ULONG  ulFunN;                    /*flags and function number */
  22229.  
  22230.  
  22231.  The GetDefaultAttributes function retrieves the current values for the
  22232.  default attributes identified by the flAttrs parameter.
  22233.  
  22234.  
  22235.  Parameters
  22236.  
  22237.  hdc  the engine's device context.
  22238.  
  22239.  ulType  the type of attributes to retrieve. This parameter can be one of the
  22240.  following values:
  22241.  
  22242.  Value                             Meaning
  22243.  ────────────────────────────────────────────────────────────────────────────
  22244.  
  22245.  PRIM_LINE                         Line-attribute bundle
  22246.  
  22247.  PRIM_CHAR                         Character-attribute bundle
  22248.  
  22249.  PRIM_MARKER                       Marker-attribute bundle
  22250.  
  22251.  PRIM_AREA                         Area-attribute bundle
  22252.  
  22253.  PRIM_IMAGE                        Image-attribute bundle
  22254.  
  22255.   flAttrs  which attribute values to fill in the bundle. The fields in
  22256.  each bundle are represented by specific bits. The function retrieves
  22257.  information for each bit that is set.
  22258.  
  22259.  pBundle  to a copy of an attribute bundle. Only the attribute values that
  22260.  correspond to the flAttrs attribute flags will contain valid information.
  22261.  
  22262.  hddc  the device driver's device context.
  22263.  
  22264.  ulFunN  the function number and a mask of various flags. The low word
  22265.  contains the function number; the high word contains a mask of flags, which
  22266.  may be set by the graphics programming interface (GPI), the engine, or a
  22267.  driver. For a description of these flags, see Section 7.1.1.
  22268.  
  22269.  
  22270.  Return Value
  22271.  
  22272.  The return value is TRUE if the function is successful or FALSE if an error
  22273.  occurs.
  22274.  
  22275.  
  22276.  Comments
  22277.  
  22278.  The default attributes are those that the graphics engine assigns to the
  22279.  attribute bundles in a device context when GPI calls the
  22280.  InitializeAttributes or SetAttributes function. If GPI calls
  22281.  InitializeAttributes, it must set the option INAT_CURRENTATTRIBUTES. If GPI
  22282.  calls SetAttributes, only those attributes identified by the flDefs flag are
  22283.  set to their default values.
  22284.  
  22285.  
  22286.  █    GetDefaultViewingLimits
  22287.  ────────────────────────────────────────────────────────────────────────────
  22288.  
  22289.  BOOL GetDefaultViewingLimits  (hdc, prcl, hddc, ulFunN)
  22290.  
  22291.  HDC  hdc;                         /*handle of engine's device context */
  22292.  
  22293.  PRECTL  prcl;                     /*pointer to RECTL structure */
  22294.  
  22295.  ULONG  hddc;                      /*handle of application's device context
  22296.                                    */
  22297.  
  22298.  ULONG  ulFunN;                    /*flags and function number */
  22299.  
  22300.  
  22301.  The GetDefaultViewingLimits function retrieves the rectangle that specifies
  22302.  the default viewing limits in model-space coordinates.
  22303.  
  22304.  
  22305.  Parameters
  22306.  
  22307.  hdc  the engine's device context.
  22308.  
  22309.  prcl  to the RECTL structure that receives the viewing limits.
  22310.  
  22311.  hddc  the device driver's device context.
  22312.  
  22313.  ulFunN  the function number and a mask of various flags. The low word
  22314.  contains the function number; the high word contains a mask of flags, which
  22315.  may be set by the graphics programming interface (GPI), the engine, or a
  22316.  driver. For a description of these flags, see Section 7.1.1.
  22317.  
  22318.  
  22319.  Return Value
  22320.  
  22321.  The return value is TRUE if the function is successful or FALSE if an error
  22322.  occurs.
  22323.  
  22324.  
  22325.  Comments
  22326.  
  22327.  The default viewing limits are those that the graphics engine assigns to a
  22328.  device context when GPI calls the InitializeAttributes function and sets the
  22329.  INAT_CURRENTATTRIBUTES option.
  22330.  
  22331.  
  22332.  █    GetDriverInfo
  22333.  ────────────────────────────────────────────────────────────────────────────
  22334.  
  22335.  ULONG PASCAL FAR GetDriverInfo  (handle, index, hdc)
  22336.  
  22337.  LHANDLE  handle;                  /*handle of device context or bitmap */
  22338.  
  22339.  ULONG  ulIndex;                   /*index of device context or bitmap */
  22340.  
  22341.  HDC  hdc;                         /*handle of engine's device context */
  22342.  
  22343.  
  22344.  The GetDriverInfo function retrieves the handle of a driver's device context
  22345.  that contains the instance data that the engine associated with a device
  22346.  context or a bitmap.
  22347.  
  22348.  The graphics engine validates the handle parameter to ensure that it belongs
  22349.  to the same device driver as the one identified by the hdc parameter and
  22350.  returns an error if not. This provides a mechanism for devices to validate
  22351.  the ownership of a device context or a bitmap.
  22352.  
  22353.  This function is available as a callback function from device drivers to the
  22354.  graphics engine and can be directly dynamically linked to.
  22355.  
  22356.  
  22357.  Parameters
  22358.  
  22359.  handle  a device context or a bitmap.
  22360.  
  22361.  ulIndex  whether the handle parameter identifies a device context or a
  22362.  bitmap. If this parameter is DI_HDC, handle identifies a device context. If
  22363.  the parameter is DI_HBITMAP, handle identifies a bitmap.
  22364.  
  22365.  hdc  the engine's device context.
  22366.  
  22367.  
  22368.  Return Value
  22369.  
  22370.  The return value is the handle to a driver's device context if the function
  22371.  is successful; otherwise, it is -1.
  22372.  
  22373.  
  22374.  Comments
  22375.  
  22376.  The graphics engine exports this function, making it available to
  22377.  Presentation Manager device drivers. However, a device driver must import
  22378.  GetDriverInfo in its module definition file in order to link to the library
  22379.  that contains the call.
  22380.  
  22381.  
  22382.  █    GetGlobalViewingXform
  22383.  ────────────────────────────────────────────────────────────────────────────
  22384.  
  22385.  BOOL GetGlobalViewingXform  (hdc, pxform, hddc, ulFunN)
  22386.  
  22387.  HDC  hdc;                         /*handle of engine's device context */
  22388.  
  22389.  PXFORM  pxform;                   /*pointer to XFORM structure */
  22390.  
  22391.  ULONG  hddc;                      /*handle of device driver's device
  22392.                                    context */
  22393.  
  22394.  ULONG  ulFunN;                    /*flags and function number */
  22395.  
  22396.  
  22397.  The GetGlobalViewingXform function retrieves values from the current global
  22398.  viewing transformation matrix.
  22399.  
  22400.  
  22401.  Parameters
  22402.  
  22403.  hdc  the engine's device context.
  22404.  
  22405.  pxform  to an XFORM structure that receives the first two elements from the
  22406.  three rows of a transformation matrix.
  22407.  
  22408.  hddc  the device driver's device context.
  22409.  
  22410.  ulFunN  the function number and a mask of various flags. The low word
  22411.  contains the function number; the high word contains a mask of flags, which
  22412.  may be set by the graphics programming interface (GPI), the engine, or a
  22413.  driver. For a description of these flags, see Section 7.1.1.
  22414.  
  22415.  
  22416.  Return Value
  22417.  
  22418.  The return value is TRUE if the function is successful or FALSE if an error
  22419.  occurs.
  22420.  
  22421.  
  22422.  Errors
  22423.  
  22424.  If an error occurs during the execution of this function, the graphics
  22425.  engine or the device driver calls the WinSetErrorInfo function and records
  22426.  the associated error code. The following list contains possible error codes
  22427.  that the engine or the device driver calls record:
  22428.  
  22429.       PMERR_HDC_BUSY
  22430.       PMERR_INV_HDC
  22431.  
  22432.  
  22433.  
  22434.  
  22435.  
  22436.  █    GetGraphicsField
  22437.  ────────────────────────────────────────────────────────────────────────────
  22438.  
  22439.  BOOL GetGraphicsField  (hdc, prcl, hddc, ulFunN)
  22440.  
  22441.  HDC  hdc;                         /*handle of engine's device context */
  22442.  
  22443.  PRECTL  prcl;                     /*pointer to RECTL structure */
  22444.  
  22445.  UNSIGNED  hddc;                   /*handle of device driver's device
  22446.                                    context */
  22447.  
  22448.  UNSIGNED  ulFunN;                 /*flags and function number */
  22449.  
  22450.  
  22451.  The GetGraphicsField function retrieves the coordinates of the lower-left
  22452.  and upper-right corners of the graphics field. The graphics field is a
  22453.  clipping area in page space.
  22454.  
  22455.  
  22456.  Parameters
  22457.  
  22458.  hdc  the engine's device context.
  22459.  
  22460.  prcl  to a RECTL structure that receives the page-space coordinates of the
  22461.  lower-left and upper-right corners of the graphics field.
  22462.  
  22463.  hddc  the device driver's device context.
  22464.  
  22465.  ulFunN  the function number and a mask of various flags. The low word
  22466.  contains the function number; the high word contains a mask of flags, which
  22467.  may be set by the graphics programming interface (GPI), the engine, or a
  22468.  driver. For a description of these flags, see Section 7.1.1.
  22469.  
  22470.  
  22471.  Return Value
  22472.  
  22473.  The return value is TRUE if the function is successful or FALSE if an error
  22474.  occurs.
  22475.  
  22476.  
  22477.  Errors
  22478.  
  22479.  If an error occurs during the execution of this function, the graphics
  22480.  engine or the device driver calls the WinSetErrorInfo function and records
  22481.  the associated error code. The following list contains possible error codes
  22482.  that the engine or the device driver calls record:
  22483.  
  22484.       PMERR_HDC_BUSY
  22485.       PMERR_INV_HDC
  22486.  
  22487.  
  22488.  
  22489.  
  22490.  
  22491.  █    GetHandle
  22492.  ────────────────────────────────────────────────────────────────────────────
  22493.  
  22494.  LONG GetHandle  (hdc, ulIndex, hddc, ulFunN)
  22495.  
  22496.  HDC  hdc;                         /*handle of engine's device context */
  22497.  
  22498.  ULONG  ulIndex;                   /*index for handle */
  22499.  
  22500.  ULONG  hddc;                      /*handle of device driver's device
  22501.                                    context */
  22502.  
  22503.  ULONG  ulFunN;                    /*flags and function number */
  22504.  
  22505.  
  22506.  The GetHandle function retrieves a handle for the specified index.
  22507.  
  22508.  
  22509.  Parameters
  22510.  
  22511.  hdc  the engine's device context.
  22512.  
  22513.  ulIndex  the index value of the handle in the range 0 to 3. This parameter
  22514.  may specify a handle for a GPI presentation space, an AVIO presentation
  22515.  space, or a metafile. The fourth index value is reserved for future use.
  22516.  
  22517.  hddc  the device driver's device context.
  22518.  
  22519.  ulFunN  the function number and a mask of various flags. The low word
  22520.  contains the function number; the high word contains a mask of flags, which
  22521.  may be set by the graphics programming interface (GPI), the engine, or a
  22522.  driver. For a description of these flags, see Section 7.1.1.
  22523.  
  22524.  
  22525.  Return Value
  22526.  
  22527.  The return value is the specified handle if the function is successful;
  22528.  otherwise, it is GPI_ALTERROR.
  22529.  
  22530.  
  22531.  Errors
  22532.  
  22533.  If an error occurs during the execution of this function, the graphics
  22534.  engine calls the WinSetErrorInfo function and records the associated error
  22535.  code. The following list contains possible error codes that the engine may
  22536.  record:
  22537.  
  22538.       PMERR_HDC_BUSY
  22539.       PMERR_INV_HDC
  22540.  
  22541.  
  22542.  
  22543.  
  22544.  
  22545.  █    GetLineOrigin
  22546.  ────────────────────────────────────────────────────────────────────────────
  22547.  
  22548.  LONG GetLineOrigin  (hdc, pptl, hddc, ulFunN)
  22549.  
  22550.  HDC  hdc;                         /*handle of engine's device context */
  22551.  
  22552.  PPOINTL  pptl;                    /*pointer to POINTL structure */
  22553.  
  22554.  ULONG  hddc;                      /*handle of device driver's device
  22555.                                    context */
  22556.  
  22557.  ULONG  ulFunN;                    /*flags and function number */
  22558.  
  22559.  
  22560.  The GetLineOrigin function returns the current style state and current
  22561.  position to the device driver. The style state is kept by the device driver.
  22562.  
  22563.  
  22564.  Simulations must be able to query and set the style since some lines/curves
  22565.  are drawn by the driver and some by simulations.
  22566.  
  22567.  The style number is a USHORT value with two parts. The low byte is the
  22568.  position in the style mask, in the range 0 through 255. The high byte is the
  22569.  state of the style error value.
  22570.  
  22571.  
  22572.  Parameters
  22573.  
  22574.  pptl  to a POINTL structure that receives the coordinate pair in which the
  22575.  current position is returned.
  22576.  
  22577.  
  22578.  Return Value
  22579.  
  22580.  The return value is GPI_OK if the function is successful or GPI_ERROR if an
  22581.  error occurs.
  22582.  
  22583.  
  22584.  Errors
  22585.  
  22586.  If an error occurs during the execution of this function, the device driver
  22587.  calls the WinSetErrorInfo function and records the associated error code.
  22588.  The following list contains possible error codes that the device driver may
  22589.  record:
  22590.  
  22591.       PMERR_DEV_FUNC_NOT_INSTALLED
  22592.       PMERR_INV_HDC
  22593.  
  22594.  
  22595.  
  22596.  
  22597.  
  22598.  █    GetModelXform
  22599.  ────────────────────────────────────────────────────────────────────────────
  22600.  
  22601.  BOOL GetModelXform  (hdc, pxform, hddc, ulFunN)
  22602.  
  22603.  HDC  hdc;                         /*handle of engine's device context */
  22604.  
  22605.  PXFORM  pxform;                   /*pointer to XFORM structure */
  22606.  
  22607.  ULONG  hddc;                      /*handle of device driver's device
  22608.                                    context */
  22609.  
  22610.  ULONG  ulFunN;                    /*flags and function number */
  22611.  
  22612.  
  22613.  The GetModelXform function retrieves values from the current
  22614.  model-transformation matrix.
  22615.  
  22616.  
  22617.  Parameters
  22618.  
  22619.  hdc  the engine's device context.
  22620.  
  22621.  pxform  to an XFORM structure that contains the first two values from the
  22622.  three rows in a two-dimensional transformation matrix.
  22623.  
  22624.  hddc  the device driver's device context.
  22625.  
  22626.  ulFunN  the function number and a mask of various flags. The low word
  22627.  contains the function number; the high word contains a mask of flags, which
  22628.  may be set by the graphics programming interface (GPI), the engine, or a
  22629.  driver. For a description of these flags, see Section 7.1.1.
  22630.  
  22631.  
  22632.  Return Value
  22633.  
  22634.  The return value is TRUE if the function is successful or FALSE if an error
  22635.  occurs.
  22636.  
  22637.  
  22638.  Errors
  22639.  
  22640.  If an error occurs during the execution of this function, the graphics
  22641.  engine or the device driver calls the WinSetErrorInfo function and records
  22642.  the associated error code. The following list contains possible error codes
  22643.  that the engine or the device driver calls record:
  22644.  
  22645.       PMERR_HDC_BUSY
  22646.       PMERR_INV_HDC
  22647.  
  22648.  
  22649.  
  22650.  
  22651.  
  22652.  █    GetPageUnits
  22653.  ────────────────────────────────────────────────────────────────────────────
  22654.  
  22655.  LONG GetPageUnits  (hdc, pulUnits, hddc, ulFunN)
  22656.  
  22657.  HDC  hdc;                         /*handle of engine's device context */
  22658.  
  22659.  PULONG  pulUnits;                 /*pointer to page dimensions */
  22660.  
  22661.  ULONG  hddc;                      /*handle of device driver's device
  22662.                                    context */
  22663.  
  22664.  ULONG  ulFunN;                    /*flags and function number */
  22665.  
  22666.  
  22667.  The GetPageUnits function retrieves the current page units as well as the
  22668.  presentation-page dimensions.
  22669.  
  22670.  
  22671.  Parameters
  22672.  
  22673.  hdc  the engine's device context.
  22674.  
  22675.  pulUnits  to a ULONG value that contains the current presentation-page
  22676.  dimensions.
  22677.  
  22678.  hddc  the device driver's device context.
  22679.  
  22680.  ulFunN  the function number and a mask of various flags. The low word
  22681.  contains the function number; the high word contains a mask of flags, which
  22682.  may be set by the graphics programming interface (GPI), the engine, or a
  22683.  driver. For a description of these flags, see Section 7.1.1.
  22684.  
  22685.  
  22686.  Return Value
  22687.  
  22688.  The return value specifies the page units if the function is successful;
  22689.  otherwise, it is zero.
  22690.  
  22691.  
  22692.  Errors
  22693.  
  22694.  If an error occurs during the execution of this function, the graphics
  22695.  engine or the device driver calls the WinSetErrorInfo function and records
  22696.  the associated error code. The following list contains possible error codes
  22697.  that the engine or the device driver calls record:
  22698.  
  22699.       PMERR_HDC_BUSY
  22700.       PMERR_INV_HDC
  22701.  
  22702.  
  22703.  
  22704.  
  22705.  
  22706.  █    GetPageViewport
  22707.  ────────────────────────────────────────────────────────────────────────────
  22708.  
  22709.  BOOL GetPageViewport  (hdc, prcl, hddc, ulFunN)
  22710.  
  22711.  HDC  hdc;                         /*handle of engine's device context */
  22712.  
  22713.  PRECTL  prcl;                     /*pointer to RECTL structure */
  22714.  
  22715.  ULONG  hddc;                      /*handle of device driver's device
  22716.                                    context */
  22717.  
  22718.  ULONG  ulFunN;                    /*flags and function number */
  22719.  
  22720.  
  22721.  The GetPageViewport function retrieves the coordinates of the lower-left and
  22722.  upper-right corners of the page viewport.
  22723.  
  22724.  
  22725.  Parameters
  22726.  
  22727.  hdc  the engine's device context.
  22728.  
  22729.  prcl  to a RECTL structure that contains the coordinates of the lower-left
  22730.  and upper-right corners of the page viewport.
  22731.  
  22732.  uhddc  the device driver's device context.
  22733.  
  22734.  ulFunN  the function number and a mask of various flags. The low word
  22735.  contains the function number; the high word contains a mask of flags, which
  22736.  may be set by the graphics programming interface (GPI), the engine, or a
  22737.  driver. For a description of these flags, see Section 7.1.1.
  22738.  
  22739.  
  22740.  Return Value
  22741.  
  22742.  The return value is TRUE if the function is successful or FALSE if an error
  22743.  occurs.
  22744.  
  22745.  
  22746.  Errors
  22747.  
  22748.  If an error occurs during the execution of this function, the graphics
  22749.  engine or the device driver calls the WinSetErrorInfo function and records
  22750.  the associated error code. The following list contains possible error codes
  22751.  that the engine or the device driver calls record:
  22752.  
  22753.       PMERR_HDC_BUSY
  22754.       PMERR_INV_HDC
  22755.  
  22756.  
  22757.  
  22758.  
  22759.  
  22760.  █    GetPairKerningTable
  22761.  ────────────────────────────────────────────────────────────────────────────
  22762.  
  22763.  ULONG GetPairKerningTable  (hdc, ckp, pkp, hddc, ulFunN)
  22764.  
  22765.  HDC  hdc;                         /*handle of engine's device context */
  22766.  
  22767.  LONG  ckp;                        /*count of kerning pairs */
  22768.  
  22769.  PKERNINGPAIRS  pkp;               /*pointer to KERNINGPAIRS structures */
  22770.  
  22771.  ULONG  hddc;                      /*handle of device driver's device
  22772.                                    context */
  22773.  
  22774.  ULONG  ulFunN;                    /*flags and function number */
  22775.  
  22776.  
  22777.   The GetPairKerningTable function retrieves kerning information for
  22778.  kerning pairs in the current font. Kerning is a process of adding or
  22779.  subtracting space between specific characters in a font. The kerning
  22780.  information identifies each character in the pair and specifies a kerning
  22781.  amount for that pair. The second parameter, ckp, specifies the number of
  22782.  kerning pairs for which the function should retrieve information.
  22783.  
  22784.  
  22785.  Parameters
  22786.  
  22787.  hdc  the engine's device context.
  22788.  
  22789.  ckp  the number of kerning pairs requested.
  22790.  
  22791.  pkp  to KERNINGPAIRS structures which contain information for each kerning
  22792.  pair. Each structure contains a field that specifies the kerning amount as
  22793.  well as two fields that identify the kerned characters.
  22794.  
  22795.  hddc  the device driver's device context.
  22796.  
  22797.  ulFunN  the function number and a mask of various flags. The low word
  22798.  contains the function number; the high word contains a mask of flags, which
  22799.  may be set by the graphics programming interface (GPI), the engine, or a
  22800.  driver. For a description of these flags, see Section 7.1.1.
  22801.  
  22802.  
  22803.  Return Value
  22804.  
  22805.  The return value is the number of kern pairs if the function is successful.
  22806.  Otherwise, it is GPI_ALTERROR.
  22807.  
  22808.  
  22809.  Errors
  22810.  
  22811.  If an error occurs during the execution of this function, the device driver
  22812.  calls the WinSetErrorInfo function and records the associated error code.
  22813.  The following list contains possible error codes that the device driver may
  22814.  record:
  22815.  
  22816.       PMERR_COORDINATE_OVERFLOW
  22817.       PMERR_DEV_FUNC_NOT_INSTALLED
  22818.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  22819.       PMERR_HDC_BUSY
  22820.       PMERR_INSUFFICIENT_MEMORY
  22821.       PMERR_INV_CODEPAGE
  22822.       PMERR_INV_COORD_SPACE
  22823.       PMERR_INV_HDC
  22824.       PMERR_INV_LENGTH_OR_COUNT
  22825.       PMERR_INV_SETID
  22826.  
  22827.  
  22828.  
  22829.  
  22830.  
  22831.  █    GetPel
  22832.  ────────────────────────────────────────────────────────────────────────────
  22833.  
  22834.  LONG GetPel  (hdc, pptl, hddc, ulFunN)
  22835.  
  22836.  HDC  hdc;                         /*handle of engine's device context */
  22837.  
  22838.  PPOINTL  pptl;                    /*pointer to POINTL structure */
  22839.  
  22840.  ULONG  hddc;                      /*handle of device driver's device
  22841.                                    context */
  22842.  
  22843.  ULONG  ulFunN;                    /*flags and function number */
  22844.  
  22845.  
  22846.  The GetPel function retrieves the color for a specified pel. (This color may
  22847.  be an RGB value or a color-table index and is dependent on the current
  22848.  color-table mode.)
  22849.  
  22850.  
  22851.  Parameters
  22852.  
  22853.  hdc  the engine's device context.
  22854.  
  22855.  pptl  to a POINTL structure that contains the current pel coordinates.
  22856.  
  22857.  hddc  the device driver's device context.
  22858.  
  22859.  ulFunN  the function number and a mask of various flags. The low word
  22860.  contains the function number; the high word contains a mask of flags, which
  22861.  may be set by the graphics programming interface (GPI), the engine, or a
  22862.  driver. For a description of these flags, see Section 7.1.1.
  22863.  
  22864.  
  22865.  Return Value
  22866.  
  22867.  The return value is an RGB or color-index value for the pel if the function
  22868.  is successful; otherwise, it is GPI_ALTERROR.
  22869.  
  22870.  
  22871.  Errors
  22872.  
  22873.  If an error occurs during the execution of this function, the device driver
  22874.  calls the WinSetErrorInfo function and records the associated error code.
  22875.  The following list contains possible error codes that the device driver may
  22876.  record:
  22877.  
  22878.       PMERR_BITMAP_NOT_SELECTED
  22879.       PMERR_COORDINATE_OVERFLOW
  22880.       PMERR_DEV_FUNC_NOT_INSTALLED
  22881.       PMERR_HDC_BUSY
  22882.       PMERR_INV_COORD_SPACE
  22883.       PMERR_INV_COORDINATE
  22884.       PMERR_INV_HDC
  22885.       PMERR_INV_LENGTH_OR_COUNT
  22886.       PMERR_INV_RECT
  22887.       PMERR_PEL_IS_CLIPPED
  22888.       PMERR_PEL_NOT_AVAILABLE
  22889.  
  22890.  
  22891.  
  22892.  
  22893.  
  22894.  Comments
  22895.  
  22896.  If the color table contains indices rather than RGB values and the function
  22897.  fails to find a matching color, it returns the constant CLR_NOINDEX (-254).
  22898.  
  22899.  If the location of the pel is outside of the current clipping areas, the
  22900.  function returns an error.
  22901.  
  22902.  
  22903.  █    GetPickWindow
  22904.  ────────────────────────────────────────────────────────────────────────────
  22905.  
  22906.  BOOL GetPickWindow  (hdc, prcl, hddc, ulFunN)
  22907.  
  22908.  HDC  hdc;                         /*handle of engine's device context */
  22909.  
  22910.  PRECTL  prcl;                     /*pointer to RECTL structure */
  22911.  
  22912.  ULONG  hddc;                      /*handle of device driver's device
  22913.                                    context */
  22914.  
  22915.  ULONG  ulFunN;                    /*flags and function number */
  22916.  
  22917.  
  22918.  The GetPickWindow function retrieves the coordinates of the pick aperture's
  22919.  lower-left and upper-right corners.
  22920.  
  22921.  
  22922.  Parameters
  22923.  
  22924.  hdc  the engine's device context.
  22925.  
  22926.  prcl  to a RECTL structure that receives the coordinates (in page units) of
  22927.  the pick aperture's lower-left and upper-right corners.
  22928.  
  22929.  hddc  the device driver's device context.
  22930.  
  22931.  ulFunN  the function number and a mask of various flags. The low word
  22932.  contains the function number; the high word contains a mask of flags, which
  22933.  may be set by the graphics programming interface (GPI), the engine, or a
  22934.  driver. For a description of these flags, see Section 7.1.1.
  22935.  
  22936.  
  22937.  Return Value
  22938.  
  22939.  The return value is TRUE if the function is successful or FALSE if an error
  22940.  occurs.
  22941.  
  22942.  
  22943.  Errors
  22944.  
  22945.  If an error occurs during the execution of this function, the device driver
  22946.  calls the WinSetErrorInfo function and records the associated error code.
  22947.  The following list contains possible error codes that the device driver may
  22948.  record:
  22949.  
  22950.       PMERR_DEV_FUNC_NOT_INSTALLED
  22951.       PMERR_INV_HDC
  22952.  
  22953.  
  22954.  
  22955.  
  22956.  
  22957.  █    GetProcessControl
  22958.  ────────────────────────────────────────────────────────────────────────────
  22959.  
  22960.  LONG GetProcessControl  (hdc, hddc, ulFunN)
  22961.  
  22962.  HDC  hdc;                         /*handle of engine's device context */
  22963.  
  22964.  ULONG  hddc;                      /*handle of device driver's device
  22965.                                    context */
  22966.  
  22967.  ULONG  ulFunN;                    /*flags and function number */
  22968.  
  22969.  
  22970.  The GetProcessControl function retrieves the process-control flags. These
  22971.  flags have the following values:
  22972.  
  22973.  Value                             Meaning
  22974.  ────────────────────────────────────────────────────────────────────────────
  22975.  
  22976.  0x0001                            Draw process flag (PCTL_DRAW).
  22977.  
  22978.  0x0002                            Bounds process flag (PCTL_BOUND).
  22979.  
  22980.  0x0004                            Correlate process flag (PCTL_CORRELATE).
  22981.  
  22982.  0x0008                            User bounds process flag
  22983.                                    (PCTL_USERBOUNDS).
  22984.  
  22985.  0x0010                            Area definition is in progress
  22986.                                    (PCTL_AREA).
  22987.  
  22988.  0x0020                            Path definition is in progress
  22989.                                    (PCTL_PATH).
  22990.  
  22991.  All other values are reserved.
  22992.  
  22993.  
  22994.  Parameters
  22995.  
  22996.  hdc  the engine's device context.
  22997.  
  22998.  hddc  the device driver's device context.
  22999.  
  23000.  ulFunN  the function number and a mask of various flags. The low word
  23001.  contains the function number; the high word contains a mask of flags, which
  23002.  may be set by the graphics programming interface (GPI), the engine, or a
  23003.  driver. For a description of these flags, see Section 7.1.1.
  23004.  
  23005.  
  23006.  Return Value
  23007.  
  23008.  The return value specifies the process-control flags if the function is
  23009.  successful; otherwise, it is GPI_ALTERROR.
  23010.  
  23011.  
  23012.  Errors
  23013.  
  23014.  If an error occurs during the execution of this function, the graphics
  23015.  engine calls the WinSetErrorInfo function and records the associated error
  23016.  code. The following list contains possible error codes that the engine may
  23017.  record:
  23018.  
  23019.       PMERR_HDC_BUSY
  23020.       PMERR_INV_HDC
  23021.  
  23022.  
  23023.  
  23024.  
  23025.  
  23026.  █    GetRegionBox
  23027.  ────────────────────────────────────────────────────────────────────────────
  23028.  
  23029.  int GetRegionBox  (hdc, hrgn, prcl, hddc, ulFunN)
  23030.  
  23031.  HDC  hdc;                         /*handle of engine's device context */
  23032.  
  23033.  HRGN  hrgn;                       /*handle of region */
  23034.  
  23035.  PRECTL  prcl;                     /*pointer to RECTL structure */
  23036.  
  23037.  ULONG  hddc;                      /*handle of device driver's device
  23038.                                    context */
  23039.  
  23040.  ULONG  ulFunN;                    /*flags and function number */
  23041.  
  23042.  
  23043.  The GetRegionBox function returns the dimensions of the smallest possible
  23044.  rectangle that will fit around a region. If the region is empty, the
  23045.  returned rectangle's right boundary is less than its left, and its top
  23046.  boundary less than its top.
  23047.  
  23048.  
  23049.  Parameters
  23050.  
  23051.  hrgn  the region.
  23052.  
  23053.  prcl  to a RECTL structure that receives the dimensions of the rectangle in
  23054.  device coordinates.
  23055.  
  23056.  
  23057.  Return Value
  23058.  
  23059.  The return value, if the function is successful, is RGN_NULL if the region
  23060.  is empty, RGN_RECT if the region is a single rectangle, or RGN_COMPLEX if
  23061.  the region consists of multiple rectangles. The return value is RGN_ERROR if
  23062.  an error occurs.
  23063.  
  23064.  
  23065.  Errors
  23066.  
  23067.  If an error occurs during the execution of this function, the graphics
  23068.  engine or the device driver calls the WinSetErrorInfo function and records
  23069.  the associated error code. The following list contains possible error codes
  23070.  that the engine or the device driver calls record:
  23071.  
  23072.       PMERR_HRGN_BUSY
  23073.       PMERR_INV_HRGN
  23074.       PMERR_REGION_IS_CLIP_REGION
  23075.  
  23076.  
  23077.  
  23078.  
  23079.  
  23080.  █    GetRegionRects
  23081.  ────────────────────────────────────────────────────────────────────────────
  23082.  
  23083.  BOOL GetRegionRects  (hdc, hrgn, prclBounds, prgnrc, prcl, hddc, ulFunN)
  23084.  
  23085.  HDC  hdc;                         /*handle of engine's device context */
  23086.  
  23087.  HRGN  hrgn;                       /*handle of region */
  23088.  
  23089.  PRECTL  prclBounds;               /*pointer to RECTL structure */
  23090.  
  23091.  PRGNRECT  prgnrc;                 /*pointer to RGNRECT structure */
  23092.  
  23093.  PRECTL  prcl;                     /*pointer to RECTL structure */
  23094.  
  23095.  ULONG  hddc;                      /*handle of device driver's device
  23096.                                    context */
  23097.  
  23098.  ULONG  ulFunN;                    /*flags and function number */
  23099.  
  23100.  
  23101.  The GetRegionRects function returns a list of (x,y) coordinates that specify
  23102.  the region associated with the given region handle. A region selected as a
  23103.  clipping region can also be specified.
  23104.  
  23105.  
  23106.  Parameters
  23107.  
  23108.  hdc  the engine's device context.
  23109.  
  23110.  hrgn  the region for which region data is returned.
  23111.  
  23112.  prclBounds  to a RECTL structure that contains a bounding rectangle. The
  23113.  first (x,y) pair defines the minimum coordinates of the rectangle, and the
  23114.  second (x,y) pair defines the maximum coordinates of the rectangle in device
  23115.  coordinates. Only rectangles intersecting this bounding rectangle are
  23116.  retrieved. If this pointer is NULL, all rectangles in the region are
  23117.  enumerated.
  23118.  
  23119.  If prclBounds is not NULL, each of the rectangles returned in the structure
  23120.  pointed to by prcl will be the intersection of the bounding rectangle with a
  23121.  rectangle in the region.
  23122.  
  23123.  prgnrc  to a RGNRECT structure. The structure has the following form:
  23124.  
  23125.  typedef struct _RGNRECT {       /* rgnrc */
  23126.      USHORT ircStart;
  23127.      USHORT crc;
  23128.      USHORT crcReturned;
  23129.      USHORT usDirection;
  23130.  } RGNRECT;
  23131.  
  23132.  
  23133.  prcl  to a RECTL structure that defines a rectangular region, which is an
  23134.  array of (x,y) pairs in device coordinates. Odd (x,y) pairs specify the
  23135.  minimum coordinates of a rectangle, and even (x,y) pairs specify the maximum
  23136.  coordinates. The format is identical to that for the CreateRectRegion
  23137.  function.
  23138.  
  23139.  hddc  the device driver's device context.
  23140.  
  23141.  ulFunN  the function number and a mask of various flags. The low word
  23142.  contains the function number; the high word contains a mask of flags, which
  23143.  may be set by the graphics programming interface (GPI), the engine, or a
  23144.  driver. For a description of these flags, see Section 7.1.1.
  23145.  
  23146.  
  23147.  Return Value
  23148.  
  23149.  The return value is TRUE if the function is successful or FALSE if an error
  23150.  occurs.
  23151.  
  23152.  
  23153.  Errors
  23154.  
  23155.  If an error occurs during the execution of this function, the graphics
  23156.  engine or the device driver calls the WinSetErrorInfo function and records
  23157.  the associated error code. The following list contains possible error codes
  23158.  that the engine or the device driver calls record:
  23159.  
  23160.       PMERR_HRGN_BUSY
  23161.       PMERR_INV_COORDINATE
  23162.       PMERR_INV_HRGN
  23163.       PMERR_INV_RECT
  23164.       PMERR_INV_REGION_CONTROL
  23165.       PMERR_REGION_IS_CLIP_REGION
  23166.  
  23167.  
  23168.  
  23169.  
  23170.  
  23171.  █    GetStyleRatio
  23172.  ────────────────────────────────────────────────────────────────────────────
  23173.  
  23174.  BOOL GetStyleRatio  (hdc, psr, hddc, ulFunN)
  23175.  
  23176.  HDC  hdc;                         /*handle of engine's device context */
  23177.  
  23178.  PBYTE  psr;                       /*pointer to buffer for style ratio */
  23179.  
  23180.  ULONG  hddc;                      /*handle of device driver's device
  23181.                                    context */
  23182.  
  23183.  ULONG  ulFunN;                    /*flags and function number */
  23184.  
  23185.  
  23186.  The GetStyleRatio function retrieves the style ratio for the device driver.
  23187.  
  23188.  This is a required device driver function.
  23189.  
  23190.  
  23191.  Parameters
  23192.  
  23193.  hdc  the engine's device context.
  23194.  
  23195.  psr  to the two-byte buffer that receives the style ratio. The low byte
  23196.  specifies the x-component; the high byte specifies the y-component.
  23197.  
  23198.  hddc  the device driver's device context.
  23199.  
  23200.  ulFunN  the function number and a mask of various flags. The low word
  23201.  contains the function number; the high word contains a mask of flags, which
  23202.  may be set by the graphics programming interface (GPI), the engine, or a
  23203.  driver. For a description of these flags, see Section 7.1.1.
  23204.  
  23205.  
  23206.  Return Value
  23207.  
  23208.  The return value is TRUE if the function is successful or FALSE if an error
  23209.  occurs.
  23210.  
  23211.  
  23212.  Errors
  23213.  
  23214.  If an error occurs during the execution of this function, the device driver
  23215.  calls the WinSetErrorInfo function and records the associated error code.
  23216.  The following list contains possible error codes that the device driver may
  23217.  record:
  23218.  
  23219.       PMERR_DEV_FUNC_NOT_INSTALLED
  23220.       PMERR_INV_HDC
  23221.  
  23222.  
  23223.  
  23224.  
  23225.  
  23226.  █    GetViewingLimits
  23227.  ────────────────────────────────────────────────────────────────────────────
  23228.  
  23229.  BOOL GetViewingLimits  (hdc, prcl, hddc, ulFunN)
  23230.  
  23231.  HDC  hdc;                         /*handle of application's device context
  23232.                                    */
  23233.  
  23234.  PRECTL  prcl;                     /*pointer to RECTL structure */
  23235.  
  23236.  ULONG  hddc;                      /*handle of device driver's device
  23237.                                    context */
  23238.  
  23239.  ULONG  ulFunN;                    /*flags and function number */
  23240.  
  23241.  
  23242.  The GetViewingLimits function retrieves the rectangle that specifies the
  23243.  boundaries of the viewing window in model space coordinates.
  23244.  
  23245.  
  23246.  Parameters
  23247.  
  23248.  hdc  the engine's device context.
  23249.  
  23250.  prcl  to the RECTL structure that receives the viewing limits.
  23251.  
  23252.  hddc  the device driver's device context.
  23253.  
  23254.  ulFunN  the function number and a mask of various flags. The low word
  23255.  contains the function number; the high word contains a mask of flags, which
  23256.  may be set by the graphics programming interface (GPI), the engine, or a
  23257.  driver. For a description of these flags, see Section 7.1.1.
  23258.  
  23259.  
  23260.  Return Value
  23261.  
  23262.  The return value is TRUE if the function is successful or FALSE if an error
  23263.  occurs.
  23264.  
  23265.  
  23266.  Errors
  23267.  
  23268.  If an error occurs during the execution of this function, the graphics
  23269.  engine or the device driver calls the WinSetErrorInfo function and records
  23270.  the associated error code. The following list contains possible error codes
  23271.  that the engine or the device driver calls record:
  23272.  
  23273.       PMERR_HDC_BUSY
  23274.       PMERR_INV_HDC
  23275.  
  23276.  
  23277.  
  23278.  █    GetWindowViewportXform
  23279.  ────────────────────────────────────────────────────────────────────────────
  23280.  
  23281.  BOOL GetWindowViewportXform  (hdc, pxform, hddc, ulFunN)
  23282.  
  23283.  HDC  hdc;                         /*handle of engine's device context */
  23284.  
  23285.  PXFORM  pxform;                   /*pointer to XFORM structure */
  23286.  
  23287.  ULONG  hddc;                      /*handle of device driver's device
  23288.                                    context */
  23289.  
  23290.  ULONG  ulFunN;                    /*flags and function number */
  23291.  
  23292.  
  23293.  The GetWindowViewportXform function retrieves an array of values that define
  23294.  the current window-to-viewport transformation matrix.
  23295.  
  23296.  
  23297.  Parameters
  23298.  
  23299.  hdc  the engine's device context.
  23300.  
  23301.  pxform  to an XFORM structure that contains the first two rows from the
  23302.  three rows of a transformation matrix. The structure has the following form:
  23303.  
  23304.  
  23305.  typedef struct _XFORM { /* xform */
  23306.      FIXED fxM11;
  23307.      FIXED fxM12;
  23308.      FIXED fxM21;
  23309.      FIXED fxM22;
  23310.      LONG  lM41;
  23311.      LONG  lM42;
  23312.  } XFORM;
  23313.  
  23314.  
  23315.  hddc  the device driver's device context.
  23316.  
  23317.  ulFunN  the function number and a mask of various flags. The low word
  23318.  contains the function number; the high word contains a mask of flags, which
  23319.  may be set by the graphics programming interface (GPI), the engine, or a
  23320.  driver. For a description of these flags, see Section 7.1.1.
  23321.  
  23322.  
  23323.  Return Value
  23324.  
  23325.  The return value is TRUE if the function is successful or FALSE if an error
  23326.  occurs.
  23327.  
  23328.  
  23329.  Errors
  23330.  
  23331.  If an error occurs during the execution of this function, the graphics
  23332.  engine or the device driver calls the WinSetErrorInfo function and records
  23333.  the associated error code. The following list contains possible error codes
  23334.  that the engine or the device driver calls record:
  23335.  
  23336.       PMERR_HDC_BUSY
  23337.       PMERR_INV_HDC
  23338.  
  23339.  
  23340.  
  23341.  
  23342.  
  23343.  █    GreEntry
  23344.  ────────────────────────────────────────────────────────────────────────────
  23345.  
  23346.  GreEntry  (param1, ..., paramN, hddc, ulFunN)
  23347.  
  23348.  TYPE1  param1;                    /*type and name depend on function */
  23349.  
  23350.  TYPEN  paramN;                    /*type and name depend on function */
  23351.  
  23352.  ULONG  hddc;                      /*handle of device driver's device
  23353.                                    context */
  23354.  
  23355.  ULONG  ulFunN;                    /*flags and function number */
  23356.  
  23357.  
  23358.  The GreEntry function provides Presentation Manager device drivers with
  23359.  access to the graphics engine.
  23360.  
  23361.  
  23362.  Parameters
  23363.  
  23364.  param1...paramN  parameters correspond to the parameters of the
  23365.  graphics-engine function that the device driver is calling. The types (TYPE)
  23366.  correspond as well.
  23367.  
  23368.  hddc  a device driver's device context.
  23369.  
  23370.  ulFunN  the function number and a mask of various flags. The low word
  23371.  contains the function number; the high word contains a mask of flags, which
  23372.  may be set by the graphics programming interface (GPI), the engine, or a
  23373.  driver. For a description of these flags, see Section 7.1.1.
  23374.  
  23375.  
  23376.  Return Value
  23377.  
  23378.  The return value depends on the graphics-engine function that the device
  23379.  driver is calling.
  23380.  
  23381.  
  23382.  Comments
  23383.  
  23384.  The GreEntry function validates the device context identified by the hddc
  23385.  parameter before passing a call to the graphics engine. This validation
  23386.  includes verifying that hddc is a valid device context handle and clearing
  23387.  any bits in the handle that GPI may have set.
  23388.  
  23389.  
  23390.  █    ImageData
  23391.  ────────────────────────────────────────────────────────────────────────────
  23392.  
  23393.  int ImageData  (hdc, pbImage, cBits, lRow, hddc, ulFunN)
  23394.  
  23395.  HDC  hdc;                         /*handle of engine's device context */
  23396.  
  23397.  PBYTE  pbImage;                   /*pointer to buffer for image data */
  23398.  
  23399.  LONG  cBits;                      /*count of bits in image data */
  23400.  
  23401.  LONG  lRow;                       /*row for image data */
  23402.  
  23403.  ULONG  hddc;                      /*handle of device driver's device
  23404.                                    context */
  23405.  
  23406.  ULONG  ulFunN;                    /*flags and function number */
  23407.  
  23408.  
  23409.  The ImageData function draws a row of image data. The function uses each bit
  23410.  in the image data pointed to pbImage to determine whether to set a
  23411.  corresponding pel. The first pel in the image is specified by the first bit
  23412.  in the first byte of data. The lRow parameter specifies the vertical offset
  23413.  in pels from the current position to start the image.
  23414.  
  23415.  The function is typically called for each row of the image, with the first
  23416.  call specifying top row in the image and subsequent calls specifying
  23417.  adjacent rows.
  23418.  
  23419.  The function does not change the current position.
  23420.  
  23421.  
  23422.  Parameters
  23423.  
  23424.  hdc  the engine's device context.
  23425.  
  23426.  pbImage  to a buffer that contains the image data. Each bit represents one
  23427.  pel. The maximum image width is 2040 pels.
  23428.  
  23429.  cBits  the number of pels to draw─that is, the number of bits in the image
  23430.  data to use. If the count is not a multiple of 8, any remaining bits in the
  23431.  image data are not used. The function cannot "assume" that unused bits are
  23432.  zero.
  23433.  
  23434.  lRow  the row number of the image data. Row 0 is the same row as the current
  23435.  position, row 1 is the next one down the screen, and so on.
  23436.  
  23437.  hddc  the device driver's device context.
  23438.  
  23439.  ulFunN  the function number and a mask of various flags. The low word
  23440.  contains the function number; the high word contains a mask of flags, which
  23441.  may be set by the graphics programming interface (GPI), the engine, or a
  23442.  driver. For a description of these flags, see Section 7.1.1.
  23443.  
  23444.  
  23445.  Return Value
  23446.  
  23447.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  23448.  GPI_HITS if the detectable attribute is set for the presentation space and a
  23449.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  23450.  
  23451.  
  23452.  Errors
  23453.  
  23454.  If an error occurs during the execution of this function, the device driver
  23455.  calls the WinSetErrorInfo function and records the associated error code.
  23456.  The following list contains possible error codes that the device driver may
  23457.  record:
  23458.  
  23459.       PMERR_BITMAP_NOT_SELECTED
  23460.       PMERR_COORDINATE_OVERFLOW
  23461.       PMERR_DEV_FUNC_NOT_INSTALLED
  23462.       PMERR_HDC_BUSY
  23463.       PMERR_INV_COLOR_DATA
  23464.       PMERR_INV_COLOR_INDEX
  23465.       PMERR_INV_COORD_SPACE
  23466.       PMERR_INV_COORDINATE
  23467.       PMERR_INV_HDC
  23468.       PMERR_INV_IMAGE_DATA_LENGTH
  23469.       PMERR_INV_IN_AREA
  23470.       PMERR_INV_IN_PATH
  23471.       PMERR_INV_LENGTH_OR_COUNT
  23472.       PMERR_INV_PICK_APERTURE_POSN
  23473.       PMERR_INV_RECT
  23474.       PMERR_INV_REGION_CONTROL
  23475.       PMERR_INV_SCAN_START
  23476.  
  23477.  
  23478.  
  23479.  
  23480.  
  23481.  █    Initialize
  23482.  ────────────────────────────────────────────────────────────────────────────
  23483.  
  23484.  void Initialize  ()
  23485.  
  23486.  
  23487.  
  23488.  The Initialize function initializes the engine for a given device driver
  23489.  process. A process must call Initialize before making any other engine call.
  23490.  
  23491.  
  23492.  This function has no parameters and returns no value.
  23493.  
  23494.  
  23495.  Comments
  23496.  
  23497.  For all other engine calls, the device driver process calls a single entry
  23498.  point to the graphics engine. The last parameter to this entry point
  23499.  indicates the required function to carry out.
  23500.  
  23501.  
  23502.  █    InitializeAttributes
  23503.  ────────────────────────────────────────────────────────────────────────────
  23504.  
  23505.  BOOL InitializeAttributes  (hdc, flCmd, hddc, ulFunN)
  23506.  
  23507.  HDC  hdc;                         /*handle of engine's device context */
  23508.  
  23509.  ULONG  flCmd;                     /*command flags */
  23510.  
  23511.  ULONG  hddc;                      /*handle of device driver's device
  23512.                                    context */
  23513.  
  23514.  ULONG  ulFunN;                    /*flags and function number */
  23515.  
  23516.  
  23517.  The InitializeAttributes function either initializes the default attributes
  23518.  to their original values or resets the current attributes to their default
  23519.  values.
  23520.  
  23521.  
  23522.  Parameters
  23523.  
  23524.  hdc  Identifies the engine's device context.
  23525.  
  23526.  flCmd  Specifies whether the default attributes should be set to their
  23527.  original values, or whether the current attributes should be set to their
  23528.  default values. This field can be set to one or both of the following
  23529.  values:
  23530.  
  23531.  Flag                              Meaning
  23532.  ────────────────────────────────────────────────────────────────────────────
  23533.  
  23534.  INAT_DEFAULTATTRIBUTES            Set all default attributes to their
  23535.                                    original values.
  23536.  
  23537.  INAT_CURRENTATTRIBUTES            Set all current attributes to their
  23538.                                    default values.
  23539.  
  23540.  hddc  Identifies the device driver's device context.
  23541.  
  23542.  ulFunN  Specifies the function number and a mask of various flags. The low
  23543.  word contains the function number; the high word contains a mask of flags,
  23544.  which may be set by the graphics programming interface (GPI), the engine, or
  23545.  a driver. For a description of these flags, see Section 7.1.1.
  23546.  
  23547.  
  23548.  Return Value
  23549.  
  23550.  The return value is TRUE if the function is successful or FALSE if an error
  23551.  occurs.
  23552.  
  23553.  
  23554.  Comments
  23555.  
  23556.  If both of the flCmd options are set, the graphics engine resets the default
  23557.  attributes before resetting the current attributes.
  23558.  
  23559.  The default and current attributes include the primitive bundles, the arc
  23560.  parameters, and the viewing limits.
  23561.  
  23562.  
  23563.  █    IntersectClipRectangle
  23564.  ────────────────────────────────────────────────────────────────────────────
  23565.  
  23566.  int IntersectClipRectangle  (hdc, prcl, hddc, ulFunN)
  23567.  
  23568.  HDC  hdc;                         /*handle of engine's device context */
  23569.  
  23570.  PRECTL  prcl;                     /*pointer to RECTL structure */
  23571.  
  23572.  ULONG  hddc;                      /*device driver's device context */
  23573.  
  23574.  ULONG  ulFunN;                    /*flags and function number */
  23575.  
  23576.  
  23577.  The IntersectClipRectangle function sets the new clip region to the
  23578.  intersection of the current clip region and the specified rectangle. The
  23579.  function creates a clip region if none existed before.
  23580.  
  23581.  All of the boundaries of the rectangle are considered to be part of the
  23582.  interior and are not clipped.
  23583.  
  23584.  
  23585.  Parameters
  23586.  
  23587.  hdc  Identifies the engine's device context.
  23588.  
  23589.  prcl  Points to the RECTL structure that receives the viewing limits. The
  23590.  structure has the following form:
  23591.  
  23592.  typedef struct _RECTL {    /* rcl */
  23593.      LONG xLeft;
  23594.      LONG yBottom;
  23595.      LONG xRight;
  23596.      LONG yTop;
  23597.  } RECTL;
  23598.  
  23599.  
  23600.  hddc  Identifies the device driver's device context.
  23601.  
  23602.  ulFunN  Specifies the function number and a mask of various flags. The low
  23603.  word contains the function number; the high word contains a mask of flags,
  23604.  which may be set by the graphics programming interface (GPI), the engine, or
  23605.  a driver. For a description of these flags, see Section 7.1.1.
  23606.  
  23607.  
  23608.  Return Value
  23609.  
  23610.  The return value is RGN_NULL, RGN_RECT, or RGN_COMPLEX if the function is
  23611.  successful. The return value is RGN_ERROR if an error occurs.
  23612.  
  23613.  
  23614.  Errors
  23615.  
  23616.  If an error occurs during the execution of this function, the graphics
  23617.  engine or the device driver calls the WinSetErrorInfo function and records
  23618.  the associated error code. The following list contains possible error codes
  23619.  that the engine or the device driver calls record:
  23620.  
  23621.       PMERR_COORDINATE_OVERFLOW
  23622.       PMERR_DEV_FUNC_NOT_INSTALLED
  23623.       PMERR_HDC_BUSY
  23624.       PMERR_INSUFFICIENT_MEMORY
  23625.       PMERR_INV_COORD_SPACE
  23626.       PMERR_INV_COORDINATE
  23627.       PMERR_INV_HDC
  23628.       PMERR_INV_HRGN
  23629.       PMERR_INV_IN_AREA
  23630.       PMERR_INV_IN_PATH
  23631.       PMERR_INV_LENGTH_OR_COUNT
  23632.       PMERR_INV_RECT
  23633.       PMERR_INV_REGION_CONTROL
  23634.  
  23635.  
  23636.  
  23637.  
  23638.  
  23639.  █    InvalidateVisRegion
  23640.  ────────────────────────────────────────────────────────────────────────────
  23641.  
  23642.  BOOL InvalidateVisRegion  (hdc, civr, pivr, hddc, ulFunN)
  23643.  
  23644.  HDC  hdc;                         /*handle of application's device context
  23645.                                    */
  23646.  
  23647.  LONG  civr;                       /*count of DC_BLOCK structures */
  23648.  
  23649.  PDC_BLOCK  pivr;                  /*pointer to array of DC_BLOCK
  23650.                                    structures */
  23651.  
  23652.  ULONG  hddc;                      /*handle of device driver's device
  23653.                                    context */
  23654.  
  23655.  ULONG  ulFunN;                    /*flags and function number */
  23656.  
  23657.  
  23658.  The InvalidateVisRegion function invalidates the visible regions in the
  23659.  device contexts identified by the DC_BLOCK structures in the specified
  23660.  array.
  23661.  
  23662.  
  23663.  Parameters
  23664.  
  23665.  hdc  Identifies the engine's device context.
  23666.  
  23667.  civr  Specifies the number of DC_BLOCK structures that appear in the array
  23668.  pointed to by the pivr parameter.
  23669.  
  23670.  pivr  Points to an array of DC_BLOCK structures.
  23671.  
  23672.  hddc  Identifies the device driver's device context.
  23673.  
  23674.  ulFunN  Specifies the function number and a mask of various flags. The low
  23675.  word contains the function number; the high word contains a mask of flags,
  23676.  which may be set by the graphics programming interface (GPI), the engine, or
  23677.  a driver. For a description of these flags, see Section 7.1.1.
  23678.  
  23679.  
  23680.  Return Value
  23681.  
  23682.  The return value is TRUE if this function is successful or FALSE if an error
  23683.  occurs.
  23684.  
  23685.  
  23686.  Errors
  23687.  
  23688.  If an error occurs during the execution of this function, the graphics
  23689.  engine calls the WinSetErrorInfo function and records the associated error
  23690.  code. The following list contains possible error codes that the engine may
  23691.  record:
  23692.  
  23693.       PMERR_DEV_FUNC_NOT_INSTALLED
  23694.  
  23695.  
  23696.  
  23697.  
  23698.  
  23699.  █    LoadFont
  23700.  ────────────────────────────────────────────────────────────────────────────
  23701.  
  23702.  BOOL LoadFont  (pszFilename, hddc, ulFunN)
  23703.  
  23704.  PSZ  pszFilename;                 /*pointer to name of font file */
  23705.  
  23706.  ULONG  hddc;                      /*handle of device driver's device
  23707.                                    context */
  23708.  
  23709.  ULONG  ulFunN;                    /*flags and function number */
  23710.  
  23711.  
  23712.  The LoadFont function loads fonts from the specified resource file. All
  23713.  fonts in the file are "private" and available only to the process that
  23714.  issued this function.
  23715.  
  23716.  
  23717.  Parameters
  23718.  
  23719.  pszFilename  Points to a null-terminated string. This string must specify a
  23720.  complete MS OS/2 path and font filename. All MS OS/2 font filenames use the
  23721.  .fon extension.
  23722.  
  23723.  hddc  Identifies the device driver's device context.
  23724.  
  23725.  ulFunN  Specifies the function number and a mask of various flags. The low
  23726.  word contains the function number; the high word contains a mask of flags,
  23727.  which may be set by the graphics programming interface (GPI), the engine, or
  23728.  a driver. For a description of these flags, see Section 7.1.1.
  23729.  
  23730.  
  23731.  Return Value
  23732.  
  23733.  The return value is GPI_OK if the function is successful or GPI_ERROR if an
  23734.  error occurs.
  23735.  
  23736.  
  23737.  Errors
  23738.  
  23739.  If an error occurs during the execution of this function, the graphics
  23740.  engine calls the WinSetErrorInfo function and records the associated error
  23741.  code. The following list contains possible error codes that the engine may
  23742.  record:
  23743.  
  23744.       PMERR_BASE_ERROR
  23745.       PMERR_INSUFFICIENT_MEMORY
  23746.       PMERR_INV_FONT_FILE_DATA
  23747.  
  23748.  
  23749.  
  23750.  
  23751.  
  23752.  █    LoadPublicFont
  23753.  ────────────────────────────────────────────────────────────────────────────
  23754.  
  23755.  BOOL LoadPublicFont  (pszFilename, hddc, ulFunN)
  23756.  
  23757.  PSZ  pszFilename;                 /*pointer to name of font file */
  23758.  
  23759.  ULONG  hddc;                      /*handle of device driver's device
  23760.                                    context */
  23761.  
  23762.  ULONG  ulFunN;                    /*flags and function number */
  23763.  
  23764.  
  23765.  The LoadPublicFont function loads fonts from the specified resource file.
  23766.  All fonts in the file are "public"─that is, available to all applications.
  23767.  
  23768.  If LoadPublicFont is called for a font file that has already been loaded by
  23769.  another process, the function should be successful.
  23770.  
  23771.  
  23772.  Parameters
  23773.  
  23774.  pszFilename  Points to a null-terminated string. This string must contain a
  23775.  complete path and font filename. (Font filenames should use the .fon
  23776.  extension.)
  23777.  
  23778.  hddc  Identifies the device driver's device context.
  23779.  
  23780.  ulFunN  Specifies the function number and a mask of various flags. The low
  23781.  word contains the function number; the high word contains a mask of flags,
  23782.  which may be set by the graphics programming interface (GPI), the engine, or
  23783.  a driver. For a description of these flags, see Section 7.1.1.
  23784.  
  23785.  
  23786.  Return Value
  23787.  
  23788.  The return value is GPI_OK if the function is successful or GPI_ERROR if an
  23789.  error occurs.
  23790.  
  23791.  
  23792.  Errors
  23793.  
  23794.  If an error occurs during the execution of this function, the graphics
  23795.  engine calls the WinSetErrorInfo function and records the associated error
  23796.  code. The following list contains possible error codes that the engine may
  23797.  record:
  23798.  
  23799.       PMERR_BASE_ERROR
  23800.       PMERR_INSUFFICIENT_MEMORY
  23801.       PMERR_INV_FONT_FILE_DATA
  23802.  
  23803.  
  23804.  
  23805.  
  23806.  
  23807.  Comments
  23808.  
  23809.  The UnLoadPublicFont function does not remove a font if another process has
  23810.  local identifiers linked to it. The font is removed when the last process
  23811.  releases it, but before the font can be removed, it is necessary to set the
  23812.  character set to one that does not reference the font and to then delete any
  23813.  local identifiers that reference the font.
  23814.  
  23815.  
  23816.  █    LockDevice
  23817.  ────────────────────────────────────────────────────────────────────────────
  23818.  
  23819.  BOOL LockDevice  (hdc, hddc, ulFunN)
  23820.  
  23821.  HDC  hdc;                         /*handle of engine's device context */
  23822.  
  23823.  ULONG  hddc;                      /*handle of device driver's device
  23824.                                    context */
  23825.  
  23826.  ULONG  ulFunN;                    /*flags and function number */
  23827.  
  23828.  
  23829.  The LockDevice function locks the visible region for the device. It allows
  23830.  all current and pending drawing to complete and blocks any further draw
  23831.  requests by other threads. The function permits only the thread that
  23832.  acquired the lock to continue screen I/O. All screen I/O operations by other
  23833.  threads will be blocked until the UnlockDevice function is called.
  23834.  
  23835.  
  23836.  Parameters
  23837.  
  23838.  hdc  Identifies the engine's device context.
  23839.  
  23840.  hddc  Identifies the device driver's device context.
  23841.  
  23842.  ulFunN  Specifies the function number and a mask of various flags. The low
  23843.  word contains the function number; the high word contains a mask of flags,
  23844.  which may be set by the graphics programming interface (GPI), the engine, or
  23845.  a driver. For a description of these flags, see Section 7.1.1.
  23846.  
  23847.  
  23848.  Return Value
  23849.  
  23850.  The return value is TRUE if the function is successful or FALSE if an error
  23851.  occurs.
  23852.  
  23853.  
  23854.  Errors
  23855.  
  23856.  If an error occurs during the execution of this function, the device driver
  23857.  calls the WinSetErrorInfo function and records the associated error code.
  23858.  The following list contains possible error codes that the device driver may
  23859.  record:
  23860.  
  23861.       PMERR_DEV_FUNC_NOT_INSTALLED
  23862.       PMERR_INV_HDC
  23863.  
  23864.  
  23865.  
  23866.  
  23867.  
  23868.  Comments
  23869.  
  23870.  The LockDevice and UnlockDevice functions are used mainly in the critical
  23871.  sections of visible-region calculations.
  23872.  
  23873.  To prevent deadlock, it is guaranteed that no Death or Resurrection function
  23874.  will be called by the window manager while the visible region is locked.
  23875.  
  23876.  
  23877.  
  23878.  █    ModifyPath
  23879.  ────────────────────────────────────────────────────────────────────────────
  23880.  
  23881.  BOOL ModifyPath  (hdc, phid, ulMode, hddc, ulFunN)
  23882.  
  23883.  HDC  hdc;                         /*handle of engine's device context */
  23884.  
  23885.  PHID  phid;                       /*path identifier */
  23886.  
  23887.  ULONG  ulMode;                    /*modification options */
  23888.  
  23889.  ULONG  hddc;                      /*handle of device driver's device
  23890.                                    context */
  23891.  
  23892.  ULONG  ulFunN;                    /*flags and function number */
  23893.  
  23894.  
  23895.  The ModifyPath function modifies the specified path. After modifying a path,
  23896.  the path can be used only with the FillPath and SelectClipPath functions and
  23897.  then only if the FPATH_WINDING mode is specified.
  23898.  
  23899.  
  23900.  Parameters
  23901.  
  23902.  hdc  Identifies the engine's device context.
  23903.  
  23904.  phid  Specifies the identifier of the path to modify. This parameter must be
  23905.  greater than zero. For this release of Presentation Manager, it must be set
  23906.  to 1.
  23907.  
  23908.  ulMode  Specifies how to modify the path. This parameter can be the
  23909.  following value─the only mode supported by this release of Presentation
  23910.  Manager:
  23911.  
  23912.  Value                             Meaning
  23913.  ────────────────────────────────────────────────────────────────────────────
  23914.  
  23915.  MPATH_STROKE                      Replaces the path with a path enclosing
  23916.                                    the shape produced by stroking the path
  23917.                                    using the current geometric wide-line
  23918.                                    attribute. Any open figures within the
  23919.                                    path are not closed. The bracket will
  23920.                                    include the effects of line joins and
  23921.                                    line ends, according to the current
  23922.                                    values of these attributes.
  23923.  
  23924.  hddc  Identifies the device driver's device context.
  23925.  
  23926.  ulFunN  Specifies the function number and a mask of various flags. The low
  23927.  word contains the function number; the high word contains a mask of flags,
  23928.  which may be set by the graphics programming interface (GPI), the engine, or
  23929.  a driver. For a description of these flags, see Section 7.1.1.
  23930.  
  23931.  
  23932.  Return Value
  23933.  
  23934.  The return value is TRUE if the function is successful or FALSE if an error
  23935.  occurs.
  23936.  
  23937.  
  23938.  Errors
  23939.  
  23940.  If an error occurs during the execution of this function, the graphics
  23941.  engine or the device driver calls the WinSetErrorInfo function and records
  23942.  the associated error code. The following list contains possible error codes
  23943.  that the engine or the device driver calls record:
  23944.  
  23945.       PMERR_BASE_ERROR
  23946.       PMERR_BITMAP_NOT_SELECTED
  23947.       PMERR_COORDINATE_OVERFLOW
  23948.       PMERR_DEV_FUNC_NOT_INSTALLED
  23949.       PMERR_HDC_BUSY
  23950.       PMERR_HRGN_BUSY
  23951.       PMERR_INSUFFICIENT_MEMORY
  23952.       PMERR_INV_COLOR_DATA
  23953.       PMERR_INV_COLOR_INDEX
  23954.       PMERR_INV_COORD_SPACE
  23955.       PMERR_INV_COORDINATE
  23956.       PMERR_INV_FILL_PATH_OPTIONS
  23957.       PMERR_INV_HDC
  23958.       PMERR_INV_HRGN
  23959.  
  23960.       PMERR_INV_IN_AREA
  23961.       PMERR_INV_IN_PATH
  23962.       PMERR_INV_LENGTH_OR_COUNT
  23963.       PMERR_INV_MATRIX_ELEMENT
  23964.       PMERR_INV_MODIFY_PATH_MODE
  23965.       PMERR_INV_PATH_ID
  23966.       PMERR_INV_PATTERN_REF_PT_ATTR
  23967.       PMERR_INV_PICK_APERTURE_POSN
  23968.       PMERR_INV_RECT
  23969.       PMERR_INV_REGION_CONTROL
  23970.       PMERR_INV_TRANSFORM_TYPE
  23971.       PMERR_PATH_LIMIT_EXCEEDED
  23972.       PMERR_PATH_UNKNOWN
  23973.       PMERR_REGION_IS_CLIP_REGION
  23974.  
  23975.  
  23976.  
  23977.  
  23978.  
  23979.  Comments
  23980.  
  23981.  A line may be joined to, for example, an arc. The common point is handled
  23982.  according to the line-join parameter, rather than applying a line end at
  23983.  each end.
  23984.  
  23985.  If a figure has been closed by using the GpiCloseFigure function, the
  23986.  joining rules are followed rather than the ending rules, at the
  23987.  starting/ending points.
  23988.  
  23989.  The path bracket keeps track of "crossings," so that a stroked figure─for
  23990.  example, the letter X─does not have a hole in its middle if drawn in XOR
  23991.  mode.
  23992.  
  23993.  A single path cannot contain more than 64K of data.
  23994.  
  23995.  
  23996.  █    MultiplyXforms
  23997.  ────────────────────────────────────────────────────────────────────────────
  23998.  
  23999.  BOOL MultiplyXforms  (hdc, pxform1, pxform2, ulMode, hddc, ulFunN)
  24000.  
  24001.  HDC  hdc;                         /*handle of engine's device context */
  24002.  
  24003.  PXFORM  pxform1;                  /*pointer to first XFORM structure */
  24004.  
  24005.  PXFORM  pxform2;                  /*pointer to second XFORM structure */
  24006.  
  24007.  ULONG  ulMode;                    /*multiplication options */
  24008.  
  24009.  ULONG  hddc;                      /*handle of device driver's device
  24010.                                    context */
  24011.  
  24012.  ULONG  ulFunN;                    /*flags and function number */
  24013.  
  24014.  
  24015.  The MultiplyXforms function multiplies the transformation matrix pointed to
  24016.  by the pxform1 parameter with the matrix made specified by the ulMode
  24017.  parameter and stores the result in pxform2.
  24018.  
  24019.  
  24020.  Parameters
  24021.  
  24022.  hdc  Identifies the engine's device context.
  24023.  
  24024.  pxform1  Points to the XFORM structure that contains the transformation to
  24025.  multiply. The structure has the following form:
  24026.  
  24027.  typedef struct _XFORM { /* xform */
  24028.      FIXED fxM11;
  24029.      FIXED fxM12;
  24030.      FIXED fxM21;
  24031.      FIXED fxM22;
  24032.      LONG  lM41;
  24033.      LONG  lM42;
  24034.  } XFORM;
  24035.  
  24036.  
  24037.  pxform2  Points to the XFORM structure that contains a transformation to
  24038.  multiply and that receives the result of the multiplication. The structure
  24039.  has the same form as the structure pointed to by pxform1.
  24040.  
  24041.  ulMode  Specifies how the supplied array should be used to set the matrix.
  24042.  It can be one of the following values:
  24043.  
  24044.  Value                             Meaning
  24045.  ────────────────────────────────────────────────────────────────────────────
  24046.  
  24047.  0                                 Set pxform2 to the identity matrix
  24048.                                    (SX_UNITY).
  24049.  
  24050.  1                                 Multiply pxform1 by pxform2
  24051.                                    (SX_CAT_AFTER).
  24052.  
  24053.  2                                 Multiply pxform2 by pxform1
  24054.                                    (SX_CAT_BEFORE).
  24055.  
  24056.  3                                 Replace pxform2 with pxform1
  24057.                                    (SX_OVERWRITE).
  24058.  
  24059.  hddc  Identifies the device driver's device context.
  24060.  
  24061.  ulFunN  Specifies the function number and a mask of various flags. The low
  24062.  word contains the function number; the high word contains a mask of flags,
  24063.  which may be set by the graphics programming interface (GPI), the engine, or
  24064.  a driver. For a description of these flags, see Section 7.1.1.
  24065.  
  24066.  
  24067.  Return Value
  24068.  
  24069.  The return value is TRUE if the function is successful or FALSE if an error
  24070.  occurs.
  24071.  
  24072.  
  24073.  Errors
  24074.  
  24075.  If an error occurs during the execution of this function, the graphics
  24076.  engine or the device driver calls the WinSetErrorInfo function and records
  24077.  the associated error code. The following list contains possible error codes
  24078.  that the engine or the device driver calls record:
  24079.  
  24080.       PMERR_INV_MATRIX_ELEMENT
  24081.       PMERR_INV_TRANSFORM_TYPE
  24082.  
  24083.  
  24084.  
  24085.  
  24086.  
  24087.  Comments
  24088.  
  24089.  If the function is used to perform a series of matrix multiplications on the
  24090.  same matrix, there will be a loss of accuracy, since higher extra precision
  24091.  is not retained across calls.
  24092.  
  24093.  
  24094.  █    NotifyClipChange
  24095.  ────────────────────────────────────────────────────────────────────────────
  24096.  
  24097.  ULONG NotifyClipChange  (hdc, pRect, Complexity, ClipPathId, hddc, ulFunN)
  24098.  
  24099.  HDC  hdc;                         /*handle of engine's device context */
  24100.  
  24101.  PRECTL  prcl;                     /*pointer to RECTL structure */
  24102.  
  24103.  LONG  Complexity;                 /*clip area complexity */
  24104.  
  24105.  ULONG  ClipPathId;                /*clip path identifier */
  24106.  
  24107.  ULONG  hddc;                      /*handle of device driver's device
  24108.                                    context */
  24109.  
  24110.  ULONG  ulFunN;                    /*flags and function number */
  24111.  
  24112.  
  24113.  The NotifyClipChange function is called whenever the clip region that
  24114.  intersects with the visible region is changed. This function is not required
  24115.  and can be handled completely with a far return (retf) call if the device
  24116.  driver is not interested in each clip-region change.
  24117.  
  24118.  The coordinates of the rectangle are screen coordinates.
  24119.  
  24120.  The device driver must redispatch the NotifyClipChange call back to the
  24121.  engine after processing it. This enables the engine to make certain
  24122.  optimizations relating to clipping.
  24123.  
  24124.  
  24125.  Parameters
  24126.  
  24127.  hdc  Identifies the engine's device context.
  24128.  
  24129.  prcl  Points to a RECTL structure that specifies the rectangle that bounds
  24130.  the new region. If the region is a single rectangle, this will be the same
  24131.  rectangle. The structure has the following form:
  24132.  
  24133.  typedef struct _RECTL {    /* rcl */
  24134.      LONG xLeft;
  24135.      LONG yBottom;
  24136.      LONG xRight;
  24137.      LONG yTop;
  24138.  } RECTL;
  24139.  
  24140.  
  24141.  Complexity  Specifies the number of rectangles in the new clip region (that
  24142.  is, the number of rectangles returned by the GetClipRects function).
  24143.  
  24144.  ClipPathId  Specifies the current clip path identifier. If this parameter is
  24145.  zero, no clip path is defined.
  24146.  
  24147.  hddc  Identifies the device driver's device context.
  24148.  
  24149.  ulFunN  Specifies the function number and a mask of various flags. The low
  24150.  word contains the function number; the high word contains a mask of flags,
  24151.  which may be set by the graphics programming interface (GPI), the engine, or
  24152.  a driver. For a description of these flags, see Section 7.1.1.
  24153.  
  24154.  
  24155.  Return Value
  24156.  
  24157.  The return value is TRUE if the function is successful or FALSE if an error
  24158.  occurs.
  24159.  
  24160.  
  24161.  Errors
  24162.  
  24163.  If an error occurs during the execution of this function, the device driver
  24164.  calls the WinSetErrorInfo function and records the associated error code.
  24165.  The following list contains possible error codes that the device driver may
  24166.  record:
  24167.  
  24168.       PMERR_DEV_FUNC_NOT_INSTALLED
  24169.       PMERR_HDC_BUSY
  24170.       PMERR_INV_COORDINATE
  24171.       PMERR_INV_HDC
  24172.       PMERR_INV_RECT
  24173.       PMERR_INV_REGION_CONTROL
  24174.  
  24175.  
  24176.  
  24177.  
  24178.  
  24179.  █    NotifyTransformChange
  24180.  ────────────────────────────────────────────────────────────────────────────
  24181.  
  24182.  BOOL NotifyTransformChange  (hdc, flCmd, pntd, hddc, ulFunN)
  24183.  
  24184.  HDC  hdc;                         /*handle of engine's device context */
  24185.  
  24186.  ULONG  flCmd;                     /*options */
  24187.  
  24188.  PNOTIFYTRANSFORMDATA  pntd;       /*pointer to NOTIFYTRANSFORMDATA
  24189.                                    structure */
  24190.  
  24191.  ULONG  hddc;                      /*handle of device driver's device
  24192.                                    context */
  24193.  
  24194.  ULONG  ulFunN;                    /*flags and function number */
  24195.  
  24196.  
  24197.  The NotifyTransformChange function is called whenever the transformation
  24198.  from world to device coordinates changes. This call provides enough
  24199.  information to the device so that the device can optimize the transformation
  24200.  operation, or possibly even do all point transformations itself.
  24201.  
  24202.  The driver must redispatch the NotifyTransformChange call back to the engine
  24203.  after processing it. This enables the engine to make certain optimizations
  24204.  relating to transforms.
  24205.  
  24206.  
  24207.  Parameters
  24208.  
  24209.  hdc  Identifies the engine's device context.
  24210.  
  24211.  flCmd  Specifies information about the complexity of the matrix made of the
  24212.  components of the composite transformation from world to device coordinates.
  24213.  This parameter also specifies if there is a translation. The parameter can
  24214.  be a combination the following values:
  24215.  
  24216.  Value                             Meaning
  24217.  ────────────────────────────────────────────────────────────────────────────
  24218.  
  24219.  MATRIX_SIMPLE                     Two entries are zero (0x00000001).
  24220.  
  24221.  MATRIX_UNITS                      All entries are +1 or -1 (0x00000002).
  24222.  
  24223.  MATRIX_XY_EXCHANGE                Zeros are on the diagonal (0x00000004).
  24224.  
  24225.  MATRIX_X_NEGATE                   X is hit by negative (0x00000008).
  24226.  
  24227.  MATRIX_Y_NEGATE                   Y is hit by negative (0x00000010).
  24228.  
  24229.  MATRIX_TRANSLATION                Nonzero translation (0x00000020).
  24230.  
  24231.  pntd  Points to the NOTIFYTRANSFORMDATA structure. The structure has the
  24232.  following form:
  24233.  
  24234.  typedef struct _NOTIFYTRANSFORMDATA { /* ntd */
  24235.      USHORT usType;
  24236.      XFORM  xform;
  24237.  } NOTIFYTRANSFORMDATA;
  24238.  
  24239.  
  24240.  
  24241.  
  24242.  
  24243.  Return Value
  24244.  
  24245.  The return value is TRUE if the function is successful or FALSE if an error
  24246.  occurs.
  24247.  
  24248.  
  24249.  Errors
  24250.  
  24251.  If an error occurs during the execution of this function, the device driver
  24252.  calls the WinSetErrorInfo function and records the associated error code.
  24253.  The following list contains possible error codes that the device driver may
  24254.  record:
  24255.  
  24256.       PMERR_BASE_ERROR
  24257.       PMERR_COORDINATE_OVERFLOW
  24258.       PMERR_DEV_FUNC_NOT_INSTALLED
  24259.       PMERR_HDC_BUSY
  24260.       PMERR_INV_COORD_SPACE
  24261.       PMERR_INV_HDC
  24262.       PMERR_INV_IN_AREA
  24263.       PMERR_INV_IN_PATH
  24264.       PMERR_INV_LENGTH_OR_COUNT
  24265.       PMERR_INV_PATTERN_REF_PT_ATTR
  24266.       PMERR_INV_PICK_APERTURE_POSN
  24267.       PMERR_PATH_LIMIT_EXCEEDED
  24268.  
  24269.  
  24270.  
  24271.  
  24272.  
  24273.  Example
  24274.  
  24275.  If the NOTIFYTRANSFORMDATA structure contains {1.0,0.0,0.0,1.0,0,0}, the
  24276.  flCmd parameter is 0x00000003.
  24277.  
  24278.  If the NOTIFYTRANSFORMDATA structure contains {1.0,0.0,0.0,1.0,5,10}, the
  24279.  flCmd parameter is 0x00000023.
  24280.  
  24281.  If the NOTIFYTRANSFORMDATA structure contains {0.0,-1.0,1.0,0.0,17,-5}, the
  24282.  flCmd parameter is 0x00000037.
  24283.  
  24284.  
  24285.  █    OffsetClipRegion
  24286.  ────────────────────────────────────────────────────────────────────────────
  24287.  
  24288.  int OffsetClipRegion  (hdc, pptl, hddc, ulFunN)
  24289.  
  24290.  HDC  hdc;                         /*handle of engine's device context */
  24291.  
  24292.  PPOINTL  pptl;                    /*pointer to POINTL structure */
  24293.  
  24294.  ULONG  hddc;                      /*handle of device driver's device
  24295.                                    context */
  24296.  
  24297.  ULONG  ulFunN;                    /*flags and function number */
  24298.  
  24299.  
  24300.  The OffsetClipRegion function moves the clipping region by the specified
  24301.  offsets.
  24302.  
  24303.  
  24304.  Parameters
  24305.  
  24306.  hdc  Identifies the engine's device context.
  24307.  
  24308.  pptl  Points to a POINTL structure that contains the x- and y-offset the
  24309.  region is to be moved in world coordinates.
  24310.  
  24311.  hddc  Identifies the device driver's device context.
  24312.  
  24313.  ulFunN  Specifies the function number and a mask of various flags. The low
  24314.  word contains the function number; the high word contains a mask of flags,
  24315.  which may be set by the graphics programming interface (GPI), the engine, or
  24316.  a driver. For a description of these flags, see Section 7.1.1.
  24317.  
  24318.  
  24319.  Return Value
  24320.  
  24321.  The return value is RGN_NULL, RGN_RECT, or RGN_COMPLEX if the function is
  24322.  successful. The return value is RGN_ERROR if an error occurs.
  24323.  
  24324.  
  24325.  Errors
  24326.  
  24327.  If an error occurs during the execution of this function, the graphics
  24328.  engine or the device driver calls the WinSetErrorInfo function and records
  24329.  the associated error code. The following list contains possible error codes
  24330.  that the engine or the device driver calls record:
  24331.  
  24332.       PMERR_COORDINATE_OVERFLOW
  24333.       PMERR_DEV_FUNC_NOT_INSTALLED
  24334.       PMERR_HDC_BUSY
  24335.       PMERR_INSUFFICIENT_MEMORY
  24336.       PMERR_INV_COORD_OFFSET
  24337.       PMERR_INV_COORD_SPACE
  24338.       PMERR_INV_COORDINATE
  24339.       PMERR_INV_HDC
  24340.       PMERR_INV_HRGN
  24341.       PMERR_INV_IN_AREA
  24342.       PMERR_INV_IN_PATH
  24343.       PMERR_INV_LENGTH_OR_COUNT
  24344.       PMERR_INV_RECT
  24345.       PMERR_INV_REGION_CONTROL
  24346.  
  24347.  
  24348.  
  24349.  
  24350.  
  24351.  █    OffsetRegion
  24352.  ────────────────────────────────────────────────────────────────────────────
  24353.  
  24354.  BOOL OffsetRegion  (hdc, hrgn, pptl, hddc, ulFunN)
  24355.  
  24356.  HDC  hdc;                         /*handle of engine's device context */
  24357.  
  24358.  HRGN  hrgn;                       /*handle of region to offset */
  24359.  
  24360.  PPOINTL  pptl;                    /*pointer to POINTL structure */
  24361.  
  24362.  ULONG  hddc;                      /*handle of device driver's device
  24363.                                    context */
  24364.  
  24365.  ULONG  ulFunN;                    /*flags and function number */
  24366.  
  24367.  
  24368.  The OffsetRegion function moves the given region by the specified offsets
  24369.  unless the region is being used as a clipping region.
  24370.  
  24371.  
  24372.  Parameters
  24373.  
  24374.  hdc  Identifies the engine's device context.
  24375.  
  24376.  hrgn  Identifies the region to move.
  24377.  
  24378.  pptl  Points to the POINTL structure that contains the x- and y-offset the
  24379.  region is to be moved in device coordinates.
  24380.  
  24381.  hddc  Identifies the device driver's device context.
  24382.  
  24383.  ulFunN  Specifies the function number and a mask of various flags. The low
  24384.  word contains the function number; the high word contains a mask of flags,
  24385.  which may be set by the graphics programming interface (GPI), the engine, or
  24386.  a driver. For a description of these flags, see Section 7.1.1.
  24387.  
  24388.  
  24389.  Return Value
  24390.  
  24391.  The return value is TRUE if the function is successful or FALSE if an error
  24392.  occurs.
  24393.  
  24394.  
  24395.  Errors
  24396.  
  24397.  If an error occurs during the execution of this function, the graphics
  24398.  engine or the device driver calls the WinSetErrorInfo function and records
  24399.  the associated error code. The following list contains possible error codes
  24400.  that the engine or the device driver calls record:
  24401.  
  24402.       PMERR_COORDINATE_OVERFLOW
  24403.       PMERR_HRGN_BUSY
  24404.       PMERR_INV_COORDINATE
  24405.       PMERR_INV_HRGN
  24406.       PMERR_REGION_IS_CLIP_REGION
  24407.  
  24408.  
  24409.  
  24410.  
  24411.  
  24412.  █    OpenDC
  24413.  ────────────────────────────────────────────────────────────────────────────
  24414.  
  24415.  HDC OpenDC  (hdc, ulType, pszToken, lCount, pdop, hddc, ulFunN)
  24416.  
  24417.  HDC  hdc;                         /*handle of engine's device context */
  24418.  
  24419.  ULONG  ulType;                    /*type of device context */
  24420.  
  24421.  PSZ  pszToken;                    /*pointer to string for token */
  24422.  
  24423.  LONG  ulCount;                    /*count of fields in structure */
  24424.  
  24425.  PDEVOPENDATA  pdop;               /*pointer to DEVOPENSTRUC structure */
  24426.  
  24427.  ULONG  hddc;                      /*handle of device driver's device
  24428.                                    context */
  24429.  
  24430.  ULONG  ulFunN;                    /*flags and function number */
  24431.  
  24432.  
  24433.  The OpenDC function creates an output device context of a specified type.
  24434.  
  24435.  The data passed depends upon the type of device context being created. It
  24436.  provides information such as the driver name and may also provide data with
  24437.  which the device context is to be initialized.
  24438.  
  24439.  The device context inherits the process code pages of the process that
  24440.  created them at the time they were created. Subsequent calls to the DosSetCp
  24441.  function will not change the code page of a previously created device
  24442.  context. Default (shield layer) Vio and Kbd code pages will always be the
  24443.  last code pages set by any process of the application. Calls to DosSetCp by
  24444.  any application process will change the default Vio and Kbd code pages.
  24445.  
  24446.  
  24447.  Parameters
  24448.  
  24449.  hdc  Identifies the engine's device context.
  24450.  
  24451.  ulType  Specifies the type of device context to create. This parameter can
  24452.  be one of the following:
  24453.  
  24454.  Value                             Meaning
  24455.  ────────────────────────────────────────────────────────────────────────────
  24456.  
  24457.  OD_QUEUED                         Specifies a device, such as a printer or
  24458.                                    plotter, for which output is queued by
  24459.                                    the spooler.
  24460.  
  24461.  OD_DIRECT                         Specifies a device, such as a printer or
  24462.                                    plotter. Output is not queued by the
  24463.                                    spooler.
  24464.  
  24465.  OD_INFO                           Specifies a device, like OD_DIRECT, but
  24466.                                    one that is used to retrieve information
  24467.                                    (for example, font metrics). Drawing can
  24468.                                    be performed to a presentation space
  24469.                                    associated with such a device context,
  24470.                                    but no output medium is updated.
  24471.  
  24472.  OD_MEMORY                         Specifies a device context that is used
  24473.                                    to contain a bitmap.
  24474.  
  24475.  pszToken  Points to a string that identifies device information, held in the
  24476.  os2.ini file. This information is the same as that which may be pointed to
  24477.  by pdop; any information obtained in this way overrides whatever is obtained
  24478.  by using pszToken. If the token is specified as "*", no device information
  24479.  is taken from os2.ini.
  24480.  
  24481.  lCount  Specifies the number of fields supplied in the DEVOPENSTRUC
  24482.  structure. This number may be shorter than the full list if omitted items
  24483.  are irrelevant or supplied from pszToken.
  24484.  
  24485.  pdop  Points to a data area that describes the output device. This area can
  24486.  be either an array of pointers or a DEVOPENSTRUC structure. The DEVOPENSTRUC
  24487.  structure has the following form:
  24488.  
  24489.  typedef struct _DEVOPENSTRUC {
  24490.      PSZ       pszLogAddress;
  24491.      PSZ       pszDriverName;
  24492.      PDRIVDATA pdriv;
  24493.      PSZ       pszDataType;
  24494.      PSZ       pszComment;
  24495.      PSZ       pszQueueProcName;
  24496.      PSZ       pszQueueProcParams;
  24497.      PSZ       pszSpoolerParams;
  24498.      PSZ       pszNetworkParams;
  24499.  } DEVOPENSTRUC;
  24500.  
  24501.  
  24502.   hddc  Identifies the device driver's device context.
  24503.  
  24504.  ulFunN  Specifies the function number and a mask of various flags. The low
  24505.  word contains the function number; the high word contains a mask of flags,
  24506.  which may be set by the graphics programming interface (GPI), the engine, or
  24507.  a driver. For a description of these flags, see Section 7.1.1.
  24508.  
  24509.  
  24510.  Return Value
  24511.  
  24512.  The return value is a device-context handle if the function is successful;
  24513.  otherwise, it is zero.
  24514.  
  24515.  
  24516.  Errors
  24517.  
  24518.  If an error occurs during the execution of this function, the graphics
  24519.  engine calls the WinSetErrorInfo function and records the associated error
  24520.  code. The following list contains possible error codes that the engine may
  24521.  record:
  24522.  
  24523.       PMERR_BASE_ERROR
  24524.       PMERR_BITMAP_IS_SELECTED
  24525.       PMERR_COORDINATE_OVERFLOW
  24526.       PMERR_DEV_FUNC_NOT_INSTALLED
  24527.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  24528.       PMERR_HBITMAP_BUSY
  24529.       PMERR_HDC_BUSY
  24530.       PMERR_HUGE_FONTS_NOT_SUPPORTED
  24531.       PMERR_INSUFFICIENT_MEMORY
  24532.       PMERR_INV_BACKGROUND_COL_ATTR
  24533.       PMERR_INV_BACKGROUND_MIX_ATTR
  24534.       PMERR_INV_BITMAP_DIMENSION
  24535.       PMERR_INV_CHAR_DIRECTION_ATTR
  24536.       PMERR_INV_CHAR_MODE_ATTR
  24537.  
  24538.       PMERR_INV_CODEPAGE
  24539.       PMERR_INV_COLOR_ATTR
  24540.       PMERR_INV_COORD_SPACE
  24541.       PMERR_INV_COORDINATE
  24542.       PMERR_INV_DC_DATA
  24543.       PMERR_INV_DC_TYPE
  24544.       PMERR_INV_DRIVER_NAME
  24545.       PMERR_INV_HBITMAP
  24546.       PMERR_INV_HDC
  24547.       PMERR_INV_HRGN
  24548.       PMERR_INV_ID
  24549.       PMERR_INV_IN_AREA
  24550.       PMERR_INV_IN_PATH
  24551.       PMERR_INV_INFO_TABLE
  24552.       PMERR_INV_LENGTH_OR_COUNT
  24553.       PMERR_INV_LINE_TYPE_ATTR
  24554.       PMERR_INV_MIX_ATTR
  24555.       PMERR_INV_PATTERN_REF_PT_ATTR
  24556.       PMERR_INV_PATTERN_SET_ATTR
  24557.       PMERR_INV_PATTERN_SET_FONT
  24558.       PMERR_INV_RECT
  24559.       PMERR_INV_REGION_CONTROL
  24560.       PMERR_INV_SCAN_START
  24561.  
  24562.  
  24563.  
  24564.  
  24565.  
  24566.  █    OpenJournalFile
  24567.  ────────────────────────────────────────────────────────────────────────────
  24568.  
  24569.  ULONG OpenJournalFile  (hdc, pszFileName, lOption, cbBufSize, hddc, ulFunN)
  24570.  
  24571.  HDC  hdc;                         /*handle of engine's device context */
  24572.  
  24573.  PSZ  pszFileName;                 /*pointer to journal file name */
  24574.  
  24575.  ULONG  lOption;                   /*options */
  24576.  
  24577.  LONG  cbBufSize;                  /*size of buffer */
  24578.  
  24579.  ULONG  hddc;                      /*handle of device driver's device
  24580.                                    context */
  24581.  
  24582.  ULONG  ulFunN;                    /*flags and function number */
  24583.  
  24584.  
  24585.  The OpenJournalFile function opens for play a journal file that has been
  24586.  created by the CreateJournalFile function and written to by the
  24587.  AccumulateJournalFile function.
  24588.  
  24589.  
  24590.  Parameters
  24591.  
  24592.  hdc  Identifies the engine's device context.
  24593.  
  24594.  pszFileName  Points to a null-terminated string that specifies the name of
  24595.  the journal file to open, or, it points to a buffer in memory.
  24596.  
  24597.  lOption  Specifies the options for opening the file. This parameter can be
  24598.  one of the following constants:
  24599.  
  24600.  Value                             Meaning
  24601.  ────────────────────────────────────────────────────────────────────────────
  24602.  
  24603.  JNL_PERM_FILE                     Open a disk file with the given name.
  24604.                                    The file must have been created using
  24605.                                    the JNL_PERM_FILE option of the
  24606.                                    CreateJournalFile function.
  24607.  
  24608.  JNL_USERRAM_FILE                  Open a shared memory file at which
  24609.                                    pszFileName points. This file must be
  24610.                                    filled with complete journal records.
  24611.  
  24612.   cbBufSize  Specifies the size in bytes of the buffer.
  24613.  
  24614.  hddc  Identifies the device driver's device context.
  24615.  
  24616.  ulFunN  Specifies the function number and a mask of various flags. The low
  24617.  word contains the function number; the high word contains a mask of flags,
  24618.  which may be set by the graphics programming interface (GPI), the engine, or
  24619.  a driver. For a description of these flags, see Section 7.1.1.
  24620.  
  24621.  
  24622.  Return Value
  24623.  
  24624.  The return value is the journal-file handle if it is successful; otherwise,
  24625.  it is zero.
  24626.  
  24627.  
  24628.  Errors
  24629.  
  24630.  If an error occurs during the execution of this function, the graphics
  24631.  engine calls the WinSetErrorInfo function and records the associated error
  24632.  code. The following list contains possible error codes that the engine may
  24633.  record:
  24634.  
  24635.       PMERR_BASE_ERROR
  24636.       PMERR_INSUFFICIENT_MEMORY
  24637.       PMERR_INV_IN_AREA
  24638.       PMERR_INV_IN_PATH
  24639.       PMERR_INV_JOURNAL_OPTION
  24640.       PMERR_RAM_JNL_FILE_TOO_SMALL
  24641.  
  24642.  
  24643.  
  24644.  
  24645.  
  24646.  █    OS2_PM_DRV_DEVICENAMES
  24647.  ────────────────────────────────────────────────────────────────────────────
  24648.  
  24649.  LONG OS2_PM_DRV_DEVICENAMES  (pszDriverName, pcMaxNames, achDevName,
  24650.  achDevDescriptions,                                     pcMaxDataType,
  24651.  achDataType, hddc, ulFunN) .V "PSZ " "pszDriverName;" "pointer to string for
  24652.  device name
  24653.  
  24654.  PLONG  pcMaxNames;                /*maximum number of device drivers */
  24655.  
  24656.  PSTR32  achDevName;               /*pointer to array of device names */
  24657.  
  24658.  PSTR64  achDevDescriptions;       /*pointer to array of device
  24659.                                    descriptions */
  24660.  
  24661.  PLONG  pcMaxDataType;             /*pointer to maximum number of data
  24662.                                    types */
  24663.  
  24664.  PSTR16  achDataType;              /*pointer to array of data types */
  24665.  
  24666.  ULONG  hddc;                      /*handle of device driver's device
  24667.                                    context */
  24668.  
  24669.  ULONG  ulFunN;                    /*flags and function number */
  24670.  
  24671.  
  24672.  The OS2_PM_DRV_DEVICENAMES function retrieves the names and descriptions of
  24673.  devices and data types that the specified device driver supports.
  24674.  
  24675.  
  24676.  Parameters
  24677.  
  24678.  pszDriverName  Points to the null-terminated string that contains the full
  24679.  pathname for the device driver.
  24680.  
  24681.  pcMaxNames  Points to a variable containing the maximum number of device
  24682.  names and descriptions that this function should retrieve. If this parameter
  24683.  is zero, the function should retrieve the number of device names that this
  24684.  driver supports. (This means that the function will not update the
  24685.  achDevName and achDevDescriptions parameters.) If this parameter is nonzero,
  24686.  the function should update achDevName and achDevDescriptions with the
  24687.  appropriate names and descriptions of supported devices.
  24688.  
  24689.  achDevName  Points to an array of null-terminated strings, each element of
  24690.  which identifies a particular device (for example, model number). Valid
  24691.  names are defined by device drivers. "IBM4201" is an example of a device
  24692.  name.
  24693.  
  24694.  achDevDescriptions  Points to an array of null-terminated strings, each
  24695.  element of which is a description of a particular device (for example, model
  24696.  name). Valid names are defined by device drivers. "IBM 4201 Proprinter" is
  24697.  an example of a device description.
  24698.  
  24699.  pcMaxDataType  Points to a variable containing the maximum number of data
  24700.  types that can be retrieved. If this parameter is zero, the function should
  24701.  retrieve the number of data types that this driver supports. (This means
  24702.  that the function will not update the achDataType parameter.) If this
  24703.  parameter is nonzero, the function should update achDataType with valid data
  24704.  types for this driver.
  24705.  
  24706.  achDataType  Points to an array of null-terminated strings, each element of
  24707.  which identifies a data type. Valid data types are defined by device
  24708.  drivers. "PM_Q_STD" is an example of a data type.
  24709.  
  24710.  hddc  Identifies the device driver's device context. This argument is
  24711.  ignored by this function.
  24712.  
  24713.  ulFunN  Specifies the function number and a mask of various flags. The low
  24714.  word contains the function number; the high word contains a mask of flags,
  24715.  which may be set by the graphics programming interface (GPI), the engine, or
  24716.  a driver. For a description of these flags, see Section 7.1.1.
  24717.  
  24718.  
  24719.  Return Value
  24720.  
  24721.  The return value is 1 if the function is successful or zero if an error
  24722.  occurs.
  24723.  
  24724.  
  24725.  Comments
  24726.  
  24727.  A device driver must export this function in its module definition file.
  24728.  
  24729.  This function corresponds to the API function DevQueryDeviceNames.
  24730.  
  24731.  
  24732.  █    OS2_PM_DRV_DEVMODE
  24733.  ────────────────────────────────────────────────────────────────────────────
  24734.  
  24735.  LONG OS2_PM_DRV_DEVMODE  (pbDriverData, pszDriverName, achDeviceName,
  24736.  pszLogAddr, ulOptions)
  24737.  
  24738.  PDRIVDATA  pbDriverData;          /*pointer to buffer for data */
  24739.  
  24740.  PSZ  pszDriverName;               /*pointer to string for driver name */
  24741.  
  24742.  PSZ  achDeviceName;               /*pointer to device name */
  24743.  
  24744.  PSZ  pszPrinterName;              /*pointer to string for name of output
  24745.                                    device */
  24746.  
  24747.  ULONG  ulOptions;                 /*options flag */
  24748.  
  24749.  
  24750.  The OS2_PM_DRV_DEVMODE function serves four purposes, depending on the value
  24751.  specified by pbDriverData and ulOptions. The function will do one of the
  24752.  following: retrieve the size of the driver data buffer, display a dialog box
  24753.  that allows a user to change job properties, display two dialog boxes (one
  24754.  of which allows the user to change job properties and the other of which
  24755.  allows the user to change printer properties), or return the current job
  24756.  properties.
  24757.  
  24758.  
  24759.  Parameters
  24760.  
  24761.  pbDriverData  Points to a buffer that receives data defined by the driver.
  24762.  If this parameter is NULL, the function should return the required size of
  24763.  the buffer in bytes.
  24764.  
  24765.  pszDriverName  Points to the null-terminated string that contains the name
  24766.  of the device driver.
  24767.  
  24768.  achDeviceName  Points to the null-terminated string that identifies the
  24769.  particular device (for example, its model number). This string must not
  24770.  exceed 32 bytes. Valid names are defined by device drivers.
  24771.  
  24772.  pszPrinterName  Points to the null-terminated string that contains the
  24773.  device name.
  24774.  
  24775.  ulOptions  Specifies whether the function should display a dialog box that
  24776.  allows the user to change job properties, display two dialog boxes that
  24777.  allow the user to change job and printer properties, or simply return the
  24778.  current job properties. This parameter can be one of the following values:
  24779.  
  24780.  
  24781.  Value                             Meaning
  24782.  ────────────────────────────────────────────────────────────────────────────
  24783.  
  24784.  DPDMF_POSTJOBPROP                 Display a dialog box that allows the
  24785.                                    user to change job properties. The
  24786.                                    default values for this dialog box are
  24787.                                    taken from the PM_SPOOLER_DD section of
  24788.                                    the os2.ini file if the pszLogAddr
  24789.                                    parameter specifies a logical address.
  24790.                                    If pszLogAddr is NULL, the default
  24791.                                    values are taken from the pbDriverData
  24792.                                    parameter.
  24793.  
  24794.  DPDMF_CHANGEPROP                  Display two dialog boxes. The first will
  24795.                                    allow the user to change job properties;
  24796.                                    the second will allow the user to change
  24797.                                    printer properties. The default values
  24798.                                    for this dialog box are taken from the
  24799.                                    PM_SPOOLER_DD section of the os2.ini
  24800.                                    file. The function returns the new
  24801.                                    values in the pbDriverData parameter.
  24802.                                    The pszLogAddr parameter cannot be NULL
  24803.                                    when this option is selected.
  24804.  
  24805.  DPDMF_QUERYJOBPROP                Return the current job properties.
  24806.  
  24807.  
  24808.  
  24809.  Return Value
  24810.  
  24811.  If pbDriverData is NULL and the function is successful, it returns the
  24812.  number bytes required by the buffer at which pbDriverData points. If
  24813.  pbDriverData points to a buffer and the function is successful, it returns
  24814.  DEV_OK. If the function fails, the return value is DEV_ERROR.
  24815.  
  24816.  
  24817.  Comments
  24818.  
  24819.  A device driver must export this function in its module definition file.
  24820.  
  24821.  Job properties are characteristics of a print job such as the text quality
  24822.  (draft, near letter, etc.), paper size, and font typeface. Printer
  24823.  properties are settings on a printer, such as the paper-bin number,
  24824.  printer-memory size, and font-cartridge type.
  24825.  
  24826.  
  24827.  █    OS2_PM_DRV_ENABLE
  24828.  ────────────────────────────────────────────────────────────────────────────
  24829.  
  24830.  LONG OS2_PM_DRV_ENABLE  (ulSubfunction, param1, param2)
  24831.  
  24832.  ULONG  ulSubfunction;             /*subfunction name */
  24833.  
  24834.  ULONG  param1;                    /*parameter 1 */
  24835.  
  24836.  ULONG  param2;                    /*parameter 2 */
  24837.  
  24838.  
  24839.  The OS2_PM_DRV_ENABLE function is called to carry out specific tasks related
  24840.  to the device driver, such as filling logical and physical device blocks,
  24841.  enabling device contexts, and installing simulations.
  24842.  
  24843.  
  24844.  Parameters
  24845.  
  24846.  ulSubfunction  Specifies the subfunction to carry out. It can be one of the
  24847.  following:
  24848.  
  24849.  Subfunction                       Code
  24850.  ────────────────────────────────────────────────────────────────────────────
  24851.  
  24852.  FILL_LOGICAL_DEVICE_BLOCK         1
  24853.  
  24854.  FILL_PHYS_DEVICE_BLOCK            2
  24855.  
  24856.  DISABLE_PHYS_DEVICE_BLOCK         4
  24857.  
  24858.  ENABLE_DDC                        5
  24859.  
  24860.  DISABLE_DDC                       6
  24861.  
  24862.  SAVE_DDC_STATE                    7
  24863.  
  24864.  RESTORE_DDC_STATE                 8
  24865.  
  24866.  RESET_DDC_STATE                   9
  24867.  
  24868.  COMPLETE_OPEN_DDC                 10
  24869.  
  24870.  BEGIN_CLOSE_DDC                   11
  24871.  
  24872.  INSTALL_SIMULATION                12
  24873.  
  24874.  Subfunction number 3 is reserved.
  24875.  
  24876.  param1  32 bits of information to be used for the requested subfunction.
  24877.  
  24878.  param2  32 bits of information to be used for the requested subfunction.
  24879.  
  24880.  
  24881.  Return Value
  24882.  
  24883.  The return value depends on the subfunction.
  24884.  
  24885.  
  24886.  Comments
  24887.  
  24888.  A device driver must export this function in its module definition file.
  24889.  
  24890.  The following list describes each subfunction:
  24891.  
  24892.  Function name                     Description
  24893.  ────────────────────────────────────────────────────────────────────────────
  24894.  
  24895.  FILL_LOGICAL_DEVICE_BLOCK         Fills a special array called a driver
  24896.                                    dispatch table with addresses of the
  24897.                                    device driver's graphic functions.
  24898.  
  24899.  FILL_PHYS_DEVICE_BLOCK            Fills a data structure with device
  24900.                                    information, such as the driver name,
  24901.                                    output type, horizontal and vertical
  24902.                                    resolution, color planes, foreground and
  24903.                                    background mix modes, default raster
  24904.                                    font, and the default vector font.
  24905.  
  24906.  DISABLE_PHYS_DEVICE_BLOCK         Disables a device and deallocates the
  24907.                                    memory that the device driver used.
  24908.  
  24909.  ENABLE_DDC                        Reserves memory for, initializes, and
  24910.                                    associates a device's instance data with
  24911.                                    an engine device context.
  24912.  
  24913.  DISABLE_DDC                       Removes the device's instance data that
  24914.                                    was associated with an engine device
  24915.                                    context at the time of the call to the
  24916.                                    ENABLE_DDC subfunction.
  24917.  
  24918.  SAVE_DDC_STATE                    Informs the device driver that it should
  24919.                                    save its device-context information on a
  24920.                                    special stack.
  24921.  
  24922.  RESTORE_DDC_STATE                 Informs the device driver that it should
  24923.                                    restore a device context by using
  24924.                                    information on the special stack.
  24925.  
  24926.  RESET_DDC_STATE                   Informs the device driver that it should
  24927.                                    reset the device context to its initial
  24928.                                    state.
  24929.  
  24930.  COMPLETE_OPEN_DDC                 Informs the device driver that the
  24931.                                    creation of a device context is complete.
  24932.                                    Upon receiving this call, the driver can
  24933.                                    perform operations that require a
  24934.                                    complete driver device context (such as
  24935.                                    creating a journal file).
  24936.  
  24937.  BEGIN_CLOSE_DDC                   Informs the device driver that a device
  24938.                                    context is about to close. Upon
  24939.                                    receiving this call, the driver should
  24940.                                    perform any operations that require a
  24941.                                    complete device context.
  24942.  
  24943.  INSTALL_SIMULATION                Informs an installable simulation that
  24944.                                    it should load the device driver's
  24945.                                    dispatch table with pointers to its
  24946.                                    functions and perform any additional
  24947.                                    necessary initialization.
  24948.  
  24949.  The OS2_PM_DRV_ENABLE function corresponds to the API function DevOpenDC or
  24950.  DevCloseDC. This means that the system calls OS2_PM_DRV_ENABLE each time a
  24951.  Presentation Manager application calls one of these two API functions.
  24952.  
  24953.  
  24954.  █    OS2_PM_DRV_ENABLE (1)
  24955.  ────────────────────────────────────────────────────────────────────────────
  24956.  
  24957.  ULONG OS2_PM_DRV_ENABLE  (FILL_LOGICAL_DEVICE_BLOCK, pKling1, pKling2)
  24958.  
  24959.  PKLING1  pKling1;                 /*pointer to structure */
  24960.  
  24961.  PKLING2  pKling2;                 /*pointer to structure */
  24962.  
  24963.  
  24964.  FILL_LOGICAL_DEVICE_BLOCK is a subfunction of OS2_PM_DRV_ENABLE. This
  24965.  subfunction initializes a device driver's logical device block, which is a
  24966.  data structure that contains device and device driver information.
  24967.  FILL_LOGICAL_DEVICE_BLOCK is the first subfunction that the graphics engine
  24968.  calls when it loads a device driver's module.
  24969.  
  24970.  
  24971.  Parameters
  24972.  
  24973.  pKling1  to a structure that contains the following fields:
  24974.  
  24975.  Field                             Description
  24976.  ────────────────────────────────────────────────────────────────────────────
  24977.  
  24978.  ulVersion                         Specifies the version number of the
  24979.                                    graphics engine. This is a binary-coded
  24980.                                    decimal number.
  24981.  
  24982.  ulTableSize                       Specifies the number of entries in the
  24983.                                    dispatch table. The device driver should
  24984.                                    not replace pointers past the end of the
  24985.                                    table as indicated by this number.
  24986.  
  24987.   pKling2  to a structure that contains the following fields:
  24988.  
  24989.  Field                             Description
  24990.  ────────────────────────────────────────────────────────────────────────────
  24991.  
  24992.  pFlags                            Points to a word of logical device flags.
  24993.                                    The device driver should set bits 0, 1,
  24994.                                    and 2 of these flags. All other flags
  24995.                                    are reserved for system use and must not
  24996.                                    be modified. The bits are defined as
  24997.                                    follows:
  24998.  
  24999.  
  25000.  
  25001.  Value                             Meaning
  25002.  ────────────────────────────────────────────────────────────────────────────
  25003.  
  25004.  0x0001                            Set if each device context for this
  25005.                                    device will require its own physical
  25006.                                    device block. Clear if only one physical
  25007.                                    device block is needed for each physical
  25008.                                    device. It is expected that printer and
  25009.                                    plotter drivers would set this bit, and
  25010.                                    most others would clear it.
  25011.  
  25012.  0x0002                            Set if this device can have only one
  25013.                                    device context open at any time; this is
  25014.                                    a serially reusable device. Clear if an
  25015.                                    arbitrary number of device contexts may
  25016.                                    coexist.
  25017.  
  25018.  0x0004                            Set if the pdriv and pszDriverName
  25019.                                    fields in DEVOPENSTRUC (which was passed
  25020.                                    in a call to the OpenDC function) should
  25021.                                    be ignored. This would be the case if
  25022.                                    the device driver supported only one
  25023.                                    physical device in one configuration─for
  25024.                                    example, the display driver.
  25025.  
  25026.  .LI "pDispatchTable" Points to the dispatch table. Each entry in the table
  25027.  is a 32-bit pointer to a graphics function. This table is already filled
  25028.  with the addresses of the system-default functions when this call is made.
  25029.  The device driver must replace the table entries that correspond to required
  25030.  major functions. For a complete list of these functions, see Section 7.2.
  25031.  The device driver may replace more entries, at its option. This table will
  25032.  then be used to address functions for all physical devices belonging to this
  25033.  logical device.
  25034.  
  25035.  
  25036.  Return Value
  25037.  
  25038.  The return value is TRUE if the subfunction is successful or FALSE if an
  25039.  error occurs.
  25040.  
  25041.  
  25042.  █    OS2_PM_DRV_ENABLE (2)
  25043.  ────────────────────────────────────────────────────────────────────────────
  25044.  
  25045.  ULONG OS2_PM_DRV_ENABLE  (FILL_PHYS_DEVICE_BLOCK, pdop, ulType)
  25046.  
  25047.  PDEVOPENSTRUC  pdop;              /*pointer to DEVOPENSTRUC structure */
  25048.  
  25049.  ULONG  ulType;                    /*type of device context */
  25050.  
  25051.  
  25052.  FILL_PHYS_DEVICE_BLOCK is a subfunction of OS2_PM_DRV_ENABLE. This
  25053.  subfunction initializes a device driver's physical device block. A physical
  25054.  device block is a data structure that contains information such as the
  25055.  device's name, output type, horizontal and vertical resolutions, color
  25056.  planes, foreground and background mix modes, default fonts, and so on.
  25057.  
  25058.  
  25059.  Parameters
  25060.  
  25061.  pdop  to a DEVOPENSTRUC structure. The structure has the following form:
  25062.  
  25063.  typedef struct _DEVOPENSTRUC {
  25064.      PSZ       pszLogAddress;
  25065.      PSZ       pszDriverName;
  25066.      PDRIVDATA pdriv;
  25067.      PSZ       pszDataType;
  25068.      PSZ       pszComment;
  25069.      PSZ       pszQueueProcName;
  25070.      PSZ       pszQueueProcParams;
  25071.      PSZ       pszSpoolerParams;
  25072.      PSZ       pszNetworkParams;
  25073.  } DEVOPENSTRUC;
  25074.  
  25075.  
  25076.  ulType  bit 0 of the pFlags field was set, this argument specifies the type
  25077.  of device context. Otherwise, this argument is zero.
  25078.  
  25079.  
  25080.  Return Value
  25081.  
  25082.  The return value is a handle or a pointer to a physical device block if the
  25083.  subfunction is successful; otherwise, it is -1.
  25084.  
  25085.  
  25086.  Comments
  25087.  
  25088.  The graphics engine may call FILL_PHYS_DEVICE_BLOCK once per physical device
  25089.  or once per device-context allocation, depending on how bit 0 of the pFlags
  25090.  field was set by the FILL_LOGICAL_DEVICE_BLOCK subfunction.
  25091.  
  25092.  The DISABLE_PHYS_DEVICE_BLOCK and ENABLE_DDC subfunctions use the handle or
  25093.  pointer that this subfunction returns.
  25094.  
  25095.  
  25096.  █    OS2_PM_DRV_ENABLE (4)
  25097.  ────────────────────────────────────────────────────────────────────────────
  25098.  
  25099.  ULONG OS2_PM_DRV_ENABLE  (DISABLE_PHYS_DEVICE_BLOCK, hdc, Reserved)
  25100.  
  25101.  HDC  hdc;                         /*handle of engine's device context */
  25102.  
  25103.  TYPE  Reserved;                   /*Reserved */
  25104.  
  25105.  
  25106.  DISABLE_PHYS_DEVICE_BLOCK is a subfunction of OS2_PM_DRV_ENABLE. This
  25107.  subfunction deallocates the memory that a device driver occupied.
  25108.  
  25109.  
  25110.  Parameters
  25111.  
  25112.  hdc  the physical device block handle returned by the FILL_PHYS_DEVICE_BLOCK
  25113.  subfunction.
  25114.  
  25115.  Reserved
  25116.  
  25117.  
  25118.  Return Value
  25119.  
  25120.  The return value is zero if the subfunction is successful; otherwise, it is
  25121.  1.
  25122.  
  25123.  
  25124.  Comments
  25125.  
  25126.  If the device driver is a display driver, DISABLE_PHYS_DEVICE_BLOCK should
  25127.  not deallocate the device driver's memory; instead, it should return zero.
  25128.  
  25129.  
  25130.  
  25131.  █    OS2_PM_DRV_ENABLE (5)
  25132.  ────────────────────────────────────────────────────────────────────────────
  25133.  
  25134.  ULONG OS2_PM_DRV_ENABLE  (ENABLE_DDC, pKling, Reserved)
  25135.  
  25136.  PKLING  pKling;                   /*pointer to structure */
  25137.  
  25138.  TYPE  Reserved;                   /*must be zero */
  25139.  
  25140.  
  25141.  ENABLE_DDC is a subfunction of OS2_PM_DRV_ENABLE. This subfunction reserves
  25142.  memory for, and initializes, a device's instance data.
  25143.  
  25144.  
  25145.  Parameters
  25146.  
  25147.  pKling  to a structure that has the following fields:
  25148.  
  25149.  Field                             Description
  25150.  ────────────────────────────────────────────────────────────────────────────
  25151.  
  25152.  ulStateInfo                       Specifies the handle or pointer returned
  25153.                                    by the FILL_PHYS_DEVICE_BLOCK
  25154.                                    subfunction.
  25155.  
  25156.  ulType                            Specifies the type of device context.
  25157.  
  25158.  hdc                               Identifies the device context.
  25159.  
  25160.  Reserved  a reserved value; must be zero.
  25161.  
  25162.  
  25163.  Return Value
  25164.  
  25165.  The return value is a handle or pointer to the device's instance data if the
  25166.  subfunction is successful; otherwise, it is -1.
  25167.  
  25168.  
  25169.  Comments
  25170.  
  25171.  A device's instance data is device driver data such as the current transform
  25172.  matrix, the current attribute bundles, the current color table, and the
  25173.  current arc parameters.
  25174.  
  25175.  The handle or pointer that this subfunction returns is sometimes called the
  25176.  device's "magic number."
  25177.  
  25178.  
  25179.  █    OS2_PM_DRV_ENABLE (6)
  25180.  ────────────────────────────────────────────────────────────────────────────
  25181.  
  25182.  ULONG OS2_PM_DRV_ENABLE  (DISABLE_DDC, hdc, Reserved)
  25183.  
  25184.  HDC  hdc;                         /*handle of engine's device context */
  25185.  
  25186.  TYPE  Reserved;                   /*must be zero */
  25187.  
  25188.  
  25189.  DISABLE_DDC is a subfunction of OS2_PM_DRV_ENABLE. This subfunction informs
  25190.  a device driver that it should release the memory occupied by its device
  25191.  context.
  25192.  
  25193.  
  25194.  Parameters
  25195.  
  25196.  hdc  the handle returned by the ENABLE_DDC subfunction.
  25197.  
  25198.  Reserved  a reserved value; must be zero.
  25199.  
  25200.  
  25201.  Return Value
  25202.  
  25203.  The return value is zero if the subfunction is successful; otherwise, it is
  25204.  -1.
  25205.  
  25206.  
  25207.  █    OS2_PM_DRV_ENABLE (7)
  25208.  ────────────────────────────────────────────────────────────────────────────
  25209.  
  25210.  ULONG OS2_PM_DRV_ENABLE  (SAVE_DDC_STATE, hdc, Reserved)
  25211.  
  25212.  HDC  hdc;                         /*handle of engine's device context */
  25213.  
  25214.  TYPE  Reserved;                   /*must be zero */
  25215.  
  25216.  
  25217.  SAVE_DDC_STATE is a subfunction of OS2_PM_DRV_ENABLE. This subfunction
  25218.  indicates to the device driver that it should save a copy of its device
  25219.  context's instance data on a special stack.
  25220.  
  25221.  
  25222.  Parameters
  25223.  
  25224.  hdc  the handle returned by the ENABLE_DDC subfunction.
  25225.  
  25226.  Reserved  a reserved value; must be zero.
  25227.  
  25228.  
  25229.  Return Value
  25230.  
  25231.  The return value is zero if the function is successful; otherwise, it is -1.
  25232.  
  25233.  
  25234.  
  25235.  Comments
  25236.  
  25237.  SAVE_DDC_STATE should save the instance data using a LIFO (last-in,
  25238.  first-out) format. If memory is not available for saving a device context's
  25239.  instance data, this subfunction should return -1.
  25240.  
  25241.  
  25242.  █    OS2_PM_DRV_ENABLE (8)
  25243.  ────────────────────────────────────────────────────────────────────────────
  25244.  
  25245.  ULONG OS2_PM_DRV_ENABLE  (RESTORE_DDC_STATE, hdc, hddc)
  25246.  
  25247.  HDC  hdc;                         /*handle of engine's device context */
  25248.  
  25249.  ULONG  hddc;                      /*handle of device driver's device
  25250.                                    context */
  25251.  
  25252.  
  25253.  RESTORE_DDC_STATE is a subfunction of OS2_PM_DRV_ENABLE. This subfunction
  25254.  replaces the current device context's instance data with instance data
  25255.  stored on a special stack.
  25256.  
  25257.  
  25258.  Parameters
  25259.  
  25260.  hdc  the handle returned by the ENABLE_DDC subfunction.
  25261.  
  25262.  hddc  which instance data (from the stack) the driver should use to replace
  25263.  the current device context's instance data. If the number is positive, it
  25264.  identifies the data according to the order it was pushed onto the stack;
  25265.  that is, if the number is 1, the first pushed state is restored and all
  25266.  others are lost. If the number is 2, the second pushed state is restored and
  25267.  one remains saved. If the number is negative, it indicates how many states
  25268.  will be popped; that is, if the number is -1, pop back one state. If the
  25269.  number is zero, an error is returned.
  25270.  
  25271.  
  25272.  Return Value
  25273.  
  25274.  The return value is zero if the function is successful; otherwise, it is -1.
  25275.  
  25276.  
  25277.  
  25278.  Comments
  25279.  
  25280.  RESTORE_DDC_STATE returns an error if the hddc parameter specifies a
  25281.  negative value greater than the number of states pushed onto the stack.
  25282.  
  25283.  
  25284.  █    OS2_PM_DRV_ENABLE (9)
  25285.  ────────────────────────────────────────────────────────────────────────────
  25286.  
  25287.  ULONG OS2_PM_DRV_ENABLE  (RESET_DDC_STATE, hddc, Reserved)
  25288.  
  25289.  ULONG  hddc;                      /*handle of device driver's device
  25290.                                    context */
  25291.  
  25292.  TYPE  Reserved;                   /*must be zero */
  25293.  
  25294.  
  25295.  RESET_DDC_STATE is a subfunction of OS2_PM_DRV_ENABLE. This subfunction
  25296.  replaces the current device driver's instance data with the original
  25297.  instance data. The original data is the instance data that the device driver
  25298.  created at the time of the ENABLE_DDC subfunction call.
  25299.  
  25300.  
  25301.  Parameters
  25302.  
  25303.  hddc  the device driver's device context.
  25304.  
  25305.  Reserved  a reserved value; must be zero.
  25306.  
  25307.  
  25308.  Return Value
  25309.  
  25310.  The return value is zero if the function is successful; otherwise, it is -1.
  25311.  
  25312.  
  25313.  
  25314.  Comments
  25315.  
  25316.  The device context pointed to by the hddc parameter is the device context
  25317.  returned by the ENABLE_DDC subfunction or the SetDriverInfo function.
  25318.  
  25319.  RESET_DDC_STATE does not alter the device context's visible region or
  25320.  device-context origin.
  25321.  
  25322.  
  25323.  █    OS2_PM_DRV_ENABLE (10)
  25324.  ────────────────────────────────────────────────────────────────────────────
  25325.  
  25326.  ULONG OS2_PM_DRV_ENABLE  (COMPLETE_OPEN_DDC, hdc, hddc)
  25327.  
  25328.  HDC  hdc;                         /*handle of engine's device context */
  25329.  
  25330.  ULONG  hddc;                      /*handle of device driver's device
  25331.                                    context */
  25332.  
  25333.  
  25334.  COMPLETE_OPEN_DDC is a subfunction of OS2_PM_DRV_ENABLE. It is the last
  25335.  subfunction that the graphics engine calls when it opens a device
  25336.  context. When a device driver receives this call, it can perform final
  25337.  initialization operations such as creating a journal file.
  25338.  
  25339.  
  25340.  Parameters
  25341.  
  25342.  hdc  the engine's device context.
  25343.  
  25344.  hddc  the device driver's device context.
  25345.  
  25346.  
  25347.  Return Value
  25348.  
  25349.  The return value is zero if the subfunction is successful; otherwise, it is
  25350.  -1.
  25351.  
  25352.  
  25353.  Comments
  25354.  
  25355.  COMPLETE_OPEN_DDC is also sent to any installed simulations. (These
  25356.  simulations should ignore the hddc parameter.)
  25357.  
  25358.  
  25359.  █    OS2_PM_DRV_ENABLE (11)
  25360.  ────────────────────────────────────────────────────────────────────────────
  25361.  
  25362.  ULONG OS2_PM_DRV_ENABLE  (BEGIN_CLOSE_DDC, hdc, hddc)
  25363.  
  25364.  HDC  hdc;                         /*handle of engine's device context */
  25365.  
  25366.  ULONG  hddc;                      /*handle of device driver's device
  25367.                                    context */
  25368.  
  25369.  
  25370.  BEGIN_CLOSE_DDC is a subfunction of OS2_PM_DRV_ENABLE. It is the first
  25371.  subfunction that the graphics engine calls during the process of closing a
  25372.  device context. When a device driver receives this call, it should perform
  25373.  necessary operations such as dumping any graphics into a spool file.
  25374.  
  25375.  
  25376.  Parameters
  25377.  
  25378.  hdc  the engine's device context.
  25379.  
  25380.  hddc  the device driver's device context.
  25381.  
  25382.  
  25383.  Return Value
  25384.  
  25385.  The return value is zero if the subfunction is successful; otherwise, it is
  25386.  -1.
  25387.  
  25388.  
  25389.  Comments
  25390.  
  25391.  BEGIN_CLOSE_DDC is also sent to any installed simulations (which should
  25392.  ignore the hddc parameter).
  25393.  
  25394.  
  25395.  █    OS2_PM_DRV_ENABLE (12)
  25396.  ────────────────────────────────────────────────────────────────────────────
  25397.  
  25398.  ULONG OS2_PM_DRV_ENABLE  (INSTALL_SIMULATION, pKling, pTable)
  25399.  
  25400.  PKLING  pKling;                   /*pointer to structure */
  25401.  
  25402.  TYPE  pTable;                     /*pointer to dispatch table */
  25403.  
  25404.  
  25405.  INSTALL_SIMULATION is a subfunction of OS2_PM_DRV_ENABLE. This subfunction
  25406.  informs an installable simulation that it should load the device driver's
  25407.  dispatch table with pointers to its functions and perform any additional
  25408.  necessary initialization.
  25409.  
  25410.  
  25411.  Parameters
  25412.  
  25413.  pKling  to a structure with the following fields:
  25414.  
  25415.  Field                             Description
  25416.  ────────────────────────────────────────────────────────────────────────────
  25417.  
  25418.  ulVersion                         Specifies the version number of the
  25419.                                    graphics engine. This is a binary-coded
  25420.                                    decimal number.
  25421.  
  25422.  pComponent                        Points to the null-terminated string
  25423.                                    that specifies which component to
  25424.                                    install. By using these component names,
  25425.                                    a single file on the disk can contain
  25426.                                    the code for several simulations, such
  25427.                                    as: "REGIONS," "TRANSFORMATIONS," or
  25428.                                    "ARCS." Even if a file contains only one
  25429.                                    simulation component, it should check
  25430.                                    the name for consistency.
  25431.  
  25432.  ulTableSize                       Specifies the number of entries in the
  25433.                                    dispatch table. The simulation should
  25434.                                    not replace pointers past the end of the
  25435.                                    table as indicated by this number.
  25436.  
  25437.  pTable  to the device driver's dispatch table.
  25438.  
  25439.  
  25440.  Return Value
  25441.  
  25442.  The return value is zero if the function is successful; otherwise, it is an
  25443.  error value.
  25444.  
  25445.  
  25446.  Comments
  25447.  
  25448.  If an installed simulation doesn't completely handle a particular function,
  25449.  it should save the pointer corresponding to that function before installing
  25450.  a pointer to its own function.
  25451.  
  25452.  
  25453.  █    OutlinePath
  25454.  ────────────────────────────────────────────────────────────────────────────
  25455.  
  25456.  LONG OutlinePath  (hdc, phid, flCmd, hddc, ulFunN)
  25457.  
  25458.  HDC  hdc;                         /*handle of engine's device context */
  25459.  
  25460.  PHID  phid;                       /*path identifier */
  25461.  
  25462.  ULONG  flCmd;                     /*options */
  25463.  
  25464.  ULONG  hddc;                      /*handle of device driver's device
  25465.                                    context */
  25466.  
  25467.  ULONG  ulFunN;                    /*flags and function number */
  25468.  
  25469.  
  25470.  The OutlinePath function draws the boundary of the specified path.
  25471.  
  25472.  
  25473.  Parameters
  25474.  
  25475.  hdc  Identifies the engine's device context.
  25476.  
  25477.  phid  Specifies the identifier of the path to be stroked. This value must be
  25478.  1 for the current release of MS OS/2.
  25479.  
  25480.  flCmd  Specifies the options to use while stroking the path. This argument
  25481.  must be zero for the current release of MS OS/2.
  25482.  
  25483.  hddc  Identifies the device driver's device context.
  25484.  
  25485.  ulFunN  Specifies the function number and a mask of various flags. The low
  25486.  word contains the function number; the high word contains a mask of flags,
  25487.  which may be set by the graphics programming interface (GPI), the engine, or
  25488.  a driver. For a description of these flags, see Section 7.1.1.
  25489.  
  25490.  
  25491.  Return Value
  25492.  
  25493.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  25494.  GPI_HITS if the detectable attribute is set for the presentation space and a
  25495.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  25496.  
  25497.  
  25498.  
  25499.  Errors
  25500.  
  25501.  If an error occurs during the execution of this function, the graphics
  25502.  engine or the device driver calls the WinSetErrorInfo function and records
  25503.  the associated error code. The following list contains possible error codes
  25504.  that the engine or the device driver calls record:
  25505.  
  25506.       PMERR_BASE_ERROR
  25507.       PMERR_BITMAP_NOT_SELECTED
  25508.       PMERR_COORDINATE_OVERFLOW
  25509.       PMERR_DEV_FUNC_NOT_INSTALLED
  25510.       PMERR_HDC_BUSY
  25511.       PMERR_INV_COLOR_DATA
  25512.  
  25513.       PMERR_INV_COLOR_INDEX
  25514.       PMERR_INV_COORD_SPACE
  25515.       PMERR_INV_FILL_PATH_OPTIONS
  25516.       PMERR_INV_HDC
  25517.       PMERR_INV_IN_AREA
  25518.       PMERR_INV_IN_PATH
  25519.       PMERR_INV_LENGTH_OR_COUNT
  25520.       PMERR_INV_PATH_ID
  25521.       PMERR_INV_PICK_APERTURE_POSN
  25522.       PMERR_INV_RECT
  25523.       PMERR_PATH_UNKNOWN
  25524.  
  25525.  
  25526.  
  25527.  
  25528.  
  25529.  Comments
  25530.  
  25531.  The path is drawn using the current cosmetic (narrow) line attributes, which
  25532.  are defined in the LINEBUNDLE structure. The path is destroyed after it is
  25533.  drawn.
  25534.  
  25535.  
  25536.  █    PaintRegion
  25537.  ────────────────────────────────────────────────────────────────────────────
  25538.  
  25539.  int PaintRegion  (hdc, hrgn, hddc, ulFunN)
  25540.  
  25541.  HDC  hdc;                         /*handle of engine's device context */
  25542.  
  25543.  HRGN  hrgn;                       /*handle of region */
  25544.  
  25545.  ULONG  hddc;                      /*handle of device driver's device
  25546.                                    context */
  25547.  
  25548.  ULONG  ulFunN;                    /*flags and function number */
  25549.  
  25550.  
  25551.  The PaintRegion function paints the specified region using the current area
  25552.  foreground and background colors. Mixing is controlled by the area
  25553.  foreground mix mode only.
  25554.  
  25555.  
  25556.  Parameters
  25557.  
  25558.  hdc  Identifies the engine's device context.
  25559.  
  25560.  hrgn  Identifies the region.
  25561.  
  25562.  hddc  Identifies the device driver's device context.
  25563.  
  25564.  ulFunN  Specifies the function number and a mask of various flags. The low
  25565.  word contains the function number; the high word contains a mask of flags,
  25566.  which may be set by the graphics programming interface (GPI), the engine, or
  25567.  a driver. For a description of these flags, see Section 7.1.1.
  25568.  
  25569.  
  25570.  Return Value
  25571.  
  25572.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  25573.  GPI_HITS if the detectable attribute is set for the presentation space and a
  25574.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  25575.  
  25576.  
  25577.  
  25578.  Errors
  25579.  
  25580.  If an error occurs during the execution of this function, the graphics
  25581.  engine or the device driver calls the WinSetErrorInfo function and records
  25582.  the associated error code. The following list contains possible error codes
  25583.  that the engine or the device driver calls record:
  25584.  
  25585.       PMERR_HDC_BUSY
  25586.       PMERR_HRGN_BUSY
  25587.       PMERR_INV_HDC
  25588.       PMERR_INV_HRGN
  25589.       PMERR_INV_IN_AREA
  25590.       PMERR_INV_IN_PATH
  25591.       PMERR_REGION_IS_CLIP_REGION
  25592.  
  25593.  
  25594.  
  25595.  
  25596.  
  25597.  █    PartialArc
  25598.  ────────────────────────────────────────────────────────────────────────────
  25599.  
  25600.  int PartialArc  (hdc, pptl, fxMult, fxStart, fxSweep, hddc, ulFunN)
  25601.  
  25602.  HDC  hdc;                         /*handle of engine's device context */
  25603.  
  25604.  PPOINTL  pptl;                    /*pointer to POINTL structure */
  25605.  
  25606.  FIXED  fxMult;                    /*multiplier */
  25607.  
  25608.  FIXED  fxStart;                   /*start angle */
  25609.  
  25610.  FIXED  fxSweep;                   /*sweep angle */
  25611.  
  25612.  ULONG  hddc;                      /*handle of device driver's device
  25613.                                    context */
  25614.  
  25615.  ULONG  ulFunN;                    /*flags and function number */
  25616.  
  25617.  
  25618.  The PartialArc function draws two figures: a straight line, from the current
  25619.  position to the starting point of a partial arc; and the arc itself, with
  25620.  its center at the specified point.
  25621.  
  25622.  The full arc, of which the arc is a part, is identical to that defined by
  25623.  the FullArc function. The part of the arc drawn by this primitive function
  25624.  is defined by the parameters fxStart and fxSweep, which are the start and
  25625.  sweep angles, respectively, subtended from the center─if the current arc
  25626.  parameters specify a circular form. If they do not, these angles are skewed
  25627.  to the same degree that the ellipse is a skewed circle. The fxStart angle is
  25628.  measured counterclockwise from the x-axis of the circle prior to the
  25629.  application of the arc parameters.
  25630.  
  25631.  Both fxStart and fxSweep may be negative. If fxStart is negative, it is
  25632.  measured clockwise from the x-axis. If fxSweep is negative, the arc is drawn
  25633.  in the direction opposite to that indicated by the arc parameters. The arc
  25634.  parameters determine whether the arc is drawn clockwise or counterclockwise.
  25635.  
  25636.  
  25637.  The current position is updated to the final point on the arc. Note this
  25638.  difference from FullArc, in which the current position remains at the center
  25639.  of the figure. A primitive function (for example, PolyLine) following
  25640.  PartialArc will draw from the end point of the arc.
  25641.  
  25642.  
  25643.  Parameters
  25644.  
  25645.  hdc  Identifies the engine's device context.
  25646.  
  25647.  pptl  Points to a POINTL structure that contains the center point of the
  25648.  arc.
  25649.  
  25650.  fxMult  Specifies a multiplier that determines the size of the arc in
  25651.  relation to an arc with the current arc parameters. The value passed is
  25652.  treated as a 4-byte fixed-point (FIXED) number with the high word as the
  25653.  integer portion and the low word as the fractional portion. Thus, a value of
  25654.  65,536 specifies a multiplier of 1. There is a current implementation limit
  25655.  of 255 for the multiplier (that is, a value passed of 255 * 65,536 =
  25656.  16,711,680).
  25657.  
  25658.  fxStart  Specifies the start angle in degrees. The value passed is a
  25659.  fixed-point number. Thus 180 degrees is represented as 180 * 65,536 =
  25660.  11,796,480. The value must be greater than or equal to zero.
  25661.  
  25662.  fxSweep  Specifies the sweep angle in degrees. The value passed is a
  25663.  fixed-point number. The value must be positive.
  25664.  
  25665.  hddc  Identifies the device driver's device context.
  25666.  
  25667.  ulFunN  Specifies the function number and a mask of various flags. The low
  25668.  word contains the function number; the high word contains a mask of flags,
  25669.  which may be set by the graphics programming interface (GPI), the engine, or
  25670.  a driver. For a description of these flags, see Section 7.1.1.
  25671.  
  25672.  
  25673.  Return Value
  25674.  
  25675.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  25676.  GPI_HITS if the detectable attribute is set for the presentation space and a
  25677.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  25678.  
  25679.  
  25680.  Errors
  25681.  
  25682.  If an error occurs during the execution of this function, the graphics
  25683.  engine or the device driver calls the WinSetErrorInfo function and records
  25684.  the associated error code. The following list contains possible error codes
  25685.  that the engine or the device driver calls record:
  25686.  
  25687.       PMERR_BASE_ERROR
  25688.       PMERR_BITMAP_NOT_SELECTED
  25689.       PMERR_COORDINATE_OVERFLOW
  25690.       PMERR_DEV_FUNC_NOT_INSTALLED
  25691.       PMERR_HDC_BUSY
  25692.       PMERR_INV_ANGLE_PARM
  25693.       PMERR_INV_COLOR_DATA
  25694.       PMERR_INV_COLOR_INDEX
  25695.       PMERR_INV_COORD_SPACE
  25696.       PMERR_INV_HDC
  25697.       PMERR_INV_IN_AREA
  25698.       PMERR_INV_IN_PATH
  25699.       PMERR_INV_LENGTH_OR_COUNT
  25700.       PMERR_INV_MULTIPLIER
  25701.       PMERR_INV_PICK_APERTURE_POSN
  25702.       PMERR_INV_RECT
  25703.       PMERR_PATH_LIMIT_EXCEEDED
  25704.       PMERR_PATH_UNKNOWN
  25705.  
  25706.  
  25707.  
  25708.  
  25709.  
  25710.  █    PlayJournalFile
  25711.  ────────────────────────────────────────────────────────────────────────────
  25712.  
  25713.  ULONG PlayJournalFile  (hdc, hfile, hddc, ulFunN)
  25714.  
  25715.  HDC  hdc;                         /*handle of engine's device context */
  25716.  
  25717.  LHANDLE  hfile;                   /*handle of journal file */
  25718.  
  25719.  ULONG  hddc;                      /*handle of device driver's device
  25720.                                    context */
  25721.  
  25722.  ULONG  ulFunN;                    /*flags and function number */
  25723.  
  25724.  
  25725.  The PlayJournalFile function plays the specified journal file to the
  25726.  specified device context. The journal file is read into memory and each
  25727.  journaled GreEntry call is played.
  25728.  
  25729.  Each journaled record is processed before playing to the extent that long
  25730.  pointers to data are fixed up and clone objects (regions or bitmaps) are
  25731.  created, if necessary, from the journaled data.
  25732.  
  25733.  It is assumed that any single journaled function and its associated data fit
  25734.  in a 32K buffer. If the journaled record contains region rectangles or
  25735.  bitmap bits, these do not count in this 32K restriction.
  25736.  
  25737.  
  25738.  Parameters
  25739.  
  25740.  hdc  Identifies the engine's device context.
  25741.  
  25742.  hfile  Identifies the journal file to play.
  25743.  
  25744.  hddc  Identifies the device driver's device context.
  25745.  
  25746.  ulFunN  Specifies the function number and a mask of various flags. The low
  25747.  word contains the function number; the high word contains a mask of flags,
  25748.  which may be set by the graphics programming interface (GPI), the engine, or
  25749.  a driver. For a description of these flags, see Section 7.1.1.
  25750.  
  25751.  
  25752.  Return Value
  25753.  
  25754.  The return value is GPI_OK if the function is successful or GPI_ERROR if an
  25755.  error occurs.
  25756.  
  25757.  
  25758.  Errors
  25759.  
  25760.  If an error occurs during the execution of this function, the graphics
  25761.  engine calls the WinSetErrorInfo function and records the associated error
  25762.  code. The following list contains possible error codes that the engine may
  25763.  record:
  25764.  
  25765.       PMERR_BASE_ERROR
  25766.       PMERR_BITMAP_IS_SELECTED
  25767.       PMERR_BITMAP_NOT_SELECTED
  25768.       PMERR_COORDINATE_OVERFLOW
  25769.       PMERR_DEV_FUNC_NOT_INSTALLED
  25770.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  25771.       PMERR_HBITMAP_BUSY
  25772.       PMERR_HDC_BUSY
  25773.       PMERR_HRGN_BUSY
  25774.       PMERR_HUGE_FONTS_NOT_SUPPORTED
  25775.       PMERR_INCORRECT_DC_TYPE
  25776.       PMERR_INSUFFICIENT_MEMORY
  25777.       PMERR_INV_BACKGROUND_COL_ATTR
  25778.       PMERR_INV_BACKGROUND_MIX_ATTR
  25779.       PMERR_INV_BITMAP_DIMENSION
  25780.       PMERR_INV_CHAR_DIRECTION_ATTR
  25781.       PMERR_INV_CHAR_MODE_ATTR
  25782.       PMERR_INV_CODEPAGE
  25783.       PMERR_INV_COLOR_ATTR
  25784.       PMERR_INV_COORD_SPACE
  25785.       PMERR_INV_COORDINATE
  25786.       PMERR_INV_DC_DATA
  25787.       PMERR_INV_DC_TYPE
  25788.       PMERR_INV_DRIVER_NAME
  25789.       PMERR_INV_HBITMAP
  25790.       PMERR_INV_HDC
  25791.       PMERR_INV_HJOURNAL
  25792.       PMERR_INV_HRGN
  25793.       PMERR_INV_ID
  25794.       PMERR_INV_IN_AREA
  25795.       PMERR_INV_IN_PATH
  25796.       PMERR_INV_INFO_TABLE
  25797.       PMERR_INV_LENGTH_OR_COUNT
  25798.       PMERR_INV_LINE_TYPE_ATTR
  25799.       PMERR_INV_METAFILE
  25800.       PMERR_INV_MIX_ATTR
  25801.       PMERR_INV_PATTERN_REF_PT_ATTR
  25802.       PMERR_INV_PATTERN_SET_ATTR
  25803.       PMERR_INV_PATTERN_SET_FONT
  25804.       PMERR_INV_RECT
  25805.       PMERR_INV_REGION_CONTROL
  25806.       PMERR_INV_REGION_MIX_MODE
  25807.       PMERR_INV_SCAN_START
  25808.       PMERR_INV_USAGE_PARM
  25809.       PMERR_JFILE_BUSY
  25810.       PMERR_RAM_JNL_FILE_TOO_SMALL
  25811.       PMERR_REGION_IS_CLIP_REGION
  25812.  
  25813.  
  25814.  
  25815.  
  25816.  
  25817.  █    PolyFillet
  25818.  ────────────────────────────────────────────────────────────────────────────
  25819.  
  25820.  int PolyFillet  (hdc, aptl, cptl, hddc, ulFunN)
  25821.  
  25822.  HDC  hdc;                         /*handle of engine's device context */
  25823.  
  25824.  PPOINTL  aptl;                    /*pointer to array of POINTL structures
  25825.                                    */
  25826.  
  25827.  LONG  cptl;                       /*count of points */
  25828.  
  25829.  ULONG  hddc;                      /*handle of device driver's device
  25830.                                    context */
  25831.  
  25832.  ULONG  ulFunN;                    /*flags and function number */
  25833.  
  25834.  
  25835.  The PolyFillet function creates a fillet on a series of connected lines,
  25836.  with the first line starting at the current position.
  25837.  
  25838.  
  25839.  Parameters
  25840.  
  25841.  aptl  to an array of POINTL structures. Each structure contains the
  25842.  coordinates of a point.
  25843.  
  25844.  cptl  the number of points. This must be at least 2. For PolyFillet, a count
  25845.  of 0 is also valid.
  25846.  
  25847.  
  25848.  Return Value
  25849.  
  25850.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  25851.  GPI_HITS if the detectable attribute is set for the presentation space and a
  25852.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  25853.  
  25854.  
  25855.  Errors
  25856.  
  25857.  If an error occurs during the execution of this function, the graphics
  25858.  engine or the device driver calls the WinSetErrorInfo function and records
  25859.  the associated error code. The following list contains possible error codes
  25860.  that the engine or the device driver calls record:
  25861.  
  25862.       PMERR_BASE_ERROR
  25863.       PMERR_BITMAP_NOT_SELECTED
  25864.       PMERR_COORDINATE_OVERFLOW
  25865.       PMERR_DEV_FUNC_NOT_INSTALLED
  25866.       PMERR_HDC_BUSY
  25867.       PMERR_INV_COLOR_DATA
  25868.       PMERR_INV_COLOR_INDEX
  25869.       PMERR_INV_COORD_SPACE
  25870.       PMERR_INV_HDC
  25871.       PMERR_INV_IN_AREA
  25872.       PMERR_INV_IN_PATH
  25873.       PMERR_INV_LENGTH_OR_COUNT
  25874.       PMERR_INV_PICK_APERTURE_POSN
  25875.       PMERR_INV_RECT
  25876.       PMERR_PATH_LIMIT_EXCEEDED
  25877.       PMERR_PATH_UNKNOWN
  25878.  
  25879.  
  25880.  
  25881.  
  25882.  
  25883.  Comments
  25884.  
  25885.  If only two points are supplied, an imaginary line is drawn from the current
  25886.  position to the first point, and a second line from the first point to the
  25887.  second. A curve is then constructed, starting at the current position and
  25888.  tangential to the first line at that point. The curve, which has the
  25889.  appearance of a fillet, is drawn such that it reaches the last point at a
  25890.  tangent to the second line. The straight lines are imaginary and are not
  25891.  drawn.
  25892.  
  25893.  If more than two points are supplied, an imaginary series of lines is
  25894.  constructed through them (as with the PolyLine function). All the lines
  25895.  except the first and last are then divided in two at their midpoints. A
  25896.  series of curved fillets are then drawn, with the first drawn starting at
  25897.  the current position to the midpoint of the second imaginary line. The
  25898.  second and subsequent lines are drawn starting at the end point of the
  25899.  previous line.
  25900.  
  25901.  The curves are drawn using the current line attributes.
  25902.  
  25903.  Upon completion, the current (x,y) position is set to the last point in the
  25904.  series.
  25905.  
  25906.  An individual fillet always lies within the area bounded by the starting,
  25907.  ending and control points.
  25908.  
  25909.  It is not an error for more than one of the points to have the same
  25910.  coordinates.
  25911.  
  25912.  The maximum number of fillets allowed in PolyFillet is not less than 4000.
  25913.  
  25914.  
  25915.  █    PolyFilletSharp
  25916.  ────────────────────────────────────────────────────────────────────────────
  25917.  
  25918.  int PolyFilletSharp  (hdc, aptl, cptl, pfxSharpness, hddc, ulFunN)
  25919.  
  25920.  HDC  hdc;                         /*handle of engine's device context */
  25921.  
  25922.  PPOINTL  aptl;                    /*pointer to array of POINTL structures
  25923.                                    */
  25924.  
  25925.  LONG  cptl;                       /*count of points */
  25926.  
  25927.  PFIXED  pfxSharpness;             /*pointer to array of fixed-point values
  25928.                                    */
  25929.  
  25930.  ULONG  hddc;                      /*handle of device driver's device
  25931.                                    context */
  25932.  
  25933.  ULONG  ulFunN;                    /*flags and function number */
  25934.  
  25935.  
  25936.  The PolyFilletSharp function creates a fillet on a series of connected
  25937.  lines, with the first line starting at the current position. Subsequent
  25938.  points identify the end points of the lines.
  25939.  
  25940.  
  25941.  Parameters
  25942.  
  25943.  hdc  Identifies the engine's device context.
  25944.  
  25945.  aptl  Points to an array of POINTL structures. Each structure contains the
  25946.  coordinates of a point.
  25947.  
  25948.  cptl  Specifies the number of points. This number must be at least 2 and
  25949.  divisible by 2 (or 2f, where f is the number of fillets). For
  25950.  PolyFilletSharp, a count of 0 is also valid.
  25951.  
  25952.  pfxSharpness  Points to an array of sharpness values for the fillets. The
  25953.  array has n/2 elements, each array element being a fixed-point (FIXED)
  25954.  value.
  25955.  
  25956.  hddc  Identifies the device driver's device context.
  25957.  
  25958.  ulFunN  Specifies the function number and a mask of various flags. The low
  25959.  word contains the function number; the high word contains a mask of flags,
  25960.  which may be set by the graphics programming interface (GPI), the engine, or
  25961.  a driver. For a description of these flags, see Section 7.1.1.
  25962.  
  25963.  
  25964.  Return Value
  25965.  
  25966.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  25967.  GPI_HITS if the detectable attribute is set for the presentation space and a
  25968.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  25969.  
  25970.  
  25971.  
  25972.  Errors
  25973.  
  25974.  If an error occurs during the execution of this function, the graphics
  25975.  engine or the device driver calls the WinSetErrorInfo function and records
  25976.  the associated error code. The following list contains possible error codes
  25977.  that the engine or the device driver calls record:
  25978.  
  25979.       PMERR_BASE_ERROR
  25980.       PMERR_BITMAP_NOT_SELECTED
  25981.       PMERR_COORDINATE_OVERFLOW
  25982.       PMERR_DEV_FUNC_NOT_INSTALLED
  25983.       PMERR_HDC_BUSY
  25984.  
  25985.       PMERR_INV_COLOR_DATA
  25986.       PMERR_INV_COLOR_INDEX
  25987.       PMERR_INV_COORD_SPACE
  25988.       PMERR_INV_HDC
  25989.       PMERR_INV_IN_AREA
  25990.       PMERR_INV_IN_PATH
  25991.       PMERR_INV_LENGTH_OR_COUNT
  25992.       PMERR_INV_PICK_APERTURE_POSN
  25993.       PMERR_INV_RECT
  25994.       PMERR_PATH_LIMIT_EXCEEDED
  25995.       PMERR_PATH_UNKNOWN
  25996.  
  25997.  
  25998.  
  25999.  
  26000.  
  26001.  Comments
  26002.  
  26003.  This function differs from PolyFillet in the following ways:
  26004.  
  26005.    ■   The sharpness of each fillet is explicitly specified.
  26006.  
  26007.    ■   Both the control and the ending point of each fillet are explicitly
  26008.        specified.
  26009.  
  26010.    ■   Adjacent fillets will in general have a discontinuity in gradient,
  26011.        unless the points are chosen so that this is not the case.
  26012.  
  26013.  
  26014.  The sharpness of each fillet is defined as follows. Let A and C be the
  26015.  starting and ending points, respectively, of the fillet, and let B be the
  26016.  control point. Let W be the midpoint of AC. Let D be the point where the
  26017.  fillet intersects WB. Then the sharpness is given by the following:
  26018.  
  26019.  sharpness (S) = WD/DB
  26020.  
  26021.  
  26022.  
  26023.  If                                Then
  26024.  ────────────────────────────────────────────────────────────────────────────
  26025.  
  26026.  S > 1.0                           Hyperbola is drawn
  26027.  
  26028.  S = 1.0                           Parabola is drawn
  26029.  
  26030.  S < 1.0                           Ellipse is drawn
  26031.  
  26032.   The first fillet is drawn using the two lines, one from the current
  26033.  position to the first (x,y) point specified (its control point), and one
  26034.  from there to the second point specified. The fillet starts from the current
  26035.  position and ends at the second point specified. It is tangential to the
  26036.  first line at the current position, and to the second line at the second
  26037.  specified point. The sharpness of this fillet is given by the first
  26038.  sharpness value.
  26039.  
  26040.  Each subsequent fillet is drawn starting from the ending point of the
  26041.  previous fillet, and uses the next two lines in the sequence. Thus, two
  26042.  points and one sharpness value are specified for each fillet.
  26043.  
  26044.  The curves are drawn using the current line attributes.
  26045.  
  26046.  Upon completion, the current (x,y) position is set to the last point in the
  26047.  series.
  26048.  
  26049.  An individual fillet always lies within the area bounded by the starting,
  26050.  ending and control points.
  26051.  
  26052.  It is not an error for any of the points to have the same coordinates.
  26053.  
  26054.  The maximum number of fillets allowed in PolyFilletSharp is not less than
  26055.  2000.
  26056.  
  26057.  
  26058.  █    PolyLine
  26059.  ────────────────────────────────────────────────────────────────────────────
  26060.  
  26061.  int PolyLine  (hdc, aptl, cptl, hddc, ulFunN)
  26062.  
  26063.  HDC  hdc;                         /*handle of engine's device context */
  26064.  
  26065.  PPOINTL  aptl;                    /*pointer to array of POINTL structures
  26066.                                    */
  26067.  
  26068.  LONG  cptl;                       /*count of points */
  26069.  
  26070.  ULONG  hddc;                      /*handle of device driver's device
  26071.                                    context */
  26072.  
  26073.  ULONG  ulFunN;                    /*flags and function number */
  26074.  
  26075.  
  26076.  The PolyLine function draws a series of straight lines starting at the
  26077.  current position and connecting the specified points. The lines are drawn
  26078.  using the current line attributes. Upon completion, the current position is
  26079.  set to the last point in the series.
  26080.  
  26081.  The maximum number of lines allowed in PolyLine is not less than 8000.
  26082.  
  26083.  
  26084.  Parameters
  26085.  
  26086.  hdc  Identifies the engine's device context.
  26087.  
  26088.  aptl  Points to an array of POINTL structures. Each structure contains the
  26089.  coordinates of a point.
  26090.  
  26091.  cptl  Specifies the number of points. For PolyLine, a count of 0 is also
  26092.  valid.
  26093.  
  26094.  hddc  Identifies the device driver's device context.
  26095.  
  26096.  ulFunN  Specifies the function number and a mask of various flags. The low
  26097.  word contains the function number; the high word contains a mask of flags,
  26098.  which may be set by the graphics programming interface (GPI), the engine, or
  26099.  a driver. For a description of these flags, see Section 7.1.1.
  26100.  
  26101.  
  26102.  Return Value
  26103.  
  26104.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  26105.  GPI_HITS if the detectable attribute is set for the presentation space and a
  26106.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  26107.  
  26108.  
  26109.  
  26110.  Errors
  26111.  
  26112.  If an error occurs during the execution of this function, the device driver
  26113.  calls the WinSetErrorInfo function and records the associated error code.
  26114.  The following list contains possible error codes that the device driver may
  26115.  record:
  26116.  
  26117.       PMERR_BASE_ERROR
  26118.       PMERR_BITMAP_NOT_SELECTED
  26119.       PMERR_COORDINATE_OVERFLOW
  26120.       PMERR_DEV_FUNC_NOT_INSTALLED
  26121.       PMERR_HDC_BUSY
  26122.       PMERR_INV_COLOR_DATA
  26123.       PMERR_INV_COLOR_INDEX
  26124.       PMERR_INV_COORD_SPACE
  26125.       PMERR_INV_HDC
  26126.       PMERR_INV_IN_AREA
  26127.       PMERR_INV_IN_PATH
  26128.       PMERR_INV_LENGTH_OR_COUNT
  26129.       PMERR_INV_PICK_APERTURE_POSN
  26130.       PMERR_INV_RECT
  26131.       PMERR_PATH_LIMIT_EXCEEDED
  26132.       PMERR_PATH_UNKNOWN
  26133.  
  26134.  
  26135.  
  26136.  
  26137.  
  26138.  █    PolyMarker
  26139.  ────────────────────────────────────────────────────────────────────────────
  26140.  
  26141.  int PolyMarker  (hdc, aptl, cptl, hddc, ulFunN)
  26142.  
  26143.  HDC  hdc;                         /*handle of engine's device context */
  26144.  
  26145.  PPOINTL  aptl;                    /*pointer to array of POINTL structures
  26146.                                    */
  26147.  
  26148.  LONG  cptl;                       /*count of points */
  26149.  
  26150.  ULONG  hddc;                      /*handle of device driver's device
  26151.                                    context */
  26152.  
  26153.  ULONG  ulFunN;                    /*flags and function number */
  26154.  
  26155.  
  26156.  The PolyMarker function draws a marker, selected by the current values of
  26157.  the marker set and marker symbol attributes centered over a point. This
  26158.  function draws the first marker at the current position and draws the
  26159.  remaining markers at the points in the array aptl.
  26160.  
  26161.  Upon completion, the current position is set to the last point in the
  26162.  series.
  26163.  
  26164.  
  26165.  Parameters
  26166.  
  26167.  hdc  the engine's device context.
  26168.  
  26169.  aptl  to an array of POINTL structures. Each structure contains the
  26170.  coordinates of a point.
  26171.  
  26172.  cptl  the number of points. For PolyMarker, a count of 0 is also valid.
  26173.  
  26174.  hddc  the device driver's device context.
  26175.  
  26176.  ulFunN  the function number and a mask of various flags. The low word
  26177.  contains the function number; the high word contains a mask of flags, which
  26178.  may be set by the graphics programming interface (GPI), the engine, or a
  26179.  driver. For a description of these flags, see Section 7.1.1.
  26180.  
  26181.  
  26182.  Return Value
  26183.  
  26184.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  26185.  GPI_HITS if the detectable attribute is set for the presentation space and a
  26186.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  26187.  
  26188.  
  26189.  Errors
  26190.  
  26191.  If an error occurs during the execution of this function, the device driver
  26192.  calls the WinSetErrorInfo function and records the associated error code.
  26193.  The following list contains possible error codes that the device driver may
  26194.  record:
  26195.  
  26196.       PMERR_ALREADY_IN_PATH
  26197.       PMERR_BASE_ERROR
  26198.       PMERR_BITMAP_NOT_SELECTED
  26199.       PMERR_COORDINATE_OVERFLOW
  26200.       PMERR_DEV_FUNC_NOT_INSTALLED
  26201.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  26202.       PMERR_FONT_AND_MODE_MISMATCH
  26203.       PMERR_HDC_BUSY
  26204.       PMERR_HRGN_BUSY
  26205.       PMERR_HUGE_FONTS_NOT_SUPPORTED
  26206.       PMERR_INSUFFICIENT_MEMORY
  26207.       PMERR_INV_BACKGROUND_COL_ATTR
  26208.       PMERR_INV_BACKGROUND_MIX_ATTR
  26209.       PMERR_INV_CHAR_ANGLE_ATTR
  26210.       PMERR_INV_CHAR_DIRECTION_ATTR
  26211.       PMERR_INV_CHAR_MODE_ATTR
  26212.       PMERR_INV_CHAR_POS_OPTIONS
  26213.       PMERR_INV_CHAR_SET_ATTR
  26214.       PMERR_INV_CHAR_SHEAR_ATTR
  26215.       PMERR_INV_CLIP_PATH_OPTIONS
  26216.  
  26217.       PMERR_INV_CODEPAGE
  26218.       PMERR_INV_COLOR_ATTR
  26219.       PMERR_INV_COLOR_DATA
  26220.       PMERR_INV_COLOR_INDEX
  26221.       PMERR_INV_COORD_SPACE
  26222.       PMERR_INV_COORDINATE
  26223.       PMERR_INV_DC_TYPE
  26224.       PMERR_INV_END_PATH_OPTIONS
  26225.       PMERR_INV_FILL_PATH_OPTIONS
  26226.       PMERR_INV_GEOM_LINE_WIDTH_ATTR
  26227.       PMERR_INV_HDC
  26228.       PMERR_INV_HRGN
  26229.       PMERR_INV_ID
  26230.       PMERR_INV_IN_AREA
  26231.       PMERR_INV_IN_PATH
  26232.       PMERR_INV_LENGTH_OR_COUNT
  26233.       PMERR_INV_LINE_END_ATTR
  26234.       PMERR_INV_LINE_JOIN_ATTR
  26235.       PMERR_INV_LINE_TYPE_ATTR
  26236.       PMERR_INV_LINE_WIDTH_ATTR
  26237.       PMERR_INV_MARKER_SET_ATTR
  26238.       PMERR_INV_MARKER_SYMBOL_ATTR
  26239.       PMERR_INV_MATRIX_ELEMENT
  26240.       PMERR_INV_MIX_ATTR
  26241.       PMERR_INV_PATH_ID
  26242.       PMERR_INV_PATTERN_REF_PT_ATTR
  26243.       PMERR_INV_PATTERN_SET_ATTR
  26244.       PMERR_INV_PATTERN_SET_FONT
  26245.       PMERR_INV_PICK_APERTURE_POSN
  26246.       PMERR_INV_PRIMITIVE_TYPE
  26247.       PMERR_INV_RECT
  26248.       PMERR_INV_REGION_CONTROL
  26249.       PMERR_INV_SETID
  26250.       PMERR_INV_TRANSFORM_TYPE
  26251.       PMERR_MATRIX_OVERFLOW
  26252.       PMERR_NOT_IN_PATH
  26253.       PMERR_PATH_LIMIT_EXCEEDED
  26254.       PMERR_PATH_UNKNOWN
  26255.       PMERR_REGION_IS_CLIP_REGION
  26256.       PMERR_UNSUPPORTED_ATTR
  26257.       PMERR_UNSUPPORTED_ATTR_VALUE
  26258.  
  26259.  
  26260.  
  26261.  
  26262.  
  26263.  █    PolyScanline
  26264.  ────────────────────────────────────────────────────────────────────────────
  26265.  
  26266.  ULONG PolyScanline  (hdc, psd, hddc, ulFunN)
  26267.  
  26268.  HDC  hdc;                         /*handle of engine's device context */
  26269.  
  26270.  PSCANDATA  psd;                   /*pointer to SCANDATA structure */
  26271.  
  26272.  ULONG  hddc;                      /*handle of device driver's device
  26273.                                    context */
  26274.  
  26275.  ULONG  ulFunN;                    /*flags and function number */
  26276.  
  26277.  
  26278.  The PolyScanline function fills the areas between the specified short-line
  26279.  pairs using the current pattern attributes. This function must be supported
  26280.  by all device drivers.
  26281.  
  26282.  The device driver can make the following assumptions:
  26283.  
  26284.    ■   The count of the number of polyscans (short-line pairs) in the buffer
  26285.        is never odd.
  26286.  
  26287.    ■   The two short-lines in a polyscan pair will both have the same height
  26288.        and will never intersect.
  26289.  
  26290.    ■   The ordering of the edges is from bottom to top and from left to
  26291.        right.
  26292.  
  26293.  
  26294.  The device driver must perform region clipping for PolyScanline. For
  26295.  non-display device drivers this can be accomplished by a call to the display
  26296.  device driver.
  26297.  
  26298.  The coordinates for this function are screen coordinates.
  26299.  
  26300.  
  26301.  Parameters
  26302.  
  26303.  hdc  the engine's device context.
  26304.  
  26305.  psd  to a SCANDATA structure. The structure has the following form:
  26306.  
  26307.  typedef struct _SCANDATA { /* sd */
  26308.      PSHORTLINE pslFirstLeft;
  26309.      PSHORTLINE pslLastLeft;
  26310.      PSHORTLINE pslFirstRight;
  26311.      PSHORTLINE pslLastRight;
  26312.      ULONG      c;
  26313.      RECTL      rclBound;
  26314.  } SCANDATA;
  26315.  
  26316.  
  26317.  hddc  the device driver's device context.
  26318.  
  26319.  ulFunN  the function number and a mask of various flags. The low word
  26320.  contains the function number; the high word contains a mask of flags, which
  26321.  may be set by the graphics programming interface (GPI), the engine, or a
  26322.  driver. For a description of these flags, see Section 7.1.1.
  26323.  
  26324.  
  26325.  Return Value
  26326.  
  26327.  The return value is GPI_OK if the function is successful or GPI_ERROR if an
  26328.  error occurs.
  26329.  
  26330.  
  26331.  Errors
  26332.  
  26333.  If an error occurs during the execution of this function, the device driver
  26334.  calls the WinSetErrorInfo function and records the associated error code.
  26335.  The following list contains possible error codes that the device driver may
  26336.  record:
  26337.  
  26338.       PMERR_BITMAP_NOT_SELECTED
  26339.       PMERR_COORDINATE_OVERFLOW
  26340.       PMERR_DEV_FUNC_NOT_INSTALLED
  26341.       PMERR_HDC_BUSY
  26342.       PMERR_INV_COLOR_DATA
  26343.       PMERR_INV_COLOR_INDEX
  26344.       PMERR_INV_COORD_SPACE
  26345.       PMERR_INV_COORDINATE
  26346.       PMERR_INV_HDC
  26347.       PMERR_INV_IN_AREA
  26348.       PMERR_INV_IN_PATH
  26349.       PMERR_INV_LENGTH_OR_COUNT
  26350.       PMERR_INV_PICK_APERTURE_POSN
  26351.       PMERR_INV_RECT
  26352.       PMERR_INV_REGION_CONTROL
  26353.  
  26354.  
  26355.  
  26356.  
  26357.  
  26358.  Comments
  26359.  
  26360.  The first SCANDATA structure is a header. It points to the first and last
  26361.  short-line pair. This is because the Bitblt function may have to process the
  26362.  scan lines forward or backward depending on the transfer.
  26363.  
  26364.  The right and left short lines are doubly-linked in two separate short-line
  26365.  lists. Each list is found by using the header.
  26366.  
  26367.  
  26368.  █    PolyShortLine
  26369.  ────────────────────────────────────────────────────────────────────────────
  26370.  
  26371.  int PolyShortLine  (hdc, psl, hddc, ulFunN)
  26372.  
  26373.  HDC  hdc;                         /*handle of engine's device context */
  26374.  
  26375.  PSHORTLINE  psl;                  /*pointer to SHORTLINE structure */
  26376.  
  26377.  ULONG  hddc;                      /*handle of device driver's device
  26378.                                    context */
  26379.  
  26380.  ULONG  ulFunN;                    /*flags and function number */
  26381.  
  26382.  
  26383.  The PolyShortLine function draws a series of short lines. The function is
  26384.  not available at the API level.
  26385.  
  26386.  The parameters include a pointer to the SHORTLINE structure, which is a
  26387.  linked list of short lines. The function should render each short line in
  26388.  the list until it finds a null short line.
  26389.  
  26390.  The current position is not affected by this call. The lines are assumed
  26391.  already clipped.
  26392.  
  26393.  The coordinates for this function are screen coordinates.
  26394.  
  26395.  
  26396.  Parameters
  26397.  
  26398.  hdc  Identifies the engine's device context.
  26399.  
  26400.  psl  Points to a SHORTLINE structure. The structure has the following form:
  26401.  
  26402.  typedef struct _SHORTLINE { /* sl */
  26403.      SHORTLINEHEADER slh;
  26404.      SHORT       ax[1];
  26405.  } SHORTLINE;
  26406.  
  26407.  
  26408.  hddc  Identifies the device driver's device context.
  26409.  
  26410.  ulFunN  Specifies the function number and a mask of various flags. The low
  26411.  word contains the function number; the high word contains a mask of flags,
  26412.  which may be set by the graphics programming interface (GPI), the engine, or
  26413.  a driver. For a description of these flags, see Section 7.1.1.
  26414.  
  26415.  
  26416.  Return Value
  26417.  
  26418.  The return value is GPI_OK if the function is successful or GPI_ERROR if an
  26419.  error occurs.
  26420.  
  26421.  
  26422.  Errors
  26423.  
  26424.  If an error occurs during the execution of this function, the device driver
  26425.  calls the WinSetErrorInfo function and records the associated error code.
  26426.  The following list contains possible error codes that the device driver may
  26427.  record:
  26428.  
  26429.       PMERR_BITMAP_NOT_SELECTED
  26430.       PMERR_COORDINATE_OVERFLOW
  26431.       PMERR_DEV_FUNC_NOT_INSTALLED
  26432.       PMERR_HDC_BUSY
  26433.       PMERR_INV_COLOR_DATA
  26434.       PMERR_INV_COLOR_INDEX
  26435.       PMERR_INV_COORD_SPACE
  26436.       PMERR_INV_HDC
  26437.       PMERR_INV_IN_AREA
  26438.  
  26439.       PMERR_INV_IN_PATH
  26440.       PMERR_INV_LENGTH_OR_COUNT
  26441.       PMERR_INV_PICK_APERTURE_POSN
  26442.  
  26443.  
  26444.  
  26445.  
  26446.  
  26447.  Comments
  26448.  
  26449.  The SHORTLINE structure is a discrete representation of a curve. A curve
  26450.  starts at point %x sub 0 , y sub 0% and ends at point %x sub 1 , y sub 1%.
  26451.  For each of the %y sub 1~-~y sub 0~+~1% rows, there is exactly one x value,
  26452.  contained in the x array. The steps are stored in absolute coordinates; for
  26453.  example:
  26454.  
  26455.               0
  26456.               |
  26457.               XXX
  26458.                  XXXX
  26459.                      XXXXX
  26460.                           X
  26461.  
  26462.  
  26463.  The short line is defined as follows: xstart = 0, ystart = 0, xstop = 13,
  26464.  ystop = 4, and the array is {3,7,12,13}. Note there are %y sub 1~-~y sub
  26465.  0~+~1% numbers in the array. The last point, (13,4), is not drawn.
  26466.  
  26467.  
  26468.  █    PolySpline
  26469.  ────────────────────────────────────────────────────────────────────────────
  26470.  
  26471.  int PolySpline  (hdc, aptl, cptl, hddc, ulFunN)
  26472.  
  26473.  HDC  hdc;                         /*handle of engine's device context */
  26474.  
  26475.  PPOINTL  aptl;                    /*pointer to array of POINTL structures
  26476.                                    */
  26477.  
  26478.  LONG  cptl;                       /*count of points */
  26479.  
  26480.  ULONG  hddc;                      /*handle of device driver's device
  26481.                                    context */
  26482.  
  26483.  ULONG  ulFunN;                    /*flags and function number */
  26484.  
  26485.  
  26486.  The PolySpline function creates a succession of cubic Bezier splines. The
  26487.  first spline is drawn from the current position to the third specified
  26488.  point, with the first and second points used as control points. Subsequent
  26489.  splines start from the ending point of the previous spline, and end at the
  26490.  next specified point but two, with the intervening points their first and
  26491.  second control points. The application must ensure that the gradient is
  26492.  continuous at each end/start point, if this is required. The number of
  26493.  points in the array must be 3s, where s is the number of splines. The points
  26494.  are given in the following order: first control point, second control point,
  26495.  and ending point.
  26496.  
  26497.  The splines are drawn using the current line attributes. Upon completion,
  26498.  the current position is set to the last point in the series. An individual
  26499.  spline always lies within the area bounded by the starting, ending and
  26500.  control points. It is not an error for any of the points have the same
  26501.  coordinates.
  26502.  
  26503.  The maximum number of splines allowed in PolySpline is not less than 2500.
  26504.  
  26505.  
  26506.  Parameters
  26507.  
  26508.  hdc  Identifies the engine's device context.
  26509.  
  26510.  aptl  Points to an array of POINTL structures. Each structure contains the
  26511.  coordinates of a point.
  26512.  
  26513.  cptl  Specifies the number of points in the array of structures. This number
  26514.  must be at least 3 and divisible by 3 (or 3s, where s is the number of
  26515.  splines). For PolySpline, a count of 0 is also valid.
  26516.  
  26517.  hddc  Identifies the device driver's device context.
  26518.  
  26519.  ulFunN  Specifies the function number and a mask of various flags. The low
  26520.  word contains the function number; the high word contains a mask of flags,
  26521.  which may be set by the graphics programming interface (GPI), the engine, or
  26522.  a driver. For a description of these flags, see Section 7.1.1.
  26523.  
  26524.  
  26525.  Return Value
  26526.  
  26527.  The return value is GPI_OK or GPI_HITS if the function is successful (it is
  26528.  GPI_HITS if the detectable attribute is set for the presentation space and a
  26529.  correlation hit occurs). The return value is GPI_ERROR if an error occurs.
  26530.  
  26531.  
  26532.  Errors
  26533.  
  26534.  If an error occurs during the execution of this function, the graphics
  26535.  engine or the device driver calls the WinSetErrorInfo function and records
  26536.  the associated error code. The following list contains possible error codes
  26537.  that the engine or the device driver calls record:
  26538.  
  26539.       PMERR_BASE_ERROR
  26540.       PMERR_BITMAP_NOT_SELECTED
  26541.       PMERR_COORDINATE_OVERFLOW
  26542.       PMERR_DEV_FUNC_NOT_INSTALLED
  26543.       PMERR_HDC_BUSY
  26544.       PMERR_INV_COLOR_DATA
  26545.       PMERR_INV_COLOR_INDEX
  26546.       PMERR_INV_COORD_SPACE
  26547.       PMERR_INV_HDC
  26548.       PMERR_INV_IN_AREA
  26549.       PMERR_INV_IN_PATH
  26550.       PMERR_INV_LENGTH_OR_COUNT
  26551.       PMERR_INV_PICK_APERTURE_POSN
  26552.       PMERR_INV_RECT
  26553.       PMERR_PATH_LIMIT_EXCEEDED
  26554.       PMERR_PATH_UNKNOWN
  26555.  
  26556.  
  26557.  
  26558.  
  26559.  
  26560.  █    PtInRegion
  26561.  ────────────────────────────────────────────────────────────────────────────
  26562.  
  26563.  int PtInRegion  (hdc, hrgn, pptl, hddc, ulFunN)
  26564.  
  26565.  HDC  hdc;                         /*handle of engine's device context */
  26566.  
  26567.  HRGN  hrgn;                       /*handle of region */
  26568.  
  26569.  PPOINTL  pptl;                    /*pointer to POINTL structure */
  26570.  
  26571.  ULONG  hddc;                      /*handle of device driver's device
  26572.                                    context */
  26573.  
  26574.  ULONG  ulFunN;                    /*flags and function number */
  26575.  
  26576.  
  26577.  The PtInRegion function checks whether a point lies within a region.
  26578.  
  26579.  
  26580.  Parameters
  26581.  
  26582.  hdc  Identifies the engine's device context.
  26583.  
  26584.  hrgn  Identifies the region.
  26585.  
  26586.  pptl  Points to a POINTL structure that contains the coordinates of the
  26587.  point to check.
  26588.  
  26589.  hddc  Identifies the device driver's device context.
  26590.  
  26591.  ulFunN  Specifies the function number and a mask of various flags. The low
  26592.  word contains the function number; the high word contains a mask of flags,
  26593.  which may be set by the graphics programming interface (GPI), the engine, or
  26594.  a driver. For a description of these flags, see Section 7.1.1.
  26595.  
  26596.  
  26597.  Return Value
  26598.  
  26599.  The return value is PRGN_OUTSIDE or PRGN_INSIDE if the function is
  26600.  successful or PRGN_ERROR if an error occurs.
  26601.  
  26602.  
  26603.  Errors
  26604.  
  26605.  If an error occurs during the execution of this function, the graphics
  26606.  engine or the device driver calls the WinSetErrorInfo function and records
  26607.  the associated error code. The following list contains possible error codes
  26608.  that the engine or the device driver calls record:
  26609.  
  26610.       PMERR_HRGN_BUSY
  26611.       PMERR_INV_COORDINATE
  26612.       PMERR_INV_HRGN
  26613.       PMERR_INV_RECT
  26614.       PMERR_REGION_IS_CLIP_REGION
  26615.  
  26616.  
  26617.  
  26618.  
  26619.  
  26620.  █    PtVisible
  26621.  ────────────────────────────────────────────────────────────────────────────
  26622.  
  26623.  int PtVisible  (hdc, pptl, hddc, ulFunN)
  26624.  
  26625.  HDC  hdc;                         /*handle of engine's device context */
  26626.  
  26627.  PPOINTL  pptl;                    /*pointer to POINTL structure */
  26628.  
  26629.  ULONG  hddc;                      /*handle of device driver's device
  26630.                                    context */
  26631.  
  26632.  ULONG  ulFunN;                    /*flags and function number */
  26633.  
  26634.  
  26635.  The PtVisible function checks whether a point is visible within the clipping
  26636.  region of the specified device context (where clipping region is defined to
  26637.  be the intersection of application clipping and clipping resulting from
  26638.  windowing).
  26639.  
  26640.  
  26641.  Parameters
  26642.  
  26643.  hdc  Identifies the engine's device context.
  26644.  
  26645.  pptl  Points to a POINTL structure that contains the coordinates of the
  26646.  point in world coordinates.
  26647.  
  26648.  hddc  Identifies the device driver's device context.
  26649.  
  26650.  ulFunN  Specifies the function number and a mask of various flags. The low
  26651.  word contains the function number; the high word contains a mask of flags,
  26652.  which may be set by the graphics programming interface (GPI), the engine, or
  26653.  a driver. For a description of these flags, see Section 7.1.1.
  26654.  
  26655.  
  26656.  Return Value
  26657.  
  26658.  The return value is PVIS_VISIBLE or PVIS_INVISIBLE if the function is
  26659.  successful or PVIS_ERROR if an error occurs.
  26660.  
  26661.  
  26662.  Errors
  26663.  
  26664.  If an error occurs during the execution of this function, the graphics
  26665.  engine or the device driver calls the WinSetErrorInfo function and records
  26666.  the associated error code. The following list contains possible error codes
  26667.  that the engine or the device driver calls record:
  26668.  
  26669.       PMERR_COORDINATE_OVERFLOW
  26670.       PMERR_DEV_FUNC_NOT_INSTALLED
  26671.       PMERR_HDC_BUSY
  26672.       PMERR_INV_COORD_SPACE
  26673.       PMERR_INV_COORDINATE
  26674.       PMERR_INV_HDC
  26675.       PMERR_INV_LENGTH_OR_COUNT
  26676.       PMERR_INV_RECT
  26677.  
  26678.  
  26679.  
  26680.  
  26681.  
  26682.  █    QueryBitmapHandle
  26683.  ────────────────────────────────────────────────────────────────────────────
  26684.  
  26685.  HBITMAP QueryBitmapHandle  (hdc, lcid, hddc, ulFunN)
  26686.  
  26687.  HDC  hdc;                         /*handle of engine's device context */
  26688.  
  26689.  LCID  lcid;                       /*local identifier */
  26690.  
  26691.  ULONG  hddc;                      /*handle of device driver's device
  26692.                                    context */
  26693.  
  26694.  ULONG  ulFunN;                    /*flags and function number */
  26695.  
  26696.  
  26697.  The QueryBitmapHandle function retrieves the bitmap handle for the specified
  26698.  local identifier or raises an error if the identifier does not reference a
  26699.  bitmap.
  26700.  
  26701.  
  26702.  Parameters
  26703.  
  26704.  hdc  Identifies the engine's device context.
  26705.  
  26706.  lcid  Specifies the local identifier for the bitmap.
  26707.  
  26708.  hddc  Identifies the device driver's device context.
  26709.  
  26710.  ulFunN  Specifies the function number and a mask of various flags. The low
  26711.  word contains the function number; the high word contains a mask of flags,
  26712.  which may be set by the graphics programming interface (GPI), the engine, or
  26713.  a driver. For a description of these flags, see Section 7.1.1.
  26714.  
  26715.  
  26716.  Return Value
  26717.  
  26718.  The return value is the bitmap handle if the function is successful;
  26719.  otherwise, it is zero.
  26720.  
  26721.  
  26722.  Errors
  26723.  
  26724.  If an error occurs during the execution of this function, the graphics
  26725.  engine calls the WinSetErrorInfo function and records the associated error
  26726.  code. The following list contains possible error codes that the engine may
  26727.  record:
  26728.  
  26729.       PMERR_BITMAP_NOT_SELECTED
  26730.       PMERR_HDC_BUSY
  26731.       PMERR_INV_HDC
  26732.       PMERR_INV_SETID
  26733.  
  26734.  
  26735.  
  26736.  
  26737.  
  26738.  █    QueryCharPositions
  26739.  ────────────────────────────────────────────────────────────────────────────
  26740.  
  26741.  ULONG QueryCharPositions  (hdc, pptlStart, flCmd, cch, pch, pdx,
  26742.  aptlCharPos, hddc, ulFunN)
  26743.  
  26744.  HDC  hdc;                         /*handle of engine's device context */
  26745.  
  26746.  PPOINTL  pptlStart;               /*pointer to POINTL structure */
  26747.  
  26748.  ULONG  flCmd;                     /*options */
  26749.  
  26750.  LONG  cch;                        /*count of characters */
  26751.  
  26752.  PCH  pch;                         /*pointer to character string */
  26753.  
  26754.  PLONG  pdx;                       /*pointer to array of vectors */
  26755.  
  26756.  PPOINTL  aptlCharPos;             /*pointer to array of POINTL structures
  26757.                                    */
  26758.  
  26759.  ULONG  hddc;                      /*handle of device driver's device
  26760.                                    context */
  26761.  
  26762.  ULONG  ulFunN;                    /*flags and function number */
  26763.  
  26764.  
  26765.  The QueryCharPositions function retrieves the positions in world coordinates
  26766.  at which the currently associated device will place each given character,
  26767.  taking into account kerning, extra space, etc.
  26768.  
  26769.  A starting position may optionally be specified.
  26770.  
  26771.  A vector of increments may optionally be specified, which allows control
  26772.  over the positioning of each character after the first. These distances are
  26773.  measured in world coordinates (along the baseline for left-to-right and
  26774.  right-to-left character directions, and along the shearline for
  26775.  top-to-bottom and bottom-to-top) and if specified, set the widths of each
  26776.  character. Any spacing called for by character spacing, character extra, or
  26777.  character-break extra is applied in addition to the widths specified by the
  26778.  vector.
  26779.  
  26780.  
  26781.  Parameters
  26782.  
  26783.  hdc  Identifies the engine's device context.
  26784.  
  26785.  pptlStart  Points to a POINTL structure that contains the starting position.
  26786.  
  26787.  
  26788.  flCmd  Specifies control flags. This parameter can be one of the following:
  26789.  
  26790.  
  26791.  Value                             Meaning
  26792.  ────────────────────────────────────────────────────────────────────────────
  26793.  
  26794.  CHS_VECTOR                        Use increment vectors. If this value is
  26795.                                    not given, do not use the increment
  26796.                                    vectors.
  26797.  
  26798.  CHS_START_XY                      Use the starting position. If this value
  26799.                                    is not given, use the current position.
  26800.  
  26801.  All other values are reserved.
  26802.  
  26803.  cch  Specifies the number of bytes in the character string.
  26804.  
  26805.  pch  Points to the string of character code points.
  26806.  
  26807.  pdx  Points to an array of vector increments. These are 4-byte signed
  26808.  integers in world coordinates.
  26809.  
  26810.  aptlCharPos  Points to an array of POINTL structures. The first element of
  26811.  the array contains the current position and the last contains the new
  26812.  current position.
  26813.  
  26814.  hddc  Identifies the device driver's device context.
  26815.  
  26816.  ulFunN  Specifies the function number and a mask of various flags. The low
  26817.  word contains the function number; the high word contains a mask of flags,
  26818.  which may be set by the graphics programming interface (GPI), the engine, or
  26819.  a driver. For a description of these flags, see Section 7.1.1.
  26820.  
  26821.  
  26822.  Return Value
  26823.  
  26824.  The return value is GPI_OK if the function is successful or GPI_ERROR if an
  26825.  error occurs.
  26826.  
  26827.  
  26828.  Errors
  26829.  
  26830.  If an error occurs during the execution of this function, the graphics
  26831.  engine or the device driver calls the WinSetErrorInfo function and records
  26832.  the associated error code. The following list contains possible error codes
  26833.  that the engine or the device driver calls record:
  26834.  
  26835.       PMERR_COORDINATE_OVERFLOW
  26836.       PMERR_DEV_FUNC_NOT_INSTALLED
  26837.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  26838.       PMERR_HDC_BUSY
  26839.       PMERR_INSUFFICIENT_MEMORY
  26840.       PMERR_INV_CHAR_ANGLE_ATTR
  26841.       PMERR_INV_CHAR_MODE_ATTR
  26842.       PMERR_INV_CHAR_POS_OPTIONS
  26843.       PMERR_INV_CODEPAGE
  26844.       PMERR_INV_COORD_SPACE
  26845.       PMERR_INV_HDC
  26846.       PMERR_INV_LENGTH_OR_COUNT
  26847.       PMERR_INV_MATRIX_ELEMENT
  26848.       PMERR_INV_SETID
  26849.       PMERR_INV_TRANSFORM_TYPE
  26850.  
  26851.  
  26852.  
  26853.  
  26854.  
  26855.  █    QueryClipRegion
  26856.  ────────────────────────────────────────────────────────────────────────────
  26857.  
  26858.  HRGN QueryClipRegion  (hdc, hddc, ulFunN)
  26859.  
  26860.  HDC  hdc;                         /*handle of engine's device context */
  26861.  
  26862.  ULONG  hddc;                      /*handle of device driver's device
  26863.                                    context */
  26864.  
  26865.  ULONG  ulFunN;                    /*flags and function number */
  26866.  
  26867.  
  26868.  The QueryClipRegion function retrieves the handle of the currently selected
  26869.  clip region.
  26870.  
  26871.  
  26872.  Parameters
  26873.  
  26874.  hdc  Identifies the engine's device context.
  26875.  
  26876.  hddc  Identifies the device driver's device context.
  26877.  
  26878.  ulFunN  Specifies the function number and a mask of various flags. The low
  26879.  word contains the function number; the high word contains a mask of flags,
  26880.  which may be set by the graphics programming interface (GPI), the engine, or
  26881.  a driver. For a description of these flags, see Section 7.1.1.
  26882.  
  26883.  
  26884.  Return Value
  26885.  
  26886.  The return value is the region handle if the function is successful, NULL if
  26887.  no region is selected, or HRGN_ERROR if an error occurs.
  26888.  
  26889.  
  26890.  Errors
  26891.  
  26892.  If an error occurs during the execution of this function, the graphics
  26893.  engine or the device driver calls the WinSetErrorInfo function and records
  26894.  the associated error code. The following list contains possible error codes
  26895.  that the engine or the device driver calls record:
  26896.  
  26897.       PMERR_HDC_BUSY
  26898.       PMERR_INV_HDC
  26899.  
  26900.  
  26901.  
  26902.  
  26903.  
  26904.  █    QueryCodePageVector
  26905.  ────────────────────────────────────────────────────────────────────────────
  26906.  
  26907.  ULONG QueryCodePageVector  (ulCodePage, hddc, ulFunN)
  26908.  
  26909.  ULONG  ulCodePage;                /*code page */
  26910.  
  26911.  ULONG  hddc;                      /*handle of device driver's device
  26912.                                    context */
  26913.  
  26914.  ULONG  ulFunN;                    /*flags and function number */
  26915.  
  26916.  
  26917.  The QueryCodePageVector function retrieves a pointer to a vector of 256
  26918.  words, which are the code-point-to-glyph mapping numbers.
  26919.  
  26920.  
  26921.  Parameters
  26922.  
  26923.  ulCodePage  the code page number.
  26924.  
  26925.  hddc  the device driver's device context.
  26926.  
  26927.  ulFunN  the function number and a mask of various flags. The low word
  26928.  contains the function number; the high word contains a mask of flags, which
  26929.  may be set by the graphics programming interface (GPI), the engine, or a
  26930.  driver. For a description of these flags, see Section 7.1.1.
  26931.  
  26932.  
  26933.  Return Value
  26934.  
  26935.  The return value is a pointer to code-page vector if the function is
  26936.  successful. Otherwise, it is zero.
  26937.  
  26938.  
  26939.  Errors
  26940.  
  26941.  If an error occurs during the execution of this function, the graphics
  26942.  engine calls the WinSetErrorInfo function and records the associated error
  26943.  code. The following list contains possible error codes that the engine may
  26944.  record:
  26945.  
  26946.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  26947.       PMERR_INSUFFICIENT_MEMORY
  26948.       PMERR_INV_CODEPAGE
  26949.  
  26950.  
  26951.  
  26952.  
  26953.  
  26954.  █    QueryColorData
  26955.  ────────────────────────────────────────────────────────────────────────────
  26956.  
  26957.  BOOL QueryColorData  (hdc, clColorData, alColorData, hddc, ulFunN)
  26958.  
  26959.  HDC  hdc;                         /*handle of engine's device context */
  26960.  
  26961.  LONG  clColorData;                /*count of color-data elements */
  26962.  
  26963.  PLONG  alColorData;               /*pointer to array of color data */
  26964.  
  26965.  ULONG  hddc;                      /*handle of device driver's device
  26966.                                    context */
  26967.  
  26968.  ULONG  ulFunN;                    /*flags and function number */
  26969.  
  26970.  
  26971.  The QueryColorData function retrieves information about the currently
  26972.  available color table and device colors. Default colors are not included in
  26973.  the loaded color index returned in the first and second elements of the
  26974.  color data array.
  26975.  
  26976.  
  26977.  Parameters
  26978.  
  26979.  hdc  the engine's device context.
  26980.  
  26981.  clColorData  the number of elements to copy to the color data array.
  26982.  
  26983.  alColorData  to the color data array. For more information, see "Comments."
  26984.  Information is returned only for the number of elements supplied. Any extra
  26985.  elements supplied are set to zero by the system.
  26986.  
  26987.  hddc  the device driver's device context.
  26988.  
  26989.  ulFunN  the function number and a mask of various flags. The low word
  26990.  contains the function number; the high word contains a mask of flags, which
  26991.  may be set by the graphics programming interface (GPI), the engine, or a
  26992.  driver. For a description of these flags, see Section 7.1.1.
  26993.  
  26994.  
  26995.  Return Value
  26996.  
  26997.  The return value is TRUE if the function is successful or FALSE if an error
  26998.  occurs.
  26999.  
  27000.  
  27001.  Errors
  27002.  
  27003.  If an error occurs during the execution of this function, the graphics
  27004.  engine calls the WinSetErrorInfo function and records the associated error
  27005.  code. The following list contains possible error codes that the engine may
  27006.  record:
  27007.  
  27008.       PMERR_DEV_FUNC_NOT_INSTALLED
  27009.       PMERR_INV_HDC
  27010.       PMERR_INV_LENGTH_OR_COUNT
  27011.  
  27012.  
  27013.  
  27014.  
  27015.  
  27016.  Comments
  27017.  
  27018.  The color data array pointed to by alColorData has the following elements:
  27019.  
  27020.  Index                             Description
  27021.  ────────────────────────────────────────────────────────────────────────────
  27022.  
  27023.  QCD_LCT_FORMAT                    Specifies the format of the loaded color
  27024.                                    table. This format can be one of the
  27025.                                    following:
  27026.  
  27027.  
  27028.  
  27029.  Value                             Meaning
  27030.  ────────────────────────────────────────────────────────────────────────────
  27031.  
  27032.  LCOLF_DEFAULT                     Default color table is in effect. (0)
  27033.  
  27034.  LCOLF_INDRGB                      Color table loaded that translates from
  27035.                                    index to RGB. (1)
  27036.  
  27037.  LCOLF_RGB                         Color index = RGB. (3)
  27038.  
  27039.  .LI "QCD_LCT_LOINDEX" Specifies the smallest color index loaded in the color
  27040.  table. This value will always be 0. .LI "QCD_LCT_HIINDEX" Specifies the
  27041.  largest color index in the color table. This value will never be less than
  27042.  15.
  27043.  
  27044.  
  27045.  █    QueryColorIndex
  27046.  ────────────────────────────────────────────────────────────────────────────
  27047.  
  27048.  LONG QueryColorIndex  (hdc, flCmd, clr, hddc, ulFunN)
  27049.  
  27050.  HDC  hdc;                         /*handle of engine's device context */
  27051.  
  27052.  ULONG  flCmd;                     /*options */
  27053.  
  27054.  COLOR  clr;                       /*RGB color value */
  27055.  
  27056.  ULONG  hddc;                      /*handle of device driver's device
  27057.                                    context */
  27058.  
  27059.  ULONG  ulFunN;                    /*flags and function number */
  27060.  
  27061.  
  27062.   The QueryColorIndex function retrieves a color table index or an RGB
  27063.  value. If a device context contains a color table, the function returns the
  27064.  color table index for a device color that is closest to the color specified
  27065.  by the clr parameter. If a device context does not contain a color
  27066.  table─that is, if the RGB mode is set─the function returns clr.
  27067.  
  27068.  
  27069.  Parameters
  27070.  
  27071.  hdc  the engine's device context.
  27072.  
  27073.  flCmd  various options. If this value is LCOLOPT_REALIZED, the function
  27074.  returns the color index for a color in a realized color table. If this value
  27075.  is zero, the function returns the color index for a color in the current
  27076.  logical color table. All other values are reserved.
  27077.  
  27078.  clr  an RGB color value.
  27079.  
  27080.  hddc  the device driver's device context.
  27081.  
  27082.  ulFunN  the function number and a mask of various flags. The low word
  27083.  contains the function number; the high word contains a mask of flags, which
  27084.  may be set by the graphics programming interface (GPI), the engine, or a
  27085.  driver. For a description of these flags, see Section 7.1.1.
  27086.  
  27087.  
  27088.  Return Value
  27089.  
  27090.  The return value is the color index providing the closest match to the
  27091.  specified color if the function is successful. Otherwise, it is
  27092.  GPI_ALTERROR.
  27093.  
  27094.  
  27095.  Errors
  27096.  
  27097.  If an error occurs during the execution of this function, the device driver
  27098.  calls the WinSetErrorInfo function and records the associated error code.
  27099.  The following list contains possible error codes that the device driver may
  27100.  record:
  27101.  
  27102.       PMERR_DEV_FUNC_NOT_INSTALLED
  27103.       PMERR_INV_COLOR_OPTIONS
  27104.       PMERR_INV_HDC
  27105.       PMERR_INV_RGBCOLOR
  27106.  
  27107.  
  27108.  
  27109.  
  27110.  
  27111.  █    QueryDeviceBitmaps
  27112.  ────────────────────────────────────────────────────────────────────────────
  27113.  
  27114.  BOOL QueryDeviceBitmaps  (hdc, abmf, clBitmapFormats, hddc, ulFunN)
  27115.  
  27116.  HDC  hdc;                         /*handle of engine's device context */
  27117.  
  27118.  PBITMAPFORMAT  abmf;              /*pointer to array of BITMAPFORMAT
  27119.                                    structures */
  27120.  
  27121.  LONG  clBitmapFormats;            /*count of bitmap formats */
  27122.  
  27123.  ULONG  hddc;                      /*handle of device driver's device
  27124.                                    context */
  27125.  
  27126.  ULONG  ulFunN;                    /*flags and function number */
  27127.  
  27128.  
  27129.  The QueryDeviceBitmaps function retrieves a list of device bitmap formats
  27130.  supported by the CreateBitmap function. The number of formats supported can
  27131.  be found by calling the QueryDeviceCaps function.
  27132.  
  27133.  The format at the start of the returned list is that which most closely
  27134.  matches the device's bitmap format.
  27135.  
  27136.  The data is returned in the array pointed to by the abmf parameter. Unused
  27137.  array elements are cleared to zero.
  27138.  
  27139.  
  27140.  Parameters
  27141.  
  27142.  hdc  Identifies the engine's device context.
  27143.  
  27144.  abmf  Points to an array of BITMAPFORMAT structures. Each structure receives
  27145.  the data for one bitmap format. The structure has the following form:
  27146.  
  27147.  typedef struct _BITMAPFORMAT { /* bmf */
  27148.      ULONG cPlanes;
  27149.      ULONG cBitCount;
  27150.  } BITMAPFORMAT;
  27151.  
  27152.  
  27153.  clBitmapFormats  Specifies the number of elements in the array pointed to by
  27154.  abmf.
  27155.  
  27156.  hddc  Identifies the device driver's device context.
  27157.  
  27158.  ulFunN  Specifies the function number and a mask of various flags. The low
  27159.  word contains the function number; the high word contains a mask of flags,
  27160.  which may be set by the graphics programming interface (GPI), the engine, or
  27161.  a driver. For a description of these flags, see Section 7.1.1.
  27162.  
  27163.  
  27164.  Return Value
  27165.  
  27166.  The return value is TRUE if the function is successful or FALSE if an error
  27167.  occurs.
  27168.  
  27169.  
  27170.  Errors
  27171.  
  27172.  If an error occurs during the execution of this function, the device driver
  27173.  calls the WinSetErrorInfo function and records the associated error code.
  27174.  The following list contains possible error codes that the device driver may
  27175.  record:
  27176.  
  27177.       PMERR_DEV_FUNC_NOT_INSTALLED
  27178.       PMERR_INV_LENGTH_OR_COUNT
  27179.  
  27180.  
  27181.  
  27182.  
  27183.  
  27184.  █    QueryDeviceCaps
  27185.  ────────────────────────────────────────────────────────────────────────────
  27186.  
  27187.  BOOL QueryDeviceCaps  (hdc, lIndex, alData, clData, hddc, ulFunN)
  27188.  
  27189.  HDC  hdc;                         /*handle of engine's device context */
  27190.  
  27191.  LONG  lIndex;                     /*starting index */
  27192.  
  27193.  PLONG  alData;                    /*pointer to buffer for capabilities */
  27194.  
  27195.  LONG  clData;                     /*number of bytes in buffer */
  27196.  
  27197.  ULONG  hddc;                      /*device driver's device context */
  27198.  
  27199.  ULONG  ulFunN;                    /*flags and function number */
  27200.  
  27201.  
  27202.  The QueryDeviceCaps function returns information about the capabilities of a
  27203.  specified device. If the lIndex and clData parameters reference an undefined
  27204.  capability, the function returns zero for that element. This is not an
  27205.  error.
  27206.  
  27207.  
  27208.  Parameters
  27209.  
  27210.  hdc  the engine's device context.
  27211.  
  27212.  lIndex  the index number of the first item of information to be returned in
  27213.  alData. The first element is number 1.
  27214.  
  27215.  alData  to an array of 32-bit integers. It must have at least clData
  27216.  elements. Each element receives a capability. For more information about
  27217.  capabilities, see "Comments."
  27218.  
  27219.  clData  the number of items of information to be returned in the array
  27220.  specified by alData. This must be greater than zero; otherwise, an error
  27221.  will be logged.
  27222.  
  27223.  hddc  the device driver's device context.
  27224.  
  27225.  ulFunN  the function number and a mask of various flags. The low word
  27226.  contains the function number; the high word contains a mask of flags, which
  27227.  may be set by the graphics programming interface (GPI), the engine, or a
  27228.  driver. For a description of these flags, see Section 7.1.1.
  27229.  
  27230.  
  27231.  Return Value
  27232.  
  27233.  The return value is TRUE if the function is successful or FALSE if an error
  27234.  occurs.
  27235.  
  27236.  
  27237.  Errors
  27238.  
  27239.  If an error occurs during the execution of this function, the device driver
  27240.  calls the WinSetErrorInfo function and records the associated error code.
  27241.  The following is a possible error code that the device driver may record:
  27242.  
  27243.       PMERR_DEV_FUNC_NOT_INSTALLED
  27244.  
  27245.  
  27246.  
  27247.  
  27248.  
  27249.  Comments
  27250.  
  27251.  There are the following device capabilities:
  27252.  
  27253.  CAPS_FAMILY  the device family (the values are the same as for the type
  27254.  parameter in DevOpenDC/OpenDC).
  27255.  
  27256.  CAPS_IO_CAPS  device input/output capability. This value can be one of the
  27257.  following:
  27258.  
  27259.  Value                             Meaning
  27260.  ────────────────────────────────────────────────────────────────────────────
  27261.  
  27262.  CAPS_IO_DUMMY                     Dummy device (1)
  27263.  
  27264.  CAPS_IO_SUPPORTS_OP               Device supports output (2)
  27265.  
  27266.  CAPS_IO_SUPPORTS_IP               Device supports input (3)
  27267.  
  27268.  CAPS_IO_SUPPORTS_IO               Device supports output and input (4)
  27269.  
  27270.  CAPS_TECHNOLOGY  the display technology. This value can be one of the
  27271.  following:
  27272.  
  27273.  Value                             Meaning.
  27274.  ────────────────────────────────────────────────────────────────────────────
  27275.  
  27276.  CAPS_TECH_UNKNOWN                 Unknown (for example, metafile) (0)
  27277.  
  27278.  CAPS_TECH_VECTOR_PLOTTER          Vector plotter (1)
  27279.  
  27280.  CAPS_TECH_RASTER_DISPLAY          Raster display (2)
  27281.  
  27282.  CAPS_TECH_RASTER_PRINTER          Raster printer (3)
  27283.  
  27284.  CAPS_TECH_RASTER_CAMERA           Raster camera (4)
  27285.  
  27286.  CAPS_DRIVER_VERSION  the device driver version number.
  27287.  
  27288.  CAPS_HEIGHT  the default page depth (for a full-screen maximized window for
  27289.  displays) in display points (pels). (For a plotter, a display point or pel
  27290.  is defined as the smallest possible displacement of the pen and can be
  27291.  smaller than a pen width.)
  27292.  
  27293.  CAPS_WIDTH  the default page width (for a full-screen maximized window for
  27294.  displays) in display points.
  27295.  
  27296.  CAPS_HEIGHT_IN_CHARS  the default page depth (for a full-screen maximized
  27297.  window for displays) in character rows.
  27298.  
  27299.  CAPS_WIDTH_IN_CHARS  the default page width (for a full-screen maximized
  27300.  window for displays) in character columns.
  27301.  
  27302.  CAPS_VERTICAL_RESOLUTION  the vertical resolution of the device in display
  27303.  points (pels) per meter for displays, and plotter units per meter for
  27304.  plotters.
  27305.  
  27306.  CAPS_HORIZONTAL_RESOLUTION  the horizontal resolution of the device in
  27307.  display points (pels) per meter for displays, and plotter units per meter
  27308.  for plotters.
  27309.  
  27310.  CAPS_CHAR_HEIGHT  the default character-box height in display points (pels).
  27311.  
  27312.  
  27313.  CAPS_CHAR_WIDTH  the default character-box width in display points (pels).
  27314.  
  27315.  CAPS_SMALL_CHAR_HEIGHT  the default small character-box height in display
  27316.  points (pels). This number is zero if there is only one character-box size).
  27317.  
  27318.  
  27319.  CAPS_SMALL_CHAR_WIDTH  the default small character-box width in display
  27320.  points (pels). This number is zero if there is only one character-box size).
  27321.  
  27322.  
  27323.  CAPS_COLORS  the number of distinct colors supported at the same time,
  27324.  including background colors (gray scales count as distinct colors). If
  27325.  loadable color tables are supported, this value is the number of entries in
  27326.  the device color table. For plotters, the returned value is the number of
  27327.  pens plus 1 (for the background color).
  27328.  
  27329.  CAPS_COLOR_PLANES  the number of color planes.
  27330.  
  27331.  CAPS_COLOR_BITCOUNT  the number of adjacent color bits for each pel (within
  27332.  one plane).
  27333.  
  27334.  CAPS_COLOR_TABLE_SUPPORT  loadable color-table support. This value can be
  27335.  one of the following:
  27336.  
  27337.  Value                             Meaning
  27338.  ────────────────────────────────────────────────────────────────────────────
  27339.  
  27340.  CAPS_COLTABL_RGB_8                RGB color table can be loaded, with a
  27341.                                    minimum support of 8 bits each for red
  27342.                                    green and blue. (1)
  27343.  
  27344.  CAPS_COLTABL_RGB_8_PLUS           Color table with other than 8 bits for
  27345.                                    each primary can be loaded. (2)
  27346.  
  27347.  CAPS_COLTABL_TRUE_MIX             Mixing will occur when the logical color
  27348.                                    table has been realized, if the size of
  27349.                                    the logical color table is not greater
  27350.                                    than the number of distinct colors
  27351.                                    supported (see CAPS_COLORS). (4)
  27352.  
  27353.  CAPS_COLTABL_REALIZE              Loaded color table can be realized. (8)
  27354.  
  27355.  CAPS_MOUSE_BUTTONS  the number of mouse or tablet buttons that are available
  27356.  to the application. A returned value of zero indicates that there are no
  27357.  mouse or tablet buttons available.
  27358.  
  27359.  CAPS_FOREGROUND_MIX_SUPPORT  foreground mix-mode support. This value can be
  27360.  a combination of the following:
  27361.  
  27362.  Value                             Meaning
  27363.  ────────────────────────────────────────────────────────────────────────────
  27364.  
  27365.  CAPS_FM_OR                        OR (1)
  27366.  
  27367.  CAPS_FM_OVERPAINT                 Overpaint (2)
  27368.  
  27369.  CAPS_FM_XOR                       Exclusive-OR (8)
  27370.  
  27371.  CAPS_FM_LEAVEALONE                Leave-alone (16)
  27372.  
  27373.  CAPS_FM_AND                       AND (32)
  27374.  
  27375.  CAPS_FM_GENERAL_BOOLEAN           Mixes 7 through 17 (64)
  27376.  
  27377.  The value returned is the sum of the values appropriate to the mix modes
  27378.  supported. A device capable of supporting OR must, as a minimum, return 1 +
  27379.  2 + 16 = 19, signifying support for the mandatory mix modes OR, overpaint
  27380.  and leave-alone.
  27381.  
  27382.  Note that these numbers correspond to the decimal representation of a bit
  27383.  string that is seven bits long, with each bit set to 1 if the appropriate
  27384.  mode is supported.
  27385.  
  27386.  Those mix modes returned as supported are guaranteed for all primitive
  27387.  types.
  27388.  
  27389.  CAPS_BACKGROUND_MIX_SUPPORT  background mix-mode support. This value can be
  27390.  a combination of the following:
  27391.  
  27392.  Value                             Meaning
  27393.  ────────────────────────────────────────────────────────────────────────────
  27394.  
  27395.  CAPS_BM_OR                        OR (1)
  27396.  
  27397.  CAPS_BM_OVERPAINT                 Overpaint (2)
  27398.  
  27399.  CAPS_BM_XOR                       Exclusive-OR (8)
  27400.  
  27401.  CAPS_BM_LEAVEALONE                Leave-alone (16)
  27402.  
  27403.  The value returned is the sum of the values appropriate to the mix modes
  27404.  supported. A device must, as a minimum, return 2 + 16 = 18, signifying
  27405.  support for the mandatory background mix modes overpaint, and leave-alone.
  27406.  
  27407.  Note that these numbers correspond to the decimal representation of a bit
  27408.  string that is five bits long, with each bit set to 1 if the appropriate
  27409.  mode is supported.
  27410.  
  27411.  Those mix modes returned as supported are guaranteed for all primitive
  27412.  types.
  27413.  
  27414.  CAPS_VIO_LOADABLE_FONTS  the number of logical fonts that may be created for
  27415.  alphanumerics.
  27416.  
  27417.  CAPS_WINDOW_BYTE_ALIGNMENT  whether the client area of Vio windows should be
  27418.  byte-aligned. This value can be the following:
  27419.  
  27420.  Value                             Meaning
  27421.  ────────────────────────────────────────────────────────────────────────────
  27422.  
  27423.  CAPS_BYTE_ALIGN_REQUIRED          Must be byte-aligned. (0)
  27424.  
  27425.  CAPS_BYTE_ALIGN_RECOMMENDED       More efficient if byte-aligned, but not
  27426.                                    required. (1)
  27427.  
  27428.  CAPS_BYTE_ALIGN_NOT_REQUIRED      Does not matter whether byte-aligned. (2)
  27429.  
  27430.  CAPS_BITMAP_FORMATS  the number of bitmap formats supported by the device.
  27431.  
  27432.  
  27433.  CAPS_RASTER_CAPS  the device's raster-operations capability. This value can
  27434.  be one of the following:
  27435.  
  27436.  Value                             Meaning
  27437.  ────────────────────────────────────────────────────────────────────────────
  27438.  
  27439.  CAPS_RASTER_BITBLT                Bitblt is supported. (1)
  27440.  
  27441.  CAPS_RASTER_BANDING               The device supports banding. (2)
  27442.  
  27443.  CAPS_RASTER_BITBLT_SCALING        Bitblt with scaling is supported. (4)
  27444.  
  27445.  CAPS_RASTER_SET_PEL               SetPel is supported. (16)
  27446.  
  27447.  CAPS_MARKER_HEIGHT  the default marker-box width in pels.
  27448.  
  27449.  CAPS_MARKER_WIDTH  the default marker-box depth in pels.
  27450.  
  27451.  CAPS_DEVICE_FONTS  the number of device specific fonts.
  27452.  
  27453.  CAPS_GRAPHICS_SUBSET  the graphics drawing subset that is supported.
  27454.  
  27455.  CAPS_GRAPHICS_VERSION  the graphics architecture version number that is
  27456.  supported (1 indicates version 1).
  27457.  
  27458.  CAPS_GRAPHICS_VECTOR_SUBSET  the graphics vector drawing subset that is
  27459.  supported.
  27460.  
  27461.  CAPS_DEVICE_WINDOWING  device windowing support. If this value is 1, the
  27462.  device supports windowing. Other bits are reserved and must be zero.
  27463.  
  27464.  CAPS_ADDITIONAL_GRAPHICS  additional graphics support. This value can be the
  27465.  following:
  27466.  
  27467.  Value                             Meaning
  27468.  ────────────────────────────────────────────────────────────────────────────
  27469.  
  27470.  CAPS_GRAPHICS_KERNING_SUPPORT     Device supports kerning. (2)
  27471.  
  27472.  CAPS_FONT_OUTLINE_DEFAULT         Driver can supply default outline font.
  27473.                                    (4) .
  27474.  
  27475.  CAPS_FONT_IMAGE_DEFAULT           Driver can supply default image font. (8)
  27476.  
  27477.  CAPS_FONT_OUTLINE_MANAGE          Driver will manage default outline font.
  27478.                                    (16)
  27479.  
  27480.  CAPS_FONT_IMAGE_MANAGE            Driver will manage default image font.
  27481.                                    (32)
  27482.  
  27483.   Two fonts will be bound to the engine: an image font and an outline
  27484.  font. These will be used if the driver does not want to supply one or both
  27485.  of these. In addition, if the driver wants to supply default fonts but not
  27486.  manage them, the engine will do so (the driver gives the engine the font
  27487.  selector, and the engine does all the necessary mapping, transforming,
  27488.  etc.).
  27489.  
  27490.  Other bits are reserved and must be zero.
  27491.  
  27492.  CAPS_PHYS_COLORS  the maximum number of distinct colors that can be
  27493.  specified on the device.
  27494.  
  27495.  CAPS_COLOR_INDEX  the maximum logical color table index supported for this
  27496.  device. This value must be at lease 7. For EGA and VGA adapters, the value
  27497.  is 63.
  27498.  
  27499.  
  27500.  █    QueryDeviceNames
  27501.  ────────────────────────────────────────────────────────────────────────────
  27502.  
  27503.  BOOL QueryDeviceNames  (pszDriverName, pcDevices, pszDeviceNames,
  27504.  pszDeviceDescs, pcDataTypes,                               pszDataTypes,
  27505.  hddc, ulFunN) .V "PSZ " "pszDriverName;" "pointer to driver name
  27506.  
  27507.  PLONG  pcDevices;                 /*pointer to count of device names */
  27508.  
  27509.  PSTR32  pszDeviceNames;           /*pointer to device names */
  27510.  
  27511.  PSTR64  pszDeviceDescs;           /*pointer to device descriptions */
  27512.  
  27513.  PLONG  pcDataTypes;               /*pointer to count of data types */
  27514.  
  27515.  PSTR16  pszDataTypes;             /*pointer to data-type names */
  27516.  
  27517.  ULONG  hddc;                      /*handle of device driver's device
  27518.                                    context */
  27519.  
  27520.  ULONG  ulFunN;                    /*flags and function number */
  27521.  
  27522.  
  27523.  The QueryDeviceNames function retrieves the names of the devices supported
  27524.  by the specified driver, their corresponding descriptions, and the data
  27525.  types the driver supports. ("IBM4201" is an example of a device name, "IBM
  27526.  4201 Proprinter" is an example of a device description, and "PM_Q_STD" is an
  27527.  example of a data type.)
  27528.  
  27529.  
  27530.  Parameters
  27531.  
  27532.  pszDriverName  to a null-terminated string containing the name of the device
  27533.  driver.
  27534.  
  27535.  pcDevices  to a count specifying the maximum number of device names and
  27536.  descriptions that can be retrieved. There must be the same number of
  27537.  descriptions as names. If pcDevices is zero, the count is updated to the
  27538.  actual number of devices supported and pszDeviceNames and pszDeviceDescs are
  27539.  not updated. If pcDevices is nonzero, the count is updated to the actual
  27540.  number of device names retrieved and pszDeviceNames and pszDeviceDescs are
  27541.  updated.
  27542.  
  27543.  pszDeviceNames  to an array of null-terminated strings identifying the
  27544.  particular devices (model numbers, etc). Valid names are defined by device
  27545.  drivers.
  27546.  
  27547.  pszDeviceDescs  to an array of null-terminated strings describing the
  27548.  particular devices.
  27549.  
  27550.  pcDataTypes  to a count specifying the maximum number of data types that can
  27551.  be retrieved. If pcDataTypes is zero, the count is updated to the number of
  27552.  data types supported and pszDataTypes is not updated. If pcDataTypes is
  27553.  nonzero, the count is updated to the number of data types actually retrieved
  27554.  and pszDataTypes is updated.
  27555.  
  27556.  pszDataTypes  to an array of null-terminated strings identifying the data
  27557.  types. Valid data types are defined by device drivers.
  27558.  
  27559.  hddc  the device driver's device context.
  27560.  
  27561.  ulFunN  the function number and a mask of various flags. The low word
  27562.  contains the function number; the high word contains a mask of flags, which
  27563.  may be set by the graphics programming interface (GPI), the engine, or a
  27564.  driver. For a description of these flags, see Section 7.1.1.
  27565.  
  27566.  
  27567.  Return Value
  27568.  
  27569.  The return value is TRUE if the function is successful or FALSE if an error
  27570.  occurs.
  27571.  
  27572.  
  27573.  Errors
  27574.  
  27575.  If an error occurs during the execution of this function, the graphics
  27576.  engine calls the WinSetErrorInfo function and records the associated error
  27577.  code. The following list contains possible error codes that the engine may
  27578.  record:
  27579.  
  27580.       PMERR_BASE_ERROR
  27581.       PMERR_INV_LENGTH_OR_COUNT
  27582.  
  27583.  
  27584.  
  27585.  
  27586.  
  27587.  Comment
  27588.  
  27589.  The application can call the QueryDeviceNames function with pcDataTypes and
  27590.  pszDataTypes set to zero to determine how much storage is needed for the
  27591.  data areas. After allocating the storage, the application again calls the
  27592.  function to retrieve the data.
  27593.  
  27594.  
  27595.  █    QueryDevResource
  27596.  ────────────────────────────────────────────────────────────────────────────
  27597.  
  27598.  short QueryDevResource  (hdc, ulType, idRes, hddc, ulFunN)
  27599.  
  27600.  HDC  hdc;                         /*handle of engine's device context */
  27601.  
  27602.  ULONG  ulType;                    /*resource type */
  27603.  
  27604.  ULONG  idRes;                     /*resource identifier */
  27605.  
  27606.  ULONG  hddc;                      /*handle of device driver's device
  27607.                                    context */
  27608.  
  27609.  ULONG  ulFunN;                    /*flags and function number */
  27610.  
  27611.  
  27612.  The QueryDevResource function is called by a user at setup time to load all
  27613.  pointers and bitmaps and by the engine to load the default fonts, if any.
  27614.  
  27615.  
  27616.  Parameters
  27617.  
  27618.  hdc  Identifies the engine's device context.
  27619.  
  27620.  ulType  Specifies the resource type.
  27621.  
  27622.  idRes  Specifies the resource identifier.
  27623.  
  27624.  hddc  Identifies the device driver's device context.
  27625.  
  27626.  ulFunN  Specifies the function number and a mask of various flags. The low
  27627.  word contains the function number; the high word contains a mask of flags,
  27628.  which may be set by the graphics programming interface (GPI), the engine, or
  27629.  a driver. For a description of these flags, see Section 7.1.1.
  27630.  
  27631.  
  27632.  Return Value
  27633.  
  27634.  The return value is a resource selector if the function is successful, zero
  27635.  if the resource is not available, or GPI_ALTERROR if an error occurs.
  27636.  
  27637.  
  27638.  Errors
  27639.  
  27640.  If an error occurs during the execution of this function, the device driver
  27641.  calls the WinSetErrorInfo function and records the associated error code.
  27642.  The following list contains possible error codes that the device driver may
  27643.  record:
  27644.  
  27645.       PMERR_BASE_ERROR
  27646.       PMERR_DEV_FUNC_NOT_INSTALLED
  27647.  
  27648.  
  27649.  
  27650.  
  27651.  
  27652.  Comments
  27653.  
  27654.  The following resources are accessed through this function:
  27655.  
  27656.      RT_POINTER  1       SPTR_ARROW          1
  27657.      RT_POINTER  1       SPTR_TEXT           2
  27658.      RT_POINTER  1       SPTR_WAIT           3
  27659.      RT_POINTER  1       SPTR_SIZE           4
  27660.      RT_POINTER  1       SPTR_MOVE           5
  27661.      RT_POINTER  1       SPTR_SIZENWSE       6
  27662.      RT_POINTER  1       SPTR_SIZENESW       7
  27663.      RT_POINTER  1       SPTR_SIZEWE         8
  27664.      RT_POINTER  1       SPTR_SIZENS         9
  27665.      RT_POINTER  1       SPTR_APPICON        10
  27666.      RT_POINTER  1       SPTR_HANDICON       11
  27667.      RT_POINTER  1       SPTR_QUESICON       12
  27668.      RT_POINTER  1       SPTR_BANGICON       13
  27669.      RT_POINTER  1       SPTR_NOTEICON       14
  27670.  
  27671.  
  27672.      RT_POINTER  1       SPTR_ILLEGAL        18
  27673.      RT_POINTER  1       SPTR_FILE           19
  27674.      RT_POINTER  1       SPTR_FOLDER         20
  27675.      RT_POINTER  1       SPTR_MULTFILE       21
  27676.      RT_POINTER  1       SPTR_PROGRAM        22
  27677.  
  27678.  
  27679.      RT_BITMAP   2       SBMP_SYSMENU        1
  27680.      RT_BITMAP   2       SBMP_SBUPARROW      2
  27681.      RT_BITMAP   2       SBMP_SBDNARROW      3
  27682.      RT_BITMAP   2       SBMP_SBRGARROW      4
  27683.      RT_BITMAP   2       SBMP_SBLFARROW      5
  27684.      RT_BITMAP   2       SBMP_MENUCHECK      6
  27685.      RT_BITMAP   2       SBMP_CHECKBOXES     7
  27686.      RT_BITMAP   2       SBMP_BTNCORNERS     8
  27687.      RT_BITMAP   2       SBMP_MINBUTTON      9
  27688.      RT_BITMAP   2       SBMP_MAXBUTTON      10
  27689.      RT_BITMAP   2       SBMP_RESTOREBUTTON  11
  27690.      RT_BITMAP   2       SBMP_CHILDSYSMENU   12
  27691.      RT_BITMAP   2       SBMP_DRIVE          15
  27692.      RT_BITMAP   2       SBMP_FILE           16
  27693.      RT_BITMAP   2       SBMP_FOLDER         17
  27694.      RT_BITMAP   2       SBMP_TREEPLUS       18
  27695.      RT_BITMAP   2       SBMP_TREEMINUS      19
  27696.      RT_BITMAP   2       SBMP_PROGRAM        22
  27697.  
  27698.      FONT        1000    SFONT_RASTER        100
  27699.      FONT        1000    SFONT_OUTLINE       101
  27700.  
  27701.  
  27702.  
  27703.  
  27704.  
  27705.  █    QueryEngineVersion
  27706.  ────────────────────────────────────────────────────────────────────────────
  27707.  
  27708.  LONG QueryEngineVersion  (hddc, ulFunN)
  27709.  
  27710.  ULONG  hddc;                      /*handle of device driver's device
  27711.                                    context */
  27712.  
  27713.  ULONG  ulFunN;                    /*flags and function number */
  27714.  
  27715.  
  27716.  The QueryEngineVersion function returns the version number for the engine.
  27717.  
  27718.  
  27719.  Parameters
  27720.  
  27721.  hddc  Identifies the device driver's device context.
  27722.  
  27723.  ulFunN  Specifies the function number and a mask of various flags. The low
  27724.  word contains the function number; the high word contains a mask of flags,
  27725.  which may be set by the graphics programming interface (GPI), the engine, or
  27726.  a driver. For a description of these flags, see Section 7.1.1.
  27727.  
  27728.  
  27729.  Return Value
  27730.  
  27731.  The return value if the function is successful is a pointer to the version
  27732.  number of the engine, or zero for the initial version of the engine.
  27733.  Otherwise, the return value is GPI_ALTERROR.
  27734.  
  27735.  
  27736.  Errors
  27737.  
  27738.  If an error occurs during the execution of this function, the graphics
  27739.  engine calls the WinSetErrorInfo function and records the associated error
  27740.  code.
  27741.  
  27742.  
  27743.  █    QueryFontAttributes
  27744.  ────────────────────────────────────────────────────────────────────────────
  27745.  
  27746.  BOOL QueryFontAttributes  (hdc, cbfm, pfm, hddc, ulFunN)
  27747.  
  27748.  HDC  hdc;                         /*handle of engine's device context */
  27749.  
  27750.  LONG  cbfm;                       /*count of font metrics */
  27751.  
  27752.  PFONTMETRICS  pfm;                /*pointer to FONTMETRICS structure */
  27753.  
  27754.  ULONG  hddc;                      /*handle of device driver's device
  27755.                                    context */
  27756.  
  27757.  ULONG  ulFunN;                    /*flags and function number */
  27758.  
  27759.  
  27760.  The QueryFontAttributes function obtains the metrics of the font currently
  27761.  selected by the SetCharSet function.
  27762.  
  27763.  
  27764.  Parameters
  27765.  
  27766.  hdc  Identifies the engine's device context.
  27767.  
  27768.  cbfm  Specifies the length of the font-metrics buffer pointed to by the pfm
  27769.  parameter.
  27770.  
  27771.  pfm  Points to a FONTMETRICS structure to contain the information retrieved.
  27772.  
  27773.  
  27774.  hddc  Identifies the device driver's device context.
  27775.  
  27776.  ulFunN  Specifies the function number and a mask of various flags. The low
  27777.  word contains the function number; the high word contains a mask of flags,
  27778.  which may be set by the graphics programming interface (GPI), the engine, or
  27779.  a driver. For a description of these flags, see Section 7.1.1.
  27780.  
  27781.  
  27782.  Return Value
  27783.  
  27784.  The return value is TRUE if the function is successful or FALSE if an error
  27785.  occurs.
  27786.  
  27787.  
  27788.  Errors
  27789.  
  27790.  If an error occurs during the execution of this function, the graphics
  27791.  engine calls the WinSetErrorInfo function and records the associated error
  27792.  code. The following list contains possible error codes that the engine may
  27793.  record:
  27794.  
  27795.       PMERR_COORDINATE_OVERFLOW
  27796.       PMERR_DEV_FUNC_NOT_INSTALLED
  27797.       PMERR_HDC_BUSY
  27798.       PMERR_INV_COORD_SPACE
  27799.       PMERR_INV_HDC
  27800.       PMERR_INV_LENGTH_OR_COUNT
  27801.       PMERR_INV_SETID
  27802.  
  27803.  
  27804.  
  27805.  
  27806.  
  27807.  Comment
  27808.  
  27809.  This function will log an error (PMERR_COORDINATE_OVERFLOW) if the operation
  27810.  cannot be performed because the matrix is singular.
  27811.  
  27812.  
  27813.  █    QueryFontFileDescriptions
  27814.  ────────────────────────────────────────────────────────────────────────────
  27815.  
  27816.  ULONG QueryFontFileDescriptions  (pszFilename, pcFonts, pffdescs, hddc,
  27817.  ulFunN)
  27818.  
  27819.  PSZ  pszFilename;                 /*pointer to filename */
  27820.  
  27821.  PLONG  pcFonts;                   /*pointer to count of fonts */
  27822.  
  27823.  PFFDESCS  pffdescs;               /*pointer to font descriptions */
  27824.  
  27825.  ULONG  hddc;                      /*handle of device driver's device
  27826.                                    context */
  27827.  
  27828.  ULONG  ulFunN;                    /*flags and function number */
  27829.  
  27830.  
  27831.  The QueryFontFileDescriptions function retrieves the family and face names
  27832.  for the fonts contained in the specified file if it is a font-resource file.
  27833.  
  27834.  
  27835.  
  27836.  Parameters
  27837.  
  27838.  pszFilename  Points to a null-terminated string containing the name of the
  27839.  font-resource file.
  27840.  
  27841.  pcFonts  Points to a count of the maximum number of family-name and
  27842.  face-name pairs to be retrieved in the array pointed to by pffdescs. On
  27843.  return, this count is updated to the actual number of name pairs retrieved.
  27844.  
  27845.  pffdescs  Points to an array of (2*pcFonts) 32-bit fields in which the
  27846.  family-name and face-name pairs for each font are returned, with the family
  27847.  name first in each pair.
  27848.  
  27849.  hddc  Identifies the device driver's device context.
  27850.  
  27851.  ulFunN  Specifies the function number and a mask of various flags. The low
  27852.  word contains the function number; the high word contains a mask of flags,
  27853.  which may be set by the graphics programming interface (GPI), the engine, or
  27854.  a driver. For a description of these flags, see Section 7.1.1.
  27855.  
  27856.  
  27857.  Return Value
  27858.  
  27859.  The return value is a count of the number of fonts for which details were
  27860.  not retrieved (maximum specified minus actual) if the function is
  27861.  successful. Otherwise, it is GPI_ALTERROR.
  27862.  
  27863.  
  27864.  Errors
  27865.  
  27866.  If an error occurs during the execution of this function, the graphics
  27867.  engine calls the WinSetErrorInfo function and records the associated error
  27868.  code. The following list contains possible error codes that the engine may
  27869.  record:
  27870.  
  27871.       PMERR_BASE_ERROR
  27872.       PMERR_INV_FONT_FILE_DATA
  27873.  
  27874.  
  27875.  
  27876.  
  27877.  
  27878.  Comment
  27879.  
  27880.  The application can call the QueryFontFileDescriptions function with pcFonts
  27881.  set to zero to determine how much storage is needed for the font
  27882.  descriptions. After allocating the storage, the application calls the
  27883.  function again to retrieve the data.
  27884.  
  27885.  
  27886.  █    QueryFonts
  27887.  ────────────────────────────────────────────────────────────────────────────
  27888.  
  27889.  LONG QueryFonts  (hdc, flCmd, pszFaceName, afm, cbfm, pcFonts, hddc, ulFunN)
  27890.  
  27891.  HDC  hdc;                         /*handle of engine's device context */
  27892.  
  27893.  ULONG  flCmd;                     /*options */
  27894.  
  27895.  PSZ  pszFaceName;                 /*pointer to face name */
  27896.  
  27897.  PFONTMETRICS  afm;                /*pointer to array of FONTMETRICS
  27898.                                    structures */
  27899.  
  27900.  LONG  cbfm;                       /*count of font metrics */
  27901.  
  27902.  PLONG  pcFonts;                   /*pointer to count of fonts */
  27903.  
  27904.  ULONG  hddc;                      /*handle of device driver's device
  27905.                                    context */
  27906.  
  27907.  ULONG  ulFunN;                    /*flags and function number */
  27908.  
  27909.  
  27910.  The QueryFonts function retrieves details about the fonts that match the
  27911.  specified face name. Public, private, or both public and private fonts can
  27912.  be specified.
  27913.  
  27914.  
  27915.  Parameters
  27916.  
  27917.  hdc  the engine's device context.
  27918.  
  27919.  flCmd  whether information about public, private, or both public and private
  27920.  fonts should be retrieved. The following values are valid:
  27921.  
  27922.  Value                             Meaning
  27923.  ────────────────────────────────────────────────────────────────────────────
  27924.  
  27925.  QFF_PUBLIC                        Enumerate public fonts.
  27926.  
  27927.  QFF_PRIVATE                       Enumerate private fonts.
  27928.  
  27929.  pszFaceName  to a null-terminated string containing a valid (non-NULL) face
  27930.  name. (If this is a NULL pointer, all faces are matched.)
  27931.  
  27932.  afm  to an array of FONTMETRICS structures in which the metrics of matching
  27933.  fonts are returned. The format of each element is as described for the
  27934.  QueryFontAttributes function, except that the usCodePage field, which has no
  27935.  meaning in this context, is set to zero. No more than cbfm bytes are
  27936.  retrieved for any one font, and the number of fonts retrieved is limited to
  27937.  the value specified by pcFonts.
  27938.  
  27939.  cbfm  the length of each FONTMETRICS structure in the afm array.
  27940.  
  27941.  pcFonts  to a count specifying the number of fonts for which the application
  27942.  wants metrics. On return, this count is updated to the actual number of
  27943.  fonts for which metrics are retrieved.
  27944.  
  27945.  hddc  the device driver's device context.
  27946.  
  27947.  ulFunN  the function number and a mask of various flags. The low word
  27948.  contains the function number; the high word contains a mask of flags, which
  27949.  may be set by the graphics programming interface (GPI), the engine, or a
  27950.  driver. For a description of these flags, see Section 7.1.1.
  27951.  
  27952.  
  27953.  Return Value
  27954.  
  27955.  The return value is the number of fonts not retrieved (maximum specified
  27956.  minus actual) if the function is successful. Otherwise, the return value is
  27957.  GPI_ALTERROR.
  27958.  
  27959.  
  27960.  Errors
  27961.  
  27962.  If an error occurs during the execution of this function, the graphics
  27963.  engine calls the WinSetErrorInfo function and records the associated error
  27964.  code. The following list contains possible error codes that the engine may
  27965.  record:
  27966.  
  27967.       PMERR_COORDINATE_OVERFLOW
  27968.       PMERR_DEV_FUNC_NOT_INSTALLED
  27969.       PMERR_HDC_BUSY
  27970.       PMERR_INV_COORD_SPACE
  27971.       PMERR_INV_HDC
  27972.       PMERR_INV_LENGTH_OR_COUNT
  27973.       PMERR_INV_OR_INCOMPAT_OPTIONS
  27974.  
  27975.  
  27976.  
  27977.  
  27978.  
  27979.  Comments
  27980.  
  27981.  By inspecting the retrieved data, the application can choose which of the
  27982.  available fonts is most appropriate for its requirements. If necessary, it
  27983.  can force selection of a particular font.
  27984.  
  27985.  The application can call the QueryFonts function with pcFonts set to zero to
  27986.  determine how many fonts match the face name.
  27987.  
  27988.  All sizes are returned in world coordinates.
  27989.  
  27990.  This function will log an error (PMERR_COORDINATE_OVERFLOW) if the operation
  27991.  cannot be performed because the matrix is singular.
  27992.  
  27993.  
  27994.  █    QueryHardcopyCaps
  27995.  ────────────────────────────────────────────────────────────────────────────
  27996.  
  27997.  LONG QueryHardcopyCaps  (hdc, lStart, chci, phci, hddc, ulFunN)
  27998.  
  27999.  HDC  hdc;                         /*handle of engine's device context */
  28000.  
  28001.  LONG  lStart;                     /*first forms-code number */
  28002.  
  28003.  LONG  chci;                       /*count of form codes */
  28004.  
  28005.  PHCINFO  phci;                    /*pointer to HCINFO structure */
  28006.  
  28007.  ULONG  hddc;                      /*handle of device driver's device
  28008.                                    context */
  28009.  
  28010.  ULONG  ulFunN;                    /*flags and function number */
  28011.  
  28012.  
  28013.  The QueryHardcopyCaps function retrieves information about the hard-copy
  28014.  capabilities of the specified device.
  28015.  
  28016.  
  28017.  Parameters
  28018.  
  28019.  hdc  the engine's device context.
  28020.  
  28021.  lStart  the form-code number the query is to start from, where the first
  28022.  available form code is designated as 0.
  28023.  
  28024.  chci  the number of forms the query is to cover. Thus, if there are five
  28025.  form codes defined, lStart is 2, and chci is 3, the query covers form codes
  28026.  2, 3, and 4. If chci is zero, the count is updated to the number of form
  28027.  codes defined and phci is not updated. If chci is nonzero, the count is
  28028.  updated to the number of form codes for which information was retrieved and
  28029.  phci is updated.
  28030.  
  28031.  phci  to a buffer containing the results of the query in chci copies of the
  28032.  following structure:
  28033.  
  28034.  typedef struct _HCINFO {
  28035.      CHAR szformname[32];
  28036.      LONG cx;
  28037.      LONG cy;
  28038.      LONG xLeftClip;
  28039.      LONG yBottomClip;
  28040.      LONG xRightClip;
  28041.      LONG yTopClip;
  28042.      LONG xPels;
  28043.      LONG yPels;
  28044.      LONG flAttributes;
  28045.  } HCINFO  ;
  28046.  
  28047.  
  28048.  hddc  the device driver's device context.
  28049.  
  28050.  ulFunN  the function number and a mask of various flags. The low word
  28051.  contains the function number; the high word contains a mask of flags, which
  28052.  may be set by the graphics programming interface (GPI), the engine, or a
  28053.  driver. For a description of these flags, see Section 7.1.1.
  28054.  
  28055.  
  28056.  Return Value
  28057.  
  28058.  
  28059.  
  28060.  The return value if the function is successful is the number of forms for
  28061.  which information was retrieved, or if chci is zero, the number of forms
  28062.  available. Otherwise, the return value is GPI_ALTERROR.
  28063.  
  28064.  
  28065.  Errors
  28066.  
  28067.  If an error occurs during the execution of this function, the device driver
  28068.  calls the WinSetErrorInfo function and records the associated error code.
  28069.  The following is a possible error code that the device driver may record:
  28070.  
  28071.       PMERR_DEV_FUNC_NOT_INSTALLED
  28072.  
  28073.  
  28074.  
  28075.  
  28076.  
  28077.  Comment
  28078.  
  28079.  The lStart and chci parameters can be used together to determine the number
  28080.  of forms available without having to allocate a buffer large enough to hold
  28081.  information on them all.
  28082.  
  28083.  
  28084.  █    QueryLogColorTable
  28085.  ────────────────────────────────────────────────────────────────────────────
  28086.  
  28087.  LONG QueryLogColorTable  (hdc, flCmd, lStart, clColorData, alColorData,
  28088.  hddc, ulFunN)
  28089.  
  28090.  HDC  hdc;                         /*handle of engine's device context */
  28091.  
  28092.  ULONG  flCmd;                     /*options */
  28093.  
  28094.  LONG  lStart;                     /*first color index */
  28095.  
  28096.  LONG  clColorData;                /*count of color data */
  28097.  
  28098.  PLONG  alColorData;               /*pointer to buffer for color data */
  28099.  
  28100.  ULONG  hddc;                      /*handle of device driver's device
  28101.                                    context */
  28102.  
  28103.  ULONG  ulFunN;                    /*flags and function number */
  28104.  
  28105.  
  28106.  The QueryLogColorTable function retrieves the logical colors of the
  28107.  currently associated device, one at a time.
  28108.  
  28109.  
  28110.  Parameters
  28111.  
  28112.  hdc  the engine's device context.
  28113.  
  28114.  flCmd  the options. If flCmd is LCOLOPT_INDEX, the index is also retrieved
  28115.  for each RGB value. Other values are reserved.
  28116.  
  28117.  lStart  the starting index for which data is to be retrieved.
  28118.  
  28119.  clColorData  the number of elements available in the array pointed to by
  28120.  alColorData. If flCmd is LCOLOPT_INDEX, this number is the total number of
  28121.  index values plus the total number of RGB values. (The number of index
  28122.  values is always equivalent to the total number of RGB values.)
  28123.  
  28124.  alColorData  to an array in which the information is returned. If flCmd is
  28125.  LCOLOPT_INDEX, the array consists of alternating color indices and RGB
  28126.  values, in the order index1, RGB1, index2, RGB2, and so on. If flCmd is
  28127.  LCOLOPT_INDEX and the logical color table is not loaded with a contiguous
  28128.  set of indices, any index values not loaded are simply skipped.
  28129.  
  28130.  If flCmd is not LCOLOPT_INDEX, the array consists of color values only (each
  28131.  value is as defined for the CreateLogColorTable function), starting from the
  28132.  specified index and ending either when there are no further loaded entries
  28133.  in the table or when the number of entries specified by clColorData have
  28134.  been retrieved. If flCmd is not LCOLOPT_INDEX and the logical color table is
  28135.  not loaded with a contiguous set of indices, QLCT_NOTLOADED(-1) is returned
  28136.  as the color value for any index value not loaded.
  28137.  
  28138.  hddc  the device driver's device context.
  28139.  
  28140.  ulFunN  the function number and a mask of various flags. The low word
  28141.  contains the function number; the high word contains a mask of flags, which
  28142.  may be set by the graphics programming interface (GPI), the engine, or a
  28143.  driver. For a description of these flags, see Section 7.1.1.
  28144.  
  28145.  
  28146.  Return Value
  28147.  
  28148.  The return value if the function is successful is the number of elements
  28149.  retrieved, or QLCT_RGB if the color table is in RGB mode and no elements are
  28150.  retrieved. Otherwise, the return value is QLCT_ERROR.
  28151.  
  28152.  
  28153.  Errors
  28154.  
  28155.  If an error occurs during the execution of this function, the device driver
  28156.  calls the WinSetErrorInfo function and records the associated error code.
  28157.  The following list contains possible error codes that the device driver may
  28158.  record:
  28159.  
  28160.       PMERR_DEV_FUNC_NOT_INSTALLED
  28161.       PMERR_INV_COLOR_OPTIONS
  28162.       PMERR_INV_COLOR_START_INDEX
  28163.       PMERR_INV_HDC
  28164.       PMERR_INV_LENGTH_OR_COUNT
  28165.  
  28166.  
  28167.  
  28168.  
  28169.  
  28170.  █    QueryLogicalFont
  28171.  ────────────────────────────────────────────────────────────────────────────
  28172.  
  28173.  BOOL QueryLogicalFont  (hdc, lcid, pchName, pfat, cbFontAttrs, hddc, ulFunN)
  28174.  
  28175.  HDC  hdc;                         /*handle of engine's device context */
  28176.  
  28177.  LCID  lcid;                       /*local identifier */
  28178.  
  28179.  PSTR8  pchName;                   /*pointer to logical name */
  28180.  
  28181.  PFATTRS  pfat;                    /*pointer to FATTRS structure */
  28182.  
  28183.  LONG  cbFontAttrs;                /*count of font attributes */
  28184.  
  28185.  ULONG  hddc;                      /*handle of device driver's device
  28186.                                    context */
  28187.  
  28188.  ULONG  ulFunN;                    /*flags and function number */
  28189.  
  28190.  
  28191.  The QueryLogicalFont function retrieves the font attributes for the
  28192.  specified logical font.
  28193.  
  28194.  
  28195.  Parameters
  28196.  
  28197.  hdc  the engine's device context.
  28198.  
  28199.  lcid  the local identifier of the required logical font.
  28200.  
  28201.  pchName  to an 8-character name used to describe the logical font.
  28202.  
  28203.  pfat  to a FATTRS structure specified in the CreateLogicalFont function.
  28204.  
  28205.  cbFontAttrs  the number of bytes of font-attribute information to be
  28206.  retrieved (the font may become larger in the future).
  28207.  
  28208.  hddc  the device driver's device context.
  28209.  
  28210.  ulFunN  the function number and a mask of various flags. The low word
  28211.  contains the function number; the high word contains a mask of flags, which
  28212.  may be set by the graphics programming interface (GPI), the engine, or a
  28213.  driver. For a description of these flags, see Section 7.1.1.
  28214.  
  28215.  
  28216.  Return Value
  28217.  
  28218.  The return value is TRUE if the function is successful or FALSE if an error
  28219.  occurs.
  28220.  
  28221.  
  28222.  Errors
  28223.  
  28224.  If an error occurs during the execution of this function, the device driver
  28225.  calls the WinSetErrorInfo function and records the associated error code.
  28226.  The following list contains possible error codes that the device driver may
  28227.  record:
  28228.  
  28229.       PMERR_HDC_BUSY
  28230.       PMERR_INV_HDC
  28231.       PMERR_INV_LENGTH_OR_COUNT
  28232.       PMERR_INV_SETID
  28233.  
  28234.  
  28235.  
  28236.  
  28237.  
  28238.  Comments
  28239.  
  28240.  Local identifiers -2, -3, and -4 represent advanced video input-and-output
  28241.  (AVIO) lcids 1, 2, and 3, respectively. It is the function of the engine to
  28242.  perform the remapping between these values and 1, 2, and 3 for the device
  28243.  driver.
  28244.  
  28245.  If the specified lcid is in use for a bitmap, QueryLogicalFont returns an
  28246.  error.
  28247.  
  28248.  
  28249.  █    QueryNearestColor
  28250.  ────────────────────────────────────────────────────────────────────────────
  28251.  
  28252.  LONG QueryNearestColor  (hdc, flCmd, clr, hddc, ulFunN)
  28253.  
  28254.  HDC  hdc;                         /*handle of engine's device context */
  28255.  
  28256.  ULONG  flCmd;                     /*options */
  28257.  
  28258.  COLOR  clr;                       /*RGB color value */
  28259.  
  28260.  ULONG  hddc;                      /*handle of device driver's device
  28261.                                    context */
  28262.  
  28263.  ULONG  ulFunN;                    /*flags and function number */
  28264.  
  28265.  
  28266.  The QueryNearestColor function returns the RGB color in the physical palette
  28267.  that most closely matches the specified RGB color, even if the returned
  28268.  color is not available in the logical color table.
  28269.  
  28270.  
  28271.  Parameters
  28272.  
  28273.  hdc  Identifies the engine's device context.
  28274.  
  28275.  flCmd  Specifies the options. If flCmd is LCOLOPT_REALIZED, the nearest
  28276.  color is determined as if the logical color table were realized. Other
  28277.  values are reserved.
  28278.  
  28279.  clr  Specifies the required color.
  28280.  
  28281.  hddc  Identifies the device driver's device context.
  28282.  
  28283.  ulFunN  Specifies the function number and a mask of various flags. The low
  28284.  word contains the function number; the high word contains a mask of flags,
  28285.  which may be set by the graphics programming interface (GPI), the engine, or
  28286.  a driver. For a description of these flags, see Section 7.1.1.
  28287.  
  28288.  
  28289.  Return Value
  28290.  
  28291.  If the function is successful, the return value is the nearest RGB value to
  28292.  that specified by clr. Otherwise, it is GPI_ALTERROR.
  28293.  
  28294.  
  28295.  Errors
  28296.  
  28297.  If an error occurs during the execution of this function, the graphics
  28298.  engine calls the WinSetErrorInfo function and records the associated error
  28299.  code. The following list contains possible error codes that the engine may
  28300.  record:
  28301.  
  28302.       PMERR_DEV_FUNC_NOT_INSTALLED
  28303.       PMERR_INV_COLOR_OPTIONS
  28304.       PMERR_INV_HDC
  28305.       PMERR_INV_RGBCOLOR
  28306.  
  28307.  
  28308.  
  28309.  
  28310.  
  28311.  Comments
  28312.  
  28313.  The color returned is that value that would be used for the drawing of
  28314.  lines, text, and so on, and does not take account of the possibility of
  28315.  dithered colors being used for filled areas. With dithering, it is likely
  28316.  that the color used for the filling of areas will be different from that
  28317.  used for lines, text, and so on, when the same color is specified.
  28318.  
  28319.  The algorithm for determining the "nearest" color is as follows:
  28320.  
  28321.  Imagine a cube, treating one corner as the origin and the three edges
  28322.  leaving it as the R, G, and B axes. Call this "RGB space." Any color is
  28323.  simply a point in RGB space. For example, moving up the R axis means
  28324.  increasing RED intensity; the different intensities of CYAN run along the
  28325.  line B = G.
  28326.  
  28327.  
  28328.  █    QueryNumberSetIds
  28329.  ────────────────────────────────────────────────────────────────────────────
  28330.  
  28331.  LONG QueryNumberSetIds  (hdc, ulLcidRange, hddc, ulFunN)
  28332.  
  28333.  HDC  hdc;                         /*handle of engine's device context */
  28334.  
  28335.  ULONG  ulLcidRange;               /*range of local identifiers */
  28336.  
  28337.  ULONG  hddc;                      /*handle of device driver's device
  28338.                                    context */
  28339.  
  28340.  ULONG  ulFunN;                    /*flags and function number */
  28341.  
  28342.  
  28343.  The QueryNumberSetIds function returns the total number of logical-font and
  28344.  bitmap identifiers (local identifiers, or lcids) that have been loaded.
  28345.  
  28346.  
  28347.  Parameters
  28348.  
  28349.  hdc  Identifies the engine's device context.
  28350.  
  28351.  ulLcidRange  Specifies whether to query graphics-programming-interface (GPI)
  28352.  lcids, advanced video input-and-output (AVIO) lcids, or both. This value can
  28353.  be one of the following:
  28354.  
  28355.  Value                             Meaning
  28356.  ────────────────────────────────────────────────────────────────────────────
  28357.  
  28358.  LCID_RANGE_GPI                    Query GPI lcids.
  28359.  
  28360.  LCID_RANGE_AVIO                   Query AVIO lcids.
  28361.  
  28362.  LCID_RANGE_BOTH                   Query both GPI and AVIO lcids.
  28363.  
  28364.  hddc  Identifies the device driver's device context.
  28365.  
  28366.  ulFunN  Specifies the function number and a mask of various flags. The low
  28367.  word contains the function number; the high word contains a mask of flags,
  28368.  which may be set by GPI, the engine, or a driver. For a description of these
  28369.  flags, see Section 7.1.1.
  28370.  
  28371.  
  28372.  Return Value
  28373.  
  28374.  The return value is the number of lcids if the function is successful.
  28375.  Otherwise, it is LCID_ERROR.
  28376.  
  28377.  
  28378.  Errors
  28379.  
  28380.  If an error occurs during the execution of this function, the graphics
  28381.  engine calls the WinSetErrorInfo function and records the associated error
  28382.  code. The following list contains possible error codes that the engine may
  28383.  record:
  28384.  
  28385.       PMERR_HDC_BUSY
  28386.       PMERR_INV_HDC
  28387.       PMERR_INV_SETID
  28388.       PMERR_INV_SETID_TYPE
  28389.  
  28390.  
  28391.  
  28392.  
  28393.  
  28394.  Comment
  28395.  
  28396.  The local identifiers -2, -3, and -4 represent AVIO lcids 1, 2, and 3,
  28397.  respectively. It is the function of the engine to perform the remapping
  28398.  between these values and 1, 2, and 3 for the device driver.
  28399.  
  28400.  
  28401.  █    QueryRealColors
  28402.  ────────────────────────────────────────────────────────────────────────────
  28403.  
  28404.  LONG QueryRealColors  (hdc, flCmd, lStart, clColorData, alColorData, hddc,
  28405.  ulFunN)
  28406.  
  28407.  HDC  hdc;                         /*handle of engine's device context */
  28408.  
  28409.  ULONG  flCmd;                     /*options */
  28410.  
  28411.  LONG  lStart;                     /*first color index */
  28412.  
  28413.  LONG  clColorData;                /*count of color data */
  28414.  
  28415.  PLONG  alColorData;               /*pointer to buffer for color data */
  28416.  
  28417.  ULONG  hddc;                      /*handle of device driver's device
  28418.                                    context */
  28419.  
  28420.  ULONG  ulFunN;                    /*flags and function number */
  28421.  
  28422.  
  28423.  The QueryRealColors function retrieves RGB values associated with the colors
  28424.  in a physical palette.
  28425.  
  28426.  
  28427.  Parameters
  28428.  
  28429.  hdc  the engine's device context.
  28430.  
  28431.  flCmd  the options. If the LCOLOPT_REALIZED option is specified, the color
  28432.  information is determined as if the logical color table were realized. If
  28433.  the LCOLOPT_INDEX option is specified, a color index is returned for each
  28434.  RGB value. Other values are reserved.
  28435.  
  28436.  lStart  the ordinal number of the first color required. To start the
  28437.  sequence, this would be 0. Note that this number does not necessarily bear
  28438.  any relationship to the color index; the order in which the colors are
  28439.  returned is not defined.
  28440.  
  28441.  clColorData  the number of elements available in the array pointed to by
  28442.  alColorData.
  28443.  
  28444.  alColorData  to an array in which the information is returned. If
  28445.  LCOLOPT_INDEX is specified, this is an array of alternating color indices
  28446.  and RGB values in the order index1, RGB1, index2, RGB2, and so on. If there
  28447.  is a color table, colors not in the table but available on the device have a
  28448.  special index of CLR_NOINDEX (-254) when LCOLOPT_INDEX is specified. In RGB
  28449.  mode when LCOLOPT_INDEX is specified, the RGB value appears in the index
  28450.  field. If LCOLOPT_INDEX is not specified, this is an array of color values
  28451.  (each value is as defined for the CreateLogColorTable function).
  28452.  
  28453.  hddc  the device driver's device context.
  28454.  
  28455.  ulFunN  the function number and a mask of various flags. The low word
  28456.  contains the function number; the high word contains a mask of flags, which
  28457.  may be set by the graphics programming interface (GPI), the engine, or a
  28458.  driver. For a description of these flags, see Section 7.1.1.
  28459.  
  28460.  
  28461.  Return Value
  28462.  
  28463.  If the function is successful, the return value is the number of elements
  28464.  retrieved. Otherwise, it is GPI_ALTERROR.
  28465.  
  28466.  
  28467.  Errors
  28468.  
  28469.  If an error occurs during the execution of this function, the device driver
  28470.  calls the WinSetErrorInfo function and records the associated error code.
  28471.  The following list contains possible error codes that the device driver may
  28472.  record:
  28473.  
  28474.       PMERR_DEV_FUNC_NOT_INSTALLED
  28475.       PMERR_INV_COLOR_OPTIONS
  28476.       PMERR_INV_COLOR_START_INDEX
  28477.       PMERR_INV_HDC
  28478.       PMERR_INV_LENGTH_OR_COUNT
  28479.  
  28480.  
  28481.  
  28482.  
  28483.  
  28484.  █    QueryRGBColor
  28485.  ────────────────────────────────────────────────────────────────────────────
  28486.  
  28487.  LONG QueryRGBColor  (hdc, flCmd, clr, hddc, ulFunN)
  28488.  
  28489.  HDC  hdc;                         /*handle of engine's device context */
  28490.  
  28491.  ULONG  flCmd;                     /*options */
  28492.  
  28493.  COLOR  clr;                       /*color index */
  28494.  
  28495.  ULONG  hddc;                      /*handle of device driver's device
  28496.                                    context */
  28497.  
  28498.  ULONG  ulFunN;                    /*flags and function number */
  28499.  
  28500.  
  28501.  The QueryRGBColor function returns the RGB color in the physical palette
  28502.  that corresponds to the specified color index. If the logical color table
  28503.  was created using the LCOLF_RGB option, the QueryRGBColor function is
  28504.  identical to the QueryNearestColor function.
  28505.  
  28506.  
  28507.  Parameters
  28508.  
  28509.  hdc  Identifies the engine's device context.
  28510.  
  28511.  flCmd  Specifies the options. If LCOLOPT_REALIZED is specified, the color
  28512.  information is determined as if the logical color table were realized. Since
  28513.  realizing a logical color table affects the contents of the physical
  28514.  palette, the RGB color value returned with this option may be different from
  28515.  the value returned without it. If LCOLOPT_INDEX is specified, the actual RGB
  28516.  color originally specified for this index is returned. Other values are
  28517.  reserved.
  28518.  
  28519.  clr  Specifies the index of the required color.
  28520.  
  28521.  hddc  Identifies the device driver's device context.
  28522.  
  28523.  ulFunN  Specifies the function number and a mask of various flags. The low
  28524.  word contains the function number; the high word contains a mask of flags,
  28525.  which may be set by the graphics programming interface (GPI), the engine, or
  28526.  a driver. For a description of these flags, see Section 7.1.1.
  28527.  
  28528.  
  28529.  Return Value
  28530.  
  28531.  The return value is the nearest available RGB color to that specified if the
  28532.  function is successful. Otherwise, it is GPI_ALTERROR.
  28533.  
  28534.  
  28535.  Errors
  28536.  
  28537.  If an error occurs during the execution of this function, the device driver
  28538.  calls the WinSetErrorInfo function and records the associated error code.
  28539.  The following list contains possible error codes that the device driver may
  28540.  record:
  28541.  
  28542.       PMERR_DEV_FUNC_NOT_INSTALLED
  28543.       PMERR_INV_COLOR_DATA
  28544.       PMERR_INV_COLOR_INDEX
  28545.       PMERR_INV_COLOR_OPTIONS
  28546.       PMERR_INV_HDC
  28547.  
  28548.  
  28549.  
  28550.  
  28551.  
  28552.  Comment
  28553.  
  28554.  The special negative color indices -1, -2, -4, and -5 are valid inputs to
  28555.  this query and correspond, respectively, to CLR_BLACK, CLR_WHITE, CLR_TRUE,
  28556.  and CLR_FALSE; -3 (CLR_DEFAULT) is invalid and returns an error.
  28557.  
  28558.  
  28559.  █    QuerySetIds
  28560.  ────────────────────────────────────────────────────────────────────────────
  28561.  
  28562.  BOOL QuerySetIds  (hdc, clcid, alTypes, pchNames, alcid, ulLcidRange, hddc,
  28563.  ulFunN)
  28564.  
  28565.  HDC  hdc;                         /*handle of engine's device context */
  28566.  
  28567.  LONG  clcid;                      /*count of local identifiers */
  28568.  
  28569.  PLONG  alTypes;                   /*pointer to buffer for types */
  28570.  
  28571.  PSTR8  pchNames;                  /*pointer to array of names */
  28572.  
  28573.  PLCID  alcid;                     /*pointer to array of local identifiers
  28574.                                    */
  28575.  
  28576.  ULONG  ulLcidRange;               /*range of local identifiers */
  28577.  
  28578.  ULONG  hddc;                      /*handle of device driver's device
  28579.                                    context */
  28580.  
  28581.  ULONG  ulFunN;                    /*flags and function number */
  28582.  
  28583.  
  28584.  The QuerySetIds function retrieves a list of types, names, and local
  28585.  identifiers (lcids) for all current logical fonts and tagged bitmaps.
  28586.  
  28587.  
  28588.  Parameters
  28589.  
  28590.  hdc  the engine's device context.
  28591.  
  28592.  clcid  the number of objects to retrieve. If there are fewer than clcid
  28593.  loaded lcids, the remaining types and lcids are set to zero.
  28594.  
  28595.  alTypes  to an array of clcid elements in which to retrieve the lcid types.
  28596.  Each element can be one of the following values:
  28597.  
  28598.  Value                             Meaning
  28599.  ────────────────────────────────────────────────────────────────────────────
  28600.  
  28601.  LCIDT_FONT                        Logical font
  28602.  
  28603.  LCIDT_BITMAP                      Bitmap
  28604.  
  28605.  pchNames  to an array in which to retrieve the 8-character names associated
  28606.  with the corresponding lcids. For a bitmap, the name field is filled with
  28607.  zeros.
  28608.  
  28609.  alcid  to an array of clcid elements in which to retrieve the lcids.
  28610.  
  28611.  ulLcidRange  whether to retrieve graphics-programming-interface (GPI) lcids,
  28612.  advanced video input-and-output (AVIO) lcids, or both. This value can be one
  28613.  of the following:
  28614.  
  28615.  Value                             Meaning
  28616.  ────────────────────────────────────────────────────────────────────────────
  28617.  
  28618.  LCID_RANGE_GPI                    Query GPI lcids.
  28619.  
  28620.  LCID_RANGE_AVIO                   Query AVIO lcids.
  28621.  
  28622.  LCID_RANGE_BOTH                   Query both GPI and AVIO lcids.
  28623.  
  28624.  hddc  the device driver's device context.
  28625.  
  28626.  ulFunN  the function number and a mask of various flags. The low word
  28627.  contains the function number; the high word contains a mask of flags, which
  28628.  may be set by GPI, the engine, or a driver. For a description of these
  28629.  flags, see Section 7.1.1.
  28630.  
  28631.  
  28632.  Return Value
  28633.  
  28634.  The return value is TRUE if the function is successful or FALSE if an error
  28635.  occurs.
  28636.  
  28637.  
  28638.  Errors
  28639.  
  28640.  If an error occurs during the execution of this function, the graphics
  28641.  engine calls the WinSetErrorInfo function and records the associated error
  28642.  code. The following list contains possible error codes that the engine may
  28643.  record:
  28644.  
  28645.       PMERR_HDC_BUSY
  28646.       PMERR_INV_HDC
  28647.       PMERR_INV_LENGTH_OR_COUNT
  28648.       PMERR_INV_SETID
  28649.       PMERR_INV_SETID_TYPE
  28650.  
  28651.  
  28652.  
  28653.  
  28654.  
  28655.  Comment
  28656.  
  28657.  Local identifiers -2, -3, and -4 represent AVIO lcids 1, 2, and 3,
  28658.  respectively. It is the function of the engine to perform the remapping
  28659.  between these values and 1, 2, and 3 for the device driver.
  28660.  
  28661.  
  28662.  █    QueryTextBox
  28663.  ────────────────────────────────────────────────────────────────────────────
  28664.  
  28665.  BOOL QueryTextBox  (hdc, cch, pch, cptlTextBox, aptlTextBox, hddc, ulFunN)
  28666.  
  28667.  HDC  hdc;                         /*handle of engine's device context */
  28668.  
  28669.  LONG  cch;                        /*count of characters */
  28670.  
  28671.  PCH  pch;                         /*pointer to character string */
  28672.  
  28673.  LONG  cptlTextBox;                /*count of points */
  28674.  
  28675.  PPOINTL  aptlTextBox;             /*pointer to array of POINTL structures
  28676.                                    */
  28677.  
  28678.  ULONG  hddc;                      /*handle of device driver's device
  28679.                                    context */
  28680.  
  28681.  ULONG  ulFunN;                    /*flags and function number */
  28682.  
  28683.  
  28684.  The QueryTextBox function retrieves the text-box and concatenation points
  28685.  for the specified string, using the current character attributes, in an
  28686.  array of up to five points. The first four points are the coordinates of the
  28687.  top-left, bottom-left, top-right, and bottom-right corners of the
  28688.  parallelogram that encompasses the string when it is drawn on the associated
  28689.  device. The fifth point is the concatenation point─that is, the position at
  28690.  which a subsequent string must be drawn if it is to follow smoothly. The
  28691.  points on the borders of the parallelogram are considered to be within the
  28692.  parallelogram.
  28693.  
  28694.  
  28695.  Parameters
  28696.  
  28697.  hdc  the engine's device context.
  28698.  
  28699.  cch  the number of bytes in the character string.
  28700.  
  28701.  pch  to the string of character code points.
  28702.  
  28703.  cptlTextBox  the number of points to be retrieved in the array pointed to by
  28704.  aptlTextBox. If this value is TXT_COUNT, the function retrieves the maximum
  28705.  number of points for the text box.
  28706.  
  28707.  aptlTextBox  to an array of POINTL structures to contain the points. The
  28708.  elements in this array are defined as follows:
  28709.  
  28710.  Value                             Meaning
  28711.  ────────────────────────────────────────────────────────────────────────────
  28712.  
  28713.  TXTBOX_TOPLEFT                    Upper-left corner
  28714.  
  28715.  TXTBOX_BOTTOMLEFT                 Lower-left corner
  28716.  
  28717.  TXTBOX_TOPRIGHT                   Upper-left corner
  28718.  
  28719.  TXTBOX_BOTTOMRIGHT                Lower-right corner
  28720.  
  28721.  TXTBOX_CONCAT                     Concatenation point
  28722.  
  28723.  hddc  the device driver's device context.
  28724.  
  28725.  ulFunN  the function number and a mask of various flags. The low word
  28726.  contains the function number; the high word contains a mask of flags, which
  28727.  may be set by the graphics programming interface (GPI), the engine, or a
  28728.  driver. For a description of these flags, see Section 7.1.1.
  28729.  
  28730.  
  28731.  Return Value
  28732.  
  28733.  The return value is TRUE if the function is successful or FALSE if an error
  28734.  occurs.
  28735.  
  28736.  
  28737.  Errors
  28738.  
  28739.  If an error occurs during the execution of this function, the graphics
  28740.  engine or the device driver calls the WinSetErrorInfo function and records
  28741.  the associated error code. The following list contains possible error codes
  28742.  that the engine or the device driver calls record:
  28743.  
  28744.       PMERR_COORDINATE_OVERFLOW
  28745.       PMERR_DEV_FUNC_NOT_INSTALLED
  28746.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  28747.       PMERR_HDC_BUSY
  28748.       PMERR_INSUFFICIENT_MEMORY
  28749.       PMERR_INV_CHAR_ANGLE_ATTR
  28750.       PMERR_INV_CHAR_MODE_ATTR
  28751.       PMERR_INV_CODEPAGE
  28752.       PMERR_INV_COORD_SPACE
  28753.       PMERR_INV_HDC
  28754.       PMERR_INV_LENGTH_OR_COUNT
  28755.       PMERR_INV_MATRIX_ELEMENT
  28756.       PMERR_INV_SETID
  28757.       PMERR_INV_TRANSFORM_TYPE
  28758.  
  28759.  
  28760.  
  28761.  
  28762.  
  28763.  Comments
  28764.  
  28765.  All coordinates are in world coordinates and are relative to the starting
  28766.  point of the string, as defined by the character direction.
  28767.  
  28768.  This function logs an error (PMERR_COORDINATE_OVERFLOW) if the operation
  28769.  cannot be performed because the matrix is singular.
  28770.  
  28771.  
  28772.  █    QueryViewportSize
  28773.  ────────────────────────────────────────────────────────────────────────────
  28774.  
  28775.  BOOL QueryViewportSize  (hdc, ulUnits, cvs, pvs, hddc, ulFunN)
  28776.  
  28777.  HDC  hdc;                         /*handle of engine's device context */
  28778.  
  28779.  ULONG  ulUnits;                   /*page units to be emulated */
  28780.  
  28781.  LONG  cvs;                        /*count of viewport sizes */
  28782.  
  28783.  PVIEWPORTSIZE  pvs;               /*pointer to VIEWPORTSIZE structures */
  28784.  
  28785.  ULONG  hddc;                      /*handle of device driver's device
  28786.                                    context */
  28787.  
  28788.  ULONG  ulFunN;                    /*flags and function number */
  28789.  
  28790.  
  28791.  The QueryViewportSize function calculates the viewport sizes (in page
  28792.  coordinates) that, for the specified window sizes, produce a window/viewport
  28793.  transformation that emulates the specified page units using the current page
  28794.  units.
  28795.  
  28796.  
  28797.  Parameters
  28798.  
  28799.  hdc  Identifies the engine's device context.
  28800.  
  28801.  ulUnits  Specifies the page units to be emulated.
  28802.  
  28803.  cvs  Specifies the number of dimension pairs in the array pointed to by pvs.
  28804.  
  28805.  
  28806.  pvs  Points to an array of VIEWPORTSIZE structures to contain the viewport
  28807.  dimensions.
  28808.  
  28809.  hddc  Identifies the device driver's device context.
  28810.  
  28811.  ulFunN  Specifies the function number and a mask of various flags. The low
  28812.  word contains the function number; the high word contains a mask of flags,
  28813.  which may be set by the graphics programming interface (GPI), the engine, or
  28814.  a driver. For a description of these flags, see Section 7.1.1.
  28815.  
  28816.  
  28817.  Return Value
  28818.  
  28819.  The return value is TRUE if the function is successful or FALSE if an error
  28820.  occurs.
  28821.  
  28822.  
  28823.  Errors
  28824.  
  28825.  If an error occurs during the execution of this function, the graphics
  28826.  engine or the device driver calls the WinSetErrorInfo function and records
  28827.  the associated error code. The following is a possible error code that the
  28828.  engine or the device driver calls record:
  28829.  
  28830.       PMERR_DEV_FUNC_NOT_INSTALLED
  28831.  
  28832.  
  28833.  
  28834.  
  28835.  
  28836.  Comment
  28837.  
  28838.  The QueryViewportSize function is not required for the first release of
  28839.  Presentation Manager.
  28840.  
  28841.  
  28842.  █    QueryWidthTable
  28843.  ────────────────────────────────────────────────────────────────────────────
  28844.  
  28845.  BOOL QueryWidthTable  (hdc, chFirst, cbWidthTable, alWidthTable, hddc,
  28846.  ulFunN)
  28847.  
  28848.  HDC  hdc;                         /*handle of engine's device context */
  28849.  
  28850.  LONG  chFirst;                    /*first character to be queried */
  28851.  
  28852.  LONG  cbWidthTable;               /*count of widths */
  28853.  
  28854.  PLONG  alWidthTable;              /*pointer to buffer for widths */
  28855.  
  28856.  ULONG  hddc;                      /*handle of device driver's device
  28857.                                    context */
  28858.  
  28859.  ULONG  ulFunN;                    /*flags and function number */
  28860.  
  28861.  
  28862.  The QueryWidthTable function retrieves the character widths for the
  28863.  currently selected logical fonts, in world coordinates.
  28864.  
  28865.  
  28866.  Parameters
  28867.  
  28868.  hdc  the engine's device context.
  28869.  
  28870.  chFirst  the code point of the initial character for which width information
  28871.  is required.
  28872.  
  28873.  cbWidthTable  the size, in bytes, of the buffer pointed to by the
  28874.  alWidthTable parameter.
  28875.  
  28876.  alWidthTable  to a buffer in which the width data is retrieved.
  28877.  
  28878.  hddc  the device driver's device context.
  28879.  
  28880.  ulFunN  the function number and a mask of various flags. The low word
  28881.  contains the function number; the high word contains a mask of flags, which
  28882.  may be set by the graphics programming interface (GPI), the engine, or a
  28883.  driver. For a description of these flags, see Section 7.1.1.
  28884.  
  28885.  
  28886.  Return Value
  28887.  
  28888.  The return value is TRUE if the function is successful or FALSE if an error
  28889.  occurs.
  28890.  
  28891.  
  28892.  Errors
  28893.  
  28894.  If an error occurs during the execution of this function, the graphics
  28895.  engine or the device driver calls the WinSetErrorInfo function and records
  28896.  the associated error code. The following list contains possible error codes
  28897.  that the engine or the device driver calls record:
  28898.  
  28899.       PMERR_COORDINATE_OVERFLOW
  28900.       PMERR_DEV_FUNC_NOT_INSTALLED
  28901.       PMERR_EXCEEDS_MAX_SEG_LENGTH
  28902.       PMERR_HDC_BUSY
  28903.       PMERR_INSUFFICIENT_MEMORY
  28904.       PMERR_INV_CHAR_MODE_ATTR
  28905.       PMERR_INV_CODEPAGE
  28906.       PMERR_INV_COORD_SPACE
  28907.       PMERR_INV_FIRST_CHAR
  28908.       PMERR_INV_HDC
  28909.       PMERR_INV_LENGTH_OR_COUNT
  28910.       PMERR_INV_MATRIX_ELEMENT
  28911.       PMERR_INV_SETID
  28912.       PMERR_INV_TRANSFORM_TYPE
  28913.  
  28914.  
  28915.  
  28916.  
  28917.  
  28918.  Comment
  28919.  
  28920.  This function logs an error (PMERR_COORDINATE_OVERFLOW) if the operation
  28921.  cannot be performed because the matrix is singular.
  28922.  
  28923.  This function returns widths of zero for undefined code points.
  28924.  
  28925.  
  28926.  █    RealizeColorTable
  28927.  ────────────────────────────────────────────────────────────────────────────
  28928.  
  28929.  BOOL RealizeColorTable  (hdc, hddc, ulFunN)
  28930.  
  28931.  HDC  hdc;                         /*handle of engine's device context */
  28932.  
  28933.  ULONG  hddc;                      /*handle of device driver's device
  28934.                                    context */
  28935.  
  28936.  ULONG  ulFunN;                    /*flags and function number */
  28937.  
  28938.  
  28939.  The RealizeColorTable function sets the device's physical color table to the
  28940.  closest possible match to the logical color table.
  28941.  
  28942.  
  28943.  Parameters
  28944.  
  28945.  hdc  Identifies the engine's device context.
  28946.  
  28947.  hddc  Identifies the device driver's device context.
  28948.  
  28949.  ulFunN  Specifies the function number and a mask of various flags. The low
  28950.  word contains the function number; the high word contains a mask of flags,
  28951.  which may be set by the graphics programming interface (GPI), the engine, or
  28952.  a driver. For a description of these flags, see Section 7.1.1.
  28953.  
  28954.  
  28955.  Return Value
  28956.  
  28957.  The return value is TRUE if the function is successful or FALSE if an error
  28958.  occurs.
  28959.  
  28960.  
  28961.  Errors
  28962.  
  28963.  If an error occurs during the execution of this function, the device driver
  28964.  calls the WinSetErrorInfo function and records the associated error code.
  28965.  The following list contains possible error codes that the device driver may
  28966.  record:
  28967.  
  28968.       PMERR_COL_TABLE_NOT_REALIZABLE
  28969.       PMERR_DEV_FUNC_NOT_INSTALLED
  28970.       PMERR_INV_HDC
  28971.       PMERR_INV_IN_AREA
  28972.       PMERR_INV_IN_PATH
  28973.       PMERR_REALIZE_NOT_SUPPORTED
  28974.  
  28975.  
  28976.  
  28977.  
  28978.  
  28979.  Comments
  28980.  
  28981.  If an attempt is made to realize a color table on a device that does not
  28982.  support the RealizeColorTable function, the function returns an error.
  28983.  
  28984.  A device such as a printer may implicitly realize the color table when the
  28985.  table is created. In this case, the RealizeColorTable function completes
  28986.  without error.
  28987.  
  28988.  
  28989.  █    RealizeFont
  28990.  ────────────────────────────────────────────────────────────────────────────
  28991.  
  28992.  ULONG RealizeFont  (hdc, flCmd, pfatLogFont, pfocaEngFont, hddc, ulFunN)
  28993.  
  28994.  HDC  hdc;                         /*handle of engine's device context */
  28995.  
  28996.  ULONG  flCmd;                     /*options */
  28997.  
  28998.  PFATTRS  pfatLogFont;             /*pointer to logical-font attributes */
  28999.  
  29000.  PFOCAFONT  pfocaEngFont;          /*pointer to engine font */
  29001.  
  29002.  ULONG  hddc;                      /*handle of device driver's device
  29003.                                    context */
  29004.  
  29005.  ULONG  ulFunN;                    /*flags and function number */
  29006.  
  29007.  
  29008.  The RealizeFont function realizes or deletes the specified font.
  29009.  
  29010.  
  29011.  Parameters
  29012.  
  29013.  hdc  Identifies the engine's device context.
  29014.  
  29015.  flCmd  Specifies the option. This value can be one of the following:
  29016.  
  29017.  Value                             Meaning
  29018.  ────────────────────────────────────────────────────────────────────────────
  29019.  
  29020.  REALIZE_FONT                      Realize a matching device font.
  29021.  
  29022.  REALIZE_ENGINE_FONT               Realize a device font using an engine
  29023.