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

Text Truncated. Only the first 1MB is shown below. Download the file for the complete contents.
  1.  Microsoft Operating System/2: Programmer's Reference Volume 3
  2.  
  3.  
  4.  ══════════════════════════════════════════════════════════════════════════
  5.  
  6.  
  7.  Microsoft(R) Operating System/2: Programmer's Reference Volume 3
  8.  
  9.  Version 1.1
  10.  
  11.  
  12.  ══════════════════════════════════════════════════════════════════════════
  13.  
  14.  
  15.    Information in this document is subject to change without notice and does
  16.    not represent a commitment on the part of Microsoft Corporation. The
  17.    software and/or databases described in this document are furnished under a
  18.    license agreement or nondisclosure agreement. The software and/or
  19.    databases may be used or copied only in accordance with the terms of the
  20.    agreement. The purchaser may make one copy of the software for backup
  21.    purposes. No part of this manual and/or database may be reproduced or
  22.    transmitted in any form or by any means, electronic or mechanical,
  23.    including photocopying, recording, or information storage and retrieval
  24.    systems, for any purpose other than the purchaser's personal use, without
  25.    the written permission of Microsoft Corporation.
  26.  
  27.    (C) Copyright Microsoft Corporation, 1989. All rights reserved.
  28.  
  29.    Printed in the United States of America.
  30.  
  31.    The character-set tables in this manual are reprinted by permission from
  32.    the IBM Operating System/2 User's Reference, (C) 1987 by International
  33.    Business Machines Corporation.
  34.  
  35.    Microsoft(R), MS(R), MS-DOS(R), and the Microsoft logo are registered
  36.    trademarks of Microsoft Corporation.
  37.  
  38.    IBM(R), PC/AT(R), and Personal System/2(R) are registered trademarks
  39.    of International Business Machines Corporation.
  40.  
  41.    Document No. LN0702C-110-I00-0289
  42.  
  43.  
  44.  
  45.  ────────────────────────────────────────────────────────────────────────────
  46.  Contents
  47.  
  48.  
  49.  Chapter 1  Introduction
  50.         1.1     Overview
  51.         1.2     How to Use This Manual
  52.         1.3     Naming Conventions
  53.         1.4     Notational Conventions
  54.  
  55.  Chapter 2  Functions Directory
  56.         2.1     Introduction
  57.         2.2     Functions
  58.  
  59.  Chapter 3  Input-and-Output Control Functions
  60.         3.1     Introduction
  61.         3.2     Category and Function Codes
  62.         3.3     Functions
  63.  
  64.  Chapter 4  Types, Macros, Structures
  65.         4.1     Introduction
  66.         4.2     Types
  67.         4.3     Macros
  68.         4.4     Structures
  69.  
  70.  Chapter 5  File Formats
  71.         5.1     Introduction
  72.         5.2     Keyboard Translation Tables
  73.         5.3     Video Modes and Fonts
  74.         5.4     Resource-File Formats
  75.  
  76.  
  77.  Appendix A  Error Values
  78.         A.1     Introduction
  79.         A.2     Errors
  80.  
  81.  Appendix B  ANSI Escape Sequences
  82.         B.1     Introduction
  83.         B.2     Cursor Functions
  84.         B.3     Erase Functions
  85.         B.4     Screen Graphics Functions
  86.  
  87.  Appendix C  Country and Code-Page Information
  88.         C.1     Introduction
  89.         C.2     Supported Countries
  90.         C.3     Code Pages
  91.  
  92.  
  93.  ────────────────────────────────────────────────────────────────────────────
  94.  Figures
  95.  
  96.         Figure 1.1     Sample Reference Page
  97.  
  98.  
  99.  ────────────────────────────────────────────────────────────────────────────
  100.  Tables
  101.  
  102.         Table 3.1      Specific Category and Function Codes
  103.         Table 5.1      Table-Flag Values
  104.         Table 5.2      Country and Language Codes
  105.         Table 5.3      Shift-Key Masks
  106.         Table 5.4      Text Modes
  107.         Table 5.5      Graphics Modes
  108.  
  109.  
  110.  
  111.  ────────────────────────────────────────────────────────────────────────────
  112.  Chapter 1  Introduction
  113.  
  114.         1.1     Overview
  115.         1.2     How to Use This Manual
  116.             1.2.1     C Format
  117.             1.2.2     MS OS/2 Include Files
  118.             1.2.3     MS OS/2 Calling Conventions
  119.             1.2.4     Bit Masks in Function Parameters
  120.             1.2.5     Structures
  121.         1.3     Naming Conventions
  122.             1.3.1     Parameter and Field Names
  123.                 1.3.1.1    Prefixes
  124.                 1.3.1.2    Base Types
  125.             1.3.2     Constant Names
  126.         1.4     Notational Conventions
  127.  
  128.  
  129.  1.1  Overview
  130.  
  131.    This manual describes the Dos, Kbd, Mou, and Vio system functions of
  132.    Microsoft(R) Operating System/2 (MS(R) OS/2). These functions, also called
  133.    the base system functions, let MS OS/2 programs use the operating system
  134.    to carry out tasks such as reading from and writing to disk files;
  135.    allocating memory; starting other programs; and using the keyboard, mouse,
  136.    and video screen.
  137.  
  138.    MS OS/2 system functions are designed to be used in C, Pascal, and other
  139.    high-level-language programs, as well as in assembly-language programs. In
  140.    MS OS/2, all programs request operating-system services by calling system
  141.    functions.
  142.  
  143.    This chapter, "Introduction," shows how to use this manual, provides a
  144.    brief description of MS OS/2 calling conventions, illustrates function
  145.    calls in various languages, and outlines MS OS/2 naming conventions.
  146.  
  147.    Chapter 2, "Functions Directory," is an alphabetical listing of MS OS/2
  148.    base system functions. This chapter defines each function's purpose, gives
  149.    its syntax, describes the function parameters, and gives possible return
  150.    values. Many functions also show simple program examples that illustrate
  151.    how the function is used to carry out simple tasks.
  152.  
  153.    Chapter 3, "Input-and-Output Control Functions," lists the
  154.    input-and-output control (IOCtl) functions used to control input and
  155.    output devices such as serial ports, the keyboard, and the mouse.
  156.  
  157.    Chapter 4, "Types, Macros, Structures," describes the types, macros, and
  158.    structures used by MS OS/2 base system functions.
  159.  
  160.    Chapter 5, "File Formats," describes the format of files and other large
  161.    data structures used by MS OS/2 base system functions. These formats
  162.    include keyboard translation tables and video I/O fonts.
  163.  
  164.    Appendix A, "Error Values," lists error codes and their corresponding
  165.    values.
  166.  
  167.    Appendix B, "ANSI Escape Sequences," lists the escape sequences used by
  168.    MS OS/2.
  169.  
  170.    Appendix C, "Country and Code-Page Information," lists information
  171.    contained in the country and code-page files used by MS OS/2 system
  172.    functions. This includes code-page tables, code-page identifiers, and
  173.    country-specific information.
  174.  
  175.    This manual is intended to fully describe MS OS/2 base system functions
  176.    and the structures and file formats used with these functions. It does not
  177.    show how to use these functions to carry out specific tasks. For more
  178.    information on this topic, see the Microsoft Operating System/2
  179.    Programmer's Reference, Volume 1. Also, this manual does not describe MS
  180.    OS/2 Presentation Manager functions. Presentation Manager functions let
  181.    programs use the window-management and graphics features of MS OS/2. For
  182.    more information on MS OS/2 Presentation Manager functions, see the
  183.    Microsoft Operating System/2 Programmer's Reference, Volume 2.
  184.  
  185.  
  186.  1.2  How to Use This Manual
  187.  
  188.    This manual provides detailed information about each MS OS/2 base system
  189.    function, macro, and structure. Each description has the following format:
  190.  
  191.    ┌────────────────────────────────────────────────────────────────────────┐
  192.    │ Figure 1.1 can be found in Section 1.2 of the printed manual.          │
  193.    └────────────────────────────────────────────────────────────────────────┘
  194.  
  195.    Figure 1.1  Sample Reference Page
  196.  
  197.    These are the elements shown:
  198.  
  199.    1.  The function, macro, or structure name.
  200.  
  201.    2.  The function, macro, or structure syntax. The syntax specifies the
  202.        number of parameters (or fields) and gives the type of each. It also
  203.        gives the order (from left to right) that parameters must be pushed on
  204.        the stack. Comments to the right briefly describe the purpose of the
  205.        parameter.
  206.  
  207.    3.  A description of the function, macro, or structure, including its
  208.        purpose and details of operation.
  209.  
  210.    4.  Any special consideration for the function, including whether a
  211.        function can be used in family API programs.
  212.  
  213.    5.  A full description of each parameter (or field), including permitted
  214.        values and related structures.
  215.  
  216.    6.  A description of the function return value, including possible error
  217.        values.
  218.  
  219.    7.  An example showing how the function can be used to accomplish a simple
  220.        task.
  221.  
  222.    8.  A list of related functions and structures.
  223.  
  224.  1.2.1  C Format
  225.  
  226.    In this manual, the syntax for MS OS/2 functions is given in C-language
  227.    format. In your C-language sources, the function name must be spelled
  228.    exactly as given in the syntax, and the parameters must be used in the
  229.    order given in the syntax. This syntax also applies to Pascal program
  230.    sources.
  231.  
  232.    The following example shows how to call the DosBeep function in a
  233.    C-language program:
  234.  
  235.    /* play a note for 1 second */
  236.  
  237.    DosBeep(660,             /* 660 cycles-per-second      */
  238.            1000);           /* play for 1000 milliseconds */
  239.  
  240.  1.2.2  MS OS/2 Include Files
  241.  
  242.    This manual uses many types, structures, and constants that are not part
  243.    of standard C language. These items, designed for MS OS/2, are defined in
  244.    the MS OS/2 C-language include files provided with the Microsoft OS/2
  245.    Presentation Manager Softset and the Microsoft OS/2 Presentation Manager
  246.    Toolkit.
  247.  
  248.    In C-language programs, the #include directive specifying os2.h, the MS
  249.    OS/2 C-language include file, can be placed at the beginning of the source
  250.    file to include the definitions for the special types, structures, and
  251.    constants. Although there are many MS OS/2 include files, the os2.h file
  252.    contains the additional #include directives needed to process the basic MS
  253.    OS/2 definitions.
  254.  
  255.    To speed up processing of the MS OS/2 C-language include files, many
  256.    definitions are processed only if the C-language program explicitly
  257.    defines a corresponding include constant. An include constant is simply a
  258.    constant name, with the prefix INCL_, that controls a portion of the
  259.    include files. If a constant is defined using the #define directive, the
  260.    corresponding MS OS/2 definitions are processed. For a list of the include
  261.    constants and a description of the MS OS/2 system functions they enable,
  262.    see the Microsoft Operating System/2 Programmer's Reference, Volume 1.
  263.  
  264.  1.2.3  MS OS/2 Calling Conventions
  265.  
  266.    You must know MS OS/2 calling conventions to use MS OS/2 functions in
  267.    other high-level languages or in assembly language. MS OS/2 functions use
  268.    the Pascal (sometimes called the PLM) calling convention for passing
  269.    parameters, and they apply some additional rules to support dynamic-link
  270.    libraries. The following rules apply:
  271.  
  272.    ■  You must push the parameters on the stack. In this manual, each
  273.       function description lists the parameters in the order they must be
  274.       pushed. The left parameter must be pushed first, the right parameter
  275.       last. If a parameter specifies an address, the address must be a far
  276.       address; that is, it must have the form selector:offset. The selector
  277.       must be pushed first, then the offset.
  278.  
  279.    ■  The function automatically removes the parameters from the stack as it
  280.       returns. This means the function must have a fixed number of
  281.       parameters.
  282.  
  283.    ■  You must use an intersegment call instruction to call the function.
  284.       This is required for all dynamic-link-library functions.
  285.  
  286.    ■  The function returns a value, possibly an error value, in either the ax
  287.       register or the dx:ax register pair. Only the di and si register values
  288.       are guaranteed to be preserved by the function. MS OS/2 base system
  289.       functions may preserve other registers as well, but they do not
  290.       preserve the flags register. The contents of the flags register are
  291.       undefined; specifically, the direction flag in the register may be
  292.       changed. However, if the direction flag was zero before the function
  293.       was called, it will be zero after the function returns.
  294.  
  295.    The following example shows how MS OS/2 calling conventions apply to the
  296.    DosOpen function in an assembly-language program:
  297.  
  298.    EXTRN DOSOPEN:FAR
  299.    name            db      "abc", 0
  300.    hFile           dw      0
  301.    usAction        dw      0
  302.  
  303.    push    ds                      ; filename to open
  304.    push    offset name
  305.    push    ds                      ; address of file handle
  306.    push    offset hFile
  307.    push    ds                      ; address to store action taken
  308.    push    offset usAction
  309.    push    0                       ; size of new file 0100H
  310.    push    100
  311.    push    0                       ; file's attribute
  312.    push    0010H                   ; create file if it does not exist
  313.    push    0041H                   ; open file for writing, share with all
  314.    push    0                       ; reserved
  315.    push    0
  316.    call    DOSOPEN
  317.  
  318.    The following example shows how to call the same DosOpen function in a
  319.    C-language program. In C, the DosOpen function name, parameter types, and
  320.    constant names are defined in os2.h, the MS OS/2 C-language include file.
  321.  
  322.    # include <os2.h>
  323.  
  324.    HFILE hfile;
  325.    USHORT usAction;
  326.  
  327.    DosOpen("abc",        /* filename to open                 */
  328.        &hfile,           /* address of file handle           */
  329.        &usAction,        /* address to store action taken    */
  330.        100L,             /* size of new file                 */
  331.        FILE_NORMAL,      /* file's attribute                 */
  332.        FILE_CREATE,      /* create file if it does not exist */
  333.        OPEN_SHARE_DENYNONE |   /* share with all             */
  334.        OPEN_ACCESS_WRITEONLY,  /* open for writing           */
  335.        0L);                    /* reserved                   */
  336.  
  337.  1.2.4  Bit Masks in Function Parameters
  338.  
  339.    Many MS OS/2 system functions accept or return bit masks as part of their
  340.    operation. A bit mask is a collection of two or more bit fields within a
  341.    single byte, or a short or long value. Bit masks provide a way to pack
  342.    many Boolean flags (flags whose values represent on/off or true/false
  343.    values) into a single parameter or structure field. In assembly-language
  344.    programming, it is easy to individually set, clear, or test the bits in a
  345.    bit mask by using instructions that modify or examine bits within a byte
  346.    or a word. In C-language programming, however, the programmer does not
  347.    have direct access to these instructions, so the bitwise AND and OR
  348.    operators typically are used to examine and modify the bit masks.
  349.  
  350.    Since this manual presents the syntax of MS OS/2 system functions in
  351.    C-language syntax, it also defines bit masks in a way that is easiest to
  352.    work with using the C language: as a set of constant values. When a
  353.    function parameter is a bit mask, this manual provides a list of constants
  354.    (named or numeric) that represent the correct values used to set, clear,
  355.    or examine each field in the bit mask. For example, the fbType field of
  356.    the VIOMODEINFO structure in the VioSetMode function specifies three
  357.    values: VGMT_OTHER, VGMT_GRAPHICS, and VGMT_DISABLEBURST. These represent
  358.    the "set" values of the first three fields in the bit mask. Typically, the
  359.    description associated with the value explains the result of the function
  360.    if the given value is used; that is, when the corresponding bit is set.
  361.    Generally, the opposite result is assumed when the value is not used. For
  362.    example, using VGMT_GRAPHICS in the fbType field enables graphics mode;
  363.    not using it disables graphics mode.
  364.  
  365.  1.2.5  Structures
  366.  
  367.    Many MS OS/2 system functions use structures as input and output
  368.    parameters. This manual defines all structures and their fields using
  369.    C-language syntax. In most cases, the structure definition presented is
  370.    copied directly from the C-language include files provided with the
  371.    Microsoft C Optimizing Compiler. Occasionally, an MS OS/2 function may
  372.    have a structure that has no corresponding include-file definition. In
  373.    such cases, this manual gives an incomplete form of the C-language
  374.    structure definition to indicate that the structure is not already defined
  375.    in an include file.
  376.  
  377.  
  378.  1.3  Naming Conventions
  379.  
  380.    In this manual, all parameter, variable, structure, field, and constant
  381.    names conform to MS OS/2 naming conventions. MS OS/2 naming conventions
  382.    are rules that define how to create names that indicate both the purpose
  383.    and data type of an item used with MS OS/2 system functions. These naming
  384.    conventions are used in this manual to help you readily identify the
  385.    purpose and type of the function parameters and structure fields. These
  386.    conventions are also used in most MS OS/2 sample program sources to make
  387.    the sources more readable and informative.
  388.  
  389.  1.3.1  Parameter and Field Names
  390.  
  391.    With MS OS/2 naming conventions, all parameter and field names consist of
  392.    up to three elements: a prefix, a base type, and a qualifier. A name
  393.    always consists of at least a base type or a qualifier. In most cases, the
  394.    name also includes a prefix.
  395.  
  396.    The base type, always written in lowercase letters, identifies the data
  397.    type of the item. The prefix, also written in lowercase letters, specifies
  398.    additional information about the item, such as whether it is a pointer, an
  399.    array, or a count of bytes. The qualifier, a short word or phrase written
  400.    with the first letter of each word uppercase, specifies the purpose of the
  401.    item.
  402.  
  403.    There are several standard prefixes and base types. These are used for the
  404.    data types most frequently used with MS OS/2.
  405.  
  406.    1.3.1.1  Prefixes
  407.  
  408.    The following is a list of standard prefixes used in MS OS/2 naming
  409.    conventions:
  410.  
  411. ╓┌─┌───────┌─────────────────────────────────────────────────────────────────╖
  412.    Prefix  Description
  413.    ──────────────────────────────────────────────────────────────────────────
  414.    p       Pointer. This prefix identifies a far, or 32-bit, pointer to a
  415.            given item. For example, pch is a far pointer to a character.
  416.  
  417.    np      Near pointer. This prefix identifies a near, or 16-bit, pointer to
  418.            a given item. For example, npch is a near pointer to a character.
  419.  
  420.    a       Array. This prefix identifies an array of two or more items of a
  421.            given type. For example, ach is an array of characters.
  422.    Prefix  Description
  423.    ──────────────────────────────────────────────────────────────────────────
  424.           given type. For example, ach is an array of characters.
  425.  
  426.    i       Index. This prefix identifies an index into an array. For example,
  427.            ich is an index to one character in an array of characters.
  428.  
  429.    c       Count. This prefix identifies a count of items. It is usually
  430.            combined with the base type of the items being counted instead of
  431.            the base type of the actual parameter. For example, cch is a count
  432.            of characters even though it may be declared with the type USHORT.
  433.  
  434.    h       Handle. This prefix is used for values that uniquely identify an
  435.            object but that cannot be used to access the object directly. For
  436.            example, hfile is a handle of a file.
  437.  
  438.    off     Offset. This prefix is used for values that represent offsets from
  439.            the beginning of a buffer or a structure. For example, off is the
  440.            offset from the beginning of the given segment to the specified
  441.            byte.
  442.  
  443.    Prefix  Description
  444.    ──────────────────────────────────────────────────────────────────────────
  445. 
  446.    id      Identifier. This prefix is used for values that identify an
  447.            object. For example, idSession is a session identifier.
  448.    ──────────────────────────────────────────────────────────────────────────
  449.  
  450.  
  451.    1.3.1.2  Base Types
  452.  
  453.    The following is a list of standard base types used in MS OS/2 naming
  454.    conventions:
  455.  
  456. ╓┌─┌───────┌─────────────────────────────────────────────────────────────────╖
  457.    Base    Type/Description
  458.    type
  459.    ──────────────────────────────────────────────────────────────────────────
  460.    f       BOOL. A 16-bit flag or Boolean value. The qualifier should
  461.            describe the condition associated with the flag when it is TRUE.
  462.            For example, fSuccess is TRUE if successful, FALSE if not; fError
  463.            is TRUE if an error occurs and FALSE if no error occurs. For
  464.    Base    Type/Description
  465.    type
  466.    ──────────────────────────────────────────────────────────────────────────
  467.           is TRUE if an error occurs and FALSE if no error occurs. For
  468.            objects of type BOOL, a zero value implies FALSE; a nonzero value
  469.            implies TRUE.
  470.  
  471.    ch      CHAR. An 8-bit signed value.
  472.  
  473.    s       SHORT. A 16-bit signed value.
  474.  
  475.    l       LONG. A 32-bit signed value.
  476.  
  477.    uch     UCHAR. An 8-bit unsigned value.
  478.  
  479.    us      USHORT. A 16-bit unsigned value.
  480.  
  481.    ul      ULONG. A 32-bit unsigned value.
  482.  
  483.    b       BYTE. An 8-bit unsigned value. Same as uch.
  484.  
  485.    Base    Type/Description
  486.    type
  487.    ──────────────────────────────────────────────────────────────────────────
  488. 
  489.    sz      CHAR[ ]. Array of characters, terminated with a null character
  490.            (the last byte is set to zero).
  491.  
  492.    fb      UCHAR. Array of flags in a byte. This base type is used when more
  493.            than one flag is packed in an 8-bit value. Values for such an
  494.            array are typically created by using the logical OR operator to
  495.            combine two or more values.
  496.  
  497.    fs      USHORT. Array of flags in a short (16-bit unsigned value). This
  498.            base type is used when more than one flag is packed in a 16-bit
  499.            value. Values for such an array are typically created by using the
  500.            logical OR operator to combine two or more values.
  501.  
  502.    fl      ULONG. Array of flags in a long (32-bit unsigned value). This base
  503.            type is used when more than one flag is packed in a 32-bit value.
  504.            Values for such an array are typically created by using the
  505.            logical OR operator to combine two or more values.
  506.    Base    Type/Description
  507.    type
  508.    ──────────────────────────────────────────────────────────────────────────
  509.           logical OR operator to combine two or more values.
  510.  
  511.    sel     SEL. A 16-bit value used to hold a segment selector.
  512.    ──────────────────────────────────────────────────────────────────────────
  513.  
  514.  
  515.    The base type for a structure is usually derived from the structure name.
  516.    An MS OS/2 structure name, always written in uppercase letters, is a word
  517.    or phrase that describes the size, purpose, and/or intended content
  518.    associated with the type. The base type is typically an abbreviation of
  519.    the structure name. The following list gives the base types for the
  520.    structures described in this manual:
  521.  
  522.  
  523.    ctryc             kbdtyp            ptbuf
  524.    ctryi             lnctl             driv
  525.    date              lis               qresc
  526.    dcbinf            mdmst             resc
  527.    trckl             mnin              shftst
  528.    bspblk            mnout             kbsi
  529.    fdate             mouev             htky
  530.    scrgrp            moupl             stdata
  531.    findbuf           moups             mnpos
  532.    flock             mouqi             stsdata
  533.    frm               mourt             rtdly
  534.    fsalloc           mousc             vioci
  535.    fsinf             trckfmt           viofi
  536.    dosfsrs           mxs               vioin
  537.    fsts              mxsl              vioint
  538.    ftime             rxq               viomi
  539.    gis               dvpblck           vioos
  540.    htype             pidi              viopal
  541.    kbci              nmpinf            viopb
  542.    kbstkbs           pi                vol
  543.    kbxl              ptrdfnc
  544.  
  545.  
  546.  1.3.2  Constant Names
  547.  
  548.    A constant name is a descriptive name for a numeric value used with an MS
  549.    OS/2 function. All constant names are written in uppercase letters and
  550.    have a prefix derived from the name of the function, object, or idea
  551.    associated with the constant. The prefix is followed by an underscore (_)
  552.    and the rest of the constant name, which indicates the meaning of the
  553.    constant and may specify a value, action, color, or condition. A few
  554.    common constants do not have prefixes──for example, NULL is used for null
  555.    pointers of all types, and TRUE and FALSE are used with the BOOL data
  556.    type.
  557.  
  558.  
  559.  1.4  Notational Conventions
  560.  
  561.    The following notational conventions are used throughout this manual:
  562.  
  563.    Convention      Meaning
  564.    ──────────────────────────────────────────────────────────────────────────
  565.    bold            Bold type is used for keywords──for example, the names of
  566.                    functions, data types, structures, and macros. These names
  567.                    are spelled exactly as they should appear in source
  568.                    programs.
  569.  
  570.    italics         Italic type is used to indicate the name of an argument;
  571.                    this name must be replaced by an actual argument. Italics
  572.                    are also used to show emphasis in text.
  573.  
  574.    this font       This type is used for example program-code fragments.
  575.    ──────────────────────────────────────────────────────────────────────────
  576.  
  577.  
  578.  
  579.  ────────────────────────────────────────────────────────────────────────────
  580.  Chapter 2  Functions Directory
  581.  
  582.         2.1     Introduction
  583.         2.2     Functions
  584.  
  585.  2.1  Introduction
  586.  
  587.    This chapter describes MS OS/2 Dos, Kbd, Mou, and Vio functions. These
  588.    functions, also called MS OS/2 base system functions, provide the support
  589.    programs need to access the basic operating-system features of MS OS/2,
  590.    such as multitasking, memory management, and input and output. The Dos,
  591.    Kbd, Mou, and Vio functions represent four distinct function groups. As
  592.    described in the following list, programs use these function groups to
  593.    carry out specific tasks:
  594.  
  595. ╓┌─┌───────────────┌─────────────────────────────────────────────────────────╖
  596.    Function group  Usage
  597.    ──────────────────────────────────────────────────────────────────────────
  598.    Dos             Use the disk operating system (Dos) functions in
  599.                    full-screen and Presentation Manager sessions to read from
  600.                    and write to disk files, to allocate memory, to start
  601.                    threads and processes, to communicate with other
  602.                    processes, and to access your computer's devices directly.
  603.                    Most functions in this group can be used in Presentation
  604.                    Manager applications.
  605.  
  606.    Kbd             Use the keyboard (Kbd) functions in full-screen sessions
  607.                    to read keystrokes from the keyboard, to manage multiple
  608.                    logical keyboards, and to change code pages and
  609.                    translation tables. Since the Presentation Manager session
  610.                    provides its own keyboard support, Kbd functions are not
  611.    Function group  Usage
  612.    ──────────────────────────────────────────────────────────────────────────
  613.                   provides its own keyboard support, Kbd functions are not
  614.                    needed in Presentation Manager applications.
  615.  
  616.    Mou             Use the mouse (Mou) functions in full-screen sessions to
  617.                    read mouse input from the mouse-event queue, to set the
  618.                    mouse-pointer shape, and to manage the mouse for all
  619.                    processes in a session. As with the keyboard, the
  620.                    Presentation Manager session provides its own mouse
  621.                    support, so Mou functions are not needed in Presentation
  622.                    Manager applications.
  623.  
  624.    Vio             Use the video input-and-output (Vio) functions in
  625.                    full-screen sessions to write characters and character
  626.                    attributes to the screen, to create pop-up windows for
  627.                    messages, to change the video modes, and to access
  628.                    physical video memory. Vio functions can also be used in
  629.                    advanced video-input-and-output (AVIO) applications for
  630.                    the Presentation Manager session to write characters and
  631.                    character attributes in a window. Most Presentation
  632.    Function group  Usage
  633.    ──────────────────────────────────────────────────────────────────────────
  634.                   character attributes in a window. Most Presentation
  635.                    Manager applications, however, use the graphics
  636.                    programming interface (Gpi) to write text in a window.
  637.    ──────────────────────────────────────────────────────────────────────────
  638.  
  639.  
  640.    Many functions in this chapter are also family API functions. This means
  641.    they can be used in dual-mode programs──that is, programs that run in
  642.    either MS OS/2 or MS-DOS(R). The family API functions are clearly marked.
  643.  
  644.    In this chapter, complete syntax, purpose, and parameter descriptions are
  645.    given for each function. Types, macros, and structures used by a function
  646.    are given with the function; these are defined more fully in Chapter 4,
  647.    "Types, Macros, Structures." The numeric values for error values returned
  648.    by the functions are listed in Appendix A, "Error Values."
  649.  
  650.    Many of the function descriptions in this chapter include examples. The
  651.    examples show how to use the functions to accomplish simple tasks. In
  652.    nearly all cases, the examples are code fragments, not complete programs.
  653.    A code fragment is intended to show the context in which a function can be
  654.    used, but often assumes that variables, structures, and constants used in
  655.    the example have been defined and/or initialized. Also, a code fragment
  656.    may use comments to represent a task instead of giving the actual
  657.    statements.
  658.  
  659.    Although the examples are not complete, you can still use them in your
  660.    programs if you take the following steps:
  661.  
  662.    ■  Include the os2.h file in your program.
  663.  
  664.    ■  Define the appropriate include constants for the functions, structures,
  665.       and constants used in the example.
  666.  
  667.    ■  Define and initialize all variables.
  668.  
  669.    ■  Replace comments that represent tasks with appropriate statements.
  670.  
  671.    ■  Check return values for errors and take appropriate actions.
  672.  
  673.  
  674.  2.2  Functions
  675.  
  676.    The following is a complete list, in alphabetical order, of the MS OS/2
  677.    Dos, Kbd, Mou, and Vio functions.
  678.  
  679.  ────────────────────────────────────────────────────────────────────────────
  680.  DosAllocHuge
  681.  ────────────────────────────────────────────────────────────────────────────
  682.    USHORT DosAllocHuge (usNumSeg, usPartialSeg, psel, usMaxNumSeg, fsAlloc)
  683.    USHORT usNumSeg;        /*number of segments to allocate                */
  684.    USHORT usPartialSeg;    /*number of bytes in last segment               */
  685.    PSEL psel;              /*pointer to variable for selector allocated    */
  686.    USHORT usMaxNumSeg;     /*maximum number of segments to reallocate      */
  687.    USHORT fsAlloc;         /*sharable/discardable flags                    */
  688.  
  689.    The DosAllocHuge function allocates a huge memory block. This block
  690.    consists of one or more 65,536-byte memory segments and one additional
  691.    segment of the size specified by the usPartialSeg parameter.
  692.  
  693.    The DosAllocHuge function allocates the segments and copies the selector
  694.    of the first segment to the variable pointed to by the psel parameter.
  695.    Selectors for the remaining segments are consecutive and must be computed
  696.    by using the selector offset.
  697.  
  698.    The DosAllocHuge function can specify that segments be sharable or
  699.    discardable. If the process that calls DosAllocHuge specifies that the
  700.    segments can be shared, then it can call the DosGiveSeg function to make
  701.    the location or the allocated segments available to another process. The
  702.    other process must use the DosGetSeg function to access the shared memory.
  703.    For more information about sharable and discardable segments, see the
  704.    "Comments" section under the DosAllocSeg function.
  705.  
  706.    The DosAllocHuge function is a family API function.
  707.  
  708.  Parameters
  709.  
  710.    usNumSeg  Specifies the number of 65,536-byte segments to be allocated.
  711.  
  712.    usPartialSeg  Specifies the number of bytes in the last segment. This
  713.    number can be any value from 0 through 65,535. If it is zero, no
  714.    additional segment is allocated.
  715.  
  716.    psel  Points to the variable that receives the selector of the first
  717.    segment.
  718.  
  719.    usMaxNumSeg  Specifies the maximum number of segments that can be
  720.    specified in any subsequent call to the DosReallocHuge function. If the
  721.    usMaxNumSeg parameter is zero, the memory cannot be reallocated to a size
  722.    greater than its original size, but it can be reallocated to a smaller
  723.    size.
  724.  
  725.    fsAlloc  Specifies whether the segments can be shared with other processes
  726.    or can be discarded. The fsAlloc parameter can be one or more of the
  727.    following values:
  728.  
  729.    Value              Meaning
  730.    ──────────────────────────────────────────────────────────────────────────
  731.    SEG_DISCARDABLE    Create discardable segments.
  732.  
  733.    SEG_GETTABLE       Create sharable segments that other processes can
  734.                       retrieve by using the DosGetSeg function.
  735.  
  736.    SEG_GIVEABLE       Create sharable segments that the owning process can
  737.                       give to other processes by using the DosGiveSeg
  738.                       function.
  739.  
  740.    SEG_NONSHARED      Create nonsharable, nondiscardable segments. This value
  741.                       cannot be combined with any other value.
  742.    ──────────────────────────────────────────────────────────────────────────
  743.  
  744.    If the shared or discardable attributes are not specified, only the
  745.    process that creates the segment can access it, and the contents of the
  746.    segment remain in memory until the process frees the segment.
  747.  
  748.  Return Value
  749.  
  750.    The return value is zero if the function is successful. Otherwise, it is
  751.    an error value, which may be the following:
  752.  
  753.          ERROR_NOT_ENOUGH_MEMORY
  754.  
  755.  Comments
  756.  
  757.    Each segment in the huge memory block has a unique selector. The selectors
  758.    are consecutive. The psel parameter specifies the value of the first
  759.    selector; the remaining selectors can be computed by adding the selector
  760.    offset to the first selector one or more times──that is, once for the
  761.    second selector, twice for the third, and so on. The selector offset is a
  762.    multiple of 2, as specified by the shift count retrieved by using the
  763.    DosGetHugeShift function. For example, if the shift count is 2, the
  764.    selector offset is 4 (1 << 2). If the selector offset is 4 and the first
  765.    selector is 6, then the second selector is 10, the third is 14, and so on.
  766.  
  767.    The system may move or swap the memory segments as directed by the memman
  768.    command in the config.sys file. Moving and swapping have no effect on the
  769.    value of the segment selectors, so you can compute the selectors at any
  770.    time and save them; they will remain available for use as long as the
  771.    memory remains allocated.
  772.  
  773.    The DosAllocHugeSeg function automatically locks the segment. A locked
  774.    segment cannot be discarded. You must use the DosUnlockSeg function to
  775.    unlock the segment and permit discarding. To prevent the memory manager
  776.    from discarding an unlocked discardable segment, use the DosLockSeg
  777.    function.
  778.  
  779.    The DosFreeSeg function frees all segments if you pass it the first
  780.    selector.
  781.  
  782.  Restrictions
  783.  
  784.    In real mode, the following restrictions apply to the DosAllocHuge
  785.    function:
  786.  
  787.    ■  The usPartialSeg parameter is rounded up to the next paragraph
  788.       (16-byte) value.
  789.  
  790.    ■  The actual segment address is copied to the psel parameter.
  791.  
  792.  Example
  793.  
  794.    This example calls the DosAllocHuge function to allocate two segments with
  795.    64K and one segment with 200 bytes. It then converts the first selector to
  796.    a huge pointer that can access all the memory allocated.
  797.  
  798.    CHAR huge *pchBuffer;
  799.    SEL sel;
  800.    DosAllocHuge(3,               /* number of segments                */
  801.        200,                      /* size of last segment              */
  802.        &sel,                     /* address of selector               */
  803.        5,                        /* maximum segments for reallocation */
  804.        SEG_NONSHARED);           /* sharing flag                      */
  805.    pchBuffer = MAKEP(sel, 0);    /* converts to a pointer             */
  806.  
  807.  See Also
  808.  
  809.    DosAllocSeg, DosFreeSeg, DosGetHugeShift, DosGetSeg, DosGiveSeg,
  810.    DosLockSeg, DosReallocHuge, DosUnlockSeg
  811.  
  812.  
  813.  ────────────────────────────────────────────────────────────────────────────
  814.  DosAllocSeg
  815.  ────────────────────────────────────────────────────────────────────────────
  816.    USHORT DosAllocSeg (usSize, psel, fsAlloc)
  817.    USHORT usSize;          /*number of bytes requested                     */
  818.    PSEL psel;              /*pointer to variable for selector allocated    */
  819.    USHORT fsAlloc;         /*sharable/discardable flags                    */
  820.  
  821.    The DosAllocSeg function allocates a memory segment and copies the segment
  822.    selector to the variable pointed to by the psel parameter. The segment can
  823.    have from 1 through 65,536 bytes.
  824.  
  825.    The DosAllocSeg function can specify that the segment be sharable or
  826.    discardable. If the process that calls DosAllocSeg specifies that the
  827.    segments can be shared, then it can call the DosGiveSeg function to make
  828.    the location or the allocated segments available to another process. The
  829.    other process must use the DosGetSeg function to access the shared memory.
  830.  
  831.    The DosAllocSeg function is a family API function.
  832.  
  833.  Parameters
  834.  
  835.    usSize  Specifies the number of bytes to be allocated. This number can be
  836.    any value from 0 through 65,535. If it is zero, the function allocates
  837.    65,536 bytes.
  838.  
  839.    psel  Points to the variable that receives the segment selector.
  840.  
  841.    fsAlloc  Specifies whether the segment can be shared with other processes
  842.    or can be discarded. The fsAlloc parameter can be one or more of the
  843.    following values:
  844.  
  845.    Value              Meaning
  846.    ──────────────────────────────────────────────────────────────────────────
  847.    SEG_DISCARDABLE    Create a discardable segment.
  848.  
  849.    SEG_GETTABLE       Create a sharable segment that other processes can
  850.                       retrieve by using the DosGetSeg function.
  851.  
  852.    SEG_GIVEABLE       Create a sharable segment that the owning process can
  853.                       give to other processes by using the DosGiveSeg
  854.                       function.
  855.  
  856.    SEG_NONSHARED      Create a nonsharable, nondiscardable segment. This
  857.                       value cannot be combined with any other value.
  858.    ──────────────────────────────────────────────────────────────────────────
  859.  
  860.    If the sharable or discardable attributes are not specified, only the
  861.    process that creates the segment can access it, and the contents of the
  862.    segment remain in memory until the process frees the segment.
  863.  
  864.  Return Value
  865.  
  866.    The return value is zero if the function is successful. Otherwise, it is
  867.    an error value, which may be the following:
  868.  
  869.          ERROR_NOT_ENOUGH_MEMORY
  870.  
  871.  Comments
  872.  
  873.    The system may move or swap the memory segment as directed by the memman
  874.    command in the config.sys file. Moving and swapping have no effect on the
  875.    segment selectors.
  876.  
  877.    A sharable segment is available to the process that created it and to
  878.    other processes. If necessary, the system will discard an unlocked
  879.    discardable segment in order to satisfy another allocation request. The
  880.    new allocation request can come from any process, including the process
  881.    that allocated the segment being discarded.
  882.  
  883.    Discardable segments are useful for holding information that is accessed
  884.    for short periods of time and that can be regenerated quickly if
  885.    discarded. Examples are cache buffers for a database package, saved bitmap
  886.    images for obscured windows, and precomputed display images for a
  887.    word-processing application. Although the data in the segment is lost when
  888.    the segment is discarded, the segment can be restored to its original size
  889.    by using the DosReallocSeg function.
  890.  
  891.    The DosAllocSeg function automatically locks the segment. A locked segment
  892.    cannot be discarded. You must use the DosUnlockSeg function to unlock the
  893.    segment and permit discarding. To prevent the memory manager from
  894.    discarding an unlocked discardable segment, use the DosLockSeg function.
  895.  
  896.    The DosFreeSeg function frees the segment.
  897.  
  898.  Restrictions
  899.  
  900.    In real mode, the following restrictions apply to the DosAllocSeg
  901.    function:
  902.  
  903.    ■  The usSize parameter is rounded up to the next paragraph (16-byte)
  904.       value.
  905.  
  906.    ■  The actual segment address is copied to the psel parameter.
  907.  
  908.  Example
  909.  
  910.    This example calls the DosAllocSeg function to allocate 26,953 bytes. It
  911.    then converts the selector to a far pointer that can access the allocated
  912.    bytes.
  913.  
  914.    PCH pchBuffer;
  915.    SEL sel;
  916.  
  917.    DosAllocSeg(26953,              /* bytes to allocate     */
  918.        &sel,                       /* address of selector   */
  919.        SEG_NONSHARED);             /* sharing flag          */
  920.    pchBuffer = MAKEP(sel, 0);      /* converts to a pointer */
  921.  
  922.  See Also
  923.  
  924.    DosAllocHuge, DosFreeSeg, DosGetSeg, DosGiveSeg, DosLockSeg,
  925.    DosReallocSeg, DosUnlockSeg
  926.  
  927.  
  928.  ────────────────────────────────────────────────────────────────────────────
  929.  DosAllocShrSeg
  930.  ────────────────────────────────────────────────────────────────────────────
  931.    USHORT DosAllocShrSeg (usSize, pszSegName, psel)
  932.    USHORT usSize;          /*number of bytes requested                     */
  933.    PSZ pszSegName;         /*pointer to segment name                       */
  934.    PSEL psel;              /*pointer to variable for selector allocated    */
  935.  
  936.    The DosAllocShrSeg function allocates a shared memory segment and copies
  937.    the segment selector to the variable pointed to by the psel parameter. The
  938.    segment can have from 1 through 65,536 bytes.
  939.  
  940.    A shared segment can be accessed by any process that knows the segment
  941.    name. A process can retrieve a selector for the segment by specifying the
  942.    name in a call to the DosGetShrSeg function. (Shared segments allocated by
  943.    using the DosAllocSeg function must be explicitly given and retrieved by
  944.    using the DosGiveSeg and DosGetSeg functions.)
  945.  
  946.  Parameters
  947.  
  948.    usSize  Specifies the number of bytes to be allocated. This number can be
  949.    any value from 0 through 65,535. If it is zero, the function allocates
  950.    65,536 bytes.
  951.  
  952.    pszSegName  Points to a null-terminated string that identifies the shared
  953.    memory segment. The string must have the following form:
  954.  
  955.    \sharemem\name
  956.  
  957.    The segment name, name, must have the same format as an MS OS/2 filename
  958.    and must be unique. For example, the name \sharemem\public.dat is
  959.    acceptable.
  960.  
  961.    psel  Points to the variable that receives the segment selector.
  962.  
  963.  Return Value
  964.  
  965.    The return value is zero if the function is successful. Otherwise, it is
  966.    an error value, which may be one of the following:
  967.  
  968.          ERROR_ALREADY_EXISTS
  969.          ERROR_INVALID_HANDLE
  970.          ERROR_NOT_ENOUGH_MEMORY
  971.  
  972.  Comments
  973.  
  974.    A process may allocate up to 30 shared segments.
  975.  
  976.    The system may move or swap the memory segments as directed by the memman
  977.    command in the config.sys file. Moving and swapping have no effect on the
  978.    value of the segment selector.
  979.  
  980.    The DosFreeSeg function frees a shared segment.
  981.  
  982.  Example
  983.  
  984.    This example calls the DosAllocShrSeg function to allocate 26,953 bytes.
  985.    It gives the memory the name "\sharemem\abc.mem" so that other processes
  986.    may use the memory if they know the name.
  987.  
  988.    SEL sel;
  989.  
  990.    DosAllocShrSeg(26953,            /* bytes to allocate   */
  991.        "\\sharemem\\abc.mem",       /* memory name         */
  992.        &sel);                       /* address of selector */
  993.  
  994.  See Also
  995.  
  996.    DosAllocHuge, DosAllocSeg, DosFreeSeg, DosGetSeg, DosGetShrSeg,
  997.    DosGiveSeg
  998.  
  999.  
  1000.  ────────────────────────────────────────────────────────────────────────────
  1001.  DosBeep
  1002.  ────────────────────────────────────────────────────────────────────────────
  1003.    USHORT DosBeep (usFrequency, usDuration)
  1004.    USHORT usFrequency;     /*frequency in hertz                            */
  1005.    USHORT usDuration;      /*duration in milliseconds                      */
  1006.  
  1007.    The DosBeep function generates sound from the speaker.
  1008.  
  1009.    The DosBeep function is a family API function.
  1010.  
  1011.  Parameters
  1012.  
  1013.    usFrequency  Specifies the frequency of the sound in hertz
  1014.    (cycles-per-second). This parameter can be any value from 0x0025 through
  1015.    0x7FFF.
  1016.  
  1017.    usDuration  Specifies the length of the sound in milliseconds.
  1018.  
  1019.  Return Value
  1020.  
  1021.    The return value is zero if the function is successful. Otherwise, it is
  1022.    an error value, which may be the following:
  1023.  
  1024.          ERROR_INVALID_FREQUENCY
  1025.  
  1026.  Example
  1027.  
  1028.    This example calls the DosBeep function and produces audible tones:
  1029.  
  1030.    SHORT i;
  1031.    for (i = 0; i < 10; i++) {
  1032.        DosBeep(600, 175);
  1033.        DosBeep(1200, 175);
  1034.    }
  1035.  
  1036.  See Also
  1037.  
  1038.    WinAlarm
  1039.  
  1040.  
  1041.  ────────────────────────────────────────────────────────────────────────────
  1042.  DosBufReset
  1043.  ────────────────────────────────────────────────────────────────────────────
  1044.    USHORT DosBufReset (hf)
  1045.    HFILE hf;               /*file handle                                   */
  1046.  
  1047.    The DosBufReset function flushes the file buffers for the specified file
  1048.    by writing the current contents of the file buffer to the corresponding
  1049.    device. If the file is a disk file, the function writes to the disk and
  1050.    updates the directory information for the file.
  1051.  
  1052.    Although DosBufReset flushes and updates information as if the file were
  1053.    closed, the file remains open.
  1054.  
  1055.    The DosBufReset function is a family API function.
  1056.  
  1057.  Parameters
  1058.  
  1059.    hf  Identifies the file whose buffers are flushed. This handle must have
  1060.    been created previously by using the DosOpen function. If this parameter
  1061.    is set to 0xFFFF, the function flushes buffers for all currently open
  1062.    files.
  1063.  
  1064.  Return Value
  1065.  
  1066.    The return value is zero if the function is successful. Otherwise, it is
  1067.    an error value, which may be one of the following:
  1068.  
  1069.          ERROR_ACCESS_DENIED
  1070.          ERROR_FILE_NOT_FOUND
  1071.          ERROR_INVALID_HANDLE
  1072.  
  1073.  Comments
  1074.  
  1075.    If the process has several open files on removeable disks, the function
  1076.    may have the effect of requiring the user to repeatedly swap disks.
  1077.  
  1078.  Example
  1079.  
  1080.    This example opens the file abc and writes the contents of the abBuf
  1081.    buffer to the file. It then writes the data to the disk by calling the
  1082.    DosBufReset function to flush the buffers.
  1083.  
  1084.    BYTE abBuf[512];
  1085.    HFILE hf;
  1086.    USHORT usAction, cbBytesWritten, usError;
  1087.    usError = DosOpen("abc", &hf, &usAction, 0L, FILE_NORMAL,
  1088.        FILE_CREATE | FILE_OPEN,
  1089.        OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYWRITE, 0L);
  1090.    if (!usError) {
  1091.        DosWrite(hf, abBuf, sizeof(abBuf), &cbBytesWritten);
  1092.        DosBufReset(hf);    /* flush the buffers */
  1093.  
  1094.  See Also
  1095.  
  1096.    DosClose, DosOpen, DosWrite
  1097.  
  1098.  
  1099.  ────────────────────────────────────────────────────────────────────────────
  1100.  DosCallback
  1101.  ────────────────────────────────────────────────────────────────────────────
  1102.    VOID DosCallback (pfn)
  1103.    PFN pfn;                /*pointer to ring-3 function                    */
  1104.  
  1105.    The DosCallback function allows a process with ring-2 input/output
  1106.    privilege to call a ring-3 function.
  1107.  
  1108.  Parameters
  1109.  
  1110.    pfn  Points to the ring-3 function to be called.
  1111.  
  1112.  Return Value
  1113.  
  1114.    This function does not return a value.
  1115.  
  1116.  Comments
  1117.  
  1118.    When a process with ring-2 input/output privileges uses the DosCallback
  1119.    function to call a ring-3 function, the target function executes at ring 3
  1120.    and returns to the ring-2 calling process. The ring-3 function need not
  1121.    conform to the ring-2 privilege level. The ring-3 function that is called
  1122.    by the DosCallback function may call a ring-2 segment before it returns.
  1123.  
  1124.    All registers except FLAGS will be passed intact across this call/return
  1125.    sequence and may be used to pass parameters or data back and forth between
  1126.    rings 2 and 3. Any addresses passed from ring 2 to ring 3 must be based on
  1127.    ring-3 selectors, because ring-3 code cannot address ring-2 data
  1128.    selectors.
  1129.  
  1130.    A ring-2 stack cannot be used to pass data to a ring-3 function.
  1131.  
  1132.    The following Dos functions are valid when issued from ring 2:
  1133.  
  1134.  
  1135.    DosAllocHuge            DosGetHugeShift       DosReadAsync
  1136.    DosAllocSeg             DosGetInfoSeg         DosReallocHuge
  1137.    DosAllocShrSeg          DosGetMachineMode     DosReallocSeg
  1138.    DosBeep                 DosGetModHandle       DosResumeThread
  1139.    DosBufReset             DosGetModName         DosRmDir
  1140.    DosCallback             DosGetPID             DosScanEnv
  1141.    DosChDir                DosGetPPID            DosSearchPath
  1142.    DosChgFilePtr           DosGetProcAddr        DosSelectDisk
  1143.    DosCLIAccess            DosGetPrty            DosSemClear
  1144.    DosClose                DosGetResource        DosSemRequest
  1145.    DosCloseSem             DosGetSeg             DosSemSet
  1146.    DosCreateCSAlias        DosGetShrSeg          DosSemSetWait
  1147.    DosCreateSem            DosGetVersion         DosSemWait
  1148.    DosCreateThread         DosGiveSeg            DosSendSignal
  1149.    DosCwait                DosHoldSignal         DosSetCp
  1150.    DosDelete               DosKillProcess        DosSetDateTime
  1151.    DosDevConfig            DosLoadModule         DosSetFHandState
  1152.    DosDevIOCtl             DosLockSeg            DosSetFileInfo
  1153.    DosDupHandle            DosMakePipe           DosSetFileMode
  1154.    DosEnterCritSec         DosMemAvail           DosSetFSInfo
  1155.    DosErrClass             DosMkDir              DosSetMaxFH
  1156.    DosError                DosMove               DosSetPrty
  1157.    DosExecPgm              DosMuxSemWait         DosSetSigHandler
  1158.    DosExit                 DosNewSize            DosSetVec
  1159.    DosExitCritSec          DosOpen               DosSetVerify
  1160.    DosExitList             DosOpenSem            DosSizeSeg
  1161.    DosFileLocks            DosPhysicalDisk       DosSleep
  1162.    DosFindClose            DosPortAccess         DosSubAlloc
  1163.    DosFindFirst            DosQAppType           DosSubFree
  1164.    DosFindNext             DosQCurDir            DosSubSet
  1165.    DosFlagProcess          DosQCurDisk           DosSuspendThread
  1166.    DosFreeModule           DosQFHandState        DosTimerAsync
  1167.    DosFreeSeg              DosQFileInfo          DosTimerStart
  1168.    DosFSRamSemClear        DosQFileMode          DosTimerStop
  1169.    DosFSRamSemRequest      DosQFSInfo            DosUnlockSeg
  1170.    DosGetCp                DosQHandType          DosWrite
  1171.    DosGetDateTime          DosQVerify            DosWriteAsync
  1172.    DosGetEnv               DosRead
  1173.  
  1174.  
  1175.  ────────────────────────────────────────────────────────────────────────────
  1176.  DosCallNmPipe
  1177.  ────────────────────────────────────────────────────────────────────────────
  1178.    USHORT DosCallNmPipe (pszName, pbInBuf, cbInBuf, pbOutBuf, cbOutBuf,
  1179.    pcbRead, ulTimeOut)
  1180.    PSZ pszName;            /*pointer to pipe name                          */
  1181.    PBYTE pbInBuf;          /*pointer to input buffer                       */
  1182.    USHORT cbInBuf;         /*number of bytes in input buffer               */
  1183.    PBYTE pbOutBuf;         /*pointer to output buffer                      */
  1184.    USHORT cbOutBuf;        /*number of bytes in output buffer              */
  1185.    PUSHORT pcbRead;        /*pointer to variable for bytes read            */
  1186.    ULONG ulTimeOut;        /*timeout value                                 */
  1187.  
  1188.    The DosCallNmPipe function opens a named pipe, writes to and reads from
  1189.    it, and closes it.
  1190.  
  1191.  Parameters
  1192.  
  1193.    pszName  Points to the name of the pipe. The name is in the form
  1194.    \pipe\name for a local pipe and \\server\pipe\name for a remote pipe.
  1195.  
  1196.    pbInBuf  Points to the buffer containing the data that is written to the
  1197.    pipe.
  1198.  
  1199.    cbInBuf  Specifies the size (in bytes) of the input buffer.
  1200.  
  1201.    pbOutBuf  Points to the output buffer that receives the data read from the
  1202.    pipe.
  1203.  
  1204.    cbOutBuf  Specifies the size (in bytes) of the output buffer.
  1205.  
  1206.    pcbRead  Points to the variable that receives the number of bytes read
  1207.    from the pipe.
  1208.  
  1209.    ulTimeOut  Specifies a value (in milliseconds) that is the amount of time
  1210.    MS OS/2 should wait for the pipe to become available.
  1211.  
  1212.  Return Value
  1213.  
  1214.    The return value is zero if the function is successful. Otherwise, it is
  1215.    an error value, which may be one of the following:
  1216.  
  1217.          ERROR_BAD_PIPE
  1218.          ERROR_INTERRUPT
  1219.          ERROR_INVALID_FUNCTION
  1220.          ERROR_SEM_TIMEOUT
  1221.  
  1222.  Comments
  1223.  
  1224.    The DosCallNmPipe function is equivalent to calling DosOpen,
  1225.    DosTransactNmPipe, and DosClose.
  1226.  
  1227.  See Also
  1228.  
  1229.    DosMakePipe, DosTransactNmPipe
  1230.  
  1231.  
  1232.  ────────────────────────────────────────────────────────────────────────────
  1233.  DosCaseMap
  1234.  ────────────────────────────────────────────────────────────────────────────
  1235.    USHORT DosCaseMap (usLength, pctryc, pchString)
  1236.    USHORT usLength;        /*length of string to casemap                   */
  1237.    PCOUNTRYCODE pctryc;    /*pointer to structure for country code         */
  1238.    PCHAR pchString;        /*pointer to character string                   */
  1239.  
  1240.    The DosCaseMap function casemaps the characters in the given string. If
  1241.    necessary, the function replaces characters in the string with the correct
  1242.    case-mapped characters.
  1243.  
  1244.    The DosCaseMap function uses the casemap information in the country.sys
  1245.    file to casemap the string.
  1246.  
  1247.    The DosCaseMap function is a family API function.
  1248.  
  1249.  Parameters
  1250.  
  1251.    usLength  Specifies the length of the given string.
  1252.  
  1253.    pctryc  Points to the COUNTRYCODE structure that contains the country code
  1254.    and the code-page identifier for the casemap operation. The COUNTRYCODE
  1255.    structure has the following form:
  1256.  
  1257.    typedef struct _COUNTRYCODE {
  1258.        USHORT country;
  1259.        USHORT codepage;
  1260.    } COUNTRYCODE;
  1261.  
  1262.    For a full description, see Chapter 4, "Types, Macros, Structures."
  1263.  
  1264.    pchString  Points to the character string to be casemapped.
  1265.  
  1266.  Return Value
  1267.  
  1268.    The return value is zero if the function is successful. Otherwise, it is
  1269.    an error value, which may be one of the following:
  1270.  
  1271.          ERROR_NLS_BAD_TYPE
  1272.          ERROR_NLS_NO_COUNTRY_FILE
  1273.          ERROR_NLS_NO_CTRY_CODE
  1274.          ERROR_NLS_OPEN_FAILED
  1275.          ERROR_NLS_TABLE_TRUNCATED
  1276.          ERROR_NLS_TYPE_NOT_FOUND
  1277.  
  1278.  Restrictions
  1279.  
  1280.    In real mode, the following restriction applies to the DosCaseMap
  1281.    function:
  1282.  
  1283.    ■  There is no method of identifying the boot drive. The system assumes
  1284.       that the country.sys file is in the root directory of the current
  1285.       drive.
  1286.  
  1287.  See Also
  1288.  
  1289.    DosGetCollate, DosGetCtryInfo, DosSetCp
  1290.  
  1291.  
  1292.  ────────────────────────────────────────────────────────────────────────────
  1293.  DosChDir
  1294.  ────────────────────────────────────────────────────────────────────────────
  1295.    USHORT DosChDir (pszDirPath, ulReserved)
  1296.    PSZ pszDirPath;         /*directory path                                */
  1297.    ULONG ulReserved;       /*must be zero                                  */
  1298.  
  1299.    The DosChDir function changes the current directory to the specified
  1300.    directory. When a process changes the current directory, subsequent calls
  1301.    to file-system functions, such as the DosOpen function, use the new
  1302.    directory as the default directory. The default directory is used if no
  1303.    explicit path is given with a filename.
  1304.  
  1305.    The DosChDir function is a family API function.
  1306.  
  1307.  Parameters
  1308.  
  1309.    pszDirPath  Points to the null-terminated string that specifies the new
  1310.    directory path. The string must be a valid MS OS/2 directory path and must
  1311.    not be longer than 125 characters.
  1312.  
  1313.    ulReserved  Specifies a reserved value; must be zero.
  1314.  
  1315.  Return Value
  1316.  
  1317.    The return value is zero if the function is successful. Otherwise, it is
  1318.    an error value, which may be one of the following:
  1319.  
  1320.          ERROR_DRIVE_LOCKED
  1321.          ERROR_FILE_NOT_FOUND
  1322.          ERROR_NOT_DOS_DISK
  1323.          ERROR_NOT_ENOUGH_MEMORY
  1324.          ERROR_PATH_NOT_FOUND
  1325.  
  1326.  Comments
  1327.  
  1328.    This function applies only to the process that is changing the directory.
  1329.    It does not affect the current directories of other processes. When the
  1330.    process terminates, the previous default directory becomes the default
  1331.    directory again.
  1332.  
  1333.    When a process starts, it inherits its current directory from the parent
  1334.    process.
  1335.  
  1336.  Example
  1337.  
  1338.    This example stores the current default drive and path, then calls the
  1339.    DosChDir function to change the default path to the root directory:
  1340.  
  1341.    PSZ pszPath;
  1342.    USHORT cbPath = 0, usDisk;
  1343.    ULONG ulLogicalDrives;
  1344.    SEL selPath;
  1345.  
  1346.    DosQCurDisk(&usDisk, &ulLogicalDrives);       /* gets current drive  */
  1347.    DosQCurDir(usDisk, NULL, &cbPath);            /* gets size of buffer */
  1348.    DosAllocSeg(cbPath, &selPath, SEG_NONSHARED); /* allocates memory    */
  1349.    pszPath = MAKEP(selPath, 0);          /* assigns it to a far pointer */
  1350.    DosQCurDir(usDisk, pszPath, &cbPath); /* gets current directory      */
  1351.    DosChDir("\\", 0L);                 /* changes to the root directory */
  1352.        .
  1353.        .
  1354.        .
  1355.    DosChDir(pszPath, 0L);              /* restores the directory        */
  1356.  
  1357.  See Also
  1358.  
  1359.    DosMkDir, DosQCurDir, DosQCurDisk, DosRmDir, DosSelectDisk
  1360.  
  1361.  
  1362.  ────────────────────────────────────────────────────────────────────────────
  1363.  DosChgFilePtr
  1364.  ────────────────────────────────────────────────────────────────────────────
  1365.    USHORT DosChgFilePtr (hf, lDistance, fMethod, pulNewPtr)
  1366.    HFILE hf;               /*file handle                                   */
  1367.    LONG lDistance;         /*distance to move                              */
  1368.    USHORT fMethod;         /*method of moving                              */
  1369.    PULONG pulNewPtr;       /*new pointer location                          */
  1370.  
  1371.    The DosChgFilePtr function moves the file pointer to a new position in the
  1372.    file. The file pointer is maintained by the system. It points to the next
  1373.    byte to be read from a file or to the next position in the file to receive
  1374.    a byte.
  1375.  
  1376.    The DosChgFilePtr function is a family API function.
  1377.  
  1378.  Parameters
  1379.  
  1380.    hf  Identifies the file. This handle must have been created previously by
  1381.    using the DosOpen function.
  1382.  
  1383.    lDistance  Specifies the number of bytes to move the file pointer in the
  1384.    file. If this value is positive, the pointer moves forward through the
  1385.    file. If the value is negative, the pointer moves backward.
  1386.  
  1387.    fMethod  Specifies where the move will start. This parameter must be one
  1388.    of the following values:
  1389.  
  1390.    Value           Meaning
  1391.    ──────────────────────────────────────────────────────────────────────────
  1392.    FILE_BEGIN      Start move at the beginning of the file.
  1393.  
  1394.    FILE_CURRENT    Start move at the current location.
  1395.  
  1396.    FILE_END        Start move at the end of the file.
  1397.    ──────────────────────────────────────────────────────────────────────────
  1398.  
  1399.    pulNewPtr  Points to the long variable that receives the new file-pointer
  1400.    location.
  1401.  
  1402.  Return Value
  1403.  
  1404.    The return value is zero if the function is successful. Otherwise, it is
  1405.    an error value, which may be one of the following:
  1406.  
  1407.          ERROR_INVALID_FUNCTION
  1408.          ERROR_INVALID_HANDLE
  1409.  
  1410.  Comments
  1411.  
  1412.    The system automatically advances the file pointer for each byte read or
  1413.    written; the pointer is at the beginning of the file when the file is
  1414.    opened.
  1415.  
  1416.  Example
  1417.  
  1418.    This example opens the file abc for read and write access, calls the
  1419.    DosChgFilePtr function to set the file pointer at the end of the file,
  1420.    writes the string "Hello World", and closes the file. The ulFilePointer
  1421.    variable contains the file's current length when the pointer is at the end
  1422.    of the file.
  1423.  
  1424.    HFILE hf;
  1425.    USHORT usAction, cbBytesWritten;
  1426.    ULONG ulFilePointer;
  1427.    DosOpen("abc", &hf, &usAction, 0L, FILE_NORMAL,
  1428.        FILE_OPEN | FILE_CREATE,
  1429.        OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYWRITE, 0L);
  1430.    DosChgFilePtr(hf,                    /* file handle             */
  1431.        0L,                              /* distance to move        */
  1432.        FILE_END,                        /* type of movement        */
  1433.        &ulFilePointer);                 /* address of new position */
  1434.    DosWrite(hf, "Hello World\r\n", 13, &cbBytesWritten);
  1435.    DosClose(hf);
  1436.  
  1437.  See Also
  1438.  
  1439.    DosNewSize, DosOpen, DosRead, DosWrite
  1440.  
  1441.  
  1442.  ────────────────────────────────────────────────────────────────────────────
  1443.  DosCLIAccess
  1444.  ────────────────────────────────────────────────────────────────────────────
  1445.    USHORT DosCLIAccess (VOID)
  1446.  
  1447.    The DosCLIAccess function requests an input/output (I/O) privilege for
  1448.    disabling and enabling interrupts. Assembly-language programs that use the
  1449.    cli and sti instructions in IOPL segments must use the DosCLIAccess
  1450.    function to receive permission to use these instructions.
  1451.  
  1452.    The DosCLIAccess function is a family API function.
  1453.  
  1454.    This function has no parameters.
  1455.  
  1456.  Return Value
  1457.  
  1458.    The return value is zero if the function is successful. Otherwise, it is
  1459.    an error value.
  1460.  
  1461.  Comments
  1462.  
  1463.    Assembly-language programs that use the in and out instructions to read
  1464.    from and write to I/O ports must use the DosPortAccess function to receive
  1465.    permission to use these instructions. The DosPortAccess function also
  1466.    grants permission to use the cli and sti instructions.
  1467.  
  1468.  See Also
  1469.  
  1470.    DosPortAccess
  1471.  
  1472.  
  1473.  ────────────────────────────────────────────────────────────────────────────
  1474.  DosClose
  1475.  ────────────────────────────────────────────────────────────────────────────
  1476.    USHORT DosClose (hf)
  1477.    HFILE hf;               /*file handle                                   */
  1478.  
  1479.    The DosClose function closes a specified file or pipe. DosClose causes the
  1480.    system to write the contents of all the file's internal buffers to the
  1481.    device──for example, to the disk──and to update all directory information.
  1482.  
  1483.    The DosClose function is a family API function.
  1484.  
  1485.  Parameters
  1486.  
  1487.    hf  Identifies the file to close. This handle must have been created
  1488.    previously by using the DosOpen function, the DosDupHandle function, or
  1489.    the DosMakePipe function.
  1490.  
  1491.  Return Value
  1492.  
  1493.    The return value is zero if the function is successful. Otherwise, it is
  1494.    an error value, which may be one of the following:
  1495.  
  1496.          ERROR_ACCESS_DENIED
  1497.          ERROR_FILE_NOT_FOUND
  1498.          ERROR_INVALID_HANDLE
  1499.  
  1500.  Example
  1501.  
  1502.    This example opens the file abc, reads from the file, and calls the
  1503.    DosClose function to close it:
  1504.  
  1505.    BYTE abBuf[512];
  1506.    HFILE hf;
  1507.    USHORT usAction, cbBytesRead;
  1508.    DosOpen("abc", &hf, &usAction, 0L, FILE_NORMAL, FILE_OPEN,
  1509.        OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, 0L);
  1510.    DosRead(hf, abBuf, sizeof(abBuf), &cbBytesRead);
  1511.    DosClose(hf);                           /* closes the file */
  1512.  
  1513.  See Also
  1514.  
  1515.    DosBufReset, DosDupHandle, DosFindClose, DosMakePipe, DosOpen,
  1516.    DosRead
  1517.  
  1518.  
  1519.  ────────────────────────────────────────────────────────────────────────────
  1520.  DosCloseQueue
  1521.  ────────────────────────────────────────────────────────────────────────────
  1522.    USHORT DosCloseQueue (hqueue)
  1523.    HQUEUE hqueue;          /*queue handle                                  */
  1524.  
  1525.    The DosCloseQueue function closes a queue. If the process calling
  1526.    DosCloseQueue owns the queue, the function removes any outstanding
  1527.    elements from the queue. If the process does not own the queue, the
  1528.    contents of the queue remain unchanged and the queue remains available to
  1529.    other processes that have it open.
  1530.  
  1531.  Parameters
  1532.  
  1533.    hqueue  Identifies the queue to be closed. This queue must have been
  1534.    previously created or opened by using the DosCreateQueue or DosOpenQueue
  1535.    function.
  1536.  
  1537.  Return Value
  1538.  
  1539.    The return value is zero if the function is successful. Otherwise, it is
  1540.    an error value, which may be the following:
  1541.  
  1542.          ERROR_QUE_INVALID_HANDLE
  1543.  
  1544.  Comments
  1545.  
  1546.    After the owner closes the queue, any process that attempts to write to
  1547.    the queue will receive an error value.
  1548.  
  1549.  Example
  1550.  
  1551.    This example creates and opens a queue, then calls the DosCloseQueue
  1552.    function to close the queue:
  1553.  
  1554.    HQUEUE hqueue;
  1555.    DosCreateQueue(&hqueue, QUE_FIFO, "\\queues\\abc.que");
  1556.        .
  1557.        .
  1558.        .
  1559.    DosCloseQueue(hqueue);
  1560.  
  1561.  See Also
  1562.  
  1563.    DosCreateQueue, DosOpenQueue, DosReadQueue, DosWriteQueue
  1564.  
  1565.  
  1566.  ────────────────────────────────────────────────────────────────────────────
  1567.  DosCloseSem
  1568.  ────────────────────────────────────────────────────────────────────────────
  1569.    USHORT DosCloseSem (hsem)
  1570.    HSEM hsem;              /*semaphore handle                              */
  1571.  
  1572.    The DosCloseSem function closes a specified system semaphore. If another
  1573.    process has the semaphore open, it remains open and can be used by that
  1574.    process, although the semaphore cannot be used by the process that closes
  1575.    it. This function deletes the semaphore only when the last process using
  1576.    the semaphore closes it.
  1577.  
  1578.  Parameters
  1579.  
  1580.    hsem  Identifies the semaphore to be closed. This handle must have been
  1581.    previously created or opened by using the DosCreateSem or DosOpenSem
  1582.    function.
  1583.  
  1584.  Return Value
  1585.  
  1586.    The return value is zero if the function is successful. Otherwise, it is
  1587.    an error value, which may be one of the following:
  1588.  
  1589.          ERROR_INVALID_HANDLE
  1590.          ERROR_SEM_IS_SET
  1591.  
  1592.  Comments
  1593.  
  1594.    If a process does not close its semaphores before terminating, the system
  1595.    closes them.
  1596.  
  1597.  Example
  1598.  
  1599.    This example opens a previously created system semaphore, then calls the
  1600.    DosCloseSem function to close it:
  1601.  
  1602.    HSEM hsem;                                 /* semaphore handle     */
  1603.    DosOpenSem(&hsem, "\\sem\\abc");           /* opens the semaphore  */
  1604.        .
  1605.        .
  1606.        .
  1607.    DosCloseSem(hsem);                         /* closes the semaphore */
  1608.  
  1609.  See Also
  1610.  
  1611.    DosCreateSem, DosOpenSem
  1612.  
  1613.  
  1614.  ────────────────────────────────────────────────────────────────────────────
  1615.  DosConnectNmPipe
  1616.  ────────────────────────────────────────────────────────────────────────────
  1617.    USHORT DosConnectNmPipe (hp)
  1618.    HPIPE hp;               /*pipe handle                                   */
  1619.  
  1620.    The DosConnectNmPipe function waits for a client to open a named pipe.
  1621.  
  1622.  Parameters
  1623.  
  1624.    hp  Identifies the named pipe. This handle must have been created
  1625.    previously by using DosMakeNmPipe.
  1626.  
  1627.  Return Value
  1628.  
  1629.    The return value is zero if the function is successful. Otherwise, it is
  1630.    an error value, which may be one of the following:
  1631.  
  1632.      ERROR_BAD_PIPE
  1633.      ERROR_BROKEN_PIPE
  1634.      ERROR_INTERRUPT
  1635.      ERROR_INVALID_FUNCTION
  1636.      ERROR_PIPE_NOT_CONNECTED
  1637.  
  1638.  Comments
  1639.  
  1640.    If the client end of a named pipe is open, the DosConnectNmPipe function
  1641.    returns immediately. If the client end of a named pipe is not open and the
  1642.    pipe was created with blocking, the DosConnectNmPipe function waits until
  1643.    a client opens the pipe. If the client end of a named pipe is not open and
  1644.    the pipe was created with no blocking, the DosConnectNmPipe function
  1645.    returns an error value immediately.
  1646.  
  1647.    In nonblocking mode, multiple DosConnectNmPipe calls can be issued to poll
  1648.    the state of a named pipe. If a client has not opened the pipe, the first
  1649.    call to the DosConnectNmPipe function puts the named pipe into a listening
  1650.    state and returns immediately with an ERROR_PIPE_NOT_CONNECTED return
  1651.    value. Subsequent calls to the DosConnectNmPipe function also return this
  1652.    error value, until a client opens the named pipe.
  1653.  
  1654.    If a named pipe was opened and closed by a client but has not been
  1655.    disconnected by the controlling process, the DosConnectNmPipe function
  1656.    returns ERROR_BROKEN_PIPE.
  1657.  
  1658.  See Also
  1659.  
  1660.    DosDisConnectNmPipe, DosMakeNmPipe
  1661.  
  1662.  
  1663.  ────────────────────────────────────────────────────────────────────────────
  1664.  DosCreateCSAlias
  1665.  ────────────────────────────────────────────────────────────────────────────
  1666.    USHORT DosCreateCSAlias (selDataSegment, pselCodeSegment)
  1667.    SEL selDataSegment;     /*data-segment selector                         */
  1668.    PSEL pselCodeSegment;   /*pointer to code-segment selector              */
  1669.  
  1670.    The DosCreateCSAlias function creates an aliased code-segment selector for
  1671.    a specified memory segment. The aliased code-segment selector can be used
  1672.    to pass execution control to machine instructions in a data segment.
  1673.  
  1674.    The DosCreateCSAlias function is a family API function.
  1675.  
  1676.  Parameters
  1677.  
  1678.    selDataSegment  Specifies the data-segment selector that identifies the
  1679.    memory segment.
  1680.  
  1681.    pselCodeSegment  Points to the variable that receives the aliased
  1682.    code-segment selector.
  1683.  
  1684.  Return Value
  1685.  
  1686.    The return value is zero if the function is successful. Otherwise, it is
  1687.    an error value, which may be the following:
  1688.  
  1689.          ERROR_ACCESS_DENIED
  1690.  
  1691.  Comments
  1692.  
  1693.    Shared memory segments, segments in huge memory blocks, and global data
  1694.    segments from dynamic-link libraries cannot be used to create an aliased
  1695.    code segment.
  1696.  
  1697.    If the process has copied valid machine instructions to the data segment,
  1698.    the aliased code-segment selector can be combined with a segment offset to
  1699.    pass execution control to the machine instructions. The instructions in
  1700.    the aliased code segment can be called from either privilege level 2
  1701.    (input/output privilege) or privilege level 3.
  1702.  
  1703.    The DosFreeSeg function frees the aliased code-segment selector. Freeing
  1704.    the data-segment selector does not affect the aliased code segment, or
  1705.    vice versa. The segment is not removed from memory until both selectors
  1706.    have been freed.
  1707.  
  1708.  Restrictions
  1709.  
  1710.    In real mode, the following restrictions apply to the DosCreateCSAlias
  1711.    function:
  1712.  
  1713.    ■  The selector returned is the address of the code.
  1714.  
  1715.    ■  Freeing either the aliased selector or the original selector
  1716.       immediately frees the block of memory.
  1717.  
  1718.  See Also
  1719.  
  1720.    DosAllocSeg, DosFreeSeg
  1721.  
  1722.  
  1723.  ────────────────────────────────────────────────────────────────────────────
  1724.  DosCreateQueue
  1725.  ────────────────────────────────────────────────────────────────────────────
  1726.    USHORT DosCreateQueue (phqueue, fQueueOrder, pszQueueName)
  1727.    PHQUEUE phqueue;        /*pointer to variable for queue handle          */
  1728.    USHORT fQueueOrder;     /*order in which elements are read-written      */
  1729.    PSZ pszQueueName;       /*pointer to queue name                         */
  1730.  
  1731.    The DosCreateQueue function creates and opens a queue. The new queue is
  1732.    owned by the process that calls the function, but can be opened for use by
  1733.    other processes.
  1734.  
  1735.  Parameters
  1736.  
  1737.    phqueue  Points to the variable that receives the queue handle.
  1738.  
  1739.    fQueueOrder  Specifies the order in which elements are read from and
  1740.    written to the queue. This parameter can be one of the following values:
  1741.  
  1742.    Value           Meaning
  1743.    ──────────────────────────────────────────────────────────────────────────
  1744.    QUE_FIFO        First-in/first-out queue. The first element put in the
  1745.                    queue is the first element to be removed.
  1746.  
  1747.    QUE_LIFO        Last-in/first-out queue. The last element put in the queue
  1748.                    is the first element to be removed.
  1749.  
  1750.    QUE_PRIORITY    Priority queue. The process that places the element in the
  1751.                    queue specifies a priority. Elements with the highest
  1752.                    priority are removed first.
  1753.    ──────────────────────────────────────────────────────────────────────────
  1754.  
  1755.    pszQueueName  Points to a null-terminated string. The string identifies
  1756.    the queue and must have the following form:
  1757.  
  1758.    \queues\name
  1759.  
  1760.    The string name, name, must have the same format as an MS OS/2 filename
  1761.    and must be unique.
  1762.  
  1763.  Return Value
  1764.  
  1765.    The return value is zero if the function is successful. Otherwise, it is
  1766.    an error value, which may be one of the following:
  1767.  
  1768.          ERROR_QUE_DUPLICATE
  1769.          ERROR_QUE_INVALID_NAME
  1770.          ERROR_QUE_INVALID_PRIORITY
  1771.          ERROR_QUE_NO_MEMORY
  1772.  
  1773.  Comments
  1774.  
  1775.    The process that creates a queue owns that queue. The owning process can
  1776.    write elements to and read elements from the queue at any time, since
  1777.    DosCreateQueue automatically opens the queue for the owning process. Other
  1778.    processes may open the queue by using the DosOpenQueue function and write
  1779.    elements to it by using the DosWriteQueue function, but they cannot read
  1780.    elements from the queue. Any thread belonging to the process that owns a
  1781.    queue can read from or write to the queue.
  1782.  
  1783.    If any process has a queue open when the owner closes it, subsequent
  1784.    requests to write to the queue return an error value.
  1785.  
  1786.  See Also
  1787.  
  1788.    DosCloseQueue, DosOpenQueue
  1789.  
  1790.  
  1791.  ────────────────────────────────────────────────────────────────────────────
  1792.  DosCreateSem
  1793.  ────────────────────────────────────────────────────────────────────────────
  1794.    USHORT DosCreateSem (fNoExclusive, phssm, pszSemName)
  1795.    USHORT fNoExclusive;    /*exclusive/nonexclusive ownership flag         */
  1796.    PHSYSSEM phssm;         /*pointer to variable for semaphore handle      */
  1797.    PSZ pszSemName;         /*pointer to semaphore name                     */
  1798.  
  1799.    The DosCreateSem function creates a system semaphore and copies the
  1800.    semaphore handle to a variable. A process can use a system semaphore to
  1801.    indicate to another process a change in the status of a shared resource.
  1802.  
  1803.  Parameters
  1804.  
  1805.    fNoExclusive  Specifies ownership of the semaphore. If this parameter is
  1806.    CSEM_PRIVATE, the process receives exclusive ownership. If this parameter
  1807.    is CSEM_PUBLIC, the process does not receive exclusive ownership.
  1808.  
  1809.    phssm  Points to the variable that receives the semaphore handle.
  1810.  
  1811.    pszSemName  Points to a null-terminated string that identifies the
  1812.    semaphore. The string must have the following form:
  1813.  
  1814.    \sem\name
  1815.  
  1816.    The string name, name, must have the same format as an MS OS/2 filename
  1817.    and must be unique.
  1818.  
  1819.  Return Value
  1820.  
  1821.    The return value is zero if the function is successful. Otherwise, it is
  1822.    an error value, which may be one of the following:
  1823.  
  1824.          ERROR_ALREADY_EXISTS
  1825.          ERROR_INVALID_NAME
  1826.          ERROR_INVALID_PARAMETER
  1827.          ERROR_TOO_MANY_SEMAPHORES
  1828.  
  1829.  Comments
  1830.  
  1831.    The process that creates the system semaphore owns it. Other processes can
  1832.    open the semaphore by using the DosOpenSem function, then wait for a
  1833.    change in the status of the semaphore by using the DosSemWait or
  1834.    DosMuxSemWait function. The owning process can change the status of the
  1835.    semaphore by using the DosSemSet or DosSemClear functions.
  1836.  
  1837.    The process calling the DosCreateSem function receives exclusive ownership
  1838.    of a system semaphore, unless otherwise specified. Exclusive ownership
  1839.    prevents other processes from setting or clearing the semaphore while the
  1840.    owning process has it open. Other processes may open the semaphore and
  1841.    wait for it to change status, but they cannot change its status.
  1842.  
  1843.  Example
  1844.  
  1845.    This example calls DosCreateSem to create a system semaphore, then calls
  1846.    DosSemSet to set it and DosSemClear to clear it:
  1847.  
  1848.    HSYSSEM hssm;               /* handle to semaphore */
  1849.    DosCreateSem(CSEM_PRIVATE,  /* specifies ownership */
  1850.        &hssm,                  /* address of handle   */
  1851.        "\\sem\\abc.sem");      /* name of semaphore   */
  1852.    DosSemSet(hssm);            /* sets the semaphore  */
  1853.        .
  1854.        .
  1855.        .
  1856.    DosSemClear(hssm);          /* clears the semaphore */
  1857.  
  1858.  See Also
  1859.  
  1860.    DosCloseSem, DosOpenSem, DosSemClear, DosSemRequest, DosSemSet,
  1861.    DosSemSetWait, DosSemWait
  1862.  
  1863.  
  1864.  ────────────────────────────────────────────────────────────────────────────
  1865.  DosCreateThread
  1866.  ────────────────────────────────────────────────────────────────────────────
  1867.    USHORT DosCreateThread (pfnFunction, ptidThread, pbThrdStack)
  1868.    PFNTHREAD pfnFunction(VOID);
  1869.                            /*pointer to address of function                */
  1870.    PTID ptidThread;        /*pointer to variable for thread identifier     */
  1871.    PBYTE pbThrdStack;      /*pointer to thread stack                       */
  1872.  
  1873.    The DosCreateThread function creates a new thread.
  1874.  
  1875.  Parameters
  1876.  
  1877.    pfnFunction  Points to a program-supplied function and represents the
  1878.    starting address of the thread. For a full description, see the following
  1879.    "Comments" section.
  1880.  
  1881.    ptidThread  Points to the variable that receives the thread identifier.
  1882.  
  1883.    pbThrdStack  Points to the address of the new thread's stack.
  1884.  
  1885.  Return Value
  1886.  
  1887.    The return value is zero if the function is successful. Otherwise, it is
  1888.    an error value, which may be one of the following:
  1889.  
  1890.          ERROR_NO_PROC_SLOTS
  1891.          ERROR_NOT_ENOUGH_MEMORY
  1892.  
  1893.  Comments
  1894.  
  1895.    When a thread is created, the system makes a far call to the
  1896.    application-supplied function whose address is specified by the
  1897.    pfnFunction parameter. This function may include local variables and may
  1898.    call other functions, as long as the thread's stack has sufficient space.
  1899.    (The stack can be allocated by using the DosAllocSeg function or by using
  1900.    a global array.) The address specified by the pbThrdStack parameter should
  1901.    be the address of the last word in the stack, not the first, since the
  1902.    stack grows down in memory. The thread terminates when the function
  1903.    returns or calls the DosExit function.
  1904.  
  1905.    The pfnFunction parameter points to a function that is supplied by the
  1906.    program. This function should have the following form:
  1907.  
  1908.    VOID FAR FuncName(VOID)
  1909.    {
  1910.    }
  1911.  
  1912.    Since the system passes no arguments, no parameters are defined.
  1913.  
  1914.    DosCreateThread can create up to 255 threads per process. A new thread
  1915.    inherits all files and resources owned by the parent process. Any thread
  1916.    in a process can open a file, device, pipe, queue, or system semaphore.
  1917.    Other threads may use the corresponding handles to access the given item.
  1918.  
  1919.    Note that high-level-languages, run-time libraries, and stack checking may
  1920.    severely limit or eliminate the ability to call the DosCreateThread
  1921.    function directly from a high-level-language program. For more
  1922.    information, consult the documentation that came with your language
  1923.    product.
  1924.  
  1925.    Before calling the DosCreateThread function, either set the es register to
  1926.    zero or assign to it a selector that will remain valid for the duration of
  1927.    the new thread. If you fail to set the es register to one of these values,
  1928.    the thread may unexpectedly terminate as a result of a general protection
  1929.    fault. For more information, see the Microsoft Operating System/2
  1930.    Programmer's Reference, Volume 1.
  1931.  
  1932.  Example
  1933.  
  1934.    This example sets aside a 512-byte buffer to be used as stack space for
  1935.    any threads that are created. The first stack is set at the end of the
  1936.    array. The thread is created by calling the DosCreateThread function. The
  1937.    thread terminates by calling the DosExit function.
  1938.  
  1939.    VOID FAR Thread1();
  1940.    BYTE abStackArea[512];
  1941.        .
  1942.        .
  1943.        .
  1944.        PVOID pStack1 = abStackArea + 512;   /* 512-byte stack          */
  1945.        TID tidThread1;
  1946.  
  1947.        DosCreateThread(Thread1,             /* name of thread function */
  1948.            &tidThread1,                     /* address of thread ID    */
  1949.            pStack1);                        /* thread's stack          */
  1950.        .
  1951.        .
  1952.        .
  1953.        DosExit(EXIT_PROCESS, 0);
  1954.    }
  1955.  
  1956.    VOID FAR Thread1() {
  1957.        .
  1958.        .
  1959.        .
  1960.        DosExit(EXIT_THREAD, 0);
  1961.    }
  1962.  
  1963.  See Also
  1964.  
  1965.    DosExit, DosResumeThread, DosSuspendThread
  1966.  
  1967.  
  1968.  ────────────────────────────────────────────────────────────────────────────
  1969.  DosCwait
  1970.  ────────────────────────────────────────────────────────────────────────────
  1971.    USHORT DosCwait (fScope, fWait, prescResults, ppidProcess, pidWaitProcess)
  1972.    USHORT fScope;          /*flag scope                                    */
  1973.    USHORT fWait;           /*wait/no-wait flag                             */
  1974.    PRESULTCODES prescResults;
  1975.                            /*pointer to structure receiving result codes   */
  1976.    PPID ppidProcess;       /*pointer to variable for process identifier    */
  1977.    PID pidWaitProcess;     /*process identifier of process to wait for     */
  1978.  
  1979.    The DosCwait function waits for a child process to terminate, then
  1980.    retrieves the result codes from that process. The function copies the
  1981.    process identifier of the terminated process to the variable pointed to by
  1982.    the ppidProcess parameter and copies a termination code to the structure
  1983.    pointed to by the prescResults parameter.
  1984.  
  1985.  Parameters
  1986.  
  1987.    fScope  Specifies how many processes to wait for. If the value of this
  1988.    parameter is DCWA_PROCESS, the thread waits until the specified process
  1989.    ends. If it is DCWA_PROCESSTREE, the thread waits until the specified
  1990.    process and all its child processes end.
  1991.  
  1992.    fWait  Specifies whether or not to wait for child processes. If this
  1993.    parameter is DCWW_WAIT, the thread waits while child processes are
  1994.    running. If it is DCWW_NOWAIT, the thread does not wait. This option is
  1995.    used to retrieve the result codes of a child process that has already
  1996.    ended.
  1997.  
  1998.    prescResults  Points to the RESULTCODES structure that receives the
  1999.    termination code and result code for the child process's termination. The
  2000.    RESULTCODES structure has the following form:
  2001.  
  2002.    typedef struct _RESULTCODES {
  2003.        USHORT codeTerminate;
  2004.        USHORT codeResult;
  2005.    } RESULTCODES;
  2006.  
  2007.    For a full description, see Chapter 4, "Types, Macros, Structures."
  2008.  
  2009.    ppidProcess  Points to the variable that receives the process identifier
  2010.    of the ending process.
  2011.  
  2012.    pidWaitProcess  Specifies which process to wait for. If this parameter is
  2013.    a process identifier, the thread waits for that process to end. If it is
  2014.    zero, the thread waits until any child process ends.
  2015.  
  2016.  Return Value
  2017.  
  2018.    The return value is zero if the function is successful. Otherwise, it is
  2019.    an error value, which may be one of the following:
  2020.  
  2021.          ERROR_CHILD_NOT_COMPLETE
  2022.          ERROR_INVALID_PROCID
  2023.          ERROR_WAIT_NO_CHILDREN
  2024.  
  2025.  Comments
  2026.  
  2027.    The DosCwait function may wait for a child process and any processes
  2028.    started by the child process to end before it returns, but it will not
  2029.    report the status of the processes that were started by the child process.
  2030.  
  2031.    When the function is waiting for more then one child process, the
  2032.    ppidProcess variable is used to determine which child process has
  2033.    terminated.
  2034.  
  2035.    Do not call the DosCwait function before starting a child process. When
  2036.    this happens, the process calling DosCwait waits indefinitely, since a
  2037.    child process cannot start asynchronously.
  2038.  
  2039.  Example
  2040.  
  2041.    This example runs the cmd.exe program as a child process, then calls the
  2042.    DosCwait function to wait until cmd.exe terminates:
  2043.  
  2044.    CHAR achFailName[128];
  2045.    RESULTCODES rescResults;
  2046.    PID pidProcess;
  2047.    DosExecPgm(achFailName, sizeof(achFailName),
  2048.        EXEC_ASYNC, "cmd", 0, &rescResults, "cmd.exe");
  2049.        .
  2050.        .
  2051.        .
  2052.    DosCwait(DCWA_PROCESS,          /* execution flag                */
  2053.        DCWW_WAIT,                  /* wait option                   */
  2054.        &rescResults,               /* address for result codes      */
  2055.        &pidProcess,                /* address of process identifier */
  2056.        rescResults.codeTerminate); /* process to wait for           */
  2057.  
  2058.  See Also
  2059.  
  2060.    DosExecPgm, DosExit, DosKillProcess
  2061.  
  2062.  
  2063.  ────────────────────────────────────────────────────────────────────────────
  2064.  DosDelete
  2065.  ────────────────────────────────────────────────────────────────────────────
  2066.    USHORT DosDelete (pszFileName, ulReserved)
  2067.    PSZ pszFileName;        /*pointer to string specifying pathname         */
  2068.    ULONG ulReserved;       /*must be zero                                  */
  2069.  
  2070.    The DosDelete function deletes a file.
  2071.  
  2072.    The DosDelete function is a family API function.
  2073.  
  2074.  Parameters
  2075.  
  2076.    pszFileName  Points to a null-terminated string that specifies the file to
  2077.    be deleted. This string must be a valid MS OS/2 filename and must not
  2078.    contain wildcard characters.
  2079.  
  2080.    ulReserved  Specifies a reserved value; must be zero.
  2081.  
  2082.  Return Value
  2083.  
  2084.    The return value is zero if the function is successful. Otherwise, it is
  2085.    an error value, which may be one of the following:
  2086.  
  2087.          ERROR_ACCESS_DENIED
  2088.          ERROR_FILE_NOT_FOUND
  2089.          ERROR_NOT_DOS_DISK
  2090.          ERROR_PATH_NOT_FOUND
  2091.          ERROR_SHARING_BUFFER_EXCEEDED
  2092.          ERROR_SHARING_VIOLATION
  2093.  
  2094.  Comments
  2095.  
  2096.    Read-only files cannot be deleted by using the DosDelete function. The
  2097.    DosSetFileMode function can be used to change a file's read-only
  2098.    attributes, making it possible to delete that file.
  2099.  
  2100.    The DosDelete function cannot delete directories; use the DosRmDir
  2101.    function to delete directories.
  2102.  
  2103.  Example
  2104.  
  2105.    This example calls the DosDelete function to delete the file abc, and
  2106.    displays a message reporting success or failure:
  2107.  
  2108.    USHORT usError;
  2109.    usError = DosDelete("abc", 0L);
  2110.    if (usError)
  2111.        VioWrtTTY("abc not deleted\r\n", 21, 0);
  2112.    else
  2113.        VioWrtTTY("abc deleted\r\n", 17, 0);
  2114.  
  2115.  See Also
  2116.  
  2117.    DosRmDir, DosSetFileMode
  2118.  
  2119.  
  2120.  ────────────────────────────────────────────────────────────────────────────
  2121.  DosDevConfig
  2122.  ────────────────────────────────────────────────────────────────────────────
  2123.    USHORT DosDevConfig (pvDevInfo, usItem, usReserved)
  2124.    PVOID pvDevInfo;        /*pointer to variable for device information    */
  2125.    USHORT usItem;          /*item number                                   */
  2126.    USHORT usReserved;      /*must be zero                                  */
  2127.  
  2128.    The DosDevConfig function retrieves information about attached devices.
  2129.  
  2130.    The DosDevConfig function is a family API function.
  2131.  
  2132.  Parameters
  2133.  
  2134.    pvDevInfo  Points to the variable that receives device information. The
  2135.    type of information received depends on the value of the usItem parameter.
  2136.  
  2137.    usItem  Specifies what device information to retrieve. This parameter can
  2138.    be one of the following values:
  2139.  
  2140. ╓┌─┌───────────────────────┌─────────────────────────────────────────────────╖
  2141.    Value                   Meaning
  2142.    ──────────────────────────────────────────────────────────────────────────
  2143.    DEVINFO_ADAPTER         The pvDevInfo parameter points to a BYTE variable
  2144.    Value                   Meaning
  2145.    ──────────────────────────────────────────────────────────────────────────
  2146.    DEVINFO_ADAPTER         The pvDevInfo parameter points to a BYTE variable
  2147.                            that is set to FALSE if the primary display
  2148.                            adapter is a monochrome/printer display adapter
  2149.                            type, or to TRUE for other display adapters.
  2150.  
  2151.    DEVINFO_COPROCESSOR     The pvDevInfo parameter points to a BYTE variable
  2152.                            that is set to TRUE if a math coprocessor is
  2153.                            present.
  2154.  
  2155.    DEVINFO_FLOPPY          The pvDevInfo parameter points to a USHORT
  2156.                            variable that receives the number of
  2157.                            removeable-disk drives that are installed.
  2158.  
  2159.    DEVINFO_MODEL           The pvDevInfo parameter points to a BYTE variable
  2160.                            that receives the PC model type.
  2161.  
  2162.    DEVINFO_PRINTER         The pvDevInfo parameter points to a USHORT
  2163.                            variable that receives the number of printers that
  2164.                            are attached.
  2165.    Value                   Meaning
  2166.    ──────────────────────────────────────────────────────────────────────────
  2167.                           are attached.
  2168.  
  2169.    DEVINFO_RS232           The pvDevInfo parameter points to a USHORT
  2170.                            variable that receives the number of RS232 cards
  2171.                            that are attached.
  2172.  
  2173.    DEVINFO_SUBMODEL        The pvDevInfo parameter points to a BYTE variable
  2174.                            that receives the PC submodel type.
  2175.    ──────────────────────────────────────────────────────────────────────────
  2176.  
  2177.  
  2178.    usReserved  Specifies a reserved value; must be zero.
  2179.  
  2180.  Return Value
  2181.  
  2182.    The return value is zero if the function is successful. Otherwise, it is
  2183.    an error value, which may be the following:
  2184.  
  2185.          ERROR_INVALID_PARAMETER
  2186.  
  2187.  Example
  2188.  
  2189.    This example calls the DosDevConfig function to determine if a math
  2190.    coprocessor is present:
  2191.  
  2192.    BYTE bDevInfo;
  2193.    DosDevConfig(&bDevInfo,     /* address of variable for device info. */
  2194.        DEVINFO_COPROCESSOR,    /* information requested                */
  2195.        0);                     /* reserved                             */
  2196.    if (bDevInfo)
  2197.        VioWrtTTY("Math coprocessor present\r\n", 26, 0);
  2198.    else
  2199.        VioWrtTTY("Math coprocessor not present\r\n", 30, 0);
  2200.  
  2201.  See Also
  2202.  
  2203.    DosDevIOCtl, VioGetConfig
  2204.  
  2205.  
  2206.  ────────────────────────────────────────────────────────────────────────────
  2207.  DosDevIOCtl
  2208.  ────────────────────────────────────────────────────────────────────────────
  2209.    USHORT DosDevIOCtl (pvData, pvParms, usFunction, usCategory, hDevice)
  2210.    PVOID pvData;           /*pointer to buffer for data area               */
  2211.    PVOID pvParms;          /*pointer to buffer for command arguments       */
  2212.    USHORT usFunction;      /*device function                               */
  2213.    USHORT usCategory;      /*device category                               */
  2214.    HFILE hDevice;          /*device handle                                 */
  2215.  
  2216.    The DosDevIOCtl function passes device-control functions to the device
  2217.    specified by the hDevice parameter.
  2218.  
  2219.    The DosDevIOCtl function is a family API function.
  2220.  
  2221.  Parameters
  2222.  
  2223.    pvData  Points to a buffer that receives data from the given control
  2224.    function. Some control functions may also read data from the buffer as
  2225.    part of their processing.
  2226.  
  2227.    pvParms  Points to a buffer that contains any data required for the given
  2228.    control function. Some control functions may copy data to the buffer as
  2229.    part of their processing.
  2230.  
  2231.    usFunction  Specifies the device-control function. This parameter can be
  2232.    any one of the device-control function codes described in Chapter 3,
  2233.    "Input-and-Output Control Functions."
  2234.  
  2235.    usCategory  Specifies the device categories. This parameter can be any one
  2236.    of the device categories described in Chapter 3, "Input-and-Output
  2237.    Control Functions."
  2238.  
  2239.    hDevice  Identifies the device that receives the device-control function.
  2240.    This handle must have been created previously by using the DosOpen
  2241.    function or it must be a standard (open) device handle.
  2242.  
  2243.  Return Value
  2244.  
  2245.    In addition to the system error values, the DosDevIOCtl function returns
  2246.    device driver return-value information. Return values in the range 0xFF00
  2247.    through 0xFFFF are user-dependent error values. Return values in the range
  2248.    0xFE00 through 0xFEFF are device-driver-dependent error values.
  2249.  
  2250.    The error value may be one of the following:
  2251.  
  2252.          ERROR_BAD_DRIVER_LEVEL
  2253.          ERROR_INVALID_CATEGORY
  2254.          ERROR_INVALID_DRIVE
  2255.          ERROR_INVALID_FUNCTION
  2256.          ERROR_INVALID_HANDLE
  2257.          ERROR_PROTECTION_VIOLATION
  2258.  
  2259.  Restrictions
  2260.  
  2261.    In real mode, the following restrictions apply to the DosDevIOCtl
  2262.    function:
  2263.  
  2264.    ■  Some control functions in categories 1, 5, and 8 can be used with
  2265.       MS-DOS 3.x, but not with MS-DOS 2.x.
  2266.  
  2267.    ■  Categories 2, 3, 4, 6, 7, 10, and 11 cannot be used.
  2268.  
  2269.  Example
  2270.  
  2271.    This example calls the DosDevIOCtl function to change the typamatic rate
  2272.    of the keyboard. Before you can use the DosDevIOCtl function to access the
  2273.    keyboard you must open the keyboard device and set the focus.
  2274.  
  2275.    USHORT usParameters[2];
  2276.    HKBD hkbd;
  2277.    usParameters[0] = 500;             /* delay in milliseconds     */
  2278.    usParameters[1] = 60;              /* characters per second     */
  2279.    KbdOpen(&hkbd);                    /* opens the keyboard        */
  2280.    KbdGetFocus(0, hkbd);              /* gets the focus            */
  2281.    DosDevIOCtl(0L,                    /* data area                 */
  2282.        (PCHAR) usParameters,          /* command arguments         */
  2283.        0x54,                          /* function code             */
  2284.        4,                             /* device category           */
  2285.        hkbd);                         /* handle to device keyboard */
  2286.  
  2287.  See Also
  2288.  
  2289.    DosOpen, KbdGetFocus, KbdOpen
  2290.  
  2291.  
  2292.  ────────────────────────────────────────────────────────────────────────────
  2293.  DosDisConnectNmPipe
  2294.  ────────────────────────────────────────────────────────────────────────────
  2295.    USHORT DosDisConnectNmPipe (hp)
  2296.    HPIPE hp;               /*pipe handle                                   */
  2297.  
  2298.    The DosDisConnectNmPipe function closes a client's handle of a named pipe.
  2299.  
  2300.  Parameters
  2301.  
  2302.    hp  Identifies the named pipe. This handle must have been created
  2303.    previously by using the DosMakeNmPipe function.
  2304.  
  2305.  Return Value
  2306.  
  2307.    The return value is zero if the function is successful. Otherwise, it is
  2308.    an error value, which may be one of the following:
  2309.  
  2310.          ERROR_BAD_PIPE
  2311.          ERROR_INVALID_FUNCTION
  2312.  
  2313.  Comments
  2314.  
  2315.    If the client end of a named pipe is open, the DosDisConnectNmPipe
  2316.    function forces that end of the named pipe closed. The client will receive
  2317.    an error value the next time it attempts to access the pipe. Closing the
  2318.    client end of a named pipe may discard data in the pipe before the client
  2319.    reads the data.
  2320.  
  2321.    A client that is forced off a pipe by a call to DosDisConnectNmPipe must
  2322.    still close its end of the pipe by using the DosClose function.
  2323.  
  2324.  See Also
  2325.  
  2326.    DosClose, DosConnectNmPipe, DosMakeNmPipe
  2327.  
  2328.  
  2329.  ────────────────────────────────────────────────────────────────────────────
  2330.  DosDupHandle
  2331.  ────────────────────────────────────────────────────────────────────────────
  2332.    USHORT DosDupHandle (hfOld, phfNew)
  2333.    HFILE hfOld;            /*handle of existing file                       */
  2334.    PHFILE phfNew;          /*pointer to variable containing new file       */
  2335.                            /*handle                                        */
  2336.  
  2337.    The DosDupHandle function duplicates a file handle. The new handle has the
  2338.    same handle-specific information as the existing handle, such as its
  2339.    file-pointer position and access method. The original handle and the
  2340.    duplicate are interchangeable, since most changes to one affect the other.
  2341.    For example, moving the file pointer for the original handle moves the
  2342.    pointer for the new handle. Closing the original handle by using the
  2343.    DosClose function does not close the duplicate handle, however, and
  2344.    closing the duplicate does not close the original. A file is not closed
  2345.    until its last handle is closed.
  2346.  
  2347.    The DosDupHandle function is a family API function.
  2348.  
  2349.  Parameters
  2350.  
  2351.    hfOld  Identifies the file handle to duplicate. This handle must have been
  2352.    created previously by using the DosOpen function. The DosDupHandle
  2353.    function closes the file before duplicating its handle.
  2354.  
  2355.    phfNew  Points to the variable that contains the new file handle. If this
  2356.    parameter is 0xFFFF, the DosDupHandle function creates a new handle and
  2357.    copies it to the variable pointed to by the phfNew parameter. Any
  2358.    specified value other than 0xFFFF is used as the handle.
  2359.  
  2360.  Return Value
  2361.  
  2362.    The return value is zero if the function is successful. Otherwise, it is
  2363.    an error value, which may be one of the following:
  2364.  
  2365.          ERROR_INVALID_HANDLE
  2366.          ERROR_INVALID_TARGET_HANDLE
  2367.          ERROR_TOO_MANY_OPEN_FILES
  2368.  
  2369.  Comments
  2370.  
  2371.    You can change the inheritance, fail-on-error, and write-through flags for
  2372.    the duplicate file handle by using the DosSetFHandState function.
  2373.  
  2374.  Example
  2375.  
  2376.    This example calls the DosDupHandle function to duplicate the standard
  2377.    output handle, and then writes "Hello World" to the new handle:
  2378.  
  2379.    HFILE hfNew;
  2380.    USHORT, cbBytesWritten;
  2381.    hfNew = 0xFFFF;                  /* create new handle         */
  2382.    DosDupHandle(1, &hfNew);         /* duplicate standard output */
  2383.    DosWrite(hfNew, "Hello World\r\n", 13, &cbBytesWritten);
  2384.  
  2385.  See Also
  2386.  
  2387.    DosChgFilePtr, DosClose, DosExecPgm, DosMakePipe, DosRead,
  2388.    DosSetFHandState, DosWrite
  2389.  
  2390.  
  2391.  ────────────────────────────────────────────────────────────────────────────
  2392.  DosEnterCritSec
  2393.  ────────────────────────────────────────────────────────────────────────────
  2394.    VOID DosEnterCritSec (VOID)
  2395.  
  2396.    The DosEnterCritSec function suspends every thread in the current process,
  2397.    except for the calling thread. Suspended threads will not execute until
  2398.    the current thread calls the DosExitCritSec function.
  2399.  
  2400.    This function has no parameters.
  2401.  
  2402.  Return Value
  2403.  
  2404.    This function does not return a value.
  2405.  
  2406.  Comments
  2407.  
  2408.    The signal handler (if installed) is not suspended when the
  2409.    DosEnterCritSec function is called. If a signal occurs, the processing
  2410.    done by the signal handler must not interfere with the processing done by
  2411.    the thread calling the DosEnterCritSec function.
  2412.  
  2413.  See Also
  2414.  
  2415.    DosCreateThread, DosExitCritSec, DosHoldSignal, DosSetSigHandler
  2416.  
  2417.  
  2418.  ────────────────────────────────────────────────────────────────────────────
  2419.  DosErrClass
  2420.  ────────────────────────────────────────────────────────────────────────────
  2421.    USHORT DosErrClass (usErrorCode, pusClass, pfsAction, pusLocus|)
  2422.    USHORT usErrorCode;     /*error value for analysis                      */
  2423.    PUSHORT pusClass;       /*pointer to variable for error classification  */
  2424.    PUSHORT pfsAction;      /*pointer to variable for action                */
  2425.    PUSHORT pusLocus;       /*pointer to variable for error origin          */
  2426.  
  2427.    The DosErrClass function retrieves a classification of an error value and
  2428.    a recommended action.
  2429.  
  2430.    The DosErrClass function is a family API function.
  2431.  
  2432.  Parameters
  2433.  
  2434.    usErrorCode  Specifies the error value returned by an MS OS/2 function.
  2435.  
  2436.    pusClass  Points to the variable that receives the classification of the
  2437.    error value. This parameter can be one of the following values:
  2438.  
  2439. ╓┌─┌───────────────────┌─────────────────────────────────────────────────────╖
  2440.    Value               Meaning
  2441.    ──────────────────────────────────────────────────────────────────────────
  2442.    ERRCLASS_ALREADY    Action already taken.
  2443.  
  2444.    ERRCLASS_APPERR     An application error has probably occurred.
  2445.  
  2446.    ERRCLASS_AUTH       Authorization has failed.
  2447.  
  2448.    ERRCLASS_BADFMT     Bad format for call data.
  2449.  
  2450.    ERRCLASS_CANT       Cannot perform requested action.
  2451.  
  2452.    ERRCLASS_HRDFAIL    A device-hardware failure has occurred.
  2453.  
  2454.    ERRCLASS_INTRN      An internal error has occurred.
  2455.  
  2456.    ERRCLASS_LOCKED     Resource or data is locked.
  2457.  
  2458.    ERRCLASS_MEDIA      Incorrect media; a CRC error has occurred.
  2459.    Value               Meaning
  2460.    ──────────────────────────────────────────────────────────────────────────
  2461.   ERRCLASS_MEDIA      Incorrect media; a CRC error has occurred.
  2462.  
  2463.    ERRCLASS_NOTFND     The item was not located.
  2464.  
  2465.    ERRCLASS_OUTRES     Out of resources.
  2466.  
  2467.    ERRCLASS_SYSFAIL    A system failure has occurred.
  2468.  
  2469.    ERRCLASS_TEMPSIT    This is a temporary situation.
  2470.  
  2471.    ERRCLASS_TIME       A time-out has occurred.
  2472.  
  2473.    ERRCLASS_UNK        The error is unclassified.
  2474.    ──────────────────────────────────────────────────────────────────────────
  2475.  
  2476.  
  2477.    pfsAction  Points to the variable that receives the recommended action for
  2478.    the specific error. This parameter can be one of the following values:
  2479.  
  2480.    Value               Meaning
  2481.    ──────────────────────────────────────────────────────────────────────────
  2482.    ERRACT_ABORT        Terminate in an orderly manner.
  2483.  
  2484.    ERRACT_DLYRET       Delay and retry.
  2485.  
  2486.    ERRACT_IGNORE       Ignore the error.
  2487.  
  2488.    ERRACT_INTRET       Retry after user intervention.
  2489.  
  2490.    ERRACT_PANIC        Terminate immediately.
  2491.  
  2492.    ERRACT_RETRY        Retry immediately.
  2493.  
  2494.    ERRACT_USER         Bad user input; get new values.
  2495.    ──────────────────────────────────────────────────────────────────────────
  2496.  
  2497.    pusLocus  Points to the variable that receives the error's origin in the
  2498.    system. This parameter can be one of the following values:
  2499.  
  2500.    Value               Meaning
  2501.    ──────────────────────────────────────────────────────────────────────────
  2502.    ERRLOC_DISK         The error occurred in a random-access device, such as
  2503.                        a disk drive.
  2504.  
  2505.    ERRLOC_MEM          This is a memory-parameter error.
  2506.  
  2507.    ERRLOC_NET          This is a network error.
  2508.  
  2509.    ERRLOC_SERDEV       This is a serial-device error.
  2510.  
  2511.    ERRLOC_UNK          The origin of the error is unknown.
  2512.    ──────────────────────────────────────────────────────────────────────────
  2513.  
  2514.  Return Value
  2515.  
  2516.    The return value is zero if the function is successful. Otherwise, it is
  2517.    an error value.
  2518.  
  2519.  Comments
  2520.  
  2521.    The ERRACT_, ERRCLASS_, and ERRLOC_ constants are defined in the bseerr.h
  2522.    file.
  2523.  
  2524.  Example
  2525.  
  2526.    This example calls the DosQFileMode function to determine the status of
  2527.    the file a:\abc.exe. If DosQFileMode returns an error, the DosErrClass
  2528.    function is called to determine the class of the error. The process
  2529.    terminates if the error is a device-hardware failure──for example, if a
  2530.    drive door is open or a specified disk drive is nonexistent.
  2531.  
  2532.    USHORT usAttribute, usError, usClass, fsAction, usLocus;
  2533.    usError = DosQFileMode("a:\\abc.ext", &usAttribute, 0L);
  2534.    if (usError) {
  2535.        DosErrClass(usError,             /* error number            */
  2536.            &usClass,                    /* error classification    */
  2537.            &fsAction,                   /* recommended action      */
  2538.            &usLocus);                   /* error origin            */
  2539.        if (usClass == ERRCLASS_HRDFAIL) /* device-hardware failure */
  2540.            DosExit(1, EXIT_PROCESS);    /* exits application       */
  2541.  
  2542.  See Also
  2543.  
  2544.    DosError, DosExit, DosQFileMode
  2545.  
  2546.  
  2547.  ────────────────────────────────────────────────────────────────────────────
  2548.  DosError
  2549.  ────────────────────────────────────────────────────────────────────────────
  2550.    USHORT DosError (fEnable)
  2551.    USHORT fEnable;         /*enable/disable error handling                 */
  2552.  
  2553.    The DosError function enables or disables hard-error and exception
  2554.    processing for a process. By default, the system displays a message and
  2555.    prompts for user input when a hard error or exception occurs. A hard error
  2556.    is typically an error that cannot be resolved by software──for example,
  2557.    when the drive door is opened while a removeable disk is being read.
  2558.  
  2559.    The DosError function disables the default processing by forgoing the
  2560.    displayed message and directing any function that encounters a hard error
  2561.    or exception to return an appropriate error value. The process must
  2562.    determine the appropriate action by referring to the error value.
  2563.  
  2564.    The DosError function is a family API function.
  2565.  
  2566.  Parameters
  2567.  
  2568.    fEnable  Specifies whether to disable or enable processing. This parameter
  2569.    can be one of the following values:
  2570.  
  2571.    Value                 Meaning
  2572.    ──────────────────────────────────────────────────────────────────────────
  2573.    EXCEPTION_DISABLE     Disable exception processing.
  2574.  
  2575.    EXCEPTION_ENABLE      Enable exception processing.
  2576.  
  2577.    HARDERROR_DISABLE     Disable hard-error processing.
  2578.  
  2579.    HARDERROR_ENABLE      Enable hard-error processing.
  2580.    ──────────────────────────────────────────────────────────────────────────
  2581.  
  2582.  Return Value
  2583.  
  2584.    The return value is zero if the function is successful. Otherwise, it is
  2585.    an error value, which may be the following:
  2586.  
  2587.          ERROR_INVALID_DATA
  2588.  
  2589.  Comments
  2590.  
  2591.    By default, the system terminates any process in which an exception
  2592.    occurs. Although the DosError function can disable the message when an
  2593.    exception occurs, it cannot disable the termination of the process. To
  2594.    prevent a process from being terminated, use the DosSetVec function to
  2595.    trap the exception and carry out process-specific exception processing.
  2596.  
  2597.  Restrictions
  2598.  
  2599.    In real mode, the following restriction applies to the DosError function:
  2600.  
  2601.    ■  If the fEnable parameter is HARDERROR_DISABLE, all subsequent int 24h
  2602.       requests fail until a call is made to the DosError function with
  2603.       fEnable set to HARDERROR_ENABLE.
  2604.  
  2605.  Example
  2606.  
  2607.    This example calls the DosError function to turn off hard-error
  2608.    processing, then calls the DosErrClass function to process any error that
  2609.    is received:
  2610.  
  2611.    USHORT usAttribute, usError, usClass, fsAction, usLocus;
  2612.    DosError(HARDERROR_DISABLE);        /* turn off hard-error processing */
  2613.    usError = DosQFileMode("a:\\abc.ext", &usAttribute, 0L);
  2614.    if (usError) {
  2615.        DosErrClass(usError, &usClass, &fsAction, &usLocus);
  2616.        if (usClass == ERRCLASS_HRDFAIL)
  2617.            DosExit(1, EXIT_PROCESS);
  2618.  
  2619.  See Also
  2620.  
  2621.    DosErrClass, DosSetFHandState
  2622.  
  2623.  
  2624.  ────────────────────────────────────────────────────────────────────────────
  2625.  DosExecPgm
  2626.  ────────────────────────────────────────────────────────────────────────────
  2627.    USHORT DosExecPgm (pchFailName, cbFailName, fExecFlags, pszArgs, pszEnv,
  2628.    prescResults, pszPgmName)
  2629.    PCHAR pchFailName;      /*pointer to buffer for failed filename         */
  2630.    SHORT cbFailName;       /*size of failed filename buffer                */
  2631.    USHORT fExecFlags;      /*synchronous/trace flags                       */
  2632.    PSZ pszArgs;            /*pointer to argument strings                   */
  2633.    PSZ pszEnv;             /*pointer to environment strings                */
  2634.    PRESULTCODES prescResults;
  2635.                            /*pointer to structure receiving result codes   */
  2636.    PSZ pszPgmName;         /*pointer to program name to execute            */
  2637.  
  2638.    The DosExecPgm function loads and starts a child process.
  2639.  
  2640.    The DosExecPgm function is a family API function.
  2641.  
  2642.  Parameters
  2643.  
  2644.    pchFailName  Points to the buffer that receives the name of the object
  2645.    (such as a dynamic-link module). The DosExecPgm function copies a name to
  2646.    this buffer if it cannot load and start the specified program.
  2647.  
  2648.    cbFailName  Specifies the length (in bytes) of the buffer pointed to by
  2649.    the pchFailName parameter.
  2650.  
  2651.    fExecFlags  Specifies how a given program should be run. This parameter
  2652.    can be one of the following values:
  2653.  
  2654. ╓┌─┌───────────────────┌─────────────────────────────────────────────────────╖
  2655.    Value               Meaning
  2656.    ──────────────────────────────────────────────────────────────────────────
  2657.    EXEC_ASYNC          Execute asynchronously to the parent process. The
  2658.                        DosExecPgm function copies the process identifier of
  2659.                        the child process to the codeTerminate field of the
  2660.                        structure pointed to by the prescResults parameter.
  2661.  
  2662.    EXEC_ASYNCRESULT    Execute asynchronously to the parent process. Before
  2663.                        returning, the DosExecPgm function copies the process
  2664.                        identifier of the child process to the codeTerminate
  2665.                        field of the structure pointed to by the prescResults
  2666.                        parameter. When the child process ends, the system
  2667.                        saves the termination and result codes in memory it
  2668.                        reserves for these codes. This memory remains
  2669.    Value               Meaning
  2670.    ──────────────────────────────────────────────────────────────────────────
  2671.                       reserves for these codes. This memory remains
  2672.                        allocated until the parent process calls the DosCwait
  2673.                        function to retrieve the information.
  2674.  
  2675.    EXEC_SYNC           Execute synchronously to the parent process. When the
  2676.                        child process ends, the DosExecPgm function copies its
  2677.                        termination and result codes to the structure pointed
  2678.                        to by the prescResults parameter.
  2679.  
  2680.    EXEC_BACKGROUND     Execute asynchronously to the parent process and
  2681.                        detach from the screen group of the parent process.
  2682.                        The detached process executes in the background. If a
  2683.                        process terminates the parent process──for example, by
  2684.                        using the DosKillProcess function──the child process
  2685.                        continues to run. The child process should not require
  2686.                        screen output (other than through the VioPopUp
  2687.                        function). The child process also should not call Vio,
  2688.                        Kbd, or Mou functions.
  2689.  
  2690.    Value               Meaning
  2691.    ──────────────────────────────────────────────────────────────────────────
  2692. 
  2693.    EXEC_TRACE          Execute under conditions for tracing. The parent
  2694.                        process debugs the child process.
  2695.    ──────────────────────────────────────────────────────────────────────────
  2696.  
  2697.  
  2698.    pszArgs  Points to a set of null-terminated argument strings that
  2699.    represent the program's command parameters. The argument strings are
  2700.    copied to the process's environment segment. The string can have any
  2701.    format but must end with two null characters. A typical format is the
  2702.    program name, a null character, the program parameters (separated by
  2703.    spaces), and two null characters.
  2704.  
  2705.    If this parameter is zero, no argument strings are passed to the child
  2706.    process.
  2707.  
  2708.    pszEnv  Points to a set of null-terminated environment strings that
  2709.    represent environment variables and their current values. The environment
  2710.    strings are copied to the process's environment segment. These strings
  2711.    represent environment variables and their current values. An environment
  2712.    string has the following form:
  2713.  
  2714.          variable=value
  2715.  
  2716.    Two or more strings can be concatenated to pass multiple environment
  2717.    strings to the child process. The last environment string must end with
  2718.    two null characters.
  2719.  
  2720.    If this parameter is zero, the child process inherits the unchanged
  2721.    environment of the parent process.
  2722.  
  2723.    prescResults  Points to the RESULTCODES structure that receives the
  2724.    termination and result codes of the child process. The RESULTCODES
  2725.    structure has the following form:
  2726.  
  2727.    typedef struct _RESULTCODES {
  2728.        USHORT codeTerminate;
  2729.        USHORT codeResult;
  2730.    } RESULTCODES;
  2731.  
  2732.    For a full description, see Chapter 4, "Types, Macros, Structures."
  2733.  
  2734.    pszPgmName  Points to a null-terminated string that specifies the process
  2735.    to load and start. The string must be a valid MS OS/2 filename and include
  2736.    the filename extension. The string must specify an executable file.
  2737.  
  2738.  Return Value
  2739.  
  2740.    The return value is zero if the function is successful. Otherwise, it is
  2741.    an error value, which may be one of the following:
  2742.  
  2743.          ERROR_ACCESS_DENIED
  2744.          ERROR_AUTODATASEG_EXCEEDS_64k
  2745.          ERROR_BAD_ENVIRONMENT
  2746.          ERROR_BAD_FORMAT
  2747.          ERROR_DRIVE_LOCKED
  2748.          ERROR_DYNLINK_FROM_INVALID_RING
  2749.          ERROR_EXE_MARKED_INVALID
  2750.          ERROR_FILE_NOT_FOUND
  2751.          ERROR_INTERRUPT
  2752.          ERROR_INVALID_DATA
  2753.          ERROR_INVALID_EXE_SIGNATURE
  2754.          ERROR_INVALID_FUNCTION
  2755.          ERROR_INVALID_MINALLOCSIZE
  2756.          ERROR_INVALID_MODULETYPE
  2757.          ERROR_INVALID_ORDINAL
  2758.          ERROR_INVALID_SEGDPL
  2759.          ERROR_INVALID_SEGMENT_NUMBER
  2760.          ERROR_INVALID_STACKSEG
  2761.          ERROR_INVALID_STARTING_CODESEG
  2762.          ERROR_ITERATED_DATA_EXCEEDS_64K
  2763.          ERROR_LOCK_VIOLATION
  2764.          ERROR_NO_PROC_SLOTS
  2765.          ERROR_NOT_DOS_DISK
  2766.          ERROR_NOT_ENOUGH_MEMORY
  2767.          ERROR_PATH_NOT_FOUND
  2768.          ERROR_PROC_NOT_FOUND
  2769.          ERROR_RELOC_CHAIN_XEEDS_SEGLIM
  2770.          ERROR_SHARING_BUFFER_EXCEEDED
  2771.          ERROR_SHARING_VIOLATION
  2772.          ERROR_TOO_MANY_OPEN_FILES
  2773.  
  2774.  Comments
  2775.  
  2776.    If the filename is a complete pathname (a drive name, path, and filename),
  2777.    the DosExecPgm function loads the program from the specified location. If
  2778.    only a filename is given and that filename is not found in the current
  2779.    directory, the DosExecPgm function searches each directory specified in
  2780.    the parent process's PATH environment variable for the given file.
  2781.  
  2782.    The child process receives a discrete address space──that is, it receives
  2783.    its own local descriptor table. This means that the parent process and the
  2784.    child process cannot access each other's data. To pass data between
  2785.    processes, the parent process typically opens a pipe by using the
  2786.    DosMakePipe function before starting the child process, then lets the
  2787.    child process access one end of the pipe.
  2788.  
  2789.    The environment segment of the child process consists of the environment
  2790.    strings (at offset zero), the program filename, and the argument strings.
  2791.    The system passes the offset to the argument strings in the bx register
  2792.    and the environment segment's selector in the ax register. These values
  2793.    can also be retrieved by using the DosGetEnv function.
  2794.  
  2795.    When the child process starts, it inherits all pipe handles and all open
  2796.    file handles from the parent process. (File handles that are opened with
  2797.    the fsOpenMode parameter of the DosOpen function set to
  2798.    OPEN_FLAGS_NOINHERIT are not inherited by the child process──for more
  2799.    information, see the DosOpen function.) The child process can use these
  2800.    handles immediately, without opening or preparing them in any way. This
  2801.    gives the parent process control over the files associated with the
  2802.    standard input, output, and error file handles. For example, the parent
  2803.    process can redirect the standard output from the screen to a file by
  2804.    opening the file and duplicating its handle as the standard output handle
  2805.    (0x0001). If the child process then writes to the standard output, the
  2806.    data goes to the file, not to the screen.
  2807.  
  2808.  Restrictions
  2809.  
  2810.    In real mode, the following restrictions apply to the DosExecPgm function:
  2811.  
  2812.    ■  The only value allowed for the fExecFlags parameter is EXEC_SYNC.
  2813.  
  2814.    ■  The buffer pointed to by the pchFailName parameter is filled with
  2815.       blanks, even if the function fails.
  2816.  
  2817.    ■  The codeResult field of the RESULTCODES structure receives the exit
  2818.       code from either the DosExit function or the MS-DOS int 21h, 4cH system
  2819.       call, whichever is used to terminate the program.
  2820.  
  2821.  Example
  2822.  
  2823.    This example calls the DosExecPgm function to execute the program abc.exe.
  2824.    The program executes as a child process asynchronously with the parent
  2825.    program.
  2826.  
  2827.    CHAR achFailName[128];
  2828.    RESULTCODES rescResults;
  2829.    DosExecPgm(achFailName,                 /* object-name buffer */
  2830.        sizeof(achFailName),                /* length of buffer   */
  2831.        EXEC_ASYNCH,                        /* async flag         */
  2832.        "abc = 0",                        /* argument string    */
  2833.        0,                                  /* environment string */
  2834.        &rescResults,                       /* address of result  */
  2835.        "abc.exe");                         /* name of program    */
  2836.  
  2837.  See Also
  2838.  
  2839.    DosCreateThread, DosCwait, DosExit, DosGetEnv, DosKillProcess,
  2840.    DosOpen
  2841.  
  2842.  
  2843.  ────────────────────────────────────────────────────────────────────────────
  2844.  DosExit
  2845.  ────────────────────────────────────────────────────────────────────────────
  2846.    VOID DosExit (fTerminate, usExitCode)
  2847.    USHORT fTerminate;      /*terminate current/all threads                 */
  2848.    USHORT usExitCode;      /*result code for parent process                */
  2849.  
  2850.    The DosExit function ends a thread or a process and all its threads.
  2851.  
  2852.    The DosExit function is a family API function.
  2853.  
  2854.  Parameters
  2855.  
  2856.    fTerminate  Specifies whether to terminate the current thread or the
  2857.    process and all its threads. If this parameter is EXIT_THREAD, only the
  2858.    current thread ends. If it is EXIT_PROCESS, all threads in the process
  2859.    end.
  2860.  
  2861.    usExitCode  Specifies the program's exit code.
  2862.  
  2863.  Return Value
  2864.  
  2865.    This function does not return a value.
  2866.  
  2867.  Comments
  2868.  
  2869.    If the fTerminate parameter is EXIT_THREAD, the function ends the current
  2870.    thread. If the current thread is the last one in the process, the process
  2871.    also ends. If the fTerminate parameter is EXIT_PROCESS, the DosExit
  2872.    function terminates all threads in the process and creates a final
  2873.    temporary thread. The temporary thread executes any functions given in the
  2874.    list created by the DosExitList function. When this last thread ends, the
  2875.    system frees any resources used by the process. The exit code specified by
  2876.    the last call to the DosExit function is supplied to the parent process by
  2877.    using the DosCwait function.
  2878.  
  2879.  Restrictions
  2880.  
  2881.    In real mode, the following restriction applies to the DosExit function:
  2882.  
  2883.    ■  The function always exits from the current program, since there are no
  2884.       threads in the real-mode environment.
  2885.  
  2886.  Example
  2887.  
  2888.    This example creates a thread, referred to as thread 2. This example shows
  2889.    two ways of stopping thread 2: by stopping all threads in the process and
  2890.    by stopping thread 2 specifically. Thread 1, the main process, exits and
  2891.    ends all threads by calling the DosExit function with the first parameter
  2892.    set to EXIT_PROCESS. Thread 2, the thread created with the call to
  2893.    DosCreateThread, ends only itself, by calling DosExit with the first
  2894.    parameter set to EXIT_THREAD.
  2895.  
  2896.    BYTE bStackArea[2048];
  2897.  
  2898.    main() {
  2899.        .
  2900.        .
  2901.        .
  2902.        PVOID pStack2 = bStackArea + 512;
  2903.        TID tidThread2;
  2904.        DosCreateThread(Thread2, &tidThread2, pStack2);
  2905.        .
  2906.        .
  2907.        .
  2908.        DosExit(EXIT_PROCESS,      /* exit process                   */
  2909.            0);                    /* return value                   */
  2910.    }
  2911.    VOID FAR Thread2() {
  2912.        .
  2913.        .
  2914.        .
  2915.        DosExit(EXIT_THREAD,       /* exit thread, process continues */
  2916.            0);                    /* return value                   */
  2917.    }
  2918.  
  2919.  See Also
  2920.  
  2921.    DosCwait, DosExecPgm, DosExitList
  2922.  
  2923.  
  2924.  ────────────────────────────────────────────────────────────────────────────
  2925.  DosExitCritSec
  2926.  ────────────────────────────────────────────────────────────────────────────
  2927.    VOID DosExitCritSec (VOID)
  2928.  
  2929.    The DosExitCritSec function restores execution of all threads in the
  2930.    process that were suspended by the DosEnterCritSec function.
  2931.  
  2932.    This function has no parameters.
  2933.  
  2934.  Return Value
  2935.  
  2936.    This function does not return a value.
  2937.  
  2938.  See Also
  2939.  
  2940.    DosCreateThread, DosEnterCritSec
  2941.  
  2942.  
  2943.  ────────────────────────────────────────────────────────────────────────────
  2944.  DosExitList
  2945.  ────────────────────────────────────────────────────────────────────────────
  2946.    USHORT DosExitList (fFnCode, pfnFunction)
  2947.    USHORT fFnCode;         /*function code                                 */
  2948.    PFNEXITLIST pfnFunction(USHORT);
  2949.                            /*pointer to address of function                */
  2950.  
  2951.    The DosExitList function specifies a function that is executed when the
  2952.    current process ends. This "termination function" may define additional
  2953.    termination functions. The DosExitList function may be called one or more
  2954.    times: each call adds or subtracts a function from an internal list that
  2955.    is maintained by the system. When the current process terminates, MS OS/2
  2956.    transfers control to each function on the list.
  2957.  
  2958.  Parameters
  2959.  
  2960.    fFnCode  Specifies whether a function's address is added to or removed
  2961.    from the list. This parameter can be one of the following values:
  2962.  
  2963.    Value           Meaning
  2964.    ──────────────────────────────────────────────────────────────────────────
  2965.    EXLST_ADD       Add function to termination list.
  2966.  
  2967.    EXLST_EXIT      Termination processing complete; call the next function on
  2968.                    termination list.
  2969.  
  2970.    EXLST_REMOVE    Remove function from termination list.
  2971.    ──────────────────────────────────────────────────────────────────────────
  2972.  
  2973.    pfnFunction  Points to the termination function to be added to the list.
  2974.    For a full description, see the following "Comments" section.
  2975.  
  2976.  Return Value
  2977.  
  2978.    The return value is zero if the function is successful. Otherwise, it is
  2979.    an error value, which may be one of the following:
  2980.  
  2981.          ERROR_INVALID_DATA
  2982.          ERROR_NOT_ENOUGH_MEMORY
  2983.  
  2984.  Comments
  2985.  
  2986.    Dynamic-link-library modules often use the DosExitList function; this
  2987.    function allows library modules to free resources or clear flags and
  2988.    semaphores if the client process terminates without notifying them.
  2989.  
  2990.    The termination function has one parameter and no return value. The
  2991.    function should have the following form:
  2992.  
  2993.    PFNEXITLIST FuncName(usTermCode)
  2994.    USHORT usTermCode;
  2995.    {
  2996.        .
  2997.        .
  2998.        .
  2999.        DosExitList(EXLST_EXIT, 0);
  3000.    }
  3001.  
  3002.    The usTermCode parameter of the termination function specifies the reason
  3003.    the process ended. This parameter is one of the following values:
  3004.  
  3005.    Value            Meaning
  3006.    ──────────────────────────────────────────────────────────────────────────
  3007.    TC_EXIT          Normal exit
  3008.  
  3009.    TC_HARDERROR     Hard-error abort
  3010.  
  3011.    TC_KILLPROCESS   Unintercepted DosKillProcess
  3012.  
  3013.    TC_TRAP          Trap operation
  3014.    ──────────────────────────────────────────────────────────────────────────
  3015.  
  3016.    Before transferring control to the termination function, MS OS/2 resets
  3017.    the stack to its initial value. MS OS/2 then passes control to the
  3018.    function by using a jmp instruction. The termination function should carry
  3019.    out its tasks and then call the DosExitList function with the fFnCode
  3020.    parameter set to EXLST_EXIT. This parameter setting directs the system to
  3021.    call the next function on the termination list. When all functions on the
  3022.    list have been called, the process ends.
  3023.  
  3024.    Termination functions should be as short and fail-safe as possible. When
  3025.    the termination functions are executed, all threads except for the one
  3026.    executing the DosExitList function have been destroyed. A termination
  3027.    function must call the DosExitList function to end; otherwise, the process
  3028.    "hangs," since MS OS/2 cannot terminate it.
  3029.  
  3030.    A termination function can call most MS OS/2 system functions; however, it
  3031.    must not call the DosCreateThread or DosExecPgm function.
  3032.  
  3033.  Example
  3034.  
  3035.    This example calls the DosExitList function, which then adds the locally
  3036.    defined function CleanUp to the list of routines to be called when the
  3037.    process terminates. The CleanUp function displays a message that it is
  3038.    cleaning up, then calls DosExitList, reporting that it has finished and
  3039.    that the next function on the termination list can be called.
  3040.  
  3041.        DosExitList(EXLST_ADD,              /* adds address to the list */
  3042.            CleanUp);                       /* function address         */
  3043.        .
  3044.        .
  3045.        .
  3046.        DosExit(EXIT_PROCESS, 0);
  3047.    }
  3048.  
  3049.    VOID PASCAL FAR CleanUp(usTermCode)
  3050.    USHORT usTermCode;
  3051.    {
  3052.        VioWrtTTY("Cleaning up...\r\n", 16, 0);
  3053.        .
  3054.        .
  3055.        .
  3056.        DosExitList(EXLST_EXIT,             /* termination complete     */
  3057.            0L);
  3058.    }
  3059.  
  3060.  See Also
  3061.  
  3062.    DosCreateThread, DosExecPgm, DosExit
  3063.  
  3064.  
  3065.  ────────────────────────────────────────────────────────────────────────────
  3066.  DosFileLocks
  3067.  ────────────────────────────────────────────────────────────────────────────
  3068.    USHORT DosFileLocks (hf, pfUnlock, pfLock)
  3069.    HFILE hf;               /*file handle                                   */
  3070.    PFILELOCK pfUnLock;     /*pointer to range to be unlocked               */
  3071.    PFILELOCK pfLock;       /*pointer to range to be locked                 */
  3072.  
  3073.    The DosFileLocks function unlocks and/or locks a region in an open file.
  3074.    Locking a region prevents other processes from accessing the locked
  3075.    region.
  3076.  
  3077.    The DosFileLocks function is a family API function.
  3078.  
  3079.  Parameters
  3080.  
  3081.    hf  Identifies the file handle. This handle must have been created
  3082.    previously by using the DosOpen function.
  3083.  
  3084.    pfUnLock  Points to the FILELOCK structure that specifies the starting
  3085.    position in the file and the number of bytes of the file to unlock. This
  3086.    parameter is ignored if NULL is specified instead of a structure address.
  3087.    The FILELOCK structure has the following form:
  3088.  
  3089.    typedef struct _FILELOCK {
  3090.        LONG lOffset;
  3091.        LONG lRange;
  3092.    } FILELOCK;
  3093.  
  3094.    For a full description, see Chapter 4, "Types, Macros, Structures."
  3095.  
  3096.    pfLock  Points to the FILELOCK structure that specifies the starting
  3097.    position in the file and the number of bytes of the file to lock. This
  3098.    parameter is ignored if NULL is specified instead of a structure address.
  3099.  
  3100.  Return Value
  3101.  
  3102.    The return value is zero if the function is successful. Otherwise, it is
  3103.    an error value, which may be one of the following:
  3104.  
  3105.          ERROR_INVALID_HANDLE
  3106.          ERROR_LOCK_VIOLATION
  3107.  
  3108.  Comments
  3109.  
  3110.    The DosFileLocks function can both lock and unlock regions. The system
  3111.    unlocks any specified region before locking any other region. Locked
  3112.    regions can overlap, but if one region would entirely encompass another,
  3113.    the smaller region should be unlocked first. The DosFileLocks function can
  3114.    lock any part of a file. Attempting to lock bytes beyond the end of a file
  3115.    does not result in an error.
  3116.  
  3117.  Example
  3118.  
  3119.    This example opens the file abc and calls the DosFileLocks function to
  3120.    lock 100 bytes of the file, starting with byte number three. No other file
  3121.    may read or write to this range in the file until DosFileLocks is called
  3122.    to unlock the range or the file is closed. The same structure is used to
  3123.    lock the file and to unlock the file.
  3124.  
  3125.    FILELOCK flock;
  3126.    HFILE hf;
  3127.    USHORT usAction;
  3128.  
  3129.    /* open the file */
  3130.  
  3131.    DosOpen("abc",                            /* filename to open       */
  3132.        &hf,                                  /* address of file handle */
  3133.        &usAction,                            /* action taken           */
  3134.        100L,                                 /* size of new file       */
  3135.        FILE_NORMAL,                          /* file attribute         */
  3136.        FILE_OPEN,                            /* open if file exists    */
  3137.        OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE   /* open mode      */
  3138.        0L);                                          /* reserved       */
  3139.  
  3140.    flock.lOffset = 3L;               /* offset to begin lock           */
  3141.    flock.lRange = 100L;              /* range to lock                  */
  3142.    DosFileLocks(hf,                  /* handle of file to lock         */
  3143.        NULL,                         /* unlock range (NULL to disable) */
  3144.        &flock);                      /* address of lock range          */
  3145.        .
  3146.        . /* other file processing occurs here */
  3147.        .
  3148.    DosFileLocks(hf,                  /* handle of file to unlock       */
  3149.        &flock,                       /* address of unlock range        */
  3150.        NULL);                        /* lock range (NULL to disable)   */
  3151.  
  3152.  See Also
  3153.  
  3154.    DosDupHandle, DosExecPgm, DosOpen
  3155.  
  3156.  
  3157.  ────────────────────────────────────────────────────────────────────────────
  3158.  DosFindClose
  3159.  ────────────────────────────────────────────────────────────────────────────
  3160.    USHORT DosFindClose (hdir)
  3161.    HDIR hdir;              /*handle of search directory                    */
  3162.  
  3163.    The DosFindClose function closes the specified search-directory handle.
  3164.    The DosFindFirst and DosFindNext functions use the search-directory handle
  3165.    to locate files with names that match a given name.
  3166.  
  3167.    The DosFindClose function is a family API function.
  3168.  
  3169.  Parameters
  3170.  
  3171.    hdir  Identifies the search directory. This handle must have been
  3172.    previously opened by using the DosFindFirst function.
  3173.  
  3174.  Return Value
  3175.  
  3176.    The return value is zero if the function is successful. Otherwise, it is
  3177.    an error value, which may be the following:
  3178.  
  3179.          ERROR_INVALID_HANDLE
  3180.  
  3181.  Example
  3182.  
  3183.    This example calls the DosFindFirst function to find all files that match
  3184.    "*.*". When DosFindFirst is finished, the handle is closed by calling the
  3185.    DosFindClose function.
  3186.  
  3187.    HDIR hdir = 0xFFFF;
  3188.    USHORT usSearchCount = 1;
  3189.    FILEFINDBUF findbuf;
  3190.    DosFindFirst("*.*", &hdir, FILE_NORMAL, &findbuf,
  3191.        sizeof(findbuf), &usSearchCount, 0L);
  3192.        .
  3193.        .
  3194.        .
  3195.    DosFindClose(hdir);                /* closes the search directory */
  3196.  
  3197.  See Also
  3198.  
  3199.    DosFindFirst, DosFindNext, DosSearchPath
  3200.  
  3201.  ────────────────────────────────────────────────────────────────────────────
  3202.  DosFindFirst
  3203.  ────────────────────────────────────────────────────────────────────────────
  3204.    USHORT DosFindFirst (pszFileSpec, phdir, usAttribute, pfindbuf, usBufLen,
  3205.    pusSearchCount, ulReserved)
  3206.    PSZ pszFileSpec;        /*pointer to string specifying pathname         */
  3207.    PHDIR phdir;            /*pointer to variable for handle                */
  3208.    USHORT usAttribute;     /*search attribute                              */
  3209.    PFILEFINDBUF pfindbuf;  /*pointer to structure receiving result         */
  3210.    USHORT usBufLen;        /*length of result buffer                       */
  3211.    PUSHORT pusSearchCount; /*pointer to variable for file count            */
  3212.    ULONG ulReserved;       /*must be zero                                  */
  3213.  
  3214.    The DosFindFirst function searches a directory for the file or files whose
  3215.    filename and attributes match the specified filename and attributes. The
  3216.    function copies the name and directory information of the file to the
  3217.    FILEFINDBUF structure. The information returned is as accurate as the most
  3218.    recent call to the DosClose or DosBufReset function.
  3219.  
  3220.    The DosFindFirst function is a family API function.
  3221.  
  3222.  Parameters
  3223.  
  3224.    pszFileSpec  Points to a null-terminated string. This string must be a
  3225.    valid MS OS/2 pathname and may contain wildcard characters.
  3226.  
  3227.    phdir  Points to the variable that contains the handle of the directory to
  3228.    be searched.
  3229.  
  3230.    If the phdir parameter is HDIR_SYSTEM, the system default search-directory
  3231.    handle is used. If it is HDIR_CREATE, the search directory that is used by
  3232.    the process is created, and the function copies the handle of this search
  3233.    directory to the variable pointed to by the phDir parameter. If the handle
  3234.    was created by a previous call to the DosFindFirst function, it can be
  3235.    used in subsequent calls to the DosFindNext function.
  3236.  
  3237.    usAttribute  Specifies the file attribute(s) of the file to be located.
  3238.    This parameter can be a combination of the following values:
  3239.  
  3240.    Value             Meaning
  3241.    ──────────────────────────────────────────────────────────────────────────
  3242.    FILE_NORMAL       Search for normal files.
  3243.  
  3244.    FILE_READONLY     Search for read-only files.
  3245.  
  3246.    FILE_HIDDEN       Search for hidden files.
  3247.  
  3248.    FILE_SYSTEM       Search for system files.
  3249.  
  3250.    FILE_DIRECTORY    Search for subdirectories.
  3251.  
  3252.    FILE_ARCHIVED     Search for archived files.
  3253.    ──────────────────────────────────────────────────────────────────────────
  3254.  
  3255.    pfindbuf  Points to the FILEFINDBUF structure that receives the result of
  3256.    the search. The FILEFINDBUF structure has the following form:
  3257.  
  3258.    typedef struct _FILEFINDBUF {
  3259.        FDATE  fdateCreation;
  3260.        FTIME  ftimeCreation;
  3261.        FDATE  fdateLastAccess;
  3262.        FTIME  ftimeLastAccess;
  3263.        FDATE  fdateLastWrite;
  3264.        FTIME  ftimeLastWrite;
  3265.        ULONG  cbFile;
  3266.        ULONG  cbFileAlloc;
  3267.        USHORT attrFile;
  3268.        UCHAR  cchName;
  3269.        CHAR   achName[13];
  3270.    } FILEFINDBUF;
  3271.  
  3272.    For a full description, see Chapter 4, "Types, Macros, Structures."
  3273.    usBufLen  Specifies the length (in bytes) of the structure pointed to by
  3274.    the pfindbuf parameter.
  3275.  
  3276.    pusSearchCount  Points to a variable that specifies the number of matching
  3277.    filenames to locate. The DosFindFirst function copies the number of
  3278.    filenames found to this parameter before returning.
  3279.  
  3280.    ulReserved  Specifies a reserved value; must be zero.
  3281.  
  3282.  Return Value
  3283.  
  3284.    The return value is zero if the function is successful. Otherwise, it is
  3285.    an error value, which may be one of the following:
  3286.  
  3287.          ERROR_BUFFER_OVERFLOW
  3288.          ERROR_DRIVE_LOCKED
  3289.          ERROR_FILE_NOT_FOUND
  3290.          ERROR_INVALID_HANDLE
  3291.          ERROR_INVALID_PARAMETER
  3292.          ERROR_NO_MORE_FILES
  3293.          ERROR_NO_MORE_SEARCH_HANDLES
  3294.          ERROR_NOT_DOS_DISK
  3295.          ERROR_PATH_NOT_FOUND
  3296.  
  3297.  Comments
  3298.  
  3299.    The pusSearchCount parameter specifies the number of files to search for.
  3300.    The number of files whose information is copied is the number of files
  3301.    requested, the number of files whose information fits in the structure, or
  3302.    the number of files that exist, whichever is smallest. To receive
  3303.    information for more than one file, the pfindbuf parameter must point to a
  3304.    buffer that consists of consecutive FILEFINDBUF structures──for example,
  3305.    an array of structures. If the DosFindFirst function fails to find a match
  3306.    or cannot copy all of the information about the file to the structure, it
  3307.    returns an error.
  3308.  
  3309.    The DosFindFirst function obtains a handle that can be used in subsequent
  3310.    calls to the DosFindNext function to specify the directory to search and
  3311.    the filename to search for. Each call to the DosFindFirst function
  3312.    automatically closes the handle of the search directory, if it has not
  3313.    been closed previously by using the DosFindClose function.
  3314.  
  3315.    Currently, the maximum filename length is 13 bytes: up to 8 characters in
  3316.    the filename; 4 characters, including the period (.), in the filename
  3317.    extension; and the terminating null character. The maximum filename length
  3318.    will change in future versions of MS OS/2.
  3319.  
  3320.    A search for read-only files, hidden files, system files, archived files,
  3321.    or subdirectories includes all normal files in addition to those matching
  3322.    the specified attribute.
  3323.  
  3324.  Restrictions
  3325.  
  3326.    In real mode, the following restriction applies to the DosFindFirst
  3327.    function:
  3328.  
  3329.    ■  The phdir parameter must be set to HDIR_SYSTEM.
  3330.  
  3331.  Example
  3332.  
  3333.    This example uses the DosFindFirst function to find the file abc.ext. An
  3334.    error message is displayed if the file is not found.
  3335.  
  3336.    HDIR hdir = HDIR_CREATE;
  3337.    USHORT usSearchCount = 1;
  3338.    FILEFINDBUF findbuf;
  3339.    if (DosFindFirst("abc.ext",      /* filename to search for      */
  3340.            &hdir,                   /* address of directory handle */
  3341.            FILE_NORMAL,             /* type of files to search for */
  3342.            &findbuf,                /* address of buffer           */
  3343.            sizeof(findbuf),         /* size of buffer              */
  3344.            &usSearchCount,          /* number of matching entries  */
  3345.            0L))                     /* reserved                    */
  3346.        VioWrtTTY("File not found\r\n", 16, 0);
  3347.    else {
  3348.  
  3349.  See Also
  3350.  
  3351.    DosBufReset, DosClose, DosFindClose, DosFindNext, DosQFileMode,
  3352.    DosQFSInfo
  3353.  
  3354.  
  3355.  ────────────────────────────────────────────────────────────────────────────
  3356.  DosFindNext
  3357.  ────────────────────────────────────────────────────────────────────────────
  3358.    USHORT DosFindNext (hdir, pfindbuf, cbfindbuf, pusSearchCount)
  3359.    HDIR hdir;              /*handle of search directory                    */
  3360.    PFILEFINDBUF pfindbuf;  /*pointer to structure receiving search result  */
  3361.    USHORT cbfindbuf;       /*length of result buffer                       */
  3362.    PUSHORT pusSearchCount; /*pointer to variable for file count            */
  3363.  
  3364.    The DosFindNext function searches for the next file or group of files
  3365.    matching the specified filename and attributes. The function copies the
  3366.    name and directory information of the file to the FILEFINDBUF structure
  3367.    pointed to by the pfindbuf parameter. The information returned is as
  3368.    accurate as the most recent call to the DosClose or DosBufReset function.
  3369.  
  3370.    The DosFindNext function is a family API function.
  3371.  
  3372.  Parameters
  3373.  
  3374.    hdir  Identifies the search directory and the filename(s) to search for.
  3375.    This handle must have been created previously by using the DosFindFirst
  3376.    function.
  3377.  
  3378.    pfindbuf  Points to the FILEFINDBUF structure that receives the result of
  3379.    the search. The FILEFINDBUF structure has the following form:
  3380.  
  3381.    typedef struct _FILEFINDBUF {
  3382.        FDATE  fdateCreation;
  3383.        FTIME  ftimeCreation;
  3384.        FDATE  fdateLastAccess;
  3385.        FTIME  ftimeLastAccess;
  3386.        FDATE  fdateLastWrite;
  3387.        FTIME  ftimeLastWrite;
  3388.        ULONG  cbFile;
  3389.        ULONG  cbFileAlloc;
  3390.        USHORT attrFile;
  3391.        UCHAR  cchName;
  3392.        CHAR   achName[13];
  3393.    } FILEFINDBUF;
  3394.  
  3395.    For a full description, see Chapter 4, "Types, Macros, Structures."
  3396.  
  3397.    cbfindbuf  Specifies the length (in bytes) of the structure pointed to by
  3398.    the pfindbuf parameter.
  3399.  
  3400.    pusSearchCount  Points to an unsigned variable that specifies the number
  3401.    of matching filenames to locate. The DosFindNext function copies the
  3402.    number of filenames found to the unsigned variable before returning.
  3403.  
  3404.  Return Value
  3405.  
  3406.    The return value is zero if the function is successful. Otherwise, it is
  3407.    an error value, which may be one of the following:
  3408.  
  3409.          ERROR_BUFFER_OVERFLOW
  3410.          ERROR_INVALID_HANDLE
  3411.          ERROR_INVALID_PARAMETER
  3412.          ERROR_NO_MORE_FILES
  3413.          ERROR_NOT_DOS_DISK
  3414.  
  3415.  Comments
  3416.  
  3417.    The pusSearchCount parameter specifies the number of files to search for.
  3418.    The number of files whose information is copied is the number of files
  3419.    requested, the number of files whose information fits in the structure, or
  3420.    the number of files that exist, whichever is smallest. If you want to
  3421.    receive information for more than one file, the pfindbuf parameter must
  3422.    point to a buffer that consists of consecutive FILEFINDBUF structures──for
  3423.    example, an array of structures. If the DosFindNext function fails to find
  3424.    a match or cannot copy all of the information about the file to the
  3425.    structure, it returns an error.
  3426.  
  3427.    Currently, the maximum filename length is 13 bytes: up to 8 characters in
  3428.    the filename; 4 characters, including the period (.), in the filename
  3429.    extension; and the terminating null character. The maximum filename length
  3430.    will change in future versions of MS OS/2.
  3431.  
  3432.  Restrictions
  3433.  
  3434.    In real mode, the following restriction applies to the DosFindNext
  3435.    function:
  3436.  
  3437.    ■  The hdir parameter must be set to HDIR_SYSTEM.
  3438.  
  3439.  Example
  3440.  
  3441.    This example calls the DosFindFirst function to find all files matching
  3442.    "*.*", and then uses the DosFindNext function to display them one at a
  3443.    time:
  3444.  
  3445.    HDIR hdir = 0xFFFF;
  3446.    USHORT usSearchCount = 1;
  3447.    FILEFINDBUF findbuf;
  3448.    DosFindFirst("*.*", &hdir, 0x00, &findbuf, sizeof(findbuf),
  3449.        &usSearchCount, 0L);
  3450.    do {
  3451.        VioWrtTTY(findbuf.achName, findbuf.cchName, 0);
  3452.        VioWrtTTY("\r\n", 2, 0);     /* cursor to next line     */
  3453.    }
  3454.    while (DosFindNext(hdir,         /* handle of directory     */
  3455.        &findbuf,                    /* address of buffer       */
  3456.        sizeof(findbuf),             /* length of buffer        */
  3457.        &usSearchCount)              /* number of files to find */
  3458.        == 0);                       /* while no error          */
  3459.  
  3460.  See Also
  3461.  
  3462.    DosBufReset, DosClose, DosFindClose, DosFindFirst, DosQFileMode,
  3463.    DosQFSInfo
  3464.  
  3465.  
  3466.  ────────────────────────────────────────────────────────────────────────────
  3467.  DosFlagProcess
  3468.  ────────────────────────────────────────────────────────────────────────────
  3469.    USHORT DosFlagProcess (pidProcess, fScope, usFlagNum, usFlagArg)
  3470.    PID pidProcess;         /*identifier of process receiving flag          */
  3471.    USHORT fScope;          /*flag process or all processes                 */
  3472.    USHORT usFlagNum;       /*flag number                                   */
  3473.    USHORT usFlagArg;       /*flag argument                                 */
  3474.  
  3475.    The DosFlagProcess function generates a signal that is sent to the calling
  3476.    process. By default, the process ignores these signals, but it can respond
  3477.    to them by using the DosSetSigHandler function to define a signal handler.
  3478.    A process can also refuse event-flag signals, causing the DosFlagProcess
  3479.    function to return an error value.
  3480.  
  3481.  Parameters
  3482.  
  3483.    pidProcess  Specifies the process identifier of the process that receives
  3484.    the flag.
  3485.  
  3486.    fScope  Specifies how many external event flags to set. If this parameter
  3487.    is FLGP_SUBTREE, the function sets the external event flags for the
  3488.    specified process and all of its child processes. If it is FLGP_PID, the
  3489.    function sets the event flag for only the specified process.
  3490.  
  3491.    usFlagNum  Specifies the number of the flag to set. This parameter can be
  3492.    one of the following values:
  3493.  
  3494.    Value     Meaning
  3495.    ──────────────────────────────────────────────────────────────────────────
  3496.    PFLG_A    Process flag A.
  3497.  
  3498.    PFLG_B    Process flag B.
  3499.  
  3500.    PFLG_C    Process flag C.
  3501.    ──────────────────────────────────────────────────────────────────────────
  3502.  
  3503.    usFlagArg  Specifies an argument to pass to the specified process.
  3504.  
  3505.  Return Value
  3506.  
  3507.    The return value is zero if the function is successful. Otherwise, it is
  3508.    an error value, which may be one of the following:
  3509.  
  3510.          ERROR_INVALID_FLAG_NUMBER
  3511.          ERROR_INVALID_FUNCTION
  3512.          ERROR_INVALID_PROCID
  3513.          ERROR_SIGNAL_REFUSED
  3514.  
  3515.  Comments
  3516.  
  3517.    The current signal cannot be accepted if a signal of the same type is
  3518.    already waiting to be processed.
  3519.  
  3520.  Example
  3521.  
  3522.    This example executes a process called abc.exe. It then calls the
  3523.    DosFlagProcess function to send the PFLG_A (process flag A) signal to that
  3524.    process.
  3525.  
  3526.    CHAR achFailName[128];
  3527.    RESULTCODES rescResults;
  3528.    DosExecPgm(achFailName, sizeof(achFailName),
  3529.        EXEC_ASYNCH, "abc", 0, &rescResults, "abc.exe");
  3530.        .
  3531.        .
  3532.        .
  3533.    DosFlagProcess(rescResults.codeTerminate, /* process identifier */
  3534.        FLGP_SUBTREE,                /* notifies the entire subtree */
  3535.        PFLG_A,                      /* sends process flag A        */
  3536.        1);                          /* value to send process       */
  3537.  
  3538.  See Also
  3539.  
  3540.    DosExecPgm, DosSetSigHandler
  3541.  
  3542.  
  3543.  ────────────────────────────────────────────────────────────────────────────
  3544.  DosFreeModule
  3545.  ────────────────────────────────────────────────────────────────────────────
  3546.    USHORT DosFreeModule (hmod)
  3547.    HMODULE hmod;           /*module handle                                 */
  3548.  
  3549.    The DosFreeModule function frees the specified dynamic-link module. After
  3550.    a process has freed a module, any function addresses the process may have
  3551.    retrieved from the module are no longer valid; a protection fault occurs
  3552.    if these functions are called.
  3553.  
  3554.  Parameters
  3555.  
  3556.    hmod  Identifies the dynamic-link module to free. This handle must have
  3557.    been created previously by using the DosLoadModule function.
  3558.  
  3559.  Return Value
  3560.  
  3561.    The return value is zero if the function is successful. Otherwise, it is
  3562.    an error value, which may be one of the following:
  3563.  
  3564.          ERROR_INTERRUPT
  3565.          ERROR_INVALID_HANDLE
  3566.  
  3567.  Comments
  3568.  
  3569.    If other processes have loaded the module and not yet freed it, the module
  3570.    remains in system memory for those processes. The system does not remove a
  3571.    module from memory until it is no longer used by any process.
  3572.  
  3573.  See Also
  3574.  
  3575.    DosLoadModule
  3576.  
  3577.  
  3578.  ────────────────────────────────────────────────────────────────────────────
  3579.  DosFreeSeg
  3580.  ────────────────────────────────────────────────────────────────────────────
  3581.    USHORT DosFreeSeg (sel)
  3582.    SEL sel;                /*segment selector                              */
  3583.  
  3584.    The DosFreeSeg function frees the specified memory segment. The function
  3585.    accepts selectors for memory segments, shared-memory segments, huge-memory
  3586.    segments, and aliased code segments. DosFreeSeg frees a shared-memory
  3587.    segment after the segment is freed by the last process accessing it.
  3588.    DosFreeSeg frees the code-segment selector for aliased code segments, but
  3589.    the corresponding data-segment selector remains valid until it is freed.
  3590.  
  3591.    The DosFreeSeg function is a family API function.
  3592.  
  3593.  Parameters
  3594.  
  3595.    sel  Specifies the selector of the segment to free.
  3596.  
  3597.  Return Value
  3598.  
  3599.    The return value is zero if the function is successful. Otherwise, it is
  3600.    an error value, which may be the following:
  3601.  
  3602.          ERROR_ACCESS_DENIED
  3603.  
  3604.  Restrictions
  3605.  
  3606.    In real mode, the following restriction applies to the DosFreeSeg
  3607.    function:
  3608.  
  3609.    ■  A code-segment selector (created by using the DosCreateCSAlias
  3610.       function) and the corresponding data-segment selector are the same.
  3611.       Freeing one frees both.
  3612.  
  3613.  Example
  3614.  
  3615.    This example allocates three segments of memory, then calls the DosFreeSeg
  3616.    function to free the memory:
  3617.  
  3618.    SEL sel;
  3619.    DosAllocHuge(3, 200, &sel, 5, SEG_NONSHARED);
  3620.        .
  3621.        .
  3622.        .
  3623.    DosFreeSeg(sel);
  3624.  
  3625.  See Also
  3626.  
  3627.    DosAllocHuge, DosAllocSeg, DosAllocShrSeg, DosCreateCSAlias
  3628.  
  3629.  
  3630.  ────────────────────────────────────────────────────────────────────────────
  3631.  DosFSRamSemClear
  3632.  ────────────────────────────────────────────────────────────────────────────
  3633.    USHORT DosFSRamSemClear (pdosfsrs)
  3634.    PDOSFSRSEM pdosfsrs;    /*pointer to structure for semaphore            */
  3635.  
  3636.    The DosFSRamSemClear function releases ownership of a fast-safe RAM
  3637.    semaphore.
  3638.  
  3639.  Parameters
  3640.  
  3641.    pdosfsrs  Points to the DOSFSRSEM structure containing the information
  3642.    about a fast-safe RAM semaphore. The DOSFSRSEM structure has the following
  3643.    form:
  3644.  
  3645.    typedef struct _DOSFSRSEM {
  3646.        USHORT cb;
  3647.        PID    pid;
  3648.        TID    tid;
  3649.        USHORT cUsage;
  3650.        USHORT client;
  3651.        ULONG  sem;
  3652.    } DOSFSRSEM;
  3653.  
  3654.    For more information, see Chapter 4, "Types, Macros, Structures."
  3655.  
  3656.  Return Value
  3657.  
  3658.    The return value is zero if the function is successful. Otherwise, it is
  3659.    an error value.
  3660.  
  3661.  Comments
  3662.  
  3663.    The DosFSRamSemClear function is used to release a semaphore obtained by
  3664.    using the DosFSRamSemRequest function. If the semaphore-use count for the
  3665.    current thread is zero, the semaphore is cleared and any threads that are
  3666.    blocked on the semaphore are restarted.
  3667.  
  3668.    DosFSRamSemClear cannot be issued against a fast-safe RAM semaphore that
  3669.    is owned by another thread.
  3670.  
  3671.  See Also
  3672.  
  3673.    DosFSRamSemRequest
  3674.  
  3675.  
  3676.  ────────────────────────────────────────────────────────────────────────────
  3677.  DosFSRamSemRequest
  3678.  ────────────────────────────────────────────────────────────────────────────
  3679.    USHORT DosFSRamSemRequest (pdosfsrs, lTimeout)
  3680.    PDOSFSRSEM pdosfsrs;    /*pointer to structure for semaphore            */
  3681.    LONG lTimeout;          /*time to wait for semaphore                    */
  3682.  
  3683.    The DosFSRamSemRequest function obtains a fast-safe RAM semaphore and
  3684.    records the current owner for potential cleanup by a DosExitList function.
  3685.  
  3686.  Parameters
  3687.  
  3688.    pdosfsrs  Points to the DOSFSRSEM structure containing information about a
  3689.    fast-safe RAM semaphore. The DOSFSRSEM structure has the following form:
  3690.  
  3691.    typedef struct _DOSFSRSEM {
  3692.        USHORT cb;
  3693.        PID    pid;
  3694.        TID    tid;
  3695.        USHORT cUsage;
  3696.        USHORT client;
  3697.        ULONG  sem;
  3698.    } DOSFSRSEM;
  3699.  
  3700.    For more information, see Chapter 4, "Types, Macros, Structures."
  3701.  
  3702.    lTimeout  Specifies how long to wait for the semaphore to become
  3703.    available. If the value is greater then zero, this parameter specifies the
  3704.    number of milliseconds to wait before returning. If the value is
  3705.    SEM_IMMEDIATE_RETURN, the function returns immediately. If the value is
  3706.    SEM_INDEFINITE_WAIT, the function waits indefinitely.
  3707.  
  3708.  Return Value
  3709.  
  3710.    The return value is zero if the function is successful. Otherwise, it is
  3711.    an error value.
  3712.  
  3713.  Comments
  3714.  
  3715.    When the DosFSRamSemRequest function is called, it checks the status of
  3716.    the semaphore. If the semaphore is not owned, DosFSRamSemRequest sets it
  3717.    to owned, increases the use count, and returns immediately to the calling
  3718.    function. If the semaphore is owned, DosFSRamSemRequest may block the
  3719.    thread until the semaphore is not owned, then try again. The lTimeout
  3720.    parameter is used to place an upper limit on the amount of time to block
  3721.    before returning.
  3722.  
  3723.    When the thread is finished with the protected resource, it calls the
  3724.    DosFSRamSemClear function. DosFSRamSemClear decreases the use count and,
  3725.    if the count is zero, sets the semaphore to unowned and starts any threads
  3726.    that were blocked while waiting for the semaphore.
  3727.  
  3728.    Recursive requests for fast-safe RAM semaphores are supported by a use
  3729.    count of the number of times the owning process has issued a
  3730.    DosFSRamSemRequest function without issuing a corresponding
  3731.    DosFSRamSemClear function.
  3732.  
  3733.    The DosFSRamSemRequest function does not return unless the specified
  3734.    semaphore remains clear long enough for the calling thread to obtain it.
  3735.  
  3736.    Fast-safe RAM semaphores operate by using the DOSFSRSEM structure. Before
  3737.    the initial call to the DosFSRamSemRequest function, this structure must
  3738.    be initialized to zero and the cb field must be set to 14. The client
  3739.    field is provided to allow the calling process a means of identifying
  3740.    which resource is currently owned by the owner of the semaphore. This
  3741.    field is initialized to zero when a fast-safe RAM semaphore is first
  3742.    acquired. The owning process may use this field to describe the resource
  3743.    currently being accessed. The values in the client field may be useful to
  3744.    an DosExitList function handler in determining the appropriate cleanup
  3745.    action.
  3746.  
  3747.    When a process terminates that owns a fast-safe RAM semaphore, the
  3748.    DosExitList functions of that process (if any) will be given control. If
  3749.    important resources are protected by fast-safe RAM semaphores, the
  3750.    DosExitList function should call the DosFSRamSemRequest function to gain
  3751.    ownership of these semaphores. When called during the processing of
  3752.    DosExitList termination functions, the DosFSRamSemRequest function will
  3753.    examine the indicated fast-safe RAM semaphore and, if it is owned by the
  3754.    active process, force the identifier of the owning thread to be equal to
  3755.    the identifier of the current thread and set the use count to one. This
  3756.    allows the DosExitList function to be used without requiring any handling
  3757.    instructions for fast-safe RAM semaphores. When the execution of the
  3758.    DosExitList function is finished, it should call the DosFSRamSemClear
  3759.    function.
  3760.  
  3761.    Except for the client field, the calling process should not modify any
  3762.    fields in the DOSFSRSEM structure after the DosFSRamSemRequest function
  3763.    returns.
  3764.  
  3765.  See Also
  3766.  
  3767.    DosExitList, DosFSRamSemClear
  3768.  
  3769.  
  3770.  ────────────────────────────────────────────────────────────────────────────
  3771.  DosGetCollate
  3772.  ────────────────────────────────────────────────────────────────────────────
  3773.    USHORT DosGetCollate (cbBuf, pctryc, pchBuf, pcbTable)
  3774.    USHORT cbBuf;           /*size of buffer                                */
  3775.    PCOUNTRYCODE pctryc;    /*pointer to structure containing country code  */
  3776.    PCHAR pchBuf;           /*pointer to buffer for table                   */
  3777.    PUSHORT pcbTable;       /*pointer to variable receiving table length    */
  3778.  
  3779.    The DosGetCollate function retrieves the collating-sequence table for the
  3780.    given country code and code-page identifier. The collating-sequence table
  3781.    is a character array with 256 elements in which each element specifies the
  3782.    sorting weight of the corresponding character. (The sorting weight is the
  3783.    value used to determine if a character appears before or after another
  3784.    character in a sorted list.) Sorting weights and character values are not
  3785.    necessarily the same──for example, in a given character set, the sorting
  3786.    weights for the letters A and B might be 1 and 2, even though their
  3787.    character values are 65 and 66.
  3788.  
  3789.    The DosGetCollate function copies the collating-sequence table from the
  3790.    country.sys file to a buffer. If the buffer is too small to hold all the
  3791.    information, DosGetCollate truncates the information. If the buffer is
  3792.    larger than the information, DosGetCollate fills any remaining bytes with
  3793.    zeros.
  3794.  
  3795.    The DosGetCollate function is a family API function.
  3796.  
  3797.  Parameters
  3798.  
  3799.    cbBuf  Specifies the size (in bytes) of the buffer that receives the
  3800.    collating-sequence table.
  3801.  
  3802.    pctryc  Points to the COUNTRYCODE structure that contains the country code
  3803.    and the code-page identifier used to retrieve the collating-sequence
  3804.    table. The COUNTRYCODE structure has the following form:
  3805.  
  3806.    typedef struct _COUNTRYCODE {
  3807.        USHORT country;
  3808.        USHORT codepage;
  3809.    } COUNTRYCODE;
  3810.  
  3811.    For a full description, see Chapter 4, "Types, Macros, Structures."
  3812.  
  3813.    pchBuf  Points to the buffer that receives the collating-sequence table.
  3814.  
  3815.    pcbTable  Points to the variable that receives the number of bytes copied
  3816.    to the buffer.
  3817.  
  3818.  Return Value
  3819.  
  3820.    The return value is zero if the function is successful. Otherwise, it is
  3821.    an error value.
  3822.  
  3823.  Comments
  3824.  
  3825.    The MS OS/2 sort command uses the DosGetCollate function to sort text
  3826.    according to the collating-sequence table.
  3827.  
  3828.  Restrictions
  3829.  
  3830.    In real mode, the following restriction applies to the DosGetCollate
  3831.    function:
  3832.  
  3833.    ■  There is no method of identifying the boot drive. The system assumes
  3834.       that the country.sys file is in the root directory of the current
  3835.       drive.
  3836.  
  3837.  See Also
  3838.  
  3839.    DosCaseMap, DosGetCtryInfo
  3840.  
  3841.  
  3842.  ────────────────────────────────────────────────────────────────────────────
  3843.  DosGetCp
  3844.  ────────────────────────────────────────────────────────────────────────────
  3845.    USHORT DosGetCp (cbBuf, pusBuf, pcbCodePgLst)
  3846.    USHORT cbBuf;           /*number of bytes in buffer for list            */
  3847.    PUSHORT pusBuf;         /*pointer to buffer receiving list              */
  3848.    PUSHORT pcbCodePgLst;   /*pointer to variable receiving list length     */
  3849.  
  3850.    The DosGetCp function retrieves a list that contains the current code page
  3851.    for the process and all prepared system code pages. The code-page list
  3852.    consists of one or more 16-bit values, each value representing a code-page
  3853.    identifier. The first value in the list is the identifier for the
  3854.    process's current code page. A process can set its current code page by
  3855.    using the DosSetCp function. Otherwise, the process inherits its current
  3856.    code page from its parent process.
  3857.  
  3858.    The DosGetCp function copies the code-page list to a buffer. If the buffer
  3859.    is too small to hold all the information, DosGetCp truncates the
  3860.    information. If the buffer is larger than the information, DosGetCp fills
  3861.    any remaining bytes with zeros.
  3862.  
  3863.  Parameters
  3864.  
  3865.    cbBuf  Specifies the length (in bytes) of the buffer for the code-page
  3866.    list.
  3867.  
  3868.    pusBuf  Points to the buffer that receives the code-page list.
  3869.  
  3870.    pcbCodePgLst  Points to the variable that receives the number of bytes
  3871.    copied to the code-page list.
  3872.  
  3873.  Return Value
  3874.  
  3875.    The return value is zero if the function is successful. Otherwise, it is
  3876.    an error value.
  3877.  
  3878.  Comments
  3879.  
  3880.    The code-page identifier can be one of the following values:
  3881.  
  3882.    Number      Code page
  3883.    ──────────────────────────────────────────────────────────────────────────
  3884.    437         United States
  3885.  
  3886.    850         Multilingual
  3887.  
  3888.    860         Portuguese
  3889.  
  3890.    863         French-Canadian
  3891.  
  3892.    865         Nordic
  3893.    ──────────────────────────────────────────────────────────────────────────
  3894.  
  3895.  See Also
  3896.  
  3897.    DosSetCp
  3898.  
  3899.  
  3900.  ────────────────────────────────────────────────────────────────────────────
  3901.  DosGetCtryInfo
  3902.  ────────────────────────────────────────────────────────────────────────────
  3903.    USHORT DosGetCtryInfo (cbBuf, pctryc, pctryi, pcbCountryInfo)
  3904.    USHORT cbBuf;           /*length of data area                           */
  3905.    PCOUNTRYCODE pctryc;    /*pointer to structure containing country info. */
  3906.    PCOUNTRYINFO pctryi;    /*pointer to structure receiving country info.  */
  3907.    PUSHORT pcbCountryInfo; /*pointer to variable for number of bytes       */
  3908.  
  3909.    The DosGetCtryInfo function retrieves a copy of the country-dependent
  3910.    formatting information for the specified country code and code-page
  3911.    identifier. Country-dependent formatting information defines the symbols
  3912.    and formats used to express currency values, dates, times, and numbers in
  3913.    a given country.
  3914.  
  3915.    The DosGetCtryInfo function copies the information from the country.sys
  3916.    file to the COUNTRYINFO structure. If this structure is too small to hold
  3917.    all the information, DosGetCtryInfo truncates the information. If the
  3918.    structure is larger than the information, the function fills any remaining
  3919.    bytes with zeros.
  3920.  
  3921.    The DosGetCtryInfo function is a family API function.
  3922.  
  3923.  Parameters
  3924.  
  3925.    cbBuf  Specifies the size (in bytes) of the COUNTRYINFO structure.
  3926.  
  3927.    pctryc  Points to the COUNTRYCODE structure that contains the country code
  3928.    and the code-page identifier used to retrieve country-dependent
  3929.    information. The COUNTRYCODE structure has the following form:
  3930.  
  3931.    typedef struct _COUNTRYCODE {
  3932.        USHORT country;
  3933.        USHORT codepage;
  3934.    } COUNTRYCODE;
  3935.  
  3936.    For a full description, see Chapter 4, "Types, Macros, Structures."
  3937.  
  3938.    pctryi  Points to the COUNTRYINFO structure that receives the
  3939.    country-dependent formatting information. The COUNTRYINFO structure has
  3940.    the following form:
  3941.  
  3942.    typedef struct _COUNTRYINFO {
  3943.        USHORT country;
  3944.        USHORT codepage;
  3945.        USHORT fsDateFmt;
  3946.        CHAR   szCurrency[5];
  3947.        CHAR   szThousandsSeparator[2];
  3948.        CHAR   szDecimal[2];
  3949.        CHAR   szDateSeparator[2];
  3950.        CHAR   szTimeSeparator[2];
  3951.        UCHAR  fsCurrencyFmt;
  3952.        UCHAR  cDecimalPlace;
  3953.        UCHAR  fsTimeFmt;
  3954.        USHORT abReserved1[2];
  3955.        CHAR   szDataSeparator[2];
  3956.        USHORT abReserved2[5];
  3957.    } COUNTRYINFO;
  3958.  
  3959.    For a full description, see Chapter 4, "Types, Macros, Structures."
  3960.  
  3961.    pcbCountryInfo  Points to the variable that receives the number of bytes
  3962.    of information copied to the COUNTRYINFO structure.
  3963.  
  3964.  Return Value
  3965.  
  3966.    The return value is zero if the function is successful. Otherwise, it is
  3967.    an error value, which may be one of the following:
  3968.  
  3969.          ERROR_NLS_BAD_TYPE
  3970.          ERROR_NLS_NO_COUNTRY_FILE
  3971.          ERROR_NLS_NO_CTRY_CODE
  3972.          ERROR_NLS_OPEN_FAILED
  3973.          ERROR_NLS_TABLE_TRUNCATED
  3974.          ERROR_NLS_TYPE_NOT_FOUND
  3975.  
  3976.  Restrictions
  3977.  
  3978.    In real mode, the following restriction applies to the DosGetCtryInfo
  3979.    function:
  3980.  
  3981.    ■  There is no method of identifying the boot drive. The system assumes
  3982.       that the country.sys file is in the root directory of the current
  3983.       drive.
  3984.  
  3985.  
  3986.  ────────────────────────────────────────────────────────────────────────────
  3987.  DosGetDateTime
  3988.  ────────────────────────────────────────────────────────────────────────────
  3989.    USHORT DosGetDateTime (pdateTime)
  3990.    PDATETIME pdateTime;    /*pointer to structure for date and time        */
  3991.  
  3992.    The DosGetDateTime function retrieves the current date and time. Although
  3993.    MS OS/2 maintains the current date and time, any process can change the
  3994.    date and time by using the DosSetDateTime function; as a result, the
  3995.    current date and time are as accurate as the most recent call to the
  3996.    DosSetDateTime function.
  3997.  
  3998.    The DosGetDateTime function is a family API function.
  3999.  
  4000.  Parameters
  4001.  
  4002.    pdateTime  Points to the DATETIME structure that receives the date and
  4003.    time information. The DATETIME structure has the following form:
  4004.  
  4005.    typedef struct _DATETIME {
  4006.        UCHAR   hours;
  4007.        UCHAR   minutes;
  4008.        UCHAR   seconds;
  4009.        UCHAR   hundredths;
  4010.        UCHAR   day;
  4011.        UCHAR   month;
  4012.        USHORT  year;
  4013.        SHORT   timezone;
  4014.        UCHAR   weekday;
  4015.    } DATETIME;
  4016.  
  4017.    For a full description, see Chapter 4, "Types, Macros, Structures."
  4018.  
  4019.  Return Value
  4020.  
  4021.    The return value is zero if the function is successful. Otherwise, it is
  4022.    an error value.
  4023.  
  4024.  Comments
  4025.  
  4026.    A process can also retrieve the current date and time by using the
  4027.    DosGetInfoSeg function. However, DosGetInfoSeg is available only to
  4028.    programs that run with MS OS/2.
  4029.  
  4030.  Example
  4031.  
  4032.    This example calls the DosGetDateTime function repeatedly until the time
  4033.    is 9:30:
  4034.  
  4035.    DATETIME date;
  4036.    do                                   /* do until 9:30 */
  4037.        DosGetDateTime(&date);
  4038.    while (!(date.hours == 9 && date.minutes == 30))
  4039.  
  4040.  See Also
  4041.  
  4042.    DosGetInfoSeg, DosSetDateTime
  4043.  
  4044.  
  4045.  ────────────────────────────────────────────────────────────────────────────
  4046.  DosGetDBCSEv
  4047.  ────────────────────────────────────────────────────────────────────────────
  4048.    USHORT DosGetDBCSEv (cbBuf, pctryc, pchBuf)
  4049.    USHORT cbBuf;           /*length of buffer                              */
  4050.    PCOUNTRYCODE pctryc;    /*pointer to structure for country code         */
  4051.    PCHAR pchBuf;           /*pointer to buffer for DBCS information        */
  4052.  
  4053.    The DosGetDBCSEv function retrieves the double-byte character set (DBCS)
  4054.    environment vector for the given country code and code-page identifier.
  4055.  
  4056.    The DosGetDBCSEv function is a family API function.
  4057.  
  4058.  Parameters
  4059.  
  4060.    cbBuf  Specifies the size (in bytes) of the buffer that receives the DBCS
  4061.    environment vector.
  4062.  
  4063.    pctryc  Points to the COUNTRYCODE structure that contains the country code
  4064.    and code-page identifier used to retrieve the DBCS environment vector. The
  4065.    COUNTRYCODE structure has the following form:
  4066.  
  4067.    typedef struct _COUNTRYCODE {
  4068.        USHORT country;
  4069.        USHORT codepage;
  4070.    } COUNTRYCODE;
  4071.  
  4072.    For a full description, see Chapter 4, "Types, Macros, Structures."
  4073.  
  4074.    pchBuf  Points to the buffer that receives the country-dependent DBCS
  4075.    environment vector.
  4076.  
  4077.  Return Value
  4078.  
  4079.    The return value is zero if the function is successful. Otherwise, it is
  4080.    an error value, which may be one of the following:
  4081.  
  4082.          ERROR_NLS_BAD_TYPE
  4083.          ERROR_NLS_NO_COUNTRY_FILE
  4084.          ERROR_NLS_NO_CTRY_CODE
  4085.          ERROR_NLS_OPEN_FAILED
  4086.          ERROR_NLS_TABLE_TRUNCATED
  4087.          ERROR_NLS_TYPE_NOT_FOUND
  4088.  
  4089.  Comments
  4090.  
  4091.    The DBCS environment vector defines the first and last values in the
  4092.    ranges for the DBCS lead-byte and second-byte values.
  4093.  
  4094.    The DosGetDBCSEv function copies the information from the country.sys file
  4095.    to a buffer. The first two bytes in the environment vector specify the
  4096.    first and last values in the range for the DBCS lead-byte values. All
  4097.    subsequent pairs of bytes (except for the last two bytes) specify the
  4098.    first and last values in the ranges for DBCS second-byte values. The last
  4099.    two bytes are both set to zero. The form of the information is similar to
  4100.    the following:
  4101.  
  4102.    CHAR first1, last1;
  4103.    CHAR first2, last2;
  4104.        .
  4105.        .
  4106.        .
  4107.    CHAR firstn, lastn;
  4108.    CHAR firstend=0, lastend=0;
  4109.  
  4110.    If the buffer is too small to hold all of the information, the
  4111.    DosGetDBCSEv function truncates the information. To avoid this, make sure
  4112.    the buffer is at least ten bytes long. You can verify that all information
  4113.    has been copied by checking the last two bytes to make sure they are
  4114.    zeros. If the structure is larger than the information, the function fills
  4115.    any remaining bytes with zeros.
  4116.  
  4117.  Restrictions
  4118.  
  4119.    In real mode, the following restriction applies to the DosGetDBCSEv
  4120.    function:
  4121.  
  4122.    ■  There is no method of identifying the boot drive. The system assumes
  4123.       that the country.sys file is in the root directory of the current
  4124.       drive.
  4125.  
  4126.  See Also
  4127.  
  4128.    DosCaseMap, DosGetCollate, DosGetCp, DosGetCtryInfo, DosSetCp,
  4129.    VioGetCp, VioSetCp
  4130.  
  4131.  
  4132.  ────────────────────────────────────────────────────────────────────────────
  4133.  DosGetEnv
  4134.  ────────────────────────────────────────────────────────────────────────────
  4135.    USHORT DosGetEnv (pselEnviron, pusOffsetCmd)
  4136.    PUSHORT pselEnviron;    /*pointer to variable for selector              */
  4137.    PUSHORT pusOffsetCmd;   /*pointer to variable for offset                */
  4138.  
  4139.    The DosGetEnv function retrieves the address of the process's environment
  4140.    and an offset into the environment where the command line is stored that
  4141.    was used to start the process. This offset can be used to retrieve
  4142.    command-line arguments.
  4143.  
  4144.    The environment is one or more null-terminated strings that name and
  4145.    define the environment variables available to the current process. The
  4146.    command-line string is a single null-terminated string that is a copy of
  4147.    the command line that was used to run the process.
  4148.  
  4149.    The DosGetEnv function is a family API function.
  4150.  
  4151.  Parameters
  4152.  
  4153.    pselEnviron  Points to the variable that receives the environment's
  4154.    segment selector. The environment begins in the first byte of the segment
  4155.    identified by this parameter.
  4156.  
  4157.    pusOffsetCmd  Points to the variable that receives the offset from the
  4158.    beginning of the specified segment to the beginning of the command line.
  4159.  
  4160.  Return Value
  4161.  
  4162.    The return value is zero if the function is successful. Otherwise, it is
  4163.    an error value, which may be the following:
  4164.  
  4165.          ERROR_INVALID_ACCESS
  4166.  
  4167.  Comments
  4168.  
  4169.    Each string in the environment has the following form:
  4170.  
  4171.          stringname=value
  4172.  
  4173.    Each environment string ends with a null character. The last string is
  4174.    followed by an additional null character to indicate the end of the
  4175.    environment. The two null characters are followed by the command-line
  4176.    string.
  4177.  
  4178.    The DosGetEnv function is typically used to retrieve the command-line
  4179.    arguments. Although DosGetEnv can be used to retrieve a single environment
  4180.    variable, an easier way to do this is to call the DosScanEnv function.
  4181.  
  4182.  Example
  4183.  
  4184.    This example calls the DosGetEnv function to retrieve the selector to the
  4185.    environment and the offset to the argument table within the environment.
  4186.    The pszEnviron parameter points to the beginning of the environment, and
  4187.    the pszArgument parameter points to the beginning of the argument table.
  4188.  
  4189.    PSZ pszEnviron, pszArgument;
  4190.    SEL selEnviron;
  4191.    USHORT usOffsetCmd;
  4192.    DosGetEnv(&selEnviron, &usOffsetCmd);
  4193.    pszEnviron = MAKEP(selEnviron, 0);
  4194.    pszArgument = MAKEP(selEnviron, usOffsetCmd);
  4195.  
  4196.  See Also
  4197.  
  4198.    DosExecPgm, DosScanEnv
  4199.  
  4200.  
  4201.  ────────────────────────────────────────────────────────────────────────────
  4202.  DosGetHugeShift
  4203.  ────────────────────────────────────────────────────────────────────────────
  4204.    USHORT DosGetHugeShift (pusShiftCount)
  4205.    PUSHORT pusShiftCount;  /*pointer to variable receiving shift count     */
  4206.  
  4207.    The DosGetHugeShift function retrieves the shift count used to compute the
  4208.    segment-selector offset for huge memory segments. (Huge memory segments
  4209.    are allocated by using the DosAllocHuge function.) The shift count
  4210.    represents a multiple of two, so the segment-selector offset is equal to
  4211.    the value 1 shifted left by the shift count. For example, the
  4212.    segment-selector offset is eight if the shift count is three.
  4213.  
  4214.    The DosGetHugeShift function is a family API function.
  4215.  
  4216.  Parameters
  4217.  
  4218.    pusShiftCount  Points to the variable that receives the shift count.
  4219.  
  4220.  Return Value
  4221.  
  4222.    The return value is zero if the function is successful. Otherwise, it is
  4223.    an error value.
  4224.  
  4225.  See Also
  4226.  
  4227.    DosAllocHuge
  4228.  
  4229.  
  4230.  ────────────────────────────────────────────────────────────────────────────
  4231.  DosGetInfoSeg
  4232.  ────────────────────────────────────────────────────────────────────────────
  4233.    USHORT DosGetInfoSeg (pselGlobalSeg, pselLocalSeg)
  4234.    PSEL pselGlobalSeg;     /*pointer to variable for global selector       */
  4235.    PSEL pselLocalSeg;      /*pointer to variable for local selector        */
  4236.  
  4237.    The DosGetInfoSeg function retrieves segment selectors for the global and
  4238.    local information segments. These read-only information segments contain
  4239.    general information about the system and the process. The global
  4240.    information segment is accessible only to all processes. The local
  4241.    information segment is accessible only to the current process.
  4242.  
  4243.  Parameters
  4244.  
  4245.    pselGlobalSeg  Points to the GINFOSEG structure that contains global
  4246.    information. The GINFOSEG structure has the following form:
  4247.  
  4248.    typedef struct _GINFOSEG {
  4249.        ULONG   time;
  4250.        ULONG   msecs;
  4251.        UCHAR   hour;
  4252.        UCHAR   minutes;
  4253.        UCHAR   seconds;
  4254.        UCHAR   hundredths;
  4255.        USHORT  timezone;
  4256.        USHORT  cusecTimerInterval;
  4257.        UCHAR   day;
  4258.        UCHAR   month;
  4259.        USHORT  year;
  4260.        UCHAR   weekday;
  4261.        UCHAR   uchMajorVersion;
  4262.        UCHAR   uchMinorVersion;
  4263.        UCHAR   chRevisionLetter;
  4264.        UCHAR   sgCurrent;
  4265.        UCHAR   sgMax;
  4266.        UCHAR   cHugeShift;
  4267.        UCHAR   fProtectModeOnly;
  4268.        USHORT  pidForeground;
  4269.        UCHAR   fDynamicSched;
  4270.        UCHAR   csecMaxWait;
  4271.        USHORT  cmsecMinSlice;
  4272.        USHORT  cmsecMaxSlice;
  4273.        USHORT  bootdrive;
  4274.        UCHAR   amecRAS[32];
  4275.        UCHAR   csgWindowableVioMax;
  4276.        UCHAR   csgPMMax;
  4277.    } GINFOSEG;
  4278.  
  4279.    For a full description, see Chapter 4, "Types, Macros, Structures."
  4280.  
  4281.    pselLocalSeg  Points to the LINFOSEG structure that contains local
  4282.    information. The LINFOSEG structure has the following form:
  4283.  
  4284.    typedef struct _LINFOSEG {
  4285.        PID     pidCurrent;
  4286.        PID     pidParent;
  4287.        USHORT  prtyCurrent;
  4288.        TID     tidCurrent;
  4289.        USHORT  sgCurrent;
  4290.        UCHAR   rfProcStatus;
  4291.        UCHAR   dummy1;
  4292.        BOOL    fForeground;
  4293.        UCHAR   typeProcess;
  4294.        UCHAR   dummy2;
  4295.        SEL     selEnvironment;
  4296.        USHORT  offCmdLine;
  4297.        USHORT  cbDataSegment;
  4298.        USHORT  cbStack;
  4299.        USHORT  cbHeap;
  4300.        HMODULE hmod;
  4301.        SEL     selDS;
  4302.    } LINFOSEG;
  4303.  
  4304.    For a full description, see Chapter 4, "Types, Macros, Structures."
  4305.  
  4306.  Return Value
  4307.  
  4308.    The return value is zero if the function is successful. Otherwise, it is
  4309.    an error value.
  4310.  
  4311.  Example
  4312.  
  4313.    This example calls the DosGetInfoSeg function to retrieve the selector of
  4314.    a system global segment, converts the segment selector into a pointer to a
  4315.    structure, and checks to determine if the current day of the week is
  4316.    Monday:
  4317.  
  4318.    SEL selGlobalSeg, selLocalSeg;
  4319.    GINFOSEG FAR *pgis;
  4320.    DosGetInfoSeg(&selGlobalSeg, &selLocalSeg);
  4321.    pgis = MAKEPGINFOSEG(selGlobalSeg);
  4322.    if (pgis->weekday == 1) {
  4323.        .
  4324.        . /* this code is executed only on a Monday */
  4325.        .
  4326.  
  4327.  See Also
  4328.  
  4329.    DosGetDateTime
  4330.  
  4331.  
  4332.  ────────────────────────────────────────────────────────────────────────────
  4333.  DosGetMachineMode
  4334.  ────────────────────────────────────────────────────────────────────────────
  4335.    USHORT DosGetMachineMode (pbMachineMode)
  4336.    PBYTE pbMachineMode;    /*pointer to variable for machine mode          */
  4337.  
  4338.    The DosGetMachineMode function retrieves the current machine mode──that
  4339.    is, whether the current mode is real or protected.
  4340.  
  4341.    The DosGetMachineMode function is a family API function.
  4342.  
  4343.  Parameters
  4344.  
  4345.    pbMachineMode  Points to the variable that receives the machine mode. If
  4346.    this parameter is MODE_REAL, the current mode is real mode, 808x or 80x86.
  4347.    If this parameter is MODE_PROTECTED, the current mode is protected mode,
  4348.    80x86.
  4349.  
  4350.  Return Value
  4351.  
  4352.    The return value is zero if the function is successful. Otherwise, it is
  4353.    an error value.
  4354.  
  4355.    The DosGetMachineMode function allows a program that is running in real
  4356.    mode to avoid calling functions that are not available when it is in real
  4357.    mode. The MS OS/2 functions that are available in both real and protected
  4358.    modes are listed in the Microsoft Operating System/2 Programmer's
  4359.    Reference, Volume 1.
  4360.  
  4361.  Example
  4362.  
  4363.    This example calls the DosGetMachineMode function and displays the machine
  4364.    mode under which the current process is running:
  4365.  
  4366.    BYTE bMode;
  4367.    DosGetMachineMode(&bMode);
  4368.    if (bMode == MODE_PROTECTED)
  4369.        VioWrtTTY("Protected mode\r\n", 16, 0);
  4370.    else
  4371.        VioWrtTTY("Real mode\r\n", 11, 0);
  4372.  
  4373.  
  4374.  ────────────────────────────────────────────────────────────────────────────
  4375.  DosGetMessage
  4376.  ────────────────────────────────────────────────────────────────────────────
  4377.    USHORT DosGetMessage (ppchVTable, usVCount, pchBuf, cbBuf, usMsgNo,
  4378.    pszFileName, pcbMsg)
  4379.    PCHAR FAR * ppchVTable; /*pointer to table of pointers to strings       */
  4380.    USHORT usVCount;        /*number of pointers in table                   */
  4381.    PCHAR pchBuf;           /*pointer to buffer receiving message           */
  4382.    USHORT cbBuf;           /*number of bytes in buffer                     */
  4383.    USHORT usMsgNo;         /*message number to retrieve                    */
  4384.    PSZ pszFileName;        /*name of file containing message               */
  4385.    PUSHORT pcbMsg;         /*number of bytes in returned message           */
  4386.  
  4387.    The DosGetMessage function retrieves a message from the specified
  4388.    system-message file. DosGetMessage may insert one or more strings into the
  4389.    body of the message as it retrieves the message.
  4390.  
  4391.    The DosGetMessage function is a family API function.
  4392.  
  4393.  Parameters
  4394.  
  4395.    ppchVTable  Points to a table of pointers to substitution strings. Each
  4396.    entry in the table points to a null-terminated string to be inserted into
  4397.    the message. Up to nine pointers can be given.
  4398.  
  4399.    usVCount  Specifies the number of pointers in the table. This parameter
  4400.    can be any value from 0 through 9. If this parameter is zero, the
  4401.    ppchVTable parameter is ignored. If it is greater than 9, the
  4402.    DosGetMessage function returns an error indicating that the usVCount
  4403.    parameter is out of range.
  4404.  
  4405.    pchBuf  Points to the buffer that receives the requested message.
  4406.  
  4407.    cbBuf  Specifies the length (in bytes) of the buffer.
  4408.  
  4409.    usMsgNo  Specifies the message number for the requested message.
  4410.  
  4411.    pszFileName  Points to a null-terminated string that specifies the MS OS/2
  4412.    path and filename of the message file that contains the message.
  4413.  
  4414.    pcbMsg  Points to the variable that receives the number of bytes copied to
  4415.    the buffer.
  4416.  
  4417.  Return Value
  4418.  
  4419.    The return value is zero if the function is successful. Otherwise, it is
  4420.    an error value, which may be one of the following:
  4421.  
  4422.          ERROR_FILE_NOT_FOUND
  4423.          ERROR_MR_INV_IVCOUNT
  4424.          ERROR_MR_INV_MSGF_FORMAT
  4425.          ERROR_MR_MID_NOT_FOUND
  4426.          ERROR_MR_MSG_TOO_LONG
  4427.          ERROR_MR_UN_ACC_MSGF
  4428.          ERROR_MR_UN_PERFORM
  4429.  
  4430.  Comments
  4431.  
  4432.    To retrieve the requested message, the DosGetMessage function first
  4433.    searches the process's message segment, if there is one. If it cannot find
  4434.    the specified message, the function then searches the specified message
  4435.    file. If no drive or path is specified in the filename, DosGetMessage
  4436.    searches the system root directory for the message file, then searches the
  4437.    current directory on the current drive. The DosGetMessage function may
  4438.    also search the directories specified by the commands append (in real
  4439.    mode) and dpath (in protected mode) for the given message file.
  4440.  
  4441.    When the DosGetMessage function finds a message, it copies the message to
  4442.    the buffer pointed to by the pchBuf parameter. As it copies the message,
  4443.    DosGetMessage replaces any symbol in the form %x (where x is a digit from
  4444.    1 through 9) with one of the strings pointed to in the table pointed to by
  4445.    the ppchVTable parameter. For example, DosGetMessage replaces all symbols
  4446.    in the form %1 with the string pointed to by the first pointer in the
  4447.    table. If there is no corresponding string in the table, DosGetMessage
  4448.    copies the %x symbol, unchanged, to the buffer.
  4449.  
  4450.    The %x symbols used in a message are not necessarily enclosed in spaces.
  4451.    If you want spaces, you may need to supply them as part of your
  4452.    substitution strings.
  4453.  
  4454.    If the message is too long to fit in the buffer, the DosGetMessage
  4455.    function truncates the message and returns an error code.
  4456.  
  4457.    If the DosGetMessage function cannot retrieve a message because of a
  4458.    direct-access-storage-device (DASD) hard error or because it cannot find
  4459.    the message file, it places a default message in the buffer. This can
  4460.    occur when an invalid parameter is specified──for example, an invalid
  4461.    usMsgNo parameter or an invalid usVCount parameter; when the DosGetMessage
  4462.    function cannot read the system-message file──for example, when a DASD
  4463.    error occurs or when format of the message file is invalid; or when the
  4464.    DosGetMessage function cannot find the system-message file. The
  4465.    DosGetMessage function retrieves messages that have been prepared
  4466.    previously by using the mkmsgf utility to create a message file.
  4467.    DosGetMessage also retrieves messages that have been added to the message
  4468.    segment of the program's executable file by using the msgbind utility. It
  4469.    is irrelevant to the process that calls the DosGetMessage function whether
  4470.    DosGetMessage retrieves messages from the message segment or from the
  4471.    message file. In either case, the function uses the usMsgNo and
  4472.    pszFileName parameters to locate the message. For more information on the
  4473.    mkmsgf and msgbind utilities, see Microsoft Operating System/2 Programming
  4474.    Tools.
  4475.  
  4476.  Restrictions
  4477.  
  4478.    In real mode, the following restriction applies to the DosGetMessage
  4479.    function:
  4480.  
  4481.    ■  There is no method of identifying the boot drive.
  4482.  
  4483.  See Also
  4484.  
  4485.    DosInsMessage, DosPutMessage
  4486.  
  4487.  
  4488.  ────────────────────────────────────────────────────────────────────────────
  4489.  DosGetModHandle
  4490.  ────────────────────────────────────────────────────────────────────────────
  4491.    USHORT DosGetModHandle (pszModName, phMod)
  4492.    PSZ pszModName;         /*module name                                   */
  4493.    PHMODULE phMod;         /*pointer to variable receiving module handle   */
  4494.  
  4495.    The DosGetModHandle function retrieves the handle of a dynamic-link
  4496.    module. The DosGetModHandle function is typically used to make sure that a
  4497.    module has been loaded into memory. If the module has not been loaded, the
  4498.    function returns an error value.
  4499.  
  4500.  Parameters
  4501.  
  4502.    pszModName  Points to a null-terminated string that specifies the MS OS/2
  4503.    filename of the module. The .dll filename extension is used for
  4504.    dynamic-link libraries.
  4505.  
  4506.    phMod  Points to the variable that receives the module handle.
  4507.  
  4508.  Return Value
  4509.  
  4510.    The return value is zero if the function is successful. Otherwise, it is
  4511.    an error value, which may be one of the following:
  4512.  
  4513.          ERROR_INTERRUPT
  4514.          ERROR_MOD_NOT_FOUND
  4515.  
  4516.  Comments
  4517.  
  4518.    The module name specified by the pszModName parameter must match the name
  4519.    of the module that is already loaded. Otherwise, an error value is
  4520.    returned.
  4521.  
  4522.  See Also
  4523.  
  4524.    DosFreeModule, DosGetModName, DosLoadModule
  4525.  
  4526.  
  4527.  ────────────────────────────────────────────────────────────────────────────
  4528.  DosGetModName
  4529.  ────────────────────────────────────────────────────────────────────────────
  4530.    USHORT DosGetModName (hmod, cbBuf, pchBuf)
  4531.    HMODULE hmod;           /*module handle                                 */
  4532.    USHORT cbBuf;           /*number of bytes in buffer                     */
  4533.    PCHAR pchBuf;           /*pointer to buffer receiving module name       */
  4534.  
  4535.    The DosGetModName function retrieves the drive, path, and filename of the
  4536.    specified module.
  4537.  
  4538.  Parameters
  4539.  
  4540.    hmod  Identifies the dynamic-link module. This handle must have been
  4541.    created previously by using the DosLoadModule function.
  4542.  
  4543.    cbBuf  Specifies the maximum length (in bytes) of the buffer that receives
  4544.    the the information about the module.
  4545.  
  4546.    pchBuf  Points to the buffer that receives the module's drive, path, and
  4547.    filename.
  4548.  
  4549.  Return Value
  4550.  
  4551.    The return value is zero if the function is successful. Otherwise, it is
  4552.    an error value, which may be one of the following:
  4553.  
  4554.          ERROR_BAD_LENGTH
  4555.          ERROR_INTERRUPT
  4556.          ERROR_INVALID_HANDLE
  4557.  
  4558.  Comments
  4559.  
  4560.    The DosGetModName function returns an error if there is not enough room in
  4561.    the buffer for the drive, path, and filename.
  4562.  
  4563.    When a function within a dynamic-link library is called, or when the
  4564.    dynamic-link library initializes itself, the di register contains the
  4565.    module handle for the current process.
  4566.  
  4567.  See Also
  4568.  
  4569.    DosFreeModule, DosGetModHandle, DosLoadModule, DosMonOpen
  4570.  
  4571.  
  4572.  ────────────────────────────────────────────────────────────────────────────
  4573.  DosGetPID
  4574.  ────────────────────────────────────────────────────────────────────────────
  4575.    USHORT DosGetPID (ppidi)
  4576.    PPIDINFO ppidi;         /*pointer to structure receiving identifiers    */
  4577.  
  4578.    The DosGetPID function retrieves the process, thread, and parent-process
  4579.    identifiers for the current process.
  4580.  
  4581.  Parameters
  4582.  
  4583.    ppidi  Points to the PIDINFO structure that receives the process
  4584.    identifiers. The PIDINFO structure has the following form:
  4585.  
  4586.    typedef struct _PIDINFO {
  4587.        PID pid;
  4588.        TID tid;
  4589.        PID pidParent;
  4590.    } PIDINFO;
  4591.  
  4592.    For a full description, see Chapter 4, "Types, Macros, Structures."
  4593.  
  4594.  Return Value
  4595.  
  4596.    The return value is zero if the function is successful. Otherwise, it is
  4597.    an error value.
  4598.  
  4599.  See Also
  4600.  
  4601.    DosExecPgm, DosGetPPID
  4602.  
  4603.  
  4604.  ────────────────────────────────────────────────────────────────────────────
  4605.  DosGetPPID
  4606.  ────────────────────────────────────────────────────────────────────────────
  4607.    USHORT DosGetPPID (pidChild, ppidParent)
  4608.    USHORT pidChild;        /*process identifier of child process           */
  4609.    PUSHORT ppidParent;     /*point to variable for parent-process          */
  4610.                            /*identifier                                    */
  4611.  
  4612.    The DosGetPPID function retrieves the process identifier of a parent
  4613.    process.
  4614.  
  4615.  Parameters
  4616.  
  4617.    pidChild  Specifies the process identifier of the child process.
  4618.  
  4619.    ppidParent  Points to the variable that receives the process identifier of
  4620.    the parent process.
  4621.  
  4622.  Return Value
  4623.  
  4624.    The return value is zero if the function is successful. Otherwise, it is
  4625.    an error value, which may be the following:
  4626.  
  4627.          ERROR_INVALID_PROCID
  4628.  
  4629.  See Also
  4630.  
  4631.    DosGetPID
  4632.  
  4633.  
  4634.  ────────────────────────────────────────────────────────────────────────────
  4635.  DosGetProcAddr
  4636.  ────────────────────────────────────────────────────────────────────────────
  4637.    USHORT DosGetProcAddr (hmod, pszProcName, ppfnProcAddress)
  4638.    HMODULE hmod;           /*handle of module                              */
  4639.    PSZ pszProcName;        /*pointer to module-name string                 */
  4640.    PPFN ppfnProcAddress;   /*pointer to variable for procedure address     */
  4641.  
  4642.    The DosGetProcAddr function retrieves the address of a procedure in a
  4643.    specified dynamic-link module. This address can then be used to call the
  4644.    procedure.
  4645.  
  4646.  Parameters
  4647.  
  4648.    hmod  Identifies the dynamic-link module. This handle must have been
  4649.    created previously by using the DosLoadModule function.
  4650.  
  4651.    pszProcName  Points to a null-terminated string that specifies the
  4652.    procedure name to retrieve. If this string starts with a number sign (#),
  4653.    the remaining part of the string is treated as an ASCII ordinal.
  4654.    Alternately, if the selector portion of the pointer is zero, the offset
  4655.    portion of the pointer is an explicit entry number (an ordinal) within the
  4656.    dynamic-link module.
  4657.  
  4658.    ppfnProcAddress  Points to the variable that receives the procedure
  4659.    address.
  4660.  
  4661.  Return Value
  4662.  
  4663.    The return value is zero if the function is successful. Otherwise, it is
  4664.    an error value, which may be one of the following:
  4665.  
  4666.          ERROR_INTERRUPT
  4667.          ERROR_INVALID_HANDLE
  4668.          ERROR_PROC_NOT_FOUND
  4669.  
  4670.  Comments
  4671.  
  4672.    Although the DosGetProcAddr function can be used to retrieve procedure
  4673.    addresses from the DOSCALLS dynamic-link module, these procedures are
  4674.    available through ordinal values only. If you attempt to retrieve a
  4675.    procedure address from the DOSCALLS module by using a procedure name,
  4676.    DosGetProcAddr returns an error.
  4677.  
  4678.  Example
  4679.  
  4680.    This example calls the DosLoadModule function to load the dynamic-link
  4681.    module qhdll.dll. It then calls the DosGetProcAddr function to retrieve
  4682.    the address of the BOXMESSAGE function that is defined in the module and
  4683.    calls the DosFreeModule function to free the dynamic-link module. (This
  4684.    example is accurate if qhdll.dll exists in a directory defined by the
  4685.    libpath parameter of the config.sys file, and if qhdll.dll contains the
  4686.    BOXMESSAGE function that uses the Pascal calling convention.)
  4687.  
  4688.    CHAR achFailName[128];
  4689.    HMODULE hmod;
  4690.    VOID (PASCAL FAR *pfnBoxMsg) (PSZ, BYTE, BYTE, SHANDLE, SHANDLE, BOOL);
  4691.  
  4692.    DosLoadModule(achFailName, sizeof(achFailName), "qhdll", &hmod);
  4693.    DosGetProcAddr(hmod,         /* module handle                 */
  4694.        "BOXMESSAGE",            /* name of function              */
  4695.        &pfnBoxMsg);             /* variable for function address */
  4696.    pfnBoxMsg("Hello World", 0x30, 1, 0, 0);
  4697.    DosFreeModule(hmod);
  4698.  
  4699.  See Also
  4700.  
  4701.    DosFreeModule, DosGetModName, DosLoadModule
  4702.  
  4703.  
  4704.  ────────────────────────────────────────────────────────────────────────────
  4705.  DosGetPrty
  4706.  ────────────────────────────────────────────────────────────────────────────
  4707.    USHORT DosGetPrty (usScope, pusPriority, pid)
  4708.    USHORT usScope;         /*thread priority in current process/another    */
  4709.                            /*process                                       */
  4710.    PUSHORT pusPriority;    /*pointer to variable for priority              */
  4711.    USHORT pid;             /*process or thread identifier                  */
  4712.  
  4713.    The DosGetPrty function retrieves the scheduling priority of a specified
  4714.    thread in the current process or the priority of thread 1 in a specified
  4715.    process.
  4716.  
  4717.  Parameters
  4718.  
  4719.    usScope  Specifies whether to retrieve the priority for a thread in the
  4720.    current process or the priority of thread 1 in some other process.
  4721.  
  4722.    If the usScope parameter is PRTYS_PROCESS, the DosGetPrty function
  4723.    retrieves the priority of thread 1 for the process specified by the pid
  4724.    parameter. If thread 1 for that process has terminated, the DosGetPrty
  4725.    function returns an error value.
  4726.  
  4727.    If the usScope parameter is PRTYS_THREAD, the function retrieves the
  4728.    priority of the thread specified by the pid parameter.
  4729.  
  4730.    pusPriority  Points to the variable that receives the scheduling priority
  4731.    of the specified thread. The high-order byte is set to the priority class;
  4732.    the low-order byte is set to the priority level.
  4733.  
  4734.    pid  Specifies a process or thread identifier, depending on the value of
  4735.    the usScope parameter. If the pid parameter is 0x0000, the DosGetPrty
  4736.    function retrieves the priority for the current process or thread.
  4737.  
  4738.  Return Value
  4739.  
  4740.    The return value is zero if the function is successful. Otherwise, it is
  4741.    an error value, which may be one of the following:
  4742.  
  4743.          ERROR_INVALID_PROCID
  4744.          ERROR_INVALID_SCOPE
  4745.          ERROR_INVALID_THREADID
  4746.  
  4747.  See Also
  4748.  
  4749.    DosSetPrty
  4750.  
  4751.  
  4752.  ────────────────────────────────────────────────────────────────────────────
  4753.  DosGetResource
  4754.  ────────────────────────────────────────────────────────────────────────────
  4755.    USHORT DosGetResource (hmod, idType, idName, psel)
  4756.    HMODULE hmod;           /*module handle                                 */
  4757.    USHORT idType;          /*resource-type identifier                      */
  4758.    USHORT idName;          /*resource-name identifier                      */
  4759.    PSEL psel;              /*pointer to variable for resource selector     */
  4760.  
  4761.    The DosGetResource function retrieves the specified resource from a
  4762.    specified executable file. The function allocates a segment, copies the
  4763.    resource into the segment, and returns the segment selector. A process can
  4764.    use this segment selector to access the resource directly.
  4765.  
  4766.  Parameters
  4767.  
  4768.    hmod  Identifies the module that contains the resource. This parameter can
  4769.    be either the module handle returned by the DosLoadModule function or NULL
  4770.    for the application's module.
  4771.  
  4772.    idType  Specifies the type of resource to retrieve.
  4773.  
  4774.    idName  Specifies the name of the resource to retrieve.
  4775.  
  4776.    psel  Points to the variable that receives the selector of the segment
  4777.    containing the resource.
  4778.  
  4779.  Return Value
  4780.  
  4781.    The return value is zero if the function is successful. Otherwise, it is
  4782.    an error value, which may be one of the following:
  4783.  
  4784.          ERROR_CANT_FIND_RESOURCE
  4785.          ERROR_INVALID_MODULE
  4786.          ERROR_INVALID_SELECTOR
  4787.  
  4788.  Comments
  4789.  
  4790.    The following list describes the predefined types that can be used for the
  4791.    idType parameter:
  4792.  
  4793. ╓┌─┌─────────────────┌───────────────────────────────────────────────────────╖
  4794.    Type              Meaning
  4795.    ──────────────────────────────────────────────────────────────────────────
  4796.    RT_ACCELTABLE     Accelerator tables
  4797.  
  4798.    RT_BITMAP         Bitmap
  4799.  
  4800.    RT_CHARTBL        Glyph to character tables
  4801.  
  4802.    RT_DIALOG         Dialog template
  4803.  
  4804.    RT_DISPLAYINFO    Screen-display information
  4805.  
  4806.    RT_FONT           Font
  4807.  
  4808.    RT_FONTDIR        Font directory
  4809.  
  4810.    RT_KEYTBL         Key to UGL tables
  4811.    Type              Meaning
  4812.    ──────────────────────────────────────────────────────────────────────────
  4813.   RT_KEYTBL         Key to UGL tables
  4814.  
  4815.    RT_MENU           Menu template
  4816.  
  4817.    RT_MESSAGE        Error-message tables
  4818.  
  4819.    RT_POINTER        Mouse-pointer shape
  4820.  
  4821.    RT_RCDATA         Binary data
  4822.  
  4823.    RT_STRING         String tables
  4824.  
  4825.    RT_VKEYTBL        Key to virtual-key tables
  4826.    ──────────────────────────────────────────────────────────────────────────
  4827.  
  4828.  
  4829.  See Also
  4830.  
  4831.    DosLoadModule
  4832.  
  4833.  
  4834.  ────────────────────────────────────────────────────────────────────────────
  4835.  DosGetSeg
  4836.  ────────────────────────────────────────────────────────────────────────────
  4837.    USHORT DosGetSeg (sel)
  4838.    SEL sel;                /*selector of shared memory segment             */
  4839.  
  4840.    The DosGetSeg function obtains access to the shared memory segment
  4841.    identified by a specified segment selector. Although a process can receive
  4842.    the selector for a shared memory segment from another process, it cannot
  4843.    use the selector to access the segment until it uses the DosGetSeg
  4844.    function.
  4845.  
  4846.  Parameters
  4847.  
  4848.    sel  Specifies the selector for the shared memory segment.
  4849.  
  4850.  Return Value
  4851.  
  4852.    The return value is zero if the function is successful. Otherwise, it is
  4853.    an error value.
  4854.  
  4855.  Comments
  4856.  
  4857.    DosGetSeg obtains access only to shared memory segments created by using
  4858.    the DosAllocSeg function with the fAlloc parameter set to SEG_GETTABLE.
  4859.  
  4860.  See Also
  4861.  
  4862.    DosAllocSeg, DosGetShrSeg, DosGiveSeg
  4863.  
  4864.  
  4865.  ────────────────────────────────────────────────────────────────────────────
  4866.  DosGetShrSeg
  4867.  ────────────────────────────────────────────────────────────────────────────
  4868.    USHORT DosGetShrSeg (pszName, psel)
  4869.    PSZ pszName;            /*pointer to memory-segment name                */
  4870.    PSEL psel;              /*pointer to variable for selector              */
  4871.  
  4872.    The DosGetShrSeg function retrieves a selector to a shared memory segment.
  4873.    The shared segment must have been allocated previously by another process.
  4874.    The function increases the segment's reference count by one to indicate
  4875.    that the segment is in use. The process receiving the new selector may use
  4876.    it to obtain access to the shared memory segment.
  4877.  
  4878.  Parameters
  4879.  
  4880.    pszName  Points to a null-terminated string that identifies the shared
  4881.    memory segment. This string must have the following form:
  4882.  
  4883.    \sharemem\pszName
  4884.  
  4885.    The string name, pszName, must have the same format as an MS OS/2 filename
  4886.    and must be unique.
  4887.  
  4888.    psel  Points to the variable that receives the new selector for the shared
  4889.    memory segment.
  4890.  
  4891.  Return Value
  4892.  
  4893.    The return value is zero if the function is successful. Otherwise, it is
  4894.    an error value, which may be one of the following:
  4895.  
  4896.          ERROR_FILE_NOT_FOUND
  4897.          ERROR_INVALID_HANDLE
  4898.          ERROR_TOO_MANY_OPEN_FILES
  4899.  
  4900.  See Also
  4901.  
  4902.    DosAllocShrSeg, DosFreeSeg, DosGetSeg
  4903.  
  4904.  
  4905.  ────────────────────────────────────────────────────────────────────────────
  4906.  DosGetVersion
  4907.  ────────────────────────────────────────────────────────────────────────────
  4908.    USHORT DosGetVersion (pusVersion)
  4909.    PUSHORT pusVersion;     /*pointer to variable receiving version number  */
  4910.  
  4911.    The DosGetVersion function retrieves the operating system's version
  4912.    number. For MS OS/2, version 1.1, both the major and minor version numbers
  4913.    are 10.
  4914.  
  4915.    The DosGetVersion function is a family API function.
  4916.  
  4917.  Parameters
  4918.  
  4919.    pusVersion  Points to the variable that receives the version number. The
  4920.    high-order byte is set to the major version number; the low-order byte is
  4921.    set to the minor version number.
  4922.  
  4923.  Return Value
  4924.  
  4925.    The return value is zero if the function is successful. Otherwise, it is
  4926.    an error value.
  4927.  
  4928.  Example
  4929.  
  4930.    This example retrieves the version number and displays the major version
  4931.    number:
  4932.  
  4933.    USHORT usVersion;
  4934.    CHAR ch;
  4935.  
  4936.    DosGetVersion(&usVersion);
  4937.    ch = (LOBYTE(usVersion) / 10) + '0'; /* gets major version number */
  4938.    VioWrtTTY("You are using MS OS/2 version ", 30, 0);
  4939.    VioWrtTTY(&ch, 1, 0);
  4940.    VioWrtTTY("\r\n", 2, 0);
  4941.  
  4942.  See Also
  4943.  
  4944.    DosQSysInfo
  4945.  
  4946.  
  4947.  ────────────────────────────────────────────────────────────────────────────
  4948.  DosGiveSeg
  4949.  ────────────────────────────────────────────────────────────────────────────
  4950.    USHORT DosGiveSeg (sel, pidProcess, pselRecipient)
  4951.    SEL sel;                /*selector of shared memory segment             */
  4952.    PID pidProcess;         /*process identifier of recipient               */
  4953.    PSEL pselRecipient;     /*pointer to variable for selector of recipient */
  4954.  
  4955.    The DosGiveSeg function creates a new segment selector for a shared memory
  4956.    segment. The new selector can then be used by another process to access
  4957.    the shared memory segment.
  4958.  
  4959.    The process that creates the new segment selector is responsible for
  4960.    passing the selector to any process that uses the segment.
  4961.  
  4962.  Parameters
  4963.  
  4964.    sel  Specifies the segment selector of the shared memory segment.
  4965.  
  4966.    pidProcess  Specifies the process identifier of the process that receives
  4967.    access to the shared memory segment.
  4968.  
  4969.    pselRecipient  Points to the variable that receives the new segment
  4970.    selector.
  4971.  
  4972.  Return Value
  4973.  
  4974.    The return value is zero if the function is successful. Otherwise, it is
  4975.    an error value, which may be one of the following:
  4976.  
  4977.          ERROR_ACCESS_DENIED
  4978.          ERROR_NOT_ENOUGH_MEMORY
  4979.  
  4980.  Comments
  4981.  
  4982.    The DosGiveSeg function is successful even if the specified process
  4983.    already has access to the segment.
  4984.  
  4985.    DosGiveSeg applies only to shared memory segments created by using the
  4986.    DosAllocSeg function with the fAlloc parameter set to SEG_GIVEABLE.
  4987.  
  4988.  See Also
  4989.  
  4990.    DosAllocSeg, DosGetSeg
  4991.  
  4992.  
  4993.  ────────────────────────────────────────────────────────────────────────────
  4994.  DosHoldSignal
  4995.  ────────────────────────────────────────────────────────────────────────────
  4996.    USHORT DosHoldSignal (fDisable)
  4997.    USHORT fDisable;        /*disable/enable signals                        */
  4998.  
  4999.    The DosHoldSignal function disables or enables signal processing for the
  5000.    current process.
  5001.  
  5002.    The DosHoldSignal function is a family API function.
  5003.  
  5004.  Parameters
  5005.  
  5006.    fDisable  Specifies whether to disable or enable signals that are intended
  5007.    for the current process. If this parameter is HLDSIG_DISABLE, the function
  5008.    disables signals. If it is HLDSIG_ENABLE, the function enables signals and
  5009.    restores the request count to its value before the last call to
  5010.    DosHoldSignal.
  5011.  
  5012.  Return Value
  5013.  
  5014.    The return value is zero if the function is successful. Otherwise, it is
  5015.    an error value, which may be the following:
  5016.  
  5017.          ERROR_INVALID_FUNCTION
  5018.  
  5019.  Comments
  5020.  
  5021.    If the fDisable parameter is HLDSIG_DISABLE, the function holds all
  5022.    signals without processing them until DosHoldSignal is called again with
  5023.    fDisable set to HLDSIG_ENABLE. Signals should be held for as little time
  5024.    as possible; if necessary, a signal should be released and then held
  5025.    again.
  5026.  
  5027.    Requests to disable and enable signal processing are cumulative. This
  5028.    means two requests to disable processing must be followed by two requests
  5029.    to enable processing before processing is enabled.
  5030.  
  5031.    The DosHoldSignal function is intended to be used by library routines,
  5032.    subsystems, and similar code that need to prevent a possible signal from
  5033.    interfering with the completion of the current activity──for instance,
  5034.    activity in locked segments or in temporarily reserved resources.
  5035.  
  5036.  Restrictions
  5037.  
  5038.    In real mode, the following restriction applies to the DosHoldSignal
  5039.    function:
  5040.  
  5041.    ■  Only the signal interrupt (SIG_CTRLC) and signal break (SIG_CTRLBREAK)
  5042.       signals are recognized.
  5043.  
  5044.  Example
  5045.  
  5046.    This example calls the DosHoldSignal function to disable signals and calls
  5047.    the DosEnterCritSec function to stop all other threads. When the
  5048.    processing of the critical section of code is completed, the DosHoldSignal
  5049.    function enables signals again:
  5050.  
  5051.    DosHoldSignal(HLDSIG_DISABLE);       /* disables signals        */
  5052.    DosEnterCritSec();                   /* enters critical section */
  5053.        .
  5054.        .
  5055.        .
  5056.    DosExitCritSec();                    /* exits critical section  */
  5057.    DosHoldSignal(HLDSIG_ENABLE);        /* enables signals         */
  5058.  
  5059.  See Also
  5060.  
  5061.    DosCLIAccess, DosEnterCritSec, DosFlagProcess
  5062.  
  5063.  
  5064.  ────────────────────────────────────────────────────────────────────────────
  5065.  DosInsMessage
  5066.  ────────────────────────────────────────────────────────────────────────────
  5067.    USHORT DosInsMessage (ppchVTable, usVCount, pszMsg, cbMsg, pchBuf, cbBuf,
  5068.    pcbMsg)
  5069.    PCHAR FAR * ppchVTable; /*pointer to table of character pointers        */
  5070.    USHORT usVCount;        /*number of pointers in table                   */
  5071.    PSZ pszMsg;             /*pointer to input message                      */
  5072.    USHORT cbMsg;           /*number of bytes in input message              */
  5073.    PCHAR pchBuf;           /*pointer to buffer for updated message         */
  5074.    USHORT cbBuf;           /*number of bytes in buffer                     */
  5075.    PUSHORT pcbMsg;         /*pointer to variable for length of message     */
  5076.  
  5077.    The DosInsMessage function copies a specified message to a buffer. Unlike
  5078.    the DosGetMessage function, DosInsMessage does not retrieve a message.
  5079.    DosInsMessage is often used when messages are loaded before the
  5080.    insertion-text strings are known.
  5081.  
  5082.    The DosInsMessage function is a family API function.
  5083.  
  5084.  Parameters
  5085.  
  5086.    ppchVTable  Points to a table of pointers to null-terminated strings than
  5087.    can be inserted into the message. Up to nine strings can be given.
  5088.  
  5089.    usVCount  Specifies the number of strings in the table. This parameter can
  5090.    be any value from 0 through 9. If this parameter is zero, the ppchVTable
  5091.    parameter is ignored. If this parameter is greater than 9, the function
  5092.    returns an error value indicating that the usVCount parameter is out of
  5093.    range.
  5094.  
  5095.    pszMsg  Points to a null-terminated string that specifies the message to
  5096.    process.
  5097.  
  5098.    cbMsg  Specifies the length (in bytes) of the message.
  5099.  
  5100.    pchBuf  Points to the buffer that receives the message.
  5101.  
  5102.    cbBuf  Specifies the length (in bytes) of the buffer that receives the
  5103.    message.
  5104.  
  5105.    pcbMsg  Points to the variable that receives the number of bytes copied to
  5106.    the buffer.
  5107.  
  5108.  Return Value
  5109.  
  5110.    The return value is zero if the function is successful. Otherwise, it is
  5111.    an error value, which may be one of the following:
  5112.  
  5113.          ERROR_MR_INV_IVCOUNT
  5114.          ERROR_MR_MSG_TOO_LONG
  5115.  
  5116.  Comments
  5117.  
  5118.    As it copies a message, the DosInsMessage function replaces any symbol in
  5119.    the form %x (where x is a digit from 1 through 9) with one of the strings
  5120.    pointed to in the table pointed to by the ppchVTable parameter. For
  5121.    example, the function replaces all symbols of the form %1 with the first
  5122.    string pointed to in the table. If there is no corresponding string in the
  5123.    table, DosInsMessage copies the %x sequence to the buffer. If the message
  5124.    is too long to fit in the buffer, the DosGetMessage function truncates the
  5125.    message and returns an error code.
  5126.  
  5127.  Restrictions
  5128.  
  5129.    In real mode, the following restriction applies to the DosInsMessage
  5130.    function:
  5131.  
  5132.    ■  There is no method of identifying the boot drive. The system assumes
  5133.       that the message file is in the root directory of the current drive.
  5134.  
  5135.  See Also
  5136.  
  5137.    DosGetMessage, DosPutMessage
  5138.  
  5139.  
  5140.  ────────────────────────────────────────────────────────────────────────────
  5141.  DosKillProcess
  5142.  ────────────────────────────────────────────────────────────────────────────
  5143.    USHORT DosKillProcess (fScope, pidProcess)
  5144.    USHORT fScope;          /*flag for process only-parent and child        */
  5145.                            /*processes                                     */
  5146.    PID pidProcess;         /*process identifier of process to be ended     */
  5147.  
  5148.    The DosKillProcess function terminates the specified process, with the
  5149.    option of also terminating all child processes that belong to it. Any
  5150.    subsequent request for the process's termination code returns the
  5151.    TC_KILLPROCESS code, unless the process intercepted the termination
  5152.    request.
  5153.  
  5154.  Parameters
  5155.  
  5156.    fScope  Specifies whether to terminate the child processes that belong to
  5157.    the specified process that is terminated. If this parameter is
  5158.    DKP_PROCESSTREE, the function terminates the specified process and all of
  5159.    its child processes. If it is DKP_PROCESS, the function terminates the
  5160.    specified process only.
  5161.  
  5162.    pidProcess  Specifies the process identifier of the process to terminate.
  5163.  
  5164.  Return Value
  5165.  
  5166.    The return value is zero if the function is successful. Otherwise, it is
  5167.    an error value, which may be the following:
  5168.  
  5169.          ERROR_INVALID_PROCID
  5170.  
  5171.  Comments
  5172.  
  5173.    A process can intercept the termination request generated by the
  5174.    DosKillProcess function by using the DosSetSigHandler function to create a
  5175.    signal handler. When the process creates a signal handler, the process
  5176.    typically completes any termination tasks, such as copying data from local
  5177.    buffers to files, then calls the DosExit function to terminate. If a
  5178.    process has no signal handler, the DosKillProcess function terminates the
  5179.    process after flushing all system file buffers and closing all handles
  5180.    opened by the process.
  5181.  
  5182.    Before terminating, the process being terminated must flush file buffers
  5183.    that are not managed by MS OS/2──for example, the buffers managed by the C
  5184.    run-time library. MS OS/2 does not flush these buffers as part of its
  5185.    termination sequence.
  5186.  
  5187.  Example
  5188.  
  5189.    This example creates the child process abc.exe, then calls the
  5190.    DosKillProcess function to terminate it:
  5191.  
  5192.    CHAR achFailName[128];
  5193.    RESULTCODES resc;
  5194.    DosExecPgm(achFailName, sizeof(achFailName),
  5195.        EXEC_ASYNCH, "abc", 0, &resc, "abc.exe");
  5196.        .
  5197.        .
  5198.        .
  5199.    DosKillProcess(DKP_PROCESS, resc.codeTerminate);
  5200.  
  5201.  See Also
  5202.  
  5203.    DosCwait, DosExit, DosSetSigHandler
  5204.  
  5205.  
  5206.  ────────────────────────────────────────────────────────────────────────────
  5207.  DosLoadModule
  5208.  ────────────────────────────────────────────────────────────────────────────
  5209.    USHORT DosLoadModule (pszFailName, cbFileName, pszModName, phmod)
  5210.    PSZ pszFailName;        /*pointer to buffer for name if failure         */
  5211.    USHORT cbFileName;      /*length of buffer for name if failure          */
  5212.    PSZ pszModName;         /*pointer to module name                        */
  5213.    PHMODULE phmod;         /*pointer to variable for module handle         */
  5214.  
  5215.    The DosLoadModule function loads a dynamic-link module and returns a
  5216.    handle for the module. You can use the module handle to retrieve the entry
  5217.    addresses of procedures in the module and to retrieve information about
  5218.    the module.
  5219.  
  5220.  Parameters
  5221.  
  5222.    pszFailName  Points to the buffer that receives a null-terminated string.
  5223.    The DosLoadModule function copies a string to the buffer only if the
  5224.    function fails to load the module. The string identifies the dynamic-link
  5225.    module responsible for the failure. This module may be other than the one
  5226.    specified in the pszModName parameter if the specified module links to
  5227.    other dynamic-link modules.
  5228.  
  5229.    cbFileName  Specifies the length (in bytes) of the buffer pointed to by
  5230.    the pszFailName parameter.
  5231.  
  5232.    pszModName  Points to a null-terminated string. This string must be a
  5233.    valid MS OS/2 filename that specifies the path and filename of the
  5234.    dynamic-link module to be loaded. All dynamic-link modules have the .dll
  5235.    filename extension, by default.
  5236.  
  5237.    phmod  Points to the variable that receives the handle of the dynamic-link
  5238.    module.
  5239.  
  5240.  Return Value
  5241.  
  5242.    The return value is zero if the function is successful. Otherwise, it is
  5243.    an error value, which may be one of the following:
  5244.  
  5245.          ERROR_BAD_FORMAT
  5246.          ERROR_FILE_NOT_FOUND
  5247.          ERROR_INTERRUPT
  5248.          ERROR_NOT_ENOUGH_MEMORY
  5249.  
  5250.  Comments
  5251.  
  5252.    The DosLoadModule function loads only MS OS/2 dynamic-link modules.
  5253.    Attempts to load other executable files (such as MS-DOS executable files)
  5254.    result in errors.
  5255.  
  5256.  Example
  5257.  
  5258.    This example calls the DosLoadModule function to load the dynamic-link
  5259.    module qhdll.dll. This example then calls the DosGetProcAddr function to
  5260.    retrieve the address of the BOXMESSAGE function that is defined in the
  5261.    module. After calling the BOXMESSAGE function, the example calls
  5262.    DosFreeModule to free the dynamic-link module. (This example is accurate
  5263.    if qhdll.dll exists in a directory defined by the libpath parameter of the
  5264.    config.sys file, and if qhdll.dll contains the BOXMESSAGE function that
  5265.    uses the Pascal calling convention.)
  5266.  
  5267.    CHAR achFailName[128];
  5268.    HMODULE hmod;
  5269.    VOID (PASCAL FAR *pfnBoxMsg)(PSZ, BYTE, BYTE, SHANDLE, SHANDLE, BOOL);
  5270.  
  5271.    DosLoadModule(achFailName,       /* failure name buffer         */
  5272.        sizeof(achFailName),         /* size of failure name buffer */
  5273.        "qhdll",                     /* module name                 */
  5274.        &hmod);                      /* address of handle           */
  5275.    DosGetProcAddr(hmod, "BOXMESSAGE", &pfnBoxMsg);
  5276.    pfnBoxMsg("Hello World", 0x30, 1, 0, 0, FALSE);
  5277.    DosFreeModule(hmod);
  5278.  
  5279.  See Also
  5280.  
  5281.    DosExecPgm, DosFreeModule, DosGetModName, DosGetProcAddr
  5282.  
  5283.  
  5284.  ────────────────────────────────────────────────────────────────────────────
  5285.  DosLockSeg
  5286.  ────────────────────────────────────────────────────────────────────────────
  5287.    USHORT DosLockSeg (sel)
  5288.    SEL sel;                /*selector of segment to lock                   */
  5289.  
  5290.    The DosLockSeg function locks a discardable segment in memory. A locked
  5291.    segment cannot be discarded until it is unlocked by using the DosUnlockSeg
  5292.    function.
  5293.  
  5294.    If a segment has been discarded, the DosLockSeg function returns an error
  5295.    value that specifies that the segment no longer exists. When this occurs,
  5296.    the DosReallocSeg function can be called to allocate a new copy of the
  5297.    segment. The program must recreate any discarded data.
  5298.  
  5299.  Parameters
  5300.  
  5301.    sel  Specifies the selector of the segment to lock.
  5302.  
  5303.  Return Value
  5304.  
  5305.    The return value is zero if the function is successful. Otherwise, it is
  5306.    an error value.
  5307.  
  5308.  Comments
  5309.  
  5310.    DosLockSeg applies only to segments that have been allocated by using the
  5311.    DosAllocSeg function with the fAlloc parameter set to SEG_DISCARDABLE.
  5312.  
  5313.    MS OS/2 can move and swap a locked segment as needed.
  5314.  
  5315.    The DosLockSeg and DosUnlockSeg functions may be nested. For example, if
  5316.    DosLockSeg is called five times to lock a segment, DosUnlockSeg must be
  5317.    called five times to unlock the segment. A segment becomes permanently
  5318.    locked if it is locked 255 times without being unlocked.
  5319.  
  5320.  See Also
  5321.  
  5322.    DosAllocSeg, DosReallocSeg, DosUnlockSeg
  5323.  
  5324.  
  5325.  ────────────────────────────────────────────────────────────────────────────
  5326.  DosMakeNmPipe
  5327.  ────────────────────────────────────────────────────────────────────────────
  5328.    USHORT DosMakeNmPipe (pszName, php, fsOpenMode, fsPipeMode, cbOutBuf,
  5329.    cbInBuf, ulTimeOut)
  5330.    PSZ pszName;            /*pipe name                                     */
  5331.    PHPIPE php;             /*pointer to pipe handle                        */
  5332.    USHORT fsOpenMode;      /*open mode of pipe                             */
  5333.    USHORT fsPipeMode;      /*pipe-specific modes                           */
  5334.    USHORT cbOutBuf;        /*number of bytes in output buffer              */
  5335.    USHORT cbInBuf;         /*number of bytes in input buffer               */
  5336.    ULONG ulTimeOut;        /*timeout value                                 */
  5337.  
  5338.    The DosMakeNmPipe function creates a named pipe and retrieves a handle
  5339.    that can be used in subsequent pipe operations.
  5340.  
  5341.  Parameters
  5342.  
  5343.    pszName  Points to a null-terminated string that identifies the name of
  5344.    the pipe. The string must have the following form:
  5345.  
  5346.    \pipe\name
  5347.  
  5348.    The string name, name, must have the same format as an MS OS/2 filename.
  5349.  
  5350.    php  Points to the variable that receives the handle of the named pipe.
  5351.  
  5352.    fsOpenMode  Specifies the modes with which to open the pipe. This
  5353.    parameter is a combination of an access mode flag, an inheritance flag,
  5354.    and a write-behind flag. The possible values are:
  5355.  
  5356.    Value                       Meaning
  5357.    ──────────────────────────────────────────────────────────────────────────
  5358.    PIPE_ACCESS_DUPLEX          Pipe is full duplex──going to and from server
  5359.                                and client.
  5360.  
  5361.    PIPE_ACCESS_INBOUND         Pipe is inbound──going from client to server.
  5362.  
  5363.    PIPE_ACCESS_OUTBOUND        Pipe is outbound──going from server to client.
  5364.  
  5365.    PIPE_INHERIT                Pipe is inherited by any child processes that
  5366.                                are created by using the DosExecPgm function.
  5367.  
  5368.    PIPE_NOINHERIT              Pipe is private to the current process and
  5369.                                cannot be inherited.
  5370.  
  5371.    PIPE_NOWRITEBEHIND          Write-behind to remote pipes is not allowed.
  5372.  
  5373.    PIPE_WRITEBEHIND            Write-behind to remote pipes is allowed.
  5374.    ──────────────────────────────────────────────────────────────────────────
  5375.  
  5376.    fsPipeMode  Specifies the pipe-specific modes of the pipe. This parameter
  5377.    is a combination of an instance count, a read-mode flag, a type flag, and
  5378.    a wait flag. The possible values are:
  5379.  
  5380.    Value                       Meaning
  5381.    ──────────────────────────────────────────────────────────────────────────
  5382.    PIPE_WAIT                   Reading from and writing to the pipe waits if
  5383.                                no data is available.
  5384.  
  5385.    PIPE_NOWAIT                 Reading from and writing to the pipe returns
  5386.                                immediately if no data is available.
  5387.  
  5388.    PIPE_READMODE_BYTE          Read pipe as a byte stream.
  5389.  
  5390.    PIPE_READMODE_MESSAGE       Read pipe as a message stream.
  5391.  
  5392.    PIPE_TYPE_BYTE              Pipe is a byte-stream pipe.
  5393.  
  5394.    PIPE_TYPE_MESSAGE           Pipe is a message-stream pipe.
  5395.  
  5396.    PIPE_UNLIMITED_INSTANCES    Unlimited instances of the pipe can be
  5397.                                created. If this value is not specified, a
  5398.                                value from 1 through 254 can be used for the
  5399.                                number of instances.
  5400.    ──────────────────────────────────────────────────────────────────────────
  5401.  
  5402.    cbOutBuf  Specifies the number of bytes to reserve for the outgoing
  5403.    buffer.
  5404.  
  5405.    cbInBuf  Specifies the number of bytes to reserve for the incoming buffer.
  5406.  
  5407.    ulTimeOut  Specifies the default value (in milliseconds) of the timeout
  5408.    parameter of the DosWaitNmPipe function.
  5409.  
  5410.  Return Value
  5411.  
  5412.    The return value is zero if the function is successful. Otherwise, it is
  5413.    an error value, which may be one of the following:
  5414.  
  5415.          ERROR_INVALID_PARAMETER
  5416.          ERROR_NOT_ENOUGH_MEMORY
  5417.          ERROR_OUT_OF_STRUCTURES
  5418.          ERROR_PATH_NOT_FOUND
  5419.          ERROR_PIPE_BUSY
  5420.  
  5421.  See Also
  5422.  
  5423.    DosClose, DosWaitNmPipe
  5424.  
  5425.  
  5426.  ────────────────────────────────────────────────────────────────────────────
  5427.  DosMakePipe
  5428.  ────────────────────────────────────────────────────────────────────────────
  5429.    USHORT DosMakePipe (phfRead, phfWrite, cbPipe)
  5430.    PHFILE phfRead;         /*pointer to variable for read handle           */
  5431.    PHFILE phfWrite;        /*pointer to variable for write handle          */
  5432.    USHORT cbPipe;          /*number of bytes reserved for pipe             */
  5433.  
  5434.    The DosMakePipe function creates a pipe. The function creates the pipe,
  5435.    assigning the specified pipe size to the storage buffer, and also creates
  5436.    handles that the process can use to read from and write to the buffer in
  5437.    subsequent calls to the DosRead and DosWrite functions.
  5438.  
  5439.  Parameters
  5440.  
  5441.    phfRead  Points to the variable that receives the read handle for the
  5442.    pipe.
  5443.  
  5444.    phfWrite  Points to the variable that receives the write handle for the
  5445.    pipe.
  5446.  
  5447.    cbPipe  Specifies the size (in bytes) to allocate for the storage buffer
  5448.    for this pipe. This parameter can be any value up to 65,536 minus the size
  5449.    of the pipe header, which is currently 32 bytes. If this parameter is
  5450.    zero, the default buffer size is used.
  5451.  
  5452.  Return Value
  5453.  
  5454.    The return value is zero if the function is successful. Otherwise, it is
  5455.    an error value, which may be one of the following:
  5456.  
  5457.          ERROR_NOT_ENOUGH_MEMORY
  5458.          ERROR_TOO_MANY_OPEN_FILES
  5459.  
  5460.  Comments
  5461.  
  5462.    Pipes are typically used by a pair of processes. One process creates the
  5463.    pipe and passes a handle to the other process. This lets one process write
  5464.    into the pipe and the other read from the pipe. Since MS OS/2 provides no
  5465.    permission checks on pipes, the cooperating processes must ensure that
  5466.    they do not attempt to write to or read from the pipe at the same time.
  5467.  
  5468.    When all of a pipe's handles are closed by using the DosClose function, MS
  5469.    OS/2 deletes that pipe. If two processes are communicating by using a pipe
  5470.    and the process ends that is reading the pipe, the next call to the
  5471.    DosWrite function for that pipe returns the "broken pipe" error value.
  5472.  
  5473.    MS OS/2 temporarily blocks any call to the DosWrite function that would
  5474.    have written more data to the pipe than could fit in the storage buffer.
  5475.    The system removes the block as soon as enough data is read from the pipe
  5476.    to make room for the remaining unwritten data.
  5477.  
  5478.  See Also
  5479.  
  5480.    DosClose, DosDupHandle, DosRead, DosWrite
  5481.  
  5482.  
  5483.  ────────────────────────────────────────────────────────────────────────────
  5484.  DosMemAvail
  5485.  ────────────────────────────────────────────────────────────────────────────
  5486.    USHORT DosMemAvail (pulAvailMem)
  5487.    PULONG pulAvailMem;     /*pointer to variable for available memory      */
  5488.  
  5489.    The DosMemAvail function retrieves the size of the largest block of free
  5490.    memory available when the function is called. The largest free block
  5491.    consists of all free memory, whether consecutive or not. This function
  5492.    does not cause segments to be moved, swapped, or discarded.
  5493.  
  5494.  Parameters
  5495.  
  5496.    pulAvailMem  Points to the variable that receives the size (in bytes) of
  5497.    the largest free block of memory.
  5498.  
  5499.  Return Value
  5500.  
  5501.    The return value is zero if the function is successful. Otherwise, it is
  5502.    an error value.
  5503.  
  5504.  Comments
  5505.  
  5506.    Since other processes may allocate and free memory at any time, the size
  5507.    of the largest free block can be expected to change.
  5508.  
  5509.    The DosMemAvail function returns only the amount of memory currently
  5510.    available without swapping. More memory can be allocated than indicated by
  5511.    the DosMemAvail function──when necessary, the system swaps memory or
  5512.    discards unlocked memory to meet memory-allocation requests.
  5513.  
  5514.  Example
  5515.  
  5516.    This example calls DosMemAvail to determine the amount of available
  5517.    memory. It then allocates one third of that memory and allows for
  5518.    reallocation of up to ten 64K segments.
  5519.  
  5520.    #define SEGSIZE (64L * 1024L)
  5521.    LONG lAvail;
  5522.    SEL sel;
  5523.  
  5524.    DosMemAvail(&lAvail);                /* gets amount of current memory */
  5525.    lAvail /= 3L;                        /* calculate one third of memory */
  5526.    DosAllocHuge((USHORT) (lAvail / SEGSIZE), /* number of segments       */
  5527.        (USHORT) (lAvail % SEGSIZE),          /* size of last segment     */
  5528.        &sel,                                 /* address of selector      */
  5529.        10,                             /* allows reallocation up to 640K */
  5530.        SEG_NONSHARED);                 /* sharing flag                   */
  5531.  
  5532.  See Also
  5533.  
  5534.    DosAllocHuge
  5535.  
  5536.  
  5537.  ────────────────────────────────────────────────────────────────────────────
  5538.  DosMkDir
  5539.  ────────────────────────────────────────────────────────────────────────────
  5540.    USHORT DosMkDir (pszDirName, ulReserved)
  5541.    PSZ pszDirName;         /*new directory name                            */
  5542.    ULONG ulReserved;       /*must be zero                                  */
  5543.  
  5544.    The DosMkDir function creates the specified directory. If the directory
  5545.    already exists or the specified directory name is invalid, the function
  5546.    returns an error value.
  5547.  
  5548.    The DosMkDir function is a family API function.
  5549.  
  5550.  Parameters
  5551.  
  5552.    pszDirName  Points to a null-terminated string. This string must be a
  5553.    valid MS OS/2 directory name.
  5554.  
  5555.    ulReserved  Specifies a reserved value; must be zero.
  5556.  
  5557.  Return Value
  5558.  
  5559.    The return value is zero if the function is successful. Otherwise, it is
  5560.    an error value, which may be one of the following:
  5561.  
  5562.          ERROR_ACCESS_DENIED
  5563.          ERROR_DRIVE_LOCKED
  5564.          ERROR_NOT_DOS_DISK
  5565.          ERROR_PATH_NOT_FOUND
  5566.  
  5567.  Example
  5568.  
  5569.    This example calls the DosMkDir function to create the subdirectory abc
  5570.    and report an error if it fails:
  5571.  
  5572.    USHORT usError;
  5573.    usError = DosMkDir("abc", 0L);
  5574.    if (usError)
  5575.        VioWrtTTY("Can't open directory\r\n", 22, 0);
  5576.    else {
  5577.  
  5578.  See Also
  5579.  
  5580.    DosRmDir
  5581.  
  5582.  
  5583.  ────────────────────────────────────────────────────────────────────────────
  5584.  DosMonClose
  5585.  ────────────────────────────────────────────────────────────────────────────
  5586.    USHORT DosMonClose (hmon)
  5587.    HMONITOR hmon;          /*monitor handle to close                       */
  5588.  
  5589.    The DosMonClose function closes the specified monitor. The function
  5590.    flushes and closes all monitor buffers associated with this process.
  5591.  
  5592.  Parameters
  5593.  
  5594.    hmon  Identifies the monitor to close. This handle must have been created
  5595.    previously by using the DosMonOpen function.
  5596.  
  5597.  Return Value
  5598.  
  5599.    The return value is zero if the function is successful. Otherwise, it is
  5600.    an error value, which may be the following:
  5601.  
  5602.          ERROR_MON_INVALID_HANDLE
  5603.  
  5604.  See Also
  5605.  
  5606.    DosMonOpen, DosMonRead, DosMonReg, DosMonWrite
  5607.  
  5608.  
  5609.  ────────────────────────────────────────────────────────────────────────────
  5610.  DosMonOpen
  5611.  ────────────────────────────────────────────────────────────────────────────
  5612.    USHORT DosMonOpen (pszDevName, phmon)
  5613.    PSZ pszDevName;         /*pointer to device name                        */
  5614.    PHMONITOR phmon;        /*pointer to variable for monitor handle        */
  5615.  
  5616.    The DosMonOpen function opens a monitor and creates a handle that can be
  5617.    used to identify the monitor. Only one monitor per process is
  5618.    allowed──that is, DosMonOpen must not be called more than once by any
  5619.    process.
  5620.  
  5621.  Parameters
  5622.  
  5623.    pszDevName  Points to a null-terminated string. This string specifies the
  5624.    name of the device for which the monitor is to be opened.
  5625.  
  5626.    phmon  Points to the variable that receives the monitor handle.
  5627.  
  5628.  Return Value
  5629.  
  5630.    The return value is zero if the function is successful. Otherwise, it is
  5631.    an error value, which may be one of the following:
  5632.  
  5633.          ERROR_MON_INVALID_DEVNAME
  5634.          ERROR_NOT_ENOUGH_MEMORY
  5635.  
  5636.  Comments
  5637.  
  5638.    You can determine whether a device supports a monitor by using the
  5639.    DosDevIOCtl function. For more information, see DEV_QUERYMONSUPPORT in
  5640.    Chapter 3, "Input-and-Output Control Functions."
  5641.  
  5642.  See Also
  5643.  
  5644.    DosMonClose, DosMonRead, DosMonWrite
  5645.  
  5646.  ────────────────────────────────────────────────────────────────────────────
  5647.  DosMonRead
  5648.  ────────────────────────────────────────────────────────────────────────────
  5649.    USHORT DosMonRead (pbInBuffer, fWait, pbDataBuf, pcbDataBuf)
  5650.    PBYTE pbInBuffer;       /*pointer to buffer for monitor input           */
  5651.    UCHAR fWait;            /*wait/no-wait flag                             */
  5652.    PBYTE pbDataBuf;        /*pointer to buffer for data records            */
  5653.    PUSHORT pcbDataBuf;     /*pointer to variable with size of buffer       */
  5654.  
  5655.    The DosMonRead function reads data records from the device associated with
  5656.    the specified monitor and copies the records to a buffer.
  5657.  
  5658.  Parameters
  5659.  
  5660.    pbInBuffer  Points to the buffer for monitor input. This handle must have
  5661.    been registered previously by using the DosMonReg function.
  5662.  
  5663.    fWait  Specifies whether the function should wait for input. If this
  5664.    parameter is DCWW_WAIT, the function waits until input is ready. If this
  5665.    parameter is DCWW_NOWAIT, no input is ready, and the function returns
  5666.    immediately.
  5667.  
  5668.    pbDataBuf  Points to the buffer that receives the data records.
  5669.  
  5670.    pcbDataBuf  Points to the variable that contains the size (in bytes) of
  5671.    the buffer that receives the data records. When the DosMonRead function
  5672.    returns, it sets the variable to the number of bytes copied from the data
  5673.    record to the buffer.
  5674.  
  5675.  Return Value
  5676.  
  5677.    The return value is zero if the function is successful. Otherwise, it is
  5678.    an error value, which may be one of the following:
  5679.  
  5680.          ERROR_MON_BUFFER_EMPTY
  5681.          ERROR_MON_BUFFER_TOO_SMALL
  5682.          ERROR_MON_INVALID_PARMS
  5683.  
  5684.  Comments
  5685.  
  5686.    Device monitors must respond rapidly to avoid delaying input and output
  5687.    (I/O). (This rapid response is especially important for keyboard
  5688.    monitors.) A monitor process should be written so that any threads that
  5689.    read and write the monitor data run at a high priority. These threads
  5690.    should never perform operations that might delay them, such as waiting for
  5691.    I/O or a semaphore. The monitor process can have other threads running at
  5692.    normal priority to handle such operations.
  5693.  
  5694.  See Also
  5695.  
  5696.    DosMonClose, DosMonOpen, DosMonReg, DosMonWrite
  5697.  
  5698.  
  5699.  ────────────────────────────────────────────────────────────────────────────
  5700.  DosMonReg
  5701.  ────────────────────────────────────────────────────────────────────────────
  5702.    USHORT DosMonReg (hmon, pbInBuf, pbOutBuf, fPosition, usIndex)
  5703.    HMONITOR hmon;          /*monitor handle to register                    */
  5704.    PBYTE pbInBuf;          /*pointer to structure for input buffer         */
  5705.    PBYTE pbOutBuf;         /*pointer to structure for output buffer        */
  5706.    USHORT fPosition;       /*position flag                                 */
  5707.    USHORT usIndex;         /*index                                         */
  5708.  
  5709.    The DosMonReg function registers a monitor by placing it in a chain of
  5710.    other monitors for the same device. Each monitor receives input from or
  5711.    sends output to the device in the order in which it appears in the chain.
  5712.  
  5713.  Parameters
  5714.  
  5715.    hmon  Identifies the monitor to register. This handle must have been
  5716.    created previously by using the DosMonOpen function.
  5717.  
  5718.    pbInBuf  Points to the MONIN structure that receives data from the device
  5719.    driver or from the previous monitor in the chain. The MONIN structure has
  5720.    the following form:
  5721.  
  5722.    typedef struct _MONIN {
  5723.        USHORT cb;
  5724.        BYTE abReserved[18];
  5725.        BYTE bBuffer[108];
  5726.    } MONIN;
  5727.  
  5728.    For a full description, see Chapter 4, "Types, Macros, Structures."
  5729.  
  5730.    pbOutBuf  Points to the MONOUT structure that receives data for the next
  5731.    monitor in the chain. The MONOUT structure has the following form:
  5732.  
  5733.    typedef struct _MONOUT {
  5734.        USHORT cb;
  5735.        BYTE abReserved[18];
  5736.        BYTE abBuffer[108];
  5737.    } MONOUT;
  5738.  
  5739.    For a full description, see Chapter 4, "Types, Macros, Structures."
  5740.  
  5741.    fPosition  Specifies the position of the monitor in the chain of input and
  5742.    output. This parameter can be one of the following values:
  5743.  
  5744.    Value               Meaning
  5745.    ──────────────────────────────────────────────────────────────────────────
  5746.    MONITOR_BEGIN       Place the monitor at the beginning of the chain, in
  5747.                        front of any other monitors already in the chain.
  5748.  
  5749.    MONITOR_DEFAULT     Place the monitor anywhere in the chain.
  5750.  
  5751.    MONITOR_END         Place the monitor at the end of the chain, after any
  5752.                        other monitors already in the chain.
  5753.    ──────────────────────────────────────────────────────────────────────────
  5754.  
  5755.    usIndex  Specifies a device-specific value. If the device is the keyboard,
  5756.    this parameter specifies the identifier for the screen group to monitor.
  5757.    If no screen-group number is available (because the monitor is detached),
  5758.    the identifier of the current foreground screen group can be obtained by
  5759.    calling the DosGetInfoSeg function. (The current foreground screen group
  5760.    is the screen group that made the most recent call to the KbdCharIn
  5761.    function.)
  5762.  
  5763.  Return Value
  5764.  
  5765.    The return value is zero if the function is successful. Otherwise, it is
  5766.    an error value, which may be one of the following:
  5767.  
  5768.          ERROR_MON_BUFFER_TOO_SMALL
  5769.          ERROR_MON_INVALID_HANDLE
  5770.          ERROR_MON_INVALID_PARMS
  5771.          ERROR_NOT_ENOUGH_MEMORY
  5772.  
  5773.  Comments
  5774.  
  5775.    The MONIN and MONOUT structures must be in the same segment.
  5776.  
  5777.  See Also
  5778.  
  5779.    DosMonClose, DosMonOpen, DosMonRead, DosMonWrite, KbdCharIn
  5780.  
  5781.  
  5782.  ────────────────────────────────────────────────────────────────────────────
  5783.  DosMonWrite
  5784.  ────────────────────────────────────────────────────────────────────────────
  5785.    USHORT DosMonWrite (pbOutBuf, pbDataBuf, cbDataBuf)
  5786.    PBYTE pbOutBuf;         /*monitor-output buffer                         */
  5787.    PBYTE pbDataBuf;        /*buffer from which records are taken           */
  5788.    USHORT cbDataBuf;       /*number of bytes                               */
  5789.  
  5790.    The DosMonWrite function writes one or more data records into a device's
  5791.    output stream. The output-buffer structure identifies the device that
  5792.    receives the data records.
  5793.  
  5794.  Parameters
  5795.  
  5796.    pbOutBuf  Points to the output-buffer structure for the monitor. The
  5797.    monitor must have been registered previously by using the DosMonReg
  5798.    function.
  5799.  
  5800.    pbDataBuf  Points to the buffer that contains the data records to insert
  5801.    into the device's output stream.
  5802.  
  5803.    cbDataBuf  Specifies the number of bytes of data records in the buffer
  5804.    pointed to by the pbDataBuf parameter.
  5805.  
  5806.  Return Value
  5807.  
  5808.    The return value is zero if the function is successful. Otherwise, it is
  5809.    an error value, which may be one of the following:
  5810.  
  5811.          ERROR_MON_DATA_TOO_LARGE
  5812.          ERROR_MON_INVALID_PARMS
  5813.  
  5814.  Comments
  5815.  
  5816.    Device monitors must respond rapidly to avoid delaying input and output
  5817.    (I/O). (This rapid response is especially important for keyboard
  5818.    monitors.) A monitor process should be written so that any threads that
  5819.    read and write the monitor data run at a high priority. These threads
  5820.    should never perform operations that might delay them, such as waiting for
  5821.    I/O or a semaphore. The monitor process can have other threads running at
  5822.    normal priority to handle such operations.
  5823.  
  5824.  See Also
  5825.  
  5826.    DosMonClose, DosMonOpen, DosMonRead, DosMonReg
  5827.  
  5828.  
  5829.  ────────────────────────────────────────────────────────────────────────────
  5830.  DosMove
  5831.  ────────────────────────────────────────────────────────────────────────────
  5832.    USHORT DosMove (pszOldName, pszNewName, ulReserved)
  5833.    PSZ pszOldName;         /*pointer to old path and filename              */
  5834.    PSZ pszNewName;         /*pointer to new path and filename              */
  5835.    ULONG ulReserved;       /*must be zero                                  */
  5836.  
  5837.    The DosMove function moves a specified file to a specified new directory
  5838.    and/or filename. The function is often used to rename an existing file by
  5839.    moving the file to a new filename location in the same directory. The
  5840.    function can also be used to move a file to a new directory while
  5841.    preserving the existing filename or to rename any directory that is not
  5842.    the root directory.
  5843.  
  5844.    The DosMove function is a family API function.
  5845.  
  5846.  Parameters
  5847.  
  5848.    pszOldName  Points to a null-terminated string. This string specifies the
  5849.    current filename of the file to be moved. The string must be a valid MS
  5850.    OS/2 filename.
  5851.  
  5852.    pszNewName  Points to a null-terminated string. This string specifies the
  5853.    new directory and filename of the file to be moved. The string must be a
  5854.    valid MS OS/2 filename.
  5855.  
  5856.    ulReserved  Specifies a reserved value; must be zero.
  5857.  
  5858.  Return Value
  5859.  
  5860.    The return value is zero if the function is successful. Otherwise, it is
  5861.    an error value, which may be one of the following:
  5862.  
  5863.          ERROR_ACCESS_DENIED
  5864.          ERROR_DRIVE_LOCKED
  5865.          ERROR_FILE_NOT_FOUND
  5866.          ERROR_NOT_DOS_DISK
  5867.          ERROR_NOT_SAME_DEVICE
  5868.          ERROR_PATH_NOT_FOUND
  5869.          ERROR_SHARING_BUFFER_EXCEEDED
  5870.          ERROR_SHARING_VIOLATION
  5871.  
  5872.  Comments
  5873.  
  5874.    The DosMove function cannot move a file from one drive to another; if a
  5875.    drive is used in the pszOldName string, the same drive must be used in the
  5876.    pszNewName string.
  5877.  
  5878.    Wildcard characters are not allowed in the filename.
  5879.  
  5880.  Example
  5881.  
  5882.    This example calls the DosMove function to move the file abc to the root
  5883.    directory of the current drive and to rename the file xyz. This does not
  5884.    copy the file, but it may change the subdirectory that the filename
  5885.    appears in and may change the filename itself.
  5886.  
  5887.    DosMove("abc",            /* old filename and path */
  5888.        "\\xyz",              /* new filename and path */
  5889.        0L);                  /* reserved              */
  5890.  
  5891.  See Also
  5892.  
  5893.    DosDelete, DosSelectDisk
  5894.  
  5895.  
  5896.  ────────────────────────────────────────────────────────────────────────────
  5897.  DosMuxSemWait
  5898.  ────────────────────────────────────────────────────────────────────────────
  5899.    USHORT DosMuxSemWait (pisemCleared, pmsxl, lTimeOut)
  5900.    PUSHORT pisemCleared;   /*pointer to variable for cleared semaphore     */
  5901.    PVOID pmsxl;            /*pointer to structure containing semaphore     */
  5902.                            /*list                                          */
  5903.    LONG lTimeOut;          /*time-out value                                */
  5904.  
  5905.    The DosMuxSemWait function waits for one or more of the specified
  5906.    semaphores to clear. The function first checks the semaphores specified in
  5907.    the list pointed to by the pmsxl parameter. If any of the semaphores in
  5908.    this list are clear, the function returns. Otherwise, the function waits
  5909.    until the time specified by the lTimeOut parameter elapses or until one of
  5910.    the semaphores in the list clears.
  5911.  
  5912.    The semaphore list can contain up to 16 semaphores.
  5913.  
  5914.  Parameters
  5915.  
  5916.    pisemCleared  Points to the variable that receives the index number of the
  5917.    most recently cleared semaphore.
  5918.  
  5919.    pmsxl  Points to the MUXSEMLIST structure containing a semaphore list that
  5920.    defines the semaphores to be cleared. The semaphore list consists of one
  5921.    or more semaphore handles. The MUXSEMLIST structure has the following
  5922.    form:
  5923.  
  5924.    typedef struct _MUXSEMLIST {
  5925.        USHORT cmxs;
  5926.        MUXSEM amxs[16];
  5927.    } MUXSEMLIST;
  5928.  
  5929.    The structure may contain up to 16 semaphores.
  5930.  
  5931.    For a full description, see Chapter 4, "Types, Macros, Structures."
  5932.  
  5933.    lTimeOut  Specifies how long to wait for the semaphores to become
  5934.    available. If the value is greater then zero, this parameter specifies the
  5935.    number of milliseconds to wait before returning. If it is
  5936.    SEM_IMMEDIATE_RETURN, the function returns immediately. If it is
  5937.    SEM_INDEFINITE_WAIT, the function waits indefinitely.
  5938.  
  5939.  Return Value
  5940.  
  5941.    The return value is zero if the function is successful. Otherwise, it is
  5942.    an error value, which may be one of the following:
  5943.  
  5944.          ERROR_EXCL_SEM_ALREADY_OWNED
  5945.          ERROR_INTERRUPT
  5946.          ERROR_INVALID_EVENT_COUNT
  5947.          ERROR_INVALID_HANDLE
  5948.          ERROR_INVALID_LIST_FORMAT
  5949.          ERROR_SEM_TIMEOUT
  5950.          ERROR_TOO_MANY_MUXWAITERS
  5951.  
  5952.  Comments
  5953.  
  5954.    Although it is declared with the PVOID type, the second parameter of the
  5955.    DosMuxSemWait function must point to a MUXSEMLIST structure. You can
  5956.    create the structure by using the DEFINEMUXSEMLIST macro. The macro has
  5957.    the following syntax:
  5958.  
  5959.    DEFINEMUXSEMLIST(name, size)
  5960.  
  5961.    The name parameter specifies the name of the structure to be created, and
  5962.    the size parameter specifies the number of elements in the structure──that
  5963.    is, the number of semaphores in the list. This macro creates an array of
  5964.    MUXSEMLIST structures.
  5965.  
  5966.    Unlike the other blocking semaphore functions (DosSemRequest,
  5967.    DosSemSetWait and DosSemWait), DosMuxSemWait returns whenever one of the
  5968.    semaphores on its list is cleared, regardless of how long that semaphore
  5969.    may remain cleared. It is possible that the semaphore could be reset
  5970.    before the DosMuxSemWait function returns.
  5971.  
  5972.    The DosMuxSemWait function does not set or claim any of the semaphores.
  5973.  
  5974.    The DosMuxSemWait function can be used in conjunction with one or more
  5975.    semaphores as a triggering or synchronizing device. One or more threads
  5976.    can use DosMuxSemWait to wait for a semaphore. When an event occurs,
  5977.    another thread can clear that semaphore and immediately set it again. Any
  5978.    threads that waited for that semaphore by using DosMuxSemWait will return.
  5979.    Threads that were waiting by using one of the "level-triggered" functions
  5980.    (DosSemRequest, DosSemSetWait, or DosSemWait) may or may not resume,
  5981.    depending on the scheduler's dispatch order and the activity of other
  5982.    threads in the system.
  5983.  
  5984.  Example
  5985.  
  5986.    This example creates a structure of system semaphore handles for use by
  5987.    the DosMuxSemWait function. It sets the first element of the structure to
  5988.    the number of handles stored and creates two semaphore handles. It then
  5989.    calls DosMuxSemWait to wait until one of the semaphores is cleared. It
  5990.    uses the value of the usSemIndex parameter to find out which semaphore is
  5991.    cleared, and if it is semaphore 1, the example sets that semaphore.
  5992.  
  5993.    DEFINEMUXSEMLIST(MuxList, 2)         /* creates structure array */
  5994.    USHORT usSemIndex;
  5995.    MuxList.cmxs = 2;
  5996.    DosCreateSem(CSEM_PUBLIC, &MuxList.amxs[0].hsem,
  5997.        "\\sem\\timer0.sem");
  5998.    DosCreateSem(CSEM_PUBLIC, &MuxList.amxs[1].hsem,
  5999.        "\\sem\\timer1.sem");
  6000.        .
  6001.        .
  6002.        .
  6003.    DosMuxSemWait(&usSemIndex, &MuxList, 5000L);
  6004.    if (usSemIndex == 1) {
  6005.        DosSemSet(MuxList.amxs[1].hsem);
  6006.  
  6007.  See Also
  6008.  
  6009.    DosCreateSem, DosSemRequest, DosSemSet, DosSemSetWait, DosSemWait,
  6010.    WinMsgMuxSemWait
  6011.  
  6012.  
  6013.  ────────────────────────────────────────────────────────────────────────────
  6014.  DosNewSize
  6015.  ────────────────────────────────────────────────────────────────────────────
  6016.    USHORT DosNewSize (hf, ulNewSize)
  6017.    HFILE hf;               /*file handle                                   */
  6018.    ULONG ulNewSize;        /*new size of file                              */
  6019.  
  6020.    The DosNewSize function changes the size of the specified file. The
  6021.    function can be used to truncate or extend a file. If a file is extended,
  6022.    the value of the new bytes is undefined.
  6023.  
  6024.    The DosNewSize function is a family API function.
  6025.  
  6026.  Parameters
  6027.  
  6028.    hf  Identifies the file to be changed. This handle must have been created
  6029.    previously by using the DosOpen function.
  6030.  
  6031.    ulNewSize  Specifies the file's new size (in bytes).
  6032.  
  6033.  Return Value
  6034.  
  6035.    The return value is zero if the function is successful. Otherwise, it is
  6036.    an error value, which may be one of the following:
  6037.  
  6038.          ERROR_ACCESS_DENIED
  6039.          ERROR_DISK_FULL
  6040.          ERROR_INVALID_HANDLE
  6041.          ERROR_INVALID_PARAMETER
  6042.          ERROR_LOCK_VIOLATION
  6043.          ERROR_NOT_DOS_DISK
  6044.  
  6045.  Comments
  6046.  
  6047.    The DosNewSize function applies only to files that have been opened for
  6048.    writing. To change the size of a read-only file, first change the file's
  6049.    attributes by using the DosSetFileMode function, then open the file for
  6050.    writing.
  6051.  
  6052.    If the function extends a file, the system will attempt to allocate
  6053.    sectors that are contiguous with the existing file sectors.
  6054.  
  6055.  Example
  6056.  
  6057.    This example opens the file abc and calls the DosNewSize function to set
  6058.    the file's size to 100 bytes. If the file already exists and is larger
  6059.    than 100 bytes, it is truncated to 100 bytes. If the file is smaller than
  6060.    100 bytes, or if it was created by using the DosOpen function, it is
  6061.    expanded to 100 bytes.
  6062.  
  6063.    HFILE hf;
  6064.    USHORT usAction;
  6065.    DosOpen("abc", &hf, &usAction, 0L, FILE_NORMAL,
  6066.        FILE_OPEN | FILE_CREATE,
  6067.        OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYREADWRITE, 0L);
  6068.    DosNewSize(hf, 100L);
  6069.  
  6070.  See Also
  6071.  
  6072.    DosOpen, DosQFileInfo, DosSetFileMode
  6073.  
  6074.  
  6075.  ────────────────────────────────────────────────────────────────────────────
  6076.  DosOpen
  6077.  ────────────────────────────────────────────────────────────────────────────
  6078.    USHORT DosOpen (pszFileName, phf, pusAction, ulFileSize, usAttribute,
  6079.    fsOpenFlags, fsOpenMode, ulReserved)
  6080.    PSZ pszFileName;        /*pointer to filename                           */
  6081.    PHFILE phf;             /*pointer to variable for file handle           */
  6082.    PUSHORT pusAction;      /*pointer to variable for action taken          */
  6083.    ULONG ulFileSize;       /*file size if created or truncated             */
  6084.    USHORT usAttribute;     /*file attribute                                */
  6085.    USHORT fsOpenFlags;     /*action taken if file exists/does not exist    */
  6086.    USHORT fsOpenMode;      /*open mode of file                             */
  6087.    ULONG ulReserved;       /*must be zero                                  */
  6088.  
  6089.    The DosOpen function opens an existing file or creates a new file. This
  6090.    function returns a handle that can be used to read from and write to the
  6091.    file, as well as to retrieve information about the file.
  6092.  
  6093.    The DosOpen function is a family API function.
  6094.  
  6095.  Parameters
  6096.  
  6097.    pszFileName  Points to the null-terminated string that specifies the name
  6098.    of the file to be opened. The string must be a valid MS OS/2 filename and
  6099.    must not contain wildcard characters.
  6100.  
  6101.    phf  Points to the variable that receives the handle of the opened file.
  6102.  
  6103.    pusAction  Points to the variable receiving the value that specifies the
  6104.    action taken by the DosOpen function. If DosOpen fails, this value has no
  6105.    meaning. Otherwise, it is one of the following values:
  6106.  
  6107.    Value             Meaning
  6108.    ──────────────────────────────────────────────────────────────────────────
  6109.    FILE_CREATED      File was created.
  6110.  
  6111.    FILE_EXISTED      File already existed.
  6112.  
  6113.    FILE_TRUNCATED    File existed and was truncated.
  6114.    ──────────────────────────────────────────────────────────────────────────
  6115.  
  6116.    ulFileSize  Specifies the file's new size (in bytes). This parameter
  6117.    applies only if the file is created or truncated. The size specification
  6118.    has no effect on a file that is opened only for reading.
  6119.  
  6120.    usAttribute  Specifies the file attributes. This parameter can be a
  6121.    combination of the following values:
  6122.  
  6123.    Value             Meaning
  6124.    ──────────────────────────────────────────────────────────────────────────
  6125.    FILE_NORMAL       File can be read from or written to.
  6126.  
  6127.    FILE_READONLY     File can be read from, but not written to.
  6128.  
  6129.    FILE_HIDDEN       File is hidden and does not appear in a directory
  6130.                      listing.
  6131.  
  6132.    FILE_SYSTEM       File is a system file.
  6133.  
  6134.    FILE_ARCHIVED     File has been archived.
  6135.    ──────────────────────────────────────────────────────────────────────────
  6136.  
  6137.    File attributes apply only if the file is created.
  6138.  
  6139.    fsOpenFlags  Specifies the action to take both when the file exists and
  6140.    when it does not exist. This parameter may be one of the following values:
  6141.  
  6142.    Value                         Meaning
  6143.    ──────────────────────────────────────────────────────────────────────────
  6144.    FILE_CREATE                   Create a new file; fail if the file already
  6145.                                  exists.
  6146.  
  6147.    FILE_OPEN                     Open an existing file; fail if the file does
  6148.                                  not exist.
  6149.  
  6150.    FILE_OPEN | FILE_CREATE       Open an existing file or create the file if
  6151.                                  it does not exist.
  6152.  
  6153.    FILE_TRUNCATE                 Open an existing file and change to a given
  6154.                                  size.
  6155.  
  6156.    FILE_TRUNCATE | FILE_CREATE   Open an existing file and truncate it, or
  6157.                                  create the file if it does not exist.
  6158.    ──────────────────────────────────────────────────────────────────────────
  6159.  
  6160.    fsOpenMode  Specifies the modes with which to open the file. It consists
  6161.    of one access mode and one share mode. The other values are option and can
  6162.    be given in any combination:
  6163.  
  6164. ╓┌─┌─────────────────────────────┌───────────────────────────────────────────╖
  6165.    Value                         Meaning
  6166.    ──────────────────────────────────────────────────────────────────────────
  6167.    OPEN_ACCESS_READONLY          Data may be read from the file but not
  6168.                                  written to it.
  6169.  
  6170.    OPEN_ACCESS_READWRITE         Data may be read from or written to the
  6171.                                  file.
  6172.  
  6173.    OPEN_ACCESS_WRITEONLY         Data may be written to the file but not read
  6174.                                  from it.
  6175.  
  6176.    Value                         Meaning
  6177.    ──────────────────────────────────────────────────────────────────────────
  6178. 
  6179.    OPEN_SHARE_DENYNONE           Other processes can open the file for any
  6180.                                  access: read-only, write-only, or
  6181.                                  read-write.
  6182.  
  6183.    OPEN_SHARE_DENYREAD           Other processes can open the file for
  6184.                                  write-only access but they cannot open it
  6185.                                  for read-only or read-write access.
  6186.  
  6187.    OPEN_SHARE_DENYREADWRITE      The current process has exclusive access to
  6188.                                  the file. The file cannot be opened by any
  6189.                                  process (including the current process).
  6190.  
  6191.    OPEN_SHARE_DENYWRITE          Other processes can open the file for
  6192.                                  read-only access but they cannot open it for
  6193.                                  write-only or read-write access.
  6194.  
  6195.    OPEN_FLAGS_DASD               The file handle represents a physical drive
  6196.                                  that has been opened for direct access. (The
  6197.    Value                         Meaning
  6198.    ──────────────────────────────────────────────────────────────────────────
  6199.                                 that has been opened for direct access. (The
  6200.                                  pszFileName parameter must specify a drive
  6201.                                  name.) The DosDevIOCtl function can be used
  6202.                                  with this file handle to bypass the file
  6203.                                  system and to access the sectors of the
  6204.                                  drive directly.
  6205.  
  6206.    OPEN_FLAGS_FAIL_ON_ERROR      Any function that uses the file handle
  6207.                                  returns immediately with an error value if
  6208.                                  there is an I/O error──for example, when the
  6209.                                  drive door is open or a sector is missing.
  6210.                                  If this value is not specified, the system
  6211.                                  passes the error to the system
  6212.                                  critical-error handler, which then reports
  6213.                                  the error to the user with a hard-error
  6214.                                  popup. The fail-on-error flag is not
  6215.                                  inherited by child processes.
  6216.  
  6217.                                  The fail-on-error flag applies to all
  6218.    Value                         Meaning
  6219.    ──────────────────────────────────────────────────────────────────────────
  6220.                                 The fail-on-error flag applies to all
  6221.                                  functions that use the file handle, with the
  6222.                                  exception of the DosDevIOCtl function.
  6223.  
  6224.    OPEN_FLAGS_NOINHERIT          The file handle is not available to any
  6225.                                  child process started by the current
  6226.                                  process. If this value is not specified, any
  6227.                                  child process started by the current process
  6228.                                  may use the file handle.
  6229.  
  6230.    OPEN_FLAGS_WRITE_THROUGH      This flag applies to functions, such as
  6231.                                  DosWrite, that write data to the file. If
  6232.                                  this value is specified, the system writes
  6233.                                  data to the device before the given function
  6234.                                  returns. Otherwise, the system may store the
  6235.                                  data in an internal file buffer and write
  6236.                                  the data to the device only when the buffer
  6237.                                  is full or the file is closed.
  6238.    ──────────────────────────────────────────────────────────────────────────
  6239.    Value                         Meaning
  6240.    ──────────────────────────────────────────────────────────────────────────
  6241.   ──────────────────────────────────────────────────────────────────────────
  6242.  
  6243.  
  6244.    ulReserved  Specifies a reserved value; must be zero.
  6245.  
  6246.  Return Value
  6247.  
  6248.    The return value is zero if the function is successful. Otherwise, it is
  6249.    an error value, which may be one of the following:
  6250.  
  6251.          ERROR_ACCESS_DENIED
  6252.          ERROR_CANNOT_MAKE
  6253.          ERROR_DISK_FULL
  6254.          ERROR_DRIVE_LOCKED
  6255.          ERROR_FILE_NOT_FOUND
  6256.          ERROR_INVALID_ACCESS
  6257.          ERROR_INVALID_PARAMETER
  6258.          ERROR_NOT_DOS_DISK
  6259.          ERROR_OPEN_FAILED
  6260.          ERROR_PATH_NOT_FOUND
  6261.          ERROR_SHARING_BUFFER_EXCEEDED
  6262.          ERROR_SHARING_VIOLATION
  6263.          ERROR_TOO_MANY_OPEN_FILES
  6264.  
  6265.  Comments
  6266.  
  6267.    The ERROR_ACCESS_DENIED value is returned if you try to open a file in a
  6268.    mode that is incompatible with the file's current access and sharing
  6269.    modes──for example, if you attempt to open a read-only file for writing.
  6270.    This error is also returned if some other process has opened the file with
  6271.    a sharing method that denies the type of access you have requested.
  6272.  
  6273.    Once the file is opened, the DosSetFHandState function can be used to
  6274.    change the OPEN_FLAGS_FAIL_ON_ERROR, OPEN_FLAGS_NOINHERIT, and
  6275.    OPEN_FLAGS_WRITE_THROUGH flags specified in the fsOpenMode parameter.
  6276.  
  6277.    MS OS/2 does not provide a built-in method to inform a child process that
  6278.    it has inherited a given file handle. The parent process must pass this
  6279.    information to a child process. If the file is created without the
  6280.    OPEN_FLAGS_NOINHERIT flag, and the parent process terminates without
  6281.    closing the file, the file will remain open until all child processes have
  6282.    terminated.
  6283.  
  6284.  Restrictions
  6285.  
  6286.    In real mode, the following restriction applies to the DosOpen function:
  6287.  
  6288.    ■  Only the access modes and the OPEN_FLAGS_DASD flag may be specified for
  6289.       the fsOpenMode parameter.
  6290.  
  6291.  Example
  6292.  
  6293.    This example calls the DosOpen function to create a file abc that is 100
  6294.    bytes long and open it for write-only access. The fsOpenFlags parameter is
  6295.    set to FILE_CREATE so that DosOpen will return an error if the file
  6296.    already exists.
  6297.  
  6298.    HFILE hf;
  6299.    USHORT usAction;
  6300.    DosOpen("abc",                            /* filename to open       */
  6301.        &hf,                                  /* address of file handle */
  6302.        &usAction,                            /* action taken           */
  6303.        100L,                                 /* size of new file       */
  6304.        FILE_NORMAL,                          /* file attribute         */
  6305.        FILE_CREATE,                          /* create the file        */
  6306.        OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYNONE, /* open mode       */
  6307.        0L);                                         /* reserved        */
  6308.  
  6309.  See Also
  6310.  
  6311.    DosBufReset, DosChgFilePtr, DosDevIOCtl, DosDupHandle, DosExecPgm,
  6312.    DosQFHandState, DosQFileInfo, DosQFileMode, DosQFSInfo,
  6313.    DosSetFHandState, DosSetFileMode
  6314.  
  6315.  
  6316.  ────────────────────────────────────────────────────────────────────────────
  6317.  DosOpenQueue
  6318.  ────────────────────────────────────────────────────────────────────────────
  6319.    USHORT DosOpenQueue (ppidOwner, phqueue, pszQueueName)
  6320.    PUSHORT ppidOwner;      /*pointer to variable for queue owner's         */
  6321.                            identifier
  6322.    PHQUEUE phqueue;        /*pointer to variable for handle of queue       */
  6323.    PSZ pszQueueName;       /*pointer to name of queue                      */
  6324.  
  6325.    The DosOpenQueue function opens a queue for the current process.
  6326.  
  6327.  Parameters
  6328.  
  6329.    ppidOwner  Points to the variable that receives the process identifier of
  6330.    the queue owner.
  6331.  
  6332.    phqueue  Points to the variable that receives the handle of the queue.
  6333.  
  6334.    pszQueueName  Points to a null-terminated string. This string identifies
  6335.    the queue and must have the following form:
  6336.  
  6337.    \queues\name
  6338.  
  6339.    The string name, name, must have the same format as an MS OS/2 filename
  6340.    and must identify a queue that has been created previously by using the
  6341.    DosCreateQueue function.
  6342.  
  6343.  Return Value
  6344.  
  6345.    The return value is zero if the function is successful. Otherwise, it is
  6346.    an error value, which may be one of the following:
  6347.  
  6348.          ERROR_QUE_NAME_NOT_EXIST
  6349.          ERROR_QUE_NO_MEMORY
  6350.  
  6351.  See Also
  6352.  
  6353.    DosCloseQueue, DosCreateQueue, DosReadQueue, DosWriteQueue
  6354.  
  6355.  
  6356.  ────────────────────────────────────────────────────────────────────────────
  6357.  DosOpenSem
  6358.  ────────────────────────────────────────────────────────────────────────────
  6359.    USHORT DosOpenSem (phsem, pszSemName)
  6360.    PHSEM phsem;            /*pointer to variable for semaphore handle      */
  6361.    PSZ pszSemName;         /*pointer to semaphore name                     */
  6362.  
  6363.    The DosOpenSem function opens a system semaphore of the specified name and
  6364.    returns a unique semaphore handle. The semaphore handle can then be used
  6365.    to set and clear the semaphore and to carry out other tasks that use the
  6366.    semaphore.
  6367.  
  6368.  Parameters
  6369.  
  6370.    phsem  Points to the variable that receives the new semaphore handle.
  6371.  
  6372.    pszSemName  Points to the null-terminated string that identifies the
  6373.    semaphore. The string must have the following form:
  6374.  
  6375.    \sem\name
  6376.  
  6377.    The string name, name, must have the same format as an MS OS/2 filename
  6378.    and must identify a semaphore that has been created previously by using
  6379.    the DosCreateSem function.
  6380.  
  6381.  Return Value
  6382.  
  6383.    The return value is zero if the function is successful. Otherwise, it is
  6384.    an error value, which may be one of the following:
  6385.  
  6386.          ERROR_INVALID_NAME
  6387.          ERROR_SEM_NOT_FOUND
  6388.          ERROR_TOO_MANY_SEMAPHORES
  6389.  
  6390.  Comments
  6391.  
  6392.    The DosOpenSem function only returns the handle of the semaphore; it does
  6393.    not test or change the value of the semaphore. The semaphore handle is the
  6394.    same as the semaphore handle returned by the DosCreateSem function that
  6395.    created the semaphore.
  6396.  
  6397.    If a process creates a child process by using the DosExecPgm function, the
  6398.    new process inherits any open semaphore handles.
  6399.  
  6400.    Under MS OS/2, system semaphores reside in a memory buffer rather than a
  6401.    disk file. When the last process with an open semaphore terminates, that
  6402.    semaphore is closed and is no longer available to any other process.
  6403.  
  6404.  Example
  6405.  
  6406.    This example calls the DosOpenSem function to open a system semaphore that
  6407.    had been created previously:
  6408.  
  6409.    HSEM hsem;                               /* handle to semaphore  */
  6410.    DosOpenSem(&hsem, "\\sem\\abc.ext");     /* opens the semaphore  */
  6411.        .
  6412.        .
  6413.        .
  6414.    DosCloseSem(hsem);                       /* closes the semaphore */
  6415.  
  6416.  See Also
  6417.  
  6418.    DosCloseSem, DosCreateSem, DosExecPgm, DosSemClear, DosSemRequest
  6419.  
  6420.  
  6421.  ────────────────────────────────────────────────────────────────────────────
  6422.  DosPeekNmPipe
  6423.  ────────────────────────────────────────────────────────────────────────────
  6424.    USHORT DosPeekNmPipe (hp, pbBuf, cbBuf, pcbRead, pcbAvail, pfsState)
  6425.    HPIPE hp;               /*pipe handle                                   */
  6426.    PBYTE pbBuf;            /*pointer to buffer for data                    */
  6427.    USHORT cbBuf;           /*length of buffer for data                     */
  6428.    PUSHORT pcbRead;        /*pointer to variable for number bytes read     */
  6429.    PUSHORT pcbAvail;       /*pointer to variable for number bytes          */
  6430.                            /*available                                     */
  6431.    PUSHORT pfsState;       /*pointer to variable for pipe state            */
  6432.  
  6433.    The DosPeekNmPipe function copies a pipe's data into a buffer.
  6434.  
  6435.  Parameters
  6436.  
  6437.    hp  Identifies the pipe to read from.
  6438.  
  6439.    pbBuf  Points to a buffer that receives the data from the pipe.
  6440.  
  6441.    cbBuf  Specifies the length (in bytes) of the buffer that receives the
  6442.    data from the pipe.
  6443.  
  6444.    pcbRead  Points to the variable that receives a value specifying the
  6445.    number of bytes read from the pipe.
  6446.  
  6447.    pcbAvail  Points to the variable that the receives a value specifying the
  6448.    number of bytes that were available to be read. The first two bytes of
  6449.    this buffer specify the number of bytes remaining in the pipe (including
  6450.    message-header bytes). The next two bytes specify the number of bytes
  6451.    remaining in the current message. (There will be zero bytes remaining in
  6452.    the current message for a byte-stream pipe.)
  6453.  
  6454.    pfsState  Points to the variable that receives the state of the pipe. The
  6455.    state may be one of the following values:
  6456.  
  6457.    Value                       Meaning
  6458.    ──────────────────────────────────────────────────────────────────────────
  6459.    PIPE_STATE_CLOSING          The pipe is closed and can no longer be used.
  6460.  
  6461.    PIPE_STATE_CONNECTED        The pipe has been opened and is available for
  6462.                                reading and writing.
  6463.  
  6464.    PIPE_STATE_DISCONNECTED     The serving end must call the DosConnectNmPipe
  6465.                                function to put the pipe into a listening
  6466.                                state before a call to the DosOpen function
  6467.                                will be accepted. A pipe is in a disconnected
  6468.                                state between a call to the DosMakeNmPipe
  6469.                                function and a call to the DosConnectNmPipe
  6470.                                function.
  6471.  
  6472.    PIPE_STATE_LISTENING        The pipe will accept a call to the DosOpen
  6473.                                function.
  6474.    ──────────────────────────────────────────────────────────────────────────
  6475.  
  6476.  Return Value
  6477.  
  6478.    The return value is zero if the function is successful. Otherwise, it is
  6479.    an error value, which may be one of the following:
  6480.  
  6481.          ERROR_BAD_PIPE
  6482.          ERROR_PIPE_NOT_CONNECTED
  6483.  
  6484.  Comments
  6485.  
  6486.    The DosPeekNmPipe function never blocks, regardless of the blocking mode
  6487.    of the pipe.
  6488.  
  6489.    If the DosDisConnectNmPipe function has been called, the pipe will remain
  6490.    disconnected until a call is made to the DosConnectNmPipe function.
  6491.  
  6492.  See Also
  6493.  
  6494.    DosConnectNmPipe, DosDisConnectNmPipe, DosMakeNmPipe, DosRead
  6495.  
  6496.  
  6497.  ────────────────────────────────────────────────────────────────────────────
  6498.  DosPeekQueue
  6499.  ────────────────────────────────────────────────────────────────────────────
  6500.    USHORT DosPeekQueue (hqueue, pqresc, pcbElement, ppv, pusElementCode,
  6501.    fWait, pbElemPrty, hsem)
  6502.    HQUEUE hqueue;          /*handle of queue to read from                  */
  6503.    PQUEUERESULT pqresc;    /*pointer to structure for PID and request code */
  6504.    PUSHORT pcbElement;     /*pointer to variable for number of bytes       */
  6505.    PVOID FAR * ppv;        /*pointer to buffer for element received        */
  6506.    PUSHORT pusElementCode; /*pointer to variable for element position      */
  6507.    UCHAR fWait;            /*wait/no wait indicator                        */
  6508.    PBYTE pbElemPrty;       /*pointer to variable for priority of element   */
  6509.    ULONG hsem;             /*semaphore handle                              */
  6510.  
  6511.    The DosPeekQueue function retrieves an element without removing it from a
  6512.    queue. It copies the address of the element to a pointer and fills a
  6513.    structure with information about the element.
  6514.  
  6515.  Parameters
  6516.  
  6517.    hqueue  Identifies the queue to be read from. This handle must have been
  6518.    previously created or opened by using the DosCreateQueue or DosOpenQueue
  6519.    function.
  6520.  
  6521.    pqresc  Points to the structure that receives information about the
  6522.    request. The QUEUERESULT structure has the following form:
  6523.  
  6524.    typedef struct _QUEUERESULT {
  6525.        PID pidProcess;
  6526.        USHORT usEventCode;
  6527.    } QUEUERESULT;
  6528.  
  6529.    For a full description, see Chapter 4, "Types, Macros, Structures."
  6530.  
  6531.    pcbElement  Points to the variable that receives the length in bytes of
  6532.    the element.
  6533.  
  6534.    ppv  Points to a pointer that receives the address of the element in the
  6535.    queue.
  6536.  
  6537.    pusElementCode  Points to the variable that specifies where to look in the
  6538.    queue for the element. If the pusElementCode parameter is 0x0000, the
  6539.    function looks at the beginning of the queue. Otherwise, the function
  6540.    assumes the value is an element identifier and looks for the element that
  6541.    immediately follows the specified element. When the function returns, it
  6542.    copies the identifier of the retrieved element to the variable. The
  6543.    element identifier can then be used to search for the next element or to
  6544.    read the given element from the queue.
  6545.  
  6546.    fWait  Specifies whether the function should wait for an element to be
  6547.    placed in the queue, if the queue is empty. If the fWait parameter is
  6548.    DCWW_WAIT, the function waits until an element is available. If it is
  6549.    DCWW_NOWAIT, the function returns immediately.
  6550.  
  6551.    pbElemPrty  Points to a variable that receives the priority value
  6552.    specified when the element was added to the queue. This is a numeric value
  6553.    from 0 through 15; 15 is the highest priority.
  6554.  
  6555.    hsem  Identifies a semaphore. This value can be the handle of a system
  6556.    semaphore that has been previously created or opened by using the
  6557.    DosCreateSem or DosOpenSem function, or it can be the address of a RAM
  6558.    semaphore. This semaphore would typically be used in a call to the
  6559.    DosMuxSemWait function to wait until the queue has an element. If the
  6560.    fWait parameter is DCWW_WAIT, hsem is ignored.
  6561.  
  6562.  Return Value
  6563.  
  6564.    The return value is zero if the function is successful. Otherwise, it is
  6565.    an error value, which may be one of the following:
  6566.  
  6567.          ERROR_QUE_ELEMENT_NOT_EXIST
  6568.          ERROR_QUE_EMPTY
  6569.          ERROR_QUE_INVALID_HANDLE
  6570.          ERROR_QUE_INVALID_WAIT
  6571.          ERROR_QUE_PROC_NOT_OWNED
  6572.  
  6573.  Comments
  6574.  
  6575.    If the queue is empty, the DosPeekQueue function either returns
  6576.    immediately or waits for an element to be written to the queue, depending
  6577.    on the value of the fWait parameter.
  6578.  
  6579.    Only the process that created the queue may call the DosPeekQueue
  6580.    function.
  6581.  
  6582.  See Also
  6583.  
  6584.    DosCreateQueue, DosCreateSem, DosMuxSemWait, DosOpenSem,
  6585.    DosOpenQueue, DosReadQueue
  6586.  
  6587.  
  6588.  ────────────────────────────────────────────────────────────────────────────
  6589.  DosPhysicalDisk
  6590.  ────────────────────────────────────────────────────────────────────────────
  6591.    USHORT DosPhysicalDisk (usFunction, pbOutBuf, cbOutBuf, pbParmBuf,
  6592.    cbParmBuf)
  6593.    USHORT usFunction;      /*action to take                                */
  6594.    PBYTE pbOutBuf;         /*pointer to output buffer                      */
  6595.    USHORT cbOutBuf;        /*output-buffer length                          */
  6596.    PBYTE pbParmBuf;        /*pointer to user-supplied information          */
  6597.    USHORT cbParmBuf;       /*length of user-supplied information           */
  6598.  
  6599.    The DosPhysicalDisk function retrieves information about partitionable
  6600.    disks.
  6601.  
  6602.  Parameters
  6603.  
  6604.    usFunction  Specifies the action to take. It can be one of the following
  6605.    values:
  6606.  
  6607.    Value                             Meaning
  6608.    ──────────────────────────────────────────────────────────────────────────
  6609.    INFO_COUNT_PARTITIONABLE_DISKS    Retrieve the total number of
  6610.                                      partitionable disks.
  6611.  
  6612.    INFO_FREEIOCTLHANDLE              Release the handle obtained by a
  6613.                                      previous call to DosPhysicalDisk.
  6614.  
  6615.    INFO_GETIOCTLHANDLE               Retrieve a handle to use with Category 9
  6616.                                      IOCtl functions.
  6617.    ──────────────────────────────────────────────────────────────────────────
  6618.  
  6619.    pbOutBuf  Points to the buffer that receives output information. For a
  6620.    full description, see the first list under "Comments."
  6621.  
  6622.    cbOutBuf  Specifies the length (in bytes) of the output buffer.
  6623.  
  6624.    pbParmBuf  Points to a buffer that contains parameter data. For a full
  6625.    description, see the second list under "Comments."
  6626.  
  6627.    cbParmBuf  Specifies the length (in bytes) of the parameter buffer.
  6628.  
  6629.  Return Value
  6630.  
  6631.    The return value is zero if the function is successful. Otherwise, it is
  6632.    an error value.
  6633.  
  6634.  Comments
  6635.  
  6636.    When DosPhysicalDisk is used to obtain a handle to a partitionable
  6637.    physical drive (a usFunction value of INFO_GETIOCTLHANDLE), the pbParmBuf
  6638.    parameter should point to a null-terminated string that contains the drive
  6639.    number and a colon (:). The cbParmBuf parameter must contain the length of
  6640.    the entire string, including the trailing null character. For example, to
  6641.    obtain a handle for the first partitionable disk, pbParmBuf should point
  6642.    to "1:" and cbParmBuf should be 3.
  6643.  
  6644.    The organization and content of the output buffer depend on the given
  6645.    function, as follows:
  6646.  
  6647.    Function  cbOutBuf        Returned information
  6648.    ──────────────────────────────────────────────────────────────────────────
  6649.    1         2               Total number of partitionable disks in system
  6650.                              (one-based).
  6651.  
  6652.    2         2               Handle for the specified partitionable disk for
  6653.                              the Category 9 IOCtl functions.
  6654.  
  6655.    3         0               None. Pointer must be zero.
  6656.    ──────────────────────────────────────────────────────────────────────────
  6657.  
  6658.    This organization and content of the parameter buffer depend on the given
  6659.    function, as follows:
  6660.  
  6661.    Funct cbParmBuf   Input parameters
  6662.    ion
  6663.    ──────────────────────────────────────────────────────────────────────────
  6664.    1     0           None. Must be zero.
  6665.  
  6666.    2     Length of   Null-terminated string that specifies the partitionable
  6667.          string,     disk. The string must have the following form:
  6668.          including
  6669.          terminal    number:
  6670.          null
  6671.          character   The number parameter specifies the partitionable disk
  6672.                      number. Partitionable disk numbers start at 1.
  6673.  
  6674.    3     2           Handle retrieved by function 2.
  6675.    ──────────────────────────────────────────────────────────────────────────
  6676.  
  6677.  Example
  6678.  
  6679.    This example calls the DosPhysicalDisk function to determine the total
  6680.    number of partitionable disks. The total value is placed in the
  6681.    usDataBuffer variable.
  6682.  
  6683.    USHORT usDataBuffer;
  6684.    DosPhysicalDisk(INFO_COUNT_PARTITIONABLE_DISKS,
  6685.        (PBYTE) &usDataBuffer,      /* address of data buffer    */
  6686.        2,                          /* length of data buffer     */
  6687.        NULL,                       /* pointer to parameter list */
  6688.        0);                         /* length of parameter list  */
  6689.  
  6690.  See Also
  6691.  
  6692.    DosDevConfig, DosDevIOCtl
  6693.  
  6694.  
  6695.  ────────────────────────────────────────────────────────────────────────────
  6696.  DosPortAccess
  6697.  ────────────────────────────────────────────────────────────────────────────
  6698.    USHORT DosPortAccess (usReserved, fRelease, usFirstPort, usLastPort)
  6699.    USHORT usReserved;      /*must be zero                                  */
  6700.    USHORT fRelease;        /*request/release indicator                     */
  6701.    USHORT usFirstPort;     /*first port number                             */
  6702.    USHORT usLastPort;      /*last port number                              */
  6703.  
  6704.    The DosPortAccess function requests or releases access to a port, or
  6705.    ports, for input/output privilege.
  6706.  
  6707.  Parameters
  6708.  
  6709.    usReserved  Specifies a reserved value; must be zero.
  6710.  
  6711.    fRelease  Specifies the type of access request. If this parameter is
  6712.    FALSE, the function requests access to a port. If it is TRUE, the function
  6713.    releases access to a port.
  6714.  
  6715.    usFirstPort  Specifies either a single port or the starting port number
  6716.    (start-of-range) in a contiguous range.
  6717.  
  6718.    usLastPort  Specifies either a single port or the ending port number
  6719.    (end-of-range) in a contiguous range. If only one port is being used, the
  6720.    usFirstPort and usLastPort parameters must be the same.
  6721.  
  6722.  Return Value
  6723.  
  6724.    The return value is zero if the function is successful. Otherwise, it is
  6725.    an error value.
  6726.  
  6727.  Comments
  6728.  
  6729.    Programs that perform input or output (I/O) to a port, or ports, in IOPL
  6730.    segments must request port access from the operating system.
  6731.  
  6732.    Granting port access automatically grants cli and sti privileges from the
  6733.    operating system. Therefore, there is no need to make an additional call
  6734.    to the DosCLIAccess function.
  6735.  
  6736.  See Also
  6737.  
  6738.    DosCLIAccess
  6739.  
  6740.  
  6741.  ────────────────────────────────────────────────────────────────────────────
  6742.  DosPTrace
  6743.  ────────────────────────────────────────────────────────────────────────────
  6744.    USHORT DosPTrace (pvPtraceBuf)
  6745.    PVOID pvPtraceBuf;      /*pointer to structure receiving register       */
  6746.                            /*values                                        */
  6747.  
  6748.    The DosPTrace function provides access to the MS OS/2 debugging functions.
  6749.    These debugging functions are available to any process that starts a
  6750.    protected-mode child process by using the DosExecPgm function with the
  6751.    fExecFlags parameter set to EXEC_TRACE.
  6752.  
  6753.  Parameters
  6754.  
  6755.    pvPtraceBuf  Points to the PTRACEBUF structure that receives the current
  6756.    values of the child process's registers and a code that indicates the
  6757.    reason for returning. The PTRACEBUF structure has the following form:
  6758.  
  6759.    typedef struct PTRACEBUF {
  6760.        PID    pid;
  6761.        TID    tid;
  6762.        USHORT cmd;
  6763.        USHORT value;
  6764.        USHORT offv;
  6765.        USHORT segv;
  6766.        USHORT mte;
  6767.        USHORT rAX;
  6768.        USHORT rBX;
  6769.        USHORT rCX;
  6770.        USHORT rDX;
  6771.        USHORT rSI;
  6772.        USHORT rDI;
  6773.        USHORT rBP;
  6774.        USHORT rDS;
  6775.        USHORT rES;
  6776.        USHORT rIP;
  6777.        USHORT rCS;
  6778.        USHORT rF;
  6779.        USHORT rSP;
  6780.        USHORT rSS;
  6781.    } PTRACEBUF;
  6782.  
  6783.    For a full description, see Chapter 4, "Types, Macros, Structures."
  6784.  
  6785.  Return Value
  6786.  
  6787.    The return value is zero if the function is successful. Otherwise, it is
  6788.    an error value, which may be one of the following:
  6789.  
  6790.          ERROR_ACCESS_DENIED
  6791.          ERROR_INVALID_FUNCTION
  6792.          ERROR_INVALID_PROCID
  6793.  
  6794.  Comments
  6795.  
  6796.    To use the DosPTrace function, you need to provide the following function
  6797.    prototype in your source file:
  6798.  
  6799.          USHORT DosPTrace(PVOID);
  6800.  
  6801.    The DosPTrace function lets a parent process control the execution of the
  6802.    child process and access the child process's memory directly to insert
  6803.    break points or change data.
  6804.  
  6805.    The parent process starts the child process to be debugged, then stops the
  6806.    child process by using the DosPTrace function with the cmd field of the
  6807.    PTRACEBUF structure set to 0x000A. The parent process can then insert
  6808.    break points or change memory in the child process by using DosPTrace and
  6809.    the cmd field values. Next, the parent process can start execution by
  6810.    setting the cmd field to 0x0007 (go until break point) or 0x0009 (single
  6811.    step). The parent process can set initial register values by setting cmd
  6812.    to 0x0006. After it is started, the child process returns control to the
  6813.    parent process if it encounters a break point, a non-maskable interrupt, a
  6814.    single-step interrupt, or the end of the program.
  6815.  
  6816.    The DosPTrace function can be used to debug a process with multiple
  6817.    threads by setting the tid field of the PTRACEBUF structure to the
  6818.    identifier of the thread to be debugged. Other threads in the process are
  6819.    suspended. (The address space is the same for all threads in a process.)
  6820.    Commands to read from or write to memory locations or set break points
  6821.    affect all threads in the process, even if the command is issued with a
  6822.    specific thread identifier. If the parent process uses the 0x000B command,
  6823.    a selected thread or group of threads can keep running while others are
  6824.    suspended. This allows only the selected threads to be affected by the
  6825.    break points and manipulated.
  6826.  
  6827.  See Also
  6828.  
  6829.    DosExecPgm, DosGetInfoSeg
  6830.  
  6831.  
  6832.  ────────────────────────────────────────────────────────────────────────────
  6833.  DosPurgeQueue
  6834.  ────────────────────────────────────────────────────────────────────────────
  6835.    USHORT DosPurgeQueue (hqueue)
  6836.    HQUEUE hqueue;          /*handle of queue to be purged                  */
  6837.  
  6838.    The DosPurgeQueue function purges a queue of all elements.
  6839.  
  6840.  Parameters
  6841.  
  6842.    hqueue  Identifies the queue to be purged. This handle must have been
  6843.    created previously by using the DosCreateQueue function.
  6844.  
  6845.  Return Value
  6846.  
  6847.    The return value is zero if the function is successful. Otherwise, it is
  6848.    an error value, which may be one of the following:
  6849.  
  6850.          ERROR_QUE_INVALID_HANDLE
  6851.          ERROR_QUE_PROC_NOT_OWNED
  6852.  
  6853.  Comments
  6854.  
  6855.    Only the process that created the queue may call the DosPurgeQueue
  6856.    function.
  6857.  
  6858.  See Also
  6859.  
  6860.    DosCreateQueue
  6861.  
  6862.  
  6863.  ────────────────────────────────────────────────────────────────────────────
  6864.  DosPutMessage
  6865.  ────────────────────────────────────────────────────────────────────────────
  6866.    USHORT DosPutMessage (hf, cbMsg, pchMsg)
  6867.    HFILE hf;               /*handle of output file/device                  */
  6868.    USHORT cbMsg;           /*length of message buffer                      */
  6869.    PCHAR pchMsg;           /*pointer to message buffer                     */
  6870.  
  6871.    The DosPutMessage function writes the message pointed to by the pchMsg
  6872.    parameter to the file identified by the hf parameter.
  6873.  
  6874.    The DosPutMessage function is a family API function.
  6875.  
  6876.  Parameters
  6877.  
  6878.    hf  Identifies the file that receives the message. This handle must have
  6879.    been created previously by using the DosOpen function. Standard file
  6880.    handles (such as 1 and 2) can also be used.
  6881.  
  6882.    cbMsg  Specifies the length (in bytes) of the message to output.
  6883.  
  6884.    pchMsg  Points to the message to output.
  6885.  
  6886.  Return Value
  6887.  
  6888.    The return value is zero if the function is successful. Otherwise, it is
  6889.    an error value, which may be one of the following:
  6890.  
  6891.          ERROR_INVALID_HANDLE
  6892.          ERROR_MR_UN_PERFORM
  6893.          ERROR_WRITE_PROTECT
  6894.  
  6895.  Comments
  6896.  
  6897.    The DosPutMessage function uses an 80-column screen width. If a word is
  6898.    about to span column 80, the function "wraps" the word to a new line at
  6899.    column 1. If the last character to be positioned on a line is a
  6900.    double-byte character that would be bisected, this rule ensures that the
  6901.    character is not bisected.
  6902.  
  6903.    When handling word wrapping, the DosPutMessage function uses column 1 as
  6904.    the starting position of the cursor.
  6905.  
  6906.  Restrictions
  6907.  
  6908.    In real mode, the following restriction applies to the DosPutMessage
  6909.    function:
  6910.  
  6911.    ■  There is no method of identifying the boot drive. The system assumes
  6912.       that the message file is in the root directory of the current drive.
  6913.  
  6914.  See Also
  6915.  
  6916.    DosGetMessage, DosInsMessage, DosOpen
  6917.  
  6918.  
  6919.  ────────────────────────────────────────────────────────────────────────────
  6920.  DosQAppType
  6921.  ────────────────────────────────────────────────────────────────────────────
  6922.    USHORT DosQAppType (pszPrgName, pusType)
  6923.    PSZ pszPrgName;         /*pointer to executable-file name               */
  6924.    PUSHORT pusType;        /*pointer to application-type flags             */
  6925.  
  6926.    The DosQAppType function retrieves the application type of an executable
  6927.    file. The application type is specified at link time in the
  6928.    module-definition file.
  6929.  
  6930.  Parameters
  6931.  
  6932.    pszPrgName  Points to the null-terminated string that contains the name of
  6933.    the executable file for which the flags are to be returned. If the string
  6934.    appears to be a fully qualified path (that is, it contains a colon in the
  6935.    second position and/or contains a backslash), the file will be searched
  6936.    for in the indicated directory on the indicated drive. If neither of these
  6937.    conditions is true and the file is not in the current directory, each
  6938.    drive and directory specification in the path defined in the current
  6939.    program's environment will be searched. The default extension for an
  6940.    executable file is .exe, although any extension is acceptable.
  6941.  
  6942.    pusType  Points to a word containing flags that specify the application
  6943.    type, as determined from the header of the executable file specified by
  6944.    the pszPrgName parameter. Upon return, the variable pointed to by the
  6945.    pusType parameter will have one or more of the following flags set:
  6946.  
  6947.    Value               Meaning
  6948.    ──────────────────────────────────────────────────────────────────────────
  6949.    BOUND               Application has been "bound" and can run either in
  6950.                        protected mode or with MS-DOS (either the
  6951.                        compatibility box or MS-DOS, version 3.x).
  6952.  
  6953.    DOSFORMAT           Application will only run with MS-DOS.
  6954.  
  6955.    DYNAMICLINK         Application is a dynamic-link module.
  6956.  
  6957.    NOTSPECIFIED        Application type is not specified in executable
  6958.                        header.
  6959.  
  6960.    NOTWINDOCOMPAT      Application will run only in a full screen session.
  6961.  
  6962.    WINDOWAPI           Application runs as a Presentation Manager window.
  6963.  
  6964.    WINDOWCOMPAT        Application will run in a VIO window.
  6965.    ──────────────────────────────────────────────────────────────────────────
  6966.  
  6967.  Return Value
  6968.  
  6969.    The return value is zero if the function is successful. Otherwise, it is
  6970.    one of the following values:
  6971.  
  6972.          ERROR_BAD_FORMAT
  6973.          ERROR_DRIVE_LOCKED
  6974.          ERROR_EXE_MARKED_INVALID
  6975.          ERROR_FILE_NOT_FOUND
  6976.          ERROR_INVALID_EXE_SIGNATURE
  6977.          ERROR_TOO_MANY_OPEN_FILES
  6978.  
  6979.  
  6980.  ────────────────────────────────────────────────────────────────────────────
  6981.  DosQCurDir
  6982.  ────────────────────────────────────────────────────────────────────────────
  6983.    USHORT DosQCurDir (usDriveNumber, pszPathBuf, pcbPathBuf)
  6984.    USHORT usDriveNumber;   /*drive number                                  */
  6985.    PBYTE pszPathBuf;       /*pointer to buffer receiving directory path    */
  6986.    PUSHORT pcbPathBuf;     /*pointer to variable receiving length of path  */
  6987.  
  6988.    The DosQCurDir function retrieves the path of the current directory on the
  6989.    specified drive. DosQCurDir copies a null-terminated string identifying
  6990.    the current directory to the buffer pointed to by the pszPathBuf
  6991.    parameter. The string consists of one or more directory names separated by
  6992.    backslashes (\). The drive letter is not part of the returned string.
  6993.  
  6994.    The DosQCurDir function is a family API function.
  6995.  
  6996.  Parameters
  6997.  
  6998.    usDriveNumber  Specifies the drive number. The default drive is 0, drive A
  6999.    is 1, drive B is 2, and so on.
  7000.  
  7001.    pszPathBuf  Points to a buffer that receives the path of the current
  7002.    directory. The path of the current directory is copied to this buffer only
  7003.    if the buffer is large enough to contain the complete directory.
  7004.  
  7005.    pcbPathBuf  Points to the variable that contains the size (in bytes) of
  7006.    the pszPathBuf buffer. If the buffer is too small to contain the current
  7007.    path, the error value ERROR_BUFFER_OVERFLOW is returned and this variable
  7008.    receives the size of the buffer required to contain the complete pathname.
  7009.  
  7010.  Return Value
  7011.  
  7012.    The return value is zero if the function is successful. Otherwise, it is
  7013.    an error value, which may be one of the following:
  7014.  
  7015.          ERROR_BUFFER_OVERFLOW
  7016.          ERROR_DRIVE_LOCKED
  7017.          ERROR_INVALID_DRIVE
  7018.          ERROR_NOT_DOS_DISK
  7019.          ERROR_NOT_READY
  7020.  
  7021.  Example
  7022.  
  7023.    This example calls the DosQCurDisk function to retrieve the current drive
  7024.    number, sets the buffer length to zero, and calls DosQCurDir. Since the
  7025.    buffer is too small to contain a path of any size, DosQCurDir returns the
  7026.    size needed in the cbPath variable. The DosAllocSeg function is called to
  7027.    allocate the memory needed for the buffer, and DosQCurDir is called again
  7028.    to retrieve the path name. This method of setting the buffer length will
  7029.    be successful in any version of MS OS/2, including future versions, in
  7030.    which the maximum path length may be longer.
  7031.  
  7032.    PSZ pszPath;
  7033.    USHORT cbPath, usDisk;
  7034.    ULONG ulDrives;
  7035.    SEL selPath;
  7036.  
  7037.    cbPath = 0;
  7038.    DosQCurDisk(&usDisk, &ulDrives);     /* gets current drive          */
  7039.  
  7040.    /* First call DosQCurDir to find out the size of the buffer needed. */
  7041.  
  7042.    DosQCurDir(usDisk, NULL, &cbPath);
  7043.    DosAllocSeg(cbPath, &selPath, SEG_NONSHARED);   /* allocates memory */
  7044.    pszPath = MAKEP(selPath, 0);         /* assigns it to a far pointer */
  7045.    DosQCurDir(usDisk,                   /* drive number                */
  7046.        pszPath,                         /* buffer for directory path   */
  7047.        &cbPath);                        /* length of directory buffer  */
  7048.  
  7049.  See Also
  7050.  
  7051.    DosChDir, DosQCurDisk, DosSelectDisk
  7052.  
  7053.  
  7054.  ────────────────────────────────────────────────────────────────────────────
  7055.  DosQCurDisk
  7056.  ────────────────────────────────────────────────────────────────────────────
  7057.    USHORT DosQCurDisk (pusDriveNumber, pulLogicalDrives)
  7058.    PUSHORT pusDriveNumber; /*pointer to variable receiving drive number    */
  7059.    PULONG pulLogicalDrives;
  7060.                            /*pointer to variable receiving drive map       */
  7061.  
  7062.    The DosQCurDisk function retrieves the current drive number and a map of
  7063.    the logical drives.
  7064.  
  7065.    The DosQCurDisk function is a family API function.
  7066.  
  7067.  Parameters
  7068.  
  7069.    pusDriveNumber  Points to the variable that receives the number of the
  7070.    default drive. For example, drive A is 1, drive B is 2, and so on.
  7071.  
  7072.    pulLogicalDrives  Points to the variable that receives the map of the
  7073.    logical drive.
  7074.  
  7075.  Return Value
  7076.  
  7077.    The return value is zero if the function is successful. Otherwise, it is
  7078.    an error value.
  7079.  
  7080.  Comments
  7081.  
  7082.    The current drive number identifies the disk drive to be searched for a
  7083.    given file if no explicit drive name is given when the filename is
  7084.    specified. The current drive number is used by functions such as DosOpen
  7085.    and DosFindFirst. Each process has its own current drive and may change
  7086.    this drive, by using the DosChDir function, without affecting other
  7087.    processes. The default current drive for a process is the drive on which
  7088.    the process is called.
  7089.  
  7090.    The map of the logical drives identifies which of the 26 possible disk
  7091.    drives exist. The map is a 32-bit value in which each bit of the low-order
  7092.    26 bits represents a single drive. For example, bit 0 represents drive A,
  7093.    bit 1 represents drive B, and so on. If a bit is set to 1, the drive
  7094.    exists; if it is cleared to 0, the drive does not exist.
  7095.  
  7096.  Example
  7097.  
  7098.    This example calls the DosQCurDisk function to determine the current
  7099.    default drive and how many logical drives exist. The example then displays
  7100.    the letter of every logical drive after checking whether its bit is set in
  7101.    the ulDrives variable.
  7102.  
  7103.    CHAR chDrives;
  7104.    USHORT usDisk;
  7105.    ULONG ulDrives;
  7106.    DosQCurDisk(&usDisk, &ulDrives);        /* gets current drive        */
  7107.    for (chDrives = 'A'; chDrives <= 'Z'; chDrives++) {
  7108.        if (ulDrives & 1)                   /* if the drive bit is set,  */
  7109.            VioWrtTTY(&chDrives, 1, 0);     /* displays the drive letter */
  7110.        ulDrives >>= 1;
  7111.    }
  7112.  
  7113.  See Also
  7114.  
  7115.    DosChDir, DosFindFirst, DosOpen, DosQCurDir, DosSelectDisk
  7116.  
  7117.  
  7118.  ────────────────────────────────────────────────────────────────────────────
  7119.  DosQFHandState
  7120.  ────────────────────────────────────────────────────────────────────────────
  7121.    USHORT DosQFHandState (hf, pfsOpenMode)
  7122.    HFILE hf;               /*file handle                                   */
  7123.    PUSHORT pfsOpenMode;    /*pointer to variable for file-handle state     */
  7124.  
  7125.    The DosQFHandState function retrieves the state of the specified file
  7126.    handle. The file-handle state indicates whether the file may be read from
  7127.    or written to and whether it may be opened for reading or writing by other
  7128.    processes.
  7129.  
  7130.    The DosQFHandState function is a family API function.
  7131.  
  7132.  Parameters
  7133.  
  7134.    hf  Identifies the file whose file-handle state is to be retrieved. This
  7135.    handle must have been previously created by using the DosOpen function.
  7136.  
  7137.    pfsOpenMode  Points to the variable that receives the file-handle state.
  7138.    The file-handle state consists of one access mode, one share mode, and
  7139.    optional flags. It is identical to the values specified in the fsOpenMode
  7140.    parameter of the DosOpen function. Which values are set can be determined
  7141.    by using the AND operator to combine the value returned in the pfsOpenMode
  7142.    parameter with one or more of the following values:
  7143.  
  7144. ╓┌─┌─────────────────────────────┌───────────────────────────────────────────╖
  7145.    Value                         Meaning
  7146.    ──────────────────────────────────────────────────────────────────────────
  7147.    OPEN_ACCESS_READONLY          Data may be read from the file but not
  7148.                                  written to it.
  7149.  
  7150.    OPEN_ACCESS_READWRITE         Data may be read from or written to the
  7151.                                  file.
  7152.  
  7153.    OPEN_ACCESS_WRITEONLY         Data may be written to the file but not read
  7154.                                  from it.
  7155.  
  7156.    OPEN_SHARE_DENYNONE           Other processes can open the file for any
  7157.                                  access: read-only, write-only, or
  7158.                                  read-write.
  7159.  
  7160.    OPEN_SHARE_DENYREAD           Other processes can open the file for
  7161.                                  write-only access but they cannot open it
  7162.                                  for read-only or read-write access.
  7163.    Value                         Meaning
  7164.    ──────────────────────────────────────────────────────────────────────────
  7165.                                 for read-only or read-write access.
  7166.  
  7167.    OPEN_SHARE_DENYREADWRITE      The current process has exclusive access to
  7168.                                  the file.
  7169.  
  7170.    OPEN_SHARE_DENYWRITE          Other processes can open the file for
  7171.                                  read-only access but they cannot open it for
  7172.                                  write-only or read-write access.
  7173.  
  7174.    OPEN_FLAGS_DASD               The file handle represents a physical drive
  7175.                                  that has been opened for direct access.
  7176.  
  7177.    OPEN_FLAGS_FAIL_ON_ERROR      Any function that uses the file handle
  7178.                                  returns immediately with an error code if
  7179.                                  there is an I/O error.
  7180.  
  7181.    OPEN_FLAGS_NOINHERIT          The file handle is private to the current
  7182.                                  process.
  7183.  
  7184.    Value                         Meaning
  7185.    ──────────────────────────────────────────────────────────────────────────
  7186. 
  7187.    OPEN_FLAGS_WRITE_THROUGH      The system writes data to the device before
  7188.                                  the given function returns.
  7189.    ──────────────────────────────────────────────────────────────────────────
  7190.  
  7191.  
  7192.  Return Value
  7193.  
  7194.    The return value is zero if the function is successful. Otherwise, it is
  7195.    an error value, which may be the following:
  7196.  
  7197.          ERROR_INVALID_HANDLE
  7198.  
  7199.  Example
  7200.  
  7201.    This example calls the DosQFHandState function using the handle of a
  7202.    previously opened file, and then checks the fsOpenMode variable and
  7203.    reports if the file is opened for read/write access:
  7204.  
  7205.    HFILE hf;
  7206.    USHORT fsOpenMode;
  7207.        .
  7208.        .
  7209.        .
  7210.    DosQFHandState(hf, &fsOpenMode);
  7211.    if (fsOpenMode & OPEN_ACCESS_READWRITE)
  7212.        VioWrtTTY("File opened for read/write access\r\n", 35, 0);
  7213.    if (fsOpenMode & OPEN_SHARE_DENYREADWRITE)
  7214.        VioWrtTTY("File cannot be shared\r\n", 23, 0);
  7215.  
  7216.  See Also
  7217.  
  7218.    DosDevIOCtl, DosExecPgm, DosOpen, DosSetFHandState
  7219.  
  7220.  
  7221.  ────────────────────────────────────────────────────────────────────────────
  7222.  DosQFileInfo
  7223.  ────────────────────────────────────────────────────────────────────────────
  7224.    USHORT DosQFileInfo (hf, usInfoLevel, pfstsInfo, cbInfoBuf)
  7225.    HFILE hf;               /*handle of file about which data sought        */
  7226.    USHORT usInfoLevel;     /*level of file data required                   */
  7227.    PFILESTATUS pfstsInfo;  /*pointer to file-data buffer                   */
  7228.    USHORT cbInfoBuf;       /*length of file-data buffer                    */
  7229.  
  7230.    The DosQFileInfo function retrieves information about a specific file. The
  7231.    file information consists of the date and time the file was created, the
  7232.    date and time it was last accessed, the date and time it was last written
  7233.    to, the size of the file, and its attributes.
  7234.  
  7235.    The file information is based on the most recent call to the DosClose or
  7236.    DosBufReset function.
  7237.  
  7238.    The DosQFileInfo function is a family API function.
  7239.  
  7240.  Parameters
  7241.  
  7242.    hf  Identifies the file about which information is to be retrieved. This
  7243.    handle must have been created previously by using the DosOpen function.
  7244.  
  7245.    usInfoLevel  Specifies the level of file information required. In MS OS/2,
  7246.    version 1.1, this value must be 0x0001.
  7247.  
  7248.    pfstsInfo  Points to the structure that receives the file information. The
  7249.    FILESTATUS structure has the following form:
  7250.  
  7251.    typedef struct _FILESTATUS {
  7252.        FDATE  fdateCreation;
  7253.        FTIME  ftimeCreation;
  7254.        FDATE  fdateLastAccess;
  7255.        FTIME  ftimeLastAccess;
  7256.        FDATE  fdateLastWrite;
  7257.        FTIME  ftimeLastWrite;
  7258.        ULONG  cbFile;
  7259.        ULONG  cbFileAlloc;
  7260.        USHORT attrFile;
  7261.    } FILESTATUS;
  7262.  
  7263.    For a full description, see Chapter 4, "Types, Macros, Structures."
  7264.  
  7265.    cbInfoBuf  Specifies the length (in bytes) of the buffer that receives the
  7266.    file information.
  7267.  
  7268.  Return Value
  7269.  
  7270.    The return value is zero if the function is successful. Otherwise, it is
  7271.    an error value, which may be one of the following:
  7272.  
  7273.          ERROR_BUFFER_OVERFLOW
  7274.          ERROR_DIRECT_ACCESS_HANDLE
  7275.          ERROR_INVALID_HANDLE
  7276.          ERROR_INVALID_LEVEL
  7277.  
  7278.  Example
  7279.  
  7280.    This example opens the file abc, calls the DosQFileInfo function to
  7281.    retrieve the current allocated size, and then calls the DosNewSize
  7282.    function to increase the file's size by 1K:
  7283.  
  7284.    HFILE hf;
  7285.    USHORT usAction;
  7286.    FILESTATUS fstsFile;
  7287.    DosOpen("abc", &hf, &usAction, 0L, FILE_NORMAL,
  7288.        FILE_OPEN | FILE_CREATE,
  7289.        OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYNONE, 0L);
  7290.    DosQFileInfo(hf,                 /* file handle                 */
  7291.        1,                           /* level of information        */
  7292.        (PBYTE) &fstsFile,           /* address of file-data buffer */
  7293.        sizeof(fstsFile));           /* size of data buffer         */
  7294.    DosNewSize(hf, fstsFile.cbFileAlloc + 1024L);
  7295.  
  7296.  See Also
  7297.  
  7298.    DosBufReset, DosClose, DosOpen, DosQFileMode, DosSetFileInfo
  7299.  
  7300.  
  7301.  ────────────────────────────────────────────────────────────────────────────
  7302.  DosQFileMode
  7303.  ────────────────────────────────────────────────────────────────────────────
  7304.    USHORT DosQFileMode (pszFileName, pusAttribute, ulReserved)
  7305.    PSZ pszFileName;        /*pointer to filename                           */
  7306.    PUSHORT pusAttribute;   /*pointer to variable for file attributes       */
  7307.    ULONG ulReserved;       /*must be zero                                  */
  7308.  
  7309.    The DosQFileMode function retrieves the attributes (mode) of the specified
  7310.    file. The file attributes are set when the file is created and can be
  7311.    changed at any time by using the DosSetFileMode function.
  7312.  
  7313.    The DosQFileMode function is a family API function.
  7314.  
  7315.  Parameters
  7316.  
  7317.    pszFileName  Points to a null-terminated string that specifies the name of
  7318.    the file to be checked. The string must be a valid MS OS/2 filename.
  7319.  
  7320.    pusAttribute  Points to the variable that receives the file attributes. It
  7321.    can be one or more of the following values:
  7322.  
  7323.    Value             Meaning
  7324.    ──────────────────────────────────────────────────────────────────────────
  7325.    FILE_NORMAL       File can be read from and written to.
  7326.  
  7327.    FILE_READONLY     File can be read from but not written to.
  7328.  
  7329.    FILE_HIDDEN       File is hidden and does not appear in a directory
  7330.                      listing.
  7331.  
  7332.    FILE_SYSTEM       File is a system file.
  7333.  
  7334.    FILE_DIRECTORY    File is a subdirectory.
  7335.  
  7336.    FILE_ARCHIVED     File has been archived.
  7337.    ──────────────────────────────────────────────────────────────────────────
  7338.  
  7339.    ulReserved  Specifies a reserved value; must be zero.
  7340.  
  7341.  Return Value
  7342.  
  7343.    The return value is zero if the function is successful. Otherwise, it is
  7344.    an error value, which may be one of the following:
  7345.  
  7346.          ERROR_DRIVE_LOCKED
  7347.          ERROR_FILE_NOT_FOUND
  7348.          ERROR_NOT_DOS_DISK
  7349.          ERROR_PATH_NOT_FOUND
  7350.  
  7351.  Comments
  7352.  
  7353.    You cannot use the DosQFileMode function to retrieve the attributes of the
  7354.    volume label. The attributes of a volume label can be retrieved by using
  7355.    the DosQFSInfo function.
  7356.  
  7357.  Example
  7358.  
  7359.    This example calls the DosQFileMode function and displays a message if the
  7360.    filename abc is a subdirectory:
  7361.  
  7362.    USHORT usAttribute;
  7363.    DosQFileMode("abc",     /* filename                                 */
  7364.        &usAttribute,       /* address of variable for file's attribute */
  7365.        0L);                /* reserved                                 */
  7366.    if (usAttribute == FILE_DIRECTORY)
  7367.        VioWrtTTY("abc is a subdirectory\r\n", 23, 0);
  7368.  
  7369.  See Also
  7370.  
  7371.    DosQFHandState, DosQFSInfo, DosSetFileMode
  7372.  
  7373.  
  7374.  ────────────────────────────────────────────────────────────────────────────
  7375.  DosQFSInfo
  7376.  ────────────────────────────────────────────────────────────────────────────
  7377.    USHORT DosQFSInfo (usDriveNumber, usInfoLevel, pbInfo, cbInfo)
  7378.    USHORT usDriveNumber;   /*drive number                                  */
  7379.    USHORT usInfoLevel;     /*type of information                           */
  7380.    PBYTE pbInfo;           /*pointer to buffer for information             */
  7381.    USHORT cbInfo;          /*length of information buffer                  */
  7382.  
  7383.    The DosQFSInfo function retrieves file-system information from the disk in
  7384.    the specified drive. This file-system information defines characteristics
  7385.    of the disk, such as its size.
  7386.  
  7387.    There are two levels of file-system information. Level 1 file-system
  7388.    information specifies the number of sectors per allocation unit on the
  7389.    disk, the number of allocation units, the available allocation units, and
  7390.    the number of bytes per sector. Level 2 file-system information defines
  7391.    the volume label and the date and time at which the label was created.
  7392.  
  7393.    The DosQFSInfo function is a family API function.
  7394.  
  7395.  Parameters
  7396.  
  7397.    usDriveNumber  Specifies the logical drive number for the disk about which
  7398.    information is to be retrieved. This parameter can be any value from 0
  7399.    through 26. If this parameter is zero, information about the disk in the
  7400.    current drive is retrieved. Otherwise, 1 specifies drive A, 2 specifies
  7401.    drive B, and so on.
  7402.  
  7403.    usInfoLevel  Specifies the level of file information to be retrieved. In
  7404.    MS OS/2, version 1.1, this value can be 1 or 2.
  7405.  
  7406.    pbInfo  Points to the structure that receives the file-system information.
  7407.    For level 1 information, it points to an FSALLOCATE structure. For level
  7408.    2, it points to an FSINFO structure. An FSALLOCATE structure has the
  7409.    following form:
  7410.  
  7411.    typedef struct _FSALLOCATE {
  7412.        ULONG  idFileSystem;
  7413.        ULONG  cSectorUnit;
  7414.        ULONG  cUnit;
  7415.        ULONG  cUnitAvail;
  7416.        USHORT cbSector;
  7417.    } FSALLOCATE;
  7418.  
  7419.    An FSINFO structure has the following form:
  7420.  
  7421.    typedef struct _FSINFO {
  7422.        FDATE fdateCreation;
  7423.        FTIME ftimeCreation;
  7424.        VOLUMELABEL vol;
  7425.    } FSINFO;
  7426.  
  7427.    For a full description, see Chapter 4, "Types, Macros, Structures."
  7428.  
  7429.    cbInfo  Specifies the length (in bytes) of the buffer that receives the
  7430.    file-system information.
  7431.  
  7432.  Return Value
  7433.  
  7434.    The return value is zero if the function is successful. Otherwise, it is
  7435.    an error value, which may be one of the following:
  7436.  
  7437.          ERROR_BUFFER_OVERFLOW
  7438.          ERROR_INVALID_DRIVE
  7439.          ERROR_INVALID_LEVEL
  7440.          ERROR_NO_VOLUME_LABEL
  7441.  
  7442.  Example
  7443.  
  7444.    This example calls the DosQFSInfo function and displays the volume label
  7445.    of drive C:
  7446.  
  7447.    FSINFO fsinf;
  7448.    DosQFSInfo(3,                  /* drive number (c:)              */
  7449.        2,                         /* level of information requested */
  7450.        (PBYTE) &fsinf,            /* address of buffer              */
  7451.        sizeof(FSInfoBuf));        /* size of buffer                 */
  7452.    VioWrtTTY(fsinf.vol.szVolLabel, fsinf.vol.cch, 0);
  7453.  
  7454.  See Also
  7455.  
  7456.    DosQFHandState, DosQFileMode, DosSetFSInfo
  7457.  
  7458.  
  7459.  ────────────────────────────────────────────────────────────────────────────
  7460.  DosQHandType
  7461.  ────────────────────────────────────────────────────────────────────────────
  7462.    USHORT DosQHandType (hf, pfsType, pusDeviceAttr)
  7463.    HFILE hf;               /*file handle                                   */
  7464.    PUSHORT pfsType;        /*pointer to variable for handle type           */
  7465.    PUSHORT pusDeviceAttr;  /*pointer to variable for device attribute      */
  7466.  
  7467.    The DosQHandType function retrieves information that specifies whether the
  7468.    given file handle identifies a file, device, or pipe.
  7469.  
  7470.  Parameters
  7471.  
  7472.    hf  Identifies the file. This handle must have been created previously by
  7473.    using the DosOpen function.
  7474.  
  7475.    pfsType  Specifies the type of file or device associated with the file
  7476.    handle. It can be one of the following:
  7477.  
  7478.    Value             Meaning
  7479.    ──────────────────────────────────────────────────────────────────────────
  7480.    HANDTYPE_DEVICE   The handle is to a device, such as a printer.
  7481.  
  7482.    HANDTYPE_FILE     The handle is to a file.
  7483.  
  7484.    HANDTYPE_PIPE     The handle is to a pipe.
  7485.    ──────────────────────────────────────────────────────────────────────────
  7486.  
  7487.    If the file or device is located on a network, this parameter is a
  7488.    combination of one of the values given above and the value
  7489.    HANDTYPE_NETWORK (0x8000).
  7490.  
  7491.    pusDeviceAttr  Points to the variable that receives the device-driver
  7492.    attribute word.
  7493.  
  7494.  Return Value
  7495.  
  7496.    The return value is zero if the function is successful. Otherwise, it is
  7497.    an error value, which may be the following:
  7498.  
  7499.          ERROR_INVALID_HANDLE
  7500.  
  7501.  Comments
  7502.  
  7503.    The DosQHandType function allows some interactive or file-oriented
  7504.    programs to determine the source of their input. For example, the cmd.exe
  7505.    program suppresses the system prompt if the input is from a disk file.
  7506.  
  7507.  Example
  7508.  
  7509.    This example calls the DosQHandType function to determine if standard
  7510.    output has been redirected to a file. The LOBYTE macro is an important
  7511.    part of this example; it allows the handle type to be determined even if
  7512.    the handle is to a file or device on a network:
  7513.  
  7514.    USHORT fsType, usDeviceAttr;
  7515.    DosQHandType(1,                         /* file handle      */
  7516.        &usHandType,                        /* type of handle   */
  7517.        &usDeviceAttr);                     /* device attribute */
  7518.    if (LOBYTE(fsType) == HANDTYPE_DEVICE)
  7519.        VioWrtTTY("stdout is a device\r\n", 20, 0);
  7520.    else if (LOBYTE(fsType) & HANDTYPE_FILE) {
  7521.        if (fsType & HANDTYPE_NETWORK)
  7522.            VioWrtTTY("stdout is a networked file\r\n", 28, 0);
  7523.        else
  7524.            VioWrtTTY("stdout is a local file\r\n", 24, 0);
  7525.    }
  7526.  
  7527.  See Also
  7528.  
  7529.    DosOpen, DosQFHandState
  7530.  
  7531.  
  7532.  ────────────────────────────────────────────────────────────────────────────
  7533.  DosQNmPHandState
  7534.  ────────────────────────────────────────────────────────────────────────────
  7535.    USHORT DosQNmPHandState (hp, pfsState)
  7536.    HPIPE hp;               /*pipe handle                                   */
  7537.    PUSHORT pfsState;       /*pointer to variable receiving handle state    */
  7538.  
  7539.    The DosQNmPHandState function retrieves information about the state of a
  7540.    specified pipe handle.
  7541.  
  7542.  Parameters
  7543.  
  7544.    hp  Identifies the pipe to read from.
  7545.  
  7546.    pfsState  Points to the variable that receives the handle state. This
  7547.    parameter is a combination of an instance count, a read-mode flag, a type
  7548.    flag, an end-point flag, and a wait flag. The possible values are:
  7549.  
  7550. ╓┌─┌───────────────────────────┌─────────────────────────────────────────────╖
  7551.    Value                       Meaning
  7552.    ──────────────────────────────────────────────────────────────────────────
  7553.    PIPE_END_CLIENT             The handle is the client end of a named pipe.
  7554.  
  7555.    PIPE_END_SERVER             The handle is the server end of a named pipe.
  7556.  
  7557.    PIPE_NOWAIT                 Reading from the pipe returns immediately if
  7558.                                no data is available. If this flag is not set,
  7559.                                reading from the pipe waits until data is
  7560.                                available.
  7561.  
  7562.    Value                       Meaning
  7563.    ──────────────────────────────────────────────────────────────────────────
  7564. 
  7565.    PIPE_READMODE_MESSAGE       Read the pipe as a message stream. If this
  7566.                                flag is not set, the pipe is read as a byte
  7567.                                stream.
  7568.  
  7569.    PIPE_TYPE_MESSAGE           The pipe is a message-stream pipe. If this
  7570.                                flag is not set, the pipe is a byte-stream
  7571.                                pipe.
  7572.  
  7573.    PIPE_UNLIMITED_INSTANCES    Unlimited instances of the pipe can be
  7574.                                created. If this flag is not specified, a
  7575.                                value from 1 through 254 can be used for the
  7576.                                number of instances.
  7577.    ──────────────────────────────────────────────────────────────────────────
  7578.  
  7579.  
  7580.  Return Value
  7581.  
  7582.    The return value is zero if the function is successful. Otherwise, it is
  7583.    an error value, which may be one of the following:
  7584.  
  7585.          ERROR_BAD_PIPE
  7586.          ERROR_PIPE_NOT_CONNECTED
  7587.  
  7588.  Comments
  7589.  
  7590.    If the handle is the server end of the pipe, the handle-state values are
  7591.    identical to those set by the call to the DosMakeNmPipe function that
  7592.    created the pipe. If the handle is the client end of the pipe, the
  7593.    handle-state values are determined by the DosOpen function that opened the
  7594.    pipe or are set by the DosSetNmPHandState function.
  7595.  
  7596.  See Also
  7597.  
  7598.    DosMakeNmPipe, DosOpen, DosSetNmPHandState
  7599.  
  7600.  
  7601.  ────────────────────────────────────────────────────────────────────────────
  7602.  DosQNmPipeInfo
  7603.  ────────────────────────────────────────────────────────────────────────────
  7604.    USHORT DosQNmPipeInfo (hp, usInfoLevel, pbBuf, cbBuf)
  7605.    HPIPE hp;               /*pipe handle                                   */
  7606.    USHORT usInfoLevel;     /*level of information to retrieve              */
  7607.    PBYTE pbBuf;            /*pointer to buffer receiving information       */
  7608.    USHORT cbBuf;           /*number of bytes in buffer                     */
  7609.  
  7610.    The DosQNmPipeInfo function retrieves information about a named pipe.
  7611.  
  7612.  Parameters
  7613.  
  7614.    hp  Identifies the pipe to read from.
  7615.  
  7616.    usInfoLevel  Specifies the level of information to retrieve. Level 1 is
  7617.    miscellaneous information about the pipe. Level 2 identifies the pipe's
  7618.    clients.
  7619.  
  7620.    pbBuf  Points to the buffer that receives the information. For level-2
  7621.    information, the buffer will contain a unique 2-byte identifier of the
  7622.    client. For level-1 information, the data is stored in the PIPEINFO
  7623.    structure, which has the following form:
  7624.  
  7625.    typedef struct _PIPEINFO {
  7626.        USHORT cbOut;
  7627.        USHORT cbIn;
  7628.        BYTE   cbMaxInst;
  7629.        BYTE   cbCurInst;
  7630.        BYTE   cbName;
  7631.        CHAR   szName[1];
  7632.    } PIPEINFO;
  7633.  
  7634.    For more information, see Chapter 4, "Types, Macros, Structures."
  7635.  
  7636.    cbBuf  Specifies the size (in bytes) of the buffer receiving the
  7637.    information.
  7638.  
  7639.  Return Value
  7640.  
  7641.    The return value is zero if the function is successful. Otherwise, it is
  7642.    an error value, which may be one of the following:
  7643.  
  7644.          ERROR_BAD_PIPE
  7645.          ERROR_BUFFER_OVERFLOW
  7646.          ERROR_INVALID_LEVEL
  7647.          ERROR_INVALID_PARAMETER
  7648.          ERROR_PIPE_NOT_CONNECTED
  7649.  
  7650.  See Also
  7651.  
  7652.    DosQNmPHandState, DosQNmPipeSemState
  7653.  
  7654.  
  7655.  ────────────────────────────────────────────────────────────────────────────
  7656.  DosQNmPipeSemState
  7657.  ────────────────────────────────────────────────────────────────────────────
  7658.    USHORT DosQNmPipeSemState (hsem, pbBuf, cbBuf)
  7659.    HSEM hsem;              /*semaphore handle                              */
  7660.    PBYTE pbBuf;            /*pointer to buffer receiving information       */
  7661.    USHORT cbBuf;           /*buffer size                                   */
  7662.  
  7663.    The DosQNmPipeSemState function returns information about all local named
  7664.    pipes that are in blocking mode and are associated with a specified system
  7665.    semaphore.
  7666.  
  7667.  Parameters
  7668.  
  7669.    hsem  Identifies the semaphore that is associated with the named pipe.
  7670.  
  7671.    pbBuf  Points to the buffer that receives the information.
  7672.  
  7673.    cbBuf  Specifies the length (in bytes) of the buffer that receives the
  7674.    information.
  7675.  
  7676.  Return Value
  7677.  
  7678.    The return value is zero if the function is successful. Otherwise, it is
  7679.    an error value, which may be one of the following:
  7680.  
  7681.          ERROR_INVALID_PARAMETER
  7682.          ERROR_SEM_NOT_FOUND
  7683.  
  7684.  See Also
  7685.  
  7686.    DosSetNmPipeSem
  7687.  
  7688.  
  7689.  ────────────────────────────────────────────────────────────────────────────
  7690.  DosQSysInfo
  7691.  ────────────────────────────────────────────────────────────────────────────
  7692.    USHORT DosQSysInfo (index, pbSysInfoBuf, cbSysInfoBuf)
  7693.    USHORT index;           /*index of value to look up                     */
  7694.    PBYTE pbSysInfoBuf;     /*pointer to buffer receiving information       */
  7695.    USHORT cbSysInfoBuf;    /*number of bytes in buffer receiving           */
  7696.                            /*information                                   */
  7697.  
  7698.    The DosQSysInfo function retrieves system-format information, such as
  7699.    maximum path length, that is constant for a particular release of MS OS/2.
  7700.  
  7701.  Parameters
  7702.  
  7703.    index  Specifies the index of the information to retrieve. In MS OS/2,
  7704.    version 1.1, the only available index is zero, which returns the maximum
  7705.    path length (including the trailing null character).
  7706.  
  7707.    pbSysInfoBuf  Points to the buffer that receives the system information.
  7708.    When the value of the index is zero, the DosQSysInfo function puts the
  7709.    maximum path length into the first two bytes of the buffer.
  7710.  
  7711.    cbSysInfoBuf  Specifies the length (in bytes) of the buffer to receive the
  7712.    system information.
  7713.  
  7714.  Return Value
  7715.  
  7716.    The return value is zero if the function is successful. Otherwise, it is
  7717.    an error value, which may be one of the following:
  7718.  
  7719.          ERROR_BUFFER_OVERFLOW
  7720.          ERROR_INVALID_PARAMETER
  7721.  
  7722.  See Also
  7723.  
  7724.    DosGetVersion
  7725.  
  7726.  
  7727.  ────────────────────────────────────────────────────────────────────────────
  7728.  DosQueryQueue
  7729.  ────────────────────────────────────────────────────────────────────────────
  7730.    USHORT DosQueryQueue (hqueue, pusElemCount)
  7731.    HQUEUE hqueue;          /*queue handle                                  */
  7732.    PUSHORT pusElemCount;   /*pointer to variable for element count         */
  7733.  
  7734.    The DosQueryQueue function retrieves a count of the number of elements in
  7735.    the given queue. Any process that has a queue open can call this function.
  7736.  
  7737.  Parameters
  7738.  
  7739.    hqueue  Identifies the queue about which information is sought. This
  7740.    handle must have been previously created or opened by using the
  7741.    DosCreateQueue or DosOpenQueue function.
  7742.  
  7743.    pusElemCount  Points to the variable that receives the count of elements
  7744.    in the queue.
  7745.  
  7746.  Return Value
  7747.  
  7748.    The return value is zero if the function is successful. Otherwise, it is
  7749.    an error value, which may be the following:
  7750.  
  7751.          ERROR_QUE_INVALID_HANDLE
  7752.  
  7753.  See Also
  7754.  
  7755.    DosCreateQueue, DosOpenQueue
  7756.  
  7757.  
  7758.  ────────────────────────────────────────────────────────────────────────────
  7759.  DosQVerify
  7760.  ────────────────────────────────────────────────────────────────────────────
  7761.    USHORT DosQVerify (pfVerifyOn)
  7762.    PBOOL pfVerifyOn;       /*verification-mode indicator                   */
  7763.  
  7764.    The DosQVerify function retrieves the verification mode. The verification
  7765.    mode specifies whether the system verifies the data each time it writes
  7766.    data to a disk.
  7767.  
  7768.    The DosQVerify function is a family API function.
  7769.  
  7770.  Parameters
  7771.  
  7772.    pfVerifyOn  Points to the variable that receives the verification mode.
  7773.    The pfVerifyOn parameter is set to TRUE if the system verifies the data.
  7774.    Otherwise, it is set to FALSE.
  7775.  
  7776.  Return Value
  7777.  
  7778.    The return value is zero if the function is successful. Otherwise, it is
  7779.    an error value.
  7780.  
  7781.  Example
  7782.  
  7783.    This example calls the DosQVerify function to determine if write
  7784.    verification is active and then displays the result:
  7785.  
  7786.    BOOL fVerifyOn;
  7787.    DosQVerify(&fVerifyOn);
  7788.    if (fVerifyOn == TRUE)
  7789.        VioWrtTTY("Verify mode is active\r\n", 23, 0);
  7790.    else
  7791.        VioWrtTTY("Verify mode is not active\r\n", 27, 0);
  7792.  
  7793.  See Also
  7794.  
  7795.    DosSetVerify
  7796.  
  7797.  
  7798.  ────────────────────────────────────────────────────────────────────────────
  7799.  DosR2StackRealloc
  7800.  ────────────────────────────────────────────────────────────────────────────
  7801.    USHORT DosR2StackRealloc (usSize)
  7802.    USHORT usSize;          /*new size for stack                            */
  7803.  
  7804.    The DosR2StackRealloc function changes the size of a thread's ring-2
  7805.    stack. The function reallocates the stack as requested.
  7806.  
  7807.    This function cannot be used from ring 2.
  7808.  
  7809.  Parameters
  7810.  
  7811.    usSize  Specifies the size (in bytes) of the ring-2 stack. The new stack
  7812.    size cannot be less than the current stack size.
  7813.  
  7814.  Return Value
  7815.  
  7816.    The return value is zero if the function is successful. Otherwise, it is
  7817.    an error value.
  7818.  
  7819.  
  7820.  ────────────────────────────────────────────────────────────────────────────
  7821.  DosRead
  7822.  ────────────────────────────────────────────────────────────────────────────
  7823.    USHORT DosRead (hf, pvBuf, cbBuf, pcbBytesRead)
  7824.    HFILE hf;               /*file handle                                   */
  7825.    PVOID pvBuf;            /*pointer to buffer receiving data              */
  7826.    USHORT cbBuf;           /*number of bytes in buffer                     */
  7827.    PUSHORT pcbBytesRead;   /*pointer to variable for number of bytes read  */
  7828.  
  7829.    The DosRead function reads up to a specified number of bytes of data from
  7830.    a file into a buffer. The function may read fewer than the specified
  7831.    number of bytes if it reaches the end of the file.
  7832.  
  7833.    The DosRead function is a family API function.
  7834.  
  7835.  Parameters
  7836.  
  7837.    hf  Identifies the file to be read. This handle must have been created
  7838.    previously by using the DosOpen function.
  7839.  
  7840.    pvBuf  Points to the buffer that receives the data.
  7841.  
  7842.    cbBuf  Specifies the number of bytes to read from the file.
  7843.  
  7844.    pcbBytesRead  Points to the variable that receives the number of bytes
  7845.    read from the file. This parameter is zero if the file pointer is
  7846.    positioned at the end of the file prior to the call to the DosRead
  7847.    function.
  7848.  
  7849.  Return Value
  7850.  
  7851.    The return value is zero if the function is successful. Otherwise, it is
  7852.    an error value, which may be one of the following:
  7853.  
  7854.          ERROR_ACCESS_DENIED
  7855.          ERROR_BROKEN_PIPE
  7856.          ERROR_INVALID_HANDLE
  7857.          ERROR_LOCK_VIOLATION
  7858.          ERROR_NOT_DOS_DISK
  7859.  
  7860.  Comments
  7861.  
  7862.    The DosRead function does not return an error if the file pointer is at
  7863.    the end of the file when the read operation begins.
  7864.  
  7865.  Example
  7866.  
  7867.    This example opens, reads, and displays the file abc:
  7868.  
  7869.    BYTE abBuf[512];
  7870.    HFILE hf;
  7871.    USHORT usAction, cbBytesRead, cbBytesWritten;
  7872.    DosOpen("abc", &hf, &usAction, 0L, FILE_NORMAL, FILE_OPEN,
  7873.        OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, 0L);
  7874.    do {
  7875.        DosRead(hf,         /* file handle                      */
  7876.            abBuf,          /* address of buffer                */
  7877.            sizeof(abBuf),  /* size of buffer                   */
  7878.            &cbBytesRead);  /* address for number of bytes read */
  7879.        DosWrite(1, abBuf, cbBytesRead, &cbBytesWritten);
  7880.    }
  7881.    while (cbBytesRead);
  7882.  
  7883.  See Also
  7884.  
  7885.    DosChgFilePtr, DosOpen, DosReadAsync, DosWrite, KbdStringIn
  7886.  
  7887.  
  7888.  ────────────────────────────────────────────────────────────────────────────
  7889.  DosReadAsync
  7890.  ────────────────────────────────────────────────────────────────────────────
  7891.    USHORT DosReadAsync (hf, hsemRam, pusErrCode, pvBuf, cbBuf, pcbBytesRead)
  7892.    HFILE hf;               /*file handle                                   */
  7893.    PULONG hsemRam;         /*pointer to RAM semaphore                      */
  7894.    PUSHORT pusErrCode;     /*pointer to variable for error return code     */
  7895.    PVOID pvBuf;            /*pointer to input buffer                       */
  7896.    USHORT cbBuf;           /*length of input buffer                        */
  7897.    PUSHORT pcbBytesRead;   /*pointer to variable for number of bytes read  */
  7898.  
  7899.    The DosReadAsync function reads one or more bytes of data from the file
  7900.    identified by the hf parameter. The function reads the data
  7901.    asynchronously; that is, the function returns immediately to the process
  7902.    that called it but continues to copy data to the specified buffer while
  7903.    the execution of the process continues.
  7904.  
  7905.  Parameters
  7906.  
  7907.    hf  Identifies the file to be read. This handle must have been previously
  7908.    opened by using the DosOpen function.
  7909.  
  7910.    hsemRam  Points to the RAM semaphore that indicates when the function has
  7911.    finished reading the data.
  7912.  
  7913.    pusErrCode  Points to the variable that receives any error code the
  7914.    function generates while reading data. The possible error codes are
  7915.    identical to those returned by the DosRead function.
  7916.  
  7917.    pvBuf  Points to the buffer that receives the data being read.
  7918.  
  7919.    cbBuf  Specifies the number of bytes to be read from the file identified
  7920.    by the hf parameter.
  7921.  
  7922.    pcbBytesRead  Points to the variable that receives the number of bytes
  7923.    read from the file.
  7924.  
  7925.  Return Value
  7926.  
  7927.    The return value is zero if the function is successful. Otherwise, it is
  7928.    an error value, which may be one of the following:
  7929.  
  7930.          ERROR_ACCESS_DENIED
  7931.          ERROR_BROKEN_PIPE
  7932.          ERROR_INVALID_HANDLE
  7933.          ERROR_LOCK_VIOLATION
  7934.          ERROR_NO_PROC_SLOTS
  7935.          ERROR_NOT_DOS_DISK
  7936.  
  7937.  Comments
  7938.  
  7939.    The DosReadAsync function reads up to the number of bytes specified in the
  7940.    cbBuf parameter, but it may read fewer if it reaches the end of the file.
  7941.    In any case, the function copies the number of bytes read to the variable
  7942.    pointed to by the pcbBytesRead parameter. The pcbBytesRead parameter is
  7943.    zero if all the bytes in the file have been read (that is, the end of file
  7944.    has been reached).
  7945.  
  7946.    If the process intends to use the RAM semaphore pointed to by the hsemRam
  7947.    parameter to determine when data is available, it must set the semaphore
  7948.    by using the DosSemSet function before calling DosReadAsync. When
  7949.    DosReadAsync has read the data, it clears the RAM semaphore.
  7950.  
  7951.    The DosReadAsync function carries out the asynchronous operation by
  7952.    creating a new thread that reads from the specified file. The function
  7953.    terminates the thread when the operation is complete or when an error
  7954.    occurs.
  7955.  
  7956.  Example
  7957.  
  7958.    This example opens the file abc, sets a RAM semaphore, and calls the
  7959.    DosReadAsync function to read part of the file. While the file is being
  7960.    read, program execution continues until the call to the DosSemWait
  7961.    function, which does not return until the DosReadAsync thread completes
  7962.    its work.
  7963.  
  7964.    BYTE abBuf[512];
  7965.    ULONG hReadSemaphore = 0;
  7966.    HFILE hf;
  7967.    USHORT usAction, cbBytesRead;
  7968.    USHORT usReadReturn;
  7969.    DosOpen("abc", &hf, &usAction, 0L, FILE_NORMAL, FILE_OPEN,
  7970.        OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, 0L);
  7971.    DosSemSet(&hReadSemaphore);     /* sets RAM semaphore           */
  7972.    DosReadAsync(hf,                /* handle to file               */
  7973.        &hReadSemaphore,            /* address of semaphore         */
  7974.        &usReadReturn,              /* address to store return code */
  7975.        abBuf,                      /* address of buffer            */
  7976.        sizeof(abBuf),              /* size of buffer               */
  7977.        &cbBytesRead);              /* number of bytes read         */
  7978.        .
  7979.        . /* other processing takes place here */
  7980.        .
  7981.    DosSemWait(&hReadSemaphore, -1L);
  7982.  
  7983.  See Also
  7984.  
  7985.    DosOpen, DosRead, DosSemSet, DosSemWait, DosWriteAsync
  7986.  
  7987.  
  7988.  ────────────────────────────────────────────────────────────────────────────
  7989.  DosReadQueue
  7990.  ────────────────────────────────────────────────────────────────────────────
  7991.    USHORT DosReadQueue (hqueue, pqresc, pcbElement, ppv, usElement, fWait,
  7992.    pbElemPrty, hsem)
  7993.    HQUEUE hqueue;          /*handle of queue to read                       */
  7994.    PQUEUERESULT pqresc;    /*pointer to structure for PID and request code */
  7995.    PUSHORT pcbElement;     /*pointer to variable for length of element     */
  7996.    PVOID FAR * ppv;        /*pointer to buffer for element                 */
  7997.    USHORT usElement;       /*element number to read                        */
  7998.    UCHAR fWait;            /*wait/no wait indicator                        */
  7999.    PBYTE pbElemPrty;       /*pointer to variable for priority of element   */
  8000.    HSEM hsem;              /*semaphore handle                              */
  8001.  
  8002.    The DosReadQueue function retrieves an element from a queue and removes it
  8003.    from the queue. It copies the element to the buffer pointed to by the ppv
  8004.    parameter and fills the structure pointed to by the pqresc parameter with
  8005.    information about the element.
  8006.  
  8007.  Parameters
  8008.  
  8009.    hqueue  Identifies the queue to be read. This handle must have been
  8010.    previously created or opened by using the DosCreateQueue or DosOpenQueue
  8011.    function.
  8012.  
  8013.    pqresc  Points to the structure that receives information about the
  8014.    request. The QUEUERESULT structure has the following form:
  8015.  
  8016.    typedef struct _QUEUERESULT {
  8017.        PID pidProcess;
  8018.        USHORT usEventCode;
  8019.    } QUEUERESULT;
  8020.  
  8021.    For a full description, see Chapter 4, "Types, Macros, Structures."
  8022.  
  8023.    pcbElement  Points to the variable that receives the length in bytes of
  8024.    the element.
  8025.  
  8026.    ppv  Points to a pointer that receives the address of the element in the
  8027.    queue.
  8028.  
  8029.    usElement  Specifies where to look in the queue for the element. If the
  8030.    usElement parameter is 0x0000, the function looks at the beginning of the
  8031.    queue. Otherwise, the function assumes the value is an element identifier
  8032.    retrieved by using the DosPeekQueue function and looks for the specified
  8033.    element.
  8034.  
  8035.    fWait  Specifies whether to wait for an element to be placed in the queue,
  8036.    if the queue is empty. If the fWait parameter is DCWW_WAIT, the function
  8037.    waits until an element is available. If it is DCWW_NOWAIT, the function
  8038.    returns immediately with a code that indicates there are no entries in the
  8039.    queue.
  8040.  
  8041.    pbElemPrty  Points to a variable that receives the priority value
  8042.    specified when the element was added to the queue. This is a numeric value
  8043.    from 0 through 15; 15 is the highest priority.
  8044.  
  8045.    hsem  Identifies a semaphore. This value can be the handle of a system
  8046.    semaphore that has been previously created or opened by using the
  8047.    DosCreateSem or DosOpenSem function, or it can be the address of a RAM
  8048.    semaphore. This semaphore would typically be used in a call to the
  8049.    DosMuxSemWait function to wait until the queue has an element. If the
  8050.    fWait parameter is DCWW_WAIT, hsem is ignored.
  8051.  
  8052.  Return Value
  8053.  
  8054.    The return value is zero if the function is successful. Otherwise, it is
  8055.    an error value, which may be one of the following:
  8056.  
  8057.          ERROR_QUE_ELEMENT_NOT_EXIST
  8058.          ERROR_QUE_EMPTY
  8059.          ERROR_QUE_INVALID_HANDLE
  8060.          ERROR_QUE_INVALID_WAIT
  8061.          ERROR_QUE_PROC_NOT_OWNED
  8062.  
  8063.  Comments
  8064.  
  8065.    If the queue is empty, the DosReadQueue function either returns
  8066.    immediately or waits for an element to be written to the queue, depending
  8067.    on the value of the fWait parameter.
  8068.  
  8069.    Only the process that created the queue may call the DosReadQueue
  8070.    function.
  8071.  
  8072.  See Also
  8073.  
  8074.    DosCreateQueue, DosMuxSemWait, DosOpenQueue, DosPeekQueue,
  8075.    DosWriteQueue
  8076.  
  8077.  
  8078.  ────────────────────────────────────────────────────────────────────────────
  8079.  DosReallocHuge
  8080.  ────────────────────────────────────────────────────────────────────────────
  8081.    USHORT DosReallocHuge (usNumSeg, usPartialSeg, sel)
  8082.    USHORT usNumSeg;        /*number of 65, 536-byte segments               */
  8083.    USHORT usPartialSeg;    /*number of bytes in last segment               */
  8084.    SEL sel;                /*segment selector                              */
  8085.  
  8086.    The DosReallocHuge function reallocates a huge memory block. The function
  8087.    changes the size of the huge memory to the number of 65,536-byte segments
  8088.    specified by the usNumSeg parameter plus an additional segment of the size
  8089.    specified by the usPartialSeg parameter.
  8090.  
  8091.    The DosReallocHuge function is a family API function.
  8092.  
  8093.  Parameters
  8094.  
  8095.    usNumSeg  Specifies the number of 65,536-byte segments to allocate.
  8096.  
  8097.    usPartialSeg  Specifies the number of bytes in the last segment. This
  8098.    number can be any value from 0 through 65,535. If it is zero, no
  8099.    additional segment is allocated.
  8100.  
  8101.    sel  Specifies the selector for the huge memory block to be reallocated.
  8102.    The selector must have been created previously by using the DosAllocHuge
  8103.    function.
  8104.  
  8105.  Return Value
  8106.  
  8107.    The return value is zero if the function is successful. Otherwise, it is
  8108.    an error value, which may be one of the following:
  8109.  
  8110.          ERROR_INVALID_PARAMETER
  8111.          ERROR_NOT_ENOUGH_MEMORY
  8112.  
  8113.  Comments
  8114.  
  8115.    The DosReallocHuge function does not change the sharable and discardable
  8116.    attributes of the segments in the huge memory block. If it was originally
  8117.    a sharable or discardable block, it remains a sharable or discardable
  8118.    block. However, if DosReallocHuge reallocates a discardable block, it also
  8119.    locks the segments. The DosUnlockSeg function must be used to unlock the
  8120.    segments and permit discarding.
  8121.  
  8122.    The memory block cannot be reallocated for a size larger than the maximum
  8123.    specified by the usMaxNumSeg parameter in the original call to the
  8124.    DosAllocHuge function.
  8125.  
  8126.    Each segment in the huge memory block has a unique selector. The selectors
  8127.    are consecutive. The sel parameter specifies the value of the first
  8128.    selector; the remaining selectors can be computed by adding the selector
  8129.    offset to the first selector one or more times──that is, once for the
  8130.    second selector, twice for the third, and so on. The selector offset is a
  8131.    multiple of 2, as specified by the shift count retrieved by using the
  8132.    DosGetHugeShift function. For example, if the shift count is 2, the
  8133.    selector offset is 4 (1 << 2). If the selector offset is 4 and the first
  8134.    selector is 6, the second selector is 10, the third is 14, and so on.
  8135.  
  8136.  Restrictions
  8137.  
  8138.    In real mode, the following restriction applies to the DosReallocHuge
  8139.    function:
  8140.  
  8141.    ■  The usPartialSeg parameter is rounded up to the next paragraph
  8142.       (16-byte) value.
  8143.  
  8144.  See Also
  8145.  
  8146.    DosAllocHuge, DosFreeSeg, DosGetHugeShift, DosLockSeg, DosReallocSeg,
  8147.    DosUnlockSeg
  8148.  
  8149.  ────────────────────────────────────────────────────────────────────────────
  8150.  DosReallocSeg
  8151.  ────────────────────────────────────────────────────────────────────────────
  8152.    USHORT DosReallocSeg (usNewSize, sel)
  8153.    USHORT usNewSize;       /*new segment size                              */
  8154.    SEL sel;                /*segment selector                              */
  8155.  
  8156.    The DosReallocSeg function reallocates a segment. The function changes the
  8157.    size of the segment to the number of bytes specified in the usNewSize
  8158.    parameter.
  8159.  
  8160.    The DosReallocSeg function is a family API function.
  8161.  
  8162.  Parameters
  8163.  
  8164.    usNewSize  Specifies the new size (in bytes). The size can be any number
  8165.    from 0 through 65,535. If it is zero, the function allocates 65,536 bytes.
  8166.  
  8167.    sel  Specifies the selector of the segment to be reallocated. The selector
  8168.    must have been created previously by using the DosAllocSeg function.
  8169.  
  8170.  Return Value
  8171.  
  8172.    The return value is zero if the function is successful. Otherwise, it is
  8173.    an error value, which may be one of the following:
  8174.  
  8175.          ERROR_ACCESS_DENIED
  8176.          ERROR_NOT_ENOUGH_MEMORY
  8177.  
  8178.  Comments
  8179.  
  8180.    The DosReallocSeg function does not change the sharable and discardable
  8181.    attributes of the segment. If it was originally a sharable or discardable
  8182.    segment, it remains a sharable or discardable segment.
  8183.  
  8184.    However, if DosReallocSeg reallocates a discardable segment, it also locks
  8185.    the segment. You must use the DosUnlockSeg function to unlock the segment
  8186.    and permit discarding.
  8187.  
  8188.    The DosReallocSeg function cannot reallocate a shared segment to a size
  8189.    smaller than its original size.
  8190.  
  8191.  Restrictions
  8192.  
  8193.    In real mode, the following restriction applies to the DosReallocSeg
  8194.    function:
  8195.  
  8196.    ■  The usNewSize parameter is rounded up to the next paragraph (16-byte)
  8197.       value.
  8198.  
  8199.  See Also
  8200.  
  8201.    DosAllocSeg, DosFreeSeg, DosLockSeg, DosReallocHuge, DosUnlockSeg
  8202.  
  8203.  
  8204.  ────────────────────────────────────────────────────────────────────────────
  8205.  DosResumeThread
  8206.  ────────────────────────────────────────────────────────────────────────────
  8207.    USHORT DosResumeThread (tid)
  8208.    TID tid;                /*identifier of thread to be resumed            */
  8209.  
  8210.    The DosResumeThread function restarts a thread that was previously stopped
  8211.    by the DosSuspendThread function.
  8212.  
  8213.  Parameters
  8214.  
  8215.    tid  Specifies the thread identifier of the thread to be resumed. The
  8216.    thread must have been created previously by using the DosCreateThread
  8217.    function.
  8218.  
  8219.  Return Value
  8220.  
  8221.    The return value is zero if the function is successful. Otherwise, it is
  8222.    an error value, which may be the following:
  8223.  
  8224.          ERROR_INVALID_THREADID
  8225.  
  8226.  See Also
  8227.  
  8228.    DosCreateThread, DosSuspendThread
  8229.  
  8230.  
  8231.  ────────────────────────────────────────────────────────────────────────────
  8232.  DosRmDir
  8233.  ────────────────────────────────────────────────────────────────────────────
  8234.    USHORT DosRmDir (pszDirName, ulReserved)
  8235.    PSZ pszDirName;         /*directory name                                */
  8236.    ULONG ulReserved;       /*must be zero                                  */
  8237.  
  8238.    The DosRmDir function removes the specified directory. The directory must
  8239.    be empty before it can be removed; that is, it must not contain files of
  8240.    any kind, including hidden files and other directories. If the specified
  8241.    directory cannot be found or is not empty, DosRmDir returns an error.
  8242.  
  8243.    The DosRmDir function is a family API function.
  8244.  
  8245.  Parameters
  8246.  
  8247.    pszDirName  Points to a null-terminated string that specifies the
  8248.    directory to be removed. This string must be a valid MS OS/2 directory
  8249.    name.
  8250.  
  8251.    ulReserved  Specifies a reserved value; must be zero.
  8252.  
  8253.  Return Value
  8254.  
  8255.    The return value is zero if the function is successful. Otherwise, it is
  8256.    an error value, which may be one of the following:
  8257.  
  8258.          ERROR_ACCESS_DENIED
  8259.          ERROR_CURRENT_DIRECTORY
  8260.          ERROR_DRIVE_LOCKED
  8261.          ERROR_FILE_NOT_FOUND
  8262.          ERROR_NOT_DOS_DISK
  8263.          ERROR_PATH_NOT_FOUND
  8264.  
  8265.  Comments
  8266.  
  8267.    The DosRmDir function cannot remove the current directory or the root
  8268.    directory.
  8269.  
  8270.    If necessary, use the DosDelete function to remove files from the
  8271.    directory.
  8272.  
  8273.  Example
  8274.  
  8275.    This example deletes all files in the subdirectory abc and then calls the
  8276.    DosRmDir function to delete the subdirectory. If the subdirectory contains
  8277.    other subdirectories or files that cannot be deleted, the DosRmDir
  8278.    function returns an error.
  8279.  
  8280.    USHORT usError;
  8281.  
  8282.    DosDelete("abc\\*.*", 0L);        /* removes all files    */
  8283.    usError = DosRmDir("abc", 0L);    /* removes subdirectory */
  8284.    if (usError)
  8285.        VioWrtTTY("Can't delete subdirectory\r\n", 27, 0);
  8286.    else {
  8287.  
  8288.  See Also
  8289.  
  8290.    DosChDir, DosDelete, DosMkDir
  8291.  
  8292.  
  8293.  ────────────────────────────────────────────────────────────────────────────
  8294.  DosScanEnv
  8295.  ────────────────────────────────────────────────────────────────────────────
  8296.    USHORT DosScanEnv (pszVarName, ppszResult)
  8297.    PSZ pszVarName;         /*pointer to environment-variable name          */
  8298.    PSZ FAR * ppszResult;   /*pointer to variable for result pointer        */
  8299.  
  8300.    The DosScanEnv function searches an environment for a specified
  8301.    environment variable. The environment is one or more null-terminated
  8302.    strings that name and define the environment variables available to the
  8303.    current process. Environment variables can be used to pass information to
  8304.    a program──for example, a variable might name a list of directories that
  8305.    contain data files to be used by the program.
  8306.  
  8307.    An environment variable has the following form:
  8308.  
  8309.    name=value
  8310.  
  8311.    The DosScanEnv function searches for the environment variable whose name
  8312.    matches the name pointed to by the pszVarName parameter. If DosScanEnv
  8313.    finds the variable, it copies the address of the first character of the
  8314.    environment variable's value to the variable pointed to by the ppszResult
  8315.    parameter. The first character of the environment variable's value is the
  8316.    character following the equal sign (=).
  8317.  
  8318.  Parameters
  8319.  
  8320.    pszVarName  Points to a null-terminated string that specifies the name of
  8321.    an environment variable. The string must not include a trailing equal sign
  8322.    (=), since the equal sign is not part of the name.
  8323.  
  8324.    ppszResult  Points to the pointer variable that receives the address of
  8325.    the environment string.
  8326.  
  8327.  Return Value
  8328.  
  8329.    The return value is zero if the function is successful. Otherwise, it is
  8330.    an error value.
  8331.  
  8332.  See Also
  8333.  
  8334.    DosExecPgm, DosGetEnv, DosSearchPath
  8335.  
  8336.  
  8337.  ────────────────────────────────────────────────────────────────────────────
  8338.  DosSearchPath
  8339.  ────────────────────────────────────────────────────────────────────────────
  8340.    USHORT DosSearchPath (fsSearch, pszPath, pszFileName, pbBuf, cbBuf)
  8341.    USHORT fsSearch;        /*search flags                                  */
  8342.    PSZ pszPath;            /*pointer to search path or environment         */
  8343.                            /*variable                                      */
  8344.    PSZ pszFileName;        /*pointer to filename                           */
  8345.    PBYTE pbBuf;            /*pointer to result buffer                      */
  8346.    USHORT cbBuf;           /*length of result buffer                       */
  8347.  
  8348.    The DosSearchPath function searches the specified search path for the
  8349.    given filename. A search path is a null-terminated string that consists of
  8350.    a sequence of directory paths separated by semicolons (;). The function
  8351.    searches for the filename by looking in each directory (one directory at a
  8352.    time) in the order given.
  8353.  
  8354.  Parameters
  8355.  
  8356.    fsSearch  Specifies how to interpret the pszPath parameter and whether or
  8357.    not to search the current directory. This parameter can be a combination
  8358.    of the following values:
  8359.  
  8360.    Value                    Meaning
  8361.    ──────────────────────────────────────────────────────────────────────────
  8362.    SEARCH_CUR_DIRECTORY     The function searches the current directory
  8363.                             before it searches the first directory in the
  8364.                             search path. If this value is not specified, the
  8365.                             function searches the current directory only if
  8366.                             it is explicitly given in the search path.
  8367.  
  8368.    SEARCH_ENVIRONMENT       The pszPath parameter points to the name of an
  8369.                             environment variable. The function retrieves the
  8370.                             value of the environment variable from the
  8371.                             process's environment segment and uses it as the
  8372.                             search path. If this value is not specified,
  8373.                             pszPath points to a string that specifies the
  8374.                             search path.
  8375.  
  8376.    SEARCH_PATH              The pszPath parameter specifies the search path.
  8377.                             This value cannot be used with the
  8378.                             SEARCH_ENVIRONMENT value.
  8379.    ──────────────────────────────────────────────────────────────────────────
  8380.  
  8381.    pszPath  Points to a null-terminated string that specifies the search-path
  8382.    reference.
  8383.  
  8384.    pszFileName  Points to a null-terminated string that specifies the
  8385.    filename to search for. The string must be a valid MS OS/2 filename and
  8386.    can contain wildcard characters.
  8387.  
  8388.    pbBuf  Points to the buffer that receives the full pathname of the file if
  8389.    the filename is found.
  8390.  
  8391.    cbBuf  Specifies the length in bytes of the structure that is pointed to
  8392.    by the pbBuf parameter.
  8393.  
  8394.  Return Value
  8395.  
  8396.    The return value is zero if the function is successful. Otherwise, it is
  8397.    an error value.
  8398.  
  8399.  Comments
  8400.  
  8401.    The DosSearchPath function uses the search path pointed to by the pszPath
  8402.    parameter to look for the filename pointed to by the pszFileName
  8403.    parameter. The pszPath parameter can point to an environment variable
  8404.    name, such as PATH or DPATH, or it can point to a search path (as
  8405.    specified by the fsSearch parameter). The filename must be a valid MS OS/2
  8406.    filename and can contain wildcard characters. If DosSearchPath finds a
  8407.    matching filename in any of the directories specified by the search path,
  8408.    the function copies the full, null-terminated pathname to the buffer
  8409.    pointed to by the pbBuf parameter. If the filename pointed to by the
  8410.    pszFileName parameter contains wildcard characters, the resulting pathname
  8411.    will also contain wildcard characters; the DosFindFirst function can be
  8412.    used to retrieve the actual filename(s).
  8413.  
  8414.    The DosSearchPath function does not check for the validity of filenames.
  8415.    If the filename is not valid, the function returns an error indicating
  8416.    that the file was not found.
  8417.  
  8418.  Example
  8419.  
  8420.    This example uses the search path specified by the DPATH environment
  8421.    variable to search for the abc.txt filename:
  8422.  
  8423.    CHAR szFoundFile[128];
  8424.    DosSearchPath(SEARCH_ENVIRONMENT,  /* uses environment variable   */
  8425.        "DPATH",                       /* uses DPATH search path      */
  8426.        "abc.txt",                     /* filename                    */
  8427.        szFoundFile,                   /* receives resulting filename */
  8428.        sizeof(szFoundFile));          /* length of result buffer     */
  8429.  
  8430.    The following example is identical to the first example if the DPATH
  8431.    variable is defined as shown:
  8432.  
  8433.    DPATH=c:\sysdir;c:\init
  8434.  
  8435.    DosSearchPath(SEARCH_PATH,          /* uses search path            */
  8436.        "c:\\sysdir;c:\\init",          /* search path                 */
  8437.        "abc.txt",                      /* filename                    */
  8438.        szFoundFile,                    /* receives resulting filename */
  8439.        sizeof(szFoundFile));           /* length of result buffer     */
  8440.  
  8441.  See Also
  8442.  
  8443.    DosFindFirst, DosScanEnv
  8444.  
  8445.  
  8446.  ────────────────────────────────────────────────────────────────────────────
  8447.  DosSelectDisk
  8448.  ────────────────────────────────────────────────────────────────────────────
  8449.    USHORT DosSelectDisk (usDriveNumber)
  8450.    USHORT usDriveNumber;   /*default-drive number                          */
  8451.  
  8452.    The DosSelectDisk function selects the specified drive as the default
  8453.    drive for the calling process.
  8454.  
  8455.    The DosSelectDisk function is a family API function.
  8456.  
  8457.  Parameters
  8458.  
  8459.    usDriveNumber  Specifies the number of the default drive. Drive A is 1,
  8460.    drive B is 2, and so on.
  8461.  
  8462.  Return Value
  8463.  
  8464.    The return value is zero if the function is successful. Otherwise, it is
  8465.    an error value, which may be the following:
  8466.  
  8467.          ERROR_INVALID_DRIVE
  8468.  
  8469.  Example
  8470.  
  8471.    This example calls the DosSelectDisk function to change the default drive
  8472.    to drive C. It then changes the default path to the root and opens the
  8473.    file abc.txt.
  8474.  
  8475.    HFILE hf;
  8476.    USHORT usAction;
  8477.    DosSelectDisk(3);                /* selects drive C:              */
  8478.    DosChDir("\\", 0L);              /* changes to the root directory */
  8479.    DosOpen("abc.txt", &hf, &usAction, 0L, FILE_NORMAL,
  8480.        FILE_OPEN | FILE_CREATE,
  8481.        OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYWRITE, 0L);
  8482.  
  8483.  See Also
  8484.  
  8485.    DosChDir, DosQCurDisk
  8486.  
  8487.  
  8488.  ────────────────────────────────────────────────────────────────────────────
  8489.  DosSelectSession
  8490.  ────────────────────────────────────────────────────────────────────────────
  8491.    USHORT DosSelectSession (idSession, ulReserved)
  8492.    USHORT idSession;       /*session identifier                            */
  8493.    ULONG ulReserved;       /*must be zero                                  */
  8494.  
  8495.    The DosSelectSession function switches the specified child session to the
  8496.    foreground. Only the parent session can call DosSelectSession to switch a
  8497.    session, and the parent session, or one of its descendant sessions, must
  8498.    be currently executing in the foreground when DosSelectSession is called.
  8499.    If the parent session is not in foreground, it can use DosSelectSession to
  8500.    switch itself to the foreground.
  8501.  
  8502.  Parameters
  8503.  
  8504.    idSession  Specifies the identifier of the session to be switched to the
  8505.    foreground. This identifier must have been created previously by using the
  8506.    DosStartSession function. If idSession is 0x0000, the function switches
  8507.    the parent session to the foreground.
  8508.  
  8509.    ulReserved  Specifies a reserved value; must be zero.
  8510.  
  8511.  Return Value
  8512.  
  8513.    The return value is zero if the function is successful. Otherwise, it is
  8514.    an error value.
  8515.  
  8516.  Comments
  8517.  
  8518.    The DosSelectSession function can only select a child session that was
  8519.    created by using the DosStartSession function with the Related field of
  8520.    the STARTDATA structure set to TRUE. In other words, this function cannot
  8521.    select sessions started as independent sessions.
  8522.  
  8523.  See Also
  8524.  
  8525.    DosSetSession, DosStartSession, DosStopSession
  8526.  
  8527.  
  8528.  ────────────────────────────────────────────────────────────────────────────
  8529.  DosSemClear
  8530.  ────────────────────────────────────────────────────────────────────────────
  8531.    USHORT DosSemClear (hsem)
  8532.    HSEM hsem;              /*semaphore handle                              */
  8533.  
  8534.    The DosSemClear function clears a system or RAM semaphore that has been
  8535.    set by using the DosSemRequest, DosSemSet, or DosSemSetWait function.
  8536.  
  8537.  Parameters
  8538.  
  8539.    hsem  Identifies the semaphore to set. This value can be the handle of a
  8540.    system semaphore that has been previously created or opened by using the
  8541.    DosCreateSem or DosOpenSem function, or it can be the address of a RAM
  8542.    semaphore.
  8543.  
  8544.  Return Value
  8545.  
  8546.    The return value is zero if the function is successful. Otherwise, it is
  8547.    an error value, which may be one of the following:
  8548.  
  8549.          ERROR_EXCL_SEM_ALREADY_OWNED
  8550.          ERROR_INVALID_HANDLE
  8551.  
  8552.  Comments
  8553.  
  8554.    The DosSemClear function cannot clear a system semaphore that is owned by
  8555.    another process unless the semaphore is nonexclusive.
  8556.  
  8557.  Example
  8558.  
  8559.    This example uses the DosSemClear function to clear a RAM semaphore and a
  8560.    system semaphore:
  8561.  
  8562.    ULONG hsem = 0;
  8563.    HSYSSEM hsys;
  8564.    DosSemClear(&hsem);      /* clears a RAM semaphore    */
  8565.    DosSemClear(&hsys);      /* clears a system semaphore */
  8566.  
  8567.  See Also
  8568.  
  8569.    DosCreateSem, DosMuxSemWait, DosOpenSem, DosSemRequest, DosSemSet,
  8570.    DosSemWait
  8571.  
  8572.  
  8573.  ────────────────────────────────────────────────────────────────────────────
  8574.  DosSemRequest
  8575.  ────────────────────────────────────────────────────────────────────────────
  8576.    USHORT DosSemRequest (hsem, lTimeOut)
  8577.    HSEM hsem;              /*semaphore handle                              */
  8578.    LONG lTimeOut;          /*time-out                                      */
  8579.  
  8580.    The DosSemRequest function requests that the specified semaphore be set as
  8581.    soon as it is clear. If no previous thread has set the semaphore,
  8582.    DosSemRequest sets the semaphore and returns immediately. If the semaphore
  8583.    has already been set by another thread, the function waits until a thread
  8584.    clears the semaphore (by using the DosSemClear function) or until a
  8585.    time-out occurs.
  8586.  
  8587.  Parameters
  8588.  
  8589.    hsem  Identifies the semaphore to set. This value can be the handle of a
  8590.    system semaphore that has been previously created or opened by using the
  8591.    DosCreateSem or DosOpenSem function, or it can be the address of a RAM
  8592.    semaphore.
  8593.  
  8594.    lTimeOut  Specifies how long to wait for the semaphore to clear. If the
  8595.    value is greater then zero, this parameter specifies the number of
  8596.    milliseconds to wait before returning. If the value is
  8597.    SEM_IMMEDIATE_RETURN, the function returns immediately. If the value is
  8598.    SEM_INDEFINITE_WAIT, the function waits indefinitely.
  8599.  
  8600.  Return Value
  8601.  
  8602.    The return value is zero if the function is successful. Otherwise, it is
  8603.    an error value, which may be one of the following:
  8604.  
  8605.          ERROR_INTERRUPT
  8606.          ERROR_INVALID_HANDLE
  8607.          ERROR_SEM_OWNER_DIED
  8608.          ERROR_SEM_TIMEOUT
  8609.          ERROR_TOO_MANY_SEM_REQUESTS
  8610.  
  8611.  Comments
  8612.  
  8613.    The effects of DosSemRequest are cumulative. If multiple calls to
  8614.    DosSemRequest set the semaphore, the same number of calls to the
  8615.    DosSemClear function are required to clear the semaphore.
  8616.  
  8617.    If more than one thread has requested to set the semaphore, a thread may
  8618.    have to wait through several changes of the semaphore before it continues
  8619.    (depending on which thread clears the semaphore and when the system
  8620.    scheduler passes control to the thread). As long as the semaphore is set
  8621.    (even if it has been cleared and reset since the thread originally called
  8622.    the function), the thread must wait.
  8623.  
  8624.    The DosSemRequest function cannot set a system semaphore that is set by
  8625.    another process, unless the semaphore is nonexclusive.
  8626.  
  8627.    The DosSemRequest function can set system or RAM semaphores. A system
  8628.    semaphore is initially clear when it is created. A RAM semaphore is clear
  8629.    if its value is zero. Programs that use RAM semaphores should assign the
  8630.    initial value of zero.
  8631.  
  8632.  Example
  8633.  
  8634.    This example uses the DosSemRequest function to create a RAM semaphore. It
  8635.    also shows how to set and clear the semaphore.
  8636.  
  8637.    ULONG hsem = 0;
  8638.    DosSemRequest(&hsem,           /* address of handle    */
  8639.        -1L);                      /* waits indefinitely   */
  8640.        .
  8641.        .
  8642.        .
  8643.    DosSemClear(&hsem);            /* clears the semaphore */
  8644.  
  8645.  See Also
  8646.  
  8647.    DosCreateSem, DosExitList, DosMuxSemWait, DosOpenSem, DosSemClear,
  8648.    DosSemSet, DosSemSetWait, DosSemWait
  8649.  
  8650.  
  8651.  ────────────────────────────────────────────────────────────────────────────
  8652.  DosSemSet
  8653.  ────────────────────────────────────────────────────────────────────────────
  8654.    USHORT DosSemSet (hsem)
  8655.    HSEM hsem;              /*semaphore handle                              */
  8656.  
  8657.    The DosSemSet function sets a specified semaphore. A process typically
  8658.    uses this function to set a semaphore, then waits for the semaphore to
  8659.    clear by using the DosSemWait or DosMuxSemWait function.
  8660.  
  8661.  Parameters
  8662.  
  8663.    hsem  Identifies the semaphore to set. This value can be the handle of a
  8664.    system semaphore that has been previously created or opened by using the
  8665.    DosCreateSem or DosOpenSem function, or it can be the address of a RAM
  8666.    semaphore.
  8667.  
  8668.  Return Value
  8669.  
  8670.    The return value is zero if the function is successful. Otherwise, it is
  8671.    an error value, which may be one of the following:
  8672.  
  8673.          ERROR_EXCL_SEM_ALREADY_OWNED
  8674.          ERROR_INVALID_HANDLE
  8675.          ERROR_TOO_MANY_SEM_REQUESTS
  8676.  
  8677.  Comments
  8678.  
  8679.    The DosSemSet function cannot set a system semaphore that is owned by
  8680.    another process unless the semaphore is nonexclusive.
  8681.  
  8682.  Example
  8683.  
  8684.    This example uses the DosSemSet function to set a RAM semaphore and a
  8685.    system semaphore:
  8686.  
  8687.    ULONG hsem = 0;
  8688.    HSYSSEM hsys;
  8689.    DosSemSet(&hsem);       /* sets a RAM semaphore    */
  8690.    DosSemSet(hsys);        /* sets a system semaphore */
  8691.  
  8692.  See Also
  8693.  
  8694.    DosCreateSem, DosMuxSemWait, DosOpenSem, DosSemClear, DosSemRequest,
  8695.    DosSemSetWait, DosSemWait
  8696.  
  8697.  
  8698.  ────────────────────────────────────────────────────────────────────────────
  8699.  DosSemSetWait
  8700.  ────────────────────────────────────────────────────────────────────────────
  8701.    USHORT DosSemSetWait (hsem, lTimeOut)
  8702.    HSEM hsem;              /*semaphore handle                              */
  8703.    LONG lTimeOut;          /*time-out                                      */
  8704.  
  8705.    The DosSemSetWait function sets the specified semaphore (if it is not
  8706.    already set) and then waits for another thread to clear the semaphore (by
  8707.    using the DosSemClear function) or for a time-out to occur. The only
  8708.    difference between the DosSemSetWait function and the DosSemWait function
  8709.    is that the DosSemSetWait function will first set the semaphore if it is
  8710.    not already set.
  8711.  
  8712.  Parameters
  8713.  
  8714.    hsem  Identifies the semaphore to set. This value can be the handle of a
  8715.    system semaphore that has been previously created or opened by using the
  8716.    DosCreateSem or DosOpenSem function, or it can be the address of a RAM
  8717.    semaphore.
  8718.  
  8719.    lTimeOut  Specifies how long to wait for the semaphore to become clear. If
  8720.    the value is greater then zero, this parameter specifies the number of
  8721.    milliseconds to wait before returning. If it is SEM_IMMEDIATE_RETURN, the
  8722.    function returns immediately. If it is SEM_INDEFINITE_WAIT, the function
  8723.    waits indefinitely.
  8724.  
  8725.  Return Value
  8726.  
  8727.    The return value is zero if the function is successful. Otherwise, it is
  8728.    an error value, which may be one of the following:
  8729.  
  8730.          ERROR_EXCL_SEM_ALREADY_OWNED
  8731.          ERROR_INTERRUPT
  8732.          ERROR_INVALID_HANDLE
  8733.          ERROR_SEM_TIMEOUT
  8734.          ERROR_TOO_MANY_SEM_REQUESTS
  8735.  
  8736.  Comments
  8737.  
  8738.    If more than one thread is setting and clearing the semaphore, a thread
  8739.    may have to wait through several changes of the semaphore before it can
  8740.    continue (depending on which thread clears the semaphore and when the
  8741.    system scheduler passes control to the thread). As long as the semaphore
  8742.    is set (even if it has been cleared and reset since the thread originally
  8743.    called the function), the thread must wait.
  8744.  
  8745.    The DosSemSetWait function cannot be used to wait for a system semaphore
  8746.    that is set by another process unless the semaphore is nonexclusive.
  8747.  
  8748.  Example
  8749.  
  8750.    This example calls DosSemSetWait to set the specified RAM semaphore and
  8751.    then waits until another thread clears the semaphore. It waits for up to 5
  8752.    seconds and then returns an ERROR_SEM_TIMEOUT error value if a time-out
  8753.    occurs before the semaphore is cleared.
  8754.  
  8755.    #define INCL_DOSERRORS       /* include error constants */
  8756.  
  8757.    ULONG hsem = 0;
  8758.    if (DosSemSetWait(&hsem, 5000L) == ERROR_SEM_TIMEOUT) {
  8759.        .
  8760.        . /* error processing */
  8761.        .
  8762.    }
  8763.    else {
  8764.  
  8765.  See Also
  8766.  
  8767.    DosCreateSem, DosMuxSemWait, DosOpenSem, DosSemClear, DosSemRequest,
  8768.    DosSemWait
  8769.  
  8770.  
  8771.  ────────────────────────────────────────────────────────────────────────────
  8772.  DosSemWait
  8773.  ────────────────────────────────────────────────────────────────────────────
  8774.    USHORT DosSemWait (hsem, lTimeOut)
  8775.    HSEM hsem;              /*semaphore handle                              */
  8776.    LONG lTimeOut;          /*time-out                                      */
  8777.  
  8778.    The DosSemWait function waits for a specified semaphore to be cleared.
  8779.    DosSemWait waits until a thread uses the DosSemClear function to clear the
  8780.    semaphore or until a time-out occurs. If no previous thread has set the
  8781.    semaphore, DosSemWait returns immediately.
  8782.  
  8783.  Parameters
  8784.  
  8785.    hsem  Identifies the semaphore to set. This value can be the handle of a
  8786.    system semaphore that has been previously created or opened by using the
  8787.    DosCreateSem or DosOpenSem function, or it can be the address of a RAM
  8788.    semaphore.
  8789.  
  8790.    lTimeOut  Specifies how long to wait for the semaphore to clear. If the
  8791.    value is greater then zero, this parameter specifies the number of
  8792.    milliseconds to wait before returning. If the value is
  8793.    SEM_IMMEDIATE_RETURN, the function returns immediately. If the value is
  8794.    SEM_INDEFINITE_WAIT, the function waits indefinitely.
  8795.  
  8796.  Return Value
  8797.  
  8798.    The return value is zero if the function is successful. Otherwise, it is
  8799.    an error value, which may be one of the following:
  8800.  
  8801.          ERROR_EXCL_SEM_ALREADY_OWNED
  8802.          ERROR_INTERRUPT
  8803.          ERROR_INVALID_HANDLE
  8804.          ERROR_SEM_TIMEOUT
  8805.  
  8806.  Comments
  8807.  
  8808.    The DosSemWait function cannot be used to wait for a system semaphore that
  8809.    is owned by another process unless the semaphore is nonexclusive.
  8810.  
  8811.    If more than one thread is setting and clearing the semaphore, the thread
  8812.    calling DosSemWait may have to wait through several changes of the
  8813.    semaphore before it continues (depending on which thread clears the
  8814.    semaphore and when the system scheduler passes control to the calling
  8815.    thread). The thread must wait for as long as the semaphore is set, even if
  8816.    the semaphore has been cleared and reset since the thread originally
  8817.    called the function.
  8818.  
  8819.  Example
  8820.  
  8821.    This example calls the DosSemWait function to wait for up to 5 seconds for
  8822.    a RAM semaphore. If a time-out occurs before the semaphore handle is
  8823.    retrieved, the function returns an ERROR_SEM_TIMEOUT error value.
  8824.  
  8825.    ULONG hsem = 0;
  8826.    if (DosSemWait(&hsem, 5000L) == ERROR_SEM_TIMEOUT) {
  8827.        .
  8828.        . /* error processing */
  8829.        .
  8830.    }
  8831.    else {
  8832.  
  8833.  See Also
  8834.  
  8835.    DosCreateSem, DosMuxSemWait, DosOpenSem, DosSemRequest,
  8836.    DosSemSetWait, WinMsgSemWait
  8837.  
  8838.  
  8839.  ────────────────────────────────────────────────────────────────────────────
  8840.  DosSendSignal
  8841.  ────────────────────────────────────────────────────────────────────────────
  8842.    USHORT DosSendSignal (idProcess, usSigNumber)
  8843.    USHORT idProcess;       /*process identifier of subtree root            */
  8844.    USHORT usSigNumber;     /*signal to send                                */
  8845.  
  8846.    The DosSendSignal function sends a CTRL+C or CTRL+BREAK signal to
  8847.    the last descendant process that has a corresponding signal handler
  8848.    installed.
  8849.  
  8850.  Parameters
  8851.  
  8852.    idProcess  Specifies the process identification code (PID) of the root
  8853.    process of the subtree. It is not necessary that this process still be
  8854.    running, but it is necessary that this process be a direct child of the
  8855.    process that issues this call.
  8856.  
  8857.    usSigNumber  Specifies the signal to send. It can be SIG_CTRLC to send a
  8858.    CTRL+C signal, or SIG_CTRLBREAK to send a CTRL+BREAK signal.
  8859.  
  8860.  Return Value
  8861.  
  8862.    The return value is zero if the function is successful. Otherwise, it is
  8863.    an error value.
  8864.  
  8865.  See Also
  8866.  
  8867.    DosFlagProcess, DosHoldSignal, DosSetSigHandler
  8868.  
  8869.  
  8870.  ────────────────────────────────────────────────────────────────────────────
  8871.  DosSetCp
  8872.  ────────────────────────────────────────────────────────────────────────────
  8873.    USHORT DosSetCp (usCodePage, usReserved)
  8874.    USHORT usCodePage;      /*code-page identifier                          */
  8875.    USHORT usReserved;      /*must be zero                                  */
  8876.  
  8877.    The DosSetCp function sets the code-page identifier for the current
  8878.    process. The code-page identifier defines which translation table the
  8879.    system should use to translate input from the keyboard or to translate
  8880.    output to the screen and printer.
  8881.  
  8882.  Parameters
  8883.  
  8884.    usCodePage  Specifies the code-page identifier.
  8885.  
  8886.    usReserved  Specifies a reserved value; must be zero.
  8887.  
  8888.  Return Value
  8889.  
  8890.    The return value is zero if the function is successful. Otherwise, it is
  8891.    an error value.
  8892.  
  8893.  Comments
  8894.  
  8895.    The file system activates the current code page for printer output
  8896.    whenever the printer is opened.
  8897.  
  8898.    The code-page identifier can be one of the following values:
  8899.  
  8900.    Number      Code page
  8901.    ──────────────────────────────────────────────────────────────────────────
  8902.    437         United States
  8903.  
  8904.    850         Multilingual
  8905.  
  8906.    860         Portuguese
  8907.  
  8908.    863         French-Canadian
  8909.  
  8910.    865         Nordic
  8911.    ──────────────────────────────────────────────────────────────────────────
  8912.  
  8913.  See Also
  8914.  
  8915.    DosGetCp
  8916.  
  8917.  
  8918.  ────────────────────────────────────────────────────────────────────────────
  8919.  DosSetDateTime
  8920.  ────────────────────────────────────────────────────────────────────────────
  8921.    USHORT DosSetDateTime (pdateTime)
  8922.    PDATETIME pdateTime;    /*pointer to structure for date and time        */
  8923.  
  8924.    The DosSetDateTime function sets the current date and time. Although MS
  8925.    OS/2 maintains the current date and time, any process can change the date
  8926.    and time by using the DosSetDateTime function.
  8927.  
  8928.    The DosSetDateTime function is a family API function.
  8929.  
  8930.  Parameters
  8931.  
  8932.    pdateTime  Points to the structure that contains the date and time
  8933.    information. The DATETIME structure has the following form:
  8934.  
  8935.    typedef struct _DATETIME {
  8936.        UCHAR   hours;
  8937.        UCHAR   minutes;
  8938.        UCHAR   seconds;
  8939.        UCHAR   hundredths;
  8940.        UCHAR   day;
  8941.        UCHAR   month;
  8942.        USHORT  year;
  8943.        SHORT   timezone;
  8944.        UCHAR   weekday;
  8945.    } DATETIME;
  8946.  
  8947.    For a full description, see Chapter 4, "Types, Macros, Structures."
  8948.  
  8949.  Return Value
  8950.  
  8951.    The return value is zero if the function is successful. Otherwise, it is
  8952.    an error value, which may be the following:
  8953.  
  8954.          ERROR_TS_DATETIME
  8955.  
  8956.  Example
  8957.  
  8958.    This example retrieves the current date and time and then calls the
  8959.    DosSetDateTime function to change the month to September and the day to
  8960.    the 26th:
  8961.  
  8962.    DATETIME dateTime;
  8963.    DosGetDateTime(&dateTime);    /* gets the current date and time */
  8964.    dateTime.month = 9;           /* changes the month              */
  8965.    dateTime.day = 26;            /* changes the day                */
  8966.    DosSetDateTime(&dateTime);    /* sets the new date and time     */
  8967.  
  8968.  See Also
  8969.  
  8970.    DosGetDateTime
  8971.  
  8972.  
  8973.  ────────────────────────────────────────────────────────────────────────────
  8974.  DosSetFHandState
  8975.  ────────────────────────────────────────────────────────────────────────────
  8976.    USHORT DosSetFHandState (hf, fsState)
  8977.    HFILE hf;               /*file handle                                   */
  8978.    USHORT fsState;         /*file-state flags                              */
  8979.  
  8980.    The DosSetFHandState function modifies a file's inheritance,
  8981.    fail-on-error, and write-through. These flags are originally set by using
  8982.    the DosOpen function when the file is opened.
  8983.  
  8984.    The DosSetFHandState function is a family API function.
  8985.  
  8986.  Parameters
  8987.  
  8988.    hf  Identifies the handle of the file to be set. This handle must have
  8989.    been created previously by using the DosOpen function.
  8990.  
  8991.    fsState  Specifies the state of the file-handle. This parameter can be one
  8992.    or more of the following values:
  8993.  
  8994. ╓┌─┌────────────────────────────┌────────────────────────────────────────────╖
  8995.    Value                        Meaning
  8996.    ──────────────────────────────────────────────────────────────────────────
  8997.    OPEN_FLAGS_FAIL_ON_ERROR     Any function that uses the file handle
  8998.                                 returns immediately with an error value if
  8999.                                 there is an I/O error──for example, if the
  9000.                                 drive door is open or a sector is missing. If
  9001.                                 this value is not specified, the system
  9002.                                 passes the error to the system critical-error
  9003.                                 handler, which then reports the error to the
  9004.                                 user with a hard-error popup. The
  9005.                                 fail-on-error flag is not inherited by child
  9006.                                 processes.
  9007.  
  9008.                                 The fail-on-error flag applies to all
  9009.                                 functions that use the file handle, with the
  9010.                                 exception of the DosDevIOCtl function.
  9011.    Value                        Meaning
  9012.    ──────────────────────────────────────────────────────────────────────────
  9013.                                exception of the DosDevIOCtl function.
  9014.  
  9015.    OPEN_FLAGS_NOINHERIT         The file handle is not available to any child
  9016.                                 process started by the current process. If
  9017.                                 this value is not specified, any child
  9018.                                 process started by the current process can
  9019.                                 use the file handle.
  9020.  
  9021.    OPEN_FLAGS_WRITE_THROUGH     This flag applies to functions, such as
  9022.                                 DosWrite, that write data to the file. If
  9023.                                 this value is specified, the system writes
  9024.                                 data to the device before the given function
  9025.                                 returns. Otherwise, the system may store the
  9026.                                 data in an internal file buffer and write the
  9027.                                 data to the device only when the buffer is
  9028.                                 full or the file is closed.
  9029.    ──────────────────────────────────────────────────────────────────────────
  9030.  
  9031.  
  9032.  Return Value
  9033.  
  9034.    The return value is zero if the function is successful. Otherwise, it is
  9035.    an error value, which may be one of the following:
  9036.  
  9037.          ERROR_INVALID_HANDLE
  9038.          ERROR_INVALID_PARAMETER
  9039.  
  9040.  Restrictions
  9041.  
  9042.    In real mode, the following restriction applies to the DosSetFHandState
  9043.    function:
  9044.  
  9045.    ■  Only the OPEN_FLAGS_NOINHERIT flag can be set.
  9046.  
  9047.  Example
  9048.  
  9049.    This example opens the file abc with the inheritance flag set to zero (all
  9050.    child processes inherit the file handle). It retrieves the current
  9051.    file-handle state, clears the bits that are required to be zero, sets the
  9052.    inheritance flag using the OR operator, and calls the DosSetFHandState
  9053.    function.
  9054.  
  9055.    HFILE hf;
  9056.    USHORT usAction, fState;
  9057.    DosQFHandState(hf, &fState);             /* gets the current state */
  9058.    DosSetFHandState(hf,                     /* handle to the file     */
  9059.        (fState | OPEN_FLAGS_NOINHERIT));    /* set noinheritance flag */
  9060.  
  9061.  See Also
  9062.  
  9063.    DosBufReset, DosClose, DosDupHandle, DosExecPgm, DosOpen,
  9064.    DosQFHandState, DosSetFileMode, DosWrite
  9065.  
  9066.  
  9067.  ────────────────────────────────────────────────────────────────────────────
  9068.  DosSetFileInfo
  9069.  ────────────────────────────────────────────────────────────────────────────
  9070.    USHORT DosSetFileInfo (hf, usInfoLevel, pfstsBuf, cbBuf)
  9071.    HFILE hf;               /*file handle                                   */
  9072.    USHORT usInfoLevel;     /*level of file information                     */
  9073.    PBYTE pfstsBuf;         /*pointer to file-status information            */
  9074.    USHORT cbBuf;           /*length of file-information buffer             */
  9075.  
  9076.    The DosSetFileInfo function changes the time and date information for the
  9077.    specified file. The function replaces a file's time and date information
  9078.    with the information given in the structure pointed to by the pfstsBuf
  9079.    parameter.
  9080.  
  9081.    The DosSetFileInfo function is a family API function.
  9082.  
  9083.  Parameters
  9084.  
  9085.    hf  Identifies the file whose time and date information is being changed.
  9086.    This handle must have been created previously by using the DosOpen
  9087.    function.
  9088.  
  9089.    usInfoLevel  Specifies the level of file information being defined. In MS
  9090.    OS/2, version 1.1, this value must be 0x0001.
  9091.  
  9092.    pfstsBuf  Points to the FILESTATUS structure that contains the new
  9093.    information. The FILESTATUS structure has the following form:
  9094.  
  9095.    typedef struct _FILESTATUS {
  9096.        FDATE  fdateCreation;
  9097.        FTIME  ftimeCreation;
  9098.        FDATE  fdateLastAccess;
  9099.        FTIME  ftimeLastAccess;
  9100.        FDATE  fdateLastWrite;
  9101.        FTIME  ftimeLastWrite;
  9102.        ULONG  cbFile;
  9103.        ULONG  cbFileAlloc;
  9104.        USHORT attrFile;
  9105.    } FILESTATUS;
  9106.  
  9107.    For a full description, see Chapter 4, "Types, Macros, Structures."
  9108.  
  9109.    cbBuf  Specifies the length in bytes of the structure pointed to by the
  9110.    pfstsBuf parameter.
  9111.  
  9112.  Return Value
  9113.  
  9114.    The return value is zero if the function is successful. Otherwise, it is
  9115.    an error value, which may be one of the following:
  9116.  
  9117.          ERROR_ACCESS_DENIED
  9118.          ERROR_DIRECT_ACCESS_HANDLE
  9119.          ERROR_INSUFFICIENT_BUFFER
  9120.          ERROR_INVALID_FUNCTION
  9121.          ERROR_INVALID_HANDLE
  9122.          ERROR_INVALID_LEVEL
  9123.  
  9124.  Comments
  9125.  
  9126.    The DosSetFileInfo function does not change information in read-only
  9127.    files.
  9128.  
  9129.    A zero in matching date and time fields will cause that aspect of file
  9130.    information to be left unchanged. For example, if both the fdateCreation
  9131.    and ftimeCreation fields are set to zero, both of these attributes are
  9132.    left unchanged.
  9133.  
  9134.  See Also
  9135.  
  9136.    DosNewSize, DosQFileInfo, DosSetFileMode
  9137.  
  9138.  
  9139.  ────────────────────────────────────────────────────────────────────────────
  9140.  DosSetFileMode
  9141.  ────────────────────────────────────────────────────────────────────────────
  9142.    USHORT DosSetFileMode (pszFileName, usAttribute, ulReserved)
  9143.    PSZ pszFileName;        /*filename                                      */
  9144.    USHORT usAttribute;     /*new file attribute                            */
  9145.    ULONG ulReserved;       /*must be zero                                  */
  9146.  
  9147.    The DosSetFileMode function sets the file attributes of the specified
  9148.    file. A file's mode is defined by the settings of its attributes.
  9149.  
  9150.    The DosSetFileMode function is a family API function.
  9151.  
  9152.  Parameters
  9153.  
  9154.    pszFileName  Points to a null-terminated string that specifies the name of
  9155.    the file. The string must be a valid MS OS/2 filename.
  9156.  
  9157.    usAttribute  Specifies the file's new attributes. This parameter can be a
  9158.    combination of the following values:
  9159.  
  9160.    Value            Meaning
  9161.    ──────────────────────────────────────────────────────────────────────────
  9162.    FILE_NORMAL      File can be read from or written to.
  9163.  
  9164.    FILE_READONLY    File can be read from but not written to.
  9165.  
  9166.    FILE_HIDDEN      File is hidden and does not appear when a directory is
  9167.                     listed.
  9168.  
  9169.    FILE_SYSTEM      File is a system file.
  9170.  
  9171.    FILE_ARCHIVED    File has been archived.
  9172.    ──────────────────────────────────────────────────────────────────────────
  9173.  
  9174.    The FILE_NORMAL value can be combined only with the FILE_ARCHIVED value.
  9175.  
  9176.    ulReserved  Specifies a reserved value; must be zero.
  9177.  
  9178.  Return Value
  9179.  
  9180.    The return value is zero if the function is successful. Otherwise, it is
  9181.    an error value, which may be one of the following:
  9182.  
  9183.          ERROR_ACCESS_DENIED
  9184.          ERROR_DRIVE_LOCKED
  9185.          ERROR_FILE_NOT_FOUND
  9186.          ERROR_NOT_DOS_DISK
  9187.          ERROR_PATH_NOT_FOUND
  9188.          ERROR_SHARING_BUFFER_EXCEEDED
  9189.          ERROR_SHARING_VIOLATION
  9190.  
  9191.  See Also
  9192.  
  9193.    DosQFileMode
  9194.  
  9195.  
  9196.  ────────────────────────────────────────────────────────────────────────────
  9197.  DosSetFSInfo
  9198.  ────────────────────────────────────────────────────────────────────────────
  9199.    USHORT DosSetFSInfo (usDriveNumber, usInfoLevel, pbBuf, cbBuf)
  9200.    USHORT usDriveNumber;   /*drive number                                  */
  9201.    USHORT usInfoLevel;     /*level of file-system information              */
  9202.    PBYTE pbBuf;            /*pointer to structure for file-system          */
  9203.                            /*information                                   */
  9204.    USHORT cbBuf;           /*length of buffer for file-system information  */
  9205.  
  9206.    The DosSetFSInfo function sets information for a file-system device.
  9207.  
  9208.    The DosSetFSInfo function is a family API function.
  9209.  
  9210.  Parameters
  9211.  
  9212.    usDriveNumber  Specifies the logical drive number. The usDriveNumber
  9213.    parameter must be a value from 0 through 26. The default drive is 0, drive
  9214.    A is 1, drive B is 2, and so on.
  9215.  
  9216.    usInfoLevel  Specifies the level of file information required. In MS OS/2,
  9217.    version 1.1, this value must be 0x0002.
  9218.  
  9219.    pbBuf  Points to the structure that receives the information. When the
  9220.    request is for level-2 file information, this parameter points to a
  9221.    structure that contains the volume-label information. The VOLUMELABEL
  9222.    structure has the following form:
  9223.  
  9224.    typedef struct _VOLUMELABEL {
  9225.        BYTE cch;
  9226.        CHAR achVolLabel[12];
  9227.    } VOLUMELABEL;
  9228.  
  9229.    For a full description, see Chapter 4, "Types, Macros, Structures."
  9230.  
  9231.    cbBuf  Specifies the length (in bytes) of the VOLUMELABEL structure
  9232.    pointed to by the pbBuf parameter.
  9233.  
  9234.  Return Value
  9235.  
  9236.    The return value is zero if the function is successful. Otherwise, it is
  9237.    an error value, which may be one of the following:
  9238.  
  9239.          ERROR_CANNOT_MAKE
  9240.          ERROR_INSUFFICIENT_BUFFER
  9241.          ERROR_INVALID_DRIVE
  9242.          ERROR_INVALID_LEVEL
  9243.          ERROR_INVALID_NAME
  9244.          ERROR_LABEL_TOO_LONG
  9245.  
  9246.  See Also
  9247.  
  9248.    DosQCurDisk, DosQFSInfo
  9249.  
  9250.  
  9251.  ────────────────────────────────────────────────────────────────────────────
  9252.  DosSetMaxFH
  9253.  ────────────────────────────────────────────────────────────────────────────
  9254.    USHORT DosSetMaxFH (usHandles)
  9255.    USHORT usHandles;       /*number of file handles                        */
  9256.  
  9257.    The DosSetMaxFH function sets the maximum number of file handles for the
  9258.    current process. The number of available handles limits the number of
  9259.    files that can be opened at once. However, all handles are not always
  9260.    available for use by the process. When determining the required number of
  9261.    handles, add several for the dynamic-link modules (these modules use
  9262.    several handles) and three for the default system input/output handles.
  9263.  
  9264.  Parameters
  9265.  
  9266.    usHandles  Specifies the maximum number of file handles provided to the
  9267.    calling process. The maximum value for this parameter is 255; the default
  9268.    is 20.
  9269.  
  9270.  Return Value
  9271.  
  9272.    The return value is zero if the function is successful. Otherwise, it is
  9273.    an error value, which may be one of the following:
  9274.  
  9275.          ERROR_INVALID_PARAMETER
  9276.          ERROR_NOT_ENOUGH_MEMORY
  9277.  
  9278.  Comments
  9279.  
  9280.    This function preserves all currently open file handles.
  9281.  
  9282.  See Also
  9283.  
  9284.    DosDupHandle, DosOpen
  9285.  
  9286.  
  9287.  ────────────────────────────────────────────────────────────────────────────
  9288.  DosSetNmPHandState
  9289.  ────────────────────────────────────────────────────────────────────────────
  9290.    USHORT DosSetNmPHandState (hp, fsState)
  9291.    HPIPE hp;               /*pipe handle                                   */
  9292.    USHORT fsState;         /*state flag                                    */
  9293.  
  9294.    The DosSetNmPHandState function is used to set the read mode and the
  9295.    blocking mode of a named pipe.
  9296.  
  9297.  Parameters
  9298.  
  9299.    hp  Identifies the pipe to read from.
  9300.  
  9301.    fsState  Specifies the new mode. The mode is a combination of a read-mode
  9302.    flag and a wait flag. The possible values are:
  9303.  
  9304.    Value                      Meaning
  9305.    ──────────────────────────────────────────────────────────────────────────
  9306.    PIPE_READMODE_BYTE         Read pipe as a byte stream.
  9307.  
  9308.    PIPE_READMODE_MESSAGE      Read pipe as a message stream.
  9309.  
  9310.    PIPE_NOWAIT                Reading from and writing to the pipe returns
  9311.                               immediately if no data is available.
  9312.  
  9313.    PIPE_WAIT                  Reading from and writing to the pipe waits if
  9314.                               no data is available.
  9315.    ──────────────────────────────────────────────────────────────────────────
  9316.  
  9317.  Return Value
  9318.  
  9319.    The return value is zero if the function is successful. Otherwise, it is
  9320.    an error value, which may be one of the following:
  9321.  
  9322.          ERROR_BAD_PIPE
  9323.          ERROR_INVALID_PARAMETER
  9324.          ERROR_PIPE_NOT_CONNECTED
  9325.  
  9326.  See Also
  9327.  
  9328.    DosQNmPHandState
  9329.  
  9330.  
  9331.  ────────────────────────────────────────────────────────────────────────────
  9332.  DosSetNmPipeSem
  9333.  ────────────────────────────────────────────────────────────────────────────
  9334.    USHORT DosSetNmPipeSem (hp, hsem, usKeyVal)
  9335.    HPIPE hp;               /*pipe handle                                   */
  9336.    HSEM hsem;              /*semaphore handle                              */
  9337.    USHORT usKeyVal;        /*key value to associate                        */
  9338.  
  9339.    The DosSetNmPipeSem function associates a semaphore with a named pipe.
  9340.  
  9341.  Parameters
  9342.  
  9343.    hp  Identifies the named pipe.
  9344.  
  9345.    hsem  Identifies the semaphore to associate with the pipe.
  9346.  
  9347.    usKeyVal  Specifies a key identifier to associate with the named pipe.
  9348.  
  9349.  Return Value
  9350.  
  9351.    The return value is zero if the function is successful. Otherwise, it is
  9352.    an error value, which may be one of the following:
  9353.  
  9354.          ERROR_INVALID_FUNCTION
  9355.          ERROR_PIPE_NOT_CONNECTED
  9356.          ERROR_SEM_NOT_FOUND
  9357.  
  9358.  Comments
  9359.  
  9360.    Up to two semaphores can be attached to a named pipe; one for the serving
  9361.    end of the pipe and one for the client end of the pipe. If a semaphore is
  9362.    already attached to one end of the named pipe, the old semaphore will be
  9363.    overwritten.
  9364.  
  9365.    The DosSetNmPipeSem function only returns successfully for local named
  9366.    pipes. If the DosSetNmPipeSem function attempts to associate a semaphore
  9367.    with a remote named pipe, an ERROR_INVALID_FUNCTION error value is
  9368.    returned by the DosSetNmPipeSem function.
  9369.  
  9370.    The DosSetNmPipeSem function allows a serving application that needs to
  9371.    handle a large number of incoming named pipes to avoid dedicating a thread
  9372.    for each named pipe and avoid polling the pipes. An application can
  9373.    instead call the DosSemWait or DosMuxSemWait function to determine when
  9374.    I/O can be performed on the pipe semaphore(s). This allows a large number
  9375.    of named pipes to be handled in an event-driven way, using only a small
  9376.    number of threads. The DosQNmPipeSemState function can be used to provide
  9377.    additional information about what I/O can be performed on the set of
  9378.    pipes.
  9379.  
  9380.  See Also
  9381.  
  9382.    DosMuxSemWait, DosQNmPipeSemState, DosSemWait
  9383.  
  9384.  
  9385.  ────────────────────────────────────────────────────────────────────────────
  9386.  DosSetProcCp
  9387.  ────────────────────────────────────────────────────────────────────────────
  9388.    USHORT DosSetProcCp (usCodePage, usReserved)
  9389.    USHORT usCodePage;      /*code-page identifier                          */
  9390.    USHORT usReserved;      /*must be zero                                  */
  9391.  
  9392.    The DosSetProcCp function allows a process to set its code page.
  9393.  
  9394.  Parameters
  9395.  
  9396.    usCodePage  Specifies a code-page-identifier word that has one of the
  9397.    following values:
  9398.  
  9399.    Number      Code page
  9400.    ──────────────────────────────────────────────────────────────────────────
  9401.    437         United States
  9402.  
  9403.    850         Multilingual
  9404.  
  9405.    860         Portuguese
  9406.  
  9407.    863         French-Canadian
  9408.  
  9409.    865         Nordic
  9410.    ──────────────────────────────────────────────────────────────────────────
  9411.  
  9412.    usReserved  Specifies a reserved value; must be zero.
  9413.  
  9414.  Comments
  9415.  
  9416.    This function sets the process code page of the calling process. The code
  9417.    page of a process is used in three ways. First, the printer code page is
  9418.    set to the process code page through the file system and Printer spooler
  9419.    (the system spooler must be installed) when the process makes a request to
  9420.    open the printer. Calling DosSetProcCp does not affect the code page of a
  9421.    printer opened before the call, nor does it affect the code page of a
  9422.    printer opened by another process. Second, country-dependent information
  9423.    will, by default, be retrieved encoded in the code page of the calling
  9424.    process. Third, a newly created process inherits its process code page
  9425.    from its parent process.
  9426.  
  9427.    DosSetProcCp does not affect the screen or keyboard code page.
  9428.  
  9429.  See Also
  9430.  
  9431.    DosSetCp
  9432.  
  9433.  
  9434.  ────────────────────────────────────────────────────────────────────────────
  9435.  DosSetPrty
  9436.  ────────────────────────────────────────────────────────────────────────────
  9437.    USHORT DosSetPrty (fScope, fPrtyClass, sChange, id)
  9438.    USHORT fScope;          /*indicates the scope of change                 */
  9439.    USHORT fPrtyClass;      /*priority class to set                         */
  9440.    SHORT sChange;          /*change in priority level                      */
  9441.    USHORT id;              /*process or thread identifier                  */
  9442.  
  9443.    The DosSetPrty function sets the scheduling priority of the specified
  9444.    process or thread by changing the priority class and/or the priority
  9445.    level.
  9446.  
  9447.    Within each class, a thread's priority level may vary──either through
  9448.    system action or through the DosSetPrty function. The system changes a
  9449.    thread's priority levels based on that thread's actions and the overall
  9450.    system activity.
  9451.  
  9452.  Parameters
  9453.  
  9454.    fScope  Specifies the scope of the request. This parameter can be one of
  9455.    the following values:
  9456.  
  9457.    Value                 Meaning
  9458.    ──────────────────────────────────────────────────────────────────────────
  9459.    PRTYS_PROCESS         Priority for the process and all its threads.
  9460.  
  9461.    PRTYS_PROCESSTREE     Priority for the process and all child processes.
  9462.  
  9463.    PRTYS_THREAD          Priority for one thread in the current process.
  9464.    ──────────────────────────────────────────────────────────────────────────
  9465.  
  9466.    fPrtyClass  Specifies the priority class of a process or thread. This
  9467.    parameter can be one of the following values:
  9468.  
  9469.    Value                 Meaning
  9470.    ──────────────────────────────────────────────────────────────────────────
  9471.    PRTYC_IDLETIME        Idle-time.
  9472.  
  9473.    PRTYC_NOCHANGE        No change; leave as is.
  9474.  
  9475.    PRTYC_REGULAR         Regular.
  9476.  
  9477.    PRTYC_TIMECRITICAL    Time-critical.
  9478.    ──────────────────────────────────────────────────────────────────────────
  9479.  
  9480.    sChange  Specifies the relative change in the current priority level of
  9481.    the process or thread. This parameter can be any value from -31 through
  9482.    +31, or the constants PRTYD_MINIMUM or PRTYD_MAXIMUM, which specify the
  9483.    minimum and maximum change allowed.
  9484.  
  9485.    id  Specifies a process or thread identifier, depending on the value of
  9486.    the fScope parameter.
  9487.  
  9488.  Return Value
  9489.  
  9490.    The return value is zero if the function is successful. Otherwise, it is
  9491.    an error value, which may be one of the following:
  9492.  
  9493.          ERROR_INVALID_PCLASS
  9494.          ERROR_INVALID_PDELTA
  9495.          ERROR_INVALID_PROCID
  9496.          ERROR_INVALID_SCOPE
  9497.          ERROR_INVALID_THREADID
  9498.          ERROR_NOT_DESCENDANT
  9499.  
  9500.  See Also
  9501.  
  9502.    DosEnterCritSec, DosGetInfoSeg, DosGetPrty
  9503.  
  9504.  
  9505.  ────────────────────────────────────────────────────────────────────────────
  9506.  DosSetSession
  9507.  ────────────────────────────────────────────────────────────────────────────
  9508.    USHORT DosSetSession (idSession, pstsdata)
  9509.    USHORT idSession;       /*session identifier                            */
  9510.    PSTATUSDATA pstsdata;   /*prior to structure for session-status data    */
  9511.  
  9512.    The DosSetSession function sets the status of a child session.
  9513.  
  9514.  Parameters
  9515.  
  9516.    idSession  Specifies the identifier of the session for which the status is
  9517.    set. This identifier must have been created previously by using the
  9518.    DosStartSession function.
  9519.  
  9520.    pstsdata  Points to a STATUSDATA structure that contains the
  9521.    session-status data. The STATUSDATA structure has the following form:
  9522.  
  9523.    typedef struct _STATUSDATA {
  9524.        USHORT Length;
  9525.        USHORT SelectInd;
  9526.        USHORT BindInd;
  9527.    } STATUSDATA;
  9528.  
  9529.    For a full description, see Chapter 4, "Types, Macros, Structures."
  9530.  
  9531.  Return Value
  9532.  
  9533.    The return value is zero if the function is successful. Otherwise, it is
  9534.    an error value.
  9535.  
  9536.  Comments
  9537.  
  9538.    The DosSetSession function allows a parent session to use the SelectInd
  9539.    and BindInd fields of the STATUSDATA structure to specify whether the
  9540.    child session can be selected by the user and whether or not the child
  9541.    session will also be brought to the foreground when the user brings the
  9542.    parent session to the foreground. These fields affect selections made by
  9543.    the user from the switch list; they do not affect selections made by the
  9544.    parent session. Each of these fields can be set individually, without
  9545.    affecting the current setting of the other.
  9546.  
  9547.    A parent session can call the DosSetSession function only for a child
  9548.    session; neither the parent session itself nor any second-level child
  9549.    session can be set by using this function. The DosSetSession function can
  9550.    change the status of a child session only if that child was started as a
  9551.    related session; DosSetSession cannot change the status of sessions that
  9552.    were started as independent sessions.
  9553.  
  9554.    A bond between a parent session and a child session can be broken by
  9555.    calling the DosSetSession function and specifying either BindInd = 2 to
  9556.    break the bond, or BindInd = 1 to break the bond and establish a new bond
  9557.    with a different child session.
  9558.  
  9559.    A child session that is bound to a parent session will be brought to the
  9560.    foreground when the user selects the parent session, even if the status of
  9561.    the child session is nonselectable. If there is a bond between a parent
  9562.    session and a child session, and another bond between that child and a
  9563.    second-level child session, the second-level child session will be brought
  9564.    to the foreground when the user selects the parent session.
  9565.  
  9566.    A parent session may be running in either the foreground or the background
  9567.    when DosSetSession is called.
  9568.  
  9569.    The DosSetSession function may be called only by the process that started
  9570.    the session identified by the idSession parameter.
  9571.  
  9572.  See Also
  9573.  
  9574.    DosSelectSession, DosStartSession, DosStopSession
  9575.  
  9576.  
  9577.  ────────────────────────────────────────────────────────────────────────────
  9578.  DosSetSigHandler
  9579.  ────────────────────────────────────────────────────────────────────────────
  9580.    USHORT DosSetSigHandler (pfnSigHandler, pfnPrev, pfAction, fAction,
  9581.    usSigNumber)
  9582.    PFNSIGHANDLER pfnSigHandler;
  9583.                            /*pointer to signal-handler function            */
  9584.    PFNSIGHANDLER FAR * pfnPrev;
  9585.                            /*pointer to previous handler address           */
  9586.    PUSHORT pfAction;       /*pointer to variable for previous handler      */
  9587.                            /*action                                        */
  9588.    USHORT fAction;         /*type of request                               */
  9589.    USHORT usSigNumber;     /*signal number                                 */
  9590.  
  9591.    The DosSetSigHandler function installs or removes a signal handler for a
  9592.    specified signal. This function can also be used to ignore a signal or
  9593.    install a default action for a signal.
  9594.  
  9595.    The DosSetSigHandler function is a family API function.
  9596.  
  9597.  Parameters
  9598.  
  9599.    pfnSigHandler  Points to the address of the signal-handler function that
  9600.    receives control when a given signal occurs. For a full description, see
  9601.    the following "Comments" section.
  9602.  
  9603.    pfnPrev  Points to the variable that receives the address of the previous
  9604.    signal handler.
  9605.  
  9606.    pfAction  Points to the variable that receives the value of the previous
  9607.    signal handler's fAction parameter. The pfAction parameter can be a value
  9608.    from 0 through 3.
  9609.  
  9610.    fAction  Specifies the type of request. This parameter can be one of the
  9611.    following values:
  9612.  
  9613.    Value             Meaning
  9614.    ──────────────────────────────────────────────────────────────────────────
  9615.    SIGA_ACCEPT       The signal handler specified in the pfnSigHandler
  9616.                      parameter will accept the signal specified in the
  9617.                      usSigNumber parameter.
  9618.  
  9619.    SIGA_ACKNOWLEDGE  The signal specified in the usSigNumber parameter is
  9620.                      acknowledged. The signal handler specified in the
  9621.                      pfnSigHandler parameter will accept the signal.
  9622.  
  9623.    SIGA_ERROR        It is an error for any other process to signal this
  9624.                      process with the signal specified in the usSigNumber
  9625.                      parameter.
  9626.  
  9627.    SIGA_IGNORE       Ignore the signal.
  9628.  
  9629.    SIGA_KILL         Remove the signal handler.
  9630.    ──────────────────────────────────────────────────────────────────────────
  9631.  
  9632.    usSigNumber  Specifies the signal number. This parameter can be one of the
  9633.    following values:
  9634.  
  9635.    Value             Meaning
  9636.    ──────────────────────────────────────────────────────────────────────────
  9637.    SIG_BROKENPIPE    Connection to a pipe was broken.
  9638.  
  9639.    SIG_CTRLBREAK     CTRL+BREAK.
  9640.  
  9641.    SIG_CTRLC         CTRL+C.
  9642.  
  9643.    SIG_KILLPROCESS   Program terminated.
  9644.  
  9645.    SIG_PFLG_A        Process flag A.
  9646.  
  9647.    SIG_PFLG_B        Process flag B.
  9648.  
  9649.    SIG_PFLG_C        Process flag C.
  9650.    ──────────────────────────────────────────────────────────────────────────
  9651.  
  9652.  Return Value
  9653.  
  9654.    The return value is zero if the function is successful. Otherwise, it is
  9655.    an error value, which may be one of the following:
  9656.  
  9657.          ERROR_INVALID_FUNCTION
  9658.          ERROR_INVALID_SIGNAL_NUMBER
  9659.  
  9660.  Comments
  9661.  
  9662.    The DosSetSigHandler function installs the signal handler that the system
  9663.    will call whenever the corresponding signal occurs. The signal handler is
  9664.    a function that responds to a signal by carrying out tasks (such as
  9665.    cleaning up files). A signal is an action initiated by the user or another
  9666.    process that temporarily suspends execution of the process while the
  9667.    signal is processed. Signals occur when the user presses the CTRL+C or
  9668.    CTRL+BREAK key sequences, when the process ends, or when another process
  9669.    calls the DosFlagProcess function. By default, the CTRL+C,
  9670.    CTRL+BREAK, and end-of-process signals terminate the process.
  9671.  
  9672.    The signal-handler function can use the address and fAction parameter
  9673.    value of the previous signal handler to pass the signal through a chain of
  9674.    previous signal handlers. The new signal handler can also use the previous
  9675.    address and fAction value to restore the previous handler.
  9676.  
  9677.    The DosSetSigHandler function acknowledges a signal and reenables it for
  9678.    subsequent input if the fAction parameter is set to SIGA_ACKNOWLEDGE. A
  9679.    process must acknowledge the signal while processing it to permit the
  9680.    signal to be used again.
  9681.  
  9682.    The signal handler has the following form:
  9683.  
  9684.    VOID PASCAL FAR FuncName(usSigArg, usSigNum)
  9685.    USHORT usSigArg;    /* furnished by DosFlagProcess if appropriate */
  9686.    USHORT usSigNum;    /* signal number being processed              */
  9687.    {
  9688.        .
  9689.        .
  9690.        .
  9691.        return;
  9692.    }
  9693.  
  9694.    Parameters Description
  9695.    ──────────────────────────────────────────────────────────────────────────
  9696.    usSigArg   Specifies the signal argument passed by the process that sends
  9697.               the process-flag signal.
  9698.  
  9699.    usSigNum   Specifies the signal number. This parameter can be any of the
  9700.               values listed for the usSigNumber parameter of the
  9701.               DosSetSigHandler function.
  9702.    ──────────────────────────────────────────────────────────────────────────
  9703.  
  9704.    When a signal occurs, the system calls the corresponding signal handler,
  9705.    which then carries out tasks, such as displaying a message and writing and
  9706.    closing files. The signal handler receives control under the first thread
  9707.    of a process (thread 1). The thread that was executing when the signal
  9708.    occurred waits for signal processing to be completed. The signal handler
  9709.    can use the return statement to return control and restore execution of
  9710.    the waiting thread or the DosExit function to terminate the process.
  9711.  
  9712.    The signal handler is not suspended when the DosEnterCritSec function is
  9713.    called. If a signal occurs, the processing done by the signal handler must
  9714.    not interfere with the processing that is done by the thread calling the
  9715.    DosEnterCritSec function.
  9716.  
  9717.    All registers other than cs, ip, ss, sp, and flags in assembly-language
  9718.    signal handlers contain the same values as when the signal was received.
  9719.    The signal handler may exit by executing a far return instruction;
  9720.    execution resumes where it was interrupted, and all registers are restored
  9721.    to their values at the time of the interruption.
  9722.  
  9723.  Restrictions
  9724.  
  9725.    In real mode, the following restriction applies to the DosSetSigHandler
  9726.    function:
  9727.  
  9728.    ■  Only the signal-break (SIG_CTRLBREAK) and signal-interrupt (SIG_CTRLC)
  9729.       signals are available. DosSetSigHandler may be used to install signal
  9730.       handlers for only these two signals.
  9731.  
  9732.  See Also
  9733.  
  9734.    DosCreateThread, DosFlagProcess, DosHoldSignal
  9735.  
  9736.  
  9737.  ────────────────────────────────────────────────────────────────────────────
  9738.  DosSetVec
  9739.  ────────────────────────────────────────────────────────────────────────────
  9740.    USHORT DosSetVec (usVecNum, pfnFunction, ppfnPrev)
  9741.    USHORT usVecNum;        /*type of exception                             */
  9742.    PFN pfnFunction;        /*pointer to function                           */
  9743.    PPFN ppfnPrev;          /*pointer to variable for previous function's   */
  9744.                            /*address                                       */
  9745.  
  9746.    The DosSetVec function installs or removes an exception handler for a
  9747.    specified exception. An exception is a program error, such as division by
  9748.    zero, that causes the system to pass control to the exception handler. The
  9749.    exception handler is an assembly-language routine that corrects errors or
  9750.    cleans up programs before terminating. The system calls the exception
  9751.    handler whenever the specified exception occurs. If a process does not
  9752.    install its own exception handler, the default exception handler
  9753.    terminates the process when an exception occurs.
  9754.  
  9755.    The DosSetVec function is a family API function.
  9756.  
  9757.  Parameters
  9758.  
  9759.    usVecNum  Specifies the number of the exception vector. This parameter can
  9760.    be one of the following values:
  9761.  
  9762.    Value                       Meaning
  9763.    ──────────────────────────────────────────────────────────────────────────
  9764.    VECTOR_DIVIDE_BY_ZERO       Division by zero
  9765.  
  9766.    VECTOR_EXTENSION_ERROR      Processor extension error
  9767.  
  9768.    VECTOR_INVALIDOPCODE        Invalid opcode
  9769.  
  9770.    VECTOR_NO_EXTENSION         Processor extension not available
  9771.  
  9772.    VECTOR_OUTOFBOUNDS          Out of bounds
  9773.  
  9774.    VECTOR_OVERFLOW             Overflow
  9775.    ──────────────────────────────────────────────────────────────────────────
  9776.  
  9777.    pfnFunction  Points to the address of the exception handler that receives
  9778.    control when the specified exception occurs. If this parameter is zero,
  9779.    the DosSetVec function removes the current exception handler. For a full
  9780.    description, see the following "Comments" section.
  9781.  
  9782.    ppfnPrev  Points to the variable that receives the address of the previous
  9783.    exception handler. The new exception handler can use this address to chain
  9784.    exception handling through all previous handlers or to restore the
  9785.    previous exception handler.
  9786.  
  9787.  Return Value
  9788.  
  9789.    The return value is zero if the function is successful. Otherwise, it is
  9790.    an error value, which may be the following:
  9791.  
  9792.          ERROR_INVALID_FUNCTION
  9793.  
  9794.  Comments
  9795.  
  9796.    When the system calls the exception handler, interrupts are enabled and
  9797.    the machine status word and far return address are pushed on the stack. If
  9798.    the exception handler returns, it must use the iret (return from
  9799.    interrupt) instruction.
  9800.  
  9801.    If the DosSetVec function is used to install an exception handler for
  9802.    vector VECTOR_EXTENSION_ERROR (processor extension not available), the
  9803.    function sets the machine status word (MSW) to indicate that no 80287 is
  9804.    available. The emulate bit is set and the monitor processor bit is
  9805.    cleared. (This is done without regard for the true state of the hardware.)
  9806.    If the DosSetVec function is used to remove the exception handler for
  9807.    VECTOR_EXTENSION_ERROR, the function sets the machine status word to
  9808.    reflect the true state of the hardware.
  9809.  
  9810.  Restrictions
  9811.  
  9812.    In real mode, the following restriction applies to the DosSetVec function:
  9813.  
  9814.    ■  Since the 8086 amd 8088 microprocessors do not raise this exception,
  9815.       usVecNum may not be VECTOR_EXTENSION_ERROR.
  9816.  
  9817.  See Also
  9818.  
  9819.    DosDevConfig, DosError
  9820.  
  9821.  
  9822.  ────────────────────────────────────────────────────────────────────────────
  9823.  DosSetVerify
  9824.  ────────────────────────────────────────────────────────────────────────────
  9825.    USHORT DosSetVerify (fVerify)
  9826.    USHORT fVerify;         /*verify on/off                                 */
  9827.  
  9828.    The DosSetVerify function enables or disables data verification. When
  9829.    verification is enabled, the system verifies that data is written
  9830.    correctly whenever a process writes to a disk file.
  9831.  
  9832.    The DosSetVerify function is a family API function.
  9833.  
  9834.  Parameters
  9835.  
  9836.    fVerify  Specifies whether data verification is enabled. If the fVerify
  9837.    parameter is TRUE, verification is enabled. If it is FALSE, verification
  9838.    is disabled.
  9839.  
  9840.  Return Value
  9841.  
  9842.    The return value is zero if the function is successful. Otherwise, it is
  9843.    an error value, which may be the following:
  9844.  
  9845.          ERROR_INVALID_VERIFY_SWITCH
  9846.  
  9847.  Comments
  9848.  
  9849.    Errors when writing to a disk file are very rare. This DosSetVerify
  9850.    function allows a process to verify the proper recording of critical data.
  9851.  
  9852.  See Also
  9853.  
  9854.    DosQVerify
  9855.  
  9856.  
  9857.  ────────────────────────────────────────────────────────────────────────────
  9858.  DosSizeSeg
  9859.  ────────────────────────────────────────────────────────────────────────────
  9860.    USHORT DosSizeSeg (sel, pulSize)
  9861.    SEL sel;                /*segment selector                              */
  9862.    PULONG pulSize;         /*receives segment size                         */
  9863.  
  9864.    The DosSizeSeg function retrieves the size (in bytes) of a specified
  9865.    segment.
  9866.  
  9867.    The DosSizeSeg function is a family API function.
  9868.  
  9869.  Parameters
  9870.  
  9871.    sel  Specifies the selector of the segment. For huge segments, this must
  9872.    be the base selector.
  9873.  
  9874.    pulSize  Points to the variable that receives the segment size (in bytes).
  9875.    (For huge segments, the number of full segments will be in the high word,
  9876.    and the size of the last segment will be in the low word. These values are
  9877.    equivalent to the values of the usNumSeg and usPartialSeg parameters that
  9878.    were passed to the DosAllocHuge or DosReallocHuge function.)
  9879.  
  9880.  Return Value
  9881.  
  9882.    The return value is zero if the function is successful. Otherwise, it is
  9883.    an error value.
  9884.  
  9885.  See Also
  9886.  
  9887.    DosAllocHuge, DosAllocSeg, DosReallocHuge
  9888.  
  9889.  
  9890.  ────────────────────────────────────────────────────────────────────────────
  9891.  DosSleep
  9892.  ────────────────────────────────────────────────────────────────────────────
  9893.    USHORT DosSleep (ulTime)
  9894.    ULONG ulTime;           /*number of milliseconds to wait                */
  9895.  
  9896.    The DosSleep function causes the current thread to wait for a specified
  9897.    interval or, if the specified interval is zero, to give up the remainder
  9898.    of the current time slice.
  9899.  
  9900.    The DosSleep function is a family API function.
  9901.  
  9902.  Parameters
  9903.  
  9904.    ulTime  Specifies the number of milliseconds that the thread waits. This
  9905.    value is rounded up to the next clock tick.
  9906.  
  9907.  Return Value
  9908.  
  9909.    The return value is zero if the function is successful. Otherwise, it is
  9910.    an error value, which may be the following:
  9911.  
  9912.          ERROR_TS_WAKEUP
  9913.  
  9914.  Comments
  9915.  
  9916.    The time the thread waits can be different from the specified time by a
  9917.    clock tick or two, depending on the execution status of the other threads
  9918.    running in the system. If the specified interval is zero, the process
  9919.    forgoes the remainder of its CPU time slice but is scheduled normally for
  9920.    its next time slice. When a process continues after suspension, its
  9921.    scheduled execution time could be delayed by hardware interrupts or by
  9922.    another thread running at a higher priority. If the time interval is not
  9923.    zero it is given in milliseconds, which are rounded up to the resolution
  9924.    of the scheduler clock. The DosSleep function should not be substituted
  9925.    for a real-time clock, because the rounding of the wait interval will
  9926.    cause inaccuracies to accumulate.
  9927.  
  9928.  Example
  9929.  
  9930.    This example sets up a loop that waits for one second and then retrieves
  9931.    the time and date:
  9932.  
  9933.    DATETIME date;
  9934.    for (;;) {
  9935.        DosSleep(1000L);         /* waits for one second        */
  9936.        DosGetDateTime(&date);   /* retrieves the time and date */
  9937.        .
  9938.        .
  9939.        .
  9940.    }
  9941.  
  9942.  See Also
  9943.  
  9944.    DosGetInfoSeg, DosTimerAsync, DosTimerStart
  9945.  
  9946.  
  9947.  ────────────────────────────────────────────────────────────────────────────
  9948.  DosStartSession
  9949.  ────────────────────────────────────────────────────────────────────────────
  9950.    USHORT DosStartSession (pstdata, pidSession, ppid)
  9951.    PSTARTDATA pstdata;     /*pointer to structure containing session data  */
  9952.    PUSHORT pidSession;     /*pointer to variable for session identifier    */
  9953.    PUSHORT ppid;           /*pointer to variable for process identifier    */
  9954.  
  9955.    The DosStartSession function starts a session (screen group) and specifies
  9956.    the name of the program to start in that session. This function creates
  9957.    either an independent session or a child session, depending on the value
  9958.    of the Related field in the STARTDATA structure.
  9959.  
  9960.  Parameters
  9961.  
  9962.    pstdata  Points to the STARTDATA structure that contains data describing
  9963.    the session to start. The STARTDATA structure has the following form:
  9964.  
  9965.    typedef struct _STARTDATA {
  9966.        USHORT Length;
  9967.        USHORT Related;
  9968.        USHORT FgBg;
  9969.        USHORT TraceOpt;
  9970.        PSZ    PgmTitle;
  9971.        PSZ    PgmName;
  9972.        PBYTE  PgmInputs;
  9973.        PBYTE  TermQ;
  9974.        PBYTE  Environment;
  9975.        USHORT InheritOpt;
  9976.        USHORT SessionType;
  9977.        PSZ    IconFile;
  9978.        ULONG  PgmHandle;
  9979.        USHORT PgmControl;
  9980.        USHORT InitXPos;
  9981.        USHORT InitYPos;
  9982.        USHORT InitXSize;
  9983.        USHORT InitYSize;
  9984.    } STARTDATA;
  9985.  
  9986.    For a full description, see Chapter 4, "Types, Macros, Structures."
  9987.  
  9988.    pidSession  Points to the variable that receives the identifier of the
  9989.    child session.
  9990.  
  9991.    ppid  Points to the variable that receives the process identifier of the
  9992.    child process.
  9993.  
  9994.  Return Value
  9995.  
  9996.    The return value is zero if the function is successful. Otherwise, it is
  9997.    an error value.
  9998.  
  9999.  Comments
  10000.  
  10001.    The MS OS/2 session manager writes a data element into the specified queue
  10002.    when the child session created by the DosStartSession function terminates.
  10003.    A parent session can be notified when a child session has terminated by
  10004.    using the DosReadQueue function. When the child session terminates, the
  10005.    request value returned by DosReadQueue is zero, and the data-element
  10006.    format consists of two unsigned values: the session identifier and the
  10007.    result code.
  10008.  
  10009.    Only the process that calls the DosStartSession function should call the
  10010.    DosReadQueue function. Only this process can address the notification data
  10011.    element. After reading and processing the data element, the calling
  10012.    process must use the DosFreeSeg function to free the segment that contains
  10013.    the data element.
  10014.  
  10015.    A child session is created when the Related field of the STARTDATA
  10016.    structure is set to TRUE. The process identifier of the child process
  10017.    cannot be used with MS OS/2 functions, such as DosSetPrty, that require a
  10018.    parent process/child process relationship.
  10019.  
  10020.    An independent session is created when the Related field of the STARTDATA
  10021.    structure is set to TRUE. An independent session is not under the control
  10022.    of the starting session. The DosStartSession function does not copy
  10023.    session and process identifiers for an independent session to the
  10024.    pidSession and ppid parameters.
  10025.  
  10026.    New sessions can be started in the foreground only when the caller's
  10027.    session (or one of the caller's descendant sessions) is currently
  10028.    executing in the foreground. The new session appears in the shell switch
  10029.    list.
  10030.  
  10031.  See Also
  10032.  
  10033.    DosCreateQueue, DosExecPgm, DosFreeSeg, DosReadQueue,
  10034.    DosSelectSession, DosSetSession, DosStopSession
  10035.  
  10036.  
  10037.  ────────────────────────────────────────────────────────────────────────────
  10038.  DosStopSession
  10039.  ────────────────────────────────────────────────────────────────────────────
  10040.    USHORT DosStopSession (fScope, idSession, ulReserved)
  10041.    USHORT fScope;          /*all sessions/specified session stopped        */
  10042.    USHORT idSession;       /*session identifier                            */
  10043.    ULONG ulReserved;       /*must be zero                                  */
  10044.  
  10045.    The DosStopSession function terminates a session that was started by using
  10046.    the DosStartSession function.
  10047.  
  10048.  Parameters
  10049.  
  10050.    fScope  Specifies whether the function stops all sessions or only the
  10051.    specified session. If the fScope parameter is 0x0000, the function stops
  10052.    only the specified session. If it is 0x0001, the function stops all
  10053.    sessions.
  10054.  
  10055.    idSession  Specifies the identifier of the session to be stopped. This
  10056.    identifier must have been created previously by using the DosStartSession
  10057.    function. This parameter is ignored if the fScope parameter is set to
  10058.    0x0001.
  10059.  
  10060.    ulReserved  Specifies a reserved value; must be zero.
  10061.  
  10062.  Return Value
  10063.  
  10064.    The return value is zero if the function is successful. Otherwise, it is
  10065.    an error value.
  10066.  
  10067.  Comments
  10068.  
  10069.    The DosStopSession function can terminate only child sessions that were
  10070.    started by using the DosStartSession function (child sessions of the
  10071.    terminated session will terminate as well). Sessions that were started as
  10072.    independent sessions cannot be terminated by using DosStopSession.
  10073.  
  10074.    A parent session can be running in either the foreground or the background
  10075.    when DosStopSession is issued. If a child session is in the foreground
  10076.    when it is stopped, the parent session becomes the foreground session. The
  10077.    DosStopSession function breaks any bond between the parent session and the
  10078.    specified child session.
  10079.  
  10080.    A process running in the session specified by the idSession parameter can
  10081.    refuse to terminate. If this happens, DosStopSession returns zero. To
  10082.    verify that the target session has terminated, a process can wait for
  10083.    notification through the termination queue that is specified in the
  10084.    DosStartSession function.
  10085.  
  10086.  See Also
  10087.  
  10088.    DosSetSession, DosStartSession
  10089.  
  10090.  
  10091.  ────────────────────────────────────────────────────────────────────────────
  10092.  DosSubAlloc
  10093.  ────────────────────────────────────────────────────────────────────────────
  10094.    USHORT DosSubAlloc (sel, pusOffset, cbBlock)
  10095.    SEL sel;                /*segment selector                              */
  10096.    PUSHORT pusOffset;      /*pointer to variable for offset                */
  10097.    USHORT cbBlock;         /*number of bytes of requested memory           */
  10098.  
  10099.    The DosSubAlloc function allocates memory in a segment that was allocated
  10100.    previously by using the DosAllocSeg or DosAllocShrSeg function and that
  10101.    was initialized by using the DosSubSet function.
  10102.  
  10103.    The DosSubAlloc function is a family API function.
  10104.  
  10105.  Parameters
  10106.  
  10107.    sel  Specifies the selector of the data segment in which the memory should
  10108.    be allocated.
  10109.  
  10110.    pusOffset  Points to the variable that receives the offset to the
  10111.    allocated block.
  10112.  
  10113.    cbBlock  Specifies the size (in bytes) of the requested memory block.
  10114.  
  10115.  Return Value
  10116.  
  10117.    The return value is zero if the function is successful. Otherwise, it is
  10118.    an error value, which may be one of the following:
  10119.  
  10120.          ERROR_DOSSUB_BADSIZE
  10121.          ERROR_DOSSUB_NOMEM
  10122.  
  10123.  Comments
  10124.  
  10125.    The cbBlock parameter must not be greater than the maximum size of the
  10126.    segment minus 8 bytes. Since all memory blocks are aligned on byte
  10127.    boundaries, the cbBlock parameter does not need to be a multiple of 16.
  10128.  
  10129.  See Also
  10130.  
  10131.    DosAllocSeg, DosAllocShrSeg, DosSubFree, DosSubSet
  10132.  
  10133.  
  10134.  ────────────────────────────────────────────────────────────────────────────
  10135.  DosSubFree
  10136.  ────────────────────────────────────────────────────────────────────────────
  10137.    USHORT DosSubFree (sel, offBlock, cbBlock)
  10138.    SEL sel;                /*segment selector                              */
  10139.    USHORT offBlock;        /*block offset                                  */
  10140.    USHORT cbBlock;         /*number of bytes in block to free              */
  10141.  
  10142.    The DosSubFree function frees memory that was allocated previously by
  10143.    using the DosSubAlloc function.
  10144.  
  10145.    The DosSubFree function is a family API function.
  10146.  
  10147.  Parameters
  10148.  
  10149.    sel  Specifies the selector of the data segment from which the memory
  10150.    should be freed.
  10151.  
  10152.    offBlock  Specifies the offset of the memory block to be freed. This
  10153.    offset must have been created previously by using the DosSubAlloc
  10154.    function.
  10155.  
  10156.    cbBlock  Specifies the size (in bytes) of the block to free.
  10157.  
  10158.  Return Value
  10159.  
  10160.    The return value is zero if the function is successful. Otherwise, it is
  10161.    an error value, which may be one of the following:
  10162.  
  10163.          ERROR_DOSSUB_BADSIZE
  10164.          ERROR_DOSSUB_OVERLAP
  10165.  
  10166.  See Also
  10167.  
  10168.    DosAllocSeg, DosSubAlloc, DosSubSet
  10169.  
  10170.  
  10171.  ────────────────────────────────────────────────────────────────────────────
  10172.  DosSubSet
  10173.  ────────────────────────────────────────────────────────────────────────────
  10174.    USHORT DosSubSet (sel, fFlags, cbSeg)
  10175.    SEL sel;                /*segment selector                              */
  10176.    USHORT fFlags;          /*initialize/increase size of segment           */
  10177.    USHORT cbSeg;           /*new size of block                             */
  10178.  
  10179.    The DosSubSet function initializes a segment for suballocation or changes
  10180.    the size of a previously initialized segment.
  10181.  
  10182.    The DosSubSet function is a family API function.
  10183.  
  10184.  Parameters
  10185.  
  10186.    sel  Specifies the selector of the data segment.
  10187.  
  10188.    fFlags  Specifies whether to initialize the segment or increase its size.
  10189.    If the fFlags parameter is 0x0001, the function initializes the segment.
  10190.    If fFlags is 0x0000, the function changes the size of the segment.
  10191.  
  10192.    cbSeg  Specifies the new size (in bytes) of the segment.
  10193.  
  10194.  Return Value
  10195.  
  10196.    The return value is zero if the function is successful. Otherwise, it is
  10197.    an error value, which may be one of the following:
  10198.  
  10199.          ERROR_DOSSUB_BADFLAG
  10200.          ERROR_DOSSUB_BADSIZE
  10201.          ERROR_DOSSUB_SHRINK
  10202.  
  10203.  Comments
  10204.  
  10205.    If the fFlags parameter is 0x0001, the DosSubSet function initializes the
  10206.    segment so that the DosSubAlloc function can be used to allocate memory
  10207.    blocks in the segment. The segment must have been allocated previously by
  10208.    using the DosAllocSeg or DosAllocShrSeg function.
  10209.  
  10210.    If the fFlags parameter is 0x0000, the DosSubSet function changes the size
  10211.    of the segment to the number of bytes specified by the cbSeg parameter. If
  10212.    the specified size is greater than the current size of the segment, the
  10213.    DosReallocSeg function must be called before DosSubSet. If DosSubSet is
  10214.    not called after changing the size of a segment by using DosReallocSeg,
  10215.    the results can be unpredictable.
  10216.  
  10217.    When changing the size of a segment by using the DosSubSet function, the
  10218.    cbSeg parameter must be a multiple of 4 bytes that is greater than or
  10219.    equal to 12 bytes, or it must be zero. Otherwise, the size is rounded up
  10220.    to the next multiple of 4. In the DosSubSet function, setting the cbSeg
  10221.    parameter to zero indicates that the segment is 64K, but in the
  10222.    DosSubAlloc and DosSubFree functions, it is an error when the cbSeg
  10223.    parameter is equal to zero.
  10224.  
  10225.  See Also
  10226.  
  10227.    DosAllocSeg, DosAllocShrSeg, DosReallocSeg, DosSubAlloc, DosSubFree
  10228.  
  10229.  
  10230.  ────────────────────────────────────────────────────────────────────────────
  10231.  DosSuspendThread
  10232.  ────────────────────────────────────────────────────────────────────────────
  10233.    USHORT DosSuspendThread (tid)
  10234.    TID tid;                /*identifier of thread to suspend               */
  10235.  
  10236.    The DosSuspendThread function suspends the execution of a thread until a
  10237.    call to the DosResumeThread function is made that specifies the suspended
  10238.    thread's identifier.
  10239.  
  10240.  Parameters
  10241.  
  10242.    tid  Specifies the thread identifier of the thread to be suspended.
  10243.  
  10244.  Return Value
  10245.  
  10246.    The return value is zero if the function is successful. Otherwise, it is
  10247.    an error value, which may be the following:
  10248.  
  10249.          ERROR_INVALID_THREADID
  10250.  
  10251.  Comments
  10252.  
  10253.    The specified thread may not be suspended immediately if it has called a
  10254.    system function that has locked some system resources; the locked
  10255.    resources must be freed before the thread is suspended. The thread will
  10256.    not continue to execute until a DosResumeThread function is called.
  10257.  
  10258.    A thread can suspend threads only within its process.
  10259.  
  10260.  See Also
  10261.  
  10262.    DosCreateThread, DosEnterCritSec, DosResumeThread
  10263.  
  10264.  
  10265.  ────────────────────────────────────────────────────────────────────────────
  10266.  DosTimerAsync
  10267.  ────────────────────────────────────────────────────────────────────────────
  10268.    USHORT DosTimerAsync (ulTime, hsem, phtimer)
  10269.    ULONG ulTime;           /*time before semaphore is cleared              */
  10270.    HSEM hsem;              /*system-semaphore handle                       */
  10271.    PHTIMER phtimer;        /*pointer to variable for timer handle          */
  10272.  
  10273.    The DosTimerAsync function creates a timer that counts for a specified
  10274.    number of milliseconds, then clears a specified semaphore.
  10275.  
  10276.  Parameters
  10277.  
  10278.    ulTime  Specifies the time (in milliseconds) before the semaphore is
  10279.    cleared. This value is rounded up to the next clock tick, if necessary.
  10280.  
  10281.    hsem  Identifies the system semaphore that signals the end of the timer.
  10282.    This handle must have been created previously by using the DosCreateSem
  10283.    function.
  10284.  
  10285.    phtimer  Points to the variable that receives the timer handle.
  10286.  
  10287.  Return Value
  10288.  
  10289.    The return value is zero if the function is successful. Otherwise, it is
  10290.    an error value, which may be one of the following:
  10291.  
  10292.          ERROR_TS_NOTIMER
  10293.          ERROR_TS_SEMHANDLE
  10294.  
  10295.  Comments
  10296.  
  10297.    The timer runs asynchronously──that is, while the timer counts the time,
  10298.    the DosTimerAsync function returns to let the process continue to execute
  10299.    other tasks. The timer counts the time only once.
  10300.  
  10301.    The given semaphore must be a system semaphore. If the process uses the
  10302.    semaphore to determine when data is available, it must use the DosSemSet
  10303.    function to set the semaphore before calling the DosTimerAsync function.
  10304.  
  10305.    The timer handle specified by the phtimer parameter can be used by the
  10306.    DosTimerStop function to cancel the timer.
  10307.  
  10308.    The DosTimerAsync function is similar to the DosSleep function except that
  10309.    DosTimerAsync returns immediately; DosSleep returns only after the
  10310.    specified time has elapsed.
  10311.  
  10312.  See Also
  10313.  
  10314.    DosSemSet, DosSleep, DosTimerStart, DosTimerStop
  10315.  
  10316.  
  10317.  ────────────────────────────────────────────────────────────────────────────
  10318.  DosTimerStart
  10319.  ────────────────────────────────────────────────────────────────────────────
  10320.    USHORT DosTimerStart (ulTime, hsem, phtimer)
  10321.    ULONG ulTime;           /*time before semaphore is cleared              */
  10322.    HSEM hsem;              /*system-semaphore handle                       */
  10323.    PHTIMER phtimer;        /*pointer to variable for timer handle          */
  10324.  
  10325.    The DosTimerStart function creates a timer that counts for a specified
  10326.    number of milliseconds, then clears the specified semaphore. The function
  10327.    repeats this process continually, counting the time and clearing the
  10328.    semaphore, until the process stops it by using the DosTimerStop function.
  10329.    The timer handle is used in the DosTimerStop function to cancel the timer.
  10330.  
  10331.  Parameters
  10332.  
  10333.    ulTime  Specifies the time (in milliseconds) before the semaphore is
  10334.    cleared.
  10335.  
  10336.    hsem  Identifies the system semaphore that signals the end of the timer.
  10337.    This handle must have been created previously by using the DosCreateSem
  10338.    function.
  10339.  
  10340.    phtimer  Points to the variable that receives the timer handle.
  10341.  
  10342.  Return Value
  10343.  
  10344.    The return value is zero if the function is successful. Otherwise, it is
  10345.    an error value, which may be one of the following:
  10346.  
  10347.          ERROR_TS_NOTIMER
  10348.          ERROR_TS_SEMHANDLE
  10349.  
  10350.  Comments
  10351.  
  10352.    The timer runs asynchronously──that is, while the timer counts the time,
  10353.    the function returns to let the process continue to execute other tasks.
  10354.  
  10355.    The given semaphore must be a system semaphore. If the process uses the
  10356.    semaphore to determine when data is available, it must use the DosSemSet
  10357.    function to set the semaphore before calling the DosTimerStart function.
  10358.  
  10359.    If necessary, the DosTimerStart function rounds up the ulTime parameter to
  10360.    the next clock tick.
  10361.  
  10362.    The timer may clear the semaphore several times before a process that is
  10363.    waiting for the semaphore resumes execution. If the process requires an
  10364.    accurate count of the time it waited, it should retrieve the current
  10365.    system time from the global information segment before and after waiting
  10366.    for the semaphore and compare these times.
  10367.  
  10368.  See Also
  10369.  
  10370.    DosGetInfoSeg, DosSemSet, DosTimerStop
  10371.  
  10372.  
  10373.  ────────────────────────────────────────────────────────────────────────────
  10374.  DosTimerStop
  10375.  ────────────────────────────────────────────────────────────────────────────
  10376.    USHORT DosTimerStop (htimer)
  10377.    HTIMER htimer;          /*timer handle                                  */
  10378.  
  10379.    The DosTimerStop function stops a specified timer.
  10380.  
  10381.  Parameters
  10382.  
  10383.    htimer  Identifies the timer to be stopped. This handle must have been
  10384.    created previously by using the DosTimerAsync or DosTimerStart function.
  10385.  
  10386.  Return Value
  10387.  
  10388.    The return value is zero if the function is successful. Otherwise, it is
  10389.    an error value, which may be the following:
  10390.  
  10391.          ERROR_TS_HANDLE
  10392.  
  10393.  Comments
  10394.  
  10395.    When the DosTimerStop function stops a timer, it does not clear the
  10396.    corresponding semaphore. If a process is waiting for the semaphore to
  10397.    clear, the process that stops the timer should also clear the semaphore.
  10398.  
  10399.  See Also
  10400.  
  10401.    DosTimerAsync, DosTimerStart
  10402.  
  10403.  
  10404.  ────────────────────────────────────────────────────────────────────────────
  10405.  DosTransactNmPipe
  10406.  ────────────────────────────────────────────────────────────────────────────
  10407.    USHORT DosTransactNmPipe (hp, pbOutBuf, cbOutBuf, pbInBuf, cbInBuf,
  10408.    pcbRead)
  10409.    HPIPE hp;               /*pipe handle                                   */
  10410.    PBYTE pbOutBuf;         /*pointer to buffer containing data             */
  10411.    USHORT cbOutBuf;        /*number of bytes in output buffer              */
  10412.    PBYTE pbInBuf;          /*pointer to buffer receiving data              */
  10413.    USHORT cbInBuf;         /*number of bytes in input buffer               */
  10414.    PUSHORT pcbRead;        /*pointer to variable receiving number of bytes */
  10415.                            read
  10416.  
  10417.    The DosTransactNmPipe function writes data to and reads data from a named
  10418.    pipe.
  10419.  
  10420.  Parameters
  10421.  
  10422.    hp  Identifies the named pipe.
  10423.  
  10424.    pbOutBuf  Points to the buffer containing the data that is written to the
  10425.    pipe.
  10426.  
  10427.    cbOutBuf  Specifies the size (in bytes) of the output buffer.
  10428.  
  10429.    pbInBuf  Points to the input buffer that receives the data read from the
  10430.    pipe.
  10431.  
  10432.    cbInBuf  Specifies the size (in bytes) of the input buffer.
  10433.  
  10434.    pcbRead  Points to the variable that receives the number of bytes read
  10435.    from the pipe.
  10436.  
  10437.  Return Value
  10438.  
  10439.    The return value is zero if the function is successful. Otherwise, it is
  10440.    an error value, which may be one of the following:
  10441.  
  10442.          ERROR_BAD_PIPE
  10443.          ERROR_INTERRUPT
  10444.          ERROR_INVALID_FUNCTION
  10445.          ERROR_SEM_TIMEOUT
  10446.  
  10447.  Comments
  10448.  
  10449.    The DosTransactNmPipe function fails if the named pipe contains any unread
  10450.    data or if the named pipe is not in message mode. A named pipe's blocking
  10451.    state has no effect on the DosTransactNmPipe function. The
  10452.    DosTransactNmPipe function does not return until data is written into the
  10453.    output buffer.
  10454.  
  10455.  See Also
  10456.  
  10457.    DosCallNmPipe
  10458.  
  10459.  
  10460.  ────────────────────────────────────────────────────────────────────────────
  10461.  DosUnlockSeg
  10462.  ────────────────────────────────────────────────────────────────────────────
  10463.    USHORT DosUnlockSeg (sel)
  10464.    SEL sel;                /*selector of segment to unlock                 */
  10465.  
  10466.    The DosUnlockSeg function unlocks a discardable segment. Once a segment is
  10467.    unlocked, the system may discard it to make space available for other
  10468.    segments.
  10469.  
  10470.  Parameters
  10471.  
  10472.    sel  Specifies the selector of the segment to unlock.
  10473.  
  10474.  Return Value
  10475.  
  10476.    The return value is zero if the function is successful. Otherwise, it is
  10477.    an error value.
  10478.  
  10479.  Comments
  10480.  
  10481.    DosUnlockSeg applies only to segments that are allocated by using the
  10482.    DosAllocSeg function with the fsAlloc parameter set to SEG_DISCARDABLE.
  10483.  
  10484.    The DosLockSeg and DosUnlockSeg functions may be nested. If DosLockSeg is
  10485.    called 5 times to lock a segment, DosUnlockSeg must be called 5 times to
  10486.    unlock the segment. A segment becomes permanently locked if it is locked
  10487.    255 times without being unlocked.
  10488.  
  10489.  See Also
  10490.  
  10491.    DosAllocSeg, DosLockSeg
  10492.  
  10493.  
  10494.  ────────────────────────────────────────────────────────────────────────────
  10495.  DosWaitNmPipe
  10496.  ────────────────────────────────────────────────────────────────────────────
  10497.    USHORT DosWaitNmPipe (pszName, ulTimeOut)
  10498.    PSZ pszName;            /*pointer to pipe name                          */
  10499.    ULONG ulTimeOut;        /*timeout value                                 */
  10500.  
  10501.    The DosWaitNmPipe function waits for a named pipe to become available.
  10502.  
  10503.  Parameters
  10504.  
  10505.    pszName  Points to the name of the pipe. The name is in the form
  10506.    \pipe\name for a local pipe and \\server\pipe\name for a remote pipe.
  10507.  
  10508.    ulTimeOut  Specifies a value (in milliseconds) that is the amount of time
  10509.    MS OS/2 should wait for the pipe to become available.
  10510.  
  10511.  Return Value
  10512.  
  10513.    The return value is zero if the function is successful. Otherwise, it is
  10514.    an error value, which may be one of the following:
  10515.  
  10516.          ERROR_BAD_PIPE
  10517.          ERROR_INTERRUPT
  10518.          ERROR_SEM_TIMEOUT
  10519.  
  10520.  Comments
  10521.  
  10522.    The DosWaitNmPipe function should be used only when the DosOpen function
  10523.    returns the ERROR_PIPE_BUSY error value.
  10524.  
  10525.    If more than one process has requested a named pipe that has become
  10526.    available, the system gives the pipe to the process that has been waiting
  10527.    the longest.
  10528.  
  10529.  See Also
  10530.  
  10531.    DosOpen
  10532.  
  10533.  
  10534.  ────────────────────────────────────────────────────────────────────────────
  10535.  DosWrite
  10536.  ────────────────────────────────────────────────────────────────────────────
  10537.    USHORT DosWrite (hf, pvBuf, cbBuf, pcbBytesWritten)
  10538.    HFILE hf;               /*file handle                                   */
  10539.    PVOID pvBuf;            /*pointer to buffer                             */
  10540.    USHORT cbBuf;           /*number of bytes to write                      */
  10541.    PUSHORT                 /*pointer to variable receiving byte count      */
  10542.    pcbBytesWritten;
  10543.  
  10544.    The DosWrite function writes data from a buffer to a file, then copies the
  10545.    number of bytes written to a variable.
  10546.  
  10547.    The DosWrite function is a family API function.
  10548.  
  10549.  Parameters
  10550.  
  10551.    hf  Identifies the file that receives the data. This handle must have been
  10552.    created previously by using the DosOpen function.
  10553.  
  10554.    pvBuf  Points to the buffer that contains the data to write.
  10555.  
  10556.    cbBuf  Specifies the number of bytes to write.
  10557.  
  10558.    pcbBytesWritten  Points to the variable receiving the number of bytes
  10559.    written.
  10560.  
  10561.  Return Value
  10562.  
  10563.    The return value is zero if the function is successful. Otherwise, it is
  10564.    an error value, which may be one of the following:
  10565.  
  10566.          ERROR_ACCESS_DENIED
  10567.          ERROR_BROKEN_PIPE
  10568.          ERROR_INVALID_HANDLE
  10569.          ERROR_LOCK_VIOLATION
  10570.          ERROR_NOT_DOS_DISK
  10571.          ERROR_WRITE_FAULT
  10572.  
  10573.  Comments
  10574.  
  10575.    The DosWrite function begins to write at the current file-pointer
  10576.    position. The file-pointer position can be changed by using the
  10577.    DosChgFilePtr function.
  10578.  
  10579.    If the specified file has been opened using the write-through flag, the
  10580.    DosWrite function writes data to the disk before returning. Otherwise, the
  10581.    system collects the data in an internal file buffer and writes the data to
  10582.    the disk only when the buffer is full.
  10583.  
  10584.    The DosWrite function may write fewer bytes to the file than the number
  10585.    specified in the cbBuf parameter if there is not enough space on the disk
  10586.    for all of the requested bytes. The cbBuf parameter can be zero without
  10587.    causing an error──that is, writing no bytes is acceptable.
  10588.  
  10589.    The efficiency with which the DosWrite function writes to a disk is
  10590.    improved when the cbBuf parameter is set to a multiple of the disk's
  10591.    bytes-per-sector size. When cbBuf is set this way, the function writes
  10592.    directly to the disk, without first copying the data to an internal file
  10593.    buffer. (The DosQFSInfo function retrieves the byters-per-sector value for
  10594.    a disk.)
  10595.  
  10596.  Example
  10597.  
  10598.    This example creates the file abc and calls the DosWrite function to write
  10599.    the contents of the abBuf buffer to the file:
  10600.  
  10601.    BYTE abBuf[512];
  10602.    HFILE hf;
  10603.    USHORT usAction, cbBytesWritten, usError;
  10604.    usError = DosOpen("abc", &hf, &usAction, 0L, FILE_NORMAL,
  10605.        FILE_CREATE,
  10606.        OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYWRITE, 0L);
  10607.    if (!usError) {
  10608.        DosWrite(hf,                  /* file handle              */
  10609.            abBuf,                    /* buffer address           */
  10610.            sizeof(abBuf),            /* buffer size              */
  10611.            &cbBytesWritten);         /* address of bytes written */
  10612.  
  10613.  See Also
  10614.  
  10615.    DosChgFilePtr, DosOpen, DosRead, DosWriteAsync
  10616.  
  10617.  
  10618.  ────────────────────────────────────────────────────────────────────────────
  10619.  DosWriteAsync
  10620.  ────────────────────────────────────────────────────────────────────────────
  10621.    USHORT DosWriteAsync (hf, hsemRam, pusErrCode, pvBuf, cbBuf,
  10622.    pcbBytesWritten)
  10623.    HFILE hf;               /*file handle                                   */
  10624.    PULONG hsemRam;         /*pointer to RAM semaphore                      */
  10625.    PUSHORT pusErrCode;     /*pointer to variable for error value           */
  10626.    PVOID pvBuf;            /*pointer to buffer containing data to write    */
  10627.    USHORT cbBuf;           /*number of bytes in buffer                     */
  10628.    PUSHORT                 /*pointer to variable for bytes written         */
  10629.    pcbBytesWritten;
  10630.  
  10631.    The DosWriteAsync function writes one or more bytes of data to a specified
  10632.    file. The function writes the data asynchronously──that is, the function
  10633.    returns immediately, but continues to copy data to the specified file
  10634.    while the process continues with other tasks.
  10635.  
  10636.  Parameters
  10637.  
  10638.    hf  Identifies the file that receives the data. This handle must have been
  10639.    created previously by using the DosOpen function.
  10640.  
  10641.    hsemRam  Points to the RAM semaphore that indicates when the function has
  10642.    finished reading the data.
  10643.  
  10644.    pusErrCode  Points to the variable that receives an error value.
  10645.  
  10646.    pvBuf  Points to the buffer that contains the data to write.
  10647.  
  10648.    cbBuf  Specifies the number of bytes to write.
  10649.  
  10650.    pcbBytesWritten  Points to the variable receiving the number of bytes
  10651.    written.
  10652.  
  10653.  Return Value
  10654.  
  10655.    The return value is zero if the function is successful. Otherwise, it is
  10656.    an error value, which may be one of the following:
  10657.  
  10658.          ERROR_ACCESS_DENIED
  10659.          ERROR_BROKEN_PIPE
  10660.          ERROR_INVALID_HANDLE
  10661.          ERROR_LOCK_VIOLATION
  10662.          ERROR_NO_PROC_SLOTS
  10663.          ERROR_NOT_DOS_DISK
  10664.          ERROR_WRITE_FAULT
  10665.  
  10666.  Comments
  10667.  
  10668.    The DosWriteAsync function starts writing at the current file-pointer
  10669.    position. The file-pointer position can be changed by using the
  10670.    DosChgFilePtr function.
  10671.  
  10672.    If the specified file has been opened using the write-through flag, the
  10673.    DosWriteAsync function writes data to the disk as well as to the file
  10674.    before returning. If the write-through flag has not been set, the system
  10675.    collects the data in an internal file buffer and writes the data to the
  10676.    disk only when the buffer is full.
  10677.  
  10678.    The DosWriteAsync function may write fewer bytes to the file than the
  10679.    number specified in the cbBuf parameter if there is not enough space on
  10680.    the disk for all of the requested bytes. The cbBuf parameter can be zero
  10681.    without causing an error──that is, writing no bytes is acceptable.
  10682.  
  10683.    When the DosWriteAsync function has written the data, it clears the RAM
  10684.    semaphore pointed to by the hsemRam parameter. If the process uses the
  10685.    semaphore to determine when data is available, it must use the DosSemSet
  10686.    function to set the semaphore before calling DosWriteAsync.
  10687.  
  10688.    The efficiency with which the DosWriteAsync function writes to a disk is
  10689.    improved when the cbBuf parameter is set to a multiple of the disk's
  10690.    bytes-per-sector size. When cbBuf is set this way, the function writes
  10691.    directly to the disk, without first copying the data to an internal file
  10692.    buffer. (The DosQFSInfo function retrieves the byters-per-sector value for
  10693.    a disk.)
  10694.  
  10695.  Example
  10696.  
  10697.    This example creates the file abc.ext, sets a RAM semaphore, and calls the
  10698.    DosWriteAsync function to write the contents of the buffer abBuf to a
  10699.    file. When any additional processing is finished, the example calls the
  10700.    DosSemWait function to wait until DosWriteAsync has finished writing to
  10701.    the file.
  10702.  
  10703.    ULONG hsemWrite = 0;
  10704.    BYTE abBuf[1024];
  10705.    HFILE hf;
  10706.    USHORT usAction, cbBytesWritten;
  10707.    USHORT usWriteAsyncError;
  10708.    DosOpen("abc.ext", &hf, &usAction, 0L, FILE_NORMAL,
  10709.        FILE_CREATE,
  10710.        OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYWRITE, 0L);
  10711.  
  10712.    DosSemSet(&hsemWrite);         /* sets the semaphore       */
  10713.    DosWriteAsync(hf,              /* file handle              */
  10714.        &hsemWrite,                /* semaphore address        */
  10715.        &usWriteAsyncError,        /* return-code address      */
  10716.        abBuf,                     /* buffer address           */
  10717.        sizeof(abBuf),             /* buffer size              */
  10718.        &cbBytesWritten);          /* address of bytes written */
  10719.        .
  10720.        . /* Other processing would go here */
  10721.        .
  10722.    DosSemWait(&hsemWrite, -1L);   /* waits for DosWriteAsync  */
  10723.    if (usWriteAsyncError) {
  10724.        .
  10725.        . /* Error processing would go here. */
  10726.        .
  10727.  
  10728.  See Also
  10729.  
  10730.    DosChgFilePtr, DosOpen, DosQFSInfo, DosReadAsync, DosSemSet,
  10731.    DosSemWait, DosWrite
  10732.  
  10733.  
  10734.  ────────────────────────────────────────────────────────────────────────────
  10735.  DosWriteQueue
  10736.  ────────────────────────────────────────────────────────────────────────────
  10737.    USHORT DosWriteQueue (hqueue, usRequest, cbBuf, pbBuf, usPriority)
  10738.    HQUEUE hqueue;          /*handle of target queue                        */
  10739.    USHORT usRequest;       /*request/identification data                   */
  10740.    USHORT cbBuf;           /*number of bytes to write                      */
  10741.    PBYTE pbBuf;            /*pointer to buffer containing element to write */
  10742.    UCHAR usPriority;       /*priority of element to write                  */
  10743.  
  10744.    The DosWriteQueue function writes an element to the specified queue. The
  10745.    position of the element in the queue is determined by the value that was
  10746.    specified in the fQueueOrder parameter of the DosCreateQueue function when
  10747.    the queue was created; if the value of this parameter was set to 0x0002
  10748.    (priority queue), the usPriority parameter of the DosWriteQueue function
  10749.    can be used to set the priority of the element. After the element is
  10750.    written, the process that owns the queue may read the element by using the
  10751.    DosPeekQueue or DosReadQueue function.
  10752.  
  10753.  Parameters
  10754.  
  10755.    hqueue  Identifies the queue to be written to. This handle must have been
  10756.    previously created or opened by using the DosCreateQueue or DosOpenQueue
  10757.    function.
  10758.  
  10759.    usRequest  Specifies a program-supplied event code. MS OS/2 does not use
  10760.    this field; it is reserved for the program's use. The queue owner can
  10761.    retrieve this value by using the DosPeekQueue or DosReadQueue function.
  10762.  
  10763.    cbBuf  Specifies the number of bytes to be copied to the buffer that is
  10764.    pointed to by the pbBuf parameter.
  10765.  
  10766.    pbBuf  Points to the buffer that contains the element to be written to the
  10767.    queue.
  10768.  
  10769.    usPriority  Specifies the element priority. This parameter can be any
  10770.    value from 0 through 15; 15 is the highest priority.
  10771.  
  10772.  Return Value
  10773.  
  10774.    The return value is zero if the function is successful. Otherwise, it is
  10775.    an error value, which may be one of the following:
  10776.  
  10777.          ERROR_QUE_INVALID_HANDLE
  10778.          ERROR_QUE_NO_MEMORY
  10779.  
  10780.  Comments
  10781.  
  10782.    The DosWriteQueue function returns an error value if the queue has been
  10783.    closed by the process that owns it.
  10784.  
  10785.    If the queue owner uses a RAM semaphore to notify it when elements are
  10786.    added to the queue, the semaphore must be shared. If the notifying
  10787.    semaphore is a system semaphore, the writing process must have opened the
  10788.    semaphore by using the DosOpenSem function.
  10789.  
  10790.  Example
  10791.  
  10792.    This example creates a queue and calls the DosWriteQueue function to write
  10793.    the string "Hello World" to the queue:
  10794.  
  10795.    HQUEUE hqueue;
  10796.    DosCreateQueue(&hqueue, 0, "\\queues\\abc.que");
  10797.    DosWriteQueue(hqueue,                 /* handle to queue  */
  10798.        0,                                /* request data     */
  10799.        11,                               /* length of data   */
  10800.        "Hello World",                    /* data buffer      */
  10801.        0);                               /* element priority */
  10802.  
  10803.  See Also
  10804.  
  10805.    DosCreateQueue, DosOpenQueue, DosReadQueue
  10806.  
  10807.  ────────────────────────────────────────────────────────────────────────────
  10808.  KbdCharIn
  10809.  ────────────────────────────────────────────────────────────────────────────
  10810.    USHORT KbdCharIn (pkbci, fWait, hkbd)
  10811.    PKBDKEYINFO pkbci;      /*pointer to structure for keystroke info.      */
  10812.    USHORT fWait;           /*wait/no-wait flag                             */
  10813.    HKBD hkbd;              /*keyboard handle                               */
  10814.  
  10815.    The KbdCharIn function retrieves character and scan-code information from
  10816.    a logical keyboard. The function copies the information to the structure
  10817.    pointed to by the pkbci parameter. Keystroke information includes the
  10818.    character value of a given key, the scan code, the keystroke status, the
  10819.    state of the shift keys, and the system time (in milliseconds) when the
  10820.    keystroke occurred. For information on scan codes, key codes, and MS OS/2
  10821.    control and editing keys, see Chapter 5, "File Formats."
  10822.  
  10823.    The KbdCharIn function is a family API function.
  10824.  
  10825.  Parameters
  10826.  
  10827.    pkbci  Points to the KBDKEYINFO structure that receives the keystroke
  10828.    information. The KBDKEYINFO structure has the following form:
  10829.  
  10830.    typedef struct _KBDKEYINFO {
  10831.        UCHAR  chChar;
  10832.        UCHAR  chScan;
  10833.        UCHAR  fbStatus;
  10834.        UCHAR  bNlsShift;
  10835.        USHORT fsState;
  10836.        ULONG  time;
  10837.    } KBDKEYINFO;
  10838.  
  10839.    For a full description, see Chapter 4, "Types, Macros, Structures."
  10840.  
  10841.    fWait  Specifies whether to wait for keystroke information if none is
  10842.    available. If this parameter is IO_WAIT, the function waits for a
  10843.    keystroke if one is not available. If the parameter is IO_NOWAIT, the
  10844.    function returns immediately whether or not it retrieved any keystroke
  10845.    information. The fbStatus field in the KBDKEYINFO structure specifies
  10846.    whether a keystroke is received. The fbStatus field is nonzero if a
  10847.    keystroke is received or zero if not.
  10848.  
  10849.    hkbd  Identifies the logical keyboard. The handle must have been created
  10850.    previously by using the KbdOpen function.
  10851.  
  10852.  Return Value
  10853.  
  10854.    The return value is zero if the function is successful. Otherwise, it is
  10855.    an error value, which may be one of the following:
  10856.  
  10857.          ERROR_KBD_FOCUS_REQUIRED
  10858.          ERROR_KBD_INVALID_IOWAIT
  10859.  
  10860.  Comments
  10861.  
  10862.    The KbdCharIn function copies and removes keystroke information from the
  10863.    input buffer of the specified logical keyboard. Although echo mode for the
  10864.    logical keyboard may be turned on, KbdCharIn does not echo the characters
  10865.    it reads. If the keyboard is in ASCII mode, KbdCharIn retrieves keystroke
  10866.    information for each key pressed except shift keys and MS OS/2 CTRL keys.
  10867.    If the keyboard is in binary mode, KbdCharIn retrieves keystroke
  10868.    information for any key pressed except shift keys. In most cases, a shift
  10869.    key is pressed in combination with other keys to create a single
  10870.    keystroke. In binary mode with shift report turned on, a key by itself
  10871.    creates a keystroke that this function can retrieve. For more information
  10872.    on binary mode and shift-report mode, see the KbdSetStatus function.
  10873.  
  10874.    The KbdCharIn function retrieves extended ASCII codes, such as when the
  10875.    ALT key and another key, called the primary key, are pressed
  10876.    simultaneously. When the function retrieves an extended code, it sets the
  10877.    chChar field of the KBDKEYINFO structure to 0x0000 or 0x00E0 and copies
  10878.    the extended code to the chScan field. The extended code is usually the
  10879.    scan code of the primary key. In ASCII mode, the function retrieves only
  10880.    complete extended codes, which means that if both bytes of the extended
  10881.    code do not fit in the buffer, neither byte is retrieved. For more
  10882.    information on extended ASCII codes, see Appendix C, "Country and
  10883.    Code-Page Information."
  10884.  
  10885.    This function must be called twice to retrieve a code for a double-byte
  10886.    character set (DBCS). If the code retrieved is the first byte of a
  10887.    double-byte character, the fbStatus field of the KBDKEYINFO structure is
  10888.    set to 0x0080.
  10889.  
  10890.  Restrictions
  10891.  
  10892.    In real mode, the following restrictions apply to the KbdCharIn function:
  10893.  
  10894.    ■  It does not copy the system time to the KBDKEYINFO structure and there
  10895.       is no interim character support.
  10896.  
  10897.    ■  It retrieves characters only from the default logical keyboard (handle
  10898.       0).
  10899.  
  10900.    ■  The fbStatus field may be 0x0000 or SHIFT_KEY_IN.
  10901.  
  10902.    ■  The hkbd parameter is ignored.
  10903.  
  10904.  Example
  10905.  
  10906.    This example calls the KbdCharIn function to retrieve a character, and
  10907.    then displays the character on the screen:
  10908.  
  10909.    KBDKEYINFO kbci;
  10910.    KbdCharIn(&kbci,                  /* structure for data */
  10911.        IO_WAIT,                      /* waits for key      */
  10912.        0);                           /* keyboard handle    */
  10913.    VioWrtTTY(&kbci.chChar, 1, 0);
  10914.  
  10915.  See Also
  10916.  
  10917.    KbdGetStatus, KbdOpen, KbdPeek, KbdSetStatus, KbdStringIn
  10918.  
  10919.  
  10920.  ────────────────────────────────────────────────────────────────────────────
  10921.  KbdClose
  10922.  ────────────────────────────────────────────────────────────────────────────
  10923.    USHORT KbdClose (hkbd)
  10924.    HKBD hkbd;              /*keyboard handle                               */
  10925.  
  10926.    The KbdClose function closes the specified logical keyboard. The function
  10927.    removes any remaining keystrokes from the input buffer and automatically
  10928.    frees the focus (if the logical keyboard has it).
  10929.  
  10930.    The default keyboard cannot be closed. If you specify the default keyboard
  10931.    (handle 0), the KbdClose function ignores the request.
  10932.  
  10933.  Parameters
  10934.  
  10935.    hkbd  Identifies the logical keyboard to close. The handle must have been
  10936.    created previously by using the KbdOpen function.
  10937.  
  10938.  Return Value
  10939.  
  10940.    The return value is zero if the function is successful. Otherwise, it is
  10941.    an error value, which may be the following:
  10942.  
  10943.          ERROR_KBD_INVALID_HANDLE
  10944.  
  10945.  Example
  10946.  
  10947.    This example opens a logical keyboard and calls KbdClose to close it:
  10948.  
  10949.    HKBD hkbd;
  10950.    KbdOpen(&hkbd);
  10951.        .
  10952.        .
  10953.        .
  10954.    KbdClose(hkbd);
  10955.  
  10956.  See Also
  10957.  
  10958.    KbdFlushBuffer, KbdFreeFocus, KbdOpen
  10959.  
  10960.  
  10961.  ────────────────────────────────────────────────────────────────────────────
  10962.  KbdDeRegister
  10963.  ────────────────────────────────────────────────────────────────────────────
  10964.    USHORT KbdDeRegister (void)
  10965.  
  10966.    The KbdDeRegister function restores the default Kbd subsystem and releases
  10967.    any previously registered Kbd subsystem. The function restores the default
  10968.    Kbd subsystem for all processes in the current screen group.
  10969.  
  10970.    Once a process registers a Kbd subsystem, no other process in the screen
  10971.    group may register a Kbd subsystem until the default subsystem is
  10972.    restored. Only the process registering a Kbd subsystem may call the
  10973.    KbdDeRegister function to restore the default subsystem.
  10974.  
  10975.  Parameters
  10976.  
  10977.    This function has no parameters.
  10978.  
  10979.  Return Value
  10980.  
  10981.    The return value is zero if the function is successful. Otherwise, it is
  10982.    an error value, which may be the following:
  10983.  
  10984.          ERROR_KBD_DEREGISTER
  10985.  
  10986.  See Also
  10987.  
  10988.    KbdRegister
  10989.  
  10990.  
  10991.  ────────────────────────────────────────────────────────────────────────────
  10992.  KbdFlushBuffer
  10993.  ────────────────────────────────────────────────────────────────────────────
  10994.    USHORT KbdFlushBuffer (hkbd)
  10995.    HKBD hkbd;              /*keyboard handle                               */
  10996.  
  10997.    The KbdFlushBuffer function removes all keystroke information from the
  10998.    input buffer of the specified logical keyboard, but only if the keyboard
  10999.    has the focus or is the default keyboard.
  11000.  
  11001.    The KbdFlushBuffer function is a family API function.
  11002.  
  11003.  Parameters
  11004.  
  11005.    hkbd  Identifies the logical keyboard to clear. The handle must have been
  11006.    created previously by using the KbdOpen function.
  11007.  
  11008.  Return Value
  11009.  
  11010.    The return value is zero if the function is successful. Otherwise, it is
  11011.    an error value.
  11012.  
  11013.  Restrictions
  11014.  
  11015.    In real mode, the following restriction applies to the KbdFlushBuffer
  11016.    function:
  11017.  
  11018.    ■  The hkbd parameter is ignored.
  11019.  
  11020.  Example
  11021.  
  11022.    This example opens a logical keyboard and calls KbdFlushBuffer to remove
  11023.    any keystrokes from the input buffer:
  11024.  
  11025.    HKBD hkbd;
  11026.    KbdOpen(&hkbd);
  11027.        .
  11028.        .
  11029.        .
  11030.    KbdFlushBuffer(hkbd);
  11031.  
  11032.  See Also
  11033.  
  11034.    KbdCharIn
  11035.  
  11036.  
  11037.  ────────────────────────────────────────────────────────────────────────────
  11038.  KbdFreeFocus
  11039.  ────────────────────────────────────────────────────────────────────────────
  11040.    USHORT KbdFreeFocus (hkbd)
  11041.    HKBD hkbd;              /*keyboard handle                               */
  11042.  
  11043.    The KbdFreeFocus function frees the focus from the specified logical
  11044.    keyboard. Other logical keyboards can then use the focus.
  11045.  
  11046.  Parameters
  11047.  
  11048.    hkbd  Identifies the logical keyboard that loses the focus. The handle
  11049.    must have been created previously by using the KbdOpen function.
  11050.  
  11051.  Return Value
  11052.  
  11053.    The return value is zero if the function is successful. Otherwise, it is
  11054.    an error value.
  11055.  
  11056.  Comments
  11057.  
  11058.    If a process has been waiting for the focus as a result of calling the
  11059.    KbdGetFocus function, MS OS/2 assigns the focus to the logical keyboard as
  11060.    soon as it is free. If more than one process is waiting, MS OS/2 chooses a
  11061.    logical keyboard and assigns the focus. The other processes continue to
  11062.    wait until the focus is free.
  11063.  
  11064.  Example
  11065.  
  11066.    This example frees a logical keyboard: if other logical keyboards have
  11067.    been waiting, MS OS/2 assigns the focus to one of them; if no other
  11068.    logical keyboards have been waiting, MS OS/2 uses the default keyboard:
  11069.  
  11070.    HKBD hkbd;
  11071.    KbdOpen(&hkbd);
  11072.    KbdGetFocus(IO_WAIT, hkbd);    /* gets focus  */
  11073.        .
  11074.        .
  11075.        .
  11076.    KbdFreeFocus(hkbd);            /* frees focus */
  11077.  
  11078.  See Also
  11079.  
  11080.    KbdGetFocus, KbdOpen
  11081.  
  11082.  
  11083.  ────────────────────────────────────────────────────────────────────────────
  11084.  KbdGetCp
  11085.  ────────────────────────────────────────────────────────────────────────────
  11086.    USHORT KbdGetCp (ulReserved, pidCodePage, hkbd)
  11087.    ULONG ulReserved;       /*must be zero                                  */
  11088.    PUSHORT pidCodePage;    /*pointer to code-page identifier               */
  11089.    HKBD hkbd;              /*keyboard handle                               */
  11090.  
  11091.    The KbdGetCp function retrieves the current code-page identifier for the
  11092.    specified logical keyboard. The code-page identifier defines which
  11093.    translation table MS OS/2 uses to translate keystrokes into character
  11094.    values. The KbdGetCp function copies the identifier to the variable
  11095.    pointed to by the pidCodePage parameter.
  11096.  
  11097.  Parameters
  11098.  
  11099.    ulReserved  Specifies a reserved value; must be zero.
  11100.  
  11101.    pidCodePage  Points to the variable that receives the code-page
  11102.    identifier. The following are the valid code-page numbers:
  11103.  
  11104.    Number        Code page
  11105.    ──────────────────────────────────────────────────────────────────────────
  11106.    437           United States
  11107.  
  11108.    850           Multilingual
  11109.  
  11110.    860           Portuguese
  11111.  
  11112.    863           French-Canadian
  11113.  
  11114.    865           Nordic
  11115.    ──────────────────────────────────────────────────────────────────────────
  11116.  
  11117.    hkbd  Identifies the logical keyboard. The handle must have been created
  11118.    previously by using the KbdOpen function.
  11119.  
  11120.  Return Value
  11121.  
  11122.    The return value is zero if the function is successful. Otherwise, it is
  11123.    an error value.
  11124.  
  11125.  Comments
  11126.  
  11127.    The code-page identifier may be any value specified in a codepage command
  11128.    in the config.sys file. The identifier is 0x0000 if MS OS/2 is using the
  11129.    default translation table for the logical keyboard.
  11130.  
  11131.    For a description of the possible code-page identifiers and translation
  11132.    tables, see Appendix C, "Country and Code-Page Information."
  11133.  
  11134.  Example
  11135.  
  11136.    This example calls the KbdGetCp function to identify which code page is
  11137.    being used to translate scan codes for the specified logical keyboard.
  11138.  
  11139.    USHORT idCodePage;
  11140.    KbdGetCp(0L,                /* must be zero                    */
  11141.        &idCodePage,            /* pointer to code-page identifier */
  11142.        0);                     /* keyboard handle                 */
  11143.  
  11144.  See Also
  11145.  
  11146.    DosGetCp, KbdOpen, KbdSetCp
  11147.  
  11148.  
  11149.  ────────────────────────────────────────────────────────────────────────────
  11150.  KbdGetFocus
  11151.  ────────────────────────────────────────────────────────────────────────────
  11152.    USHORT KbdGetFocus (fWait, hkbd)
  11153.    USHORT fWait;           /*wait/no-wait flag                             */
  11154.    HKBD hkbd;              /*keyboard handle                               */
  11155.  
  11156.    The KbdGetFocus function retrieves the focus for the specified logical
  11157.    keyboard. The focus determines which logical keyboard receives keystrokes
  11158.    from the physical keyboard. A logical keyboard cannot receive keystrokes
  11159.    unless it has the focus.
  11160.  
  11161.    A process can retrieve the focus at any time, but it must wait if the
  11162.    focus is already being used by another process or thread. If a process has
  11163.    the focus, another process cannot receive the focus until the original
  11164.    process frees it by using the KbdFreeFocus function. If more than one
  11165.    process is waiting for the focus, MS OS/2 chooses which one receives the
  11166.    focus.
  11167.  
  11168.    An application must set the focus to an opened keyboard handle before
  11169.    calling functions such as KbdCharIn.
  11170.  
  11171.  Parameters
  11172.  
  11173.    fWait  Specifies whether to wait for the focus to become available. If
  11174.    this parameter is IO_WAIT, the function waits for the focus. If the
  11175.    parameter is IO_NOWAIT, the function returns immediately whether or not it
  11176.    retrieved the focus.
  11177.  
  11178.    hkbd  Identifies the logical keyboard that receives the focus. The handle
  11179.    must have been created previously by using the KbdOpen function.
  11180.  
  11181.  Return Value
  11182.  
  11183.    The return value is zero if the function is successful. Otherwise, it is
  11184.    an error value, which may be one of the following:
  11185.  
  11186.          ERROR_KBD_FOCUS_ALREADY_ACTIVE
  11187.          ERROR_KBD_UNABLE_TO_FOCUS
  11188.  
  11189.  Example
  11190.  
  11191.    This example opens a logical keyboard and calls KbdGetFocus to retrieve
  11192.    the focus for the opened keyboard. Once the KbdFreeFocus function is
  11193.    called, the focus goes to any process that is waiting for it by calling
  11194.    KbdGetFocus. If no process is waiting, MS OS/2 uses the default keyboard:
  11195.  
  11196.    HKBD hkbd;
  11197.    KbdOpen(&hkbd);
  11198.    KbdGetFocus(IO_WAIT, hkbd);  /* retrieves focus of logical keyboard */
  11199.        .
  11200.        .
  11201.        .
  11202.    KbdFreeFocus(hkbd);          /* frees the focus                     */
  11203.  
  11204.  See Also
  11205.  
  11206.    KbdCharIn, KbdFreeFocus, KbdOpen
  11207.  
  11208.  
  11209.  ────────────────────────────────────────────────────────────────────────────
  11210.  KbdGetStatus
  11211.  ────────────────────────────────────────────────────────────────────────────
  11212.    USHORT KbdGetStatus (pkbstKbdInfo, hkbd)
  11213.    PKBDINFO pkbstKbdInfo;  /*pointer to structure for keyboard status      */
  11214.    HKBD hkbd;              /*keyboard handle                               */
  11215.  
  11216.    The KbdGetStatus function retrieves the status of the specified logical
  11217.    keyboard. The keyboard status specifies the state of the keyboard echo
  11218.    mode, input mode, turnaround character, interim character flags, and shift
  11219.    state.
  11220.  
  11221.    The KbdGetStatus function is a family API function.
  11222.  
  11223.  Parameters
  11224.  
  11225.    pkbstKbdInfo  Points to the KBDINFO structure that receives the keyboard
  11226.    status. The KBDINFO structure has the following form:
  11227.  
  11228.    typedef struct _KBDINFO {
  11229.        USHORT cb;
  11230.        USHORT fsMask;
  11231.        USHORT chTurnAround;
  11232.        USHORT fsInterim;
  11233.        USHORT fsState;
  11234.    } KBDINFO;
  11235.  
  11236.    For a full description, see Chapter 4, "Types, Macros, Structures."
  11237.  
  11238.    hkbd  Identifies the logical keyboard. The handle must have been created
  11239.    previously by using the KbdOpen function.
  11240.  
  11241.  Return Value
  11242.  
  11243.    The return value is zero if the function is successful. Otherwise, it is
  11244.    an error value, which may be the following:
  11245.  
  11246.          ERROR_KBD_INVALID_LENGTH
  11247.  
  11248.  Comments
  11249.  
  11250.    Although the initial status of a logical keyboard depends on the system,
  11251.    the logical keyboard typically has echo and ASCII modes turned on, and has
  11252.    a single-byte turnaround character whose value corresponds to the
  11253.    ENTER key.
  11254.  
  11255.  Restrictions
  11256.  
  11257.    In real mode, the following restriction applies to the KbdGetStatus
  11258.    function:
  11259.  
  11260.    ■  Interim and turnaround characters are not supported.
  11261.  
  11262.  Example
  11263.  
  11264.    This example calls the KbdGetStatus function to retrieve the status of the
  11265.    default keyboard. It then checks to see if echo mode is turned on:
  11266.  
  11267.    KBDINFO kbstInfo;
  11268.    kbstInfo.cb = sizeof(kbstInfo);        /* length of status buffer */
  11269.    KbdGetStatus(&kbstInfo, 0);
  11270.    if (kbstInfo.fsMask & KEYBOARD_ECHO_ON) {
  11271.        VioWrtTTY("Echo is on\n\r", 12, 0);
  11272.  
  11273.  See Also
  11274.  
  11275.    KbdSetStatus, KbdOpen
  11276.  
  11277.  
  11278.  ────────────────────────────────────────────────────────────────────────────
  11279.  KbdOpen
  11280.  ────────────────────────────────────────────────────────────────────────────
  11281.    USHORT KbdOpen (phkbd)
  11282.    PHKBD phkbd;            /*pointer to variable for keyboard handle       */
  11283.  
  11284.    The KbdOpen function opens a logical keyboard and creates a unique handle
  11285.    that identifies a logical keyboard for use in subsequent Kbd (or other MS
  11286.    OS/2) functions. The KbdOpen function initializes the logical keyboard to
  11287.    use the default system code page.
  11288.  
  11289.  Parameters
  11290.  
  11291.    phkbd  Points to the variable that receives the handle of the logical
  11292.    keyboard.
  11293.  
  11294.  Return Value
  11295.  
  11296.    The return value is zero if the function is successful. Otherwise, it is
  11297.    an error value.
  11298.  
  11299.  Comments
  11300.  
  11301.    Any MS OS/2 function that can receive input through a handle (for example,
  11302.    the DosRead function) can use the handle created by the KbdOpen function.
  11303.  
  11304.  Example
  11305.  
  11306.    This example calls the KbdOpen function to create and open a handle for a
  11307.    logical keyboard. Before you can access this logical keyboard, you must
  11308.    call the KbdGetFocus function to retrieve the focus:
  11309.  
  11310.    HKBD hkbd;
  11311.    KbdOpen(&hkbd);
  11312.    KbdGetFocus(IO_WAIT, hkbd);
  11313.  
  11314.  See Also
  11315.  
  11316.    DosRead, KbdClose, KbdGetFocus
  11317.  
  11318.  
  11319.  ────────────────────────────────────────────────────────────────────────────
  11320.  KbdPeek
  11321.  ────────────────────────────────────────────────────────────────────────────
  11322.    USHORT KbdPeek (pkbciKeyInfo, hkbd)
  11323.    PKBDKEYINFO pkbciKeyInfo;
  11324.                            /*pointer to structure for keystroke info.      */
  11325.    HKBD hkbd;              /*keyboard handle                               */
  11326.  
  11327.    The KbdPeek function retrieves character and scan-code information from a
  11328.    logical keyboard. The function copies information to the structure pointed
  11329.    to by the pkbciKeyInfo parameter. The keystroke information includes the
  11330.    character value of the key, the scan code, the keystroke status, the state
  11331.    of the shift keys, and the system time (in milliseconds) when the
  11332.    keystroke occurred. For information on scan codes, key codes, and MS OS/2
  11333.    control and editing keys, see Chapter 5, "File Formats."
  11334.  
  11335.    The KbdPeek function is a family API function.
  11336.  
  11337.  Parameters
  11338.  
  11339.    pkbciKeyInfo  Points to the KBDKEYINFO structure that receives the
  11340.    keystroke information. The KBDKEYINFO structure has the following form:
  11341.  
  11342.    typedef struct _KBDKEYINFO {
  11343.        UCHAR chChar;
  11344.        UCHAR chScan;
  11345.        UCHAR fbStatus;
  11346.        UCHAR bNlsShift;
  11347.        USHORT fsState;
  11348.        ULONG time;
  11349.    } KBDKEYINFO;
  11350.  
  11351.    For a full description, see Chapter 4, "Types, Macros, Structures."
  11352.  
  11353.    hkbd  Identifies the logical keyboard. The handle must have been created
  11354.    previously by using the KbdOpen function.
  11355.  
  11356.  Return Value
  11357.  
  11358.    The return value is zero if the function is successful. Otherwise, it is
  11359.    an error value.
  11360.  
  11361.  Comments
  11362.  
  11363.    The KbdPeek function copies but does not remove keystroke information from
  11364.    the input buffer of the specified logical keyboard. Although echo mode for
  11365.    the logical keyboard may be turned on, the KbdPeek function does not echo
  11366.    the characters it reads. If the keyboard is in ASCII mode, KbdPeek
  11367.    retrieves keystroke information for each key pressed, except shift keys
  11368.    and MS OS/2 CTRL keys. If the keyboard is in binary mode, KbdPeek
  11369.    retrieves keystroke information for any key pressed, except shift keys. In
  11370.    most cases, a shift key is pressed in combination with other keys to
  11371.    create a single keystroke. In binary mode with shift report turned on, a
  11372.    shift key by itself creates a keystroke that this function can retrieve.
  11373.    For more information on binary mode and shift-report mode, see the
  11374.    KbdSetStatus function.
  11375.  
  11376.    The KbdPeek function retrieves extended ASCII codes, such as when the
  11377.    ALT key and another key, called the primary key, are pressed
  11378.    simultaneously. When the KbdPeek function retrieves an extended ASCII
  11379.    code, it sets the chChar field of the KBDKEYINFO structure to 0x0000 or
  11380.    0x00E0 and copies the code to the chScan field. The extended code is
  11381.    usually the scan code of the primary key. In ASCII mode, the function
  11382.    retrieves only complete extended codes, which means that if both bytes of
  11383.    the extended code do not fit in the buffer, neither byte is retrieved. For
  11384.    more information on extended ASCII codes, see Appendix C, "Country and
  11385.    Code-Page Information."
  11386.  
  11387.    The KbdPeek function must be called twice to retrieve a code for a
  11388.    double-byte character set (DBCS). If the code retrieved is the first byte
  11389.    of a double-byte character, the fbStatus field of the KBDKEYINFO structure
  11390.    is set to 0x0080.
  11391.  
  11392.  Restrictions
  11393.  
  11394.    In real mode, the following restrictions apply to the KbdPeek function:
  11395.  
  11396.    ■  It does not copy the system time to the KBDKEYINFO structure, and there
  11397.       is no interim character support.
  11398.  
  11399.    ■  It retrieves characters only from the default logical keyboard (handle
  11400.       0).
  11401.  
  11402.    ■  The fbStatus field may be 0x0000 or SHIFT_KEY_IN.
  11403.  
  11404.    ■  The hkbd parameter is ignored.
  11405.  
  11406.  Example
  11407.  
  11408.    This example calls the KbdPeek function to read a character from the
  11409.    default keyboard without removing it from the keyboard input buffer. If
  11410.    there is already a character in the buffer, the fbStatus field specifies
  11411.    this by setting the sixth bit (0x40):
  11412.  
  11413.    KBDKEYINFO kbciKeyInfo;
  11414.        .
  11415.        .
  11416.        .
  11417.    KbdPeek(&kbciKeyInfo, 0);
  11418.    if (kbciKeyInfo.fbStatus & 0x40) {
  11419.  
  11420.  See Also
  11421.  
  11422.    KbdCharIn, KbdGetStatus, KbdOpen, KbdSetStatus
  11423.  
  11424.  
  11425.  ────────────────────────────────────────────────────────────────────────────
  11426.  KbdRegister
  11427.  ────────────────────────────────────────────────────────────────────────────
  11428.    USHORT KbdRegister (pszModuleName, pszEntryName, fFunctions)
  11429.    PSZ pszModuleName;      /*pointer to string for module name             */
  11430.    PSZ pszEntryName;       /*pointer to string for entry-point name        */
  11431.    ULONG fFunctions;       /*function flags                                */
  11432.  
  11433.    The KbdRegister function registers a Kbd subsystem for the specified
  11434.    logical keyboard. The function temporarily replaces the one or more
  11435.    default Kbd functions, as specified by the fFunctions parameter, with the
  11436.    function(s) in the module named by the pszModuleName parameter. Once
  11437.    KbdRegister replaces a function, MS OS/2 passes any subsequent call to the
  11438.    replaced function to a function in the given module. If you do not replace
  11439.    a function, MS OS/2 continues to call the default Kbd function.
  11440.  
  11441.  Parameters
  11442.  
  11443.    pszModuleName  Points to the null-terminated string that contains the name
  11444.    of the dynamic-link module specifying the replacement Kbd functions. The
  11445.    string must be a valid filename.
  11446.  
  11447.    pszEntryName  Points to the null-terminated string that contains the
  11448.    dynamic-link entry-point name of the function that replaces the specified
  11449.    Kbd function(s). For a full description, see the following "Comments"
  11450.    section.
  11451.  
  11452.    fFunctions  Specifies the flags for the function(s) to replace. This
  11453.    parameter can be any combination of the following values:
  11454.  
  11455. ╓┌─┌─────────────────────┌───────────────────────────────────────────────────╖
  11456.    Value                 Meaning
  11457.    ──────────────────────────────────────────────────────────────────────────
  11458.    KR_KBDCHARIN          Replace KbdCharIn.
  11459.  
  11460.    KR_KBDPEEK            Replace KbdPeek.
  11461.  
  11462.    KR_KBDFLUSHBUFFER     Replace KbdFlushBuffer.
  11463.  
  11464.    KR_KBDGETSTATUS       Replace KbdGetStatus.
  11465.  
  11466.    KR_KBDSETSTATUS       Replace KbdSetStatus.
  11467.  
  11468.    Value                 Meaning
  11469.    ──────────────────────────────────────────────────────────────────────────
  11470. 
  11471.    KR_KBDSTRINGIN        Replace KbdStringIn.
  11472.  
  11473.    KR_KBDOPEN            Replace KbdOpen.
  11474.  
  11475.    KR_KBDCLOSE           Replace KbdClose.
  11476.  
  11477.    KR_KBDGETFOCUS        Replace KbdGetFocus.
  11478.  
  11479.    KR_KBDFREEFOCUS       Replace KbdFreeFocus.
  11480.  
  11481.    KR_KBDGETCP           Replace KbdGetCp.
  11482.  
  11483.    KR_KBDSETCP           Replace KbdSetCp.
  11484.  
  11485.    KR_KBDXLATE           Replace KbdXlate.
  11486.  
  11487.    KR_KBDSETCUSTXT       Replace KbdSetCustXt.
  11488.    ──────────────────────────────────────────────────────────────────────────
  11489.    Value                 Meaning
  11490.    ──────────────────────────────────────────────────────────────────────────
  11491.   ──────────────────────────────────────────────────────────────────────────
  11492.  
  11493.  
  11494.  Return Value
  11495.  
  11496.    The return value is zero if the function is successful. Otherwise, it is
  11497.    an error value, which may be one of the following:
  11498.  
  11499.          ERROR_KBD_INVALID_ASCIIZ
  11500.          ERROR_KBD_INVALID_MASK
  11501.          ERROR_KBD_REGISTER
  11502.  
  11503.  Comments
  11504.  
  11505.    MS OS/2 passes a Kbd function to the given module by preparing the stack
  11506.    and calling the function pointed to by the pszEntryName parameter. The
  11507.    specified module must export the entry-point function name. The
  11508.    entry-point function must check the function code on the stack to
  11509.    determine which function is being requested, and then pass control to the
  11510.    appropriate function in the module. The entry-point function may then
  11511.    access any additional parameters placed on the stack by the original call
  11512.    to KbdRegister.
  11513.  
  11514.    Only one process in a screen group may use the KbdRegister function at any
  11515.    given time. That is, only one process can replace Kbd functions at any
  11516.    given time. The process can restore the default Kbd functions by calling
  11517.    the KbdDeRegister function. A process can replace Kbd functions any number
  11518.    of times, but it may do so only by first restoring the default functions,
  11519.    and then reregistering the new functions.
  11520.  
  11521.    The entry-point function (FuncName) must have the following form:
  11522.  
  11523.      SHORT FAR FuncName(selDataSeg, usReserved1, fFunction,
  11524.          ulReserved2, usParam1, usParam2, usParam3, usParam4,
  11525.          usParam5, usParam6)
  11526.      SEL selDataSeg;
  11527.      USHORT usReserved1;
  11528.      USHORT fFunction;
  11529.      ULONG ulReserved2;
  11530.      USHORT usParam1;
  11531.      USHORT usParam2;
  11532.      USHORT usParam3;
  11533.      USHORT usParam4;
  11534.      USHORT usParam5;
  11535.      USHORT usParam6;
  11536.  
  11537. ╓┌─┌─────────────────┌───────────────────────────────────────────────────────╖
  11538.    Parameters        Description
  11539.    ──────────────────────────────────────────────────────────────────────────
  11540.    selDataSeg        Specifies the data-segment selector of the process that
  11541.                      calls the Kbd function.
  11542.  
  11543.    usReserved1       Specifies a reserved value that must not be changed.
  11544.                      This value represents a return address for the MS OS/2
  11545.                      function that routes Kbd function calls.
  11546.  
  11547.    fFunction         Specifies the function code of the function request.
  11548.                      This parameter can be one of the following values:
  11549.  
  11550.  
  11551.                      Value     Meaning
  11552.    Parameters        Description
  11553.    ──────────────────────────────────────────────────────────────────────────
  11554.                     Value     Meaning
  11555.                      ────────────────────────────────────────────────────────
  11556.                      0x0000    KbdCharIn called.
  11557.                      0x0001    KbdPeek called.
  11558.                      0x0002    KbdFlushBuffer called.
  11559.                      0x0003    KbdGetStatus called.
  11560.                      0x0004    KbdSetStatus called.
  11561.                      0x0005    KbdStringIn called.
  11562.                      0x0006    KbdOpen called.
  11563.                      0x0007    KbdClose called.
  11564.                      0x0008    KbdGetFocus called.
  11565.                      0x0009    KbdFreeFocus called.
  11566.                      0x000A    KbdGetCp called.
  11567.                      0x000B    KbdSetCp called.
  11568.                      0x000C    KbdXlate called.
  11569.                      0x000D    KbdSetCustXt called.
  11570.  
  11571.  
  11572.    ulReserved2       Specifies a reserved value that must not be changed.
  11573.    Parameters        Description
  11574.    ──────────────────────────────────────────────────────────────────────────
  11575.   ulReserved2       Specifies a reserved value that must not be changed.
  11576.                      This parameter represents the return address of the
  11577.                      program that calls the specified Kbd function.
  11578.  
  11579.    usParam1-usParam6 Specify up to six unsigned values passed with the call
  11580.                      to the Kbd function. The number and type of parameters
  11581.                      used depend on the specific function.
  11582.    ──────────────────────────────────────────────────────────────────────────
  11583.  
  11584.  
  11585.    The entry-point function should determine which function is requested and
  11586.    then carry out an appropriate action by using the passed parameters. If
  11587.    necessary, the entry-point function can call a function within the same
  11588.    module to carry out the task. The entry-point or replacement function must
  11589.    leave the stack in the same state as it was received. This is required
  11590.    since the return addresses on the stack must be available in the correct
  11591.    order to return control to the program that originally called the
  11592.    KbdRegister function.
  11593.  
  11594.    The registered function should return -1 if it wants the original function
  11595.    called, 0 if no error occurred, or an error value.
  11596.  
  11597.    In general, if the replacement function needs to access the keyboard, it
  11598.    must use the input-and-output control functions for the keyboard. For more
  11599.    information, see Chapter 3, "Input-and-Output Control Functions."
  11600.  
  11601.    The KbdRegister function itself cannot be replaced.
  11602.  
  11603.  See Also
  11604.  
  11605.    KbdDeRegister, KbdFlushBuffer
  11606.  
  11607.  
  11608.  ────────────────────────────────────────────────────────────────────────────
  11609.  KbdSetCp
  11610.  ────────────────────────────────────────────────────────────────────────────
  11611.    USHORT KbdSetCp (usReserved, idCodePage, hkbd)
  11612.    USHORT usReserved;      /*must be zero                                  */
  11613.    USHORT idCodePage;      /*code-page identifier                          */
  11614.    HKBD hkbd;              /*keyboard handle                               */
  11615.  
  11616.    The KbdSetCp function sets the code-page identifier for the specified
  11617.    logical keyboard. The code-page identifier defines which translation table
  11618.    MS OS/2 uses to translate keystrokes into character values. The code-page
  11619.    identifier may be any value specified in a codepage command in the
  11620.    config.sys file, or 0x0000 for the default translation table for the
  11621.    logical keyboard.
  11622.  
  11623.    The KbdSetCp function also clears the input buffer of the logical
  11624.    keyboard.
  11625.  
  11626.  Parameters
  11627.  
  11628.    usReserved  Specifies a reserved value; must be zero.
  11629.  
  11630.    idCodePage  Specifies the code-page identifier. If the identifier is
  11631.    0x0000, the default translation table is used. The following are the valid
  11632.    code-page numbers:
  11633.  
  11634.    Number        Code page
  11635.    ──────────────────────────────────────────────────────────────────────────
  11636.    437           United States
  11637.  
  11638.    850           Multilingual
  11639.  
  11640.    860           Portuguese
  11641.  
  11642.    863           French-Canadian
  11643.  
  11644.    865           Nordic
  11645.    ──────────────────────────────────────────────────────────────────────────
  11646.  
  11647.    hkbd  Identifies the logical keyboard. The handle must have been created
  11648.    previously by using the KbdOpen function.
  11649.  
  11650.  Return Value
  11651.  
  11652.    The return value is zero if the function is successful. Otherwise, it is
  11653.    an error value.
  11654.  
  11655.  Comments
  11656.  
  11657.    For a description of the possible code-page identifiers and translation
  11658.    tables, see Appendix C, "Country and Code-Page Information."
  11659.  
  11660.  Example
  11661.  
  11662.    This example calls KbdSetCp to change the Kbd subsystem so that it uses
  11663.    the U.S. multilingual code page (850) when translating keystrokes for the
  11664.    default keyboard. The code page must be installed by the config.sys file
  11665.    or this function returns an error value:
  11666.  
  11667.    KbdSetCp(0,                   /* reserved             */
  11668.        850,                      /* code-page identifier */
  11669.        0);                       /* keyboard handle      */
  11670.  
  11671.  See Also
  11672.  
  11673.    DosSetCp, KbdGetCp, KbdOpen, KbdSetCustXt
  11674.  
  11675.  
  11676.  ────────────────────────────────────────────────────────────────────────────
  11677.  KbdSetCustXt
  11678.  ────────────────────────────────────────────────────────────────────────────
  11679.    USHORT KbdSetCustXt (pusTransTbl, hkbd)
  11680.    PUSHORT pusTransTbl;    /*pointer to translation table                  */
  11681.    HKBD hkbd;              /*keyboard handle                               */
  11682.  
  11683.    The KbdSetCustXt function installs a custom translation table for the
  11684.    specified logical keyboard. MS OS/2 uses the translation table to generate
  11685.    character values for all subsequent keystrokes from the logical keyboard.
  11686.  
  11687.    The KbdSetCustXt function does not copy the translation table, so the
  11688.    process must maintain the table in memory while it is in use, where it
  11689.    remains until the process calls the KbdSetCp or KbdSetCustXt function to
  11690.    set another translation table, or calls the KbdClose function to close the
  11691.    logical keyboard.
  11692.  
  11693.  Parameters
  11694.  
  11695.    pusTransTbl  Points to the translation table. The table has the size and
  11696.    format described in Appendix C, "Country and Code-Page Information."
  11697.  
  11698.    hkbd  Identifies the logical keyboard that uses the new code page. The
  11699.    handle must have been created previously by using the KbdOpen function.
  11700.  
  11701.  Return Value
  11702.  
  11703.    The return value is zero if the function is successful. Otherwise, it is
  11704.    an error value.
  11705.  
  11706.  See Also
  11707.  
  11708.    DosSetCp, KbdClose, KbdOpen, KbdSetCp, KbdXlate
  11709.  
  11710.  
  11711.  ────────────────────────────────────────────────────────────────────────────
  11712.  KbdSetFgnd
  11713.  ────────────────────────────────────────────────────────────────────────────
  11714.    USHORT KbdSetFgnd (void)
  11715.  
  11716.    The KbdSetFgnd function raises the priority of the foreground keyboard's
  11717.    thread. This function is used by a Kbd subsystem, not by an application.
  11718.  
  11719.  Parameters
  11720.  
  11721.    This function has no parameters.
  11722.  
  11723.  Return Value
  11724.  
  11725.    The return value is zero if the function is successful. Otherwise, it is
  11726.    an error value.
  11727.  
  11728.  
  11729.  ────────────────────────────────────────────────────────────────────────────
  11730.  KbdSetStatus
  11731.  ────────────────────────────────────────────────────────────────────────────
  11732.    USHORT KbdSetStatus (pkbstKbdInfo, hkbd)
  11733.    PKBDINFO pkbstKbdInfo;  /*pointer to structure for keyboard status      */
  11734.    HKBD hkbd;              /*keyboard handle                               */
  11735.  
  11736.    The KbdSetStatus function sets the status for the specified logical
  11737.    keyboard. The keyboard status specifies the state of the keyboard echo
  11738.    mode, input mode, turnaround character, interim character flags, and shift
  11739.    state.
  11740.  
  11741.    The KbdSetStatus function is a family API function.
  11742.  
  11743.  Parameters
  11744.  
  11745.    pkbstKbdInfo  Points to the KBDINFO structure that contains the keyboard
  11746.    status. The KBDINFO structure has the following form:
  11747.  
  11748.    typedef struct _KBDINFO  {
  11749.        USHORT cb;
  11750.        USHORT fsMask;
  11751.        USHORT chTurnAround;
  11752.        USHORT fsInterim;
  11753.        USHORT fsState;
  11754.    } KBDINFO;
  11755.  
  11756.    For a full description, see Chapter 4, "Types, Macros, Structures."
  11757.  
  11758.    hkbd  Identifies the logical keyboard. The handle must have been created
  11759.    previously by using the KbdOpen function.
  11760.  
  11761.  Return Value
  11762.  
  11763.    The return value is zero if the function is successful. Otherwise, it is
  11764.    an error value, which may be one of the following:
  11765.  
  11766.          ERROR_KBD_INVALID_ECHO_MASK
  11767.          ERROR_KBD_INVALID_INPUT_MASK
  11768.          ERROR_KBD_INVALID_LENGTH
  11769.  
  11770.  Comments
  11771.  
  11772.    In most cases, a shift key is pressed in combination with other keys to
  11773.    create a single keystroke. In binary mode with shift report turned on, a
  11774.    shift key by itself creates a keystroke that the KbdCharIn or KbdPeek
  11775.    function can retrieve.
  11776.  
  11777.  Restrictions
  11778.  
  11779.    In real mode, the following restrictions apply to the KbdSetStatus
  11780.    function:
  11781.  
  11782.    ■  Interim and turnaround characters are not supported.
  11783.  
  11784.    ■  Binary mode with echo mode on is not supported.
  11785.  
  11786.    ■  The hkbd parameter is ignored.
  11787.  
  11788.  Example
  11789.  
  11790.    This example retrieves the current status of the default keyboard, masks
  11791.    the ASCII-mode bit, uses the OR operator to set the binary-mode bit, and
  11792.    calls the KbdSetStatus function to change the keyboard status to binary
  11793.    mode:
  11794.  
  11795.    KBDINFO kbstInfo;
  11796.    kbstInfo.cb = sizeof(kbstInfo);
  11797.    KbdGetStatus(&kbstInfo, 0);        /* gets current status  */
  11798.    kbstInfo.fsMask =
  11799.        (kbstInfo.fsMask & 0x00F7)     /* masks out ASCII mode */
  11800.        | 0x0004;                      /* OR into binary mode  */
  11801.    KbdSetStatus(&kbstInfo, 0);        /* sets new status      */
  11802.  
  11803.  See Also
  11804.  
  11805.    KbdCharIn, KbdGetStatus, KbdOpen, KbdPeek
  11806.  
  11807.  
  11808.  ────────────────────────────────────────────────────────────────────────────
  11809.  KbdStringIn
  11810.  ────────────────────────────────────────────────────────────────────────────
  11811.    USHORT KbdStringIn (pchBuffer, psibLength, fWait, hkbd)
  11812.    PCH pchBuffer;          /*pointer to buffer for string                  */
  11813.    PSTRINGINBUF psibLength;
  11814.                            /*pointer to structure for string length        */
  11815.    USHORT fWait;           /*wait/no-wait flag                             */
  11816.    HKBD hkbd;              /*keyboard handle                               */
  11817.  
  11818.    The KbdStringIn function reads a string of characters from a logical
  11819.    keyboard. The function copies the character value of each keystroke to the
  11820.    buffer pointed to by the pchBuffer parameter. Depending on the input mode
  11821.    of the keyboard and on the value of the fWait parameter, KbdStringIn
  11822.    continues to copy characters until it fills the buffer, retrieves the
  11823.    turnaround character, or reaches the end of the buffer.
  11824.  
  11825.    The KbdStringIn function is a family API function.
  11826.  
  11827.  Parameters
  11828.  
  11829.    pchBuffer  Points to the buffer that receives the character string.
  11830.  
  11831.    psibLength  Points to the STRINGINBUF structure that contains the length
  11832.    of the buffer that receives the string. The STRINGINBUF structure has the
  11833.    following form:
  11834.  
  11835.    typedef struct _STRINGINBUF {
  11836.        USHORT cb;
  11837.        USHORT cchIn;
  11838.    } STRINGINBUF;
  11839.  
  11840.    For a full description, see Chapter 4, "Types, Macros, Structures."
  11841.  
  11842.    fWait  Specifies whether to wait for the entire string to be read. If this
  11843.    parameter is IO_WAIT, the function waits for all characters up to the next
  11844.    turn- around character or until it reaches the end of the buffer. If the
  11845.    parameter is IO_NOWAIT, the function returns immediately with whatever
  11846.    characters are available.
  11847.  
  11848.    hkbd  Identifies the logical keyboard to read from. The handle must have
  11849.    been created previously by using the KbdOpen function.
  11850.  
  11851.  Return Value
  11852.  
  11853.    The return value is zero if the function is successful. Otherwise, it is
  11854.    an error value.
  11855.  
  11856.  Comments
  11857.  
  11858.    The KbdStringIn function removes keystroke information from the input
  11859.    buffer of the specified logical keyboard as it copies a character. If echo
  11860.    and ASCII modes are turned on, the function echoes characters on the
  11861.    screen as they are typed. If the keyboard is in ASCII mode, the function
  11862.    retrieves a character for each key pressed, except shift keys and MS OS/2
  11863.    CTRL and editing keys. If the keyboard is in binary mode, the function
  11864.    retrieves a character for any key pressed except shift keys.
  11865.  
  11866.    The KbdStringIn function can retrieve extended ASCII codes, such as when
  11867.    the ALT key, and another key, called the primary key, are pressed
  11868.    simultaneously. When the function retrieves an extended code, the first
  11869.    character is 0x0000 or 0x00E0 and the second is the extended code. The
  11870.    extended code is usually the scan code of the primary key. In ASCII mode,
  11871.    the function retrieves only complete extended codes, which means that if
  11872.    both bytes of the extended code do not fit in the buffer, neither byte is
  11873.    retrieved. For more information on extended ASCII codes, see Appendix C,
  11874.    "Country and Code-Page Information."
  11875.  
  11876.    In ASCII mode, KbdStringIn recognizes the MS OS/2 editing keys. These keys
  11877.    can be used to display and edit the previously entered string. The
  11878.    KbdStringIn function permits editing of the previous string only if the
  11879.    cchIn field of the STRINGINBUF structure is set to the length of the
  11880.    previous string before the function is called. If this field is set to
  11881.    zero, the line cannot be edited.
  11882.  
  11883.  Restrictions
  11884.  
  11885.    In real mode, the following restriction applies to the KbdStringIn
  11886.    function:
  11887.  
  11888.    ■  The hkbd parameter is ignored.
  11889.  
  11890.  Example
  11891.  
  11892.    This example calls the KbdStringIn function to read a character string
  11893.    from the default keyboard. In ASCII mode, the function waits for the
  11894.    RETURN key to be pressed; in binary mode, it waits for the buffer to
  11895.    be filled:
  11896.  
  11897.    CHAR achBuf[40];
  11898.    STRINGINBUF kbsiBuf;
  11899.    kbsiBuf.cb = sizeof(achBuf);
  11900.    KbdStringIn(achBuf,            /* address of buffer           */
  11901.        &kbsiBuf,                  /* address of length structure */
  11902.        IO_WAIT,                   /* waits for characters        */
  11903.        0);                        /* keyboard handle             */
  11904.    VioWrtTTY("\n", 1, 0);         /* sends linefeed character    */
  11905.    VioWrtTTY(achBuf, kbsiBuf.cchIn, 0); /* displays string       */
  11906.  
  11907.  See Also
  11908.  
  11909.    DosRead, KbdCharIn, KbdGetStatus, KbdOpen, KbdSetStatus
  11910.  
  11911.  
  11912.  ────────────────────────────────────────────────────────────────────────────
  11913.  KbdSynch
  11914.  ────────────────────────────────────────────────────────────────────────────
  11915.    USHORT KbdSynch (fWait)
  11916.    USHORT fWait;           /*wait/no-wait flag                             */
  11917.  
  11918.    The KbdSynch function synchronizes access to the keyboard device driver.
  11919.  
  11920.    This function should be used by a Kbd subsystem, not by an application.
  11921.    You cannot replace the KbdSynch function by using the KbdRegister
  11922.    function.
  11923.  
  11924.  Parameters
  11925.  
  11926.    fWait  Specifies whether to wait for access to the keyboard router if
  11927.    access is not available. If this parameter is IO_WAIT, the function waits
  11928.    for access to the keyboard router. If the parameter is IO_NOWAIT, the
  11929.    function does not wait and returns immediately.
  11930.  
  11931.  Return Value
  11932.  
  11933.    The return value is zero if the function is successful. Otherwise, it is
  11934.    an error value.
  11935.  
  11936.  Comments
  11937.  
  11938.    The KbdSynch function requests an exclusive system semaphore that blocks
  11939.    all other threads within a screen group until the semaphore is cleared.
  11940.    This semaphore is cleared when a called Kbd function returns.
  11941.  
  11942.  See Also
  11943.  
  11944.    DosDevIOCtl, KbdRegister
  11945.  
  11946.  
  11947.  ────────────────────────────────────────────────────────────────────────────
  11948.  KbdXlate
  11949.  ────────────────────────────────────────────────────────────────────────────
  11950.    USHORT KbdXlate (pkbxlKeyStroke, hkbd)
  11951.    PKBDXLATE pkbxlKeyStroke;
  11952.                            /*pointer to structure for scan code            */
  11953.    HKBD hkbd;              /*keyboard handle                               */
  11954.  
  11955.    The KbdXlate function translates a scan code and its shift states into a
  11956.    character value. The function uses the current translation table of the
  11957.    specified logical keyboard.
  11958.  
  11959.    In order to be translated, accent-key combinations, double-byte
  11960.    characters, and extended ASCII characters may require several calls to the
  11961.    KbdXlate function.
  11962.  
  11963.  Parameters
  11964.  
  11965.    pkbxlKeyStroke  Points to the KBDTRANS structure that contains the scan
  11966.    code to translate. It also receives the character value when the function
  11967.    returns. The KBDTRANS structure has the following form:
  11968.  
  11969.    typedef struct _KBDTRANS {
  11970.        UCHAR  chChar;
  11971.        UCHAR  chScan;
  11972.        UCHAR  fbStatus;
  11973.        UCHAR  bNlsShift;
  11974.        USHORT fsState;
  11975.        ULONG  time;
  11976.        USHORT fsDD;
  11977.        USHORT fsXlate;
  11978.        USHORT fsShift;
  11979.        USHORT sZero;
  11980.    } KBDTRANS;
  11981.  
  11982.    For a full description, see Chapter 4, "Types, Macros, Structures."
  11983.  
  11984.    hkbd  Identifies the logical keyboard. The handle must have been created
  11985.    previously by using the KbdOpen function.
  11986.  
  11987.  Return Value
  11988.  
  11989.    The return value is zero if the function is successful. Otherwise, it is
  11990.    an error value.
  11991.  
  11992.  See Also
  11993.  
  11994.    DosMonReg, KbdOpen, KbdSetCustXt
  11995.  
  11996.  
  11997.  ────────────────────────────────────────────────────────────────────────────
  11998.  MouClose
  11999.  ────────────────────────────────────────────────────────────────────────────
  12000.    USHORT MouClose (hmou)
  12001.    HMOU hmou;              /*mouse handle                                  */
  12002.  
  12003.    The MouClose function closes the mouse identified by the given handle. The
  12004.    function removes the mouse pointer from the screen only if the process is
  12005.    the last one in the screen group to have the mouse open.
  12006.  
  12007.  Parameters
  12008.  
  12009.    hmou  Identifies the mouse. The handle must have been created previously
  12010.    by using the MouOpen function.
  12011.  
  12012.  Return Value
  12013.  
  12014.    The return value is zero if the function is successful. Otherwise, it is
  12015.    an error value, which may be the following:
  12016.  
  12017.          ERROR_MOUSE_NO_DEVICE
  12018.  
  12019.  Example
  12020.  
  12021.    This example creates a mouse handle then calls the MouClose function to
  12022.    close the open handle:
  12023.  
  12024.    HMOU hmou;
  12025.    MouOpen(0L, &hmou);
  12026.        .
  12027.        .
  12028.        .
  12029.    MouClose(hmou);
  12030.  
  12031.  See Also
  12032.  
  12033.    MouOpen
  12034.  
  12035.  
  12036.  ────────────────────────────────────────────────────────────────────────────
  12037.  MouDeRegister
  12038.  ────────────────────────────────────────────────────────────────────────────
  12039.    USHORT MouDeRegister (void)
  12040.  
  12041.    The MouDeRegister function restores the default Mou subsystem functions
  12042.    and releases any previously registered Mou subsystem. This function
  12043.    restores the default Mou subsystem for all processes in the current screen
  12044.    group.
  12045.  
  12046.    Once a process registers a Mou subsystem, no other process in the screen
  12047.    group may register a Mou subsystem until the default subsystem is
  12048.    restored. Only the process that registers a Mou subsystem may call the
  12049.    MouDeRegister function to restore the default subsystem.
  12050.  
  12051.  Parameters
  12052.  
  12053.    This function has no parameters.
  12054.  
  12055.  Return Value
  12056.  
  12057.    The return value is zero if the function is successful. Otherwise, it is
  12058.    an error value, which may be the following:
  12059.  
  12060.          ERROR_MOUSE_DEREGISTER
  12061.  
  12062.  See Also
  12063.  
  12064.    MouRegister
  12065.  
  12066.  
  12067.  ────────────────────────────────────────────────────────────────────────────
  12068.  MouDrawPtr
  12069.  ────────────────────────────────────────────────────────────────────────────
  12070.    USHORT MouDrawPtr (hmou)
  12071.    HMOU hmou;              /*mouse handle                                  */
  12072.  
  12073.    The MouDrawPtr function enables the mouse pointer to be drawn on the
  12074.    screen, using the pointer shape defined by the most recent call to the
  12075.    MouSetPtrShape function. The MouDrawPtr function releases any exclusion
  12076.    rectangle that may have been previously set by using the MouRemovePtr
  12077.    function. An exclusion rectangle defines a rectangular region of the
  12078.    screen in which MS OS/2 will not display the pointer.
  12079.  
  12080.  Parameters
  12081.  
  12082.    hmou  Identifies the mouse. The handle must have been created previously
  12083.    by using the MouOpen function.
  12084.  
  12085.  Return Value
  12086.  
  12087.    The return value is zero if the function is successful. Otherwise, it is
  12088.    an error value, which may be the following:
  12089.  
  12090.          ERROR_MOUSE_NO_DEVICE
  12091.  
  12092.  Comments
  12093.  
  12094.    The MouDrawPtr function does not itself draw the mouse pointer. Instead,
  12095.    it directs MS OS/2 to call the mouse device driver at each mouse
  12096.    interrupt. If the mouse device driver has been disabled (by the
  12097.    MouSetDevStatus function), MouDrawPtr releases the current exclusion
  12098.    rectangle but does not draw the pointer.
  12099.  
  12100.  Example
  12101.  
  12102.    This example creates a mouse handle then calls the MouDrawPtr function to
  12103.    enable the mouse pointer to be drawn on the screen:
  12104.  
  12105.    HMOU hmou;
  12106.    MouOpen(0L, &hmou);
  12107.    MouDrawPtr(hmou);
  12108.  
  12109.  See Also
  12110.  
  12111.    MouOpen, MouRemovePtr, MouSetDevStatus, MouSetPtrShape
  12112.  
  12113.  
  12114.  ────────────────────────────────────────────────────────────────────────────
  12115.  MouFlushQue
  12116.  ────────────────────────────────────────────────────────────────────────────
  12117.    USHORT MouFlushQue (hmou)
  12118.    HMOU hmou;              /*mouse handle                                  */
  12119.  
  12120.    The MouFlushQue function removes any existing mouse events from the mouse
  12121.    event queue.
  12122.  
  12123.  Parameters
  12124.  
  12125.    hmou  Identifies the mouse. The handle must have been created previously
  12126.    by using the MouOpen function.
  12127.  
  12128.  Return Value
  12129.  
  12130.    The return value is zero if the function is successful. Otherwise, it is
  12131.    an error value, which may be the following:
  12132.  
  12133.          ERROR_MOUSE_NO_DEVICE
  12134.  
  12135.  Example
  12136.  
  12137.    This example creates a mouse handle then calls the MouFlushQue function to
  12138.    remove any events from the existing mouse event queue:
  12139.  
  12140.    HMOU hmou;
  12141.    MouOpen(0L, &hmou);
  12142.        .
  12143.        .
  12144.        .
  12145.    MouFlushQue(hmou);
  12146.  
  12147.  See Also
  12148.  
  12149.    MouGetNumQueEl, MouOpen, MouReadEventQue
  12150.  
  12151.  
  12152.  ────────────────────────────────────────────────────────────────────────────
  12153.  MouGetDevStatus
  12154.  ────────────────────────────────────────────────────────────────────────────
  12155.    USHORT MouGetDevStatus (pfsDevStatus, hmou)
  12156.    PUSHORT pfsDevStatus;   /*pointer to buffer for status                  */
  12157.    HMOU hmou;              /*mouse handle                                  */
  12158.  
  12159.    The MouGetDevStatus function retrieves the device status for the specified
  12160.    mouse.
  12161.  
  12162.  Parameters
  12163.  
  12164.    pfsDevStatus  Points to the variable that receives the device status. It
  12165.    can be any combination of the following values:
  12166.  
  12167.    Value                    Meaning
  12168.    ──────────────────────────────────────────────────────────────────────────
  12169.    MOUSE_QUEUEBUSY          Event queue is busy with input/output (I/O).
  12170.  
  12171.    MOUSE_BLOCKREAD          Block read is in progress.
  12172.  
  12173.    MOUSE_FLUSH              Flush buffer is in progress.
  12174.  
  12175.    MOUSE_UNSUPPORTED_MODE   Mouse device driver is disabled because of
  12176.                             unsupported mode.
  12177.  
  12178.    MOUSE_DISABLED           Mouse device driver is disabled.
  12179.  
  12180.    MOUSE_MICKEYS            Mouse motion is given in mickeys, not in pels.
  12181.    ──────────────────────────────────────────────────────────────────────────
  12182.  
  12183.    hmou  Identifies the mouse. The handle must have been created previously
  12184.    by using the MouOpen function.
  12185.  
  12186.  Return Value
  12187.  
  12188.    The return value is zero if the function is successful. Otherwise, it is
  12189.    an error value, which may be the following:
  12190.  
  12191.          ERROR_MOUSE_NO_DEVICE
  12192.  
  12193.  Example
  12194.  
  12195.    This example creates a mouse handle then calls the MouGetDevStatus
  12196.    function to retrieve the status for the mouse identified by the handle:
  12197.  
  12198.    USHORT fsDevStatus;
  12199.    HMOU hmou;
  12200.    MouOpen(0L, &hmou);
  12201.    MouGetDevStatus(&fsDevStatus, hmou);
  12202.    if (fsDevStatus & MOUSE_DISABLED ||
  12203.            fsDevStatus & MOUSE_UNSUPPORTED_MODE)
  12204.        VioWrtTTY("mouse is disabled\r\n", 19, 0);
  12205.  
  12206.  See Also
  12207.  
  12208.    MouOpen, MouSetDevStatus
  12209.  
  12210.  
  12211.  ────────────────────────────────────────────────────────────────────────────
  12212.  MouGetEventMask
  12213.  ────────────────────────────────────────────────────────────────────────────
  12214.    USHORT MouGetEventMask (pfsEvents, hmou)
  12215.    PUSHORT pfsEvents;      /*pointer to buffer for event mask              */
  12216.    HMOU hmou;              /*mouse handle                                  */
  12217.  
  12218.    The MouGetEventMask function retrieves the event mask for the specified
  12219.    mouse. The event mask specifies the user actions that cause MS OS/2 to
  12220.    generate mouse events. MS OS/2 responds to a user action by copying a
  12221.    mouse event to the event queue.
  12222.  
  12223.  Parameters
  12224.  
  12225.    pfsEvents  Points to the variable that receives the event mask. It can be
  12226.    any combination of the following values:
  12227.  
  12228.    Value                        Meaning
  12229.    ──────────────────────────────────────────────────────────────────────────
  12230.    MOUSE_MOTION                 Mouse motion.
  12231.  
  12232.    MOUSE_MOTION_WITH_BN1_DOWN   Mouse motion with button-1-down event.
  12233.  
  12234.    MOUSE_BN1_DOWN               Button-1-down event.
  12235.  
  12236.    MOUSE_MOTION_WITH_BN2_DOWN   Mouse motion with button-2-down event.
  12237.  
  12238.    MOUSE_BN2_DOWN               Button-2-down event.
  12239.  
  12240.    MOUSE_MOTION_WITH_BN3_DOWN   Mouse motion with button-3-down event.
  12241.  
  12242.    MOUSE_BN3_DOWN               Button-3-down event.
  12243.    ──────────────────────────────────────────────────────────────────────────
  12244.  
  12245.    hmou  Identifies the mouse. The handle must have been created previously
  12246.    by using the MouOpen function.
  12247.  
  12248.  Return Value
  12249.  
  12250.    The return value is zero if the function is successful. Otherwise, it is
  12251.    an error value, which may be the following:
  12252.  
  12253.          ERROR_MOUSE_NO_DEVICE
  12254.  
  12255.  Comments
  12256.  
  12257.    Button 1 is the left button on the mouse.
  12258.  
  12259.  Example
  12260.  
  12261.    This example creates a mouse handle, calls the MouGetEventMask function,
  12262.    and checks the event mask to see if events are accepted from a third
  12263.    button on the mouse:
  12264.  
  12265.    HMOU hmou;
  12266.    USHORT fsEvents;
  12267.    MouOpen(0L, &hmou);
  12268.    MouGetEventMask(&fsEvents, hmou);
  12269.    if(fsEvents & (MOUSE_MOTION_WITH_BN3_DOWN | MOUSE_BN3_DOWN)
  12270.        VioWrtTTY("Three buttons enabled\n\r", 23, 0);
  12271.  
  12272.  See Also
  12273.  
  12274.    MouOpen, MouReadEventQue, MouSetEventMask
  12275.  
  12276.  
  12277.  ────────────────────────────────────────────────────────────────────────────
  12278.  MouGetNumButtons
  12279.  ────────────────────────────────────────────────────────────────────────────
  12280.    USHORT MouGetNumButtons (pusButtons, hmou)
  12281.    PUSHORT pusButtons;     /*pointer to variable for number of mouse       */
  12282.                            /*buttons                                       */
  12283.    HMOU hmou;              /*mouse handle                                  */
  12284.  
  12285.    The MouGetNumButtons function retrieves the number of buttons on the
  12286.    current mouse.
  12287.  
  12288.  Parameters
  12289.  
  12290.    pusButtons  Points to the variable that receives the number of buttons on
  12291.    the mouse.
  12292.  
  12293.    hmou  Identifies the mouse. The handle must have been created previously
  12294.    by using the MouOpen function.
  12295.  
  12296.  Return Value
  12297.  
  12298.    The return value is zero if the function is successful. Otherwise, it is
  12299.    an error value, which may be the following:
  12300.  
  12301.          ERROR_MOUSE_NO_DEVICE
  12302.  
  12303.  Example
  12304.  
  12305.    This example creates a mouse handle then calls the MouGetNumButtons
  12306.    function to retrieve the number of mouse buttons:
  12307.  
  12308.    HMOU hmou;
  12309.    USHORT usButtons;
  12310.    MouOpen(0L, &hmou);
  12311.    MouGetNumButtons(&usButtons, hmou);
  12312.    if(usButtons == 2)
  12313.        VioWrtTTY("Your mouse has two buttons\n\r", 28, 0);
  12314.  
  12315.  See Also
  12316.  
  12317.    MouOpen
  12318.  
  12319.  
  12320.  ────────────────────────────────────────────────────────────────────────────
  12321.  MouGetNumMickeys
  12322.  ────────────────────────────────────────────────────────────────────────────
  12323.    USHORT MouGetNumMickeys (pusMickeys, hmou)
  12324.    PUSHORT pusMickeys;     /*pointer to variable for mickeys per           */
  12325.                            /*centimeter                                    */
  12326.    HMOU hmou;              /*mouse handle                                  */
  12327.  
  12328.    The MouGetNumMickeys function retrieves the number of mickeys that the
  12329.    specified mouse travels for each centimeter of motion. A mickey is the
  12330.    smallest unit of motion a mouse can measure. The number of mickeys per
  12331.    centimeter for a mouse depends on the device and may also depend on the
  12332.    current setting of the device.
  12333.  
  12334.  Parameters
  12335.  
  12336.    pusMickeys  Points to the variable that receives the number of mickeys per
  12337.    centimeter.
  12338.  
  12339.    hmou  Identifies the mouse. The handle must have been created previously
  12340.    by using the MouOpen function.
  12341.  
  12342.  Return Value
  12343.  
  12344.    The return value is zero if the function is successful. Otherwise, it is
  12345.    an error value, which may be the following:
  12346.  
  12347.          ERROR_MOUSE_NO_DEVICE
  12348.  
  12349.  Example
  12350.  
  12351.    This example creates a mouse handle then calls the MouGetNumMickeys
  12352.    function to retrieve the current number of mickeys per centimeter:
  12353.  
  12354.    HMOU hmou;
  12355.    USHORT usMickeys;
  12356.    MouOpen (0L, &hmou);
  12357.    MouGetNumMickeys(&usMickeys, hmou);
  12358.  
  12359.  See Also
  12360.  
  12361.    MouOpen
  12362.  
  12363.  
  12364.  ────────────────────────────────────────────────────────────────────────────
  12365.  MouGetNumQueEl
  12366.  ────────────────────────────────────────────────────────────────────────────
  12367.    USHORT MouGetNumQueEl (pmouqi, hmou)
  12368.    PMOUQUEINFO pmouqi;     /*pointer to structure for number of events     */
  12369.    HMOU hmou;              /*mouse handle                                  */
  12370.  
  12371.    The MouGetNumQueEl function retrieves the number of events in the mouse
  12372.    event queue.
  12373.  
  12374.  Parameters
  12375.  
  12376.    pmouqi  Points to the MOUQUEINFO structure that receives the number of
  12377.    events in the mouse event queue. The MOUQUEINFO structure has the
  12378.    following form:
  12379.  
  12380.    typedef struct _MOUQUEINFO {
  12381.        USHORT cEvents;
  12382.        USHORT cmaxEvents;
  12383.    } MOUQUEINFO;
  12384.  
  12385.    For a full description, see Chapter 4, "Types, Macros, Structures."
  12386.  
  12387.    hmou  Identifies the mouse. The handle must have been created previously
  12388.    by using the MouOpen function.
  12389.  
  12390.  Return Value
  12391.  
  12392.    The return value is zero if the function is successful. Otherwise, it is
  12393.    an error value, which may be the following:
  12394.  
  12395.          ERROR_MOUSE_NO_DEVICE
  12396.  
  12397.  Example
  12398.  
  12399.    This example creates a mouse handle, enables the mouse pointer to be
  12400.    drawn, and runs within an infinite for loop until there are no events in
  12401.    the queue:
  12402.  
  12403.    HMOU hmou;
  12404.    MOUEVENTINFO mouevEvent;
  12405.    MOUQUEINFO mouqi;
  12406.    USHORT fWait = FALSE;
  12407.    MouOpen(0L, &hmou);
  12408.    MouDrawPtr(hmou);
  12409.    for (;;) {
  12410.        MouGetNumQueEl(&mouqi,             /* retrieves queue         */
  12411.            hmou;
  12412.        if (mouqi.cEvents > 1)             /* until the last queue... */
  12413.            MouReadEventQue(&mouevEvent, &fWait, hmou);
  12414.        else
  12415.            break;
  12416.    }
  12417.  
  12418.  See Also
  12419.  
  12420.    MouFlushQue, MouOpen, MouReadEventQue
  12421.  
  12422.  
  12423.  ────────────────────────────────────────────────────────────────────────────
  12424.  MouGetPtrPos
  12425.  ────────────────────────────────────────────────────────────────────────────
  12426.    USHORT MouGetPtrPos (pmouplPosition, hmou)
  12427.    PPTRLOC pmoupl;         /*pointer to structure for current mouse        */
  12428.                            /*position                                      */
  12429.    HMOU hmou;              /*mouse handle                                  */
  12430.  
  12431.    The MouGetPtrPos function retrieves the current position of the mouse
  12432.    device. This position is given in screen coordinates.
  12433.  
  12434.  Parameters
  12435.  
  12436.    pmoupl  Points to the PTRLOC structure that receives the coordinates of
  12437.    the mouse position. The PTRLOC structure has the following form:
  12438.  
  12439.    typedef struct _PTRLOC {
  12440.        USHORT row;
  12441.        USHORT col;
  12442.    } PTRLOC;
  12443.  
  12444.    For a full description, see Chapter 4, "Types, Macros, Structures."
  12445.  
  12446.    hmou  Identifies the mouse. The handle must have been created previously
  12447.    by using the MouOpen function.
  12448.  
  12449.  Return Value
  12450.  
  12451.    The return value is zero if the function is successful. Otherwise, it is
  12452.    an error value, which may be the following:
  12453.  
  12454.          ERROR_MOUSE_NO_DEVICE
  12455.  
  12456.  Comments
  12457.  
  12458.    The current device status as defined by the MouSetDevStatus function does
  12459.    not affect the row and col fields of the PTRLOC structure. These fields
  12460.    always specify an absolute position relative to the upper-left corner of
  12461.    the screen.
  12462.  
  12463.  Example
  12464.  
  12465.    This example creates a mouse handle and enables the mouse pointer to be
  12466.    drawn. It then displays the text "Place mouse here" at the top of the
  12467.    screen and repeatedly calls the MouGetPtrPos function until the mouse is
  12468.    moved over the text:
  12469.  
  12470.    PTRLOC moupl;
  12471.    HMOU hmou;
  12472.    BYTE bAttr = 0x72;      /* green character on white background */
  12473.    MouOpen(0L, &hmou);
  12474.    MouDrawPtr(hmou);
  12475.    VioWrtCharStrAtt("Place mouse here", 16, 0, 35, &bAttr, 0);
  12476.    do
  12477.        MouGetPtrPos(&moupl, hmou);
  12478.    while (moupl.row != 0 || (moupl.col < 35 || moupl.col > 50));
  12479.  
  12480.  See Also
  12481.  
  12482.    MouOpen, MouSetDevStatus, MouSetPtrPos
  12483.  
  12484.  
  12485.  ────────────────────────────────────────────────────────────────────────────
  12486.  MouGetPtrShape
  12487.  ────────────────────────────────────────────────────────────────────────────
  12488.    USHORT MouGetPtrShape (pbBuffer, pmoupsInfo, hmou)
  12489.    PBYTE pbBuffer;         /*pointer to buffer for shape masks             */
  12490.    PPTRSHAPE pmoupsInfo;   /*pointer to structure for shape information    */
  12491.    HMOU hmou;              /*mouse handle                                  */
  12492.  
  12493.    The MouGetPtrShape function retrieves the AND and XOR masks that define
  12494.    the shape of the pointer for the specified mouse. MouGetPtrShape also
  12495.    retrieves information about the pointer, such as the width and height of
  12496.    masks and the location of the hot spot.
  12497.  
  12498.  Parameters
  12499.  
  12500.    pbBuffer  Points to the buffer that receives the masks.
  12501.  
  12502.    pmoupsInfo  Points to the PTRSHAPE structure that receives the pointer
  12503.    information. The PTRSHAPE structure has the following form:
  12504.  
  12505.    typedef struct _PTRSHAPE {
  12506.        USHORT cb;
  12507.        USHORT col;
  12508.        USHORT row;
  12509.        USHORT colHot;
  12510.        USHORT rowHot;
  12511.    } PTRSHAPE;
  12512.  
  12513.    For a full description, see Chapter 4, "Types, Macros, Structures."
  12514.  
  12515.    hmou  Identifies the mouse. The handle must have been created previously
  12516.    by using the MouOpen function.
  12517.  
  12518.  Return Value
  12519.  
  12520.    The return value is zero if the function is successful. Otherwise, it is
  12521.    an error value, which may be one of the following:
  12522.  
  12523.          ERROR_MOUSE_INV_PARMS
  12524.          ERROR_MOUSE_NO_DEVICE
  12525.  
  12526.  Comments
  12527.  
  12528.    The MouGetPtrShape function copies the AND and XOR masks to the buffer
  12529.    pointed to by the pbBuffer parameter. The format and size of the masks
  12530.    depend on the display device and the video mode. In text mode, each mask
  12531.    is typically a character/attribute pair. In graphics mode, each mask is a
  12532.    bitmap.
  12533.  
  12534.    The MouGetPtrShape function copies information about the pointer to the
  12535.    structure pointed to by the pmoupsInfo parameter. This structure defines
  12536.    the length (in bytes) of the AND and XOR masks, the width and height of
  12537.    each mask, and the offset from the current mouse position (or hot spot) to
  12538.    the upper-left corner of the pointer shape.
  12539.  
  12540.    Before calling MouGetPtrShape, you must set the cb field of the PTRSHAPE
  12541.    structure to the appropriate buffer size. If the field does not specify an
  12542.    appropriate size, the function copies the current size to the field and
  12543.    returns an error without copying the masks to the specified buffer.
  12544.  
  12545.  Example
  12546.  
  12547.    This example creates a mouse handle, draws the mouse pointer, and calls
  12548.    the MouGetPtrShape function to retrieve the shape of the mouse pointer:
  12549.  
  12550.    PTRSHAPE moupsInfo;
  12551.    BYTE abBuffer[4];
  12552.    HMOU hmou;
  12553.    MouOpen(0L, &hmou);
  12554.    MouDrawPtr(hmou);
  12555.    moupsInfo.cb = sizeof(abBuffer);
  12556.    MouGetPtrShape(abBuffer, &moupsInfo, hmou);
  12557.  
  12558.  See Also
  12559.  
  12560.    MouOpen, MouSetPtrShape
  12561.  
  12562.  
  12563.  ────────────────────────────────────────────────────────────────────────────
  12564.  MouGetScaleFact
  12565.  ────────────────────────────────────────────────────────────────────────────
  12566.    USHORT MouGetScaleFact (pmouscFactors, hmou)
  12567.    PSCALEFACT pmouscFactors;
  12568.                            /*pointer to structure for scaling factors      */
  12569.    HMOU hmou;              /*mouse handle                                  */
  12570.  
  12571.    The MouGetScaleFact function retrieves the horizontal and vertical scaling
  12572.    factors for the specified mouse. The scaling factors define the number of
  12573.    mickeys the mouse must travel horizontally or vertically in order to cause
  12574.    MS OS/2 to move the mouse pointer one screen unit.
  12575.  
  12576.  Parameters
  12577.  
  12578.    pmouscFactors  Points to the SCALEFACT structure that receives the scaling
  12579.    factors. The SCALEFACT structure has the following form:
  12580.  
  12581.    typedef struct _SCALEFACT {
  12582.        USHORT rowScale;
  12583.        USHORT colScale;
  12584.    } SCALEFACT;
  12585.  
  12586.    For a full description, see Chapter 4, "Types, Macros, Structures."
  12587.  
  12588.    hmou  Identifies the mouse. The handle must have been created previously
  12589.    by using the MouOpen function.
  12590.  
  12591.  Return Value
  12592.  
  12593.    The return value is zero if the function is successful. Otherwise, it is
  12594.    an error value, which may be the following:
  12595.  
  12596.          ERROR_MOUSE_NO_DEVICE
  12597.  
  12598.  Example
  12599.  
  12600.    This example creates a mouse handle then calls the MouGetScaleFact
  12601.    function to retrieve the scaling factors for the row and column
  12602.    coordinates:
  12603.  
  12604.    SCALEFACT mouscFactors;
  12605.    HMOU hmou;
  12606.    MouOpen(0L, &hmou);
  12607.    MouGetScaleFact(&mouscFactors, hmou);  /* retrieves scaling factors */
  12608.  
  12609.  See Also
  12610.  
  12611.    MouGetNumMickeys, MouOpen, MouSetScaleFact
  12612.  
  12613.  
  12614.  ────────────────────────────────────────────────────────────────────────────
  12615.  MouInitReal
  12616.  ────────────────────────────────────────────────────────────────────────────
  12617.    USHORT MouInitReal (pszDriverName)
  12618.    PSZ pszDriverName;      /*pointer to string for name of mouse           */
  12619.                            /*device driver                                 */
  12620.  
  12621.    The MouInitReal function loads and initializes the real-mode mouse device
  12622.    driver pointed to by the pszDriverName parameter. You must specify the
  12623.    name of the mouse device driver by using a device command in the
  12624.    config.sys file.
  12625.  
  12626.    This function is used only by the Task Manager.
  12627.  
  12628.  Parameters
  12629.  
  12630.    pszDriverName  Points to the null-terminated string that specifies the
  12631.    name of the mouse device driver. The name must be a valid filename. You
  12632.    can initialize the default mouse device driver by setting this parameter
  12633.    to zero.
  12634.  
  12635.  Return Value
  12636.  
  12637.    The return value is zero if the function is successful. Otherwise, it is
  12638.    an error value, which may be the following:
  12639.  
  12640.          ERROR_MOUSE_NO_DEVICE
  12641.  
  12642.  Comments
  12643.  
  12644.    The Mou functions are not available in real-mode programs. Instead, all
  12645.    real-mode mouse input and output must be carried out using the real-mode
  12646.    (int 33h) interface.
  12647.  
  12648.  See Also
  12649.  
  12650.    MouOpen
  12651.  
  12652.  
  12653.  ────────────────────────────────────────────────────────────────────────────
  12654.  MouOpen
  12655.  ────────────────────────────────────────────────────────────────────────────
  12656.    USHORT MouOpen (pszDriverName, phmou)
  12657.    PSZ pszDriverName;      /*pointer to mouse driver name                  */
  12658.    PHMOU phmou;            /*pointer to variable for mouse handle          */
  12659.  
  12660.    The MouOpen function opens the mouse for the current screen group and
  12661.    creates a handle that can be used in subsequent Mou functions (to display
  12662.    the mouse pointer, retrieve the current location of the mouse pointer,
  12663.    etc.).
  12664.  
  12665.    The MouOpen function creates the mouse handle for the current screen group
  12666.    only. Any number of processes may open this handle, but all processes in
  12667.    the screen group share it. For example, if one process changes the color
  12668.    of the mouse pointer, the pointer color changes for all other processes in
  12669.    the same screen group.
  12670.  
  12671.    When the mouse handle is first created, MouOpen does not display the mouse
  12672.    pointer. The MouDrawPtr function must be called to display the pointer. (A
  12673.    mouse device driver is required to draw the pointer. If the mouse device
  12674.    driver pointed by the pszDriverName parameter does not exist or cannot be
  12675.    opened, an error occurs and the pointer is not drawn. If pszDriverName is
  12676.    set to zero, the default mouse device driver is used; that is, the driver
  12677.    specified in a device command in the config.sys file is used.)
  12678.  
  12679.  Parameters
  12680.  
  12681.    pszDriverName  Points to the null-terminated string that contains the name
  12682.    of the mouse device driver. The name must be a valid filename. If this
  12683.    parameter is set to zero, the default pointer-draw driver is used.
  12684.  
  12685.    phmou  Points to the variable that receives the mouse handle.
  12686.  
  12687.  Return Value
  12688.  
  12689.    The return value is zero if the function is successful. Otherwise, it is
  12690.    an error value, which may be one of the following:
  12691.  
  12692.          ERROR_MOUSE_INV_MODULE
  12693.          ERROR_MOUSE_NO_DEVICE
  12694.  
  12695.  Example
  12696.  
  12697.    This example calls the MouOpen function to create a mouse handle to be
  12698.    used by the current screen group:
  12699.  
  12700.    HMOU hmou;
  12701.    MouOpen(0L, &hmou);
  12702.  
  12703.  See Also
  12704.  
  12705.    MouClose, MouDrawPtr
  12706.  
  12707.  
  12708.  ────────────────────────────────────────────────────────────────────────────
  12709.  MouReadEventQue
  12710.  ────────────────────────────────────────────────────────────────────────────
  12711.    USHORT MouReadEventQue (pmouevEvent, pfWait, hmou)
  12712.    PMOUEVENTINFO pmouevEvent;
  12713.                            /*pointer to structure for mouse event          */
  12714.    PUSHORT pfWait;         /*wait/no-wait flag                             */
  12715.    HMOU hmou;              /*mouse handle                                  */
  12716.  
  12717.    The MouReadEventQue function retrieves a mouse event from the event queue
  12718.    of the specified mouse. The event queue is a buffer to which MS OS/2
  12719.    copies each mouse event. A mouse event is a structure that specifies the
  12720.    user action that generated the event, the location of the mouse when the
  12721.    event occurred, and system time when the event occurred.
  12722.  
  12723.    MS OS/2 copies a mouse event to the event queue whenever the user moves
  12724.    the mouse or presses or releases a mouse button. The mouse event can
  12725.    specify a single action or a combination of actions, such as the mouse
  12726.    being moved with a button down. MS OS/2 copies a mouse event for a given
  12727.    action only if the event mask enables reporting for that action. For more
  12728.    information, see the MouSetEventMask function.
  12729.  
  12730.  Parameters
  12731.  
  12732.    pmouevEvent  Points to the MOUEVENTINFO structure that receives the mouse
  12733.    event. The MOUEVENTINFO structure has the following form:
  12734.  
  12735.    typedef struct _MOUEVENTINFO {
  12736.        USHORT fs;
  12737.        ULONG time;
  12738.        USHORT row;
  12739.        USHORT col;
  12740.    } MOUEVENTINFO;
  12741.  
  12742.    For a full description, see Chapter 4, "Types, Macros, Structures."
  12743.  
  12744.    pfWait  Points to the variable that specifies whether the function waits
  12745.    for an event. If this parameter is MOU_NOWAIT and the queue is empty, the
  12746.    function fills the MOUEVENTINFO structure with zeros and returns
  12747.    immediately. If the parameter is MOU_WAIT, the function waits for a mouse
  12748.    event if none is available.
  12749.  
  12750.    hmou  Identifies the mouse. The handle must have been created previously
  12751.    by using the MouOpen function.
  12752.  
  12753.  Return Value
  12754.  
  12755.    The return value is zero if the function is successful. Otherwise, it is
  12756.    an error value, which may be one of the following:
  12757.  
  12758.          ERROR_MOUSE_INV_PARMS
  12759.          ERROR_MOUSE_NO_DEVICE
  12760.          NO_ERROR_MOUSE_NO_DATA
  12761.  
  12762.  Comments
  12763.  
  12764.    Button 1 is the left button on the mouse.
  12765.  
  12766.    The meaning of the row and col fields of the MOUEVENTINFO structure
  12767.    depends on the current device status as defined by the most recently used
  12768.    MouSetDevStatus function. The values may be absolute or relative, and the
  12769.    units may be mickeys, character cells, or pels.
  12770.  
  12771.    Although a specific action may not generate a mouse event, the fs field of
  12772.    the MOUEVENTINFO structure may include information about the action when
  12773.    some other event occurs. For example, even if button 2 is disabled, fs is
  12774.    set to 0x0014 if the user presses button 1 when button 2 is also down. If
  12775.    the pfWait parameter is MOU_NOWAIT, fs will be zero if either a
  12776.    mouse-button-up event occurs or no event occurs. To see whether an event
  12777.    occurred, check the time field; it will be zero if there was no event.
  12778.  
  12779.  Example
  12780.  
  12781.    This example creates a mouse handle, enables the mouse pointer to be
  12782.    drawn, and calls the MouReadEventQue function, telling it to wait until a
  12783.    mouse event occurs. If the mouse event is the left mouse button down, the
  12784.    message "Left Button" is displayed:
  12785.  
  12786.    MOUEVENTINFO mouevEvent;
  12787.    HMOU hmou;
  12788.    USHORT fWait = TRUE;                /* waits for mouse event     */
  12789.    MouOpen(0L, &hmou);
  12790.    MouDrawPtr(hmou);
  12791.    MouReadEventQue(&mouevEvent, &fWait, hmou);
  12792.    if (mouevEvent.fs & 0x04)           /* if left button pressed... */
  12793.        VioWrtTTY("Left Button\n\r", 13, 0);
  12794.  
  12795.  See Also
  12796.  
  12797.    MouGetNumQueEl, MouOpen, MouSetDevStatus, MouSetEventMask
  12798.  
  12799.  
  12800.  ────────────────────────────────────────────────────────────────────────────
  12801.  MouRegister
  12802.  ────────────────────────────────────────────────────────────────────────────
  12803.    USHORT MouRegister (pszModuleName, pszEntryName, flFunctions)
  12804.    PSZ pszModuleName;      /*pointer to string for module name             */
  12805.    PSZ pszEntryName;       /*pointer to string for entry name              */
  12806.    ULONG flFunctions;      /*function flags                                */
  12807.  
  12808.    The MouRegister function registers a Mou subsystem for the specified
  12809.    mouse. The function temporarily replaces the one (or more) default Mou
  12810.    functions, as specified by the flFunctions parameter, with the functions
  12811.    in the module pointed to by the pszModuleName parameter. Once MouRegister
  12812.    replaces a function, MS OS/2 passes any subsequent calls to the replaced
  12813.    function to a function in the given module. If you do not replace a
  12814.    function, MS OS/2 continues to call the default Mou function.
  12815.  
  12816.  Parameters
  12817.  
  12818.    pszModuleName  Points to the null-terminated string that contains the name
  12819.    of the dynamic-link module containing the replacement Mou functions.
  12820.  
  12821.    pszEntryName  Points to the null-terminated string that contains the
  12822.    dynamic-link entry-point name of the function that replaces the specified
  12823.    Mou function. For a full description, see the following "Comments"
  12824.    section.
  12825.  
  12826.    flFunctions  Specifies the flags of the Mou functions to replace. It can
  12827.    be any combination of the following values:
  12828.  
  12829. ╓┌─┌─────────────────────┌───────────────────────────────────────────────────╖
  12830.    Value                 Meaning
  12831.    ──────────────────────────────────────────────────────────────────────────
  12832.    MR_MOUGETNUMBUTTONS   Replace MouGetNumButtons.
  12833.    Value                 Meaning
  12834.    ──────────────────────────────────────────────────────────────────────────
  12835.    MR_MOUGETNUMBUTTONS   Replace MouGetNumButtons.
  12836.  
  12837.    MR_MOUGETNUMMICKEYS   Replace MouGetNumMickeys.
  12838.  
  12839.    MR_MOUGETDEVSTATUS    Replace MouGetDevStatus.
  12840.  
  12841.    MR_MOUGETNUMQUEEL     Replace MouGetNumQueEl.
  12842.  
  12843.    MR_MOUREADEVENTQUE    Replace MouReadEventQue.
  12844.  
  12845.    MR_MOUGETSCALEFACT    Replace MouGetScaleFact.
  12846.  
  12847.    MR_MOUGETEVENTMASK    Replace MouGetEventMask.
  12848.  
  12849.    MR_MOUSETSCALEFACT    Replace MouSetScaleFact.
  12850.  
  12851.    MR_MOUSETEVENTMASK    Replace MouSetEventMask.
  12852.  
  12853.    MR_MOUOPEN            Replace MouOpen.
  12854.    Value                 Meaning
  12855.    ──────────────────────────────────────────────────────────────────────────
  12856.   MR_MOUOPEN            Replace MouOpen.
  12857.  
  12858.    MR_MOUCLOSE           Replace MouClose.
  12859.  
  12860.    MR_MOUGETPTRSHAPE     Replace MouGetPtrShape.
  12861.  
  12862.    MR_MOUSETPTRSHAPE     Replace MouSetPtrShape.
  12863.  
  12864.    MR_MOUDRAWPTR         Replace MouDrawPtr.
  12865.  
  12866.    MR_MOUREMOVEPTR       Replace MouRemovePtr.
  12867.  
  12868.    MR_MOUGETPTRPOS       Replace MouGetPtrPos.
  12869.  
  12870.    MR_MOUSETPTRPOS       Replace MouSetPtrPos.
  12871.  
  12872.    MR_MOUINITREAL        Replace MouInitReal.
  12873.  
  12874.    MR_MOUSETDEVSTATUS    Replace MouSetDevStatus.
  12875.    Value                 Meaning
  12876.    ──────────────────────────────────────────────────────────────────────────
  12877.   MR_MOUSETDEVSTATUS    Replace MouSetDevStatus.
  12878.    ──────────────────────────────────────────────────────────────────────────
  12879.  
  12880.  
  12881.  Return Value
  12882.  
  12883.    The return value is zero if the function is successful. Otherwise, it is
  12884.    an error value, which may be one of the following:
  12885.  
  12886.          ERROR_MOUSE_INVALID_ASCIIZ
  12887.          ERROR_MOUSE_INVALID_MASK
  12888.          ERROR_MOUSE_REGISTER
  12889.  
  12890.  Comments
  12891.  
  12892.    MS OS/2 passes a Mou function to the given module by preparing the stack
  12893.    and calling the function pointed to by the pszEntryName parameter.
  12894.    Specified module must export the entry-point function name. The
  12895.    entry-point function must check the function code on the stack to
  12896.    determine which function is being requested, then pass control to the
  12897.    appropriate function in the module. The entry-point function may then
  12898.    access any additional parameters placed on the stack by the MouRegister
  12899.    function.
  12900.  
  12901.    Only one process in a screen group may use the MouRegister function at any
  12902.    given time. That is, only one process at a time can replace Mou functions.
  12903.    The process can restore the default Mou functions by calling the
  12904.    MouDeRegister function. A process can replace a Mou function any number of
  12905.    times, but only by first restoring the default functions and then
  12906.    reregistering the new functions.
  12907.  
  12908.    The entry-point function (FuncName) must have the following form:
  12909.  
  12910.      SHORT FAR FuncName(usReserved1, usFunction, ulReserved2,
  12911.          usParam1, usParam2, usParam3, usParam4, usParam5)
  12912.      USHORT usReserved1;
  12913.      USHORT usFunction;
  12914.      ULONG ulReserved2;
  12915.      USHORT usParam1;
  12916.      USHORT usParam2;
  12917.      USHORT usParam3;
  12918.      USHORT usParam4;
  12919.      USHORT usParam5;
  12920.  
  12921. ╓┌─┌─────────────────┌───────────────────────────────────────────────────────╖
  12922.    Parameter         Description
  12923.    ──────────────────────────────────────────────────────────────────────────
  12924.    usReserved1       Specifies a reserved value that must not be changed.
  12925.                      This value represents a return address for the MS OS/2
  12926.                      function that routes Mou function calls.
  12927.  
  12928.    usFunction        Specifies the function code that identifies the function
  12929.                      request. It can be one of the following values:
  12930.  
  12931.                      Value     Meaning
  12932.                      ────────────────────────────────────────────────────────
  12933.                      0x0000    MouGetNumButtons called.
  12934.                      0x0001    MouGetNumMickeys called.
  12935.                      0x0002    MouGetDevStatus called.
  12936.                      0x0003    MouGetNumQueEl called.
  12937.                      0x0004    MouReadEventQue called.
  12938.    Parameter         Description
  12939.    ──────────────────────────────────────────────────────────────────────────
  12940.                     0x0004    MouReadEventQue called.
  12941.                      0x0005    MouGetScaleFact called.
  12942.                      0x0006    MouGetEventMask called.
  12943.                      0x0007    MouSetScaleFact called.
  12944.                      0x0008    MouSetEventMask called.
  12945.                      0x0009    MouGetHotKey called.
  12946.                      0x000A    MouSetHotKey called.
  12947.                      0x000B    MouOpen called.
  12948.                      0x000C    MouClose called.
  12949.                      0x000D    MouGetPtrShape called.
  12950.                      0x000E    MouSetPtrShape called.
  12951.                      0x000F    MouDrawPtr called.
  12952.                      0x0010    MouRemovePtr called.
  12953.                      0x0011    MouGetPtrPos called.
  12954.                      0x0012    MouSetPtrPos called.
  12955.                      0x0013    MouInitReal called.
  12956.                      0x0014    MouFlushQue called.
  12957.                      0x0015    MouSetDevStatus called.
  12958.  
  12959.    Parameter         Description
  12960.    ──────────────────────────────────────────────────────────────────────────
  12961. 
  12962.    ulReserved2       Specifies a reserved value that must not be changed.
  12963.                      This value represents the return address of the program
  12964.                      that calls the specified Mou function.
  12965.  
  12966.    usParam1-usParam5 Specifies up to five values passed with the original Mou
  12967.                      function call. The actual number and type of parameters
  12968.                      used depend on the specific function.
  12969.    ──────────────────────────────────────────────────────────────────────────
  12970.  
  12971.  
  12972.    The registered function should return -1 if it wants the original function
  12973.    called, 0 if no error occurred, or an error value.
  12974.  
  12975.    The entry-point function should determine which function is requested and
  12976.    then carry out an appropriate action using the passed parameters. If
  12977.    necessary, the entry-point function can call a replacement function within
  12978.    the given module to carry out the task. The entry-point or replacement
  12979.    function must leave the stack in the same state it was received. This is
  12980.    required since the return addresses on the stack must be available in the
  12981.    correct order to return control to the program that originally called the
  12982.    MouRegister function.
  12983.  
  12984.    In general, if the replacement function needs to access the mouse, it must
  12985.    use the input-and-output control functions for the mouse. For more
  12986.    information, see Chapter 3, "Input-and-Output Control Functions."
  12987.  
  12988.    The MouRegister function itself cannot be replaced.
  12989.  
  12990.  See Also
  12991.  
  12992.    MouDeRegister
  12993.  
  12994.  
  12995.  ────────────────────────────────────────────────────────────────────────────
  12996.  MouRemovePtr
  12997.  ────────────────────────────────────────────────────────────────────────────
  12998.    USHORT MouRemovePtr (pmourtRect, hmou)
  12999.    PNOPTRRECT pmourtRect;  /*pointer to structure with exclusion rectangle */
  13000.    HMOU hmou;              /*mouse handle                                  */
  13001.  
  13002.    The MouRemovePtr function removes the mouse pointer from a portion of the
  13003.    screen or from the entire screen. This part of the screen is called an
  13004.    exclusion rectangle, because when the mouse pointer moves into it, the
  13005.    pointer disappears──it is still present and can be moved, but it will not
  13006.    appear until it is moved out of the exclusion rectangle. If the pointer is
  13007.    outside the exclusion rectangle and is not currently displayed, MS OS/2
  13008.    draws the mouse pointer.
  13009.  
  13010.    The MouRemovePtr function may be called by any process in the screen
  13011.    group. Only one exclusion rectangle is active at a time, so each call to
  13012.    the function replaces the previous rectangle. The MouDrawPtr function
  13013.    removes the exclusion rectangle completely.
  13014.  
  13015.  Parameters
  13016.  
  13017.    pmourtRect  Points to the NOPTRRECT structure that contains the
  13018.    coordinates of the exclusion rectangle. The NOPTRRECT structure has the
  13019.    following form:
  13020.  
  13021.    typedef struct _NOPTRRECT {
  13022.        USHORT row;
  13023.        USHORT col;
  13024.        USHORT cRow;
  13025.        USHORT cCol;
  13026.    } NOPTRRECT;
  13027.  
  13028.    For a full description, see Chapter 4, "Types, Macros, Structures."
  13029.  
  13030.    hmou  Identifies the mouse. The handle must have been created previously
  13031.    by using the MouOpen function.
  13032.  
  13033.  Return Value
  13034.  
  13035.    The return value is zero if the function is successful. Otherwise, it is
  13036.    an error value, which may be one of the following:
  13037.  
  13038.          ERROR_MOUSE_INV_PARMS
  13039.          ERROR_MOUSE_NO_DEVICE
  13040.  
  13041.  Comments
  13042.  
  13043.    You should exclude the mouse pointer from any portion of the screen that
  13044.    is likely to change, such as a text-entry field. When you position the
  13045.    mouse pointer, MS OS/2 saves the character beneath it; when you move the
  13046.    mouse again, MS OS/2 restores the character. If the character changed
  13047.    between the time you positioned the mouse and the time you moved it, the
  13048.    new character is lost when MS OS/2 restores the old character.
  13049.  
  13050.  Example
  13051.  
  13052.    This example creates a mouse handle and enables the mouse pointer to be
  13053.    drawn. It then defines an exclusion rectangle in the center of the screen
  13054.    and calls the MouRemovePtr function to notify the mouse device driver that
  13055.    this rectangle is for the exclusive use of the process. When you move the
  13056.    mouse pointer into this rectangle, the pointer disappears:
  13057.  
  13058.    NOPTRRECT mourtRect;
  13059.    HMOU hmou;
  13060.    MouOpen(0L, &hmou);
  13061.    MouDrawPtr(hmou);
  13062.    mourtRect.row = 6;
  13063.    mourtRect.col = 30;                 /* upper-left y-coordinate     */
  13064.    mourtRect.cRow = 18;                /* lower-right x-coordinate    */
  13065.    mourtRect.cCol = 50;                /* lower-right y-coordinate    */
  13066.    MouRemovePtr(&mourtRect, hmou);
  13067.  
  13068.  See Also
  13069.  
  13070.    MouDrawPtr, MouOpen, MouSetPtrShape
  13071.  
  13072.  
  13073.  ────────────────────────────────────────────────────────────────────────────
  13074.  MouSetDevStatus
  13075.  ────────────────────────────────────────────────────────────────────────────
  13076.    USHORT MouSetDevStatus (pfsDevStatus, hmou)
  13077.    PUSHORT pfsDevStatus;   /*pointer to buffer with status                 */
  13078.    HMOU hmou;              /*mouse handle                                  */
  13079.  
  13080.    The MouSetDevStatus function sets the device status for the specified
  13081.    mouse. The device status enables or disables the mouse device driver and
  13082.    defines whether the mouse position is reported in mickeys or in screen
  13083.    units (character cells or pels).
  13084.  
  13085.  Parameters
  13086.  
  13087.    pfsDevStatus  Points to the variable that contains the device status to be
  13088.    set. This parameter can be any combination of the following values:
  13089.  
  13090.    Value          Meaning
  13091.    ──────────────────────────────────────────────────────────────────────────
  13092.    MOUSE_DISABLED Disable the default mouse device driver. If this value is
  13093.                   not given, the function enables the mouse device driver.
  13094.  
  13095.    MOUSE_MICKEYS  Report mouse motion in mickeys; that is, MS OS/2 reports
  13096.                   motion as a number of mickeys moved from the last-reported
  13097.                   position. If the value is not given, MS OS/2 reports mouse
  13098.                   motion in screen units relative to the upper-left corner of
  13099.                   the screen.
  13100.    ──────────────────────────────────────────────────────────────────────────
  13101.  
  13102.    hmou  Identifies the mouse. The handle must have been created previously
  13103.    by using the MouOpen function.
  13104.  
  13105.  Return Value
  13106.  
  13107.    The return value is zero if the function is successful. Otherwise, it is
  13108.    an error value, which may be one of the following:
  13109.  
  13110.          ERROR_MOUSE_INV_PARMS
  13111.          ERROR_MOUSE_NO_DEVICE
  13112.  
  13113.  Comments
  13114.  
  13115.    The MouSetDevStatus function enables or disables the mouse device driver.
  13116.    When this device driver is enabled, it draws the pointer by combining the
  13117.    AND and XOR masks of the pointer shape with the contents of the screen at
  13118.    the current mouse location. It draws the pointer whenever the mouse moves
  13119.    (or when an interrupt associated with the mouse occurs). When the mouse
  13120.    device driver is disabled, the function does not draw the pointer. In such
  13121.    cases, the process must draw the pointer for itself.
  13122.  
  13123.    The MouSetDevStatus function also directs the mouse to report relative or
  13124.    absolute positions. If the device is set to report absolute positions, the
  13125.    x- and y-coordinates given for a mouse position are in screen units
  13126.    relative to the upper-left corner of the screen. The type of unit depends
  13127.    on the screen mode. In text mode, the position is given in character
  13128.    cells; in graphics mode, the position is given in pels. Screen coordinates
  13129.    increase from left to right on the x-axis and from top to bottom on the
  13130.    y-axis. If the device is set to report relative positions, the x- and
  13131.    y-coordinates for a mouse position are given in mickeys and are relative
  13132.    to the most recently reported position. In this case, the coordinates are
  13133.    signed values, defining both the direction and distance of the move. The
  13134.    x-coordinate is negative when the mouse moves left; the y-coordinate is
  13135.    negative when the mouse moves up.
  13136.  
  13137.  Example
  13138.  
  13139.    This example creates a mouse handle then calls the MouGetDevStatus
  13140.    function to set the device status so that mouse-movement information is
  13141.    returned in terms of mickeys, not pels. This allows the process to obtain
  13142.    mouse information in terms of relative movement rather than in terms of
  13143.    absolute pel position:
  13144.  
  13145.    USHORT fsDevStatus = 0x0200;            /* returns mickeys    */
  13146.    HMOU hmou;
  13147.    MouOpen(0L, &hmou);
  13148.    MouSetDevStatus(&fsDevStatus, hmou);    /* sets device status */
  13149.  
  13150.  See Also
  13151.  
  13152.    MouGetDevStatus, MouOpen
  13153.  
  13154.  
  13155.  ────────────────────────────────────────────────────────────────────────────
  13156.  MouSetEventMask
  13157.  ────────────────────────────────────────────────────────────────────────────
  13158.    USHORT MouSetEventMask (pfsEvents, hmou)
  13159.    PUSHORT pfsEvents;      /*pointer to buffer with event mask             */
  13160.    HMOU hmou;              /*mouse handle                                  */
  13161.  
  13162.    The MouSetEventMask function sets the event mask for the specified mouse.
  13163.    The event mask defines the user actions that generate mouse events
  13164.    (movement or pressing or releasing a button).
  13165.  
  13166.    The MouSetEventMask function enables or disables specific user actions.
  13167.    When an action is enabled, MS OS/2 copies a mouse event to the event queue
  13168.    whenever the user carries out the action. When an action is disabled, no
  13169.    mouse event is copied.
  13170.  
  13171.  Parameters
  13172.  
  13173.    pfsEvents  Points to the variable that contains the event mask. The
  13174.    variable can be any combination of the following values:
  13175.  
  13176.    Value                        Meaning
  13177.    ──────────────────────────────────────────────────────────────────────────
  13178.    MOUSE_MOTION                 Enable mouse motion with no-buttons-down
  13179.                                 event.
  13180.  
  13181.    MOUSE_MOTION_WITH_BN1_DOWN   Enable mouse motion with button-1-down event.
  13182.  
  13183.    MOUSE_BN1_DOWN               Enable button-1-down event.
  13184.  
  13185.    MOUSE_MOTION_WITH_BN2_DOWN   Enable mouse motion with button-2-down event.
  13186.  
  13187.    MOUSE_BN2_DOWN               Enable button-2-down event.
  13188.  
  13189.    MOUSE_MOTION_WITH_BN3_DOWN   Enable mouse motion with button-3-down event.
  13190.  
  13191.    MOUSE_BN3_DOWN               Enable button-3-down event.
  13192.    ──────────────────────────────────────────────────────────────────────────
  13193.  
  13194.    hmou  Identifies the mouse. The handle must have been created previously
  13195.    by using the MouOpen function.
  13196.  
  13197.  Return Value
  13198.  
  13199.    The return value is zero if the function is successful. Otherwise, it is
  13200.    an error value, which may be one of the following:
  13201.  
  13202.          ERROR_MOUSE_INV_PARMS
  13203.          ERROR_MOUSE_NO_DEVICE
  13204.  
  13205.  Comments
  13206.  
  13207.    Button 1 is the left button on the mouse.
  13208.  
  13209.  Example
  13210.  
  13211.    This example creates a mouse handle then calls the MouSetEventMask
  13212.    function to set the event mask so that only the mouse motion or the
  13213.    pressing of the left button are recognized by the MouReadEventQue
  13214.    function:
  13215.  
  13216.    USHORT fsEvents;
  13217.    HMOU hmou;
  13218.    MouOpen(0L, &hmou);
  13219.  
  13220.    /* detect motion and button 1 */
  13221.  
  13222.    fsEvents = MOUSE_MOTION |
  13223.        MOUSE_MOTION_WITH_BN1_DOWN | MOUSE_MOTION_WITH_BN1_DOWN;
  13224.    MouSetEventMask(&fsEvents, hmou);
  13225.  
  13226.  See Also
  13227.  
  13228.    MouGetEventMask, MouOpen, MouReadEventQue
  13229.  
  13230.  
  13231.  ────────────────────────────────────────────────────────────────────────────
  13232.  MouSetPtrPos
  13233.  ────────────────────────────────────────────────────────────────────────────
  13234.    USHORT MouSetPtrPos (pmouplPosition, hmou)
  13235.    PPTRLOC pmouplPosition; /*pointer to structure for new mouse position   */
  13236.    HMOU hmou;              /*mouse handle                                  */
  13237.  
  13238.    The MouSetPtrPos function sets the current mouse position to the position
  13239.    pointed to by the pmouplPosition parameter. If the pointer is visible, the
  13240.    function moves the mouse pointer to the new location on the screen. The
  13241.    new position is always in screen units and is relative to the upper-left
  13242.    corner of the screen.
  13243.  
  13244.  Parameters
  13245.  
  13246.    pmouplPosition  Points to the PTRLOC structure that contains the new mouse
  13247.    position. The PTRLOC structure has the following form:
  13248.  
  13249.    typedef struct _PTRLOC {
  13250.        USHORT row;
  13251.        USHORT col;
  13252.    } PTRLOC;
  13253.  
  13254.    For a full description, see Chapter 4, "Types, Macros, Structures."
  13255.  
  13256.    hmou  Identifies the mouse. The handle must have been created previously
  13257.    by using the MouOpen function.
  13258.  
  13259.  Return Value
  13260.  
  13261.    The return value is zero if the function is successful. Otherwise, it is
  13262.    an error value, which may be one of the following:
  13263.  
  13264.          ERROR_MOUSE_INV_PARMS
  13265.          ERROR_MOUSE_NO_DEVICE
  13266.  
  13267.  Comments
  13268.  
  13269.    MS OS/2 hides the pointer if the new position is in the exclusion
  13270.    rectangle defined by the most recent call to the MouRemovePtr function.
  13271.  
  13272.  Example
  13273.  
  13274.    This example creates a mouse handle and calls the MouSetPtrPos function to
  13275.    initialize the mouse pointer in the upper-left corner of the screen. It
  13276.    then calls the MouDrawPtr function to enable the mouse pointer to be
  13277.    drawn:
  13278.  
  13279.    PTRLOC mouplPosition;
  13280.    HMOU hmou;
  13281.    MouOpen(0L, &hmou);
  13282.    mouplPosition.row = 0;                  /* row zero            */
  13283.    mouplPosition.col = 0;                  /* column zero         */
  13284.    MouSetPtrPos(&mouplPosition, hmou);     /* sets mouse position */
  13285.    MouDrawPtr(hmou);
  13286.  
  13287.  See Also
  13288.  
  13289.    MouDrawPtr, MouGetPtrPos, MouOpen, MouRemovePtr
  13290.  
  13291.  
  13292.  ────────────────────────────────────────────────────────────────────────────
  13293.  MouSetPtrShape
  13294.  ────────────────────────────────────────────────────────────────────────────
  13295.    USHORT MouSetPtrShape (pbBuffer, pmoupsInfo, hmou)
  13296.    PBYTE pbBuffer;         /*pointer to buffer with shape masks            */
  13297.    PPTRSHAPE pmoupsInfo;   /*pointer to structure with shape info.         */
  13298.    HMOU hmou;              /*mouse handle                                  */
  13299.  
  13300.    The MouSetPtrShape function sets the AND and XOR masks that define the
  13301.    shape of the mouse pointer for the specified mouse. MouSetPtrShape also
  13302.    sets information about the pointer, such as the width and height of masks
  13303.    and the location of the hot spot.
  13304.  
  13305.  Parameters
  13306.  
  13307.    pbBuffer  Points to the buffer that contains the new masks.
  13308.  
  13309.    pmoupsInfo  Points to the PTRSHAPE structure that contains the new pointer
  13310.    information. The PTRSHAPE structure has the following form:
  13311.  
  13312.    typedef struct _PTRSHAPE {
  13313.        USHORT cb;
  13314.        USHORT col;
  13315.        USHORT row;
  13316.        USHORT colHot;
  13317.        USHORT rowHot;
  13318.    } PTRSHAPE;
  13319.  
  13320.    For a full description, see Chapter 4, "Types, Macros, Structures."
  13321.  
  13322.    hmou  Identifies the mouse. The handle must have been created previously
  13323.    by using the MouOpen function.
  13324.  
  13325.  Return Value
  13326.  
  13327.    The return value is zero if the function is successful. Otherwise, it is
  13328.    an error value, which may be one of the following:
  13329.  
  13330.          ERROR_MOUSE_INV_PARMS
  13331.          ERROR_MOUSE_NO_DEVICE
  13332.  
  13333.  Comments
  13334.  
  13335.    The MouSetPtrShape function copies the AND and XOR masks from the buffer
  13336.    pointed to by the pbBuffer parameter. The format and size of the masks
  13337.    depend on the display device and the video mode. In text mode, each mask
  13338.    is typically a character/attribute pair. In graphics mode, each mask is a
  13339.    bitmap.
  13340.  
  13341.    The MouSetPtrShape function copies information about the pointer from the
  13342.    structure pointed to by the pmoupsInfo parameter. The structure defines
  13343.    the length (in bytes) of the AND and XOR masks, the width and height of
  13344.    each mask, and the offset from the current mouse position (or hot spot) to
  13345.    the upper-left corner of the pointer.
  13346.  
  13347.    If the pointer is displayed, the MouSetPtrShape function may not display a
  13348.    new shape immediately. If the pointer is not displayed, you must use the
  13349.    MouRemovePtr and MouDrawPtr functions to display the new shape.
  13350.  
  13351.    The pointer shape is dependent on the device driver used to support the
  13352.    display device. In text mode, MS OS/2 supports the pointer shape as a
  13353.    reverse block character. This character has a one-character height and
  13354.    width; that is, in text modes, the height and width fields must each be
  13355.    one. You can determine the current pointer shape in effect for the screen
  13356.    group by using the MouGetPtrShape function.
  13357.  
  13358.  See Also
  13359.  
  13360.    MouDrawPtr, MouGetPtrShape, MouOpen, MouRemovePtr
  13361.  
  13362.  
  13363.  ────────────────────────────────────────────────────────────────────────────
  13364.  MouSetScaleFact
  13365.  ────────────────────────────────────────────────────────────────────────────
  13366.    USHORT MouSetScaleFact (pmouscFactors, hmou)
  13367.    PSCALEFACT pmouscFactors;
  13368.                            /*pointer to structure for scaling factors      */
  13369.    HMOU hmou;              /*mouse handle                                  */
  13370.  
  13371.    The MouSetScaleFact function sets the horizontal and vertical scaling
  13372.    factors for the specified mouse. The scaling factors define the number of
  13373.    mickeys the mouse must travel horizontally or vertically to cause MS OS/2
  13374.    to move the mouse pointer one screen unit.
  13375.  
  13376.  Parameters
  13377.  
  13378.    pmouscFactors  Points to the SCALEFACT structure that contains the scaling
  13379.    factors. The SCALEFACT structure has the following form:
  13380.  
  13381.    typedef struct _SCALEFACT {
  13382.        USHORT rowScale;
  13383.        USHORT colScale;
  13384.    } SCALEFACT;
  13385.  
  13386.    For a full description, see Chapter 4, "Types, Macros, Structures."
  13387.  
  13388.    hmou  Identifies the mouse. The handle must have been created previously
  13389.    by using the MouOpen function.
  13390.  
  13391.  Return Value
  13392.  
  13393.    The return value is zero if the function is successful. Otherwise, it is
  13394.    an error value, which may be the following:
  13395.  
  13396.          ERROR_MOUSE_NO_DEVICE
  13397.  
  13398.  Example
  13399.  
  13400.    This example creates a mouse handle, enables the mouse pointer to be
  13401.    drawn, and retrieves the current scaling factor. It then doubles the
  13402.    scaling factor and calls the MouSetScaleFact function to set the new
  13403.    factor. The result is that you must move the mouse twice as far in order
  13404.    to move the pointer on the screen:
  13405.  
  13406.    SCALEFACT mouscFactors;
  13407.    HMOU hmou;
  13408.    MouOpen(0L, &hmou);
  13409.    MouDrawPtr(hmou);
  13410.    MouGetScaleFact(&mouscFactors,  /* retrieves scaling factors */
  13411.        hmou);
  13412.    mouscFactors.rowScale *= 2;     /* vertical scaling factor   */
  13413.    mouscFactors.colScale *= 2;     /* horizontal scaling factor */
  13414.    MouSetScaleFact(&mouscFactors,  /* sets new scaling factors  */
  13415.        hmou);
  13416.  
  13417.  See Also
  13418.  
  13419.    MouGetScaleFact, MouOpen
  13420.  
  13421.  
  13422.  ────────────────────────────────────────────────────────────────────────────
  13423.  MouSynch
  13424.  ────────────────────────────────────────────────────────────────────────────
  13425.    USHORT MouSynch (fWait)
  13426.    USHORT fWait;           /*wait/no-wait flag                             */
  13427.  
  13428.    The MouSynch function synchronizes access to the mouse. This function
  13429.    should be used by a Mou subsystem to prevent more than one process from
  13430.    accessing the mouse handle at any one time.
  13431.  
  13432.  Parameters
  13433.  
  13434.    fWait  Specifies whether to wait if the mouse device driver is currently
  13435.    busy. If this parameter is FALSE, the function returns control immediately
  13436.    without waiting for the device to become free. If the parameter is TRUE,
  13437.    the function waits until the mouse handle is free.
  13438.  
  13439.  Return Value
  13440.  
  13441.    The return value is zero if the function is successful. Otherwise, it is
  13442.    an error value.
  13443.  
  13444.  Comments
  13445.  
  13446.    The MouSynch function requests an exclusive system semaphore that clears
  13447.    when the Mou subsystem returns to the mouse router. The MouSynch function
  13448.    blocks all other threads within a screen group until the semaphore clears.
  13449.  
  13450.  See Also
  13451.  
  13452.    DosCloseSem, DosDevIOCtl, MouRegister
  13453.  
  13454.  
  13455.  ────────────────────────────────────────────────────────────────────────────
  13456.  VioAssociate
  13457.  ────────────────────────────────────────────────────────────────────────────
  13458.    USHORT VioAssociate (hdc, hvps)
  13459.    HDC hdc;                /*device-context handle                         */
  13460.    HVPS hvps;              /*presentation-space handle                     */
  13461.  
  13462.    The VioAssociate function associates an advanced video-input-and-output
  13463.    (AVIO) presentation space with a device context. Subsequent calls to the
  13464.    VioShowPS and VioShowBuf functions direct output to this device context.
  13465.  
  13466.    A screen device context is the only kind of device context that may be
  13467.    associated with an AVIO presentation space. If the AVIO presentation space
  13468.    is currently associated with another device context, it is disassociated.
  13469.    Similarly, if another AVIO presentation space is currently associated with
  13470.    the device context, it too is disassociated.
  13471.  
  13472.    If you specify a NULL handle for the device context, the presentation
  13473.    space is disassociated from the currently associated device context.
  13474.  
  13475.  Parameters
  13476.  
  13477.    hdc  Identifies the device context to associate with the presentation
  13478.    space. If this parameter is NULL, the function disasssociates the previous
  13479.    device context.
  13480.  
  13481.    hvps  Identifies the AVIO presentation space. The space must have been
  13482.    created previously by using the VioCreatePS function.
  13483.  
  13484.  Return Value
  13485.  
  13486.    The return value is zero if the function is successful. Otherwise, it is
  13487.    an error value.
  13488.  
  13489.  See Also
  13490.  
  13491.    VioCreatePS, VioShowBuf, VioShowPS, WinOpenWindowDC
  13492.  
  13493.  
  13494.  ────────────────────────────────────────────────────────────────────────────
  13495.  VioCreateLogFont
  13496.  ────────────────────────────────────────────────────────────────────────────
  13497.    USHORT VioCreateLogFont (pfat, lcid, pstr8Name, hvps)
  13498.    PFATTRS pfat;           /*pointer to structure for font attributes      */
  13499.    LONG lcid;              /*local identifier for font                     */
  13500.    PSTR8 pstr8Name;        /*pointer to descriptive name of logical font   */
  13501.    HVPS hvps;              /*presentation-space handle                     */
  13502.  
  13503.    The VioCreateLogFont function creates a logical font for the given
  13504.    advanced video-input-and-output (AVIO) presentation space. A logical font
  13505.    is a list of attributes, such as character size and weight, that specifies
  13506.    the font used for writing text. When a font is needed, MS OS/2 chooses
  13507.    from the available physical fonts the one that most closely matches the
  13508.    logical font. A program may, however, force selection of a particular font
  13509.    by setting the lMatch field in the FATTRS structure to the value returned
  13510.    for the requested font by the VioQueryFonts function.
  13511.  
  13512.    If the szFaceName field in the FATTRS structure is NULL and all of the
  13513.    attributes except the code page are set to zero, the system default font
  13514.    is selected, in the specified code page.
  13515.  
  13516.  Parameters
  13517.  
  13518.    pfat  Points to the FATTRS structure that contains the attributes of the
  13519.    font. The FATTRS structure has the following form:
  13520.  
  13521.    typedef struct _FATTRS {
  13522.       USHORT usRecordLength;
  13523.       USHORT fsSelection;
  13524.       LONG   lMatch;
  13525.       CHAR   szFaceName[FACESIZE];
  13526.       USHORT idRegistry;
  13527.       USHORT usCodePage;
  13528.       LONG   lMaxBaselineExt;
  13529.       LONG   lAveCharWidth;
  13530.       USHORT usWidthClass;
  13531.       USHORT usWeightClass;
  13532.       USHORT fsType;
  13533.       SHORT  sQuality;
  13534.       USHORT fsFontUse;
  13535.    } FATTRS;
  13536.  
  13537.    For a full description, see Chapter 4, "Types, Macros, Structures."
  13538.  
  13539.    lcid  Specifies the local identifier for the font. This parameter must be
  13540.    1, 2, or 3. If the identifier is already being used to refer to a font or
  13541.    bitmap, the function returns an error.
  13542.  
  13543.    pstr8Name  Points to an 8-character name that you may use to describe the
  13544.    logical font.
  13545.  
  13546.    hvps  Identifies the AVIO presentation space. This presentation space must
  13547.    have been created previously by using the VioCreatePS function.
  13548.  
  13549.  Return Value
  13550.  
  13551.    The return value is zero if the function is successful. Otherwise, it is
  13552.    an error value, indicating that an error occurred.
  13553.  
  13554.  See Also
  13555.  
  13556.    VioQueryFonts
  13557.  
  13558.  
  13559.  ────────────────────────────────────────────────────────────────────────────
  13560.  VioCreatePS
  13561.  ────────────────────────────────────────────────────────────────────────────
  13562.    USHORT VioCreatePS (phvps, cRows, cColumns, fFormat, cAttrBytes, hvps)
  13563.    PHVPS phvps;            /*pointer to variable for presentation-space    */
  13564.                            /*handle                                        */
  13565.    SHORT cRows;            /*height of presentation space                  */
  13566.    SHORT cColumns;         /*width of presentation space                   */
  13567.    SHORT fFormat;          /*format of attribute byte(s)                   */
  13568.    SHORT cAttrBytes;       /*number of attributes                          */
  13569.    HVPS hvps;              /*presentation-space handle                     */
  13570.  
  13571.    The VioCreatePS function creates an advanced video-input-and-output (AVIO)
  13572.    presentation space, the size of which must not exceed 32K. To determine
  13573.    the size of the presentation space, multiply the cColumns, cRows, and
  13574.    cAttrBytes parameters as follows: cColumns -1x+1 cRows -1x+1 (cAttrBytes +
  13575.    1).
  13576.  
  13577.  Parameters
  13578.  
  13579.    phvps  Points to the variable that receives the presentation-space handle.
  13580.    You may use this handle in subsequent Vio functions.
  13581.  
  13582.    cRows  Specifies the height (in character cells) of the presentation
  13583.    space.
  13584.  
  13585.    cColumns  Specifies the width (in character cells) of the presentation
  13586.    space.
  13587.  
  13588.    fFormat  Identifies the format of the attribute byte(s) in the
  13589.    presentation space. The content of the attribute bytes depends on the
  13590.    format. Currently, the only defined format is zero. If the format is zero,
  13591.    the attribute bytes have the following meanings:
  13592.  
  13593.    Value          Meaning
  13594.    ──────────────────────────────────────────────────────────────────────────
  13595.    FORMAT_CGA     Specifies a CGA format of two attribute bytes. The first
  13596.                   byte contains the character value. The second byte contains
  13597.                   bit fields that specify the background and foreground
  13598.                   colors. Blink and intensity fields are not supported.
  13599.  
  13600.    FORMAT_4BYTE   Specifies an extended format of four attribute bytes. The
  13601.                   first byte contains the character value. The second byte
  13602.                   contains bit fields that specify the background and
  13603.                   foreground colors. The third byte contains bit fields that
  13604.                   specify the underscore, reverse video, the background
  13605.                   opacity, and the font identifier. The fourth byte is an
  13606.                   extra byte to be used by programs.
  13607.    ──────────────────────────────────────────────────────────────────────────
  13608.  
  13609.    cAttrBytes  Specifies the number of attribute bytes per character cell in
  13610.    the presentation space. This number may be 1 or 3.
  13611.  
  13612.    hvps  Identifies the AVIO presentation space. This parameter must be zero.
  13613.  
  13614.  Return Value
  13615.  
  13616.    The return value is zero if the function is successful. Otherwise, it is
  13617.    an error value.
  13618.  
  13619.  See Also
  13620.  
  13621.    VioDestroyPS
  13622.  
  13623.  
  13624.  ────────────────────────────────────────────────────────────────────────────
  13625.  VioDeleteSetId
  13626.  ────────────────────────────────────────────────────────────────────────────
  13627.    USHORT VioDeleteSetId (lcid, hvps)
  13628.    LONG lcid;              /*local identifier for object                   */
  13629.    HVPS hvps;              /*presentation-space handle                     */
  13630.  
  13631.    The VioDeleteSetId function deletes the logical font specified by the lcid
  13632.    parameter. Do not use this function to delete the object specified by the
  13633.    local identifier zero.
  13634.  
  13635.  Parameters
  13636.  
  13637.    lcid  Specifies the local identifier for the object. This parameter must
  13638.    be 1, 2, or 3. If you specify -1, this function deletes all logical fonts.
  13639.  
  13640.    hvps  Identifies the advanced video-input-and-output (AVIO) presentation
  13641.    space. This presentation space must have been created previously by using
  13642.    the VioCreatePS function.
  13643.  
  13644.  Return Value
  13645.  
  13646.    The return value is zero if the function is successful. Otherwise, it is
  13647.    an error value.
  13648.  
  13649.  See Also
  13650.  
  13651.    VioCreateLogFont, VioCreatePS
  13652.  
  13653.  
  13654.  ────────────────────────────────────────────────────────────────────────────
  13655.  VioDeRegister
  13656.  ────────────────────────────────────────────────────────────────────────────
  13657.    USHORT VioDeRegister (VOID)
  13658.  
  13659.    The VioDeRegister function restores the functions of the default Vio
  13660.    subsystem and releases any previously registered Vio subsystem. The
  13661.    function restores the default Vio subsystem for all processes in the
  13662.    current screen group.
  13663.  
  13664.    Once a process registers a Vio subsystem, no other process in the screen
  13665.    group may register a Vio subsystem until the default subsystem is
  13666.    restored. Only the process registering a Vio subsystem may call the
  13667.    VioDeRegister function to restore the default Vio subsystem.
  13668.  
  13669.  Parameters
  13670.  
  13671.    This function has no parameters.
  13672.  
  13673.  Return Value
  13674.  
  13675.    The return value is zero if the function is successful. Otherwise, it is
  13676.    an error value, which may be the following:
  13677.  
  13678.          ERROR_VIO_DEREGISTER
  13679.  
  13680.  See Also
  13681.  
  13682.    VioRegister
  13683.  
  13684.  
  13685.  ────────────────────────────────────────────────────────────────────────────
  13686.  VioDestroyPS
  13687.  ────────────────────────────────────────────────────────────────────────────
  13688.    USHORT VioDestroyPS (hvps)
  13689.    HVPS hvps;              /*presentation-space handle                     */
  13690.  
  13691.    The VioDestroyPS function destroys the specified advanced
  13692.    video-input-and-output (AVIO) presentation space.
  13693.  
  13694.  Parameters
  13695.  
  13696.    hvps  Identifies the AVIO presentation space to destroy. This presentation
  13697.    space must have been created previously by using the VioCreatePS function.
  13698.  
  13699.  Return Value
  13700.  
  13701.    The return value is zero if the function is successful. Otherwise, it is
  13702.    an error value.
  13703.  
  13704.  See Also
  13705.  
  13706.    VioCreatePS
  13707.  
  13708.  
  13709.  ────────────────────────────────────────────────────────────────────────────
  13710.  VioEndPopUp
  13711.  ────────────────────────────────────────────────────────────────────────────
  13712.    USHORT VioEndPopUp (hvio)
  13713.    HVIO hvio;              /*video handle                                  */
  13714.  
  13715.    The VioEndPopUp function closes a pop-up screen and restores the physical
  13716.    video buffer to its previous contents. Only the process that opened the
  13717.    pop-up screen may close it.
  13718.  
  13719.    VioEndPopUp may not completely restore the screen to its previous state.
  13720.    For example, programs that modify the video registers or use graphics
  13721.    modes may have to restore the state of the registers as the pop-up screen
  13722.    is being closed. By calling the VioModeWait function, a program can
  13723.    request to be notified of the change in video mode. Whenever a process has
  13724.    a pending request, MS OS/2 notifies the process of a mode change when the
  13725.    pop-up screen is closed.
  13726.  
  13727.  Parameters
  13728.  
  13729.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  13730.    space. For AVIO programs, this handle must have been created previously
  13731.    using the VioCreatePS function. For other programs, hvio must be NULL.
  13732.  
  13733.  Return Value
  13734.  
  13735.    The return value is zero if the function is successful. Otherwise, it is
  13736.    an error value, which may be one of the following:
  13737.  
  13738.          ERROR_VIO_INVALID_HANDLE
  13739.          ERROR_VIO_NO_POPUP
  13740.  
  13741.  Example
  13742.  
  13743.    This example creates a pop-up screen, displays a message, waits three
  13744.    seconds, then calls VioEndPopUp to close the pop-up screen:
  13745.  
  13746.    USHORT fWait = VP_WAIT;
  13747.    VioPopUp(&fWait, 0);                /* creates pop-up screen */
  13748.    VioWrtTTY("This is a VIO pop-up screen\n\r", 29, 0);
  13749.    DosSleep(3000L);                    /* waits 3 seconds       */
  13750.    VioEndPopUp(0);                     /* ends pop-up screen    */
  13751.  
  13752.  See Also
  13753.  
  13754.    VioModeWait, VioPopUp
  13755.  
  13756.  
  13757.  ────────────────────────────────────────────────────────────────────────────
  13758.  VioGetAnsi
  13759.  ────────────────────────────────────────────────────────────────────────────
  13760.    USHORT VioGetAnsi (pfAnsi, hvio)
  13761.    PUSHORT pfAnsi;         /*pointer to variable for ANSI flag             */
  13762.    HVIO hvio;              /*video handle                                  */
  13763.  
  13764.    The VioGetAnsi function retrieves the state of the ANSI flag, which
  13765.    determines whether the processing of ANSI escape sequences is enabled or
  13766.    disabled.
  13767.  
  13768.  Parameters
  13769.  
  13770.    pfAnsi  Points to the variable that receives the ANSI flag. If this flag
  13771.    is ANSI_ON, ANSI processing is enabled. If the flag is ANSI_OFF, ANSI
  13772.    processing is disabled.
  13773.  
  13774.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  13775.    space. For AVIO programs, this handle must have been created previously
  13776.    using the VioCreatePS function. For other programs, hvio must be NULL.
  13777.  
  13778.  Return Value
  13779.  
  13780.    The return value is zero if the function is successful. Otherwise, it is
  13781.    an error value, which may be the following:
  13782.  
  13783.          ERROR_VIO_INVALID_HANDLE
  13784.  
  13785.  Example
  13786.  
  13787.    This example calls VioGetAnsi and, if ANSI processing enabled, calls the
  13788.    VioWrtTTY function to display a message:
  13789.  
  13790.    USHORT fAnsi;
  13791.    VioGetAnsi(&fAnsi, 0);
  13792.    if (fAnsi == ANSI_ON)
  13793.        VioWrtTTY("ANSI is on\n\r", 12, 0);
  13794.  
  13795.  See Also
  13796.  
  13797.    VioSetAnsi, VioWrtTTY
  13798.  
  13799.  
  13800.  ────────────────────────────────────────────────────────────────────────────
  13801.  VioGetBuf
  13802.  ────────────────────────────────────────────────────────────────────────────
  13803.    USHORT VioGetBuf (pulLVB, pcbLVB, hvio)
  13804.    PULONG pulLVB;          /*pointer to variable for address of LVB        */
  13805.    PUSHORT pcbLVB;         /*pointer to variable for length of LVB         */
  13806.    HVIO hvio;              /*video handle                                  */
  13807.  
  13808.    The VioGetBuf function retrieves the address of the logical video buffer
  13809.    (LVB), which contains the current character attributes for the text output
  13810.    of a process. The logical video buffer is identical in content and format
  13811.    to the physical video buffer when the process is the foreground process.
  13812.    The logical video buffer is available for text-mode screens only.
  13813.  
  13814.    A process can access and modify the contents of the logical video buffer
  13815.    at any time, even if the process is in the background. Changes made to the
  13816.    logical video buffer do not affect the physical screen until the process
  13817.    calls the VioShowBuf function.
  13818.  
  13819.    The VioGetBuf function is a family API function.
  13820.  
  13821.  Parameters
  13822.  
  13823.    pulLVB  Points to the variable that receives the address of the logical
  13824.    video buffer.
  13825.  
  13826.    pcbLVB  Points to the variable that specifies the length (in bytes) of the
  13827.    logical video buffer. You can use the VioGetMode function to determine the
  13828.    dimensions of the buffer.
  13829.  
  13830.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  13831.    space. For AVIO programs, this handle must have been created previously
  13832.    using the VioCreatePS function. For other programs, hvio must be NULL.
  13833.  
  13834.  Return Value
  13835.  
  13836.    The return value is zero if the function is successful. Otherwise, it is
  13837.    an error value, which may be the following:
  13838.  
  13839.          ERROR_VIO_INVALID_HANDLE
  13840.  
  13841.  Example
  13842.  
  13843.    This example calls VioGetBuf to retrieve the address of the logical video
  13844.    buffer. It sets the character attributes in the buffer for foreground
  13845.    blinking by using the OR operator to set the high bit, then it calls the
  13846.    VioShowBuf function to display the character attributes:
  13847.  
  13848.    PBYTE pbLVB;
  13849.    USHORT cbLVB, i;
  13850.    VioGetBuf((PULONG) &pbLVB, &cbLVB, 0);
  13851.    for (i = 0; i < cbLVB; i += 2)
  13852.  
  13853.        /* OR in the high bit to make it a blinking attribute */
  13854.  
  13855.        *(pbLVB + i + 1) = *(pbLVB + i + 1) | 0x80;
  13856.    VioShowBuf(0, cbLVB, 0);           /* displays buffer     */
  13857.  
  13858.  See Also
  13859.  
  13860.    VioGetMode, VioGetPhysBuf, VioShowBuf
  13861.  
  13862.  
  13863.  ────────────────────────────────────────────────────────────────────────────
  13864.  VioGetConfig
  13865.  ────────────────────────────────────────────────────────────────────────────
  13866.    USHORT VioGetConfig (usReserved, pvioin, hvio)
  13867.    USHORT usReserved;      /*must be zero                                  */
  13868.    PVIOCONFIGINFO pvioin;  /*pointer to structure for configuration        */
  13869.    HVIO hvio;              /*video handle                                  */
  13870.  
  13871.    The VioGetConfig function retrieves the video display configuration, which
  13872.    defines the type of display adapter, the type of display, and the amount
  13873.    of video memory available.
  13874.  
  13875.    The VioGetConfig function is a family API function.
  13876.  
  13877.  Parameters
  13878.  
  13879.    usReserved  Specifies a reserved value. This parameter must be zero.
  13880.  
  13881.    pvioin  Points to the VIOCONFIGINFO structure that receives the display
  13882.    configuration for the primary display adapter. The VIOCONFIGINFO structure
  13883.    has the following form:
  13884.  
  13885.    typedef struct _VIOCONFIGINFO {
  13886.        USHORT cb;
  13887.        USHORT adapter;
  13888.        USHORT display;
  13889.        ULONG  cbMemory;
  13890.    } VIOCONFIGINFO;
  13891.  
  13892.    For a full description, see Chapter 4, "Types, Macros, Structures."
  13893.  
  13894.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  13895.    space. For AVIO programs, this handle must have been created previously
  13896.    using the VioCreatePS function. For other programs, hvio must be NULL.
  13897.  
  13898.  Return Value
  13899.  
  13900.    The return value is zero if the function is successful. Otherwise, it is
  13901.    an error value, which may be one of the following:
  13902.  
  13903.          ERROR_VIO_INVALID_LENGTH
  13904.          ERROR_VIO_INVALID_PARMS
  13905.  
  13906.  Comments
  13907.  
  13908.    MS OS/2 derives the values for the adapter and display fields for the
  13909.    display configuration by using various tests, including checking the
  13910.    switch settings on the card.
  13911.  
  13912.  Example
  13913.  
  13914.    This example calls VioGetConfig to determine whether the display type is
  13915.    an enhanced color display:
  13916.  
  13917.    VIOCONFIGINFO vioinConfig;
  13918.    vioinConfig.cb = sizeof(vioinConfig);     /* structure length   */
  13919.    VioGetConfig(0,                           /* must be zero       */
  13920.        &vioinConfig,                         /* configuration data */
  13921.        0);                                   /* video handle       */
  13922.    if (vioinConfig.display == 2)
  13923.        VioWrtTTY("Enhanced color display\n\r", 24, 0);
  13924.  
  13925.  See Also
  13926.  
  13927.    VioGetMode, VioGetState
  13928.  
  13929.  
  13930.  ────────────────────────────────────────────────────────────────────────────
  13931.  VioGetCp
  13932.  ────────────────────────────────────────────────────────────────────────────
  13933.    USHORT VioGetCp (usReserved, pIdCodePage, hvio)
  13934.    USHORT usReserved;      /*must be zero                                  */
  13935.    PUSHORT pIdCodePage;    /*pointer to code-page identifier               */
  13936.    HVIO hvio;              /*video handle                                  */
  13937.  
  13938.    The VioGetCp function retrieves the identifier of the code page for the
  13939.    current screen group. This code page defines the character set being used
  13940.    to display text on the screen. If the identifier is 0x0000, the system
  13941.    default code page is being used. Any other value identifies a code page
  13942.    that has been set by using the VioSetCp function or that has been
  13943.    inherited from the parent process.
  13944.  
  13945.  Parameters
  13946.  
  13947.    usReserved  Specifies a reserved value. This parameter must be zero.
  13948.  
  13949.    pIdCodePage  Points to the variable that receives the code-page
  13950.    identifier. The following are the valid code-page numbers:
  13951.  
  13952.    Number        Code page
  13953.    ──────────────────────────────────────────────────────────────────────────
  13954.    437           United States
  13955.  
  13956.    850           Multilingual
  13957.  
  13958.    860           Portuguese
  13959.  
  13960.    863           French-Canadian
  13961.  
  13962.    865           Nordic
  13963.    ──────────────────────────────────────────────────────────────────────────
  13964.  
  13965.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  13966.    space. For AVIO programs, this handle must have been created previously
  13967.    using the VioCreatePS function. For other programs, hvio must be NULL.
  13968.  
  13969.  Return Value
  13970.  
  13971.    The return value is zero if the function is successful. Otherwise, it is
  13972.    an error value, which may be the following:
  13973.  
  13974.          ERROR_VIO_INVALID_HANDLE
  13975.  
  13976.  Example
  13977.  
  13978.    This example calls VioGetCp to retrieve the current system code page:
  13979.  
  13980.    USHORT idCodePage;
  13981.    VioGetCp(0,             /* must be zero         */
  13982.        &idCodePage,        /* code-page identifier */
  13983.        0);                 /* video handle         */
  13984.  
  13985.  See Also
  13986.  
  13987.    DosGetCp, DosSetCp, VioSetCp
  13988.  
  13989.  
  13990.  ────────────────────────────────────────────────────────────────────────────
  13991.  VioGetCurPos
  13992.  ────────────────────────────────────────────────────────────────────────────
  13993.    USHORT VioGetCurPos (pusRow, pusColumn, hvio)
  13994.    PUSHORT pusRow;         /*pointer to variable for row                   */
  13995.    PUSHORT pusColumn;      /*pointer to variable for column                */
  13996.    HVIO hvio;              /*video handle                                  */
  13997.  
  13998.    The VioGetCurPos function retrieves the position of the cursor on the
  13999.    screen.
  14000.  
  14001.    The VioGetCurPos function is a family API function.
  14002.  
  14003.  Parameters
  14004.  
  14005.    pusRow  Points to the variable that receives the current row position of
  14006.    the cursor.
  14007.  
  14008.    pusColumn  Points to the variable that receives the current column
  14009.    position of the cursor.
  14010.  
  14011.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  14012.    space. For AVIO programs, this handle must have been created previously
  14013.    using the VioCreatePS function. For other programs, hvio must be NULL.
  14014.  
  14015.  Return Value
  14016.  
  14017.    The return value is zero if the function is successful. Otherwise, it is
  14018.    an error value, which may be the following:
  14019.  
  14020.          ERROR_VIO_INVALID_HANDLE
  14021.  
  14022.  Example
  14023.  
  14024.    This example calls VioGetCurPos to retrieve the current row-and-column
  14025.    position of the cursor:
  14026.  
  14027.    USHORT usRow, usColumn;
  14028.    VioGetCurPos(&usRow,       /* row address    */
  14029.        &usColumn,             /* column address */
  14030.        0);                    /* video handle   */
  14031.  
  14032.  See Also
  14033.  
  14034.    VioGetCurType, VioSetCurPos
  14035.  
  14036.  
  14037.  ────────────────────────────────────────────────────────────────────────────
  14038.  VioGetCurType
  14039.  ────────────────────────────────────────────────────────────────────────────
  14040.    USHORT VioGetCurType (pviociCursor, hvio)
  14041.    PVIOCURSORINFO pviociCursor;
  14042.                            /*pointer to structure for cursor info          */
  14043.    HVIO hvio;              /*video handle                                  */
  14044.  
  14045.    The VioGetCurType function retrieves information about the cursor type.
  14046.    This information defines the height and width of the cursor, as well as
  14047.    whether it is currently visible. The VioGetCurType function is a family
  14048.    API function.
  14049.  
  14050.  Parameters
  14051.  
  14052.    pviociCursor  Points to the VIOCURSORINFO structure that receives
  14053.    information about the cursor type. The VIOCURSORINFO structure has the
  14054.    following form:
  14055.  
  14056.    typedef struct _VIOCURSORINFO {
  14057.        USHORT yStart;
  14058.        USHORT cEnd;
  14059.        USHORT cx;
  14060.        USHORT attr;
  14061.    } VIOCURSORINFO;
  14062.  
  14063.    For a full description, see Chapter 4, "Types, Macros, Structures."
  14064.  
  14065.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  14066.    space. For AVIO programs, this handle must have been created previously
  14067.    using the VioCreatePS function. For other programs, hvio must be NULL.
  14068.  
  14069.  Return Value
  14070.  
  14071.    The return value is zero if the function is successful. Otherwise, it is
  14072.    an error value, which may be the following:
  14073.  
  14074.          ERROR_VIO_INVALID_HANDLE
  14075.  
  14076.  Example
  14077.  
  14078.    This example calls VioGetCurType to retrieve the current cursor type,
  14079.    changes the attribute to hidden or visible (the opposite of what it was),
  14080.    and calls VioSetCurType to set the new cursor type:
  14081.  
  14082.    VIOCURSORINFO viociCursor;
  14083.    VioGetCurType(&viociCursor, 0); /* retrieves current cursor type     */
  14084.    viociCursor.attr =              /* flips attribute to hidden/visible */
  14085.        (viociCursor.attr == -1) ? 0 : -1;
  14086.    VioSetCurType(&viociCursor, 0); /* sets new cursor type              */
  14087.  
  14088.  See Also
  14089.  
  14090.    VioGetCurPos, VioSetCurType
  14091.  
  14092.  
  14093.  ────────────────────────────────────────────────────────────────────────────
  14094.  VioGetDeviceCellSize
  14095.  ────────────────────────────────────────────────────────────────────────────
  14096.    USHORT VioGetDeviceCellSize (pcRows, pcColumns, hvps)
  14097.    PSHORT pcRows;          /*pointer to variable for cell height           */
  14098.    PSHORT pcColumns;       /*pointer to variable for cell width            */
  14099.    HVPS hvps;              /*presentation-space handle                     */
  14100.  
  14101.    The VioGetDeviceCellSize function retrieves the size of the current device
  14102.    cell.
  14103.  
  14104.  Parameters
  14105.  
  14106.    pcRows  Points to the variable that specifies the height (in pels) of the
  14107.    device cell.
  14108.  
  14109.    pcColumns  Points to the variable that specifies the width (in pels) of
  14110.    the device cell.
  14111.  
  14112.    hvps  Identifies the advanced video-input-and-output (AVIO) presentation
  14113.    space. This presentation space must have been created previously by using
  14114.    the VioCreatePS function.
  14115.  
  14116.  Return Value
  14117.  
  14118.    The return value is zero if the function is successful. Otherwise, it is
  14119.    an error value.
  14120.  
  14121.  See Also
  14122.  
  14123.    VioCreatePS, VioSetDeviceCellSize
  14124.  
  14125.  
  14126.  ────────────────────────────────────────────────────────────────────────────
  14127.  VioGetFont
  14128.  ────────────────────────────────────────────────────────────────────────────
  14129.    USHORT VioGetFont (pviofi, hvio)
  14130.    PVIOFONTINFO pviofi;    /*pointer to structure for font information     */
  14131.    HVIO hvio;              /*video handle                                  */
  14132.  
  14133.    The VioGetFont function retrieves a specified font. A font consists of one
  14134.    bitmap for each character in a character set. The bitmaps define the
  14135.    character shapes. The VioGetFont function retrieves a copy of either the
  14136.    current font or a font from the ROM of the video display adapter.
  14137.  
  14138.  Parameters
  14139.  
  14140.    pviofi  Points to the VIOFONTINFO structure that specifies the request
  14141.    type and receives the font information. The VIOFONTINFO structure has the
  14142.    following form:
  14143.  
  14144.    typedef struct _VIOFONTINFO {
  14145.        USHORT cb;
  14146.        USHORT type;
  14147.        USHORT cxCell;
  14148.        USHORT cyCell;
  14149.        PVOID pbData;
  14150.        USHORT cbData;
  14151.    } VIOFONTINFO;
  14152.  
  14153.    For a full description, see Chapter 4, "Types, Macros, Structures."
  14154.  
  14155.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  14156.    space. For AVIO programs, this handle must have been created previously
  14157.    using the VioCreatePS function. For other programs, hvio must be NULL.
  14158.  
  14159.  Return Value
  14160.  
  14161.    The return value is zero if the function is successful. Otherwise, it is
  14162.    an error value, which may be one of the following:
  14163.  
  14164.          ERROR_VIO_COL
  14165.          ERROR_VIO_FONT
  14166.          ERROR_VIO_INVALID_PARMS
  14167.          ERROR_VIO_ROW
  14168.  
  14169.  Comments
  14170.  
  14171.    Although the VioGetFont function can retrieve fonts for many display
  14172.    adapt- ers, the fonts for some adapters are not available. In most cases,
  14173.    the function retrieves a full 256-character font. This font may consist of
  14174.    a complete ROM font, or it may be derived from downloaded fonts that are
  14175.    saved in the adapter's BIOS. The current font is defined by the most
  14176.    recent DosSetCp or VioSetCp function, or it can be set by using the
  14177.    VioSetFont function.
  14178.  
  14179.  Example
  14180.  
  14181.    This example calls the VioGetFont function to obtain the current font.
  14182.    When it returns, the cxCell and cyCell fields will contain the dimensions
  14183.    (in points) of a character cell. The pbData field points to the font:
  14184.  
  14185.    VIOFONTINFO viofiFont;
  14186.    viofiFont.cb = sizeof(viofiFont);      /* length of structure    */
  14187.    viofiFont.type = VGFI_GETCURFONT;      /* retrieves current font */
  14188.    viofiFont.cxCell = 0;                  /* clears columns         */
  14189.    viofiFont.cyCell = 0;                  /* clears rows            */
  14190.    viofiFont.pbData = 0L;                 /* address of data area   */
  14191.    viofiFont.cbData = 0;                  /* length of data area    */
  14192.    VioGetFont(&viofiFont, 0);
  14193.  
  14194.  See Also
  14195.  
  14196.    DosSetCp, VioSetCp, VioSetFont
  14197.  
  14198.  
  14199.  ────────────────────────────────────────────────────────────────────────────
  14200.  VioGetMode
  14201.  ────────────────────────────────────────────────────────────────────────────
  14202.    USHORT VioGetMode (pviomi, hvio)
  14203.    PVIOMODEINFO pviomi;    /*pointer to structure for screen mode          */
  14204.                            /*information                                   */
  14205.    HVIO hvio;              /*video handle                                  */
  14206.  
  14207.    The VioGetMode function retrieves the current screen mode. The screen mode
  14208.    defines the display mode (text or graphics), the number of colors being
  14209.    used (2, 4, or 16), and the width and height of the screen in both
  14210.    character cells and pels.
  14211.  
  14212.    The VioGetMode function is a family API function.
  14213.  
  14214.  Parameters
  14215.  
  14216.    pviomi  Points to the VIOMODEINFO structure that receives the screen-mode
  14217.    information. The VIOMODEINFO structure has the following form:
  14218.  
  14219.    typedef struct _VIOMODEINFO {
  14220.        USHORT cb;
  14221.        UCHAR  fbType;
  14222.        UCHAR  color;
  14223.        USHORT col;
  14224.        USHORT row;
  14225.        USHORT hres;
  14226.        USHORT vres;
  14227.    } VIOMODEINFO;
  14228.  
  14229.    For a full description, see Chapter 4, "Types, Macros, Structures."
  14230.  
  14231.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  14232.    space. For AVIO programs, this handle must have been created previously
  14233.    using the VioCreatePS function. For other programs, hvio must be NULL.
  14234.  
  14235.  Return Value
  14236.  
  14237.    The return value is zero if the function is successful. Otherwise, it is
  14238.    an error value, which may be one of the following:
  14239.  
  14240.          ERROR_VIO_INVALID_HANDLE
  14241.          ERROR_VIO_INVALID_LENGTH
  14242.  
  14243.  Example
  14244.  
  14245.    This example calls VioGetMode to retrieve the mode information for the
  14246.    screen:
  14247.  
  14248.    VIOMODEINFO viomi;
  14249.    viomi.cb = sizeof(viomi);
  14250.    VioGetMode(&viomi, 0);
  14251.    if (viomi.fbType == 0)
  14252.        VioWrtTTY("Monochrome display\n\r", 20, 0);
  14253.  
  14254.  See Also
  14255.  
  14256.    VioGetState, VioSetMode
  14257.  
  14258.  
  14259.  ────────────────────────────────────────────────────────────────────────────
  14260.  VioGetOrg
  14261.  ────────────────────────────────────────────────────────────────────────────
  14262.    USHORT VioGetOrg (psRow, psColumn, hvps)
  14263.    PSHORT psRow;           /*pointer to variable for row number            */
  14264.    PSHORT psColumn;        /*pointer to variable for column number         */
  14265.    HVPS hvps;              /*presentation-space handle                     */
  14266.  
  14267.    The VioGetOrg function retrieves the origin of an advanced
  14268.    video-input-and-output (AVIO) presentation space.
  14269.  
  14270.  Parameters
  14271.  
  14272.    psRow  Points to the variable that receives the row number of the cell
  14273.    currently mapped to the upper-left corner of the window.
  14274.  
  14275.    psColumn  Points to the variable that receives the column number of the
  14276.    cell currently mapped to the upper-left corner of the window.
  14277.  
  14278.    hvps  Identifies the AVIO presentation space. This presentation space must
  14279.    have been created previously by using the VioCreatePS function
  14280.  
  14281.  Return Value
  14282.  
  14283.    The return value is zero if the function is successful. Otherwise, it is
  14284.    an error value.
  14285.  
  14286.  See Also
  14287.  
  14288.    VioCreatePS, VioSetOrg
  14289.  
  14290.  
  14291.  ────────────────────────────────────────────────────────────────────────────
  14292.  VioGetPhysBuf
  14293.  ────────────────────────────────────────────────────────────────────────────
  14294.    USHORT VioGetPhysBuf (pviopb, usReserved)
  14295.    PVIOPHYSBUF pviopb;     /*pointer to structure for physical video       */
  14296.                            /*buffer                                        */
  14297.    USHORT usReserved;      /*must be zero                                  */
  14298.  
  14299.    The VioGetPhysBuf function retrieves the selector of the physical video
  14300.    buffer. The physical video buffer contains the text or graphics
  14301.    information that defines the current screen image. In text mode, the
  14302.    buffer contains the character and attribute for each character cell. In
  14303.    graphics mode, the buffer is a bitmap (in one or more planes) of the image
  14304.    on the screen. The content of the screen depends on the current screen
  14305.    mode and the type of display adapter.
  14306.  
  14307.    The VioGetPhysBuf function is a family API function.
  14308.  
  14309.  Parameters
  14310.  
  14311.    pviopb  Points to the VIOPHYSBUF structure that specifies the address and
  14312.    length of the physical video buffer, and receives the selector(s) used to
  14313.    address the video buffer. The VIOPHYSBUF structure has the following form:
  14314.  
  14315.    typedef struct _VIOPHYSBUF {
  14316.        PBYTE pBuf;
  14317.        ULONG cb;
  14318.        SEL   asel[1];
  14319.    } VIOPHYSBUF;
  14320.  
  14321.    For a full description, see Chapter 4, "Types, Macros, Structures."
  14322.  
  14323.    usReserved  Specifies a reserved value. This parameter must be zero.
  14324.  
  14325.  Return Value
  14326.  
  14327.    The return value is zero if the function is successful. Otherwise, it is
  14328.    an error value, which may be one of the following:
  14329.  
  14330.          ERROR_VIO_IN_BG
  14331.          ERROR_VIO_INVALID_HANDLE
  14332.  
  14333.  Comments
  14334.  
  14335.    Since the physical video buffer is subject to change by the current
  14336.    foreground process, only the foreground process should access the buffer.
  14337.    To ensure that the foreground process has complete control of the physical
  14338.    buffer, use the VioScrLock function.
  14339.  
  14340.  Example
  14341.  
  14342.    This example locks the screen, calls VioGetPhysBuf to retrieve the address
  14343.    of the physical video buffer, unlocks the screen, and assigns the address
  14344.    of the physical video buffer to a pointer:
  14345.  
  14346.    VIOPHYSBUF viopbBuffer;
  14347.    PCH pchScreen;
  14348.    USHORT fStatus;
  14349.    viopbBuf.pBuf = 0xB8000L;
  14350.    viopbBuf.cb = 4000;
  14351.    VioScrLock(LOCKIO_WAIT, &fStatus, 0);
  14352.    VioGetPhysBuf(&viopbBuf, 0);
  14353.    VioScrUnLock(0);
  14354.    pchScreen = MAKEP(viopbBuf.asel[0]), 0);
  14355.  
  14356.  See Also
  14357.  
  14358.    VioGetBuf, VioScrLock, VioScrUnLock, VioShowBuf
  14359.  
  14360.  
  14361.  ────────────────────────────────────────────────────────────────────────────
  14362.  VioGetState
  14363.  ────────────────────────────────────────────────────────────────────────────
  14364.    USHORT VioGetState (pvoidState, hvio)
  14365.    PVOID pvoidState;       /*pointer to structure for state information    */
  14366.    HVIO hvio;              /*video handle                                  */
  14367.  
  14368.    The VioGetState function retrieves the current settings of the palette
  14369.    registers, the overscan (border) color, or the blink/background intensity
  14370.    switch.
  14371.  
  14372.  Parameters
  14373.  
  14374.    pvoidState  Points to the structure that receives the state information.
  14375.    The structure type, which depends on the request type specified in the
  14376.    type field of each structure, is one of the following: VIOPALSTATE,
  14377.    VIOOVERSCAN, or VIOINTENSITY. These structures have the following forms:
  14378.  
  14379.    typedef struct _VIOPALSTATE {
  14380.        USHORT cb;
  14381.        USHORT type;
  14382.        USHORT iFirst;
  14383.        USHORT acolor[1];
  14384.    } VIOPALSTATE;
  14385.  
  14386.    typedef struct _VIOOVERSCAN {
  14387.        USHORT cb;
  14388.        USHORT type;
  14389.        USHORT color;
  14390.    } VIOOVERSCAN;
  14391.  
  14392.    typedef struct _VIOINTENSITY {
  14393.        USHORT cb;
  14394.        USHORT type;
  14395.        USHORT fs;
  14396.    } VIOINTENSITY;
  14397.  
  14398.    For each structure, you must set the cb and type fields before calling the
  14399.    function. Not all values for the type field are valid for all screen
  14400.    modes.
  14401.  
  14402.    For a full description, see Chapter 4, "Types, Macros, Structures."
  14403.  
  14404.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  14405.    space. For AVIO programs, this handle must have been created previously
  14406.    using the VioCreatePS function. For other programs, hvio must be NULL.
  14407.  
  14408.  Return Value
  14409.  
  14410.    The return value is zero if the function is successful. Otherwise, it is
  14411.    an error value, which may be one of the following:
  14412.  
  14413.          ERROR_VIO_INVALID_HANDLE
  14414.          ERROR_VIO_INVALID_LENGTH
  14415.  
  14416.  Example
  14417.  
  14418.    This example calls the VioGetState function to retrieve the settings for
  14419.    each of the 16 palette registers:
  14420.  
  14421.    BYTE abState[38];
  14422.    PVIOPALSTATE pviopal;
  14423.    pviopal = (PVIOPALSTATE) abState;
  14424.    pviopal->cb = sizeof(abState);   /* structure size                   */
  14425.    pviopal->type = 0;               /* retrieves palette registers      */
  14426.    pviopal->iFirst = 0;             /* first palette register to return */
  14427.    VioGetState(pviopal, 0);
  14428.  
  14429.  See Also
  14430.  
  14431.    VioGetMode, VioSetState
  14432.  
  14433.  
  14434.  ────────────────────────────────────────────────────────────────────────────
  14435.  VioModeUndo
  14436.  ────────────────────────────────────────────────────────────────────────────
  14437.    USHORT VioModeUndo (fRelinquish, fTerminate, hvio)
  14438.    USHORT fRelinquish;     /*ownership flag                                */
  14439.    USHORT fTerminate;      /*termination flag                              */
  14440.    USHORT hvio;            /*video handle                                  */
  14441.  
  14442.    The VioModeUndo function cancels a request by a process to be notified of
  14443.    a change in video mode. A process makes this request by calling the
  14444.    VioModeWait function. The request forces the calling thread to wait until
  14445.    the video mode changes. The VioModeUndo function cancels the request and
  14446.    permits the thread to continue (or ends the thread, if requested to do
  14447.    so).
  14448.  
  14449.    MS OS/2 permits only one process in a screen group to request notification
  14450.    of a video-mode change. The first process to make a request owns it.
  14451.    Thereafter, other processes must wait for the owning process to relinquish
  14452.    the request before being granted ownership. To force a process to
  14453.    relinquish ownership of the request, use the VioModeUndo function.
  14454.  
  14455.    Only the process that owns the change-mode request may call the
  14456.    VioModeUndo function.
  14457.  
  14458.  Parameters
  14459.  
  14460.    fRelinquish  Specifies whether the process should retain or relinquish
  14461.    ownership of the request. If this parameter is UNDOI_GETOWNER, the process
  14462.    retains ownership and can make the request again without competing with
  14463.    other processes. If this parameter is UNDOI_RELEASEOWNER, the process
  14464.    relinquishes ownership of the request and is canceled by VioModeUndo.
  14465.  
  14466.    fTerminate  Specifies whether to terminate the thread waiting for the mode
  14467.    change. If this parameter is UNDOK_ERRORCODE, the thread continues and
  14468.    receives an error value from the VioModeWait function. If the parameter is
  14469.    UNDOK_TERMINATE, the thread terminates.
  14470.  
  14471.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  14472.    space. For AVIO programs, this handle must have been created previously
  14473.    using the VioCreatePS function. For other programs, hvio must be NULL.
  14474.  
  14475.  Return Value
  14476.  
  14477.    The return value is zero if the function is successful. Otherwise, it is
  14478.    an error value, which may be one of the following:
  14479.  
  14480.          ERROR_VIO_FUNCTION_OWNED
  14481.          ERROR_VIO_INVALID_PARMS
  14482.          ERROR_VIO_NO_MODE_THREAD
  14483.  
  14484.  See Also
  14485.  
  14486.    VioModeWait
  14487.  
  14488.  
  14489.  ────────────────────────────────────────────────────────────────────────────
  14490.  VioModeWait
  14491.  ────────────────────────────────────────────────────────────────────────────
  14492.    USHORT VioModeWait (fEvent, pfNotify, hvio)
  14493.    USHORT fEvent;          /*event flag                                    */
  14494.    PUSHORT pfNotify;       /*pointer to variable for notify flag           */
  14495.    USHORT hvio;            /*video handle                                  */
  14496.  
  14497.    The VioModeWait function waits for a change in the current video mode
  14498.    before returning. When a change occurs, MS OS/2 sets the variable pointed
  14499.    to by the pfNotify parameter to a value indicating the type of change. The
  14500.    thread may then restore the video registers or carry out other tasks
  14501.    related to restoring the video mode for the process.
  14502.  
  14503.    The VioModeWait function is used typically by graphics programs (or text
  14504.    programs that access video registers directly) to restore the screen after
  14505.    a pop-up screen has closed. Pop-up screens often change the video mode and
  14506.    video-register values without fully restoring them when closed. A thread
  14507.    that calls the VioModeWait function waits until a pop-up screen closes so
  14508.    that it can restore the screen.
  14509.  
  14510.    MS OS/2 permits only one process in a screen group to wait for a
  14511.    video-mode change. The first process to make a request owns it.
  14512.  
  14513.  Parameters
  14514.  
  14515.    fEvent  Specifies the event flag of the event to wait for. If this
  14516.    parameter is VMWR_POPUP, the function waits for a pop-up screen to close.
  14517.    No other flags are permitted.
  14518.  
  14519.    pfNotify  Points to the variable that receives a flag specifying the
  14520.    action to carry out in response to the given event. If this flag is
  14521.    VMWN_POPUP, the process should restore the video mode. No other values are
  14522.    returned.
  14523.  
  14524.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  14525.    space. For AVIO programs, this handle must have been created previously
  14526.    using the VioCreatePS function. For other programs, hvio must be NULL.
  14527.  
  14528.  Return Value
  14529.  
  14530.    The return value is zero if the function is successful. Otherwise, it is
  14531.    an error value, which may be one of the following:
  14532.  
  14533.          ERROR_VIO_FUNCTION_OWNED
  14534.          ERROR_VIO_INVALID_PARMS
  14535.          ERROR_VIO_RETURN
  14536.  
  14537.  Comments
  14538.  
  14539.    A program should use the VioModeWait function if it changes the video
  14540.    registers directly. MS OS/2 automatically saves and restores the physical
  14541.    video buffer and screen mode whenever a pop-up screen is used.
  14542.  
  14543.    The thread that calls VioModeWait should carry out only those tasks
  14544.    directly related to restoring the screen mode. Whenever a mode change
  14545.    occurs, the thread should restore the mode and call VioModeWait as quickly
  14546.    as possible. The thread should not call MS OS/2 functions (netiher
  14547.    directly nor indirectly through other functions) that may generate pop-up
  14548.    screens or error pop-up screens. Doing so may cause MS OS/2 to lock up
  14549.    (that is, each call of the thread generates a pop-up screen, which in turn
  14550.    calls the thread and generates another pop-up screen, and so on). You can
  14551.    use the VioModeUndo function to end the thread when it is no longer
  14552.    needed.
  14553.  
  14554.    Programs that save and restore the video mode and screen before and after
  14555.    a screen switch should use the VioSavRedrawWait function.
  14556.  
  14557.  See Also
  14558.  
  14559.    VioModeUndo, VioPopUp, VioSavRedrawWait
  14560.  
  14561.  
  14562.  ────────────────────────────────────────────────────────────────────────────
  14563.  VioPopUp
  14564.  ────────────────────────────────────────────────────────────────────────────
  14565.    USHORT VioPopUp (pfWait, hvio)
  14566.    PUSHORT pfWait;         /*pointer to variable for wait/no-wait flag     */
  14567.    HVIO hvio;              /*video handle                                  */
  14568.  
  14569.    The VioPopUp function opens a pop-up screen. A pop-up screen is a
  14570.    temporary text-mode screen that a process can use to display error and
  14571.    warning messages without altering the content of the foreground screen.
  14572.    Pop-up screens are used typically by background processes to display
  14573.    messages when the screen is not available.
  14574.  
  14575.    The pop-up screen can be opaque or transparent, as specified by the flag
  14576.    pointed to by the pfWait parameter. If the pop-up screen is opaque, the
  14577.    function changes the screen mode (if the mode is not already set for 25
  14578.    lines by 80 columns of text) and clears the screen, moving the cursor to
  14579.    the upper-left corner. If the pop-up screen is transparent, the function
  14580.    uses the current screen mode and leaves the screen and the cursor
  14581.    unchanged.
  14582.  
  14583.    Once the pop-up screen is open, the process may call any of the following
  14584.    Vio functions:
  14585.  
  14586.  
  14587.        VioEndPopUp       VioReadCellStr    VioSetFont
  14588.        VioGetAnsi        VioReadCharStr    VioSetState
  14589.        VioGetCp          VioScrollDn       VioWrtCellStr
  14590.        VioGetConfig      VioScrollLf       VioWrtCharStr
  14591.        VioGetCurPos      VioScrollRt       VioWrtCharStrAtt
  14592.        VioGetCurType     VioScrollUp       VioWrtNAttr
  14593.        VioGetFont        VioSetCp          VioWrtNCell
  14594.        VioGetMode        VioSetCurPos      VioWrtNChar
  14595.        VioGetState       VioSetCurType     VioWrtTTY
  14596.  
  14597.  
  14598.    The process opening the pop-up screen receives all subsequent keyboard
  14599.    input, and MS OS/2 disables the keys that it normally uses switch from one
  14600.    screen group to another. While the pop-up screen is open, the process must
  14601.    not access or modify the physical video buffer. Also, it must not call the
  14602.    DosExecPgm function.
  14603.  
  14604.    Only one pop-up screen may be open at any given time. If a process
  14605.    attempts to open one pop-up screen while another is already open, the
  14606.    VioPopUp function waits until the previous screen is closed before opening
  14607.    the new one.
  14608.  
  14609.  Parameters
  14610.  
  14611.    pfWait  Points to the variable that specifies whether the pop-up screen is
  14612.    to be opaque or transparent, and whether the function should wait for any
  14613.    open pop-up screen to close. It can be any combination of either VP_NOWAIT
  14614.    or VP_WAIT and either VP_OPAQUE or VP_TRANSPARENT. These flags are defined
  14615.    as follows:
  14616.  
  14617.    Value                 Meaning
  14618.    ──────────────────────────────────────────────────────────────────────────
  14619.    VP_NOWAIT             Return immediately if a pop-up screen already
  14620.                          exists.
  14621.  
  14622.    VP_WAIT               Wait if a pop-up screen already exists. The function
  14623.                          opens a new pop-up screen as soon as the existing
  14624.                          one is closed.
  14625.  
  14626.    VP_OPAQUE             Set the screen mode for 25 lines by 80 columns of
  14627.                          text, clear the screen, and move the cursor to the
  14628.                          upper-left corner.
  14629.  
  14630.    VP_TRANSPARENT        Create a transparent pop-up screen. The function
  14631.                          does not change the screen mode, clear the screen,
  14632.                          or move the cursor. To create a transparent pop-up
  14633.                          screen, the screen must be in text mode already.
  14634.    ──────────────────────────────────────────────────────────────────────────
  14635.  
  14636.    hvio  Identifies a reserved value. This parameter must be zero.
  14637.  
  14638.  Return Value
  14639.  
  14640.    The return value is zero if the function is successful. Otherwise, it is
  14641.    an error value, which may be one of the following:
  14642.  
  14643.          ERROR_VIO_EXISTING_POPUP
  14644.          ERROR_VIO_INVALID_HANDLE
  14645.          ERROR_VIO_NO_POPUP
  14646.  
  14647.  Comments
  14648.  
  14649.    Before opening a pop-up screen, MS OS/2 saves the physical video buffer of
  14650.    the existing screen. While the pop-up screen is open, MS OS/2 blocks any
  14651.    Vio functions called by the process that owns the previous screen. If this
  14652.    process generates any output, MS OS/2 displays the output after the pop-up
  14653.    screen closes.
  14654.  
  14655.    You can close a pop-up screen by using the VioEndPopUp function.
  14656.    VioEndPopUp restores the screen mode and the screen buffer; it also
  14657.    restores keyboard input to the previous process and enables the key
  14658.    combination MS OS/2 uses to switch screen groups. In some cases, the
  14659.    VioEndPopUp function may not completely restore the screen. For these
  14660.    cases, use the VioModeWait function to restore the screen.
  14661.  
  14662.    You cannot use transparent pop-up screens if the foreground process has
  14663.    called the VioSavRedrawWait function.
  14664.  
  14665.    If a process registers a replacement VioPopUp function (by calling the
  14666.    VioRegister function), MS OS/2 uses the replacement function only if the
  14667.    foreground process requests a pop-up screen. If a background process
  14668.    requests a pop-up screen, MS OS/2 uses the default VioPopUp function.
  14669.  
  14670.  Example
  14671.  
  14672.    This example calls the VioPopUp function to create a pop-up screen, and
  14673.    waits for the pop-up screen if another pop-up screen is already active:
  14674.  
  14675.    USHORT fWait = VP_WAIT | VP_OPAQUE;
  14676.    VioPopUp(&fWait, 0);
  14677.        .
  14678.        . /* message and user interaction would go here */
  14679.        .
  14680.    VioEndPopUp(0);    /* ends pop-up screen */
  14681.  
  14682.  See Also
  14683.  
  14684.    DosExecPgm, VioEndPopUp, VioGetPhysBuf, VioModeWait, VioRegister,
  14685.    VioSavRedrawWait
  14686.  
  14687.  
  14688.  ────────────────────────────────────────────────────────────────────────────
  14689.  VioPrtSc
  14690.  ────────────────────────────────────────────────────────────────────────────
  14691.    USHORT VioPrtSc (hvio)
  14692.    HVIO hvio;              /*video handle                                  */
  14693.  
  14694.    The VioPrtSc function copies the contents of the screen to the printer.
  14695.  
  14696.    This function is reserved for system use. It is called whenever the
  14697.    PRINTSCREEN key is pressed. A process can, however, replace VioPrtSc
  14698.    with a custom screen-printing function by using the VioRegister function.
  14699.    If a process does replace the VioPrtSc function, all other processes in
  14700.    the screen group will also use the replacement function. This gives a
  14701.    process the capability of capturing input from the PRINTSCREEN key.
  14702.  
  14703.  Parameters
  14704.  
  14705.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  14706.    space. For AVIO programs, this handle must have been created previously
  14707.    using the VioCreatePS function. For other programs, hvio must be NULL.
  14708.  
  14709.  Return Value
  14710.  
  14711.    The return value is zero if the function is successful. Otherwise, it is
  14712.    an error value, which may be one of the following:
  14713.  
  14714.          ERROR_VIO_INVALID_HANDLE
  14715.          ERROR_VIO_SMG_ONLY
  14716.  
  14717.  See Also
  14718.  
  14719.    VioPrtScToggle, VioRegister
  14720.  
  14721.  
  14722.  ────────────────────────────────────────────────────────────────────────────
  14723.  VioPrtScToggle
  14724.  ────────────────────────────────────────────────────────────────────────────
  14725.    USHORT VioPrtScToggle (hvio)
  14726.    HVIO hvio;              /*video handle                                  */
  14727.  
  14728.    The VioPrtScToggle function enables or disables the printer echo feature.
  14729.  
  14730.    This function is reserved for system use. It is called whenever the
  14731.    CTRL+PRTSC key combination is pressed. The first press enables the
  14732.    printer echo feature, the second disables it. A process can replace
  14733.    VioPrtScToggle, however, with a custom function by using the VioRegister
  14734.    function. If a process does replace the VioPrtScToggle function, all
  14735.    processes in the screen group will also use the replacement function. This
  14736.    gives a process the capability of capturing input from the CTRL+PRTSC
  14737.    key combination.
  14738.  
  14739.  Parameters
  14740.  
  14741.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  14742.    space. For AVIO programs, this handle must have been created previously
  14743.    using the VioCreatePS function. For other programs, hvio must be NULL.
  14744.  
  14745.  Return Value
  14746.  
  14747.    The return value is zero if the function is successful. Otherwise, it is
  14748.    an error value, which may be one of the following:
  14749.  
  14750.          ERROR_VIO_INVALID_HANDLE
  14751.          ERROR_VIO_SMG_ONLY
  14752.  
  14753.  See Also
  14754.  
  14755.    VioPrtSc, VioRegister
  14756.  
  14757.  
  14758.  ────────────────────────────────────────────────────────────────────────────
  14759.  VioQueryFonts
  14760.  ────────────────────────────────────────────────────────────────────────────
  14761.    USHORT VioQueryFonts (pcbMetrics, pfm, cbMetrics, pcFonts, pszFacename,
  14762.    flOptions, hvps)
  14763.    PLONG pcbMetrics;       /*pointer to variable for structure length      */
  14764.    PFONTMETRICS pfm;       /*pointer to structure for font metrics         */
  14765.    LONG cbMetrics;         /*length of structure                           */
  14766.    PLONG pcFonts;          /*pointer to variable for number of fonts       */
  14767.    PSZ pszFacename;        /*pointer to string for face name               */
  14768.    ULONG flOptions;        /*enumeration options                           */
  14769.    HVPS hvps;              /*presentation-space handle                     */
  14770.  
  14771.    The VioQueryFonts function retrieves a font-metrics structure (or
  14772.    structures) that contains characteristics of the fonts that match the
  14773.    specified face name. These characteristics, or font metrics, are returned
  14774.    for as many matching fonts as will fit in the structure pointed to by the
  14775.    pfm parameter.
  14776.  
  14777.    After examining the returned data, the application selects the font most
  14778.    appropriate for its requirements, and if necessary, forces selection of a
  14779.    particular font by specifying the lMatch field (as returned in the pfm
  14780.    parameter) in the FATTRS structure for the VioCreateLogFont function.
  14781.  
  14782.    By specifying zero for the pcFonts parameter and then examining the value
  14783.    returned, the application determines how many fonts match the specified
  14784.    face name.
  14785.  
  14786.    All sizes are returned in world coordinates. For more information, see the
  14787.    Microsoft Operating System/2 Programmer's Reference, Volume 1.
  14788.  
  14789.  Parameters
  14790.  
  14791.    pcbMetrics  Points to the variable that receives the length (in bytes) of
  14792.    each FONTMETRICS structure. The structure pointed to by the pfm parameter
  14793.    must contain the number of bytes given by pcFonts x pcMetrics.
  14794.  
  14795.    pfm  Points to the FONTMETRICS structure that receives the font metrics of
  14796.    the specified matching fonts. The format for each record is as defined in
  14797.    the GpiQueryFontMetrics function. The FONTMETRICS structure has the
  14798.    following form:
  14799.  
  14800.    typedef struct _FONTMETRICS {
  14801.        CHAR    szFamilyname[FACESIZE];
  14802.        CHAR    szFacename[FACESIZE];
  14803.        USHORT  idRegistry;
  14804.        USHORT  usCodePage;
  14805.        LONG    lEmHeight;
  14806.        LONG    lXHeight;
  14807.        LONG    lMaxAscender;
  14808.        LONG    lMaxDescender;
  14809.        LONG    lLowerCaseAscent;
  14810.        LONG    lLowerCaseDescent;
  14811.        LONG    lInternalLeading;
  14812.        LONG    lExternalLeading;
  14813.        LONG    lAveCharWidth;
  14814.        LONG    lMaxCharInc;
  14815.        LONG    lEmInc;
  14816.        LONG    lMaxBaselineExt;
  14817.        SHORT   sCharSlope;
  14818.        SHORT   sInlineDir;
  14819.        SHORT   sCharRot;
  14820.        USHORT  usWeightClass;
  14821.        USHORT  usWidthClass;
  14822.        SHORT   sXDeviceRes;
  14823.        SHORT   sYDeviceRes;
  14824.        SHORT   sFirstChar;
  14825.        SHORT   sLastChar;
  14826.        SHORT   sDefaultChar;
  14827.        SHORT   sBreakChar;
  14828.        SHORT   sNominalPointSize;
  14829.        SHORT   sMinimumPointSize;
  14830.        SHORT   sMaximumPointSize;
  14831.        USHORT  fsType;
  14832.        USHORT  fsDefn;
  14833.        USHORT  fsSelection;
  14834.        USHORT  fsCapabilities;
  14835.        LONG    lSubscriptXSize;
  14836.        LONG    lSubscriptYSize;
  14837.        LONG    lSubscriptXOffset;
  14838.        LONG    lSubscriptYOffset;
  14839.        LONG    lSuperscriptXSize;
  14840.        LONG    lSuperscriptYSize;
  14841.        LONG    lSuperscriptXOffset;
  14842.        LONG    lSuperscriptYOffset;
  14843.        LONG    lUnderscoreSize;
  14844.        LONG    lUnderscorePosition;
  14845.        LONG    lStrikeoutSize;
  14846.        LONG    lStrikeoutPosition;
  14847.        SHORT   sKerningPairs;
  14848.        SHORT   sReserved;
  14849.        LONG    lMatch;
  14850.    } FONTMETRICS;
  14851.  
  14852.    For a full description, see Chapter 4, "Types, Macros, Structures."
  14853.  
  14854.    cbMetrics  Specifies the length (in bytes) of the font-metrics
  14855.    structure(s).
  14856.  
  14857.    pcFonts  Points to the variable that receives the number of fonts for
  14858.    which the application requires metrics.
  14859.  
  14860.    pszFacename  Points to the null-terminated string that specifies the face
  14861.    name.
  14862.  
  14863.    flOptions  Specifies whether to enumerate public or private fonts. This
  14864.    parameter may be any combination of the following values:
  14865.  
  14866.    Value        Meaning
  14867.    ──────────────────────────────────────────────────────────────────────────
  14868.    VQF_PUBLIC   Enumerate public fonts.
  14869.  
  14870.    VQF_PRIVATE  Enumerate private fonts.
  14871.    ──────────────────────────────────────────────────────────────────────────
  14872.  
  14873.    hvps  Identifies the advanced video-input-and-output (AVIO) presentation
  14874.    space. This handle must have been created previously by using the
  14875.    VioCreatePS function.
  14876.  
  14877.  Return Value
  14878.  
  14879.    The return value is the number of fonts not retrieved. The return value is
  14880.    -1 if an error occurs.
  14881.  
  14882.  See Also
  14883.  
  14884.    GpiQueryFonts, VioCreateLogFont, VioCreatePS
  14885.  
  14886.  
  14887.  ────────────────────────────────────────────────────────────────────────────
  14888.  VioQuerySetIds
  14889.  ────────────────────────────────────────────────────────────────────────────
  14890.    USHORT VioQuerySetIds (palcids, pachNames, palTypes, cSets, hvps)
  14891.    PLONG palcids;          /*pointer to array for local identifiers        */
  14892.                            /*for fonts                                     */
  14893.    PSTR8 pachNames;        /*pointer to array for font names               */
  14894.    PLONG palTypes;         /*pointer to array for object types             */
  14895.    LONG cSets;             /*number of local identifiers in use            */
  14896.    HVPS hvps;              /*presentation-space handle                     */
  14897.  
  14898.    The VioQuerySetIds function retrieves information about all available
  14899.    logical fonts. This function is similar to the GpiQuerySetIds function.
  14900.  
  14901.  Parameters
  14902.  
  14903.    palcids  Points to the array that receives the local identifiers for the
  14904.    fonts.
  14905.  
  14906.    pachNames  Points to the array that receives the 8-character names for the
  14907.    fonts.
  14908.  
  14909.    palTypes  Points to the array that receives the object types for the
  14910.    fonts. All fonts have the object type LCIDT_FONT.
  14911.  
  14912.    cSets  Specifies the number of local identifiers currently in use and
  14913.    therefore the maximum number of objects for which information can be
  14914.    returned. You can determine this value by using the GpiQueryNumberSetIds
  14915.    function.
  14916.  
  14917.    hvps  Identifies the advanced video-input-and-output (AVIO) presentation
  14918.    space. This handle must have been created previously by using the
  14919.    VioCreatePS function.
  14920.  
  14921.  Return Value
  14922.  
  14923.    The return value is zero if the function is successful. Otherwise, it is
  14924.    an error value.
  14925.  
  14926.  See Also
  14927.  
  14928.    GpiQueryNumberSetIds, GpiQuerySetIds, VioCreatePS
  14929.  
  14930.  
  14931.  ────────────────────────────────────────────────────────────────────────────
  14932.  VioReadCellStr
  14933.  ────────────────────────────────────────────────────────────────────────────
  14934.    USHORT VioReadCellStr (pchCellString, pcb, usRow, usColumn, hvio)
  14935.    PCH pchCellString;      /*pointer to buffer for string                  */
  14936.    PUSHORT pcb;            /*pointer to variable for string length         */
  14937.    USHORT usRow;           /*starting location (row)                       */
  14938.    USHORT usColumn;        /*starting location (column)                    */
  14939.    HVIO hvio;              /*video handle                                  */
  14940.  
  14941.    The VioReadCellStr function reads one or more cells (character-attribute
  14942.    pairs) from the screen, starting at the specified location. If the string
  14943.    is longer than the current line, the function continues reading it at the
  14944.    beginning of the next line but does not read past the end of the screen.
  14945.  
  14946.    The VioReadCellStr function is a family API function.
  14947.  
  14948.  Parameters
  14949.  
  14950.    pchCellString  Points to the buffer that receives the cell string.
  14951.  
  14952.    pcb  Points to the variable that specifies the length (in bytes) of the
  14953.    buffer. The length should be an even number. On return, this function
  14954.    copies the length of the string to the variable.
  14955.  
  14956.    usRow  Specifies the starting row of the cell string to read.
  14957.  
  14958.    usColumn  Specifies the starting column of the cell string to read.
  14959.  
  14960.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  14961.    space. For AVIO programs, this handle must have been created previously
  14962.    using the VioCreatePS function. For other programs, hvio must be NULL.
  14963.  
  14964.  Return Value
  14965.  
  14966.    The return value is zero if the function is successful. Otherwise, it is
  14967.    an error value, which may be one of the following:
  14968.  
  14969.          ERROR_VIO_COL
  14970.          ERROR_VIO_INVALID_HANDLE
  14971.          ERROR_VIO_ROW
  14972.  
  14973.  Example
  14974.  
  14975.    This example calls VioReadCellStr to read Line 0, then calls the
  14976.    VioWrtCellStr function to write the cell string to Line 24:
  14977.  
  14978.    CHAR achCells[160];
  14979.    USHORT cb = sizeof(achCells);
  14980.    VioReadCellStr(achCells,   /* buffer for string                     */
  14981.        &cb,                   /* pointer to variable for string length */
  14982.        0,                     /* starting location (row)               */
  14983.        0,                     /* starting location (column)            */
  14984.        0);                    /* video handle                          */
  14985.    VioWrtCellStr(achCells, cb, 24, 0, 0);
  14986.  
  14987.  See Also
  14988.  
  14989.    VioReadCharStr, VioWrtCellStr
  14990.  
  14991.  
  14992.  ────────────────────────────────────────────────────────────────────────────
  14993.  VioReadCharStr
  14994.  ────────────────────────────────────────────────────────────────────────────
  14995.    USHORT VioReadCharStr (pchString, pcb, usRow, usColumn, hvio)
  14996.    PCH pchString;          /*pointer to buffer for string                  */
  14997.    PUSHORT pcb;            /*pointer to variable for length of buffer      */
  14998.    USHORT usRow;           /*starting location (row)                       */
  14999.    USHORT usColumn;        /*starting location (column)                    */
  15000.    HVIO hvio;              /*video handle                                  */
  15001.  
  15002.    The VioReadCharStr function reads a character string from the screen,
  15003.    starting at a specified location. If the character string is longer than
  15004.    the current line, the function continues reading it at the beginning of
  15005.    the next line but does not read past the end of the screen.
  15006.  
  15007.    The VioReadCharStr function is a family API function.
  15008.  
  15009.  Parameters
  15010.  
  15011.    pchString  Points to the buffer that receives the character string.
  15012.  
  15013.    pcb  Points to the variable that specifies the length (in bytes) of the
  15014.    buffer. On return, the function copies the length of the string to the
  15015.    variable.
  15016.  
  15017.    usRow  Specifies the starting row of the character to be read.
  15018.  
  15019.    usColumn  Specifies the starting column of the character to be read.
  15020.  
  15021.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  15022.    space. For AVIO programs, this handle must have been created previously
  15023.    using the VioCreatePS function. For other programs, hvio must be NULL.
  15024.  
  15025.  Return Value
  15026.  
  15027.    The return value is zero if the function is successful. Otherwise, it is
  15028.    an error value, which may be one of the following:
  15029.  
  15030.          ERROR_VIO_COL
  15031.          ERROR_VIO_INVALID_HANDLE
  15032.          ERROR_VIO_ROW
  15033.  
  15034.  Example
  15035.  
  15036.    This example calls VioReadCharStr to read a character string that is 80
  15037.    characters long, starting at Row 1, Column 0 of the screen. It then calls
  15038.    the VioWrtCharStr function to write the character string to Row 24, Column
  15039.    0.
  15040.  
  15041.    CHAR achString[80];
  15042.    USHORT cb = sizeof(achString);
  15043.    VioReadCharStr(achString,              /* string buffer    */
  15044.        &cb,                               /* length of buffer */
  15045.        1,                                 /* row              */
  15046.        0,                                 /* column           */
  15047.        0);                                /* video handle     */
  15048.    VioWrtCharStr(achString, cb, 24, 0, 0);
  15049.  
  15050.  See Also
  15051.  
  15052.    VioReadCellStr, VioWrtCharStr
  15053.  
  15054.  
  15055.  ────────────────────────────────────────────────────────────────────────────
  15056.  VioRegister
  15057.  ────────────────────────────────────────────────────────────────────────────
  15058.    USHORT VioRegister (pszModuleName, pszEntryName, flFunction1, flFunction2)
  15059.    PSZ pszModuleName;      /*pointer to module name                        */
  15060.    PSZ pszEntryName;       /*pointer to entry-point name                   */
  15061.    ULONG flFunction1;      /*function flag 1                               */
  15062.    ULONG flFunction2;      /*function flag 2                               */
  15063.  
  15064.    The VioRegister function registers a Vio subsystem within a screen group.
  15065.    VioRegister temporarily replaces one or more default Vio functions, as
  15066.    specified by the flFunction1 and flFunction2 parameters, with the
  15067.    functions pointed to by the pszModuleName parameter. Once VioRegister
  15068.    replaces a function, MS OS/2 passes any subsequent call to the replaced
  15069.    function to a function in the given module. If you do not replace a
  15070.    function, MS OS/2 continues to call the default Vio function.
  15071.  
  15072.  Parameters
  15073.  
  15074.    pszModuleName  Points to the null-terminated string that specifies the
  15075.    name of the dynamic-link module containing the replacement Vio functions.
  15076.    The string must be a valid filename.
  15077.  
  15078.    pszEntryName  Points to the null-terminated string that specifies the
  15079.    dynamic-link entry-point name of the function that replaces the specified
  15080.    Vio functions. For a full description, see the following "Comments"
  15081.    section.
  15082.  
  15083.    flFunction1  Specifies the Vio function(s) to replace. This parameter can
  15084.    be any combination of the following values:
  15085.  
  15086. ╓┌─┌─────────────────────┌───────────────────────────────────────────────────╖
  15087.    Value                 Meaning
  15088.    ──────────────────────────────────────────────────────────────────────────
  15089.    VR_VIOGETCURPOS       Replace VioGetCurPos.
  15090.  
  15091.    VR_VIOGETCURTYPE      Replace VioGetCurType.
  15092.  
  15093.    VR_VIOGETMODE         Replace VioGetMode.
  15094.  
  15095.    VR_VIOGETBUF          Replace VioGetBuf.
  15096.  
  15097.    VR_VIOGETPHYSBUF      Replace VioGetPhysBuf.
  15098.  
  15099.    VR_VIOSETCURPOS       Replace VioSetCurPos.
  15100.  
  15101.    Value                 Meaning
  15102.    ──────────────────────────────────────────────────────────────────────────
  15103. 
  15104.    VR_VIOSETCURTYPE      Replace VioSetCurType.
  15105.  
  15106.    VR_VIOSETMODE         Replace VioSetMode.
  15107.  
  15108.    VR_VIOSHOWBUF         Replace VioShowBuf.
  15109.  
  15110.    VR_VIOREADCHARSTR     Replace VioReadCharStr.
  15111.  
  15112.    VR_VIOREADCELLSTR     Replace VioReadCellStr.
  15113.  
  15114.    VR_VIOWRTNCHAR        Replace VioWrtNChar.
  15115.  
  15116.    VR_VIOWRTNATTR        Replace VioWrtNAttr.
  15117.  
  15118.    VR_VIOWRTNCELL        Replace VioWrtNCell.
  15119.  
  15120.    VR_VIOWRTTTY          Replace VioWrtTTY.
  15121.  
  15122.    Value                 Meaning
  15123.    ──────────────────────────────────────────────────────────────────────────
  15124. 
  15125.    VR_VIOWRTCHARSTR      Replace VioWrtCharStr.
  15126.  
  15127.    VR_VIOWRTCHARSTRATT   Replace VioWrtCharStrAtt.
  15128.  
  15129.    VR_VIOWRTCELLSTR      Replace VioWrtCellStr.
  15130.  
  15131.    VR_VIOSCROLLUP        Replace VioScrollUp.
  15132.  
  15133.    VR_VIOSCROLLDN        Replace VioScrollDn.
  15134.  
  15135.    VR_VIOSCROLLLF        Replace VioScrollLf.
  15136.  
  15137.    VR_VIOSCROLLRT        Replace VioScrollRt.
  15138.  
  15139.    VR_VIOSETANSI         Replace VioSetAnsi.
  15140.  
  15141.    VR_VIOGETANSI         Replace VioGetAnsi.
  15142.  
  15143.    Value                 Meaning
  15144.    ──────────────────────────────────────────────────────────────────────────
  15145. 
  15146.    VR_VIOPRTSC           Replace VioPrtSc.
  15147.  
  15148.    VR_VIOSCRLOCK         Replace VioScrLock.
  15149.  
  15150.    VR_VIOSCRUNLOCK       Replace VioScrUnLock.
  15151.  
  15152.    VR_VIOSAVREDRAWWAIT   Replace VioSavRedrawWait.
  15153.  
  15154.    VR_VIOSAVREDRAWUNDO   Replace VioSavRedrawUndo.
  15155.  
  15156.    VR_VIOPOPUP           Replace VioPopUp.
  15157.  
  15158.    VR_VIOENDPOPUP        Replace VioEndPopUp.
  15159.  
  15160.    VR_VIOPRTSCTOGGLE     Replace VioPrtScToggle.
  15161.    ──────────────────────────────────────────────────────────────────────────
  15162.  
  15163.  
  15164.    flFunction2  Specifies the Vio function(s) to replace. This parameter can
  15165.    be any combination of the following values:
  15166.  
  15167.    Value                 Meaning
  15168.    ──────────────────────────────────────────────────────────────────────────
  15169.    VR_VIOMODEWAIT        Replace VioModeWait.
  15170.  
  15171.    VR_VIOMODEUNDO        Replace VioModeUndo.
  15172.  
  15173.    VR_VIOGETFONT         Replace VioGetFont.
  15174.  
  15175.    VR_VIOGETCONFIG       Replace VioGetConfig.
  15176.  
  15177.    VR_VIOSETCP           Replace VioSetCp.
  15178.  
  15179.    VR_VIOGETCP           Replace VioGetCp.
  15180.  
  15181.    VR_VIOSETFONT         Replace VioSetFont.
  15182.  
  15183.    VR_VIOGETSTATE        Replace VioGetState.
  15184.  
  15185.    VR_VIOSETSTATE        Replace VioSetState.
  15186.    ──────────────────────────────────────────────────────────────────────────
  15187.  
  15188.  Return Value
  15189.  
  15190.    The return value is zero if the function is successful. Otherwise, it is
  15191.    an error value, which may be one of the following:
  15192.  
  15193.          ERROR_VIO_INVALID_ASCIIZ
  15194.          ERROR_VIO_INVALID_MASK
  15195.          ERROR_VIO_REGISTER
  15196.  
  15197.  Comments
  15198.  
  15199.    MS OS/2 passes a Vio function to the given module by preparing the stack
  15200.    and calling the function pointed to by the pszEntryName parameter. The
  15201.    specified module must export the entry-point function name. The
  15202.    entry-point function must determine which function is being requested (by
  15203.    checking the function code on the stack), then pass control to the
  15204.    appropriate function in the module. The entry-point function may then
  15205.    access any additional parameters placed on the stack by the original call.
  15206.  
  15207.    Only one process in a screen group may use the VioRegister function at any
  15208.    given time. That is, only one process at a time can replace Vio functions.
  15209.    The process can restore the default Vio functions by calling the
  15210.    VioDeRegister function. A process can replace Vio functions any number of
  15211.    times, but only by first restoring the default functions and then
  15212.    reregistering the new functions.
  15213.  
  15214.    The entry-point function (FuncName) must have the following form:
  15215.  
  15216.      SHORT FAR FuncName(selDataSeg, usReserved1, fFunction, ulReserved2,
  15217.          usParam1, usParam2, usParam3, usParam4, usParam5, usParam6)
  15218.      SEL selDataSeg;
  15219.      USHORT usReserved1;
  15220.      USHORT fFunction;
  15221.      ULONG ulReserved2;
  15222.      USHORT usParam1;
  15223.      USHORT usParam2;
  15224.      USHORT usParam3;
  15225.      USHORT usParam4;
  15226.      USHORT usParam5;
  15227.      USHORT usParam6;
  15228.  
  15229. ╓┌─┌─────────────────┌───────────────────────────────────────────────────────╖
  15230.    Parameter         Description
  15231.    ──────────────────────────────────────────────────────────────────────────
  15232.    selDataSeg        Specifies the data segment selector of the process
  15233.                      calling the Vio function.
  15234.  
  15235.    usReserved1       Specifies a reserved value that must not be changed.
  15236.                      This value represents a return address for the MS OS/2
  15237.                      function that routes calls to Vio functions.
  15238.  
  15239.    fFunction         Specifies the function code of the function request.
  15240.                      This parameter can be one of the following values:
  15241.  
  15242.                      Value     Meaning
  15243.                      ────────────────────────────────────────────────────────
  15244.                      0x0000    VioGetPhysBuf called.
  15245.                      0x0001    VioGetBuf called.
  15246.                      0x0002    VioShowBuf called.
  15247.                      0x0003    VioGetCurPos called.
  15248.    Parameter         Description
  15249.    ──────────────────────────────────────────────────────────────────────────
  15250.                     0x0003    VioGetCurPos called.
  15251.                      0x0004    VioGetCurType called.
  15252.                      0x0005    VioGetMode called.
  15253.                      0x0006    VioSetCurPos called.
  15254.                      0x0007    VioSetCurType called.
  15255.                      0x0008    VioSetMode called.
  15256.                      0x0009    VioReadCharStr called.
  15257.                      0x000A    VioReadCellStr called.
  15258.                      0x000B    VioWrtNChar called.
  15259.                      0x000C    VioWrtNAttr called.
  15260.                      0x000D    VioWrtNCell called.
  15261.                      0x000E    VioWrtCharStr called.
  15262.                      0x000F    VioWrtCharStrAtt called.
  15263.                      0x0010    VioWrtCellStr called.
  15264.                      0x0011    VioWrtTTY called.
  15265.                      0x0012    VioScrollUp called.
  15266.                      0x0013    VioScrollDn called.
  15267.                      0x0014    VioScrollLf called.
  15268.                      0x0015    VioScrollRt called.
  15269.    Parameter         Description
  15270.    ──────────────────────────────────────────────────────────────────────────
  15271.                     0x0015    VioScrollRt called.
  15272.                      0x0016    VioSetAnsi called.
  15273.                      0x0017    VioGetAnsi called.
  15274.                      0x0018    VioPrtSc called.
  15275.                      0x0019    VioScrLock called.
  15276.                      0x001A    VioScrUnLock called.
  15277.                      0x001B    VioSavRedrawWait called.
  15278.                      0x001C    VioSavRedrawUndo called.
  15279.                      0x001D    VioPopUp called.
  15280.                      0x001E    VioEndPopUp called.
  15281.                      0x001F    VioPrtScToggle called.
  15282.                      0x0020    VioModeWait called.
  15283.                      0x0021    VioModeUndo called.
  15284.                      0x0022    VioGetFont called.
  15285.                      0x0023    VioGetConfig called.
  15286.                      0x0024    VioSetCp called.
  15287.                      0x0025    VioGetCp called.
  15288.                      0x0026    VioSetFont called.
  15289.                      0x0027    VioGetState called.
  15290.    Parameter         Description
  15291.    ──────────────────────────────────────────────────────────────────────────
  15292.                     0x0027    VioGetState called.
  15293.                      0x0028    VioSetState called.
  15294.    ──────────────────────────────────────────────────────────────────────────
  15295.  
  15296.  
  15297.    Parameter      Description
  15298.    ──────────────────────────────────────────────────────────────────────────
  15299.    ulReserved2    Specifies a reserved value that must not be changed. This
  15300.                   value represents the return address of the program that
  15301.                   calls the specified Vio function.
  15302.  
  15303.    usParam1-usPar Specifies up to six values passed with the original call to
  15304.    am6            the Vio function. Not all requests include all six
  15305.                   parameters since not all Vio functions use six parameters.
  15306.                   The number and type of parameters used depend on the
  15307.                   specific function.
  15308.    ──────────────────────────────────────────────────────────────────────────
  15309.  
  15310.    The entry-point function should determine which function is requested and
  15311.    then carry out an appropriate action by using the passed parameters. The
  15312.    entry-point function can call a function within the same module to carry
  15313.    out the task. The entry-point or replacement function must leave the stack
  15314.    in the same state as it was received. This is required since the return
  15315.    addresses on the stack must be available in the correct order to return
  15316.    control to the program that originally called the VioRegister function.
  15317.  
  15318.    The registered function should return -1 if it wants the original function
  15319.    called, 0 if no error occurred, or an error value.
  15320.  
  15321.    In general, if the function needs to access the display, it must use the
  15322.    input-and-output control functions for the display. For more information,
  15323.    see Chapter 3, "Input-and-Output Control Functions."
  15324.  
  15325.    The VioRegister function itself cannot be replaced.
  15326.  
  15327.    If a process replaces the VioPopUp function, only the foreground process
  15328.    has access to the replacement function. Background processes continue to
  15329.    call the default VioPopUp function.
  15330.  
  15331.  See Also
  15332.  
  15333.    VioDeRegister, VioPopUp, VioSetCurPos
  15334.  
  15335.  
  15336.  ────────────────────────────────────────────────────────────────────────────
  15337.  VioSavRedrawUndo
  15338.  ────────────────────────────────────────────────────────────────────────────
  15339.    USHORT VioSavRedrawUndo (fRelinquish, fTerminate, hvio)
  15340.    USHORT fRelinquish;     /*retain/relinquish ownership flag              */
  15341.    USHORT fTerminate;      /*terminate/continue flag                       */
  15342.    HVIO hvio;              /*video handle                                  */
  15343.  
  15344.    The VioSavRedrawUndo function cancels a request by a process to be
  15345.    notified when MS OS/2 switches screen groups. A process requests to be
  15346.    notified by calling the VioSavRedrawWait function. The request forces the
  15347.    calling thread to wait until a screen switch occurs. VioSavRedrawUndo
  15348.    cancels the request and allows the thread to continue (or terminates the
  15349.    thread, if requested to do so).
  15350.  
  15351.    MS OS/2 permits only one process in a screen group to request screen
  15352.    switch notification. The first process to make a request owns it.
  15353.    Thereafter, other processes must wait for the owning process to relinquish
  15354.    the request before being given ownership. To force the process to
  15355.    relinquish ownership of the request, use the VioSavRedrawUndo function.
  15356.  
  15357.    Only the process that owns the change-mode request can call the
  15358.    VioSavRedrawUndo function.
  15359.  
  15360.  Parameters
  15361.  
  15362.    fRelinquish  Specifies whether a process should retain or relinquish
  15363.    ownership of the request. If this parameter is UNDOI_GETOWNER, the
  15364.    process relinquishes ownership and is canceled by this function. If the
  15365.    parameter is UNDOI_RELEASEOWNER, the process retains ownership and can
  15366.    repeat the request without competing with other processes.
  15367.  
  15368.    fTerminate  Specifies whether to terminate the thread waiting for the mode
  15369.    change. If this parameter is UNDOK_ERRORCODE, the thread continues and
  15370.    receives an error value from the VioSavRedrawWait function. If the
  15371.    parameter is UNDOK_TERMINATE, the thread terminates.
  15372.  
  15373.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  15374.    space. For AVIO programs, this handle must have been created previously
  15375.    using the VioCreatePS function. For other programs, hvio must be NULL.
  15376.  
  15377.  Return Value
  15378.  
  15379.    The return value is zero if the function is successful. Otherwise, it is
  15380.    an error value, which may be one of the following:
  15381.  
  15382.          ERROR_VIO_FUNCTION_OWNED
  15383.          ERROR_VIO_INVALID_PARMS
  15384.          ERROR_VIO_NO_SAVE_RESTORE_THD
  15385.  
  15386.  See Also
  15387.  
  15388.    VioModeUndo, VioSavRedrawWait
  15389.  
  15390.  
  15391.  ────────────────────────────────────────────────────────────────────────────
  15392.  VioSavRedrawWait
  15393.  ────────────────────────────────────────────────────────────────────────────
  15394.    USHORT VioSavRedrawWait (fEvent, pfNotify, usReserved)
  15395.    USHORT fEvent;          /*event flag                                    */
  15396.    PUSHORT pfNotify;       /*pointer to variable for notify flag           */
  15397.    USHORT usReserved;      /*must be zero                                  */
  15398.  
  15399.    The VioSavRedrawWait function waits for a screen switch to occur. When a
  15400.    switch occurs, MS OS/2 sets the variable pointed to by the pfNotify
  15401.    parameter to a value that indicates the type of changes. The thread may
  15402.    then save or restore the display depending on the value pointed to by the
  15403.    pfNotify parameter. The thread must also save or restore the complete
  15404.    video mode, the state information, the registers, and the contents of the
  15405.    physical video buffer.
  15406.  
  15407.    MS OS/2 permits only one process in a screen group to wait for a screen
  15408.    switch. The first process to make a request owns it.
  15409.  
  15410.    The VioSavRedrawWait function is used typically by graphics programs (or
  15411.    text-mode programs that change the video registers directly) to save and
  15412.    restore the screen before and after MS OS/2 switches from one screen group
  15413.    to another. Screen switching often changes the screen mode and video
  15414.    register values. A thread that calls the VioSavRedrawWait function waits
  15415.    until a screen switch occurs and is then given control so that it can save
  15416.    or restore the screen.
  15417.  
  15418.  Parameters
  15419.  
  15420.    fEvent  Specifies the event flag of the event to wait for. If this flag is
  15421.    VSRWI_SAVEANDREDRAW, the function returns when the screen needs to be
  15422.    either saved or restored. If the flag is VSRWI_REDRAW, the function
  15423.    returns only when the screen needs to be restored.
  15424.  
  15425.    pfNotify  Points to the variable that receives the flag specifying the
  15426.    action to carry out in response to the given event. If this flag is
  15427.    VSWRN_SAVE, the thread saves the video buffer, the registers, and the
  15428.    state information. If the flag is VSWRN_REDRAW, the thread restores the
  15429.    video buffer, the registers, and the state information.
  15430.  
  15431.    usReserved  Specifies a reserved value. This parameter must be zero.
  15432.  
  15433.  Return Value
  15434.  
  15435.    The return value is zero if the function is successful. Otherwise, it is
  15436.    an error value, which may be one of the following:
  15437.  
  15438.          ERROR_VIO_FUNCTION_OWNED
  15439.          ERROR_VIO_INVALID_PARMS
  15440.          ERROR_VIO_RETURN
  15441.  
  15442.  Comments
  15443.  
  15444.    When an application is notified that it should save its screen image, it
  15445.    saves its physical video buffer, video mode, and any other information the
  15446.    application needs in order to redraw its screen.
  15447.  
  15448.    The thread that calls VioSavRedrawWait should carry out all tasks directly
  15449.    related to saving and restoring the screen information. Whenever a screen
  15450.    switch occurs, the thread should save or restore the screen and call
  15451.    VioSavRedrawWait as quickly as possible. The thread can access the
  15452.    physical video buffer, if necessary, but since the thread may not be the
  15453.    foreground process, it must not use the VioScrLock function to lock the
  15454.    screen. The thread should not call MS OS/2 functions (neither directly nor
  15455.    indirectly through other functions) that may generate pop-up screens or
  15456.    error pop-up screens. Doing so may cause MS OS/2 to lock up (that is, each
  15457.    call of the thread generates a pop-up screen, which in turn calls the
  15458.    thread and generates another pop-up screen, and so on). You can use the
  15459.    VioSavRedrawUndo function to end the thread when it is no longer needed.
  15460.  
  15461.    In some cases, a thread may receive a request to restore the screen before
  15462.    receiving a request to save the screen. For such requests, the thread must
  15463.    determine whether the given request is valid.
  15464.  
  15465.    Programs that need to save and restore the screen after a pop-up screen
  15466.    should use the VioModeWait function.
  15467.  
  15468.  See Also
  15469.  
  15470.    VioGetPhysBuf, VioModeWait, VioSavRedrawUndo
  15471.  
  15472.  
  15473.  ────────────────────────────────────────────────────────────────────────────
  15474.  VioScrLock
  15475.  ────────────────────────────────────────────────────────────────────────────
  15476.    USHORT VioScrLock (fWait, pfNotLocked, hvio)
  15477.    USHORT fWait;           /*wait/no-wait flag                             */
  15478.    PBYTE pfNotLocked;      /*pointer to variable for status                */
  15479.    HVIO hvio;              /*video handle                                  */
  15480.  
  15481.    The VioScrLock function locks the physical video buffer for a process.
  15482.    While the buffer is locked, no other process may lock it. This function is
  15483.    used typically to coordinate the output of graphics programs so that only
  15484.    one process writes to the physical video buffer at a time. The function
  15485.    indicates when the screen is locked by another process and is not
  15486.    available for writing, rather than denying processes access to the
  15487.    physical video buffer.
  15488.  
  15489.    Only one process in a screen group may lock the screen. If the screen is
  15490.    already locked, VioScrLock either waits for the screen to become unlocked
  15491.    or returns immediately, as determined by the fWait parameter. Processes
  15492.    that lock the screen should unlock it by using the VioScrUnLock function
  15493.    as soon as they have completed the output.
  15494.  
  15495.    If a screen-switch request occurs while the screen lock is in effect, the
  15496.    switch is held for at least thirty seconds. If the process does not unlock
  15497.    the screen before thirty seconds elapse, MS OS/2 suspends the process and
  15498.    switches the screen. The suspended process remains in the background until
  15499.    it is switched back to the foreground.
  15500.  
  15501.    The VioScrLock function is a family API function.
  15502.  
  15503.  Parameters
  15504.  
  15505.    fWait  Specifies the flag that determines whether the process is to wait
  15506.    until the screen input or output can occur. If this flag is LOCKIO_NOWAIT,
  15507.    the process returns immediately if the screen is not available. If the
  15508.    flag is LOCKIO_WAIT, the process waits for the screen to become available.
  15509.  
  15510.    pfNotLocked  Points to the variable that receives the flag specifying
  15511.    whether the screen is locked. If this flag is LOCK_SUCCESS, the screen is
  15512.    locked. If the flag is LOCK_FAIL, the screen is not locked.
  15513.  
  15514.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  15515.    space. For AVIO programs, this handle must have been created previously
  15516.    using the VioCreatePS function. For other programs, hvio must be NULL.
  15517.  
  15518.  Return Value
  15519.  
  15520.    The return value is zero if the function is successful. Otherwise, it is
  15521.    an error value, which may be one of the following:
  15522.  
  15523.          ERROR_VIO_INVALID_HANDLE
  15524.          ERROR_VIO_LOCK
  15525.          ERROR_VIO_WAIT_FLAG
  15526.  
  15527.  Restrictions
  15528.  
  15529.    In real mode, the following restriction applies to the VioScrLock
  15530.    function:
  15531.  
  15532.    ■  The function always indicates that the lock was successful.
  15533.  
  15534.  Example
  15535.  
  15536.    This example calls VioScrLock and waits until the screen lock can be
  15537.    performed (the process is in the foreground):
  15538.  
  15539.    USHORT fNotLocked;
  15540.    VioScrLock(LOCKIO_WAIT,  /* waits until I/O can take place  */
  15541.        &fNotLocked,         /* variable to receive lock status */
  15542.        0);                  /* video handle                    */
  15543.        .
  15544.        .
  15545.        .
  15546.    VioScrUnLock(0);
  15547.  
  15548.  See Also
  15549.  
  15550.    VioGetPhysBuf, VioScrUnLock
  15551.  
  15552.  
  15553.  ────────────────────────────────────────────────────────────────────────────
  15554.  VioScrollDn
  15555.  ────────────────────────────────────────────────────────────────────────────
  15556.    USHORT VioScrollDn (usTopRow, usLeftCol, usBotRow, usRightCol, cbLines,
  15557.    pbCell, hvio)
  15558.    USHORT usTopRow;        /*top row                                       */
  15559.    USHORT usLeftCol;       /*left column                                   */
  15560.    USHORT usBotRow;        /*bottom row                                    */
  15561.    USHORT usRightCol;      /*right column                                  */
  15562.    USHORT cbLines;         /*number of blank lines                         */
  15563.    PBYTE pbCell;           /*pointer to cell to write                      */
  15564.    HVIO hvio;              /*video handle                                  */
  15565.  
  15566.    The VioScrollDn function scrolls the current screen downward.
  15567.  
  15568.    The VioScrollDn function is a family API function.
  15569.  
  15570.  Parameters
  15571.  
  15572.    usTopRow  Specifies the top row of the screen area to scroll.
  15573.  
  15574.    usLeftCol  Specifies the leftmost column of the screen area to scroll.
  15575.  
  15576.    usBotRow  Specifies the bottom row of the screen area to scroll.
  15577.  
  15578.    usRightCol  Specifies the rightmost column of the screen area to scroll.
  15579.  
  15580.    cbLines  Specifies the number of lines to be inserted at the top of the
  15581.    screen area being scrolled. If this parameter is zero, no lines are
  15582.    scrolled.
  15583.  
  15584.    pbCell  Points to a character/attribute pair, called a cell, that fills
  15585.    the screen area left blank by the scrolling.
  15586.  
  15587.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  15588.    space. For AVIO programs, this handle must have been created previously
  15589.    using the VioCreatePS function. For other programs, hvio must be NULL.
  15590.  
  15591.  Return Value
  15592.  
  15593.    The return value is zero if the function is successful. Otherwise, it is
  15594.    an error value, which may be one of the following:
  15595.  
  15596.          ERROR_VIO_COL
  15597.          ERROR_VIO_INVALID_HANDLE
  15598.          ERROR_VIO_ROW
  15599.  
  15600.  Comments
  15601.  
  15602.    If the usTopRow and usLeftCol parameters are zero, they identify the
  15603.    upper-left corner of the screen. If you specify a value greater than the
  15604.    maximum for usTopRow, usLeftCol, usBotRow, usRightCol, or cbLines, the
  15605.    maximum value for that parameter is used. Maximum values depend upon the
  15606.    dimensions of the screen being used.
  15607.  
  15608.    You can use the VioScrollDn function to clear the screen by setting
  15609.    usTopRow and usLeftCol to zero and usBotRow, usRightCol, and cbLines to
  15610.    their maximum values. The function clears the screen by using the
  15611.    character/attribute pair pointed to by the pbCell parameter.
  15612.  
  15613.  Example
  15614.  
  15615.    This example creates a cell containing the space character (0x20) and a
  15616.    white character attribute (0x07 on an EGA color monitor), and calls
  15617.    VioScrollDn to clear the screen by using this cell. By changing the
  15618.    character attribute, you could change the background color of the screen
  15619.    while clearing it at the same time (using the value 0xFFFF for usBotRow,
  15620.    usRightCol, and cbLines clears the screen):
  15621.  
  15622.    BYTE bCell[2];
  15623.    bCell[0] = 0x20;      /* space character       */
  15624.    bCell[1] = 0x07;      /* white attribute (EGA) */
  15625.    VioScrollDn(0,        /* top row               */
  15626.        0,                /* left column           */
  15627.        0xFFFF,           /* bottom row            */
  15628.        0xFFFF,           /* right column          */
  15629.        0xFFFF,           /* number of lines       */
  15630.        bCell,            /* cell to write         */
  15631.        0);               /* video handle          */
  15632.  
  15633.  See Also
  15634.  
  15635.    VioScrollLf, VioScrollRt, VioScrollUp
  15636.  
  15637.  
  15638.  ────────────────────────────────────────────────────────────────────────────
  15639.  VioScrollLf
  15640.  ────────────────────────────────────────────────────────────────────────────
  15641.    USHORT VioScrollLf (usTopRow, usLeftCol, usBotRow, usRightCol, cbColumns,
  15642.    pbCell, hvio)
  15643.    USHORT usTopRow;        /*top row                                       */
  15644.    USHORT usLeftCol;       /*left column                                   */
  15645.    USHORT usBotRow;        /*bottom row                                    */
  15646.    USHORT usRightCol;      /*right column                                  */
  15647.    USHORT cbColumns;       /*number of blank columns                       */
  15648.    PBYTE pbCell;           /*pointer to the cell to write                  */
  15649.    HVIO hvio;              /*video handle                                  */
  15650.  
  15651.    The VioScrollLf function scrolls the current screen toward the left.
  15652.  
  15653.    The VioScrollLf function is a family API function.
  15654.  
  15655.  Parameters
  15656.  
  15657.    usTopRow  Specifies the top row of the screen area to scroll.
  15658.  
  15659.    usLeftCol  Specifies the leftmost column of the screen area to scroll.
  15660.  
  15661.    usBotRow  Specifies the bottom row of the screen area to scroll.
  15662.  
  15663.    usRightCol  Specifies the rightmost column of the screen area to scroll.
  15664.  
  15665.    cbColumns  Specifies the number of columns of spaces to be inserted at the
  15666.    right. If this parameter is zero, no columns are inserted.
  15667.  
  15668.    pbCell  Points to a character/attribute pair, called a cell, that fills
  15669.    the screen area left blank by the scrolling.
  15670.  
  15671.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  15672.    space. For AVIO programs, this handle must have been created previously
  15673.    using the VioCreatePS function. For other programs, hvio must be NULL.
  15674.  
  15675.  Return Value
  15676.  
  15677.    The return value is zero if the function is successful. Otherwise, it is
  15678.    an error value, which may be one of the following:
  15679.  
  15680.          ERROR_VIO_COL
  15681.          ERROR_VIO_INVALID_HANDLE
  15682.          ERROR_VIO_ROW
  15683.  
  15684.  Comments
  15685.  
  15686.    If the usTopRow and usLeftCol parameters are zero, they identify the
  15687.    upper- left corner of the screen. If you specify a value greater than the
  15688.    maximum for usTopRow, usLeftCol, usBotRow, usRightCol, or cbColumns, the
  15689.    maximum value for that parameter is used. Maximum values depend upon the
  15690.    dimensions of the screen being used.
  15691.  
  15692.    You can use the VioScrollLf function to clear the screen by setting
  15693.    usTopRow and usLeftCol to zero and usBotRow, usRightCol, and cbColumns to
  15694.    their maximum values. The function clears the screen by using the
  15695.    character/attribute pair pointed to by the pbCell parameter.
  15696.  
  15697.  Example
  15698.  
  15699.    This example calls VioScrollLf to fill the last ten columns at the right
  15700.    of the screen with red hearts on a black background (a value of 0xFFFF is
  15701.    used for usBotRow and usRightCol):
  15702.  
  15703.    BYTE bCell[2];
  15704.    bCell[0] = 0x03;     /* heart character     */
  15705.    bCell[1] = 0x04;     /* red attribute (EGA) */
  15706.    VioScrollLf(0,       /* top row             */
  15707.        0,               /* left column         */
  15708.        0xFFFF,          /* bottom row          */
  15709.        0xFFFF,          /* right column        */
  15710.        10,              /* columns             */
  15711.        bCell,           /* cell to write       */
  15712.        0);              /* video handle        */
  15713.  
  15714.  See Also
  15715.  
  15716.    VioScrollDn, VioScrollRt, VioScrollUp
  15717.  
  15718.  
  15719.  ────────────────────────────────────────────────────────────────────────────
  15720.  VioScrollRt
  15721.  ────────────────────────────────────────────────────────────────────────────
  15722.    USHORT VioScrollRt (usTopRow, usLeftCol, usBotRow, usRightCol, cbColumns,
  15723.    pbCell, hvio)
  15724.    USHORT usTopRow;        /*top row                                       */
  15725.    USHORT usLeftCol;       /*left column                                   */
  15726.    USHORT usBotRow;        /*bottom row                                    */
  15727.    USHORT usRightCol;      /*right column                                  */
  15728.    USHORT cbColumns;       /*number of blank columns                       */
  15729.    PBYTE pbCell;           /*pointer to cell to write                      */
  15730.    HVIO hvio;              /*video handle                                  */
  15731.  
  15732.    The VioScrollRt function scrolls the current screen toward the right.
  15733.  
  15734.    The VioScrollRt function is a family API function.
  15735.  
  15736.  Parameters
  15737.  
  15738.    usTopRow  Specifies the top row of the screen area to scroll.
  15739.  
  15740.    usLeftCol  Specifies the leftmost column of the screen area to scroll.
  15741.  
  15742.    usBotRow  Specifies the bottom row of the screen area to scroll.
  15743.  
  15744.    usRightCol  Specifies the rightmost column of the screen area to scroll.
  15745.  
  15746.    cbColumns  Specifies the number of columns of spaces to be inserted at the
  15747.    left. If this parameter is zero, no columns are inserted.
  15748.  
  15749.    pbCell  Points to a character/attribute pair, called a cell, that fills
  15750.    the screen area left blank by the scrolling.
  15751.  
  15752.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  15753.    space. For AVIO programs, this handle must have been created previously
  15754.    using the VioCreatePS function. For other programs, hvio must be NULL.
  15755.  
  15756.  Return Value
  15757.  
  15758.    The return value is zero if the function is successful. Otherwise, it is
  15759.    an error value, which may be one of the following:
  15760.  
  15761.          ERROR_VIO_COL
  15762.          ERROR_VIO_INVALID_HANDLE
  15763.          ERROR_VIO_ROW
  15764.  
  15765.  Comments
  15766.  
  15767.    If the usTopRow and usLeftCol parameters are zero, they identify the
  15768.    upper- left corner of the screen. If you specify a value greater than the
  15769.    maximum for usTopRow, usLeftCol, usBotRow, usRightCol, or cbColumns, the
  15770.    maximum value for that parameter is used. Maximum values depend upon the
  15771.    dimensions of the screen being used.
  15772.  
  15773.    You can use the VioScrollUp function to clear the screen by setting
  15774.    usTopRow and usLeftCol to zero and usBotRow, usRightCol, and cbColumns to
  15775.    their maximum values. The function clears the screen by using the
  15776.    character/attribute pair pointed to by the pbCell parameter.
  15777.  
  15778.  Example
  15779.  
  15780.    This example calls VioScrollRt to fill the first ten columns at the left
  15781.    of the screen with red hearts on a black background (a value of 0xFFFF is
  15782.    used for usBotRow and usRightCol):
  15783.  
  15784.    BYTE bCell[2];
  15785.    bCell[0] = 0x03;     /* heart character     */
  15786.    bCell[1] = 0x04;     /* red attribute (EGA) */
  15787.    VioScrollRt(0,       /* top row             */
  15788.        0,               /* left column         */
  15789.        0xFFFF,          /* bottom row          */
  15790.        0xFFFF,          /* right column        */
  15791.        10,              /* columns             */
  15792.        bCell,           /* cell to write       */
  15793.        0);              /* video handle        */
  15794.  
  15795.  See Also
  15796.  
  15797.    VioScrollDn, VioScrollLf, VioScrollUp
  15798.  
  15799.  
  15800.  ────────────────────────────────────────────────────────────────────────────
  15801.  VioScrollUp
  15802.  ────────────────────────────────────────────────────────────────────────────
  15803.    USHORT VioScrollUp (usTopRow, usLeftCol, usBotRow, usRightCol, cbLines,
  15804.    pbCell, hvio)
  15805.    USHORT usTopRow;        /*top row                                       */
  15806.    USHORT usLeftCol;       /*left column                                   */
  15807.    USHORT usBotRow;        /*bottom row                                    */
  15808.    USHORT usRightCol;      /*right column                                  */
  15809.    USHORT cbLines;         /*number of blank lines                         */
  15810.    PBYTE pbCell;           /*pointer to cell to write                      */
  15811.    HVIO hvio;              /*video handle                                  */
  15812.  
  15813.    The VioScrollUp function scrolls the current screen upward.
  15814.  
  15815.    The VioScrollUp function is a family API function.
  15816.  
  15817.  Parameters
  15818.  
  15819.    usTopRow  Specifies the top row of the screen area to scroll.
  15820.  
  15821.    usLeftCol  Specifies the leftmost column of the screen area to scroll.
  15822.  
  15823.    usBotRow  Specifies the bottom row of the screen area to scroll.
  15824.  
  15825.    usRightCol  Specifies the rightmost column of the screen area to scroll.
  15826.  
  15827.    cbLines  Specifies the number of blank lines to insert at the bottom of
  15828.    the screen area being scrolled. If this parameter is zero, no lines are
  15829.    inserted.
  15830.  
  15831.    pbCell  Points to a character/attribute pair, called a cell, that fills
  15832.    the screen area left blank by the scrolling.
  15833.  
  15834.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  15835.    space. For AVIO programs, this handle must have been created previously
  15836.    using the VioCreatePS function. For other programs, hvio must be NULL.
  15837.  
  15838.  Return Value
  15839.  
  15840.    The return value is zero if the function is successful. Otherwise, it is
  15841.    an error value, which may be one of the following:
  15842.  
  15843.          ERROR_VIO_COL
  15844.          ERROR_VIO_INVALID_HANDLE
  15845.          ERROR_VIO_ROW
  15846.  
  15847.  Comments
  15848.  
  15849.    If the usTopRow and usLeftCol parameters are zero, they identify the
  15850.    upper- left corner of the screen. If you specify a value greater than the
  15851.    maximum for usTopRow, usLeftCol, usBotRow, usRightCol, or cbLines, the
  15852.    maximum value for that parameter is used. Maximum values depend upon the
  15853.    dimensions of the screen being used.
  15854.  
  15855.    You can use the VioScrollUp function to clear the screen by setting
  15856.    usTopRow and usLeftCol to zero and usBotRow, usRightCol, and cbLines to
  15857.    their maximum values. The function clears the screen by using the
  15858.    character/attribute pair pointed to by the pbCell parameter.
  15859.  
  15860.  Example
  15861.  
  15862.    This example calls VioScrollUp to scroll the entire screen up (by using
  15863.    the value 0xFFFF for usBotRow, usRightCol, and cbLines) and to fill the
  15864.    screen area left blank by the scrolling with spaces on a green background
  15865.    (0x22 on an EGA color monitor):
  15866.  
  15867.    BYTE bCell[2];
  15868.    bCell[0] = 0x20;        /* space character       */
  15869.    bCell[1] = 0x22;        /* green attribute (EGA) */
  15870.    VioScrollUp(0,          /* top row               */
  15871.        0,                  /* left column           */
  15872.        0xFFFF,             /* bottom row            */
  15873.        0xFFFF,             /* right column          */
  15874.        0xFFFF,             /* number of lines       */
  15875.        bCell,              /* cell to write         */
  15876.        0);                 /* video handle          */
  15877.    VioSetCurPos(0, 0, 0);
  15878.  
  15879.  See Also
  15880.  
  15881.    VioScrollDn, VioScrollLf, VioScrollRt
  15882.  
  15883.  
  15884.  ────────────────────────────────────────────────────────────────────────────
  15885.  VioScrUnLock
  15886.  ────────────────────────────────────────────────────────────────────────────
  15887.    USHORT VioScrUnLock (hvio)
  15888.    HVIO hvio;              /*video handle                                  */
  15889.  
  15890.    The VioScrUnLock function unlocks the screen previously locked by the
  15891.    process.
  15892.  
  15893.    The VioScrUnLock function is a family API function.
  15894.  
  15895.  Parameters
  15896.  
  15897.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  15898.    space. For AVIO programs, this handle must have been created previously
  15899.    using the VioCreatePS function. For other programs, hvio must be NULL.
  15900.  
  15901.  Return Value
  15902.  
  15903.    The return value is zero if the function is successful. Otherwise, it is
  15904.    an error value, which may be one of the following:
  15905.  
  15906.          ERROR_VIO_INVALID_HANDLE
  15907.          ERROR_VIO_UNLOCK
  15908.  
  15909.  Example
  15910.  
  15911.    This example calls the VioScrLock function to lock the screen, then calls
  15912.    VioScrUnLock to unlock the screen:
  15913.  
  15914.    USHORT fNotLocked;
  15915.    VioScrLock(LOCKIO_WAIT, &fNotLocked, 0);
  15916.        .
  15917.        .
  15918.        .
  15919.    VioScrUnLock(0);
  15920.  
  15921.  See Also
  15922.  
  15923.    VioScrLock
  15924.  
  15925.  
  15926.  ────────────────────────────────────────────────────────────────────────────
  15927.  VioSetAnsi
  15928.  ────────────────────────────────────────────────────────────────────────────
  15929.    USHORT VioSetAnsi (fAnsi, hvio)
  15930.    USHORT fAnsi;           /*ANSI flag                                     */
  15931.    HVIO hvio;              /*video handle                                  */
  15932.  
  15933.    The VioSetAnsi function enables or disables processing of ANSI escape
  15934.    sequences by setting or clearing the ANSI flag, which specifies whether
  15935.    the VioWrtTTY function processes ANSI escape sequences.
  15936.  
  15937.    When a screen group is started, ANSI processing is enabled for the screen
  15938.    group.
  15939.  
  15940.  Parameters
  15941.  
  15942.    fAnsi  Specifies the ANSI flag, which determines whether ANSI processing
  15943.    is enabled or disabled. If this flag is ANSI_ON, ANSI processing is
  15944.    enabled. If the flag is ANSI_OFF, ANSI processing is disabled.
  15945.  
  15946.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  15947.    space. For AVIO programs, this handle must have been created previously
  15948.    using the VioCreatePS function. For other programs, hvio must be NULL.
  15949.  
  15950.  Return Value
  15951.  
  15952.    The return value is zero if the function is successful. Otherwise, it is
  15953.    an error value, which may be the following:
  15954.  
  15955.          ERROR_VIO_INVALID_HANDLE
  15956.  
  15957.  Example
  15958.  
  15959.    This example displays two identical strings. Before the first string is
  15960.    displayed, VioSetAnsi disables ANSI processing. As a result, the VioWrtTTY
  15961.    function displays the ANSI escape sequences as characters. Before
  15962.    VioWrtTTY displays the second string, VioSetAnsi enables ANSI processing,
  15963.    and the string is displayed in inverse video (black characters on a white
  15964.    background):
  15965.  
  15966.    VioSetAnsi(ANSI_OFF, 0);     /* disables ANSI processing */
  15967.    VioWrtTTY("\33[7mHello World\33[0m\n\r", 21, 0);
  15968.    VioSetAnsi(ANSI_ON, 0);         /* enables ANSI processing  */
  15969.    VioWrtTTY("\33[7mHello World\33[0m\n\r", 21, 0);
  15970.  
  15971.  See Also
  15972.  
  15973.    VioGetAnsi
  15974.  
  15975.  
  15976.  ────────────────────────────────────────────────────────────────────────────
  15977.  VioSetCp
  15978.  ────────────────────────────────────────────────────────────────────────────
  15979.    USHORT VioSetCp (usReserved, idCodePage, hvio)
  15980.    USHORT usReserved;      /*must be zero                                  */
  15981.    USHORT idCodePage;      /*code-page identifier                          */
  15982.    HVIO hvio;              /*video handle                                  */
  15983.  
  15984.    The VioSetCp function sets the code page for the current screen group. The
  15985.    code page defines the character set used to display characters on the
  15986.    screen.
  15987.  
  15988.  Parameters
  15989.  
  15990.    usReserved  Specifies a reserved value; must be zero.
  15991.  
  15992.    idCodePage  Specifies the code-page identifier. This parameter can be any
  15993.    code-page identifier specified in the codepage command line in the
  15994.    config.sys file. If this parameter is 0x0000, the function uses the system
  15995.    default code page. The following are the valid code-page numbers:
  15996.  
  15997.    Number        Code page
  15998.    ──────────────────────────────────────────────────────────────────────────
  15999.    437           United States
  16000.  
  16001.    850           Multilingual
  16002.  
  16003.    860           Portuguese
  16004.  
  16005.    863           French-Canadian
  16006.  
  16007.    865           Nordic
  16008.    ──────────────────────────────────────────────────────────────────────────
  16009.  
  16010.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  16011.    space. For AVIO programs, this handle must have been created previously
  16012.    using the VioCreatePS function. For other programs, hvio must be NULL.
  16013.  
  16014.  Return Value
  16015.  
  16016.    The return value is zero if the function is successful. Otherwise, it is
  16017.    an error value, which may be one of the following:
  16018.  
  16019.          ERROR_VIO_BAD_CP
  16020.          ERROR_VIO_INVALID_HANDLE
  16021.  
  16022.  Example
  16023.  
  16024.    This example calls VioSetCp to set the current system code page to the
  16025.    standard United States code page:
  16026.  
  16027.    if (VioSetCp(0,       /* must be zero         */
  16028.            437,          /* code-page identifier */
  16029.            0)) {         /* video handle         */
  16030.        VioWrtTTY("Code page not specified in CONFIG.SYS\n\r", 39, 0);
  16031.  
  16032.  See Also
  16033.  
  16034.    DosSetCp, VioGetCp
  16035.  
  16036.  
  16037.  ────────────────────────────────────────────────────────────────────────────
  16038.  VioSetCurPos
  16039.  ────────────────────────────────────────────────────────────────────────────
  16040.    USHORT VioSetCurPos (usRow, usColumn, hvio)
  16041.    USHORT usRow;           /*row position                                  */
  16042.    USHORT usColumn;        /*column position                               */
  16043.    HVIO hvio;              /*video handle                                  */
  16044.  
  16045.    The VioSetCurPos function sets the screen position of the cursor.
  16046.  
  16047.    The VioSetCurPos function is a family API function.
  16048.  
  16049.  Parameters
  16050.  
  16051.    usRow  Specifies the row position of the cursor, where zero is the top
  16052.    row.
  16053.  
  16054.    usColumn  Specifies the column position of the cursor, where zero is the
  16055.    leftmost column.
  16056.  
  16057.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  16058.    space. For AVIO programs, this handle must have been created previously
  16059.    using the VioCreatePS function. For other programs, hvio must be NULL.
  16060.  
  16061.  Return Value
  16062.  
  16063.    The return value is zero if the function is successful. Otherwise, it is
  16064.    an error value, which may be one of the following:
  16065.  
  16066.          ERROR_VIO_COL
  16067.          ERROR_VIO_INVALID_HANDLE
  16068.          ERROR_VIO_ROW
  16069.  
  16070.  Example
  16071.  
  16072.    This example calls VioSetCurPos to place the cursor in the first column of
  16073.    the last row on the screen, and then displays the text "Hello World!":
  16074.  
  16075.    VioSetCurPos(24,                 /* cursor row    */
  16076.        0,                           /* cursor column */
  16077.        0);                          /* video handle  */
  16078.    VioWrtTTY("Hello World!", 12, 0);
  16079.  
  16080.  See Also
  16081.  
  16082.    VioGetCurPos, VioSetCurType
  16083.  
  16084.  
  16085.  ────────────────────────────────────────────────────────────────────────────
  16086.  VioSetCurType
  16087.  ────────────────────────────────────────────────────────────────────────────
  16088.    USHORT VioSetCurType (pvioci, hvio)
  16089.    PVIOCURSORINFO pvioci;  /*pointer to structure for cursor               */
  16090.                            /*characteristics                               */
  16091.    HVIO hvio;              /*video handle                                  */
  16092.  
  16093.    The VioSetCurType function sets the cursor type.
  16094.  
  16095.    The cursor is a shared resource for all processes in a screen group. If
  16096.    one process changes it, it is changed for all processes in the group.
  16097.  
  16098.    The VioSetCurType function is a family API function.
  16099.  
  16100.  Parameters
  16101.  
  16102.    pvioci  Points to the VIOCURSORINFO structure that specifies the
  16103.    characteristics of the cursor. The VIOCURSORINFO structure has the
  16104.    following form:
  16105.  
  16106.    typedef struct _VIOCURSORINFO {
  16107.        USHORT yStart;
  16108.        USHORT cEnd;
  16109.        USHORT cx;
  16110.        USHORT attr;
  16111.    } VIOCURSORINFO;
  16112.  
  16113.    For a full description, see Chapter 4, "Types, Macros, Structures."
  16114.  
  16115.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  16116.    space. For AVIO programs, this handle must have been created previously
  16117.    using the VioCreatePS function. For other programs, hvio must be NULL.
  16118.  
  16119.  Return Value
  16120.  
  16121.    The return value is zero if the function is successful. Otherwise, it is
  16122.    an error value, which may be one of the following:
  16123.  
  16124.          ERROR_VIO_INVALID_HANDLE
  16125.          ERROR_VIO_WIDTH
  16126.  
  16127.  Example
  16128.  
  16129.    This example calls VioSetCurType to set the current cursor type to a block
  16130.    cursor with 14 scan lines:
  16131.  
  16132.    VIOCURSORINFO vioci;
  16133.    vioci.yStart = 0;      /* beginning scan line for cursor */
  16134.    vioci.cEnd = 13;       /* ending scan line, zero-based   */
  16135.    vioci.cx = 0;          /* default width, one character   */
  16136.    vioci.attr = 0;        /* normal attribute               */
  16137.    VioSetCurType(&vioci, 0);
  16138.  
  16139.  See Also
  16140.  
  16141.    VioGetCurType, VioSetCurPos
  16142.  
  16143.  
  16144.  ────────────────────────────────────────────────────────────────────────────
  16145.  VioSetDeviceCellSize
  16146.  ────────────────────────────────────────────────────────────────────────────
  16147.    USHORT VioSetDeviceCellSize (cRows, cColumns, hvps)
  16148.    SHORT cRows;            /*cell height                                   */
  16149.    SHORT cColumns;         /*cell width                                    */
  16150.    HVPS hvps;              /*presentation-space handle                     */
  16151.  
  16152.    The VioSetDeviceCellSize function sets the size of the device character
  16153.    cell.
  16154.  
  16155.  Parameters
  16156.  
  16157.    cRows  Specifies the height (in pels) of the character cell.
  16158.  
  16159.    cColumns  Specifies the width (in pels) of the character cell.
  16160.  
  16161.    hvps  Identifies the advanced video-input-and-output (AVIO) presentation
  16162.    space. This handle must have been created previously by using the
  16163.    VioCreatePS function.
  16164.  
  16165.  Return Value
  16166.  
  16167.    The return value is zero if the function is successful. Otherwise, it is
  16168.    an error value.
  16169.  
  16170.  See Also
  16171.  
  16172.    VioCreatePS, VioGetDeviceCellSize
  16173.  
  16174.  
  16175.  ────────────────────────────────────────────────────────────────────────────
  16176.  VioSetFont
  16177.  ────────────────────────────────────────────────────────────────────────────
  16178.    USHORT VioSetFont (pviofi, hvio)
  16179.    PVIOFONTINFO pviofi;    /*pointer to structure for display font         */
  16180.    HVIO hvio;              /*video handle                                  */
  16181.  
  16182.    The VioSetFont function sets the font used to display characters on the
  16183.    screen. A font consists of several bitmaps, one for each character in a
  16184.    character set. The bitmaps define the character shapes. The font must be
  16185.    compatible with the current screen mode; that is, the bitmap size must
  16186.    match the current character-cell size.
  16187.  
  16188.    The VioSetFont function resets the current code page. A subsequent call to
  16189.    the VioGetCp function returns an error value.
  16190.  
  16191.    Not all display adapters permit the font to be set.
  16192.  
  16193.  Parameters
  16194.  
  16195.    pviofi  Points to the VIOFONTINFO structure that specifies the display
  16196.    font. The VIOFONTINFO structure has the following form:
  16197.  
  16198.    typedef struct _VIOFONTINFO {
  16199.        USHORT cb;
  16200.        USHORT type;
  16201.        USHORT cxCell;
  16202.        USHORT cyCell;
  16203.        ULONG  pbData;
  16204.        USHORT cbData;
  16205.    } VIOFONTINFO;
  16206.  
  16207.    For a full description, see Chapter 4, "Types, Macros, Structures."
  16208.  
  16209.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  16210.    space. For AVIO programs, this handle must have been created previously
  16211.    using the VioCreatePS function. For other programs, hvio must be NULL.
  16212.  
  16213.  Return Value
  16214.  
  16215.    The return value is zero if the function is successful. Otherwise, it is
  16216.    an error value, which may be the following:
  16217.  
  16218.          ERROR_VIO_INVALID_LENGTH
  16219.  
  16220.  See Also
  16221.  
  16222.    VioGetCp, VioGetFont
  16223.  
  16224.  
  16225.  ────────────────────────────────────────────────────────────────────────────
  16226.  VioSetMode
  16227.  ────────────────────────────────────────────────────────────────────────────
  16228.    USHORT VioSetMode (pviomi, hvio)
  16229.    PVIOMODEINFO pviomi;    /*pointer to structure for screen mode          */
  16230.    HVIO hvio;              /*video handle                                  */
  16231.  
  16232.    The VioSetMode function sets the screen mode. The screen mode defines the
  16233.    display mode (text or graphics), the number of colors being used (2, 4, or
  16234.    16), and the width and height of the screen in both character cells and
  16235.    pels. VioSetMode also initializes the cursor position and type, but does
  16236.    not clear the screen.
  16237.  
  16238.    The VioSetMode function is a family API function.
  16239.  
  16240.  Parameters
  16241.  
  16242.    pviomi  Points to the VIOMODEINFO structure that specifies the screen
  16243.    mode. The VIOMODEINFO structure has the following form:
  16244.  
  16245.    typedef struct _VIOMODEINFO {
  16246.        USHORT cb;
  16247.        UCHAR  fbType;
  16248.        UCHAR  color;
  16249.        USHORT col;
  16250.        USHORT row;
  16251.        USHORT hres;
  16252.        USHORT vres;
  16253.    } VIOMODEINFO;
  16254.  
  16255.    For a full description, see Chapter 4, "Types, Macros, Structures."
  16256.  
  16257.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  16258.    space. For AVIO programs, this handle must have been created previously
  16259.    using the VioCreatePS function. For other programs, hvio must be NULL.
  16260.  
  16261.  Return Value
  16262.  
  16263.    The return value is zero if the function is successful. Otherwise, it is
  16264.    an error value, which may be one of the following:
  16265.  
  16266.          ERROR_VIO_INVALID_HANDLE
  16267.          ERROR_VIO_INVALID_LENGTH
  16268.          ERROR_VIO_MODE
  16269.  
  16270.  Comments
  16271.  
  16272.    Not all screen-mode values are valid for all displays.
  16273.  
  16274.  Example
  16275.  
  16276.    This example calls the VioGetMode function to retrieve the current display
  16277.    mode, changes the mode, and calls VioSetMode to enable the new display
  16278.    mode.
  16279.  
  16280.    VIOMODEINFO viomi;
  16281.    viomi.cb = sizeof(viomi);
  16282.    VioGetMode(&viomi, 0);
  16283.    if (viomi.vres > 350)                          /* VGA display */
  16284.        viomi.row = (viomi.row == 50) ? 25 : 50;
  16285.    else                                           /* EGA display */
  16286.        viomi.row = (viomi.row == 43) ? 25 : 43;
  16287.    VioSetMode(&viomi, 0);
  16288.  
  16289.  See Also
  16290.  
  16291.    VioGetMode, VioSetState
  16292.  
  16293.  
  16294.  ────────────────────────────────────────────────────────────────────────────
  16295.  VioSetOrg
  16296.  ────────────────────────────────────────────────────────────────────────────
  16297.    USHORT VioSetOrg (sRow, sColumn, hvps)
  16298.    SHORT sRow;             /*row number of cell                            */
  16299.    SHORT sColumn;          /*column number of cell                         */
  16300.    HVPS hvps;              /*presentation-space handle                     */
  16301.  
  16302.    The VioSetOrg function sets the origin for an advanced
  16303.    video-input-and-output (AVIO) presentation space. It moves the specified
  16304.    character cell to the upper-left corner of the screen.
  16305.  
  16306.  Parameters
  16307.  
  16308.    sRow  Specifies the row number of the character cell that is to be the
  16309.    origin.
  16310.  
  16311.    sColumn  Specifies the column number of the character cell that is to be
  16312.    the origin.
  16313.  
  16314.    hvps  Identifies the AVIO presentation space. This handle must have been
  16315.    created previously by using the VioCreatePS function.
  16316.  
  16317.  Return Value
  16318.  
  16319.    The return value is zero if the function is successful. Otherwise, it is
  16320.    an error value.
  16321.  
  16322.  See Also
  16323.  
  16324.    VioCreatePS, VioGetOrg
  16325.  
  16326.  
  16327.  ────────────────────────────────────────────────────────────────────────────
  16328.  VioSetState
  16329.  ────────────────────────────────────────────────────────────────────────────
  16330.    USHORT VioSetState (pvoidState, hvio)
  16331.    PVOID pvoidState;       /*pointer to buffer with new state              */
  16332.    HVIO hvio;              /*video handle                                  */
  16333.  
  16334.    The VioSetState function sets the palette-register values, the overscan
  16335.    (border) color, or the blink/background intensity switch.
  16336.  
  16337.  Parameters
  16338.  
  16339.    pvoidState  Points to the structure that contains the request type and the
  16340.    values to set. The structure type, which depends on the request type
  16341.    specified in the type field of each structure, is one of the following:
  16342.    VIOPALSTATE, VIOOVERSCAN, or VIOINTENSITY. These structures have the
  16343.    following forms:
  16344.  
  16345.    typedef struct _VIOPALSTATE {
  16346.        USHORT cb;
  16347.        USHORT type;
  16348.        USHORT iFirst;
  16349.        USHORT acolor[1];
  16350.    } VIOPALSTATE;
  16351.  
  16352.    typedef struct _VIOOVERSCAN {
  16353.        USHORT cb;
  16354.        USHORT type;
  16355.        USHORT color;
  16356.    } VIOOVERSCAN;
  16357.  
  16358.    typedef struct _VIOINTENSITY {
  16359.        USHORT cb;
  16360.        USHORT type;
  16361.        USHORT fs;
  16362.    } VIOINTENSITY;
  16363.  
  16364.    Not all request-type values are valid for all screen modes.
  16365.  
  16366.    For a full description, see Chapter 4, "Types, Macros, Structures."
  16367.  
  16368.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  16369.    space. For AVIO programs, this handle must have been created previously
  16370.    using the VioCreatePS function. For other programs, hvio must be NULL.
  16371.  
  16372.  Return Value
  16373.  
  16374.    The return value is zero if the function is successful. Otherwise, it is
  16375.    an error value.
  16376.  
  16377.  Example
  16378.  
  16379.    This example retrieves the current settings of the palette registers,
  16380.    switches palette registers #0 and #7, and calls VioSetState to enable the
  16381.    new settings:
  16382.  
  16383.    BYTE abState[38];
  16384.    PVIOPALSTATE pviopal;
  16385.    USHORT usTmp;
  16386.    pviopal = (PVIOPALSTATE) abState;
  16387.    pviopal->cb = sizeof(abState);
  16388.    pviopal->type = 0;             /* retrieves palette registers */
  16389.    pviopal->iFirst = 0;           /* first register to retrieve  */
  16390.    VioGetState(pviopal, 0);       /* retrieves current settings  */
  16391.    usTmp = pviopal->acolor[0];    /* swaps# 0 and# 7             */
  16392.    pviopal->acolor[0] = pviopal->acolor[7];
  16393.    pviopal->acolor[7] = usTmp;
  16394.    VioSetState(pviopal, 0);       /* enables new settings        */
  16395.  
  16396.  See Also
  16397.  
  16398.    VioGetState, VioSetMode
  16399.  
  16400.  
  16401.  ────────────────────────────────────────────────────────────────────────────
  16402.  VioShowBuf
  16403.  ────────────────────────────────────────────────────────────────────────────
  16404.    USHORT VioShowBuf (offLVB, cbOutput, hvio)
  16405.    USHORT offLVB;          /*offset into logical video buffer              */
  16406.    USHORT cbOutput;        /*length                                        */
  16407.    HVIO hvio;              /*video handle                                  */
  16408.  
  16409.    The VioShowBuf function updates the physical screen from the logical video
  16410.    buffer (LVB). You may use the logical video buffer to directly manipulate
  16411.    information displayed on the screen.
  16412.  
  16413.    The VioShowBuf function is a family API function.
  16414.  
  16415.  Parameters
  16416.  
  16417.    offLVB  Specifies the offset into the logical video buffer at which the
  16418.    screen update is to start.
  16419.  
  16420.    cbOutput  Specifies the length (in bytes) of the screen area to update.
  16421.  
  16422.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  16423.    space. For AVIO programs, this handle must have been created previously
  16424.    using the VioCreatePS function. For other programs, hvio must be NULL.
  16425.  
  16426.  Return Value
  16427.  
  16428.    The return value is zero if the function is successful. Otherwise, it is
  16429.    an error value, which may be the following:
  16430.  
  16431.          ERROR_VIO_INVALID_HANDLE
  16432.  
  16433.  Example
  16434.  
  16435.    This example retrieves the address of the logical video buffer, makes
  16436.    changes to that buffer, and calls VioShowBuf to update the physical video
  16437.    buffer from the logical video buffer:
  16438.  
  16439.    PBYTE pbLVB;
  16440.    USHORT cbOutput;
  16441.    VioGetBuf((PULONG) &pbLVB, &cbOutput, 0);
  16442.        .
  16443.        .
  16444.        .
  16445.    VioShowBuf(0,         /* offset into logical video buffer */
  16446.        cbOutput,         /* length of screen area            */
  16447.        0);               /* video handle                     */
  16448.  
  16449.  See Also
  16450.  
  16451.    VioGetBuf, VioGetPhysBuf
  16452.  
  16453.  
  16454.  ────────────────────────────────────────────────────────────────────────────
  16455.  VioShowPS
  16456.  ────────────────────────────────────────────────────────────────────────────
  16457.    USHORT VioShowPS (cRows, cColumns, off, hvps)
  16458.    SHORT cRows;            /*height of rectangle                           */
  16459.    SHORT cColumns;         /*width of rectangle                            */
  16460.    SHORT off;              /*upper-left corner of rectangle                */
  16461.    HVPS hvps;              /*presentation-space handle                     */
  16462.  
  16463.    The VioShowPS function updates the display by copying all the latest
  16464.    changes in the specified rectangle to the display.
  16465.  
  16466.  Parameters
  16467.  
  16468.    cRows  Specifies the height (in character cells) of the rectangle to
  16469.    update.
  16470.  
  16471.    cColumns  Specifies the width (in character cells) of the rectangle to
  16472.    update.
  16473.  
  16474.    off  Specifies the position of the upper-left corner of the rectangle to
  16475.    update. The position is relative to the first character cell in the
  16476.    advanced video-input-and-output (AVIO) presentation space.
  16477.  
  16478.    hvps  Identifies the AVIO presentation space. This handle must have been
  16479.    created previously by using the VioCreatePS function.
  16480.  
  16481.  Return Value
  16482.  
  16483.    The return value is zero if the function is successful. Otherwise, it is
  16484.    an error value.
  16485.  
  16486.  See Also
  16487.  
  16488.    VioCreatePS
  16489.  
  16490.  
  16491.  ────────────────────────────────────────────────────────────────────────────
  16492.  VioWrtCellStr
  16493.  ────────────────────────────────────────────────────────────────────────────
  16494.    USHORT VioWrtCellStr (pchCellString, cbCellString, usRow, usColumn, hvio)
  16495.    PCH pchCellString;      /*pointer to cell string                        */
  16496.    USHORT cbCellString;    /*length of string                              */
  16497.    USHORT usRow;           /*starting position (row)                       */
  16498.    USHORT usColumn;        /*starting position (column)                    */
  16499.    HVIO hvio;              /*video handle                                  */
  16500.  
  16501.    The VioWrtCellStr function writes a cell string to the screen. A cell
  16502.    string is one or more character/attribute pairs. A character/attribute
  16503.    pair defines the character to be written and the character attribute by
  16504.    which it is displayed.
  16505.  
  16506.    If the string is longer than the current line, the function continues
  16507.    writing it at the beginning of the next line, but does not write past the
  16508.    end of the screen.
  16509.  
  16510.    The VioWrtCellStr function is a family API function.
  16511.  
  16512.  Parameters
  16513.  
  16514.    pchCellString  Points to the cell string to write.
  16515.  
  16516.    cbCellString  Specifies the length (in bytes) of the cell string. The
  16517.    length should be an even number.
  16518.  
  16519.    usRow  Specifies the row at which to start writing the cell string.
  16520.  
  16521.    usColumn  Specifies the column at which to start writing the cell string.
  16522.  
  16523.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  16524.    space. For AVIO programs, this handle must have been created previously
  16525.    using the VioCreatePS function. For other programs, hvio must be NULL.
  16526.  
  16527.  Return Value
  16528.  
  16529.    The return value is zero if the function is successful. Otherwise, it is
  16530.    an error value, which may be one of the following:
  16531.  
  16532.          ERROR_VIO_COL
  16533.          ERROR_VIO_INVALID_HANDLE
  16534.          ERROR_VIO_ROW
  16535.  
  16536.  Example
  16537.  
  16538.    This example calls the VioWrtCellStr function to display the string "Hello
  16539.    World!" using 12 different attributes:
  16540.  
  16541.    CHAR achCellString[] = "H\1e\2l\3l\4o\5 \6W\7o\10r\11l\13d\14!";
  16542.        .
  16543.        .
  16544.        .
  16545.    VioWrtCellStr(achCellString,      /* character/attribute string */
  16546.        sizeof(achCellString),        /* length of string           */
  16547.        10,                           /* row                        */
  16548.        35,                           /* column                     */
  16549.        0);                           /* video handle               */
  16550.  
  16551.  See Also
  16552.  
  16553.    VioReadCellStr, VioWrtCharStr, VioWrtTTY
  16554.  
  16555.  
  16556.  ────────────────────────────────────────────────────────────────────────────
  16557.  VioWrtCharStr
  16558.  ────────────────────────────────────────────────────────────────────────────
  16559.    USHORT VioWrtCharStr (pchString, cbString, usRow, usColumn, hvio)
  16560.    PCH pchString;          /*pointer to string to write                    */
  16561.    USHORT cbString;        /*length of character string                    */
  16562.    USHORT usRow;           /*starting position (row)                       */
  16563.    USHORT usColumn;        /*starting position (column)                    */
  16564.    HVIO hvio;              /*video handle                                  */
  16565.  
  16566.    The VioWrtCharStr function writes a character string to the screen. A
  16567.    character string contains one or more character values, but no attributes.
  16568.    The function uses the present screen attributes to display the new
  16569.    characters. If the string is longer than the current line, the function
  16570.    continues writing it at the beginning of the next line but does not write
  16571.    past the end of the screen.
  16572.  
  16573.    The VioWrtCharStr function is a family API function.
  16574.  
  16575.  Parameters
  16576.  
  16577.    pchString  Points to the character string to write.
  16578.  
  16579.    cbString  Specifies the length (in bytes) of the character string.
  16580.  
  16581.    usRow  Specifies the row at which to start writing the string.
  16582.  
  16583.    usColumn  Specifies the column at which to start writing the string.
  16584.  
  16585.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  16586.    space. For AVIO programs, this handle must have been created previously
  16587.    using the VioCreatePS function. For other programs, hvio must be NULL.
  16588.  
  16589.  Return Value
  16590.  
  16591.    The return value is zero if the function is successful. Otherwise, it is
  16592.    an error value, which may be one of the following:
  16593.  
  16594.          ERROR_VIO_COL
  16595.          ERROR_VIO_INVALID_HANDLE
  16596.          ERROR_VIO_ROW
  16597.  
  16598.  Example
  16599.  
  16600.    This example calls VioWrtCharStr to display the string "Hello World!" on
  16601.    the screen at Row 12, Column 30:
  16602.  
  16603.    VioWrtCharStr("Hello World!",    /* string to display */
  16604.        12,                          /* length of string  */
  16605.        12,                          /* row               */
  16606.        30,                          /* column            */
  16607.        0);                          /* video handle      */
  16608.  
  16609.  See Also
  16610.  
  16611.    VioReadCharStr, VioWrtCharStr, VioWrtTTY
  16612.  
  16613.  
  16614.  ────────────────────────────────────────────────────────────────────────────
  16615.  VioWrtCharStrAtt
  16616.  ────────────────────────────────────────────────────────────────────────────
  16617.    USHORT VioWrtCharStrAtt (pchString, cbString, usRow, usColumn, pbAttr,
  16618.    hvio)
  16619.    PCH pchString;          /*pointer to string to write                    */
  16620.    USHORT cbString;        /*length of string                              */
  16621.    USHORT usRow;           /*starting position (row)                       */
  16622.    USHORT usColumn;        /*starting position (column)                    */
  16623.    PBYTE pbAttr;           /*pointer to attribute                          */
  16624.    HVIO hvio;              /*video handle                                  */
  16625.  
  16626.    The VioWrtCharStrAtt function writes a character string to the screen,
  16627.    using the specified attribute. If the string is longer than the current
  16628.    line, the function continues writing it at the beginning of the next line
  16629.    but does not write past the end of the screen.
  16630.  
  16631.    The VioWrtCharStrAtt function is a family API function.
  16632.  
  16633.  Parameters
  16634.  
  16635.    pchString  Points to the character string to write.
  16636.  
  16637.    cbString  Specifies the length (in bytes) of the character string.
  16638.  
  16639.    usRow  Specifies the row at which to start writing the string.
  16640.  
  16641.    usColumn  Specifies the column at which to start writing the string.
  16642.  
  16643.    pbAttr  Points to the variable that specifies the attribute to be used for
  16644.    each character in the string.
  16645.  
  16646.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  16647.    space. For AVIO programs, this handle must have been created previously
  16648.    using the VioCreatePS function. For other programs, hvio must be NULL.
  16649.  
  16650.  Return Value
  16651.  
  16652.    The return value is zero if the function is successful. Otherwise, it is
  16653.    an error value, which may be one of the following:
  16654.  
  16655.          ERROR_VIO_COL
  16656.          ERROR_VIO_INVALID_HANDLE
  16657.          ERROR_VIO_ROW
  16658.  
  16659.  Example
  16660.  
  16661.    This example calls VioWrtCharStrAtt to display the string "Hello World!"
  16662.    in the center of the screen in green characters on a white background (on
  16663.    an EGA color monitor):
  16664.  
  16665.    BYTE bhAttr = 0x72;        /* green character, white background */
  16666.    VioWrtCharStrAtt("Hello World!",        /* string to display    */
  16667.         12,                                /* length of string     */
  16668.         12,                                /* row                  */
  16669.         35,                                /* column               */
  16670.         &bhAttr,                           /* address of attribute */
  16671.         0);                                /* video handle         */
  16672.  
  16673.  See Also
  16674.  
  16675.    VioWrtCharStr, VioWrtNAttr, VioWrtTTY
  16676.  
  16677.  
  16678.  ────────────────────────────────────────────────────────────────────────────
  16679.  VioWrtNAttr
  16680.  ────────────────────────────────────────────────────────────────────────────
  16681.    USHORT VioWrtNAttr (pbAttr, cb, usRow, usColumn, hvio)
  16682.    PBYTE pbAttr;           /*pointer to attribute to write                 */
  16683.    USHORT cb;              /*number of times to write                      */
  16684.    USHORT usRow;           /*starting position (row)                       */
  16685.    USHORT usColumn;        /*starting position (column)                    */
  16686.    HVIO hvio;              /*video handle                                  */
  16687.  
  16688.    The VioWrtNAttr function writes a character attribute to the screen a
  16689.    specified number of times. If the attribute is repeated more times than
  16690.    can fit on the current line, the function continues writing it at the
  16691.    beginning of the next line but does not write past the end of the screen.
  16692.  
  16693.    The VioWrtNAttr function is a family API function.
  16694.  
  16695.  Parameters
  16696.  
  16697.    pbAttr  Points to the variable that specifies the character attribute to
  16698.    write.
  16699.  
  16700.    cb  Specifies the number of times to write the character attribute.
  16701.  
  16702.    usRow  Specifies the row at which to start writing the attribute.
  16703.  
  16704.    usColumn  Specifies the column at which to start writing the attribute.
  16705.  
  16706.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  16707.    space. For AVIO programs, this handle must have been created previously
  16708.    using the VioCreatePS function. For other programs, hvio must be NULL.
  16709.  
  16710.  Return Value
  16711.  
  16712.    The return value is zero if the function is successful. Otherwise, it is
  16713.    an error value, which may be one of the following:
  16714.  
  16715.          ERROR_VIO_COL
  16716.          ERROR_VIO_INVALID_HANDLE
  16717.          ERROR_VIO_ROW
  16718.  
  16719.  Example
  16720.  
  16721.    This example calls VioWrtNAttr to change all the character attributes on
  16722.    the screen to green letters on a black background (on an EGA color
  16723.    monitor):
  16724.  
  16725.    BYTE bAttr = 0x02;       /* green character, black background  */
  16726.    VioWrtNAttr(&bAttr,      /* address of attribute               */
  16727.        25 * 80,             /* number of times to write attribute */
  16728.        0,                   /* row                                */
  16729.        0,                   /* column                             */
  16730.        0);                  /* video handle                       */
  16731.  
  16732.  See Also
  16733.  
  16734.    VioWrtCharStrAtt, VioWrtNCell
  16735.  
  16736.  
  16737.  ────────────────────────────────────────────────────────────────────────────
  16738.  VioWrtNCell
  16739.  ────────────────────────────────────────────────────────────────────────────
  16740.    USHORT VioWrtNCell (pbCell, cb, usRow, usColumn, hvio)
  16741.    PBYTE pbCell;           /*pointer to cell to write                      */
  16742.    USHORT cb;              /*number of times to write                      */
  16743.    USHORT usRow;           /*starting position (row)                       */
  16744.    USHORT usColumn;        /*starting position (column)                    */
  16745.    HVIO hvio;              /*video handle                                  */
  16746.  
  16747.    The VioWrtNCell function writes a cell to the screen a specified number of
  16748.    times. A cell (also called a character/attribute pair) consists of two
  16749.    unsigned byte values that specify the character and attribute to be
  16750.    written.
  16751.  
  16752.    If the number of times that a cell is repeated is greater than the screen
  16753.    width, the VioWrtNCell function continues writing the cell at the
  16754.    beginning of the next line but does not write past the end of the screen.
  16755.  
  16756.    The VioWrtNCell function is a family API function.
  16757.  
  16758.  Parameters
  16759.  
  16760.    pbCell  Points to the cell to write.
  16761.  
  16762.    cb  Specifies the number of times to write the cell.
  16763.  
  16764.    usRow  Specifies the row at which to start writing the cell.
  16765.  
  16766.    usColumn  Specifies the column at which to start writing the cell.
  16767.  
  16768.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  16769.    space. For AVIO programs, this handle must have been created previously
  16770.    using the VioCreatePS function. For other programs, hvio must be NULL.
  16771.  
  16772.  Return Value
  16773.  
  16774.    The return value is zero if the function is successful. Otherwise, it is
  16775.    an error value, which may be one of the following:
  16776.  
  16777.          ERROR_VIO_COL
  16778.          ERROR_VIO_INVALID_HANDLE
  16779.          ERROR_VIO_ROW
  16780.  
  16781.  Example
  16782.  
  16783.    This example calls the VioWrtNCell function to fill the screen with green
  16784.    capital letter A's (on an EGA color monitor):
  16785.  
  16786.    BYTE abCell[2];        /* character/attribute pair */
  16787.    abCell[0] = 'A';       /* character (letter A)     */
  16788.    abCell[1] = 0x02;      /* attribute (green)        */
  16789.    VioWrtNCell(abCell,    /* address of attribute     */
  16790.        80 * 25,           /* number of cells to write */
  16791.        0,                 /* row                      */
  16792.        0,                 /* column                   */
  16793.        0);                /* video handle             */
  16794.  
  16795.  See Also
  16796.  
  16797.    VioWrtNChar
  16798.  
  16799.  
  16800.  ────────────────────────────────────────────────────────────────────────────
  16801.  VioWrtNChar
  16802.  ────────────────────────────────────────────────────────────────────────────
  16803.    USHORT VioWrtNChar (pchChar, cb, usRow, usColumn, hvio)
  16804.    PCH pchChar;            /*pointer to character to write                 */
  16805.    USHORT cb;              /*number of times to write                      */
  16806.    USHORT usRow;           /*starting position (row)                       */
  16807.    USHORT usColumn;        /*starting position (column)                    */
  16808.    HVIO hvio;              /*video handle                                  */
  16809.  
  16810.    The VioWrtNChar function writes a character to the screen a specified
  16811.    number of times. The function uses the present screen character attribute
  16812.    to display the new character.
  16813.  
  16814.    If the character is repeated more times than can fit on the current line,
  16815.    the VioWrtNChar function continues writing it at the beginning of the next
  16816.    line but does not write past the end of the screen.
  16817.  
  16818.    The VioWrtNChar function is a family API function.
  16819.  
  16820.  Parameters
  16821.  
  16822.    pchChar  Points to the character to write.
  16823.  
  16824.    cb  Specifies the number of times to write the character.
  16825.  
  16826.    usRow  Specifies the row at which to start writing the character.
  16827.  
  16828.    usColumn  Specifies the column at which to start writing the character.
  16829.  
  16830.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  16831.    space. For AVIO programs, this handle must have been created previously
  16832.    using the VioCreatePS function. For other programs, hvio must be NULL.
  16833.  
  16834.  Return Value
  16835.  
  16836.    The return value is zero if the function is successful. Otherwise, it is
  16837.    an error value, which may be one of the following:
  16838.  
  16839.          ERROR_VIO_COL
  16840.          ERROR_VIO_INVALID_HANDLE
  16841.          ERROR_VIO_ROW
  16842.  
  16843.  Example
  16844.  
  16845.    This example calls the VioWrtNChar function to fill the screen with
  16846.    capital letter A's:
  16847.  
  16848.    VioWrtNChar("A",    /* address of character          */
  16849.        80 * 25,        /* number of characters to write */
  16850.        0,              /* row                           */
  16851.        0,              /* column                        */
  16852.        0);             /* video handle                  */
  16853.  
  16854.  See Also
  16855.  
  16856.    VioWrtNCell
  16857.  
  16858.  
  16859.  ────────────────────────────────────────────────────────────────────────────
  16860.  VioWrtTTY
  16861.  ────────────────────────────────────────────────────────────────────────────
  16862.    USHORT VioWrtTTY (pchString, cbString, hvio)
  16863.    PCH pchString;          /*pointer to string to write                    */
  16864.    USHORT cbString;        /*length of string                              */
  16865.    HVIO hvio;              /*video handle                                  */
  16866.  
  16867.    The VioWrtTTY function writes a character string to the screen, starting
  16868.    at the current cursor position. This function advances the cursor as it
  16869.    writes each character, using a default attribute for each character. If
  16870.    the function reaches the end of the line, it continues writing at the
  16871.    beginning of the next line. If it reaches the end of the last line on the
  16872.    screen, it scrolls the screen and continues writing at the beginning of a
  16873.    new line.
  16874.  
  16875.    The VioWrtTTY function is a family API function.
  16876.  
  16877.  Parameters
  16878.  
  16879.    pchString  Points to the character string to write.
  16880.  
  16881.    cbString  Specifies the length (in bytes) of the character string.
  16882.  
  16883.    hvio  Identifies an advanced video-input-and-output (AVIO) presentation
  16884.    space. For AVIO programs, this handle must have been created previously
  16885.    using the VioCreatePS function. For other programs, hvio must be NULL.
  16886.  
  16887.  Return Value
  16888.  
  16889.    The return value is zero if the function is successful. Otherwise, it is
  16890.    an error value, which may be the following:
  16891.  
  16892.          ERROR_VIO_INVALID_HANDLE
  16893.  
  16894.  Comments
  16895.  
  16896.    For some ASCII values, VioWrtTTY carries out an action rather than
  16897.    displaying a character. The following list describes the action taken when
  16898.    the given ASCII byte value is in the string:
  16899.  
  16900.    Value     Meaning
  16901.    ──────────────────────────────────────────────────────────────────────────
  16902.    0x08      BACKSPACE. Move the cursor left by one position, without
  16903.              deleting any character that is under the cursor. If the cursor
  16904.              is at the beginning of the line, take no action.
  16905.  
  16906.    0x09      TAB. Copy spaces from the current cursor position to the
  16907.              next tab stop. Tab stops are placed at every eighth character
  16908.              position on a line.
  16909.  
  16910.    0x0A      LINEFEED. Move the cursor down to the next line. The screen
  16911.              will scroll up one line if the current line is at the bottom of
  16912.              the screen.
  16913.  
  16914.    0x0D      RETURN. Move the cursor to the beginning of the line.
  16915.  
  16916.    0x07      Bell. Generate a beep on the computer's speaker.
  16917.    ──────────────────────────────────────────────────────────────────────────
  16918.  
  16919.    If the process has enabled ANSI processing by using the VioSetAnsi
  16920.    function, VioWrtTTY processes any ANSI escape sequences in the string.
  16921.  
  16922.  Example
  16923.  
  16924.    The following example calls VioWrtTTY to write a message to the screen and
  16925.    beep the computer's speaker:
  16926.  
  16927.    VioWrtTTY("File not found\r\n07", 17, 0);
  16928.  
  16929.  See Also
  16930.  
  16931.    VioSetCurPos, VioWrtCellStr, VioWrtCharStr
  16932.  
  16933.  
  16934.  
  16935.  ────────────────────────────────────────────────────────────────────────────
  16936.  Chapter 3  Input-and-Output Control Functions
  16937.  
  16938.         3.1     Introduction
  16939.         3.2     Category and Function Codes
  16940.         3.3     Functions
  16941.  
  16942.  3.1  Introduction
  16943.  
  16944.    This chapter describes the input-and-output control (IOCtl) functions. A
  16945.    program can send commands to and retrieve data from a device driver by
  16946.    using the DosDevIOCtl function. The DosDevIOCtl function sends the
  16947.    specified codes and data directly to the given device driver, which then
  16948.    carries out the specified action.
  16949.  
  16950.    IOCtl functions typically are used to get information about or data from a
  16951.    device driver that is not available through standard MS OS/2 functions.
  16952.    For example, IOCtl functions can be used to set the baud rate of a serial
  16953.    port or read input from a mouse.
  16954.  
  16955.  
  16956.  3.2  Category and Function Codes
  16957.  
  16958.    Each IOCtl function has a category and a function code. The category code
  16959.    defines the type of device to be accessed. MS OS/2 has several predefined
  16960.    categories. In general, all codes in the range 0x0000 through 0x007F are
  16961.    reserved for predefined categories. A device driver may also use
  16962.    additional categories, but these must be explicitly defined by the device
  16963.    and be in the range 0x0080 through 0x00FF. The following list shows which
  16964.    devices correspond to the given categories:
  16965.  
  16966.    Category  Device
  16967.    ──────────────────────────────────────────────────────────────────────────
  16968.    0x0001    Serial-device control
  16969.  
  16970.    0x0003    Screen/pointer-draw control
  16971.  
  16972.    0x0004    Keyboard control
  16973.  
  16974.    0x0005    Printer control
  16975.  
  16976.    0x0006    Light-pen control (Reserved)
  16977.  
  16978.    0x0007    Pointing-device (mouse) control
  16979.  
  16980.    0x0008    Disk/diskette control
  16981.  
  16982.    0x0009    Physical-disk control
  16983.  
  16984.    0x000A    Character-monitor control
  16985.  
  16986.    0x000B    General device control
  16987.    ──────────────────────────────────────────────────────────────────────────
  16988.  
  16989.    The function code defines the action to carry out, such as reading from or
  16990.    writing to the device and retrieving or setting the device modes. The
  16991.    number and meaning of each function code depend on the device driver and
  16992.    the specified category. Function codes range from 0x0000 through 0x001F
  16993.    and are combined with one or more of the following values:
  16994.  
  16995.    Value     Meaning
  16996.    ──────────────────────────────────────────────────────────────────────────
  16997.    0x0020    Retrieve data or information from the device. If 0x0020 is not
  16998.              part of the code, the function sends data or commands to the
  16999.              device.
  17000.  
  17001.    0x0040    Pass the command to the device driver. If 0x0040 is not part of
  17002.              the code, MS OS/2 intercepts the command.
  17003.  
  17004.    0x0080    Ignore the command if the device driver does not support it. If
  17005.              0x0080 is not part of the code, the function returns an error
  17006.              code if the command is not supported.
  17007.    ──────────────────────────────────────────────────────────────────────────
  17008.  
  17009.    The following table lists the IOCtl functions by category and function
  17010.    codes and shows the corresponding function name:
  17011.  
  17012.    Table 3.1
  17013.    Specific Category and Function Codes
  17014.    ──────────────────────────────────────────────────────────────────────────
  17015. ╓┌─┌───────────────────┌─────────────────────────────────────────────────────╖
  17016.    Category, Function  Function name
  17017.    ──────────────────────────────────────────────────────────────────────────
  17018.  
  17019.    Serial-Device Control
  17020.  
  17021.    0x0001,0x0041       ASYNC_SETBAUDRATE
  17022.  
  17023.    0x0001,0x0042       ASYNC_SETLINECTRL
  17024.  
  17025.    0x0001,0x0044       ASYNC_TRANSMITIMM
  17026.  
  17027.    0x0001,0x0045       ASYNC_SETBREAKOFF
  17028.  
  17029.    0x0001,0x0046       ASYNC_SETMODEMCTRL
  17030.  
  17031.    0x0001,0x004B       ASYNC_SETBREAKON
  17032.  
  17033.    Category, Function  Function name
  17034.    ──────────────────────────────────────────────────────────────────────────
  17035. 
  17036.    0x0001,0x0047       ASYNC_STOPTRANSMIT
  17037.  
  17038.    0x0001,0x0048       ASYNC_STARTTRANSMIT
  17039.  
  17040.    0x0001,0x0053       ASYNC_SETDCBINFO
  17041.  
  17042.    0x0001,0x0061       ASYNC_GETBAUDRATE
  17043.  
  17044.    0x0001,0x0062       ASYNC_GETLINECTRL
  17045.  
  17046.    0x0001,0x0064       ASYNC_GETCOMMSTATUS
  17047.  
  17048.    0x0001,0x0065       ASYNC_GETLINESTATUS
  17049.  
  17050.    0x0001,0x0066       ASYNC_GETMODEMOUTPUT
  17051.  
  17052.    0x0001,0x0067       ASYNC_GETMODEMINPUT
  17053.  
  17054.    Category, Function  Function name
  17055.    ──────────────────────────────────────────────────────────────────────────
  17056. 
  17057.    0x0001,0x0068       ASYNC_GETINQUECOUNT
  17058.  
  17059.    0x0001,0x0069       ASYNC_GETOUTQUECOUNT
  17060.  
  17061.    0x0001,0x006D       ASYNC_GETCOMMERROR
  17062.  
  17063.    0x0001,0x0072       ASYNC_GETCOMMEVENT
  17064.  
  17065.    0x0001,0x0073       ASYNC_GETDCBINFO
  17066.  
  17067.    Screen/Pointer-Draw Control
  17068.  
  17069.    0x0003, 0x0072            PTR_GETPTRDRAWADDRESS
  17070.  
  17071.    Keyboard Control
  17072.  
  17073.    0x0004,0x0050             KBD_SETTRANSTABLE
  17074.  
  17075.    Category, Function  Function name
  17076.    ──────────────────────────────────────────────────────────────────────────
  17077. 
  17078.    0x0004,0x0051             KBD_SETINPUTMODE
  17079.  
  17080.    0x0004,0x0052             KBD_SETINTERIMFLAG
  17081.  
  17082.    0x0004,0x0053             KBD_SETSHIFTSTATE
  17083.  
  17084.    0x0004,0x0054             KBD_SETTYPAMATICRATE
  17085.  
  17086.    0x0004,0x0055             KBD_SETFGNDSCREENGRP
  17087.  
  17088.    0x0004,0x0056             KBD_SETSESMGRHOTKEY
  17089.  
  17090.    0x0004,0x0057             KBD_SETFOCUS
  17091.  
  17092.    0x0004,0x0058             KBD_SETKCB
  17093.  
  17094.    0x0004,0x005C             KBD_SETNLS
  17095.  
  17096.    Category, Function  Function name
  17097.    ──────────────────────────────────────────────────────────────────────────
  17098. 
  17099.    0x0004,0x005D             KBD_CREATE
  17100.  
  17101.    0x0004,0x005E             KBD_DESTROY
  17102.  
  17103.    0x0004,0x0071             KBD_GETINPUTMODE
  17104.  
  17105.    0x0004,0x0072             KBD_GETINTERIMFLAG
  17106.  
  17107.    0x0004,0x0073             KBD_GETSHIFTSTATE
  17108.  
  17109.    0x0004,0x0074             KBD_READCHAR
  17110.  
  17111.    0x0004,0x0075             KBD_PEEKCHAR
  17112.  
  17113.    0x0004,0x0076             KBD_GETSESMGRHOTKEY
  17114.  
  17115.    0x0004,0x0077             KBD_GETKEYBDTYPE
  17116.  
  17117.    Category, Function  Function name
  17118.    ──────────────────────────────────────────────────────────────────────────
  17119. 
  17120.    0x0004,0x0078             KBD_GETCODEPAGEID
  17121.  
  17122.    0x0004,0x0079             KBD_XLATESCAN
  17123.  
  17124.    Printer Control
  17125.  
  17126.    0x0005,0x0042             PRT_SETFRAMECTL
  17127.  
  17128.    0x0005,0x0044             PRT_SETINFINITERETRY
  17129.  
  17130.    0x0005,0x0046             PRT_INITPRINTER
  17131.  
  17132.    0x005,0x0048              PRT_ACTIVATEFONT
  17133.  
  17134.    0x0005,0x0062             PRT_GETFRAMECTL
  17135.  
  17136.    0x0005,0x0064             PRT_GETINFINITERETRY
  17137.  
  17138.    Category, Function  Function name
  17139.    ──────────────────────────────────────────────────────────────────────────
  17140. 
  17141.    0x0005,0x0066             PRT_GETPRINTERSTATUS
  17142.  
  17143.    0x0005,0x0069             PRT_QUERYACTIVEFONT
  17144.  
  17145.    0x0005,0x006A             PRT_VERIFYFONT
  17146.  
  17147.    Pointing-Device (Mouse) Control
  17148.  
  17149.    0x0007,0x0050             MOU_ALLOWPTRDRAW
  17150.  
  17151.    0x0007,0x0051             MOU_UPDATEDISPLAYMODE
  17152.  
  17153.    0x0007,0x0052             MOU_SCREENSWITCH
  17154.  
  17155.    0x0007,0x0053             MOU_SETSCALEFACTORS
  17156.  
  17157.    0x0007,0x0054             MOU_SETEVENTMASK
  17158.  
  17159.    Category, Function  Function name
  17160.    ──────────────────────────────────────────────────────────────────────────
  17161. 
  17162.    0x0007,0x0055             MOU_SETHOTKEYBUTTON
  17163.  
  17164.    0x0007,0x0056             MOU_SETPTRSHAPE
  17165.  
  17166.    0x0007,0x0057             MOU_DRAWPTR
  17167.  
  17168.    0x0007,0x0058             MOU_REMOVEPTR
  17169.  
  17170.    0x0007,0x0059             MOU_SETPTRPOS
  17171.  
  17172.    0x0007,0x005A             MOU_SETPROTDRAWADDRESS
  17173.  
  17174.    0x0007,0x005B             MOU_SETREALDRAWADDRESS
  17175.  
  17176.    0x0007,0x005C             MOU_SETMOUSTATUS
  17177.  
  17178.    0x0007,0x0060             MOU_GETBUTTONCOUNT
  17179.  
  17180.    Category, Function  Function name
  17181.    ──────────────────────────────────────────────────────────────────────────
  17182. 
  17183.    0x0007,0x0061             MOU_GETMICKEYCOUNT
  17184.  
  17185.    0x0007,0x0062             MOU_GETMOUSTATUS
  17186.  
  17187.    0x0007,0x0063             MOU_READEVENTQUE
  17188.  
  17189.    0x0007,0x0064             MOU_GETQUESTATUS
  17190.  
  17191.    0x0007,0x0065             MOU_GETEVENTMASK
  17192.  
  17193.    0x0007,0x0066             MOU_GETSCALEFACTORS
  17194.  
  17195.    0x0007,0x0067             MOU_GETPTRPOS
  17196.  
  17197.    0x0007,0x0068             MOU_GETPTRSHAPE
  17198.  
  17199.    0x0007,0x0069             MOU_GETHOTKEYBUTTON
  17200.  
  17201.    Category, Function  Function name
  17202.    ──────────────────────────────────────────────────────────────────────────
  17203. 
  17204.    Disk/Diskette Control
  17205.  
  17206.    0x0008,0x0000             DSK_LOCKDRIVE
  17207.  
  17208.    0x0008,0x0001             DSK_UNLOCKDRIVE
  17209.  
  17210.    0x0008,0x0002             DSK_REDETERMINEMEDIA
  17211.  
  17212.    0x0008,0x0003             DSK_SETLOGICALMAP
  17213.  
  17214.    0x0008,0x0020             DSK_BLOCKREMOVABLE
  17215.  
  17216.    0x0008,0x0021             DSK_GETLOGICALMAP
  17217.  
  17218.    0x0008,0x0043             DSK_SETDEVICEPARAMS
  17219.  
  17220.    0x0008,0x0044             DSK_WRITETRACK
  17221.  
  17222.    Category, Function  Function name
  17223.    ──────────────────────────────────────────────────────────────────────────
  17224. 
  17225.    0x0008,0x0045             DSK_FORMATVERIFY
  17226.  
  17227.    0x0008,0x0063             DSK_GETDEVICEPARAMS
  17228.  
  17229.    0x0008,0x0064             DSK_READTRACK
  17230.  
  17231.    0x0008,0x0065             DSK_VERIFYTRACK
  17232.  
  17233.    Physical-Disk Control
  17234.  
  17235.    0x0009,0x0000             PDSK_LOCKPHYSDRIVE
  17236.  
  17237.    0x0009,0x0001             PDSK_UNLOCKPHYSDRIVE
  17238.  
  17239.    0x0009,0x0044             PDSK_WRITEPHYSTRACK
  17240.  
  17241.    0x0009,0x0063             PDSK_GETPHYSDEVICEPARAMS
  17242.  
  17243.    Category, Function  Function name
  17244.    ──────────────────────────────────────────────────────────────────────────
  17245. 
  17246.    0x0009,0x0064             PDSK_READPHYSTRACK
  17247.  
  17248.    0x0009,0x0065             PDSK_VERIFYPHYSTRACK
  17249.  
  17250.    Character-Monitor Control
  17251.  
  17252.    0x000A,0x0040             MON_REGISTERMONITOR
  17253.  
  17254.    General Device Control
  17255.  
  17256.    0x000B,0x0001             DEV_FLUSHINPUT
  17257.  
  17258.    0x000B,0x0002             DEV_FLUSHOUTPUT
  17259.  
  17260.    0x000B,0x0060             DEV_QUERYMONSUPPORT
  17261.    ──────────────────────────────────────────────────────────────────────────
  17262.  
  17263.  
  17264.  
  17265.  3.3  Functions
  17266.  
  17267.    This section lists the IOCtl functions in alphabetical order. Each
  17268.    function's syntax is given and the parameters and return values are
  17269.    described.
  17270.  
  17271.  
  17272.  ────────────────────────────────────────────────────────────────────────────
  17273.  ASYNC_GETBAUDRATE
  17274.  ────────────────────────────────────────────────────────────────────────────
  17275.    USHORT DosDevIOCtl (pusBaudRate, 0L, 0x0061, 0x0001, hDevice)
  17276.    PUSHORT pusBaudRate;    /*pointer to variable for baud rate             */
  17277.    HFILE hDevice;          /*device handle                                 */
  17278.  
  17279.    The ASYNC_GETBAUDRATE function retrieves the baud rate for the specified
  17280.    serial device. The baud rate specifies the number of bits per second that
  17281.    the serial device transmits or receives.
  17282.  
  17283.  Parameters
  17284.  
  17285.    pusBaudRate  Points to the variable that receives the baud rate.
  17286.  
  17287.    hDevice  Identifies the serial device that receives the device-control
  17288.    function. The handle must have been created previously by using the
  17289.    DosOpen function.
  17290.  
  17291.  Return Value
  17292.  
  17293.    The return value is zero if the function is successful or an error value
  17294.    if an error occurs.
  17295.  
  17296.  See Also
  17297.  
  17298.    DosOpen, ASYNC_SETBAUDRATE
  17299.  
  17300.  
  17301.  ────────────────────────────────────────────────────────────────────────────
  17302.  ASYNC_GETCOMMERROR
  17303.  ────────────────────────────────────────────────────────────────────────────
  17304.    USHORT DosDevIOCtl (pfCommErr, 0L, 0x006D, 0x0001, hDevice)
  17305.    PUSHORT pfCommErr;      /*pointer to variable for error                 */
  17306.    HFILE hDevice;          /*device handle                                 */
  17307.  
  17308.    The ASYNC_GETCOMMERROR function retrieves the communication error word.
  17309.    After copying the error-word value to the specified variable, the function
  17310.    clears the error word.
  17311.  
  17312.  Parameters
  17313.  
  17314.    pfCommErr  Points to the variable that receives the communication status
  17315.    of the device. This variable can be a combination of the following values:
  17316.  
  17317.    Value                   Meaning
  17318.    ──────────────────────────────────────────────────────────────────────────
  17319.    RX_QUE_OVERRUN          Receive-queue overrun. There is no room in the
  17320.                            device-driver receive queue to put a character
  17321.                            read in from the receive hardware.
  17322.  
  17323.    RX_HARDWARE_OVERRUN     Receive-hardware overrun. A character arrived
  17324.                            before the previous character was completely read.
  17325.                            The previous character is lost.
  17326.  
  17327.    PARITY_ERROR            The hardware detected a parity error.
  17328.  
  17329.    FRAMING_ERROR           The hardware detected a framing error.
  17330.    ──────────────────────────────────────────────────────────────────────────
  17331.  
  17332.    hDevice  Identifies the serial device that receives the device-control
  17333.    function. The handle must have been created previously by using the
  17334.    DosOpen function.
  17335.  
  17336.  Return Value
  17337.  
  17338.    The return value is zero if the function is successful. When an error
  17339.    occurs, the function returns an error value, and any value copied to the
  17340.    variable pointed to by the pfCommErr parameter is not valid, and the
  17341.    function does not clear the error word.
  17342.  
  17343.  Comments
  17344.  
  17345.    Other than using this function, the only way to clear the communications
  17346.    error word for a device is to open the device when there are no
  17347.    outstanding open handles for it. For more information, see the
  17348.    ASYNC_SETDCBINFO function (0x0001, 0x0053).
  17349.  
  17350.  See Also
  17351.  
  17352.    DosOpen, ASYNC_GETCOMMEVENT, ASYNC_GETCOMMSTATUS, ASYNC_SETDCBINFO
  17353.  
  17354.  
  17355.  ────────────────────────────────────────────────────────────────────────────
  17356.  ASYNC_GETCOMMEVENT
  17357.  ────────────────────────────────────────────────────────────────────────────
  17358.    USHORT DosDevIOCtl (pfEvent, 0L, 0x0072, 0x0001, hDevice)
  17359.    PUSHORT pfEvent;        /*pointer to variable for events                */
  17360.    HFILE hDevice;          /*device handle                                 */
  17361.  
  17362.    The ASYNC_GETCOMMEVENT function retrieves the communications event flags
  17363.    from the internally maintained event word. After the function copies the
  17364.    event flags to the specified variable, it clears the event word.
  17365.  
  17366.  Parameters
  17367.  
  17368.    pfEvent  Points to the variable that receives the event flags. This
  17369.    variable can be a combination of the following values:
  17370.  
  17371. ╓┌─┌─────────────────┌───────────────────────────────────────────────────────╖
  17372.    Value             Meaning
  17373.    ──────────────────────────────────────────────────────────────────────────
  17374.    CHAR_RECEIVED     A character has been read from the serial-device receive
  17375.                      hardware and placed in the receive queue.
  17376.  
  17377.    LAST_CHAR_SENT    The last character in the device-driver transmit queue
  17378.                      has been sent to the serial-device transmit hardware.
  17379.                      This does not mean there is no data to send in any
  17380.                      outstanding write requests.
  17381.  
  17382.    CTS_CHANGED       The clear-to-send (CTS) signal has changed state.
  17383.  
  17384.    DSR_CHANGED       The data-set-ready (DSR) signal has changed state.
  17385.  
  17386.    DCD_CHANGED       The data-carrier-detect (DCD) signal has changed state.
  17387.  
  17388.    BREAK_DETECTED    A break has been detected.
  17389.  
  17390.    Value             Meaning
  17391.    ──────────────────────────────────────────────────────────────────────────
  17392. 
  17393.    ERROR_OCCURRED    A parity, framing, or overrun error has occurred. An
  17394.                      overrun can be a receive hardware overrun or a receive
  17395.                      queue overrun.
  17396.  
  17397.    RI_DETECTED       The trailing edge of the ring indicator (RI) has been
  17398.                      detected.
  17399.    ──────────────────────────────────────────────────────────────────────────
  17400.  
  17401.  
  17402.    hDevice  Identifies the serial device that receives the device-control
  17403.    function. The handle must have been created previously by using the
  17404.    DosOpen function.
  17405.  
  17406.  Return Value
  17407.  
  17408.    The return value is zero if the function is successful or an error value
  17409.    if an error occurs.
  17410.  
  17411.  Comments
  17412.  
  17413.    This function clears the event word only when it is successful. The event
  17414.    word remains unchanged until the device is fully closed (there are no
  17415.    outstanding open handles) and then reopened.
  17416.  
  17417.  See Also
  17418.  
  17419.    DosOpen, ASYNC_GETCOMMSTATUS, ASYNC_GETCOMMERROR
  17420.  
  17421.  
  17422.  ────────────────────────────────────────────────────────────────────────────
  17423.  ASYNC_GETCOMMSTATUS
  17424.  ────────────────────────────────────────────────────────────────────────────
  17425.    USHORT DosDevIOCtl (pbStatus, 0L, 0x0064, 0x0001, hDevice)
  17426.    PBYTE pbStatus;         /*pointer to variable for status                */
  17427.    HFILE hDevice;          /*device handle                                 */
  17428.  
  17429.    The ASYNC_GETCOMMSTATUS function retrieves the communication status of the
  17430.    specified device.
  17431.  
  17432.  Parameters
  17433.  
  17434.    pbStatus  Points to the variable that receives the communication status.
  17435.    This variable can be a combination of the following values:
  17436.  
  17437. ╓┌─┌──────────────────────────┌──────────────────────────────────────────────╖
  17438.    Value                      Meaning
  17439.    ──────────────────────────────────────────────────────────────────────────
  17440.    TX_WAITING_FOR_CTS         Transmission is waiting for the clear-to-send
  17441.                               (CTS) signal to be turned on. For a full
  17442.                               description, see the ASYNC_SETDCBINFO function
  17443.                               (0x0001, 0x0053).
  17444.  
  17445.    TX_WAITING_FOR_DSR         Transmission is waiting for the data-set-ready
  17446.                               (DSR) signal to be turned on. For a full
  17447.                               description, see the ASYNC_SETDCBINFO function
  17448.                               (0x0001, 0x0053).
  17449.  
  17450.    TX_WAITING_FOR_DCD         Transmission is waiting for the
  17451.                               data-carrier-detected (DCD) signal to be turned
  17452.                               on. For a full description, see the
  17453.    Value                      Meaning
  17454.    ──────────────────────────────────────────────────────────────────────────
  17455.                              on. For a full description, see the
  17456.                               ASYNC_SETDCBINFO function (0x0001, 0x0053).
  17457.  
  17458.    TX_WAITING_FOR_XON         Transmission is waiting because the XOFF
  17459.                               character is received. For a full description,
  17460.                               see the following "Comments" section.
  17461.  
  17462.    TX_WAITING_TO_SEND_XON     Transmission is waiting because the XOFF
  17463.                               character is transmitted. For a full
  17464.                               description, see the following "Comments"
  17465.                               section.
  17466.  
  17467.    TX_WAITING_WHILE_BREAK_ON  Transmission is waiting because a break is
  17468.                               being transmitted. For a full description, see
  17469.                               the ASYNC_SETBREAKON function (0x0001, 0x004B).
  17470.  
  17471.    TX_WAITING_TO_SEND_IMM     Character is waiting to transmit immediately.
  17472.                               For a full description, see the
  17473.                               ASYNC_TRANSMITIMM function (0x0001, 0x0044).
  17474.    Value                      Meaning
  17475.    ──────────────────────────────────────────────────────────────────────────
  17476.                              ASYNC_TRANSMITIMM function (0x0001, 0x0044).
  17477.  
  17478.    RX_WAITING_FOR_DSR         Receive state is waiting for the data-set-ready
  17479.                               (DSR) signal to be turned on. For a full
  17480.                               description, see the ASYNC_SETDCBINFO function
  17481.                               (0x0001, 0x0053).
  17482.    ──────────────────────────────────────────────────────────────────────────
  17483.  
  17484.  
  17485.    hDevice  Identifies the serial device that receives the device-control
  17486.    function. The handle must have been created previously by using the
  17487.    DosOpen function.
  17488.  
  17489.  Return Value
  17490.  
  17491.    The return value is zero if the function is successful or an error value
  17492.    if an error occurs.
  17493.  
  17494.  Comments
  17495.  
  17496.    Transmit status indicates why transmission is not occurring, regardless of
  17497.    whether or not there is data to transmit. However, the device driver must
  17498.    be enabled for the given condition (for example, enabled for output
  17499.    handshaking for the modem-control signal) for the status to reflect that
  17500.    the device driver is waiting for the given condition to transmit.
  17501.  
  17502.    For example, TX_WAITING_FOR_CTS means that the device driver puts receive
  17503.    characters in the device-driver receive queue, the device driver is not
  17504.    waiting to transmit a character immediately, and characters from the
  17505.    device-driver transmit queue are not transmitted because the clear-to-send
  17506.    (CTS) signal for output handshaking is used and CTS does not have the
  17507.    proper value.
  17508.  
  17509.    The communication status can include TX_WAITING_TO_SEND_XON if the device
  17510.    driver is enabled for automatic transmit flow control (XON/XOFF) or if the
  17511.    ASYNC_STOPTRANSMIT function (0x0001, 0x0047) has been used to tell the
  17512.    device driver to function as if an XOFF character is received. The
  17513.    ASYNC_TRANSMITIMM function (0x0001, 0x0044) can still be used to transmit
  17514.    characters immediately. The device driver can still automatically transmit
  17515.    XON and XOFF characters due to automatic receive flow control (XON/XOFF)
  17516.    when the device driver is in this state.
  17517.  
  17518.    The communication status can include TX_WAITING_FOR_XON if the device
  17519.    driver is enabled for automatic receive flow control. When in this state,
  17520.    the ASYNC_TRANSMITIMM function (0x0001, 0x0044) can still be used to
  17521.    transmit characters immediately, and the device driver can still
  17522.    automatically transmit XON characters.
  17523.  
  17524.  See Also
  17525.  
  17526.    DosOpen, ASYNC_GETCOMMEVENT, ASYNC_GETLINESTATUS, ASYNC_SETDCBINFO,
  17527.    ASYNC_STARTTRANSMIT, ASYNC_STOPTRANSMIT, ASYNC_TRANSMITIMM
  17528.  
  17529.  
  17530.  ────────────────────────────────────────────────────────────────────────────
  17531.  ASYNC_GETDCBINFO
  17532.  ────────────────────────────────────────────────────────────────────────────
  17533.    USHORT DosDevIOCtl (pusDCB, 0L, 0x0073, 0x0001, hDevice)
  17534.    PUSHORT pusDCB;         /*pointer to structure for device-control       */
  17535.                            /*information                                   */
  17536.    HFILE hDevice;          /*device handle                                 */
  17537.  
  17538.    The ASYNC_GETDCBINFO function retrieves device-control block information.
  17539.  
  17540.  Parameters
  17541.  
  17542.    pusDCB  Points to the DCBINFO structure that receives the device-control
  17543.    block information. The DCBINFO structure has the following form:
  17544.  
  17545.    typedef struct _DCBINFO {
  17546.        USHORT usWriteTimeout;
  17547.        USHORT usReadTimeout;
  17548.        BYTE   bFlags1
  17549.        BYTE   bFlags2
  17550.        BYTE   bFlags3
  17551.        BYTE   bErrorReplacementChar;
  17552.        BYTE   bBreakReplacementChar;
  17553.        BYTE   bXONChar;
  17554.        BYTE   bXOFFChar;
  17555.    } DCBINFO;
  17556.  
  17557.    For a full description, see Chapter 4, "Types, Macros, Structures."
  17558.  
  17559.    hDevice  Identifies the serial device that receives the device-control
  17560.    function. The handle must have been created previously by using the
  17561.    DosOpen function.
  17562.  
  17563.  Return Value
  17564.  
  17565.    The return value is zero if the function is successful. When an error
  17566.    occurs, the function returns an error value, and any data copied to the
  17567.    DCBINFO structure pointed to by the pusDCB parameter is not valid.
  17568.  
  17569.  Comments
  17570.  
  17571.    To ensure that only valid values are set in the device-control block, the
  17572.    program should call the ASYNC_GETDCBINFO function to fill the block, and
  17573.    then modify the settings and call the ASYNC_SETDCBINFO function with the
  17574.    modified block.
  17575.  
  17576.  See Also
  17577.  
  17578.    DosOpen, ASYNC_SETDCBINFO
  17579.  
  17580.  
  17581.  ────────────────────────────────────────────────────────────────────────────
  17582.  ASYNC_GETINQUECOUNT
  17583.  ────────────────────────────────────────────────────────────────────────────
  17584.    USHORT DosDevIOCtl (pcReceiveQue, 0L, 0x0068, 0x0001, hDevice)
  17585.    PUSHORT pcReceiveQue;   /*pointer to structure for character count      */
  17586.    HFILE hDevice;          /*device handle                                 */
  17587.  
  17588.    The ASYNC_GETINQUECOUNT function retrieves the number of characters in the
  17589.    receive queue.
  17590.  
  17591.  Parameters
  17592.  
  17593.    pcReceiveQue  Points to the RXQUEUE structure that receives the count of
  17594.    characters in the receive queue. The RXQUEUE structure has the following
  17595.    form:
  17596.  
  17597.    typedef struct _RXQUEUE {
  17598.        USHORT cbChars;
  17599.        USHORT cbQueue;
  17600.    } RXQUEUE;
  17601.  
  17602.    For a full description, see Chapter 4, "Types, Macros, Structures."
  17603.  
  17604.    hDevice  Identifies the serial device that receives the device-control
  17605.    function. The handle must have been created previously by using the
  17606.    DosOpen function.
  17607.  
  17608.  Return Value
  17609.  
  17610.    The return value is zero if the function is successful or an error value
  17611.    if an error occurs.
  17612.  
  17613.  Comments
  17614.  
  17615.    The device-driver receive queue is a memory buffer between the memory
  17616.    pointed to by the read-request packet and the receive hardware for this
  17617.    serial device. The application may not assume that there are no
  17618.    unsatisfied read requests if there are characters in the device-driver
  17619.    receive queue. The behavior of data movement between the read request and
  17620.    the receive queue may change from release to release of the device driver.
  17621.    Programs should not be written to have a dependency on this information.
  17622.  
  17623.    Programs should be written to be independent of the receive queue being a
  17624.    fixed size. The information in this field allows the application to get
  17625.    the size of the receive queue. The current size of the receive queue is
  17626.    approximately 1K but is subject to change.
  17627.  
  17628.    The application should be written to avoid device-driver receive queue
  17629.    overruns by using an application-to-application block protocol with the
  17630.    system the application is communicating with.
  17631.  
  17632.  See Also
  17633.  
  17634.    DosOpen, ASYNC_GETOUTQUECOUNT
  17635.  
  17636.  
  17637.  ────────────────────────────────────────────────────────────────────────────
  17638.  ASYNC_GETLINECTRL
  17639.  ────────────────────────────────────────────────────────────────────────────
  17640.    USHORT DosDevIOCtl (pbLineCtrl, 0L, 0x0062, 0x0001, hDevice)
  17641.    PBYTE pbLineCtrl;       /*pointer to structure for control settings     */
  17642.    HFILE hDevice;          /*device handle                                 */
  17643.  
  17644.    The ASYNC_GETLINECTRL function retrieves the line characteristics (stop
  17645.    bits, parity, data bits, break) for the specified device.
  17646.  
  17647.  Parameters
  17648.  
  17649.    pbLineCtrl  Points to a LINECONTROL structure that receives the settings
  17650.    for the number of data bits, parity, and number of stop bits. The
  17651.    LINECONTROL structure has the following form:
  17652.  
  17653.    typedef struct _LINECONTROL {
  17654.        BYTE bDataBits;
  17655.        BYTE bParity;
  17656.        BYTE bStopBits;
  17657.        BYTE fbTransBreak;
  17658.    } LINECONTROL;
  17659.  
  17660.    For a full description, see Chapter 4, "Types, Macros, Structures."
  17661.  
  17662.    hDevice  Identifies the serial device that receives the device-control
  17663.    function. The handle must have been created previously by using the
  17664.    DosOpen function.
  17665.  
  17666.  Return Value
  17667.  
  17668.    The return value is zero if the function is successful or an error value
  17669.    if an error occurs.
  17670.  
  17671.  See Also
  17672.  
  17673.    DosOpen, ASYNC_SETLINECTRL
  17674.  
  17675.  
  17676.  ────────────────────────────────────────────────────────────────────────────
  17677.  ASYNC_GETLINESTATUS
  17678.  ────────────────────────────────────────────────────────────────────────────
  17679.    USHORT DosDevIOCtl (pbTransStatus, 0L, 0x0065, 0x0001, hDevice)
  17680.    PBYTE pbTransStatus;    /*pointer to variable for status                */
  17681.    HFILE hDevice;          /*device handle                                 */
  17682.  
  17683.    The ASYNC_GETLINESTATUS function retrieves the data-transmission status
  17684.    for the specified serial device.
  17685.  
  17686.  Parameters
  17687.  
  17688.    pbTransStatus  Points to the variable that receives the data-transmission
  17689.    status. This variable can be a combination of the following values:
  17690.  
  17691.    Value                     Meaning
  17692.    ──────────────────────────────────────────────────────────────────────────
  17693.    WRITE_REQUEST_QUEUED      Write-request packets in progress or queued.
  17694.  
  17695.    DATA_IN_TX_QUE            Data in the device-driver transmit queue.
  17696.  
  17697.    HARDWARE_TRANSMITTING     Transmit hardware currently transmitting data.
  17698.  
  17699.    CHAR_READY_TO_SEND_IMM    Character waiting to be transmitted immediately.
  17700.  
  17701.    WAITING_TO_SEND_XON       Waiting to automatically transmit XON.
  17702.  
  17703.    WAITING_TO_SEND_XOFF      Waiting to automatically transmit XOFF.
  17704.    ──────────────────────────────────────────────────────────────────────────
  17705.  
  17706.    hDevice  Identifies the serial device that receives the device-control
  17707.    function. The handle must have been created previously by using the
  17708.    DosOpen function.
  17709.  
  17710.  Return Value
  17711.  
  17712.    The return value is zero if the function is successful or an error value
  17713.    if an error occurs.
  17714.  
  17715.  See Also
  17716.  
  17717.    DosOpen, ASYNC_GETCOMMSTATUS
  17718.  
  17719.  
  17720.  ────────────────────────────────────────────────────────────────────────────
  17721.  ASYNC_GETMODEMINPUT
  17722.  ────────────────────────────────────────────────────────────────────────────
  17723.    USHORT DosDevIOCtl (pbCtrlSignals, 0L, 0x0067, 0x0001, hDevice)
  17724.    PBYTE pbCtrlSignals;    /*pointer to variable for control signals       */
  17725.    HFILE hDevice;          /*device handle                                 */
  17726.  
  17727.    The ASYNC_GETMODEMINPUT function retrieves the modem-control input signals
  17728.    for the specified device.
  17729.  
  17730.  Parameters
  17731.  
  17732.    pbCtrlSignals  Points to the variable that receives the modem-control
  17733.    signals. This variable can be a combination of the following values:
  17734.  
  17735.    Value     Meaning
  17736.    ──────────────────────────────────────────────────────────────────────────
  17737.    CTS_ON    Clear-to-send (CTS) signal is on. If not given, the signal is
  17738.              off.
  17739.  
  17740.    DSR_ON    Data-set-ready (DSR) signal is on. If not given, the signal is
  17741.              off.
  17742.  
  17743.    RI_ON     Ring-indicator (RI) signal is on. If not given, the signal is
  17744.              off.
  17745.  
  17746.    DCD_ON    Data-carrier-detect (DCD) signal is on. If not given, the signal
  17747.              is off.
  17748.    ──────────────────────────────────────────────────────────────────────────
  17749.  
  17750.    hDevice  Identifies the serial device that receives the device-control
  17751.    function. The handle must have been created previously by using the
  17752.    DosOpen function.
  17753.  
  17754.  Return Value
  17755.  
  17756.    The return value is zero if the function is successful or an error value
  17757.    if an error occurs.
  17758.  
  17759.  See Also
  17760.  
  17761.    DosOpen, ASYNC_GETMODEMOUTPUT, ASYNC_SETMODEMCTRL
  17762.  
  17763.  
  17764.  ────────────────────────────────────────────────────────────────────────────
  17765.  ASYNC_GETMODEMOUTPUT
  17766.  ────────────────────────────────────────────────────────────────────────────
  17767.    USHORT DosDevIOCtl (pbCtrlSignals, 0L, 0x0066, 0x0001, hDevice)
  17768.    PBYTE pbCtrlSignals;    /*pointer to variable for control signals       */
  17769.    HFILE hDevice;          /*device handle                                 */
  17770.  
  17771.    The ASYNC_GETMODEMOUTPUT function retrieves the modem-control output
  17772.    signals for the specified device.
  17773.  
  17774.  Parameters
  17775.  
  17776.    pbCtrlSignals  Points to the variable that receives the modem-control
  17777.    signals. This variable can be one or both of the following values:
  17778.  
  17779.    Value     Meaning
  17780.    ──────────────────────────────────────────────────────────────────────────
  17781.    DTR_ON    Data-terminal-ready (DTR) signal is on. If not given, the signal
  17782.              is off.
  17783.  
  17784.    RTS_ON    Request-to-send (RTS) signal is on. If not given, the signal is
  17785.              off.
  17786.    ──────────────────────────────────────────────────────────────────────────
  17787.  
  17788.    hDevice  Identifies the serial device that receives the device-control
  17789.    function. The handle must have been created previously by using the
  17790.    DosOpen function.
  17791.  
  17792.  Return Value
  17793.  
  17794.    The return value is zero if the function is successful or an error value
  17795.    if an error occurs.
  17796.  
  17797.  See Also
  17798.  
  17799.    DosOpen, ASYNC_GETMODEMINPUT, ASYNC_SETMODEMCTRL
  17800.  
  17801.  
  17802.  ────────────────────────────────────────────────────────────────────────────
  17803.  ASYNC_GETOUTQUECOUNT
  17804.  ────────────────────────────────────────────────────────────────────────────
  17805.    USHORT DosDevIOCtl (pcTransmitQue, 0L, 0x0069, 0x0001, hDevice)
  17806.    PUSHORT pcTransmitQue;  /*pointer to structure for character count      */
  17807.    HFILE hDevice;          /*device handle                                 */
  17808.  
  17809.    The ASYNC_GETOUTQUECOUNT function retrieves a count of characters in the
  17810.    transmit queue.
  17811.  
  17812.  Parameters
  17813.  
  17814.    pcTransmitQue  Points to the RXQUEUE structure that receives the count of
  17815.    characters in the transmit queue. The RXQUEUE structure has the following
  17816.    form:
  17817.  
  17818.    typedef struct _RXQUEUE {
  17819.        USHORT cbChars;
  17820.        USHORT cbQueue;
  17821.    } RXQUEUE;
  17822.  
  17823.    For a full description, see Chapter 4, "Types, Macros, Structures."
  17824.  
  17825.    hDevice  Identifies the serial device that receives the device-control
  17826.    function. The handle must have been created previously by using the
  17827.    DosOpen function.
  17828.  
  17829.  Return Value
  17830.  
  17831.    The return value is zero if the function is successful or an error value
  17832.    if an error occurs.
  17833.  
  17834.  Comments
  17835.  
  17836.    The device-driver transmit queue is a memory buffer between the memory
  17837.    pointed to by the write-request packet and the transmit hardware for this
  17838.    serial device. If the transmit queue is empty, the program may not assume
  17839.    that all write requests are completed or that no write requests are
  17840.    outstanding. The behavior of data movement between the write request and
  17841.    the transmit queue may change from release to release of the device
  17842.    driver. Programs should not be written to have a dependency on this
  17843.    information.
  17844.  
  17845.    Programs should be written to be independent of the transmit queue being a
  17846.    fixed size. The information in this field allows the application to get
  17847.    the size of the transmit queue. The current size of the transmit queue is
  17848.    approximately 128 bytes but is subject to change.
  17849.  
  17850.  See Also
  17851.  
  17852.    DosOpen, ASYNC_GETINQUECOUNT
  17853.  
  17854.  
  17855.  ────────────────────────────────────────────────────────────────────────────
  17856.  ASYNC_SETBAUDRATE
  17857.  ────────────────────────────────────────────────────────────────────────────
  17858.    USHORT DosDevIOCtl (0L, pusBitRate, 0x0041, 0x0001, hDevice)
  17859.    PUSHORT pusBitRate;     /*pointer to variable with baud rate            */
  17860.    HFILE hDevice;          /*device handle                                 */
  17861.  
  17862.    The ASYNC_SETBAUDRATE function sets the baud rate for the specified serial
  17863.    device. The baud rate specifies the number of bits per second that the
  17864.    serial device transmits or receives.
  17865.  
  17866.  Parameters
  17867.  
  17868.    pusBitRate  Points to the variable that contains the baud rate. This
  17869.    parameter can be any one of the following values: 110, 150, 300, 600,
  17870.    1200, 2400, 4800, 9600, or 19200.
  17871.  
  17872.    hDevice  Identifies the serial device that receives the device-control
  17873.    function. The handle must have been created previously by using the
  17874.    DosOpen function.
  17875.  
  17876.  Return Value
  17877.  
  17878.    The return value is zero if the function is successful or an error value
  17879.    if the specified baud rate is out of range or an error occurs.
  17880.  
  17881.  Comments
  17882.  
  17883.    The initial rate for a serial device is 1200 baud. Once the rate is set,
  17884.    it remains unchanged until set again, even if the device is closed and
  17885.    then reopened.
  17886.  
  17887.  See Also
  17888.  
  17889.    DosOpen, ASYNC_GETBAUDRATE
  17890.  
  17891.  
  17892.  ────────────────────────────────────────────────────────────────────────────
  17893.  ASYNC_SETBREAKOFF
  17894.  ────────────────────────────────────────────────────────────────────────────
  17895.    USHORT DosDevIOCtl (pfCommErr, 0L, 0x0045, 0x0001, hDevice)
  17896.    PUSHORT pfCommErr;      /*pointer to variable for error value           */
  17897.    HFILE hDevice;          /*device handle                                 */
  17898.  
  17899.    The ASYNC_SETBREAKOFF function turns off the break character. The device
  17900.    driver stops generating a break signal. It is not considered an error if
  17901.    the device driver is not generating a break signal. The device driver then
  17902.    resumes transmitting characters, taking into account all the other reasons
  17903.    why it may or may not transmit characters.
  17904.  
  17905.  Parameters
  17906.  
  17907.    pfCommErr  Points to the variable that receives the communication status
  17908.    of the device. This variable can be a combination of the following values:
  17909.  
  17910.    Value                   Meaning
  17911.    ──────────────────────────────────────────────────────────────────────────
  17912.    RX_QUE_OVERRUN          Receive queue overrun. There is no room in the
  17913.                            device-driver receive queue to put a character
  17914.                            read in from the receive hardware.
  17915.  
  17916.    RX_HARDWARE_OVERRUN     Receive hardware overrun. A character arrived
  17917.                            before the previous character was completely read.
  17918.                            The previous character is lost.
  17919.  
  17920.    PARITY_ERROR            The hardware detected a parity error.
  17921.  
  17922.    FRAMING_ERROR           The hardware detected a framing error.
  17923.    ──────────────────────────────────────────────────────────────────────────
  17924.  
  17925.    The function sets the variable to zero if it encounters an error.
  17926.  
  17927.    hDevice  Identifies the serial device that receives the device-control
  17928.    function. The handle must have been created previously by using the
  17929.    DosOpen function.
  17930.  
  17931.  Return Value
  17932.  
  17933.    The return value is zero if the function is successful or an error value
  17934.    if an error occurs.
  17935.  
  17936.  See Also
  17937.  
  17938.    DosOpen, ASYNC_SETBREAKON
  17939.  
  17940.  
  17941.  ────────────────────────────────────────────────────────────────────────────
  17942.  ASYNC_SETBREAKON
  17943.  ────────────────────────────────────────────────────────────────────────────
  17944.    USHORT DosDevIOCtl (pfCommErr, 0L, 0x004B, 0x0001, hDevice)
  17945.    PUSHORT pfCommErr;      /*pointer to variable for error value           */
  17946.    HFILE hDevice;          /*device handle                                 */
  17947.  
  17948.    The ASYNC_SETBREAKON function turns on the break character. The device
  17949.    driver generates the break signal immediately. It is not considered an
  17950.    error if the device driver is already generating a break signal. The
  17951.    device driver does not wait for the transmit hardware to become empty.
  17952.    However, more data will not be given to the transmit hardware until the
  17953.    break is turned off. The break signal will always be transmitted,
  17954.    regardless of whether the device driver is or is not transmitting
  17955.    characters due to other reasons.
  17956.  
  17957.  Parameters
  17958.  
  17959.    pfCommErr  Points to the variable that receives the communication status
  17960.    of the device. This variable can be a combination of the following values:
  17961.  
  17962.    Value                   Meaning
  17963.    ──────────────────────────────────────────────────────────────────────────
  17964.    RX_QUE_OVERRUN          Receive queue overrun. There is no room in the
  17965.                            device-driver receive queue to put a character
  17966.                            read in from the receive hardware.
  17967.  
  17968.    RX_HARDWARE_OVERRUN     Receive hardware overrun. A character arrived
  17969.                            before the previous character was completely read.
  17970.                            The previous character is lost.
  17971.  
  17972.    PARITY_ERROR            The hardware detected a parity error.
  17973.  
  17974.    FRAMING_ERROR           The hardware detected a framing error.
  17975.    ──────────────────────────────────────────────────────────────────────────
  17976.  
  17977.    The function sets the variable to zero if it encounters an error.
  17978.  
  17979.    hDevice  Identifies the serial device that receives the device-control
  17980.    function. The handle must have been created previously by using the
  17981.    DosOpen function.
  17982.  
  17983.  Return Value
  17984.  
  17985.    The return value is zero if the function is successful or an error value
  17986.    if an error occurs.
  17987.  
  17988.  Comments
  17989.  
  17990.    Closing the device turns off the break character if there are no
  17991.    outstanding open device handles.
  17992.  
  17993.  See Also
  17994.  
  17995.    DosOpen, ASYNC_SETBREAKOFF
  17996.  
  17997.  
  17998.  ────────────────────────────────────────────────────────────────────────────
  17999.  ASYNC_SETDCBINFO
  18000.  ────────────────────────────────────────────────────────────────────────────
  18001.    USHORT DosDevIOCtl (0L, pusDCB, 0x0053, 0x0001, hDevice)
  18002.    PUSHORT pusDCB;         /*pointer to structure with device-control      */
  18003.                            /*information                                   */
  18004.    HFILE hDevice;          /*device handle                                 */
  18005.  
  18006.    The ASYNC_SETDCBINFO function sets device-control block information.
  18007.  
  18008.  Parameters
  18009.  
  18010.    pusDCB  Points to the DCBINFO structure that receives the device-control
  18011.    block information. The DCBINFO structure has the following form:
  18012.  
  18013.    typedef struct _DCBINFO {
  18014.        USHORT usWriteTimeout;
  18015.        USHORT usReadTimeout;
  18016.        BYTE   bFlags1
  18017.        BYTE   bFlags2
  18018.        BYTE   bFlags3
  18019.        BYTE   bErrorReplacementChar;
  18020.        BYTE   bBreakReplacementChar;
  18021.        BYTE   bXONChar;
  18022.        BYTE   bXOFFChar;
  18023.    } DCBINFO;
  18024.  
  18025.    For a full description, see Chapter 4, "Types, Macros, Structures."
  18026.  
  18027.    hDevice  Identifies the serial device that receives the device-control
  18028.    function. The handle must have been created previously by using the
  18029.    DosOpen function.
  18030.  
  18031.  Return Value
  18032.  
  18033.    The return value is zero if the function is successful. When an error
  18034.    occurs, the function returns an error value, and the device-control block
  18035.    characteristics of the device driver for this serial device remain
  18036.    unchanged.
  18037.  
  18038.  Comments
  18039.  
  18040.    A program can prevent making unwanted changes to device modes by calling
  18041.    the ASYNC_GETDCBINFO function (0x0001,0x0073) to retrieve a copy of the
  18042.    current DCB. The program can then modify only those fields it needs to and
  18043.    use the modified DCB with the ASYNC_SETDCBINFO function.
  18044.  
  18045.  See Also
  18046.  
  18047.    DosOpen, ASYNC_GETDCBINFO
  18048.  
  18049.  
  18050.  ────────────────────────────────────────────────────────────────────────────
  18051.  ASYNC_SETLINECTRL
  18052.  ────────────────────────────────────────────────────────────────────────────
  18053.    USHORT DosDevIOCtl (0L, pbLineCtrl, 0x0042, 0x0001, hDevice)
  18054.    PBYTE pbLineCtrl;       /*pointer to structure with line settings       */
  18055.    HFILE hDevice;          /*device handle                                 */
  18056.  
  18057.    The ASYNC_SETLINECTRL function sets the line characteristics (stop bits,
  18058.    parity, and data bits) for the specified serial device.
  18059.  
  18060.  Parameters
  18061.  
  18062.    pbLineCtrl  Points to the LINECONTROL structure that contains the
  18063.    settings for the number of data bits, parity, and number of stop bits. The
  18064.    LINECONTROL structure has the following form:
  18065.  
  18066.    typedef struct _LINECONTROL {
  18067.        BYTE bDataBits;
  18068.        BYTE bParity;
  18069.        BYTE bStopBits;
  18070.        BYTE fbTransBreak;
  18071.    } LINECONTROL;
  18072.  
  18073.    For a full description, see Chapter 4, "Types, Macros, Structures."
  18074.  
  18075.    hDevice  Identifies the serial device that receives the device-control
  18076.    function. The handle must have been created previously by using the
  18077.    DosOpen function.
  18078.  
  18079.  Return Value
  18080.  
  18081.    The return value is zero if the function is successful or an error value
  18082.    if any of the specified line characteristics is out of range. When an
  18083.    error occurs, line characteristics remain unchanged.
  18084.  
  18085.  Comments
  18086.  
  18087.    When a device is first opened, the initial line characteristics are 7 data
  18088.    bits, even parity, and 1 stop bit. After line characteristics are changed,
  18089.    they remain changed until the function is used again, even if the device
  18090.    is closed and reopened.
  18091.  
  18092.    If the number of data bits is less than 8, the device driver fills with
  18093.    zeros the unused high-order bits of each character it receives from the
  18094.    device; the device driver ignores the unused high-order bits of characters
  18095.    it receives from the program. Therefore, if the number of data bits is 7
  18096.    but the XOFF character is 0x80, the device driver does not recognize the
  18097.    XOFF character even when automatic-transmission control is enabled. If the
  18098.    error substitution character is 0x80, the device driver still places 0x80
  18099.    in the receive queue. Programs must see that these characters match the
  18100.    specified data size. Any characters that were in the receive queue before
  18101.    the function is called remain unchanged.
  18102.  
  18103.  See Also
  18104.  
  18105.    DosOpen, ASYNC_GETLINECTRL
  18106.  
  18107.  
  18108.  ────────────────────────────────────────────────────────────────────────────
  18109.  ASYNC_SETMODEMCTRL
  18110.  ────────────────────────────────────────────────────────────────────────────
  18111.    USHORT DosDevIOCtl (pfCommErr, pbCtrlSignals, 0x0046, 0x0001, hDevice)
  18112.    PUSHORT pfCommErr;      /*pointer to variable for error value           */
  18113.    PBYTE pbCtrlSignals;    /*pointer to structure with control signals     */
  18114.    HFILE hDevice;          /*device handle                                 */
  18115.  
  18116.    The ASYNC_SETMODEMCTRL function sets the modem-control signals. This
  18117.    function turns on or off the data-terminal-ready (DTR) and
  18118.    ready-to-transmit (RTS) signals (initially, the DTR and RTS signals are
  18119.    turned off).
  18120.  
  18121.  Parameters
  18122.  
  18123.    pfCommErr  Points to the variable that receives the communication status
  18124.    of the device. This variable can be a combination of the following values:
  18125.  
  18126.    Value                   Meaning
  18127.    ──────────────────────────────────────────────────────────────────────────
  18128.    RX_QUE_OVERRUN          Receive queue overrun. There is no room in the
  18129.                            device driver receive queue to put a character
  18130.                            read in from the receive hardware.
  18131.  
  18132.    RX_HARDWARE_OVERRUN     Receive hardware overrun. A character arrived
  18133.                            before the previous character was completely read.
  18134.                            The previous character is lost.
  18135.  
  18136.    PARITY_ERROR            The hardware detected a parity error.
  18137.  
  18138.    FRAMING_ERROR           The hardware detected a framing error.
  18139.    ──────────────────────────────────────────────────────────────────────────
  18140.  
  18141.    The function sets the variable to zero if it encounters an error.
  18142.  
  18143.    pbCtrlSignals  Points to the MODEMSTATUS structure that contains the
  18144.    settings for the modem-control signals. The MODEMSTATUS structure has the
  18145.    following form:
  18146.  
  18147.    typedef struct _MODEMSTATUS {
  18148.        BYTE fbModemOn;
  18149.        BYTE fbModemOff;
  18150.    } MODEMSTATUS;
  18151.  
  18152.    For a full description, see Chapter 4, "Types, Macros, Structures."
  18153.  
  18154.    hDevice  Identifies the serial device that receives the device-control
  18155.    function. The handle must have been created previously by using the
  18156.    DosOpen function.
  18157.  
  18158.  Return Value
  18159.  
  18160.    The return value is zero if the function is successful or an error value
  18161.    if the specified signal settings are invalid. When an error occurs, the
  18162.    signal settings remain unchanged.
  18163.  
  18164.  Comments
  18165.  
  18166.    This function must not be used to enable or disable the DTR or RTS signal
  18167.    if the signal is being used for input handshaking or toggling on transmit.
  18168.    Any attempt to do so will cause a "general failure" error.
  18169.  
  18170.    Although the function copies the communication error status to the
  18171.    variable pointed to by the pfCommErr parameter, it does not clear the
  18172.    error.
  18173.  
  18174.    If the serial device is opened after having been closed, the DTR and RTS
  18175.    signals are set to the values specified by the DTR control mode and the
  18176.    RTS control mode, respectively. For a full description, see the
  18177.    ASYNC_SETDCBINFO function (0x0001,0x0053).
  18178.  
  18179.    After a serial device has been closed, the device driver turns off the DTR
  18180.    and RTS signals, but only after the device has transmitted all data and
  18181.    has waited for at least as long as it would take to transmit 10 additional
  18182.    characters.
  18183.  
  18184.  See Also
  18185.  
  18186.    DosOpen, ASYNC_GETMODEMINPUT, ASYNC_GETMODEMOUTPUT
  18187.  
  18188.  
  18189.  ────────────────────────────────────────────────────────────────────────────
  18190.  ASYNC_STARTTRANSMIT
  18191.  ────────────────────────────────────────────────────────────────────────────
  18192.    USHORT DosDevIOCtl (0L, 0L, 0x0048, 0x0001, hDevice)
  18193.    HFILE hDevice;          /*device handle                                 */
  18194.  
  18195.    The ASYNC_STARTTRANSMIT function starts transmission. This function allows
  18196.    data transmission to be resumed by the device driver if data transmission
  18197.    is halted due to the ASYNC_STOPTRANSMIT function (0x0001,0x0047) or due to
  18198.    an XOFF character being received while the device driver is in automatic
  18199.    transmit flow control mode. This function is similar to the device
  18200.    receiving the XON character.
  18201.  
  18202.  Parameters
  18203.  
  18204.    hDevice  Identifies the serial device that receives the device-control
  18205.    function. The handle must have been created previously by using the
  18206.    DosOpen function.
  18207.  
  18208.  Return Value
  18209.  
  18210.    The return value is zero if the function is successful or an error value
  18211.    if an error occurs.
  18212.  
  18213.  Comments
  18214.  
  18215.    There may be other reasons why transmission is disabled; transmission may
  18216.    not be resumed. For more information, see the ASYNC_GETCOMMSTATUS
  18217.    function (0x0001,0x0064).
  18218.  
  18219.  See Also
  18220.  
  18221.    DosOpen, ASYNC_GETCOMMSTATUS , ASYNC_STOPTRANSMIT
  18222.  
  18223.  
  18224.  ────────────────────────────────────────────────────────────────────────────
  18225.  ASYNC_STOPTRANSMIT
  18226.  ────────────────────────────────────────────────────────────────────────────
  18227.    USHORT DosDevIOCtl (0L, 0L, 0x0047, 0x0001, hDevice)
  18228.    HFILE hDevice;          /*device handle                                 */
  18229.  
  18230.    The ASYNC_STOPTRANSMIT function stops the device from transmitting. This
  18231.    function stops data transmission by preventing the device driver from
  18232.    sending additional data to the transmit hardware. This function is similar
  18233.    to the device receiving the XOFF character.
  18234.  
  18235.  Parameters
  18236.  
  18237.    hDevice  Identifies the serial device that receives the device-control
  18238.    function. The handle must have been created previously by using the
  18239.    DosOpen function.
  18240.  
  18241.  Return Value
  18242.  
  18243.    The return value is zero if the function is successful or an error value
  18244.    if an error occurs.
  18245.  
  18246.  Comments
  18247.  
  18248.    If automatic-transmission control is enabled, this request causes the
  18249.    device driver to behave exactly as if it received the XOFF character.
  18250.    Transmission can be resumed if an XON character is received by the device
  18251.    driver, if an ASYNC_STARTTRANSMIT (0x0001,0x0048) function is received, or
  18252.    if the device driver is told to disable automatic-transmission control and
  18253.    in the previous state automatic-transmission control was enabled.
  18254.  
  18255.    If automatic-transmission control is disabled, the ASYNC_STARTTRANSMIT
  18256.    function (0x0001,0x0048) must be called for transmission to resume. If,
  18257.    after this request is received, the device driver is told to enable
  18258.    automatic-transmission control, transmission is still disabled. It can be
  18259.    re-enabled by any of the scenarios discussed above.
  18260.  
  18261.    There still may be other reasons why transmission may be disabled. For
  18262.    more information, see the ASYNC_GETCOMMSTATUS function (0x0001,0x0064).
  18263.  
  18264.  See Also
  18265.  
  18266.    DosOpen, ASYNC_GETCOMMSTATUS , ASYNC_STARTTRANSMIT
  18267.  
  18268.  
  18269.  ────────────────────────────────────────────────────────────────────────────
  18270.  ASYNC_TRANSMITIMM
  18271.  ────────────────────────────────────────────────────────────────────────────
  18272.    USHORT DosDevIOCtl (0L, pbChar, 0x0044, 0x0001, hDevice)
  18273.    PBYTE pbChar;           /*pointer to character                          */
  18274.    FILE hDevice;           /*device handle                                 */
  18275.  
  18276.    The ASYNC_TRANSMITIMM function transmits the specified byte immediately.
  18277.  
  18278.  Parameters
  18279.  
  18280.    pbChar  Points to the character to be transmitted.
  18281.  
  18282.    hDevice  Identifies the serial device that receives the device-control
  18283.    function. The handle must have been created previously by using the
  18284.    DosOpen function.
  18285.  
  18286.  Return Value
  18287.  
  18288.    The return value is zero if the function is successful or an error value
  18289.    if an error occurs.
  18290.  
  18291.  Comments
  18292.  
  18293.    The device driver queues the character as the next character to be
  18294.    transmitted even if there are already characters in the transmit queue.
  18295.  
  18296.    If automatic-receiving control is enabled, an XON or XOFF character may be
  18297.    transmitted before the requested character.
  18298.  
  18299.    The function always returns before the character is actually transmitted.
  18300.  
  18301.    If a character is already waiting to be transmitted immediately, the
  18302.    function returns an error. The ASYNC_GETCOMMSTATUS function
  18303.    (0x0001,0x0064) can be used to determine whether a character is currently
  18304.    waiting to be transmitted immediately.
  18305.  
  18306.    The device driver will not immediately transmit the character that is
  18307.    waiting to be transmitted immediately if the device driver is not
  18308.    transmitting characters due to modem-control signal-output handshaking or
  18309.    if the device driver is currently transmitting a break.
  18310.  
  18311.    If the device driver is not transmitting characters due to automatic
  18312.    transmission or receiving control (XON/XOFF) being enabled or due to
  18313.    operating as if an XOFF character had been received, the device driver
  18314.    still transmits a character that is waiting to be transmitted immediately
  18315.    due to this request. An application that requests that the device driver
  18316.    transmit a character immediately if automatic transmission or receiving
  18317.    control is enabled may cause unexpected results to happen to the
  18318.    communications line flow control protocol.
  18319.  
  18320.    This function is generally used to manually send XON and XOFF characters.
  18321.  
  18322.    The character waiting to be transmitted immediately is not considered part
  18323.    of the device driver transmit queue and is not flushed due to a flush
  18324.    request. XON/XOFF characters that are automatically transmitted due to
  18325.    automatic-receiving control may or may not be placed ahead of the
  18326.    character waiting to be transmitted immediately. Applications should not
  18327.    be dependent on this ordering.
  18328.  
  18329.  See Also
  18330.  
  18331.    DosOpen, ASYNC_GETCOMMSTATUS
  18332.  
  18333.  
  18334.  ────────────────────────────────────────────────────────────────────────────
  18335.  DEV_FLUSHINPUT
  18336.  ────────────────────────────────────────────────────────────────────────────
  18337.    USHORT DosDevIOCtl (0L, pbCommand, 0x0001, 0x000B, hDevice)
  18338.    PBYTE pbCommand;        /*pointer to variable with command              */
  18339.    HFILE hDevice;          /*device handle                                 */
  18340.  
  18341.    The DEV_FLUSHINPUT function flushes the input buffer.
  18342.  
  18343.  Parameters
  18344.  
  18345.    pbCommand  Points to the variable that contains a reserved value. This
  18346.    value must be zero.
  18347.  
  18348.    hDevice  Identifies the device that receives the device-control function.
  18349.    The handle must have been created previously by using the DosOpen
  18350.    function.
  18351.  
  18352.  Return Value
  18353.  
  18354.    The return value is zero if the function is successful or an error value
  18355.    if an error occurs.
  18356.  
  18357.  See Also
  18358.  
  18359.    DosOpen, DEV_FLUSHOUTPUT
  18360.  
  18361.  
  18362.  ────────────────────────────────────────────────────────────────────────────
  18363.  DEV_FLUSHOUTPUT
  18364.  ────────────────────────────────────────────────────────────────────────────
  18365.    USHORT DosDevIOCtl (0L, pbCommand, 0x0002, 0x000B, hDevice)
  18366.    PBYTE pbCommand;        /*pointer to variable with command              */
  18367.    HFILE hDevice;          /*device handle                                 */
  18368.  
  18369.    The DEV_FLUSHOUTPUT function flushes the output buffer.
  18370.  
  18371.  Parameters
  18372.  
  18373.    pbCommand  Points to the variable that contains a reserved value. This
  18374.    value must be zero.
  18375.  
  18376.    hDevice  Identifies the device that receives the device-control function.
  18377.    The handle must have been created previously by using the DosOpen
  18378.    function.
  18379.  
  18380.  Return Value
  18381.  
  18382.    The return value is zero if the function is successful or an error value
  18383.    if an error occurs.
  18384.  
  18385.  See Also
  18386.  
  18387.    DosOpen, DEV_FLUSHINPUT
  18388.  
  18389.  
  18390.  ────────────────────────────────────────────────────────────────────────────
  18391.  DEV_QUERYMONSUPPORT
  18392.  ────────────────────────────────────────────────────────────────────────────
  18393.    USHORT DosDevIOCtl (0L, pbCommand, 0x0060, 0x000B, hDevice)
  18394.    PBYTE pbCommand;        /*pointer to variable with command              */
  18395.    HFILE hDevice;          /*device handle                                 */
  18396.  
  18397.    The DEV_QUERYMONSUPPORT function queries a device driver for monitor
  18398.    support.
  18399.  
  18400.  Parameters
  18401.  
  18402.    pbCommand  Points to the variable that contains a reserved value. This
  18403.    value must be zero.
  18404.  
  18405.    hDevice  Identifies the device that receives the device-control function.
  18406.    The handle must have been created previously by using the DosOpen
  18407.    function.
  18408.  
  18409.  Return Value
  18410.  
  18411.    The return value is zero if the device supports character monitors or an
  18412.    error value if an error occurs.
  18413.  
  18414.  See Also
  18415.  
  18416.    DosOpen
  18417.  
  18418.  
  18419.  ────────────────────────────────────────────────────────────────────────────
  18420.  DSK_BLOCKREMOVABLE
  18421.  ────────────────────────────────────────────────────────────────────────────
  18422.    USHORT DosDevIOCtl (pfNonRemovable, pbCommand, 0x0020, 0x0008, hDevice)
  18423.    PBYTE pfNonRemovable;   /*pointer to removable/nonremovable flag        */
  18424.    PBYTE pbCommand;        /*pointer to variable with command              */
  18425.    HFILE hDevice;          /*device handle                                 */
  18426.  
  18427.    The DSK_BLOCKREMOVABLE function indicates whether the block device is
  18428.    removable.
  18429.  
  18430.  Parameters
  18431.  
  18432.    pfNonRemovable  Points to the variable that receives the medium type. This
  18433.    variable is 0x0000 if the medium is removable or 0x0001 if it is
  18434.    nonremovable.
  18435.  
  18436.    pbCommand  Points to the variable that contains a reserved value. This
  18437.    value must be zero.
  18438.  
  18439.    hDevice  Identifies the disk-drive that receives the device-control
  18440.    function. The handle must have been created previously by using the
  18441.    DosOpen function.
  18442.  
  18443.  Return Value
  18444.  
  18445.    The return value is zero if the function is successful or an error value
  18446.    if an error occurs.
  18447.  
  18448.  See Also
  18449.  
  18450.    DosOpen
  18451.  
  18452.  
  18453.  ────────────────────────────────────────────────────────────────────────────
  18454.  DSK_FORMATVERIFY
  18455.  ────────────────────────────────────────────────────────────────────────────
  18456.    USHORT DosDevIOCtl (0L, pbCommand, 0x0045, 0x0008, hDevice)
  18457.    PBYTE pbCommand;        /*pointer to structure with command             */
  18458.    HFILE hDevice;          /*device handle                                 */
  18459.  
  18460.    The DSK_FORMATVERIFY function formats and verifies a track on a disk drive
  18461.    according to the information passed in the format table. The format table
  18462.    is passed to the controller and the controller performs whatever
  18463.    operations are necessary for formatting.
  18464.  
  18465.  Parameters
  18466.  
  18467.    pbCommand  Points to the TRACKFORMAT structure that contains information
  18468.    about the format operation. The TRACKFORMAT structure has the following
  18469.    form:
  18470.  
  18471.    typedef struct _TRACKFORMAT {
  18472.        BYTE bCommand;
  18473.        USHORT head;
  18474.        USHORT cylinder;
  18475.        USHORT reserved;
  18476.        USHORT cSectors;
  18477.        struct {
  18478.            BYTE bCylinder;
  18479.            BYTE bHead;
  18480.            BYTE idSector;
  18481.            BYTE bBytesSector;
  18482.        } FormatTable[1];
  18483.    } TRACKFORMAT;
  18484.  
  18485.    For a full description, see Chapter 4, "Types, Macros, Structures."
  18486.  
  18487.    hDevice  Identifies the disk-drive that receives the device-control
  18488.    function. The handle must have been created previously by using the
  18489.    DosOpen function.
  18490.  
  18491.  Return Value
  18492.  
  18493.    The return value is zero if the function is successful or an error value
  18494.    if an error occurs.
  18495.  
  18496.  Comments
  18497.  
  18498.    Some controllers do not support formatting tracks with varying sector
  18499.    sizes. The program must make sure that the sector sizes specified in the
  18500.    format table are all the same.
  18501.  
  18502.  See Also
  18503.  
  18504.    DosOpen
  18505.  
  18506.  
  18507.  ────────────────────────────────────────────────────────────────────────────
  18508.  DSK_GETDEVICEPARAMS
  18509.  ────────────────────────────────────────────────────────────────────────────
  18510.    USHORT DosDevIOCtl (pbBPB, pbCommand, 0x0063, 0x0008, hDevice)
  18511.    PBYTE pbBPB;            /*pointer to structure for BIOS parameter       */
  18512.                            /*blocks                                        */
  18513.    PBYTE pbCommand;        /*pointer to variable with command              */
  18514.    HFILE hDevice;          /*device handle                                 */
  18515.  
  18516.    The DSK_GETDEVICEPARAMS function retrieves the device parameters for an MS
  18517.    OS/2 block device. The device driver maintains two BIOS parameter blocks
  18518.    (BPB) for each disk drive. One block corresponds to the medium currently
  18519.    in the disk drive. The other is a recommended BPB, based on the type of
  18520.    medium that corresponds to the physical device. For example, a
  18521.    high-density disk drive has a BPB for a 96 tracks-per-inch (tpi) floppy
  18522.    disk; a low-density disk drive has a BPB for a 48-tpi floppy disk.
  18523.  
  18524.  Parameters
  18525.  
  18526.    pbBPB  Points to the BIOSPARAMETERBLOCK structure that receives the BPB.
  18527.    The BIOSPARAMETERBLOCK structure has the following form:
  18528.  
  18529.    typedef struct _BIOSPARAMETERBLOCK {
  18530.        USHORT usBytesPerSector;
  18531.        BYTE   bSectorsPerCluster;
  18532.        USHORT usReservedSectors;
  18533.        BYTE   cFATs;
  18534.        USHORT cRootEntries;
  18535.        USHORT cSectors;
  18536.        BYTE   bMedia;
  18537.        USHORT usSectorsPerFAT;
  18538.        USHORT usSectorsPerTrack;
  18539.        USHORT cHeads;
  18540.        ULONG  cHiddenSectors;
  18541.        ULONG  cLargeSectors;
  18542.        USHORT cCylinders;
  18543.        BYTE   bDeviceType;
  18544.        USHORT fDeviceAttr;
  18545.    } BIOSPARAMETERBLOCK;
  18546.  
  18547.    For a full description, see Chapter 4, "Types, Macros, Structures."
  18548.  
  18549.    pbCommand  Points to the variable that specifies which BPB to retrieve. If
  18550.    the variable is 0x0000, the function retrieves the recommended BPB for the
  18551.    drive (the BPB for the physical device). If the variable is 0x0001, the
  18552.    function retrieves the BPB for the medium currently in the drive.
  18553.  
  18554.    hDevice  Identifies the disk drive that receives the device-control
  18555.    function. The handle must have been created previously by using the
  18556.    DosOpen function.
  18557.  
  18558.  Return Value
  18559.  
  18560.    The return value is zero if the function is successful or an error value
  18561.    if an error occurs.
  18562.  
  18563.  See Also
  18564.  
  18565.    DosOpen, DSK_SETDEVICEPARAMS
  18566.  
  18567.  
  18568.  ────────────────────────────────────────────────────────────────────────────
  18569.  DSK_GETLOGICALMAP
  18570.  ────────────────────────────────────────────────────────────────────────────
  18571.    USHORT DosDevIOCtl (pbDrive, pbCommand, 0x0021, 0x0008, hDevice)
  18572.    PBYTE pbDrive;          /*pointer to variable for drive number          */
  18573.    PBYTE pbCommand;        /*pointer to variable with command              */
  18574.    HFILE hDevice;          /*device handle                                 */
  18575.  
  18576.    The DSK_GETLOGICALMAP function retrieves the mapping of a logical drive.
  18577.  
  18578.  Parameters
  18579.  
  18580.    pbDrive  Points to the variable that receives the logical-drive number.
  18581.    This can be 1 for drive A, 2 for drive B, and so on. The function sets the
  18582.    variable to zero if only one logical drive is mapped to the physical
  18583.    drive.
  18584.  
  18585.    pbCommand  Points to a variable that contains a reserved value. The value
  18586.    must be zero.
  18587.  
  18588.    hDevice  Identifies the physical device that receives the device-control
  18589.    function. The handle must have been created previously by using the
  18590.    DosOpen function.
  18591.  
  18592.  Return Value
  18593.  
  18594.    The return value is zero if the function is successful or an error value
  18595.    if an error occurs.
  18596.  
  18597.  See Also
  18598.  
  18599.    DosOpen, DSK_SETLOGICALMAP
  18600.  
  18601.  
  18602.  ────────────────────────────────────────────────────────────────────────────
  18603.  DSK_LOCKDRIVE
  18604.  ────────────────────────────────────────────────────────────────────────────
  18605.    USHORT DosDevIOCtl (0L, pbCommand, 0x0000, 0x0008, hDevice)
  18606.    PBYTE pbCommand;        /*pointer to variable with command              */
  18607.    HFILE hDevice;          /*device handle                                 */
  18608.  
  18609.    The DSK_LOCKDRIVE function locks a disk drive, preventing file I/O by
  18610.    another process on the volume in the disk drive. This function succeeds if
  18611.    there is only one file handle open on the volume in the disk drive because
  18612.    the desired result is to exclude all other I/O to the volume.
  18613.  
  18614.  Parameters
  18615.  
  18616.    pbCommand  Points to the variable that contains a reserved value. The
  18617.    value must be zero.
  18618.  
  18619.    hDevice  Identifies the disk drive that receives the device-control
  18620.    function. The handle must have been created previously by using the
  18621.    DosOpen function.
  18622.  
  18623.  Return Value
  18624.  
  18625.    The return value is zero if the function is successful or an error value
  18626.    if an error occurs.
  18627.  
  18628.  See Also
  18629.  
  18630.    DosOpen, DSK_UNLOCKDRIVE
  18631.  
  18632.  
  18633.  ────────────────────────────────────────────────────────────────────────────
  18634.  DSK_READTRACK
  18635.  ────────────────────────────────────────────────────────────────────────────
  18636.    USHORT DosDevIOCtl (pbBuffer, pbCommand, 0x0064, 0x0008, hDevice)
  18637.    PBYTE pbBuffer;         /*pointer to buffer for data                    */
  18638.    PBYTE pbCommand;        /*pointer to structure with command             */
  18639.    HFILE hDevice;          /*device handle                                 */
  18640.  
  18641.    The DSK_READTRACK function reads from a track on a specified disk drive.
  18642.    The track table passed in the call determines the sector number, which is
  18643.    passed to the disk controller for the operation. When the sectors are
  18644.    odd-numbered or nonconsecutive, the request is broken into an appropriate
  18645.    number of single-sector operations, and one sector at a time is read.
  18646.  
  18647.  Parameters
  18648.  
  18649.    pbBuffer  Points to the buffer that receives data read from the track.
  18650.  
  18651.    pbCommand  Points to the TRACKLAYOUT structure that contains the
  18652.    information about the read operation. The TRACKLAYOUT structure has the
  18653.    following form:
  18654.  
  18655.    typedef struct _TRACKLAYOUT {
  18656.        BYTE   bCommand;
  18657.        USHORT head;
  18658.        USHORT cylinder;
  18659.        USHORT firstSector;
  18660.        USHORT cSectors;
  18661.        struct {
  18662.            USHORT sectorNumber;
  18663.            USHORT sectorSize;
  18664.        } TrackTable[1];
  18665.    } TRACKLAYOUT;
  18666.  
  18667.    For a full description, see Chapter 4, "Types, Macros, Structures."
  18668.  
  18669.    hDevice  Identifies the disk drive that receives the device-control
  18670.    function. The handle must have been created previously by using the
  18671.    DosOpen function.
  18672.  
  18673.  Return Value
  18674.  
  18675.    The return value is zero if the function is successful or an error value
  18676.    if an error occurs.
  18677.  
  18678.  Comments
  18679.  
  18680.    The device driver will not correctly read sectors of sizes other than 512
  18681.    bytes if reading would generate a direct-memory-access (DMA) violation
  18682.    error. Programs must ensure that this error does not occur.
  18683.  
  18684.  See Also
  18685.  
  18686.    DosOpen, DSK_WRITETRACK
  18687.  
  18688.  
  18689.  ────────────────────────────────────────────────────────────────────────────
  18690.  DSK_REDETERMINEMEDIA
  18691.  ────────────────────────────────────────────────────────────────────────────
  18692.    USHORT DosDevIOCtl (0L, pbCommand, 0x0002, 0x0008, hDevice)
  18693.    PBYTE pbCommand;        /*pointer to variable with command              */
  18694.    HFILE hDevice;          /*device handle                                 */
  18695.  
  18696.    The DSK_REDETERMINEMEDIA function redetermines the media on a block device
  18697.    and updates the volume in the drive. This function is normally issued
  18698.    after the volume identification information has been changed (for example,
  18699.    by formatting the disk). This function should be called only if the volume
  18700.    is locked.
  18701.  
  18702.  Parameters
  18703.  
  18704.    pbCommand  Points to the variable that contains a reserved value. The
  18705.    value must be zero.
  18706.  
  18707.    hDevice  Identifies the disk drive that receives the device-control
  18708.    function. The handle must have been created previously by using the
  18709.    DosOpen function.
  18710.  
  18711.  Return Value
  18712.  
  18713.    The return value is zero if the function is successful or an error value
  18714.    if an error occurs.
  18715.  
  18716.  See Also
  18717.  
  18718.    DosOpen
  18719.  
  18720.  
  18721.  ────────────────────────────────────────────────────────────────────────────
  18722.  DSK_SETDEVICEPARAMS
  18723.  ────────────────────────────────────────────────────────────────────────────
  18724.    USHORT DosDevIOCtl (pbBPB, pbCommand, 0x0043, 0x0008, hDevice)
  18725.    PBYTE pbBPB;            /*pointer to structure with BIOS parameter      */
  18726.                            /*blocks                                        */
  18727.    PBYTE pbCommand;        /*pointer to buffer with command                */
  18728.    HFILE hDevice;          /*device handle                                 */
  18729.  
  18730.    The DSK_SETDEVICEPARAMS function sets the device parameters for an MS OS/2
  18731.    block device. The device driver maintains two BIOS parameter blocks (BPB)
  18732.    for each disk drive. One block is the BPB that corresponds to the medium
  18733.    currently in the disk drive. The other block is a recommended BPB, based
  18734.    on the type of medium that corresponds to the physical device. For
  18735.    example, a high-density disk drive has a BPB for a 96 tracks per inch
  18736.    (tpi) floppy disk; a low-density disk drive has a BPB for a 48-tpi floppy
  18737.    disk.
  18738.  
  18739.  Parameters
  18740.  
  18741.    pbBPB  Points to the BIOSPARAMETERBLOCK structure that contains the device
  18742.    parameters to be set for the drive. The BIOSPARAMETERBLOCK structure has
  18743.    the following form:
  18744.  
  18745.    typedef struct _BIOSPARAMETERBLOCK {
  18746.        USHORT usBytesPerSector;
  18747.        BYTE   bSectorsPerCluster;
  18748.        USHORT usReservedSectors;
  18749.        BYTE   cFATs;
  18750.        USHORT cRootEntries;
  18751.        USHORT cSectors;
  18752.        BYTE   bMedia;
  18753.        USHORT usSectorsPerFAT;
  18754.        USHORT usSectorsPerTrack;
  18755.        USHORT cHeads;
  18756.        ULONG  cHiddenSectors;
  18757.        ULONG  cLargeSectors;
  18758.        USHORT cCylinders;
  18759.        BYTE   bDeviceType;
  18760.        USHORT fDeviceAttr;
  18761.    } BIOSPARAMETERBLOCK;
  18762.  
  18763.    For a full description, see Chapter 4, "Types, Macros, Structures."
  18764.  
  18765.    pbCommand  Point to the variable that contains the command description.
  18766.    This variable can be one of the following values:
  18767.  
  18768.    Value                     Meaning
  18769.    ──────────────────────────────────────────────────────────────────────────
  18770.    BUILD_BPB_FROM_MEDIUM     Build the BIOS parameter block (BPB) from the
  18771.                              medium for all subsequent build BPB requests.
  18772.  
  18773.    REPLACE_BPB_FOR_DEVICE    Change the default BPB for the physical device.
  18774.  
  18775.    REPLACE_BPB_FOR_MEDIUM    Change the BPB for the medium to the specified
  18776.                              BPB. Return the new BPB as the BPB for the
  18777.                              medium for all subsequent build BPB requests.
  18778.    ──────────────────────────────────────────────────────────────────────────
  18779.  
  18780.    hDevice  Identifies the disk drive that receives the device-control
  18781.    function. The handle must have been created previously by using the
  18782.    DosOpen function.
  18783.  
  18784.  Return Value
  18785.  
  18786.    The return value is zero if the function is successful or an error value
  18787.    if an error occurs.
  18788.  
  18789.  See Also
  18790.  
  18791.    DosOpen, DSK_GETDEVICEPARAMS
  18792.  
  18793.  
  18794.  ────────────────────────────────────────────────────────────────────────────
  18795.  DSK_SETLOGICALMAP
  18796.  ────────────────────────────────────────────────────────────────────────────
  18797.    USHORT DosDevIOCtl (pbDrive, pbCommand, 0x0003, 0x0008, hDevice)
  18798.    PBYTE pbDrive;          /*pointer to variable with drive number         */
  18799.    PBYTE pbCommand;        /*pointer to variable with command              */
  18800.    HFILE hDevice;          /*device handle                                 */
  18801.  
  18802.    The DSK_SETLOGICALMAP function sets the logical-drive mapping for a block
  18803.    device.
  18804.  
  18805.  Parameters
  18806.  
  18807.    pbDrive  Points to the variable that contains the logical-drive number.
  18808.    This can be 1 for drive A, 2 for drive B, and so on. When the function
  18809.    returns, it copies the specified drive's current logical-drive number to
  18810.    the variable. If only one logical device is mapped to the physical drive,
  18811.    the function sets the variable to zero.
  18812.  
  18813.    pbCommand  Points to the variable that contains a reserved value. The
  18814.    value must be zero.
  18815.  
  18816.    hDevice  Identifies the disk drive that receives the device-control
  18817.    function. The handle must have been created previously by using the
  18818.    DosOpen function.
  18819.  
  18820.  Return Value
  18821.  
  18822.    The return value is zero if the function is successful or an error value
  18823.    if an error occurs.
  18824.  
  18825.  See Also
  18826.  
  18827.    DosOpen, DSK_GETLOGICALMAP
  18828.  
  18829.  
  18830.  ────────────────────────────────────────────────────────────────────────────
  18831.  DSK_UNLOCKDRIVE
  18832.  ────────────────────────────────────────────────────────────────────────────
  18833.    USHORT DosDevIOCtl (0L, pbCommand, 0x0001, 0x0008, hDevice)
  18834.    PBYTE pbCommand;        /*pointer to variable with command              */
  18835.    HFILE hDevice;          /*device handle                                 */
  18836.  
  18837.    The DSK_UNLOCKDRIVE function unlocks a drive. The drive requires the
  18838.    locked volume represented by the handle.
  18839.  
  18840.  Parameters
  18841.  
  18842.    pbCommand  Points to the variable that contains a reserved value. The
  18843.    value must be zero.
  18844.  
  18845.    hDevice  Identifies the disk drive that receives the device-control
  18846.    function. The handle must have been created previously by using the
  18847.    DosOpen function.
  18848.  
  18849.  Return Value
  18850.  
  18851.    The return value is zero if the function is successful or an error value
  18852.    if an error occurs.
  18853.  
  18854.  See Also
  18855.  
  18856.    DosOpen, DSK_LOCKDRIVE
  18857.  
  18858.  
  18859.  ────────────────────────────────────────────────────────────────────────────
  18860.  DSK_VERIFYTRACK
  18861.  ────────────────────────────────────────────────────────────────────────────
  18862.    USHORT DosDevIOCtl (0L, pbCommand, 0x0065, 0x0008, hDevice)
  18863.    PBYTE pbCommand;        /*pointer to structure with command             */
  18864.    HFILE hDevice;          /*device handle                                 */
  18865.  
  18866.    The DSK_VERIFYTRACK function verifies an operation on a specified disk
  18867.    drive.
  18868.  
  18869.  Parameters
  18870.  
  18871.    pbCommand  Points to the TRACKLAYOUT structure that contains information
  18872.    about the verification operation. The TRACKLAYOUT structure has the
  18873.    following form:
  18874.  
  18875.    typedef struct _TRACKLAYOUT {
  18876.        BYTE   bCommand;
  18877.        USHORT head;
  18878.        USHORT cylinder;
  18879.        USHORT firstSector;
  18880.        USHORT cSectors;
  18881.        struct {
  18882.            USHORT sectorNumber;
  18883.            USHORT sectorSize;
  18884.        } TrackTable[1];
  18885.    } TRACKLAYOUT;
  18886.  
  18887.    For a full description, see Chapter 4, "Types, Macros, Structures."
  18888.  
  18889.    hDevice  Identifies the disk drive that receives the device-control
  18890.    function. The handle must have been created previously by using the
  18891.    DosOpen function.
  18892.  
  18893.  Return Value
  18894.  
  18895.    The return value is zero if the function is successful or an error value
  18896.    if an error occurs.
  18897.  
  18898.  Comments
  18899.  
  18900.    The track-layout table passed in the function determines the sector
  18901.    number, which is passed to the disk controller. When the sectors are
  18902.    odd-numbered or nonconsecutive, the request is broken into an appropriate
  18903.    number of single-sector operations, and one sector at a time is verified.
  18904.  
  18905.  See Also
  18906.  
  18907.    DosOpen, DSK_READTRACK, PDSK_VERIFYPHYSTRACK, DSK_WRITETRACK
  18908.  
  18909.  
  18910.  ────────────────────────────────────────────────────────────────────────────
  18911.  DSK_WRITETRACK
  18912.  ────────────────────────────────────────────────────────────────────────────
  18913.    USHORT DosDevIOCtl (pbBuffer, pbCommand, 0x0044, 0x0008, hDevice)
  18914.    PBYTE pbBuffer;         /*pointer to buffer with data                   */
  18915.    PBYTE pbCommand;        /*pointer to structure with command             */
  18916.    HFILE hDevice;          /*device handle                                 */
  18917.  
  18918.    The DSK_WRITETRACK function writes to a track on a specified disk drive.
  18919.  
  18920.  Parameters
  18921.  
  18922.    pbBuffer  Points to the buffer that contains the data to be written.
  18923.  
  18924.    pbCommand  Points to the TRACKLAYOUT structure that contains information
  18925.    about the write operation. The TRACKLAYOUT structure has the following
  18926.    form:
  18927.  
  18928.    typedef struct _TRACKLAYOUT {
  18929.        BYTE   bCommand;
  18930.        USHORT head;
  18931.        USHORT cylinder;
  18932.        USHORT firstSector;
  18933.        USHORT cSectors;
  18934.        struct {
  18935.            USHORT sectorNumber;
  18936.            USHORT sectorSize;
  18937.        } TrackTable[1];
  18938.    } TRACKLAYOUT;
  18939.  
  18940.    For a full description, see Chapter 4, "Types, Macros, Structures."
  18941.  
  18942.    hDevice  Identifies the disk drive that receives the device-control
  18943.    function. The handle must have been created previously by using the
  18944.    DosOpen function.
  18945.  
  18946.  Return Value
  18947.  
  18948.    The return value is zero if the function is successful or an error value
  18949.    if an error occurs.
  18950.  
  18951.  Comments
  18952.  
  18953.    The track-layout table passed in the function determines the sector
  18954.    number, which is passed to the disk controller. When the sectors are
  18955.    odd-numbered or nonconsecutive, the request is broken into an appropriate
  18956.    number of single-sector operations, and one sector at a time is written.
  18957.  
  18958.  See Also
  18959.  
  18960.    DosOpen, DSK_READTRACK, PDSK_READPHYSTRACK, PDSK_WRITEPHYSTRACK
  18961.  
  18962.  
  18963.  ────────────────────────────────────────────────────────────────────────────
  18964.  KBD_CREATE
  18965.  ────────────────────────────────────────────────────────────────────────────
  18966.    USHORT DosDevIOCtl (0L, pbCommand, 0x005D, 0x0004, hDevice)
  18967.    PBYTE pbCommand;        /*pointer to buffer with handle and pid         */
  18968.    HFILE hDevice;          /*device handle                                 */
  18969.  
  18970.    The KBD_CREATE function allocates memory for a logical keyboard (KCB).
  18971.    This function obtains physical memory for a new logical keyboard. The
  18972.    process ID and a logical-keyboard handle passed by the caller stored in
  18973.    allocated memory for use later by the KBD_SETKCB function. A logical
  18974.    keyboard is not created if the handle is zero.
  18975.  
  18976.  Parameters
  18977.  
  18978.    pbCommand  Points to the buffer that contains the value to use as the
  18979.    logical-keyboard handle and the code-page identifier to use with the
  18980.    logical keyboard.
  18981.  
  18982.    hDevice  Identifies the keyboard that receives the device-control
  18983.    function. The handle must have been created previously by using the
  18984.    DosOpen function.
  18985.  
  18986.  Return Value
  18987.  
  18988.    The return value is zero if the function is successful or an error value
  18989.    if the logical keyboard cannot be created.
  18990.  
  18991.  See Also
  18992.  
  18993.    KBD_SETKCB, KBD_DESTROY
  18994.  
  18995.  
  18996.  ────────────────────────────────────────────────────────────────────────────
  18997.  KBD_DESTROY
  18998.  ────────────────────────────────────────────────────────────────────────────
  18999.    USHORT DosDevIOCtl (0L, pbCommand, 0x005E, 0x0004, hDevice)
  19000.    PBYTE pbCommand;        /*pointer to buffer with handle and pid         */
  19001.    HFILE hDevice;          /*device handle                                 */
  19002.  
  19003.    The KBD_DESTROY function frees memory for a logical keyboard (KCB). This
  19004.    function searches for the existing logical keyboard that has the specified
  19005.    logical-keyboard handle and process ID combination and frees the physical
  19006.    memory associated with the logical keyboard. No action is taken if the
  19007.    specified handle is zero.
  19008.  
  19009.  Parameters
  19010.  
  19011.    pbCommand  Points to the buffer that contains the logical-keyboard handle.
  19012.  
  19013.    hDevice  Identifies the keyboard that receives the device-control
  19014.    function. The handle must have been created previously by using the
  19015.    DosOpen function.
  19016.  
  19017.  Return Value
  19018.  
  19019.    The return value is zero if the function is successful or an error value
  19020.    if the logical keyboard identified by the given handle cannot be found.
  19021.  
  19022.  See Also
  19023.  
  19024.    KBD_CREATE
  19025.  
  19026.  
  19027.  ────────────────────────────────────────────────────────────────────────────
  19028.  KBD_GETCODEPAGEID
  19029.  ────────────────────────────────────────────────────────────────────────────
  19030.    USHORT DosDevIOCtl (pbCPID, 0L, 0x0078, 0x0004, hDevice)
  19031.    PBYTE pbCPID;           /*pointer to buffer for code page id            */
  19032.    HFILE hDevice;          /*device handle                                 */
  19033.  
  19034.    The KBD_GETCODEPAGEID function retrieves the identifier of the code page
  19035.    being used by the current logical keyboard.
  19036.  
  19037.  Parameters
  19038.  
  19039.    pbCPID  Points to the CPID structure that receives the code-page
  19040.    identifier. The CPID structure has the following form:
  19041.  
  19042.    typedef struct _CPID {
  19043.        USHORT idCodePage;
  19044.        USHORT Reserved;
  19045.    } CPID;
  19046.  
  19047.    For a full description, see Chapter 4, "Types, Macros, Structures."
  19048.  
  19049.    hDevice  Identifies the keyboard that receives the device-control
  19050.    function. The handle must have been created previously by using the
  19051.    DosOpen function.
  19052.  
  19053.  Return Value
  19054.  
  19055.    The return value is zero if the function is successful or an error value
  19056.    if an error occurs.
  19057.  
  19058.  Comment
  19059.  
  19060.    This function sets the identifier to zero to indicate that PC US 437 is
  19061.    being used.
  19062.  
  19063.  See Also
  19064.  
  19065.    KbdGetCp
  19066.  
  19067.  
  19068.  ────────────────────────────────────────────────────────────────────────────
  19069.  KBD_GETINPUTMODE
  19070.  ────────────────────────────────────────────────────────────────────────────
  19071.    USHORT DosDevIOCtl (pbInputMode, 0L, 0x0071, 0x0004, hDevice)
  19072.    PBYTE pbInputMode;      /*pointer to variable for input mode            */
  19073.    HFILE hDevice;          /*device handle                                 */
  19074.  
  19075.    The KBD_GETINPUTMODE function retrieves the input mode of the screen group
  19076.    of the active process. The input mode defines whether the following keys
  19077.    are processed as commands or as keystrokes: CONTROL+C,
  19078.    CONTROL+BREAK, CONTROL+S, CONTROL+P, SCROLL LOCK, PRINTSCREEN.
  19079.  
  19080.  Parameters
  19081.  
  19082.    pbInputMode  Points to the variable that receives the input mode. If the
  19083.    variable is ASCII_MODE, the keyboard has ASCII input mode. If the variable
  19084.    is BINARY_MODE, the keyboard has binary input mode.
  19085.  
  19086.    hDevice  Identifies the keyboard that receives the device-control
  19087.    function. The handle must have been created previously by using the
  19088.    DosOpen function.
  19089.  
  19090.  Return Value
  19091.  
  19092.    The return value is zero if the function is successful or an error value
  19093.    if an error occurs.
  19094.  
  19095.  See Also
  19096.  
  19097.    DosOpen, KBD_SETINPUTMODE
  19098.  
  19099.  
  19100.  ────────────────────────────────────────────────────────────────────────────
  19101.  KBD_GETINTERIMFLAG
  19102.  ────────────────────────────────────────────────────────────────────────────
  19103.    USHORT DosDevIOCtl (pfFlags, 0L, 0x0072, 0x0004, hDevice)
  19104.    PBYTE pfFlags;          /*pointer to variable for flags                 */
  19105.    HFILE hDevice;          /*device handle                                 */
  19106.  
  19107.    The KBD_GETINTERIMFLAG function retrieves interim character flags.
  19108.  
  19109.  Parameters
  19110.  
  19111.    pfFlags  Points to the variable that receives interim flags. If the
  19112.    variable is CONVERSION_REQUEST, the program requested conversion. If it is
  19113.    INTERIM_CHAR, the interim console flag is set.
  19114.  
  19115.    hDevice  Identifies the keyboard that receives the device-control
  19116.    function. The handle must have been created previously by using the
  19117.    DosOpen function.
  19118.  
  19119.  Return Value
  19120.  
  19121.    The return value is zero if the function is successful or an error value
  19122.    if an error occurs.
  19123.  
  19124.  See Also
  19125.  
  19126.    DosOpen, KBD_SETINTERIMFLAG
  19127.  
  19128.  
  19129.  ────────────────────────────────────────────────────────────────────────────
  19130.  KBD_GETKEYBDTYPE
  19131.  ────────────────────────────────────────────────────────────────────────────
  19132.    USHORT DosDevIOCtl (pbType, 0L, 0x0077, 0x0004, hDevice)
  19133.    PBYTE pbType;           /*pointer to structure for keyboard type        */
  19134.    HFILE hDevice;          /*device handle                                 */
  19135.  
  19136.    The KBD_GETKEYBDTYPE function retrieves information about the type of
  19137.    keyboard being used.
  19138.  
  19139.  Parameters
  19140.  
  19141.    pbType  Points to the KBDTYPE structure that receives the keyboard type.
  19142.    The KBDTYPE structure has the following form:
  19143.  
  19144.    typedef struct _KBDTYPE {
  19145.        USHORT usType;
  19146.        USHORT reserved1;
  19147.        USHORT reserved2;
  19148.    } KBDTYPE;
  19149.  
  19150.    For a full description, see Chapter 4, "Types, Macros, Structures."
  19151.  
  19152.    hDevice  Identifies the keyboard that receives the device-control
  19153.    function. The handle must have been created previously by using the
  19154.    DosOpen function.
  19155.  
  19156.  Return Value
  19157.  
  19158.    The return value is zero if the function is successful or an error value
  19159.    if an error occurs.
  19160.  
  19161.  See Also
  19162.  
  19163.    DosOpen
  19164.  
  19165.  
  19166.  ────────────────────────────────────────────────────────────────────────────
  19167.  KBD_GETSESMGRHOTKEY
  19168.  ────────────────────────────────────────────────────────────────────────────
  19169.    USHORT DosDevIOCtl (pbHotKeyBuf, pcHotKeys, 0x0076, 0x0004, hDevice)
  19170.    PBYTE pbHotKeyBuf;      /*pointer to structure for hot-key information  */
  19171.    PUSHORT pcHotKeys;      /*pointer to variable for hot-key count         */
  19172.    HFILE hDevice;          /*device handle                                 */
  19173.  
  19174.    The KBD_GETSESMGRHOTKEY function retrieves the hot-key information
  19175.    structures for the currently defined hot keys.
  19176.  
  19177.  Parameters
  19178.  
  19179.    pbHotKeyBuf  Points to the HOTKEY structure that receives hot-key
  19180.    information structures. The buffer must be at least as large as the number
  19181.    of structures requested. The HOTKEY structure has the following form:
  19182.  
  19183.    typedef struct _HOTKEY {
  19184.        USHORT fHotKey;
  19185.        UCHAR  scancodeMake;
  19186.        UCHAR  scancodeBreak;
  19187.        USHORT idHotKey;
  19188.    } HOTKEY;
  19189.  
  19190.    For a full description, see Chapter 4, "Types, Macros, Structures."
  19191.  
  19192.    pcHotKeys  Points to the variable that specifies the number of hot-key
  19193.    information structures to retrieve. If this variable is HOTKEY_MAX_COUNT,
  19194.    the function copies a value to the variable that specifies the maximum
  19195.    number of hot keys the keyboard device driver can support. If this
  19196.    variable is HOTKEY_CURRENT_COUNT, the function copies a value to this
  19197.    variable that specifies the actual number of hot keys currently supported.
  19198.    The function also copies the hot-key information to the buffer pointed to
  19199.    by the pbHotKeyBuf parameter.
  19200.  
  19201.    hDevice  Identifies the keyboard that receives the device-control
  19202.    function. The handle must have been created previously by using the
  19203.    DosOpen function.
  19204.  
  19205.  Return Value
  19206.  
  19207.    The return value is zero if the function is successful or an error value
  19208.    if an error occurs.
  19209.  
  19210.  Comments
  19211.  
  19212.    If the variable pointed to by pcHotKeys is HOTKEY_MAX_COUNT, the func-
  19213.    tion returns the number of currently defined hot keys. The program uses
  19214.    this number to allocate sufficient space to retrieve the actual hot-key
  19215.    information (retrieved by setting the variable to HOTKEY_CURRENT_COUNT).
  19216.  
  19217.    Programs should retrieve the number of hot keys first, allocate sufficient
  19218.    space for the buffer pointed to by the pbHotKeyBuf parameter, then
  19219.    retrieve the hot keys.
  19220.  
  19221.  See Also
  19222.  
  19223.    DosOpen, KBD_SETSESMGRHOTKEY
  19224.  
  19225.  
  19226.  ────────────────────────────────────────────────────────────────────────────
  19227.  KBD_GETSHIFTSTATE
  19228.  ────────────────────────────────────────────────────────────────────────────
  19229.    USHORT DosDevIOCtl (pbShiftState, 0L, 0x0073, 0x0004, hDevice)
  19230.    PBYTE pbShiftState;     /*pointer to structure for shift state          */
  19231.    HFILE hDevice;          /*device handle                                 */
  19232.  
  19233.    The KBD_GETSHIFTSTATE function retrieves the shift state of the default
  19234.    keyboard of the current screen group. The shift state identifies whether
  19235.    the SHIFT, CONTROL, ALT, INSERT, and SYSREQ keys are
  19236.    up or down and whether the SCROLL LOCK, NUMLOCK, CAPSLOCK, and
  19237.    INSERT modes are on.
  19238.  
  19239.  Parameters
  19240.  
  19241.    pbShiftState  Points to the SHIFTSTATE structure that receives the shift
  19242.    state. The SHIFTSTATE structure has the following form:
  19243.  
  19244.    typedef struct _SHIFTSTATE {
  19245.        USHORT fsState;
  19246.        BYTE   fbNLS;
  19247.    } SHIFTSTATE;
  19248.  
  19249.    For a full description, see Chapter 4, "Types, Macros, Structures."
  19250.  
  19251.    hDevice  Identifies the keyboard that receives the device-control
  19252.    function. The handle must have been created previously by using the
  19253.    DosOpen function.
  19254.  
  19255.  Return Value
  19256.  
  19257.    The return value is zero if the function is successful or an error value
  19258.    if an error occurs.
  19259.  
  19260.  Comments
  19261.  
  19262.    The shift state is set by incoming keystrokes. It can also be set by using
  19263.    the KBD_SETSHIFTSTATE function (0x0004, 0x0053).
  19264.  
  19265.  See Also
  19266.  
  19267.    DosOpen, KBD_SETSHIFTSTATE
  19268.  
  19269.  
  19270.  ────────────────────────────────────────────────────────────────────────────
  19271.  KBD_PEEKCHAR
  19272.  ────────────────────────────────────────────────────────────────────────────
  19273.    USHORT DosDevIOCtl (pkkiBuffer, pusStatus, 0x0075, 0x0004, hDevice)
  19274.    PKBDKEYINFO pkkiBuffer; /*pointer to structure for keystroke            */
  19275.    PUSHORT pusStatus;      /*pointer to variable for status                */
  19276.    HFILE hDevice;          /*device handle                                 */
  19277.  
  19278.    The KBD_PEEKCHAR function retrieves one character data record from the
  19279.    head of the keyboard-input buffer of the screen group of the active
  19280.    process. The character data record is not removed from the keyboard-input
  19281.    buffer.
  19282.  
  19283.  Parameters
  19284.  
  19285.    pkkiBuffer  Points to the KBDKEYINFO structure that contains keyboard
  19286.    input. The KBDKEYINFO structure has the following form:
  19287.  
  19288.    typedef struct _KBDKEYINFO {
  19289.        UCHAR  chChar;
  19290.        UCHAR  chScan;
  19291.        UCHAR  fbStatus;
  19292.        UCHAR  bNlsShift;
  19293.        USHORT fsState;
  19294.        ULONG  time;
  19295.    } KBDKEYINFO;
  19296.  
  19297.    For a full description, see Chapter 4, "Types, Macros, Structures."
  19298.  
  19299.    pusStatus  Points to the variable that receives the keyboard status. It
  19300.    can be one or both of the following values:
  19301.  
  19302.    Value                 Meaning
  19303.    ──────────────────────────────────────────────────────────────────────────
  19304.    KBD_DATA_RECEIVED     Character data record is retrieved. If not set, no
  19305.                          character data was retrieved.
  19306.  
  19307.    KBD_DATA_BINARY       Input mode is binary. If not set, input mode is
  19308.                          ASCII.
  19309.    ──────────────────────────────────────────────────────────────────────────
  19310.  
  19311.    hDevice  Identifies the keyboard that receives the device-control
  19312.    function. The handle must have been created previously by using the
  19313.    DosOpen function.
  19314.  
  19315.  Return Value
  19316.  
  19317.    The return value is zero if the function is successful or an error value
  19318.    if an error occurs.
  19319.  
  19320.  Comments
  19321.  
  19322.    If the shift-reporting input mode is enabled, the keystroke information
  19323.    retrieved may specify only a shift-state change and no character input.
  19324.  
  19325.  See Also
  19326.  
  19327.    DosOpen, KBD_READCHAR
  19328.  
  19329.  
  19330.  ────────────────────────────────────────────────────────────────────────────
  19331.  KBD_READCHAR
  19332.  ────────────────────────────────────────────────────────────────────────────
  19333.    USHORT DosDevIOCtl (pkkiBuffer, pcRecords, 0x0074, 0x0004, hDevice)
  19334.    PKBDKEYINFO pkkiBuffer; /*pointer to structure for keystrokes           */
  19335.    PUSHORT pcRecords;      /*pointer to variable for record count          */
  19336.    HFILE hDevice;          /*device handle                                 */
  19337.  
  19338.    The KBD_READCHAR function retrieves one or more character data records
  19339.    from the keyboard-input buffer for the screen group of the active process.
  19340.  
  19341.  Parameters
  19342.  
  19343.    pkkiBuffer  Points to the structure that receives the character data
  19344.    records. The structure must be at least as large as the size of an
  19345.    individual record multiplied by the requested number of records to be
  19346.    read. The KBDKEYINFO structure has the following form:
  19347.  
  19348.    typedef struct _KBDKEYINFO {
  19349.        UCHAR  chChar;
  19350.        UCHAR  chScan;
  19351.        UCHAR  fbStatus;
  19352.        UCHAR  bNlsShift;
  19353.        USHORT fsState;
  19354.        ULONG  time;
  19355.    } KBDKEYINFO;
  19356.  
  19357.    For a full description, see Chapter 4, "Types, Macros, Structures."
  19358.  
  19359.    pcRecords  Points to the variable that contains the number of records to
  19360.    be read. When the function returns, it copies the actual number of records
  19361.    retrieved to the variable.
  19362.  
  19363.    hDevice  Identifies the keyboard that receives the device-control
  19364.    function. The handle must have been created previously by using the
  19365.    DosOpen function.
  19366.  
  19367.  Return Value
  19368.  
  19369.    The return value is zero if the function is successful or an error value
  19370.    if an error occurs.
  19371.  
  19372.  Comments
  19373.  
  19374.    This function copies the records to the buffer pointed to by the
  19375.    pkkiBuffer parameter. The variable pointed to by the pcRecords parameter
  19376.    specifies the number of records to copy. The function can copy up to 16
  19377.    characters.
  19378.  
  19379.    If the variable pointed to by pcRecords is KBD_READ_WAIT, the function
  19380.    waits for the requested number of keystrokes; it blocks the calling
  19381.    process until all records have been read. If the variable is
  19382.    KBD_READ_NOWAIT, the function retrieves any available records (up to the
  19383.    specified number) and returns immediately. When the function returns, it
  19384.    copies the actual number of records retrieved to the variable. It sets the
  19385.    sign bit to 0 if the input mode is ASCII; it sets the sign bit to 1
  19386.    (0x8000) if the input mode is binary.
  19387.  
  19388.  See Also
  19389.  
  19390.    DosOpen, KbdCharIn, KBD_PEEKCHAR
  19391.  
  19392.  
  19393.  ────────────────────────────────────────────────────────────────────────────
  19394.  KBD_SETFGNDSCREENGRP
  19395.  ────────────────────────────────────────────────────────────────────────────
  19396.    USHORT DosDevIOCtl (0L, pusScreenGrp, 0x0055, 0x0004, hDevice)
  19397.    PUSHORT pusScreenGrp;   /*pointer to structure with screen group        */
  19398.    HFILE hDevice;          /*device handle                                 */
  19399.  
  19400.    The KBD_SETFGNDSCREENGRP function sets the new foreground screen group.
  19401.    When the keyboard switches to the new screen group, it switches to the
  19402.    shift state, input buffer, and monitor chain defined for that screen
  19403.    group.
  19404.  
  19405.    This function is reserved for the session manager.
  19406.  
  19407.  Parameters
  19408.  
  19409.    pusScreenGrp  Points to the SCREENGROUP structure that contains
  19410.    the screen-group identifier of the new foreground screen group. The
  19411.    SCREENGROUP structure has the following form:
  19412.  
  19413.    typedef struct _SCREENGROUP {
  19414.        USHORT idScreenGrp;
  19415.        USHORT fTerminate;
  19416.    } SCREENGROUP;
  19417.  
  19418.    For a full description, see Chapter 4, "Types, Macros, Structures."
  19419.  
  19420.    hDevice  Identifies the keyboard that receives the device-control
  19421.    function. The handle must have been created previously by using the
  19422.    DosOpen function.
  19423.  
  19424.  Return Value
  19425.  
  19426.    The return value is zero if the function is successful or an error value
  19427.    if an error occurs.
  19428.  
  19429.  See Also
  19430.  
  19431.    DosOpen, KBD_SETSESMGRHOTKEY
  19432.  
  19433.  
  19434.  ────────────────────────────────────────────────────────────────────────────
  19435.  KBD_SETFOCUS
  19436.  ────────────────────────────────────────────────────────────────────────────
  19437.    USHORT DosDevIOCtl (0L, phkbd, 0x0057, 0x0004, hDevice)
  19438.    PHKBD phkbd;            /*pointer to logical keyboard handle            */
  19439.    HFILE hDevice;          /*device handle                                 */
  19440.  
  19441.    The KBD_SETFOCUS function sets the keyboard focus to the specified logical
  19442.    keyboard.
  19443.  
  19444.  Parameters
  19445.  
  19446.    phkbd  Points to the logical keyboard handle. The handle must have been
  19447.    created previously by using the KbdOpen function.
  19448.  
  19449.    hDevice  Identifies the keyboard that receives the device-control
  19450.    function. The handle must have been created previously by using the
  19451.    DosOpen function.
  19452.  
  19453.  Return Value
  19454.  
  19455.    The return value is zero if the function is successful or an error value
  19456.    if an error occurs.
  19457.  
  19458.  See Also
  19459.  
  19460.    DosOpen, KbdOpen
  19461.  
  19462.  
  19463.  ────────────────────────────────────────────────────────────────────────────
  19464.  KBD_SETINPUTMODE
  19465.  ────────────────────────────────────────────────────────────────────────────
  19466.    USHORT DosDevIOCtl (0L, pbInputMode, 0x0051, 0x0004, hDevice)
  19467.    PBYTE pbInputMode;      /*pointer to variable with input mode           */
  19468.    HFILE hDevice;          /*device handle                                 */
  19469.  
  19470.    The KBD_SETINPUTMODE function sets the input and shift-report modes
  19471.    for the keyboard device driver. The input mode defines whether the
  19472.    following input keys are processed as keystrokes or as commands:
  19473.    CONTROL+C, CONTROL+BREAK, CONTROL+S, CONTROL+P, SCROLL LOCK, PRINTSCREEN.
  19474.  
  19475.    The shift-report mode defines whether the shift keys are processed as
  19476.    shift keys or as keystrokes.
  19477.  
  19478.  Parameters
  19479.  
  19480.    pbInputMode  Points to the variable that contains the input mode for the
  19481.    keyboard. If the variable is ASCII_MODE, the input mode is ASCII. If the
  19482.    variable is BINARY_MODE, the input mode is binary. If these values are
  19483.    combined with SHIFT_REPORT_MODE, the function enables the shift-report
  19484.    mode; otherwise, the shift-report mode is disabled.
  19485.  
  19486.    hDevice  Identifies the keyboard that receives the device-control
  19487.    function. The handle must have been created previously by using the
  19488.    DosOpen function.
  19489.  
  19490.  Return Value
  19491.  
  19492.    The return value is zero if the function is successful or an error value
  19493.    if an error occurs.
  19494.  
  19495.  Comments
  19496.  
  19497.    The default input mode is ASCII. The keyboard device driver maintains an
  19498.    input mode for each screen group.
  19499.  
  19500.  See Also
  19501.  
  19502.    DosOpen, KBD_GETINPUTMODE
  19503.  
  19504.  
  19505.  ────────────────────────────────────────────────────────────────────────────
  19506.  KBD_SETINTERIMFLAG
  19507.  ────────────────────────────────────────────────────────────────────────────
  19508.    USHORT DosDevIOCtl (0L, pfFlags, 0x0052, 0x0004, hDevice)
  19509.    PBYTE pfFlags;          /*pointer to variable with flags                */
  19510.    HFILE hDevice;          /*device handle                                 */
  19511.  
  19512.    The KBD_SETINTERIMFLAG function sets the interim character flags.
  19513.  
  19514.  Parameters
  19515.  
  19516.    pfFlags  Points to the variable that contains the interim flags. If the
  19517.    variable is 0x0020, the program requested conversion. If the variable is
  19518.    0x0080, the interim character flag is set.
  19519.  
  19520.    hDevice  Identifies the keyboard that receives the device-control
  19521.    function. The handle must have been created previously by using the
  19522.    DosOpen function.
  19523.  
  19524.  Return Value
  19525.  
  19526.    The return value is zero if the function is successful or an error value
  19527.    if an error occurs.
  19528.  
  19529.  Comments
  19530.  
  19531.    The keyboard device driver maintains the interim character flags for each
  19532.    screen group and passes the interim character flags (with each character
  19533.    data record) to the keyboard monitors. The interim character flags set by
  19534.    this function are not the same as the interim character flags in a
  19535.    character data record.
  19536.  
  19537.  See Also
  19538.  
  19539.    DosOpen, KBD_GETINTERIMFLAG
  19540.  
  19541.  
  19542.  ────────────────────────────────────────────────────────────────────────────
  19543.  KBD_SETKCB
  19544.  ────────────────────────────────────────────────────────────────────────────
  19545.    USHORT DosDevIOCtl (0L, phKbd, 0x0058, 0x0004, hDevice)
  19546.    PHKBD phKbd;            /*logical-keyboard handle                       */
  19547.    HFILE hDevice;          /*device handle                                 */
  19548.  
  19549.    The KBD_SETKCB function binds the specified logical keyboard (KCB) to the
  19550.    physical keyboard for this session.
  19551.  
  19552.  Parameters
  19553.  
  19554.    phKbd  Points to the handle that identifies the logical keyboard.
  19555.  
  19556.    hDevice  Identifies the keyboard that receives the device-control
  19557.    function. The handle must have been created previously by using the
  19558.    DosOpen function.
  19559.  
  19560.  Return Value
  19561.  
  19562.    The return value is zero if the function is successful or an error value
  19563.    if an error occurs.
  19564.  
  19565.  See Also
  19566.  
  19567.    KbdGetFocus
  19568.  
  19569.  
  19570.  ────────────────────────────────────────────────────────────────────────────
  19571.  KBD_SETNLS
  19572.  ────────────────────────────────────────────────────────────────────────────
  19573.    USHORT DosDevIOCtl (0L, pbCodePage, 0x005C, 0x0004, hDevice)
  19574.    PBYTE pbCodePage;       /*pointer to structure with code-page info      */
  19575.    HFILE hDevice;          /*device handle                                 */
  19576.  
  19577.    The KBD_SETNLS function installs one of two possible code pages into the
  19578.    device driver and updates entry number one or number two of the code-page
  19579.    control block. Entry zero is the device-driver resident code page.
  19580.  
  19581.  Parameters
  19582.  
  19583.    pbCodePage  Points to the CODEPAGEINFO structure that specifies the
  19584.    translation table and code page to be set. The CODEPAGEINFO structure has
  19585.    the following form:
  19586.  
  19587.        typedef struct _CODEPAGEINFO {
  19588.            PBYTE pbTransTable;
  19589.            USHORT idCodePage;
  19590.            USHORT idTable;
  19591.        } CODEPAGEINFO;
  19592.  
  19593.    For a full description, see Chapter 4, "Types, Macros, Structures."
  19594.  
  19595.    hDevice  Identifies the keyboard that receives the device-control
  19596.    function. The handle must have been created previously by using the
  19597.    DosOpen function.
  19598.  
  19599.  Return Value
  19600.  
  19601.    The return value is zero if the function is successful or an error value
  19602.    if an error occurs.
  19603.  
  19604.  Comment
  19605.  
  19606.    This function is similar to KBD_SETTRANSTABLE (0x0004,0x0050) except it
  19607.    updates different entries in the code-page control block.
  19608.  
  19609.  See Also
  19610.  
  19611.    DosOpen, KBD_SETTRANSTABLE, KbdSetCp
  19612.  
  19613.  
  19614.  ────────────────────────────────────────────────────────────────────────────
  19615.  KBD_SETSESMGRHOTKEY
  19616.  ────────────────────────────────────────────────────────────────────────────
  19617.    USHORT DosDevIOCtl (0L, pbHotKey, 0x0056, 0x0004, hDevice)
  19618.    PBYTE pbHotKey;         /*pointer to structure with hot key             */
  19619.    HFILE hDevice;          /*device handle                                 */
  19620.  
  19621.    The KBD_SETSESMGRHOTKEY function sets the session-manager hot keys. A new
  19622.    hot key applies to all screen groups. The session manager can define up to
  19623.    16 hot keys.
  19624.  
  19625.  Parameters
  19626.  
  19627.    pbHotKey  Points to the HOTKEY structure that contains the hot-key
  19628.    information. The HOTKEY structure has the following form:
  19629.  
  19630.    typedef struct _HOTKEY {
  19631.        USHORT fHotKey;
  19632.        UCHAR  scancodeMake;
  19633.        UCHAR  scancodeBreak;
  19634.        USHORT idHotKey;
  19635.    } HOTKEY;
  19636.  
  19637.    For a full description, see Chapter 4, "Types, Macros, Structures."
  19638.  
  19639.    hDevice  Identifies the keyboard that receives the device-control
  19640.    function. The handle must have been created previously by using the
  19641.    DosOpen function.
  19642.  
  19643.  Return Value
  19644.  
  19645.    The return value is zero if the function is successful or an error value
  19646.    if an error occurs.
  19647.  
  19648.  Comments
  19649.  
  19650.    The KBD_SETSESMGRHOTKEY function is successful only if it is performed by
  19651.    the process that initially called the KBD_SETFGNDSCREENGRP function
  19652.    (0x0004, 0x0055).
  19653.  
  19654.    A hot key can be specified as a combination of shift flags and scan codes,
  19655.    including key combinations such as ALT+ESC. The system detects the hot
  19656.    key when the specified scan code is received. If a hot key has already
  19657.    been defined for a given hot-key identifier, specifying the identifier
  19658.    again replaces the previous definition.
  19659.  
  19660.  See Also
  19661.  
  19662.    DosOpen, KBD_GETSESMGRHOTKEY, KBD_SETFGNDSCREENGRP
  19663.  
  19664.  
  19665.  ────────────────────────────────────────────────────────────────────────────
  19666.  KBD_SETSHIFTSTATE
  19667.  ────────────────────────────────────────────────────────────────────────────
  19668.    USHORT DosDevIOCtl (0L, pbShiftState, 0x0053, 0x0004, hDevice)
  19669.    PBYTE pbShiftState;     /*pointer to structure with shift state         */
  19670.    HFILE hDevice;          /*device handle                                 */
  19671.  
  19672.    The KBD_SETSHIFTSTATE function sets the shift state for the default
  19673.    keyboard in the current screen group. The shift state identifies whether
  19674.    the SHIFT, CONTROL, ALT, INSERT, and SYSREQ keys are up or down and
  19675.    whether the SCROLL LOCK, NUMLOCK, CAPSLOCK, and INSERT modes are on.
  19676.  
  19677.  Parameters
  19678.  
  19679.    pbShiftState  Points to the SHIFTSTATE structure that contains the shift
  19680.    state. The SHIFTSTATE structure has the following form:
  19681.  
  19682.    typedef struct _SHIFTSTATE {
  19683.        USHORT fsState;
  19684.        BYTE   fbNLS;
  19685.    } SHIFTSTATE;
  19686.  
  19687.    For a full description, see Chapter 4, "Types, Macros, Structures."
  19688.  
  19689.    hDevice  Identifies the keyboard that receives the device-control
  19690.    function. The handle must have been created previously by using the
  19691.    DosOpen function.
  19692.  
  19693.  Return Value
  19694.  
  19695.    The return value is zero if the function is successful or an error value
  19696.    if an error occurs.
  19697.  
  19698.  Comments
  19699.  
  19700.    The system puts the shift state into the character data record built for
  19701.    each incoming keystroke; the shift state then can be used to interpret the
  19702.    meaning of keystrokes. The function sets the shift state to the specified
  19703.    state regardless of the state of the actual keys. The shift remains as set
  19704.    until the user presses or releases the corresponding key.
  19705.  
  19706.    The keyboard device driver maintains a shift state for each screen group.
  19707.  
  19708.  See Also
  19709.  
  19710.    DosOpen, KBD_GETSHIFTSTATE
  19711.  
  19712.  
  19713.  ────────────────────────────────────────────────────────────────────────────
  19714.  KBD_SETTRANSTABLE
  19715.  ────────────────────────────────────────────────────────────────────────────
  19716.    USHORT DosDevIOCtl (0L, pbTransTable, 0x0050, 0x0004, hDevice)
  19717.    PBYTE pbTransTable;     /*pointer to translation table                  */
  19718.    HFILE hDevice;          /*device handle                                 */
  19719.  
  19720.    The KBD_SETTRANSTABLE function passes a new translation table to the
  19721.    keyboard translation function. The new table, which overlays the current
  19722.    table, translates subsequent keystrokes.
  19723.  
  19724.  Parameters
  19725.  
  19726.    pbTransTable  Points to the translation table.
  19727.  
  19728.    hDevice  Identifies the keyboard that receives the device-control
  19729.    function. The handle must have been created previously by using the
  19730.    DosOpen function.
  19731.  
  19732.  Return Value
  19733.  
  19734.    The return value is zero if the function is successful or an error value
  19735.    if an error occurs.
  19736.  
  19737.  Comments
  19738.  
  19739.    The default translation table is U.S. English.
  19740.  
  19741.  See Also
  19742.  
  19743.    DosOpen
  19744.  
  19745.  
  19746.  ────────────────────────────────────────────────────────────────────────────
  19747.  KBD_SETTYPAMATICRATE
  19748.  ────────────────────────────────────────────────────────────────────────────
  19749.    USHORT DosDevIOCtl (0L, pusRateDelay, 0x0054, 0x0004, hDevice)
  19750.    PUSHORT pusRateDelay;   /*structure with typamatic rate and delay       */
  19751.    HFILE hDevice;          /*device handle                                 */
  19752.  
  19753.    The KBD_SETTYPAMATICRATE function sets the keyboard typamatic rate and
  19754.    delay.
  19755.  
  19756.  Parameters
  19757.  
  19758.    pusRateDelay  Points to the RATEDELAY structure that contains the
  19759.    typamatic rate and delay. The RATEDELAY structure has the following form:
  19760.  
  19761.    typedef struct _RATEDELAY {
  19762.        USHORT delay;
  19763.        USHORT rate;
  19764.    } RATEDELAY;
  19765.  
  19766.    For a full description, see Chapter 4, "Types, Macros, Structures."
  19767.  
  19768.    hDevice  Identifies the keyboard that receives the device-control
  19769.    function. The handle must have been created previously by using the
  19770.    DosOpen function.
  19771.  
  19772.  Return Value
  19773.  
  19774.    The return value is zero if the function is successful or an error value
  19775.    if an error occurs.
  19776.  
  19777.  See Also
  19778.  
  19779.    DosOpen, GETTYPAMATICRATE
  19780.  
  19781.  
  19782.  ────────────────────────────────────────────────────────────────────────────
  19783.  KBD_XLATESCAN
  19784.  ────────────────────────────────────────────────────────────────────────────
  19785.    USHORT DosDevIOCtl (pkbxl, pidCodePage, 0x0079, 0x0004, hDevice)
  19786.    PKBDXLATE pkbxl;        /*pointer to structure for scan code            */
  19787.    PBYTE pidCodePage;      /*pointer to code page for translation          */
  19788.    HFILE hDevice;          /*device handle                                 */
  19789.  
  19790.    The KBD_XLATESCAN function translates a scan code in a character data
  19791.    record to an ASCII character.
  19792.  
  19793.  Parameters
  19794.  
  19795.    pkbxl  Points to the KBDTRANS structure that contains the scan code to
  19796.    translate. It also receives the character value when the function returns.
  19797.    The KBDTRANS structure has the following form:
  19798.  
  19799.    typedef struct _KBDTRANS {
  19800.        UCHAR   chChar;
  19801.        UCHAR   chScan;
  19802.        UCHAR   fbStatus;
  19803.        UCHAR   bNlsShift;
  19804.        USHORT  fsState;
  19805.        ULONG   time;
  19806.        USHORT  fsDD;
  19807.        USHORT  fsXlate;
  19808.        USHORT  fsShift;
  19809.        USHORT  sZero;
  19810.    } KBDTRANS;
  19811.  
  19812.    For a full description, see Chapter 4, "Types, Macros, Structures."
  19813.  
  19814.    pidCodePage  Points to a code-page identifier that specifies which code
  19815.    page to use for the translation. The code-page identifier can be one of
  19816.    the following values:
  19817.  
  19818.    Number      Code page
  19819.    ──────────────────────────────────────────────────────────────────────────
  19820.    437         United States
  19821.  
  19822.    850         Multilingual
  19823.  
  19824.    860         Portuguese
  19825.  
  19826.    863         French-Canadian
  19827.  
  19828.    865         Nordic
  19829.    ──────────────────────────────────────────────────────────────────────────
  19830.  
  19831.    hDevice  Identifies the keyboard that receives the device-control
  19832.    function. The handle must have been created previously by using the
  19833.    DosOpen function.
  19834.  
  19835.  Return Value
  19836.  
  19837.    The return value is zero if the function is successful or an error value
  19838.    if an error occurs.
  19839.  
  19840.  Comments
  19841.  
  19842.    You may specify a code page to use for translation. Otherwise, the code
  19843.    page of the active keyboard is used. On entry, the KBDTRANS structure
  19844.    specifies the code page to use for translation.
  19845.  
  19846.  See Also
  19847.  
  19848.    KbdXlate
  19849.  
  19850.  
  19851.  ────────────────────────────────────────────────────────────────────────────
  19852.  MON_REGISTERMONITOR
  19853.  ────────────────────────────────────────────────────────────────────────────
  19854.    USHORT DosDevIOCtl (pusInfo, pbCommand, 0x0040, 0x000A, hDevice)
  19855.    PUSHORT pusInfo;        /*pointer to structure with monitor-register    */
  19856.                            /*info                                          */
  19857.    PBYTE pbCommand;        /*pointer to command                            */
  19858.    HFILE hDevice;          /*device handle                                 */
  19859.  
  19860.    The MON_REGISTERMONITOR function registers a monitor.
  19861.  
  19862.  Parameters
  19863.  
  19864.    pusInfo  Points to the MONITORPOSITION structure that contains the
  19865.    monitor-registration information. The MONITORPOSITION structure has the
  19866.    following form:
  19867.  
  19868.    typedef struct _MONITORPOSITION {
  19869.        USHORT position;
  19870.        USHORT index;
  19871.        PBYTE pbInBuf;
  19872.        USHORT offset;
  19873.    } MONITORPOSITION;
  19874.  
  19875.    For a full description, see Chapter 4, "Types, Macros, Structures."
  19876.  
  19877.    pbCommand  Points to the variable that contains a reserved value. The
  19878.    value must be zero.
  19879.  
  19880.    hDevice  Identifies the device that receives the device-control function.
  19881.    The handle must have been created previously by using the DosOpen
  19882.    function.
  19883.  
  19884.  Return Value
  19885.  
  19886.    The return value is zero if the function is successful or an error value
  19887.    if an error occurs.
  19888.  
  19889.  See Also
  19890.  
  19891.    DosMonRead, DosMonReg, DosMonWrite, DosOpen
  19892.  
  19893.  
  19894.  ────────────────────────────────────────────────────────────────────────────
  19895.  MOU_ALLOWPTRDRAW
  19896.  ────────────────────────────────────────────────────────────────────────────
  19897.    USHORT DosDevIOCtl (0L, 0L, 0x0050, 0x0007, hDevice)
  19898.    HFILE hDevice;          /*device handle                                 */
  19899.  
  19900.    The MOU_ALLOWPTRDRAW function notifies the mouse device driver that the
  19901.    screen group has been switched and that the pointer can now be drawn.
  19902.  
  19903.  Parameters
  19904.  
  19905.    hDevice  Identifies the pointing device that receives the device-control
  19906.    function. The handle must have been created previously by using the
  19907.    DosOpen function.
  19908.  
  19909.  Return Value
  19910.  
  19911.    The return value is zero if the function is successful or an error value
  19912.    if an error occurs.
  19913.  
  19914.  See Also
  19915.  
  19916.    DosOpen
  19917.  
  19918.  
  19919.  ────────────────────────────────────────────────────────────────────────────
  19920.  MOU_DRAWPTR
  19921.  ────────────────────────────────────────────────────────────────────────────
  19922.    USHORT DosDevIOCtl (0L, 0L, 0x0057, 0x0007, hDevice)
  19923.    HFILE hDevice;          /*device handle                                 */
  19924.  
  19925.    The MOU_DRAWPTR function removes the current exclusion rectangle, allowing
  19926.    the pointer to be drawn anywhere on the screen. If an exclusion rectangle
  19927.    has been declared for the screen group, that rectangle is released and the
  19928.    pointer position is checked. If the pointer was in the released rectangle,
  19929.    it is drawn. If the pointer was not in the released rectangle, the
  19930.    pointer-draw operation occurs.
  19931.  
  19932.  Parameters
  19933.  
  19934.    hDevice  Identifies the pointing device that receives the device-control
  19935.    function. The handle must have been created previously by using the
  19936.    DosOpen function.
  19937.  
  19938.  Return Value
  19939.  
  19940.    The return value is zero if the function is successful or an error value
  19941.    if an error occurs.
  19942.  
  19943.  See Also
  19944.  
  19945.    DosOpen
  19946.  
  19947.  
  19948.  ────────────────────────────────────────────────────────────────────────────
  19949.  MOU_GETBUTTONCOUNT
  19950.  ────────────────────────────────────────────────────────────────────────────
  19951.    USHORT DosDevIOCtl (pusCount, 0L, 0x0060, 0x0007, hDevice)
  19952.    PUSHORT pusCount;       /*pointer to variable for button count          */
  19953.    HFILE hDevice;          /*device handle                                 */
  19954.  
  19955.    The MOU_GETBUTTONCOUNT function retrieves a count of the number of mouse
  19956.    buttons.
  19957.  
  19958.  Parameters
  19959.  
  19960.    pusCount  Points to the variable that receives the count mouse buttons.
  19961.  
  19962.    hDevice  Identifies the pointing device that receives the device-control
  19963.    function. The handle must have been created previously by using the
  19964.    DosOpen function.
  19965.  
  19966.  Return Value
  19967.  
  19968.    The return value is zero if the function is successful or an error value
  19969.    if an error occurs.
  19970.  
  19971.  See Also
  19972.  
  19973.    DosOpen
  19974.  
  19975.  
  19976.  ────────────────────────────────────────────────────────────────────────────
  19977.  MOU_GETEVENTMASK
  19978.  ────────────────────────────────────────────────────────────────────────────
  19979.    USHORT DosDevIOCtl (pfEvents, 0L, 0x0065, 0x0007, hDevice)
  19980.    PUSHORT pfEvents;       /*pointer to variable for event mask            */
  19981.    HFILE hDevice;          /*device handle                                 */
  19982.  
  19983.    The MOU_GETEVENTMASK function retrieves the event mask of the current
  19984.    pointing device.
  19985.  
  19986.  Parameters
  19987.  
  19988.    pfEvents  Points to the variable that receives the event mask. This
  19989.    variable can be a combination of the following values:
  19990.  
  19991.    Value                         Meaning
  19992.    ──────────────────────────────────────────────────────────────────────────
  19993.    MOUSE_MOTION                  Motion; no buttons pressed.
  19994.  
  19995.    MOUSE_MOTION_WITH_BN1_DOWN    Motion with button 1 pressed.
  19996.  
  19997.    MOUSE_BN1_DOWN                Button 1 pressed.
  19998.  
  19999.    MOUSE_MOTION_WITH_BN2_DOWN    Motion with button 2 pressed.
  20000.  
  20001.    MOUSE_BN2_DOWN                Button 2 pressed.
  20002.  
  20003.    MOUSE_MOTION_WITH_BN3_DOWN    Motion with button 3 pressed.
  20004.  
  20005.    MOUSE_BN3_DOWN                Button 3 pressed.
  20006.    ──────────────────────────────────────────────────────────────────────────
  20007.  
  20008.    hDevice  Identifies the pointing device that receives the device-control
  20009.    function. The handle must have been created previously by using the
  20010.    DosOpen function.
  20011.  
  20012.  Return Value
  20013.  
  20014.    The return value is zero if the function is successful or an error value
  20015.    if an error occurs.
  20016.  
  20017.  See Also
  20018.  
  20019.    DosOpen, MOU_SETEVENTMASK
  20020.  
  20021.  
  20022.  ────────────────────────────────────────────────────────────────────────────
  20023.  MOU_GETHOTKEYBUTTON
  20024.  ────────────────────────────────────────────────────────────────────────────
  20025.    USHORT DosDevIOCtl (pfHotKey, 0L, 0x0069, 0x0007, hDevice)
  20026.    PUSHORT pfHotKey;       /*pointer to variable for hot key               */
  20027.    HFILE hDevice;          /*device handle                                 */
  20028.  
  20029.    The MOU_GETHOTKEYBUTTON function retrieves the mouse-button equivalent for
  20030.    the system hot key.
  20031.  
  20032.  Parameters
  20033.  
  20034.    pfHotKey  Points to the variable that receives the hot key. This variable
  20035.    can be one or more of the following values:
  20036.  
  20037.    Value             Meaning
  20038.    ──────────────────────────────────────────────────────────────────────────
  20039.    MHK_NO_HOTKEY     No system hot key used.
  20040.  
  20041.    MHK_BUTTON1       Button 1 is system hot key.
  20042.  
  20043.    MHK_BUTTON2       Button 2 is system hot key.
  20044.  
  20045.    MHK_BUTTON3       Button 3 is system hot key.
  20046.    ──────────────────────────────────────────────────────────────────────────
  20047.  
  20048.    If 0x0001 is specified, no system hot-key support is provided. If multiple
  20049.    values are given (excluding 0x0001) the system hot key requires that the
  20050.    indicated buttons be pressed simultaneously.
  20051.  
  20052.    hDevice  Identifies the pointing device that receives the device-control
  20053.    function. The handle must have been created previously by using the
  20054.    DosOpen function.
  20055.  
  20056.  Return Value
  20057.  
  20058.    The return value is zero if the function is successful or an error value
  20059.    if an error occurs.
  20060.  
  20061.  See Also
  20062.  
  20063.    DosOpen, MOU_SETHOTKEYBUTTON
  20064.  
  20065.  
  20066.  ────────────────────────────────────────────────────────────────────────────
  20067.  MOU_GETMICKEYCOUNT
  20068.  ────────────────────────────────────────────────────────────────────────────
  20069.    USHORT DosDevIOCtl (pcMickeys, 0L, 0x0061, 0x0007, hDevice)
  20070.    PUSHORT pcMickeys;      /*pointer to variable for mickeys               */
  20071.    HFILE hDevice;          /*device handle                                 */
  20072.  
  20073.    The MOU_GETMICKEYCOUNT function retrieves the count of mickeys per
  20074.    centimeter for a given pointing device.
  20075.  
  20076.  Parameters
  20077.  
  20078.    pcMickeys  Points to the variable that receives the number of mickeys per
  20079.    centimeter. The number can be any value from 0 through 32,767.
  20080.  
  20081.    hDevice  Identifies the pointing device that receives the device-control
  20082.    function. The handle must have been created previously by using the
  20083.    DosOpen function.
  20084.  
  20085.  Return Value
  20086.  
  20087.    The return value is zero if the function is successful or an error value
  20088.    if an error occurs.
  20089.  
  20090.  See Also
  20091.  
  20092.    DosOpen
  20093.  
  20094.  
  20095.  ────────────────────────────────────────────────────────────────────────────
  20096.  MOU_GETMOUSTATUS
  20097.  ────────────────────────────────────────────────────────────────────────────
  20098.    USHORT DosDevIOCtl (pfStatus, 0L, 0x0062, 0x0007, hDevice)
  20099.    PUSHORT pfStatus;       /*pointer to variable for status flags          */
  20100.    HFILE hDevice;          /*device handle                                 */
  20101.  
  20102.    The MOU_GETMOUSTATUS function retrieves the current status flags of the
  20103.    mouse device driver.
  20104.  
  20105.  Parameters
  20106.  
  20107.    pfStatus  Points to the variable that receives the status flags. This
  20108.    variable can be a combination of the following values:
  20109.  
  20110.    Value                     Meaning
  20111.    ──────────────────────────────────────────────────────────────────────────
  20112.    MOUSE_QUEUEBUSY           Event queue is busy with I/O.
  20113.  
  20114.    MOUSE_BLOCKREAD           Block read is in progress.
  20115.  
  20116.    MOUSE_FLUSH               Flush is in progress.
  20117.  
  20118.    MOUSE_UNSUPPORTED_MODE    Pointer-draw routine is disabled (device in
  20119.                              unsupported mode).
  20120.  
  20121.    MOUSE_DISABLED            Interrupt-level pointer-draw routine is not
  20122.                              called.
  20123.  
  20124.    MOUSE_MICKEYS             Mouse data is returned in mickeys (not pels).
  20125.    ──────────────────────────────────────────────────────────────────────────
  20126.  
  20127.    hDevice  Identifies the pointing device that receives the device-control
  20128.    function. The handle must have been created previously by using the
  20129.    DosOpen function.
  20130.  
  20131.  Return Value
  20132.  
  20133.    The return value is zero if the function is successful or an error value
  20134.    if an error occurs.
  20135.  
  20136.  See Also
  20137.  
  20138.    DosOpen, MOU_SETMOUSTATUS
  20139.  
  20140.  
  20141.  ────────────────────────────────────────────────────────────────────────────
  20142.  MOU_GETPTRPOS
  20143.  ────────────────────────────────────────────────────────────────────────────
  20144.    USHORT DosDevIOCtl (pplPosition, 0L, 0x0067, 0x0007, hDevice)
  20145.    PPTRLOC pplPosition;    /*pointer to structure for position             */
  20146.    HFILE hDevice;          /*device handle                                 */
  20147.  
  20148.    The MOU_GETPTRPOS function retrieves the position of the current screen's
  20149.    pointer.
  20150.  
  20151.  Parameters
  20152.  
  20153.    pplPosition  Points to the PTRLOC structure that receives the new pointer
  20154.    position. The PTRLOC structure has the following form:
  20155.  
  20156.    typedef struct _PTRLOC {
  20157.            USHORT row;
  20158.            USHORT col;
  20159.    } PTRLOC;
  20160.  
  20161.    For a full description, see Chapter 4, "Types, Macros, Structures."
  20162.  
  20163.    hDevice  Identifies the pointing device that receives the device-control
  20164.    function. The handle must have been created previously by using the
  20165.    DosOpen function.
  20166.  
  20167.  Return Value
  20168.  
  20169.    The return value is zero if the function is successful or an error value
  20170.    if an error occurs.
  20171.  
  20172.  Comments
  20173.  
  20174.    The coordinate values depend on the display mode. If the display is in
  20175.    text mode, character-position values are used. If the display is in
  20176.    graphics mode, pel values are used.
  20177.  
  20178.  See Also
  20179.  
  20180.    DosOpen, MOU_SETPTRPOS
  20181.  
  20182.  
  20183.  ────────────────────────────────────────────────────────────────────────────
  20184.  MOU_GETPTRSHAPE
  20185.  ────────────────────────────────────────────────────────────────────────────
  20186.    USHORT DosDevIOCtl (pbBuffer, ppsShape, 0x0068, 0x0007, hDevice)
  20187.    PBYTE pbBuffer;         /*pointer to buffer for pointer masks           */
  20188.    PPTRSHAPE ppsShape;     /*pointer to structure for shape information    */
  20189.    HFILE hDevice;          /*device handle                                 */
  20190.  
  20191.    The MOU_GETPTRSHAPE function retrieves the current pointer shape.
  20192.  
  20193.  Parameters
  20194.  
  20195.    pbBuffer  Points to the buffer that receives the pointer shape. The image
  20196.    format depends on the mode of the display. For currently supported modes,
  20197.    the buffer always consists of the AND image data followed by the XOR image
  20198.    data. The buffer always describes one display plane.
  20199.  
  20200.    ppsShape  Points to the PTRSHAPE structure that receives the pointer
  20201.    information and shape. The PTRSHAPE structure has the following form:
  20202.  
  20203.    typedef struct _PTRSHAPE {
  20204.        USHORT cb;
  20205.        USHORT col;
  20206.        USHORT row;
  20207.        USHORT colHot;
  20208.        USHORT rowHot;
  20209.    } PTRSHAPE;
  20210.  
  20211.    For a full description, see Chapter 4, "Types, Macros, Structures."
  20212.  
  20213.    hDevice  Identifies the pointing device that receives the device-control
  20214.    function. The handle must have been created previously by using the
  20215.    DosOpen function.
  20216.  
  20217.  Return Value
  20218.  
  20219.    The function exits in a normal state if the input pointer-image buffer is
  20220.    large enough to store the pointer image. The current pointer information
  20221.    is returned in the pointer-data record, and the pointer-image data is
  20222.    copied into the data-packet buffer.
  20223.  
  20224.    An "invalid buffer size" error occurs if the input pointer-image buffer is
  20225.    smaller than the amount of storage necessary for copying the data. The
  20226.    buffer length returned will be minimum value.
  20227.  
  20228.  Comments
  20229.  
  20230.    The parameter values are in the same mode as the current screen-group
  20231.    display mode. For text mode, these are character values; for graphics
  20232.    mode, these are pel values.
  20233.  
  20234.    On input, the only field in the pointer-definition record used by the
  20235.    mouse device driver is the length of the pointer-image buffer.
  20236.  
  20237.  See Also
  20238.  
  20239.    DosOpen, MOU_SETPTRSHAPE
  20240.  
  20241.  
  20242.  ────────────────────────────────────────────────────────────────────────────
  20243.  MOU_GETQUESTATUS
  20244.  ────────────────────────────────────────────────────────────────────────────
  20245.    USHORT DosDevIOCtl (pmqiStatus, 0L, 0x0064, 0x0007, hDevice)
  20246.    PMOUQUEINFO pmqiStatus; /*pointer to structure for queue status         */
  20247.    HFILE hDevice;          /*device handle                                 */
  20248.  
  20249.    The MOU_GETQUESTATUS function retrieves the number of elements in the
  20250.    event queue and the maximum number of elements allowed in an event queue.
  20251.  
  20252.  Parameters
  20253.  
  20254.    pmqiStatus  Points to the MOUQUEINFO structure that receives the queue
  20255.    status. The MOUQUEINFO structure has the following form:
  20256.  
  20257.    typedef struct _MOUQUEINFO {
  20258.        USHORT cEvents;
  20259.        USHORT cmaxEvents;
  20260.    } MOUQUEINFO;
  20261.  
  20262.    For a full description, see Chapter 4, "Types, Macros, Structures."
  20263.  
  20264.    hDevice  Identifies the pointing device that receives the device-control
  20265.    function. The handle must have been created previously by using the
  20266.    DosOpen function.
  20267.  
  20268.  Return Value
  20269.  
  20270.    The return value is zero if the function is successful or an error value
  20271.    if an error occurs.
  20272.  
  20273.  See Also
  20274.  
  20275.    DosOpen
  20276.  
  20277.  
  20278.  ────────────────────────────────────────────────────────────────────────────
  20279.  MOU_GETSCALEFACTORS
  20280.  ────────────────────────────────────────────────────────────────────────────
  20281.    USHORT DosDevIOCtl (psfFactors, 0L, 0x0066, 0x0007, hDevice)
  20282.    PSCALEFACT psfFactors;  /*pointer to structure for scaling factors      */
  20283.    HFILE hDevice;          /*device handle                                 */
  20284.  
  20285.    The MOU_GETSCALEFACTORS function retrieves the scaling factors of the
  20286.    current pointing device. Scaling factors are the ratio values that
  20287.    determine how much relative movement is necessary before the mouse device
  20288.    driver reports a pointing-device event. In graphics mode, this ratio is
  20289.    given in mickeys-per-pel. In text mode, this ratio is given in mickeys-
  20290.    per-character. The default values are one mickey-per-row and one
  20291.    mickey-per-column.
  20292.  
  20293.  Parameters
  20294.  
  20295.    psfFactors  Points to the SCALEFACT structure that receives the scaling
  20296.    factors. The SCALEFACT structure has the following form:
  20297.  
  20298.    typedef struct _SCALEFACT {
  20299.        USHORT rowScale;
  20300.        USHORT colScale;
  20301.    } SCALEFACT;
  20302.  
  20303.    For a full description, see Chapter 4, "Types, Macros, Structures."
  20304.  
  20305.    hDevice  Identifies the pointing device that receives the device-control
  20306.    function. The handle must have been created previously by using the
  20307.    DosOpen function.
  20308.  
  20309.  Return Value
  20310.  
  20311.    The return value is zero if the function is successful or an error value
  20312.    if an error occurs.
  20313.  
  20314.  See Also
  20315.  
  20316.    DosOpen, MOU_SETSCALEFACTORS
  20317.  
  20318.  
  20319.  ────────────────────────────────────────────────────────────────────────────
  20320.  MOU_READEVENTQUE
  20321.  ────────────────────────────────────────────────────────────────────────────
  20322.    USHORT DosDevIOCtl (pmeiEvent, pfWait, 0x0063, 0x0007, hDevice)
  20323.    PMOUEVENTINFO pmeiEvent;
  20324.                            /*pointer to structure for event information    */
  20325.    PUSHORT pfWait;         /*pointer to wait/no-wait flag                  */
  20326.    HFILE hDevice;          /*device handle                                 */
  20327.  
  20328.    The MOU_READEVENTQUE function reads the event queue for the pointing
  20329.    device.
  20330.  
  20331.  Parameters
  20332.  
  20333.    pmeiEvent  Points to the MOUEVENTINFO structure that receives event-queue
  20334.    information. The MOUEVENTINFO structure has the following form:
  20335.  
  20336.    typedef struct _MOUEVENTINFO {
  20337.        USHORT fs;
  20338.        ULONG  Time;
  20339.        USHORT row;
  20340.        USHORT col;
  20341.    } MOUEVENTINFO;
  20342.  
  20343.    For a full description, see Chapter 4, "Types, Macros, Structures."
  20344.  
  20345.    pfWait  Points to the variable that specifies how to read from the queue
  20346.    if no event is available. If the variable is WAIT, the function returns
  20347.    immediately without an event. If the variable is NOWAIT, the function
  20348.    waits until an event is available.
  20349.  
  20350.    hDevice  Identifies the pointing device that receives the device-control
  20351.    function. The handle must have been created previously by using the
  20352.    DosOpen function.
  20353.  
  20354.  Return Value
  20355.  
  20356.    The return value is zero if the function is successful or an error value
  20357.    if an error occurs.
  20358.  
  20359.  See Also
  20360.  
  20361.    DosOpen, MouReadEventQue
  20362.  
  20363.  
  20364.  ────────────────────────────────────────────────────────────────────────────
  20365.  MOU_REMOVEPTR
  20366.  ────────────────────────────────────────────────────────────────────────────
  20367.    USHORT DosDevIOCtl (0L, pnprBuffer, 0x0058, 0x0007, hDevice)
  20368.    PNOPTRRECT pnprBuffer;  /*points to structure with exclusion rectangle  */
  20369.    HFILE hDevice;          /*device handle                                 */
  20370.  
  20371.    The MOU_REMOVEPTR function specifies the exclusion rectangle to be used by
  20372.    the device driver. The exclusion rectangle specifies an area on the screen
  20373.    where the pointer-draw routine cannot draw the pointer.
  20374.  
  20375.  Parameters
  20376.  
  20377.    pnprBuffer  Points to the NOPTRRECT structure that contains the dimensions
  20378.    of the exclusion rectangle. The NOPTRRECT structure has the following
  20379.    form:
  20380.  
  20381.    typedef struct _NOPTRRECT {
  20382.        USHORT row;
  20383.        USHORT col;
  20384.        USHORT cRow;
  20385.        USHORT cCol;
  20386.    } NOPTRRECT;
  20387.  
  20388.    For a full description, see Chapter 4, "Types, Macros, Structures."
  20389.  
  20390.    hDevice  Identifies the pointing device that receives the device-control
  20391.    function. The handle must have been created previously by using the
  20392.    DosOpen function.
  20393.  
  20394.  Return Value
  20395.  
  20396.    The return value is zero if the function is successful or an error value
  20397.    if an error occurs.
  20398.  
  20399.  Comments
  20400.  
  20401.    The pointer is not drawn in the exclusion rectangle until a different area
  20402.    is specified by another call of this function.
  20403.  
  20404.    If the exclusion rectangle is defined as the entire screen, pointer-draw
  20405.    operations are disabled for the entire screen group.
  20406.  
  20407.  See Also
  20408.  
  20409.    DosOpen
  20410.  
  20411.  
  20412.  ────────────────────────────────────────────────────────────────────────────
  20413.  MOU_SCREENSWITCH
  20414.  ────────────────────────────────────────────────────────────────────────────
  20415.    USHORT DosDevIOCtl (0L, pbNotify, 0x0052, 0x0007, hDevice)
  20416.    PBYTE pbNotify;         /*pointer to structure with screen group        */
  20417.    HFILE hDevice;          /*device handle                                 */
  20418.  
  20419.    The MOU_SCREENSWITCH function notifies the mouse device driver that
  20420.    the screen group is about to be switched, and then sets a system
  20421.    pointer-draw enable/disable flag. Any pointer drawing is locked until the
  20422.    flag is cleared by using the MOU_ALLOWPTRDRAW function (0x0007, 0x0050).
  20423.  
  20424.  Parameters
  20425.  
  20426.    pbNotify  Points to the SCREENGROUP structure that contains the
  20427.    notification type and screen-group identifier. The SCREENGROUP structure
  20428.    has the following form:
  20429.  
  20430.    typedef struct _SCREENGROUP {
  20431.        USHORT idScreenGrp;
  20432.        USHORT fTerminate;
  20433.    } SCREENGROUP;
  20434.  
  20435.    For a full description, see Chapter 4, "Types, Macros, Structures."
  20436.  
  20437.    hDevice  Identifies the pointing device that receives the device-control
  20438.    function. The handle must have been created previously by using the
  20439.    DosOpen function.
  20440.  
  20441.  Return Value
  20442.  
  20443.    The return value is zero if the function is successful or an error value
  20444.    if an error occurs.
  20445.  
  20446.  See Also
  20447.  
  20448.    DosOpen
  20449.  
  20450.  
  20451.  ────────────────────────────────────────────────────────────────────────────
  20452.  MOU_SETEVENTMASK
  20453.  ────────────────────────────────────────────────────────────────────────────
  20454.    USHORT DosDevIOCtl (0L, pfEvent, 0x0054, 0x0007, hDevice)
  20455.    PUSHORT pfEvent;        /*pointer to variable for event mask            */
  20456.    HFILE hDevice;          /*device handle                                 */
  20457.  
  20458.    The MOU_SETEVENTMASK function sets the event mask of the pointing device.
  20459.  
  20460.  Parameters
  20461.  
  20462.    pfEvent  Points to the variable that contains the event mask. This
  20463.    variable can be a combination of the following values:
  20464.  
  20465.    Value                         Meaning
  20466.    ──────────────────────────────────────────────────────────────────────────
  20467.    MOUSE_MOTION                  Motion; no buttons pressed.
  20468.  
  20469.    MOUSE_MOTION_WITH_BN1_DOWN    Motion with button 1 pressed.
  20470.  
  20471.    MOUSE_BN1_DOWN                Button 1 pressed.
  20472.  
  20473.    MOUSE_MOTION_WITH_BN2_DOWN    Motion with button 2 pressed.
  20474.  
  20475.    MOUSE_BN2_DOWN                Button 2 pressed.
  20476.  
  20477.    MOUSE_MOTION_WITH_BN3_DOWN    Motion with button 3 pressed.
  20478.  
  20479.    MOUSE_BN3_DOWN                Button 3 pressed.
  20480.    ──────────────────────────────────────────────────────────────────────────
  20481.  
  20482.    hDevice  Identifies the pointing device that receives the device-control
  20483.    function. The handle must have been created previously by using the
  20484.    DosOpen function.
  20485.  
  20486.  Return Value
  20487.  
  20488.    The return value is zero if the function is successful or an error value
  20489.    if an error occurs.
  20490.  
  20491.  See Also
  20492.  
  20493.    DosOpen, MOU_GETEVENTMASK
  20494.  
  20495.  
  20496.  ────────────────────────────────────────────────────────────────────────────
  20497.  MOU_SETHOTKEYBUTTON
  20498.  ────────────────────────────────────────────────────────────────────────────
  20499.    USHORT DosDevIOCtl (0L, pfHotKey, 0x0055, 0x0007, hDevice)
  20500.    PUSHORT pfHotKey;       /*pointer to variable with hot key              */
  20501.    HFILE hDevice;          /*device handle                                 */
  20502.  
  20503.    The MOU_SETHOTKEYBUTTON function sets the mouse-button equivalent for the
  20504.    system hot key.
  20505.  
  20506.  Parameters
  20507.  
  20508.    pfHotKey  Points to the variable that specifies the hot key. This variable
  20509.    can be a combination of the following values:
  20510.  
  20511.    Value             Meaning
  20512.    ──────────────────────────────────────────────────────────────────────────
  20513.    MHK_NO_HOTKEY     No system hot key used.
  20514.  
  20515.    MHK_BUTTON1       Button 1 is system hot key.
  20516.  
  20517.    MHK_BUTTON2       Button 2 is system hot key.
  20518.  
  20519.    MHK_BUTTON3       Button 3 is system hot key.
  20520.    ──────────────────────────────────────────────────────────────────────────
  20521.  
  20522.    If 0x0001 is specified, no system hot-key support is provided. If multiple
  20523.    values are given (excluding 0x0001), the system hot key requires that the
  20524.    indicated buttons be pressed simultaneously.
  20525.  
  20526.    hDevice  Identifies the pointing device that receives the device-control
  20527.    function. The handle must have been created previously by using the
  20528.    DosOpen function.
  20529.  
  20530.  Return Value
  20531.  
  20532.    The return value is zero if the function is successful or an error value
  20533.    if an error occurs.
  20534.  
  20535.  Comments
  20536.  
  20537.    This function can be called only by the process that initially issues it
  20538.    and should be used only by the command shell.
  20539.  
  20540.  See Also
  20541.  
  20542.    DosOpen, MOU_GETHOTKEYBUTTON
  20543.  
  20544.  
  20545.  ────────────────────────────────────────────────────────────────────────────
  20546.  MOU_SETMOUSTATUS
  20547.  ────────────────────────────────────────────────────────────────────────────
  20548.    USHORT DosDevIOCtl (0L, pfStatus, 0x005C, 0x0007, hDevice)
  20549.    PUSHORT pfStatus;       /*pointer to variable with status               */
  20550.    HFILE hDevice;          /*device handle                                 */
  20551.  
  20552.    The MOU_SETMOUSTATUS function sets a subset of the current mouse
  20553.    device-driver status flags.
  20554.  
  20555.  Parameters
  20556.  
  20557.    pfStatus  Points to the variable that contains the status flags for the
  20558.    pointing device. If the variable is MOUSE_DISABLED, the interrupt-level
  20559.    pointer-draw routine is not called. If the variable is MOUSE_MICKEYS,
  20560.    mouse data is returned in mickeys (not pels).
  20561.  
  20562.    hDevice  Identifies the pointing device that receives the device-control
  20563.    function. The handle must have been created previously by using the
  20564.    DosOpen function.
  20565.  
  20566.  Return Value
  20567.  
  20568.    The return value is zero if the function is successful or an error value
  20569.    if an error occurs.
  20570.  
  20571.  See Also
  20572.  
  20573.    DosOpen, MOU_GETMOUSTATUS
  20574.  
  20575.  
  20576.  ────────────────────────────────────────────────────────────────────────────
  20577.  MOU_SETPROTDRAWADDRESS
  20578.  ────────────────────────────────────────────────────────────────────────────
  20579.    USHORT DosDevIOCtl (0L, pbFunction, 0x005A, 0x0007, hDevice)
  20580.    PBYTE pbFunction;       /*pointer to structure with drawing function    */
  20581.    HFILE hDevice;          /*device handle                                 */
  20582.  
  20583.    The MOU_SETPROTDRAWADDRESS function notifies the mouse device driver of
  20584.    the address of a protected-mode pointer-draw function. This function
  20585.    is valid for protected mode only.
  20586.  
  20587.  Parameters
  20588.  
  20589.    pbFunction  Points to the PTRDRAWFUNCTION structure that contains the
  20590.    address of the pointer-draw function. The PTRDRAWFUNCTION structure has
  20591.    the following form:
  20592.  
  20593.    typedef struct _PTRDRAWFUNCTION {
  20594.        PFN    pfnDraw;
  20595.        PCH    pchDataSeg;
  20596.    } PTRDRAWFUNCTION;
  20597.  
  20598.    For a full description, see Chapter 4, "Types, Macros, Structures."
  20599.  
  20600.    hDevice  Identifies the pointing device that receives the device-control
  20601.    function. The handle must have been created previously by using the
  20602.    DosOpen function.
  20603.  
  20604.  Return Value
  20605.  
  20606.    The return value is zero if the function is successful or an error value
  20607.    if an error occurs.
  20608.  
  20609.  Comments
  20610.  
  20611.    The pointer-draw routine is an installed, pseudo-character device driver.
  20612.    The mouse handler must do the following:
  20613.  
  20614.    ■  Open the pointer-draw device driver.
  20615.  
  20616.    ■  Query the pointer-draw device driver for the address of its entry
  20617.       point.
  20618.  
  20619.    ■  Pass the resulting address of the pointer-draw entry point to the mouse
  20620.       device driver that uses this function.
  20621.  
  20622.  See Also
  20623.  
  20624.    DosOpen, MOU_SETREALDRAWADDRESS
  20625.  
  20626.  
  20627.  ────────────────────────────────────────────────────────────────────────────
  20628.  MOU_SETPTRPOS
  20629.  ────────────────────────────────────────────────────────────────────────────
  20630.    USHORT DosDevIOCtl (0L, pplPosition, 0x0059, 0x0007, hDevice)
  20631.    PPTRLOC pplPosition;    /*pointer to structure with pointer position    */
  20632.    HFILE hDevice;          /*device handle                                 */
  20633.  
  20634.    The MOU_SETPTRPOS function sets a new screen position for the pointer
  20635.    image.
  20636.  
  20637.  Parameters
  20638.  
  20639.    pplPosition  Points to the PTRLOC structure that contains the new position
  20640.    for the pointer. The PTRLOC structure has the following form:
  20641.  
  20642.    typedef struct _PTRLOC {
  20643.        USHORT row;
  20644.        USHORT col;
  20645.    } PTRLOC;
  20646.  
  20647.    For a full description, see Chapter 4, "Types, Macros, Structures."
  20648.  
  20649.    hDevice  Identifies the pointing device that receives the device-control
  20650.    function. The handle must have been created previously by using the
  20651.    DosOpen function.
  20652.  
  20653.  Return Value
  20654.  
  20655.    The return value is zero if the function is successful or an error value
  20656.    if an error occurs.
  20657.  
  20658.  Comments
  20659.  
  20660.    The coordinate values depend on the display mode. If the display is in
  20661.    text mode, character-position values are used. If the display is in
  20662.    graphics mode, pel values are used.
  20663.  
  20664.    This function has no effect on the current exclusion-rectangle
  20665.    definitions. If a pointer image is already defined for the screen group,
  20666.    it is replaced by the new pointer image.
  20667.  
  20668.    If the pointer image is directed into an existing exclusion rectangle, it
  20669.    remains hidden (invisible) until sufficient movement places the pointer
  20670.    outside the exclusion rectangle or until the exclusion rectangle is
  20671.    released.
  20672.  
  20673.  See Also
  20674.  
  20675.    DosOpen, MOU_GETPTRPOS
  20676.  
  20677.  
  20678.  ────────────────────────────────────────────────────────────────────────────
  20679.  MOU_SETPTRSHAPE
  20680.  ────────────────────────────────────────────────────────────────────────────
  20681.    USHORT DosDevIOCtl (pbBuffer, ppsShape, 0x0056, 0x0007, hDevice)
  20682.    PBYTE pbBuffer;         /*pointer to structure with shape masks         */
  20683.    PPTRSHAPE ppsShape;     /*pointer to structure with shape information   */
  20684.    HFILE hDevice;          /*device handle                                 */
  20685.  
  20686.    The MOU_SETPTRSHAPE function sets the pointer shape.
  20687.  
  20688.  Parameters
  20689.  
  20690.    pbBuffer  Points to the buffer that contains the pointer image. The image
  20691.    format depends on the mode of the display. For currently supported modes,
  20692.    the buffer always consists of the AND image data, followed by the XOR
  20693.    image data. The buffer always describes one display plane.
  20694.  
  20695.    ppsShape  Points to the PTRSHAPE structure that receives the pointer
  20696.    information and shape. The PTRSHAPE structure has the following form:
  20697.  
  20698.    typedef struct _PTRSHAPE {
  20699.        USHORT cb;
  20700.        USHORT col;
  20701.        USHORT row;
  20702.        USHORT colHot;
  20703.        USHORT rowHot;
  20704.    } PTRSHAPE;
  20705.  
  20706.    For a full description, see Chapter 4, "Types, Macros, Structures."
  20707.  
  20708.    hDevice  Identifies the pointing device that receives the device-control
  20709.    function. The handle must have been created previously by using the
  20710.    DosOpen function.
  20711.  
  20712.  Return Value
  20713.  
  20714.    The return value is zero if the function is successful or an error value
  20715.    if an error occurs.
  20716.  
  20717.  Comments
  20718.  
  20719.    The parameter values must be in the same mode as the current screen-group
  20720.    display mode. For text mode, these must be character values; for graphics
  20721.    mode, these must be pel values.
  20722.  
  20723.  See Also
  20724.  
  20725.    DosOpen, MOU_GETPTRSHAPE
  20726.  
  20727.  
  20728.  ────────────────────────────────────────────────────────────────────────────
  20729.  MOU_SETREALDRAWADDRESS
  20730.  ────────────────────────────────────────────────────────────────────────────
  20731.    USHORT DosDevIOCtl (0L, pbFunction, 0x005B, 0x0007, hDevice)
  20732.    PBYTE pbFunction;       /*pointer to structure with function            */
  20733.    HFILE hDevice;          /*device handle                                 */
  20734.  
  20735.    The MOU_SETREALDRAWADDRESS function notifies the real-mode mouse device
  20736.    driver of the entry point of a real-mode pointer-draw routine. This
  20737.    function is intended for use by the session manager at the end of system
  20738.    initialization and is valid for real mode only.
  20739.  
  20740.  Parameters
  20741.  
  20742.    pbFunction  Points to the PTRDRAWFUNCTION structure that contains the
  20743.    address of the pointer-draw function. The PTRDRAWFUNCTION structure has
  20744.    the following form:
  20745.  
  20746.    typedef struct _PTRDRAWFUNCTION {
  20747.        PFN    pfnDraw;
  20748.        PCH    pchDataSeg;
  20749.    } PTRDRAWFUNCTION;
  20750.  
  20751.    For a full description, see Chapter 4, "Types, Macros, Structures."
  20752.  
  20753.    hDevice  Identifies the pointing device that receives the device-control
  20754.    function. The handle must have been created previously by using the
  20755.    DosOpen function.
  20756.  
  20757.  Return Value
  20758.  
  20759.    The return value is zero if the function is successful or an error value
  20760.    if an error occurs.
  20761.  
  20762.  See Also
  20763.  
  20764.    DosOpen, MOU_SETPROTDRAWADDRESS
  20765.  
  20766.  
  20767.  ────────────────────────────────────────────────────────────────────────────
  20768.  MOU_SETSCALEFACTORS
  20769.  ────────────────────────────────────────────────────────────────────────────
  20770.    USHORT DosDevIOCtl (0L, psfFactors, 0x0053, 0x0007, hDevice)
  20771.    PSCALEFACT psfFactors;  /*pointer to structure with factors             */
  20772.    HFILE hDevice;          /*device handle                                 */
  20773.  
  20774.    The MOU_SETSCALEFACTORS function reassigns the scaling factors of the
  20775.    current pointing device. Scaling factors are ratio values that determine
  20776.    how much relative movement is necessary before the mouse device driver
  20777.    reports a pointing-device event. In graphics mode, the ratio is given in
  20778.    mickeys-per-pel. In text mode, the ratio is given in
  20779.    mickeys-per-character. The default ratio values are one mickey-per-row and
  20780.    one mickey-per-column.
  20781.  
  20782.  Parameters
  20783.  
  20784.    psfFactors  Points to the SCALEFACT structure that contains the scale
  20785.    factors. The SCALEFACT structure has the following form:
  20786.  
  20787.    typedef struct _SCALEFACT {
  20788.        USHORT rowScale;
  20789.        USHORT colScale;
  20790.    } SCALEFACT;
  20791.  
  20792.    For a full description, see Chapter 4, "Types, Macros, Structures."
  20793.  
  20794.    hDevice  Identifies the pointing device that receives the device-control
  20795.    function. The handle must have been created previously by using the
  20796.    DosOpen function.
  20797.  
  20798.  Return Value
  20799.  
  20800.    The return value is zero if the function is successful or an error value
  20801.    if an error occurs.
  20802.  
  20803.  See Also
  20804.  
  20805.    DosOpen, MOU_GETSCALEFACTORS
  20806.  
  20807.  
  20808.  ────────────────────────────────────────────────────────────────────────────
  20809.  MOU_UPDATEDISPLAYMODE
  20810.  ────────────────────────────────────────────────────────────────────────────
  20811.    USHORT DosDevIOCtl (0L, pviomi, 0x0051, 0x0007, hDevice)
  20812.    PVIOMODEINFO pviomi;    /*pointer to structure with screen mode         */
  20813.    HFILE hDevice;          /*device handle                                 */
  20814.  
  20815.    The MOU_UPDATEDISPLAYMODE function notifies the mouse device driver that
  20816.    the display mode has been modified.
  20817.  
  20818.  Parameters
  20819.  
  20820.    pviomi  Points to the VIOMODEINFO structure that contains the display-mode
  20821.    information. The VIOMODEINFO structure has the following form:
  20822.  
  20823.    typedef struct _VIOMODEINFO {
  20824.        USHORT cb;
  20825.        UCHAR  fbType;
  20826.        UCHAR  color;
  20827.        USHORT col;
  20828.        USHORT row;
  20829.        USHORT hres;
  20830.        USHORT vres;
  20831.        UCHAR  fmt_ID;
  20832.        UCHAR  attrib;
  20833.    } VIOMODEINFO;
  20834.  
  20835.    For a full description, see Chapter 4, "Types, Macros, Structures."
  20836.  
  20837.    hDevice  Identifies the pointing device that receives the device-control
  20838.    function. The handle must have been created previously by using the
  20839.    DosOpen function.
  20840.  
  20841.  Return Value
  20842.  
  20843.    The return value is zero if the function is successful or an error value
  20844.    if an error occurs.
  20845.  
  20846.  Comments
  20847.  
  20848.    When the video I/O subsystem or registered video I/O subsystem sets the
  20849.    display mode, it must notify the mouse device driver prior to switching
  20850.    display modes, in order to synchronize the mouse device driver's functions
  20851.    that update the pointer.
  20852.  
  20853.  See Also
  20854.  
  20855.    DosOpen, VioSetMode
  20856.  
  20857.  
  20858.  ────────────────────────────────────────────────────────────────────────────
  20859.  PDSK_GETPHYSDEVICEPARAMS
  20860.  ────────────────────────────────────────────────────────────────────────────
  20861.    USHORT DosDevIOCtl (pbBlock, pbCommand, 0x0063, 0x0009, hDevice)
  20862.    PBYTE pbBlock;          /*pointer to structure for device parameters    */
  20863.    PBYTE pbCommand;        /*pointer to variable with command              */
  20864.    HFILE hDevice;          /*device handle                                 */
  20865.  
  20866.    The PDSK_GETPHYSDEVICEPARAMS function retrieves the device parameters for
  20867.    a physical device. The retrieved parameters apply to the entire physical
  20868.    disk.
  20869.  
  20870.  Parameters
  20871.  
  20872.    pbBlock  Points to the DEVICEPARAMETERBLOCK structure that receives the
  20873.    device parameters. The DEVICEPARAMETERBLOCK structure has the following
  20874.    form:
  20875.  
  20876.    typedef struct _DEVICEPARAMETERBLOCK {
  20877.        USHORT reserved1;
  20878.        USHORT cCylinders;
  20879.        USHORT cHeads;
  20880.        USHORT cSectorsPerTrack;
  20881.        USHORT reserved2;
  20882.        USHORT reserved3;
  20883.        USHORT reserved4;
  20884.        USHORT reserved5;
  20885.    } DEVICEPARAMETERBLOCK;
  20886.  
  20887.    For a full description, see Chapter 4, "Types, Macros, Structures."
  20888.  
  20889.    pbCommand  Points to the variable that contains a reserved value. The
  20890.    value must be zero.
  20891.  
  20892.    hDevice  Identifies the physical device that receives the device-control
  20893.    function. The handle must have been created previously by using the
  20894.    DosPhysicalDisk function.
  20895.  
  20896.  Return Value
  20897.  
  20898.    The return value is zero if the function is successful or an error value
  20899.    if an error occurs.
  20900.  
  20901.  See Also
  20902.  
  20903.    DosPhysicalDisk
  20904.  
  20905.  
  20906.  ────────────────────────────────────────────────────────────────────────────
  20907.  PDSK_LOCKPHYSDRIVE
  20908.  ────────────────────────────────────────────────────────────────────────────
  20909.    USHORT DosDevIOCtl (0L, pbCommand, 0x0000, 0x0009, hDevice)
  20910.    PBYTE pbCommand;        /*pointer to variable with command              */
  20911.    HFILE hDevice;          /*device handle                                 */
  20912.  
  20913.    The PDSK_LOCKPHYSDRIVE function locks the physical drive and any of its
  20914.    associated logical units.
  20915.  
  20916.  Parameters
  20917.  
  20918.    pbCommand  Points to the variable that contains a reserved value. The
  20919.    value must be zero.
  20920.  
  20921.    hDevice  Identifies the disk-drive device that receives the device-control
  20922.    function. The handle must have been created previously by using the
  20923.    DosPhysicalDisk function.
  20924.  
  20925.  Return Value
  20926.  
  20927.    The return value is zero if the function is successful or an error value
  20928.    if an error occurs.
  20929.  
  20930.  See Also
  20931.  
  20932.    DosPhysicalDisk, PDSK_UNLOCKPHYSDRIVE
  20933.  
  20934.  
  20935.  ────────────────────────────────────────────────────────────────────────────
  20936.  PDSK_READPHYSTRACK
  20937.  ────────────────────────────────────────────────────────────────────────────
  20938.    USHORT DosDevIOCtl (pbBuffer, pbCommand, 0x0064, 0x0009, hDevice)
  20939.    PBYTE pbBuffer;         /*pointer to structure for data                 */
  20940.    PBYTE pbCommand;        /*pointer to structure with command             */
  20941.    HFILE hDevice;          /*device handle                                 */
  20942.  
  20943.    The PDSK_READPHYSTRACK function reads from a physical track on the device
  20944.    specified in the request.
  20945.  
  20946.  Parameters
  20947.  
  20948.    pbBuffer  Points to the buffer that receives the data to be read.
  20949.  
  20950.    pbCommand  Points to the TRACKLAYOUT structure that contains information
  20951.    about the read operation. The TRACKLAYOUT structure has the following
  20952.    form:
  20953.  
  20954.    typedef struct _TRACKLAYOUT {
  20955.        BYTE   bCommand;
  20956.        USHORT head;
  20957.        USHORT cylinder;
  20958.        USHORT firstSector;
  20959.        USHORT cSectors;
  20960.        struct {
  20961.            USHORT sectorNumber;
  20962.            USHORT sectorSize;
  20963.        } TrackTable[1];
  20964.    } TRACKLAYOUT;
  20965.  
  20966.    For a full description, see Chapter 4, "Types, Macros, Structures."
  20967.  
  20968.    hDevice  Identifies the disk drive that receives the device-control
  20969.    function. The handle must have been created previously by using the
  20970.    DosPhysicalDisk function.
  20971.  
  20972.  Return Value
  20973.  
  20974.    The return value is zero if the function is successful or an error value
  20975.    if an error occurs.
  20976.  
  20977.  Comments
  20978.  
  20979.    This function is similar to the DSK_READTRACK function (0x0008, 0x0064)
  20980.    except that I/O is offset from the beginning of the physical drive instead
  20981.    of from the unit number.
  20982.  
  20983.    The track table passed in the function determines the sector number, which
  20984.    is passed to the disk controller. When the sectors are odd-numbered or
  20985.    nonconsecutive, the request is broken into an appropriate number of
  20986.    single-sector operations, and one sector at a time is read.
  20987.  
  20988.    The device driver will not correctly read sectors of sizes other than 512
  20989.    bytes if doing so would generate a direct-memory-access (DMA) violation
  20990.    error.
  20991.  
  20992.  See Also
  20993.  
  20994.    DosPhysicalDisk, DSK_WRITETRACK, PDSK_VERIFYPHYSTRACK,
  20995.    PDSK_WRITEPHYSTRACK
  20996.  
  20997.  
  20998.  ────────────────────────────────────────────────────────────────────────────
  20999.  PDSK_UNLOCKPHYSDRIVE
  21000.  ────────────────────────────────────────────────────────────────────────────
  21001.    USHORT DosDevIOCtl (0L, pbCommand, 0x0001, 0x0009, hDevice)
  21002.    PBYTE pbCommand;        /*pointer to variable with command              */
  21003.    HFILE hDevice;          /*device handle                                 */
  21004.  
  21005.    The PDSK_UNLOCKPHYSDRIVE function unlocks the physical disk drive and any
  21006.    of its associated logical units and also affects the logical units on the
  21007.    physical disk drive.
  21008.  
  21009.  Parameters
  21010.  
  21011.    pbCommand  Points to the variable that contains a reserved value. The
  21012.    value must be zero.
  21013.  
  21014.    hDevice  Identifies the disk drive that receives the device-control
  21015.    function. The handle must have been created previously by using the
  21016.    DosPhysicalDisk function.
  21017.  
  21018.  Return Value
  21019.  
  21020.    The return value is zero if the function is successful or an error value
  21021.    if an error occurs.
  21022.  
  21023.  See Also
  21024.  
  21025.    DosOpen, DosPhysicalDisk, PDSK_LOCKPHYSDRIVE
  21026.  
  21027.  
  21028.  ────────────────────────────────────────────────────────────────────────────
  21029.  PDSK_VERIFYPHYSTRACK
  21030.  ────────────────────────────────────────────────────────────────────────────
  21031.    USHORT DosDevIOCtl (0L, pbCommand, 0x0065, 0x0009, hDevice)
  21032.    PBYTE pbCommand;        /*pointer to structure with verification data   */
  21033.    HFILE hDevice;          /*device handle                                 */
  21034.  
  21035.    The PDSK_VERIFYPHYSTRACK function verifies I/O on a physical track on the
  21036.    device specified in the request.
  21037.  
  21038.  Parameters
  21039.  
  21040.    pbCommand  Points to the TRACKLAYOUT structure that contains information
  21041.    about the verify operation. The TRACKLAYOUT structure has the following
  21042.    form:
  21043.  
  21044.    typedef struct _TRACKLAYOUT {
  21045.        BYTE   bCommand;
  21046.        USHORT head;
  21047.        USHORT cylinder;
  21048.        USHORT firstSector;
  21049.        USHORT cSectors;
  21050.        struct {
  21051.            USHORT sectorNumber;
  21052.            USHORT sectorSize;
  21053.        } TrackTable[1];
  21054.    } TRACKLAYOUT;
  21055.  
  21056.    For a full description, see Chapter 4, "Types, Macros, Structures."
  21057.  
  21058.    hDevice  Identifies the physical device that receives the device-control
  21059.    function. The handle must have been created previously by using the
  21060.    DosPhysicalDisk function.
  21061.  
  21062.  Return Value
  21063.  
  21064.    The return value is zero if the function is successful or an error value
  21065.    if an error occurs.
  21066.  
  21067.  Comments
  21068.  
  21069.    This function is similar to the DSK_VERIFYTRACK function (0x0008, 0x0065)
  21070.    except that I/O is offset from the beginning of the physical drive instead
  21071.    of from the unit number.
  21072.  
  21073.    The track-layout table passed in the function determines the sector
  21074.    number, which is passed to the disk controller. When the sectors are
  21075.    odd-numbered or nonconsecutive, the request is broken into an appropriate
  21076.    number of single-sector operations, and one sector at a time is verified.
  21077.  
  21078.  See Also
  21079.  
  21080.    DosPhysicalDisk, DSK_VERIFYTRACK, PDSK_READPHYSTRACK,
  21081.    PDSK_WRITEPHYSTRACK
  21082.  
  21083.  
  21084.  ────────────────────────────────────────────────────────────────────────────
  21085.  PDSK_WRITEPHYSTRACK
  21086.  ────────────────────────────────────────────────────────────────────────────
  21087.    USHORT DosDevIOCtl (pbBuffer, pbCommand, 0x0044, 0x0009, hDevice)
  21088.    PBYTE pbBuffer;         /*pointer to buffer with data                   */
  21089.    PBYTE pbCommand;        /*pointer to structure with command             */
  21090.    HFILE hDevice;          /*device handle                                 */
  21091.  
  21092.    The PDSK_WRITEPHYSTRACK function writes to a physical track on the device
  21093.    specified in the request.
  21094.  
  21095.  Parameters
  21096.  
  21097.    pbBuffer  Points to the buffer that contains the data to be written.
  21098.  
  21099.    pbCommand  Points to the TRACKLAYOUT structure that contains information
  21100.    about the write operation. The TRACKLAYOUT structure has the following
  21101.    form:
  21102.  
  21103.    typedef struct _TRACKLAYOUT {
  21104.        BYTE   bCommand;
  21105.        USHORT head;
  21106.        USHORT cylinder;
  21107.        USHORT firstSector;
  21108.        USHORT cSectors;
  21109.        struct {
  21110.            USHORT sectorNumber;
  21111.            USHORT sectorSize;
  21112.        } TrackTable[1];
  21113.    } TRACKLAYOUT;
  21114.  
  21115.    For a full description, see Chapter 4, "Types, Macros, Structures."
  21116.  
  21117.    hDevice  Identifies the disk drive that receives the device-control
  21118.    function. The handle must have been created previously by using the
  21119.    DosPhysicalDisk function.
  21120.  
  21121.  Return Value
  21122.  
  21123.    The return value is zero if the function is successful or an error value
  21124.    if an error occurs.
  21125.  
  21126.  Comments
  21127.  
  21128.    This function is similar to the DSK_WRITETRACK function (0x0008, 0x0044)
  21129.    except that I/O is offset from the beginning of the physical drive instead
  21130.    of from the unit number.
  21131.  
  21132.    The track-layout table passed in this function determines the sector
  21133.    number, which is passed to the disk controller. When the sectors are
  21134.    odd-numbered or nonconsecutive, the request is broken into an appropriate
  21135.    number of single-sector operations, and one sector at a time is written.
  21136.  
  21137.  See Also
  21138.  
  21139.    DosPhysicalDisk, DSK_WRITETRACK, PDSK_READPHYSTRACK,
  21140.    PDSK_VERIFYPHYSTRACK
  21141.  
  21142.  
  21143.  ────────────────────────────────────────────────────────────────────────────
  21144.  PRT_ACTIVATEFONT
  21145.  ────────────────────────────────────────────────────────────────────────────
  21146.    USHORT DosDevIOCtl (pbFontInfo, pbCommand, 0x0048, 0x0005, hDevice)
  21147.    PBYTE pbFontInfo;       /*pointer to structure for font info            */
  21148.    PBYTE pbCommand;        /*pointer to byte with command info             */
  21149.    HFILE hDevice;          /*device handle                                 */
  21150.  
  21151.    The PRT_ACTIVATEFONT function activates a font for printing.
  21152.  
  21153.  Parameters
  21154.  
  21155.    pbFontInfo  Points to a FONTINFO structure that specifies the font to
  21156.    activate. The FONTINFO structure has the following form:
  21157.  
  21158.        typedef struct _FONTINFO {
  21159.            USHORT idCodePage;
  21160.            USHORT idFont;
  21161.        } FONTINFO;
  21162.  
  21163.    For a full description, see Chapter 4, "Types, Macros, Structures."
  21164.  
  21165.    pbCommand  Points to a reserved 8-bit value. The value must be zero.
  21166.  
  21167.    hDevice  Identifies the printer that receives the device-control function.
  21168.    The handle must have been created previously by using the DosOpen
  21169.    function.
  21170.  
  21171.  Return Value
  21172.  
  21173.    The return value is zero if the function is successful or an error value
  21174.    if an error occurs.
  21175.  
  21176.  See Also
  21177.  
  21178.    PRT_QUERYACTIVEFONT
  21179.  
  21180.  
  21181.  ────────────────────────────────────────────────────────────────────────────
  21182.  PRT_GETFRAMECTL
  21183.  ────────────────────────────────────────────────────────────────────────────
  21184.    USHORT DosDevIOCtl (pbFrameCtl, pbCommand, 0x0062, 0x0005, hDevice)
  21185.    PBYTE pbFrameCtl;       /*pointer to structure for frame settings       */
  21186.    PBYTE pbCommand;        /*pointer to variable with command              */
  21187.    HFILE hDevice;          /*device handle                                 */
  21188.  
  21189.    The PRT_GETFRAMECTL function retrieves frame-control information for a
  21190.    printer.
  21191.  
  21192.  Parameters
  21193.  
  21194.    pbFrameCtl  Points to the FRAME structure that receives the frame-control
  21195.    information. The FRAME structure has the following form:
  21196.  
  21197.    typedef struct _FRAME {
  21198.        BYTE bCharsPerLine;
  21199.        BYTE bLinesPerInch;
  21200.    } FRAME;
  21201.  
  21202.    For a full description, see Chapter 4, "Types, Macros, Structures."
  21203.  
  21204.    pbCommand  Points to the variable that contains a reserved value. The
  21205.    value must be zero.
  21206.  
  21207.    hDevice  Identifies the printer that receives the device-control function.
  21208.    The handle must have been created previously by using the DosOpen
  21209.    function.
  21210.  
  21211.  Return Value
  21212.  
  21213.    The return value is zero if the function is successful or an error value
  21214.    if an error occurs.
  21215.  
  21216.  See Also
  21217.  
  21218.    DosOpen, PRT_SETFRAMECTL
  21219.  
  21220.  
  21221.  ────────────────────────────────────────────────────────────────────────────
  21222.  PRT_GETINFINITERETRY
  21223.  ────────────────────────────────────────────────────────────────────────────
  21224.    USHORT DosDevIOCtl (pfRetry, pbCommand, 0x0064, 0x0005, hDevice)
  21225.    PBYTE pfRetry;          /*pointer to variable for retry flag            */
  21226.    PBYTE pbCommand;        /*pointer to variable with command              */
  21227.    HFILE hDevice;          /*device handle                                 */
  21228.  
  21229.    The PRT_GETINFINITERETRY function retrieves an infinite retry setting for
  21230.    a printer.
  21231.  
  21232.  Parameters
  21233.  
  21234.    pfRetry  Points to the variable that receives the infinite retry setting.
  21235.    The variable is FALSE if infinite retry is disabled or TRUE if retry is
  21236.    enabled.
  21237.  
  21238.    pbCommand  Points to the variable that contains a reserved value. The
  21239.    value must be zero.
  21240.  
  21241.    hDevice  Identifies the printer that receives the device-control function.
  21242.    The handle must have been created previously by using the DosOpen
  21243.    function.
  21244.  
  21245.  Return Value
  21246.  
  21247.    The return value is zero if the function is successful or an error value
  21248.    if an error occurs.
  21249.  
  21250.  See Also
  21251.  
  21252.    DosOpen, PRT_SETINFINITERETRY
  21253.  
  21254.  
  21255.  ────────────────────────────────────────────────────────────────────────────
  21256.  PRT_GETPRINTERSTATUS
  21257.  ────────────────────────────────────────────────────────────────────────────
  21258.    USHORT DosDevIOCtl (pfStatus, pbCommand, 0x0066, 0x0005, hDevice)
  21259.    PBYTE pfStatus;         /*pointer to printer status flag                */
  21260.    PBYTE pbCommand;        /*pointer to variable with command              */
  21261.    HFILE hDevice;          /*device handle                                 */
  21262.  
  21263.    The PRT_GETPRINTERSTATUS function retrieves the status of a printer.
  21264.  
  21265.  Parameters
  21266.  
  21267.    pfStatus  Points to the variable that receives the printer status. This
  21268.    variable can be a combination of the following values:
  21269.  
  21270.    Value                   Meaning
  21271.    ──────────────────────────────────────────────────────────────────────────
  21272.    PRINTER_TIMEOUT         Time-out occurred.
  21273.  
  21274.    PRINTER_IO_ERROR        I/O error occurred.
  21275.  
  21276.    PRINTER_SELECTED        Printer selected.
  21277.  
  21278.    PRINTER_OUT_OF_PAPER    Printer out of paper.
  21279.  
  21280.    PRINTER_ACKNOWLEDGED    Printer acknowledged.
  21281.  
  21282.    PRINTER_NOT_BUSY        Printer not busy.
  21283.    ──────────────────────────────────────────────────────────────────────────
  21284.  
  21285.    pbCommand  Points to the variable that contains a reserved value. The
  21286.    value must be zero.
  21287.  
  21288.    hDevice  Identifies the printer that receives the device-control function.
  21289.    The handle must have been created previously by using the DosOpen
  21290.    function.
  21291.  
  21292.  Return Value
  21293.  
  21294.    The return value is zero if the function is successful or an error value
  21295.    if an error occurs.
  21296.  
  21297.  See Also
  21298.  
  21299.    DosOpen
  21300.  
  21301.  
  21302.  ────────────────────────────────────────────────────────────────────────────
  21303.  PRT_INITPRINTER
  21304.  ────────────────────────────────────────────────────────────────────────────
  21305.    USHORT DosDevIOCtl (0L, pbCommand, 0x0046, 0x0005, hDevice)
  21306.    PBYTE pbCommand;        /*command value                                 */
  21307.    HFILE hDevice;          /*device handle                                 */
  21308.  
  21309.    The PRT_INITPRINTER function initializes a printer.
  21310.  
  21311.  Parameters
  21312.  
  21313.    pbCommand  Points to the variable that contains a reserved value. The
  21314.    value must be zero.
  21315.  
  21316.    hDevice  Identifies the printer that receives the device-control function.
  21317.    The handle must have been created previously by using the DosOpen
  21318.    function.
  21319.  
  21320.  Return Value
  21321.  
  21322.    The return value is zero if the function is successful or an error value
  21323.    if an error occurs.
  21324.  
  21325.  See Also
  21326.  
  21327.    DosOpen
  21328.  
  21329.  
  21330.  ────────────────────────────────────────────────────────────────────────────
  21331.  PRT_QUERYACTIVEFONT
  21332.  ────────────────────────────────────────────────────────────────────────────
  21333.    USHORT DosDevIOCtl (pbFontInfo, pbCommand, 0x0069, 0x0005, hDevice)
  21334.    PBYTE pbFontInfo;       /*pointer to structure for font information     */
  21335.    PBYTE pbCommand;        /*pointer to byte with command information      */
  21336.    HFILE hDevice;          /*device handle                                 */
  21337.  
  21338.    The PRT_QUERYACTIVEFONT function determines which code page and font are
  21339.    currently active.
  21340.  
  21341.  Parameters
  21342.  
  21343.    pbFontInfo  Points to a FONTINFO structure that specifies the active font.
  21344.    The FONTINFO structure has the following form:
  21345.  
  21346.        typedef struct _FONTINFO {
  21347.            USHORT idCodePage;
  21348.            USHORT idFont;
  21349.        } FONTINFO;
  21350.  
  21351.    For a full description, see Chapter 4, "Types, Macros, Structures."
  21352.  
  21353.    pbCommand  Points to a reserved 8-bit value. The value must be zero.
  21354.  
  21355.    hDevice  Identifies the printer that receives the device-control function.
  21356.    The handle must have been created previously by using the DosOpen
  21357.    function.
  21358.  
  21359.  Return Value
  21360.  
  21361.    The return value is zero if the function is successful or an error value
  21362.    if an error occurs.
  21363.  
  21364.  See Also
  21365.  
  21366.    PRT_ACTIVATEFONT
  21367.  
  21368.  
  21369.  ────────────────────────────────────────────────────────────────────────────
  21370.  PRT_SETFRAMECTL
  21371.  ────────────────────────────────────────────────────────────────────────────
  21372.    USHORT DosDevIOCtl (pbFrameCtl, pbCommand, 0x0042, 0x0005, hDevice)
  21373.    PBYTE pbFrameCtl;       /*pointer to structure with frame settings      */
  21374.    PBYTE pbCommand;        /*pointer to variable with command              */
  21375.    HFILE hDevice;          /*device handle                                 */
  21376.  
  21377.    The PRT_SETFRAMECTL function sets the frame-control information for a
  21378.    printer.
  21379.  
  21380.  Parameters
  21381.  
  21382.    pbFrameCtl  Points to the FRAME structure that contains the frame-control
  21383.    information. The FRAME structure has the following form:
  21384.  
  21385.    typedef struct _FRAME {
  21386.        BYTE bCharsPerLine;
  21387.        BYTE bLinesPerInch;
  21388.    } FRAME;
  21389.  
  21390.    For a full description, see Chapter 4, "Types, Macros, Structures."
  21391.  
  21392.    pbCommand  Points to the variable that contains a reserved value. The
  21393.    value must be zero.
  21394.  
  21395.    hDevice  Identifies the printer that receives the device-control function.
  21396.    The handle must have been created previously by using the DosOpen
  21397.    function.
  21398.  
  21399.  Return Value
  21400.  
  21401.    The return value is zero if the function is successful or an error value
  21402.    if an error occurs.
  21403.  
  21404.  See Also
  21405.  
  21406.    DosOpen, PRT_GETFRAMECTL
  21407.  
  21408.  
  21409.  ────────────────────────────────────────────────────────────────────────────
  21410.  PRT_SETINFINITERETRY
  21411.  ────────────────────────────────────────────────────────────────────────────
  21412.    USHORT DosDevIOCtl (pfRetry, pbCommand, 0x0044, 0x0005, hDevice)
  21413.    PBYTE pfRetry;          /*pointer to retry flag                         */
  21414.    PBYTE pbCommand;        /*pointer to variable with command              */
  21415.    HFILE hDevice;          /*device handle                                 */
  21416.  
  21417.    The PRT_SETINFINITERETRY function sets infinite retry for a printer.
  21418.  
  21419.  Parameters
  21420.  
  21421.    pfRetry  Points to the variable that specifies whether to enable infinite
  21422.    retry. If the variable is FALSE, the function disables infinite retry. If
  21423.    the variable is TRUE, the function enables infinite retry.
  21424.  
  21425.    pbCommand  Points to the variable that contains a reserved value. The
  21426.    value must be zero.
  21427.  
  21428.    hDevice  Identifies the printer that receives the device-control function.
  21429.    The handle must have been created previously by using the DosOpen
  21430.    function.
  21431.  
  21432.  Return Value
  21433.  
  21434.    The return value is zero if the function is successful or an error value
  21435.    if an error occurs.
  21436.  
  21437.  See Also
  21438.  
  21439.    DosOpen, PRT_GETINFINITERETRY
  21440.  
  21441.  
  21442.  ────────────────────────────────────────────────────────────────────────────
  21443.  PRT_VERIFYFONT
  21444.  ────────────────────────────────────────────────────────────────────────────
  21445.    USHORT DosDevIOCtl (pbFontInfo, pbCommand, 0x006A, 0x0005, hDevice)
  21446.    PBYTE pbFontInfo;       /*points to structure for font info             */
  21447.    PBYTE pbCommand;        /*points to byte with command info              */
  21448.    HFILE hDevice;          /*device handle                                 */
  21449.  
  21450.    The PRT_VERIFYFONT function verifies that a particular code page and font
  21451.    are available for the specified printer.
  21452.  
  21453.  Parameters
  21454.  
  21455.    pbFontInfo  Points to the FONTINFO structure that receives information for
  21456.    the available font. The FONTINFO structure has the following form:
  21457.  
  21458.    typedef struct _FONTINFO {
  21459.        USHORT idCodePage;
  21460.        USHORT idFont;
  21461.    } FONTINFO;
  21462.  
  21463.    For a full description, see Chapter 4, "Types, Macros, Structures."
  21464.  
  21465.    pbCommand  Points to a reserved 8-bit value. The value must be zero.
  21466.  
  21467.    hDevice  Identifies the printer that receives the device-control function.
  21468.    The handle must have been created previously by using the DosOpen
  21469.    function.
  21470.  
  21471.  Return Value
  21472.  
  21473.    The return value is zero if the function is successful or an error value
  21474.    if an error occurs.
  21475.  
  21476.  See Also
  21477.  
  21478.    DosOpen, PRT_ACTIVATEFONT
  21479.  
  21480.  
  21481.  ────────────────────────────────────────────────────────────────────────────
  21482.  PTR_GETPTRDRAWADDRESS
  21483.  ────────────────────────────────────────────────────────────────────────────
  21484.    USHORT DosDevIOCtl (pbFunctionInfo, 0L, 0x0072, 0x0003, hDevice)
  21485.    PBYTE pbFunctionInfo;   /*pointer to structure for function             */
  21486.    HFILE hDevice;          /*device handle                                 */
  21487.  
  21488.    The PTR_GETPTRDRAWADDRESS function retrieves the entry-point address and
  21489.    other information for the pointer-draw function (the function that draws
  21490.    the mouse pointer on the screen).
  21491.  
  21492.  Parameters
  21493.  
  21494.    pbFunctionInfo  Points to the PTRDRAWFUNCTION structure that receives the
  21495.    function information. The PTRDRAWFUNCTION structure has the following
  21496.    form:
  21497.  
  21498.    typedef struct _PTRDRAWFUNCTION {
  21499.        PFN    pfnDraw;
  21500.        PCH    pchDataSeg;
  21501.    } PTRDRAWFUNCTION;
  21502.  
  21503.    For a full description, see Chapter 4, "Types, Macros, Structures."
  21504.  
  21505.    hDevice  Identifies the pointing device that receives the device-control
  21506.    function. The handle must have been created previously by using the
  21507.    DosOpen function.
  21508.  
  21509.  Return Value
  21510.  
  21511.    The return value is zero if the function is successful or an error value
  21512.    if an error occurs.
  21513.  
  21514.  Comments
  21515.  
  21516.    The mouse device driver uses the pointer-draw function to update the
  21517.    pointer image on the screen, and retrieves the address and saves it to use
  21518.    whenever the pointer moves.
  21519.  
  21520.  See Also
  21521.  
  21522.    DosOpen
  21523.  
  21524.  
  21525.  
  21526.  ────────────────────────────────────────────────────────────────────────────
  21527.  Chapter 4  Types, Macros, Structures
  21528.  
  21529.         4.1     Introduction
  21530.         4.2     Types
  21531.         4.3     Macros
  21532.         4.4     Structures
  21533.  
  21534.  4.1  Introduction
  21535.  
  21536.    This chapter describes the types, macros, and structures used with MS OS/2
  21537.    Dos, Kbd, Mou, and Vio functions. The MS OS/2 functions use many types,
  21538.    macros, and structures that are not part of the standard C language. These
  21539.    types, macros, and structures have been defined to make the task of
  21540.    creating MS OS/2 programs easier and to make program sources clearer and
  21541.    easier to understand.
  21542.  
  21543.    All types, macros, and structures in this manual are defined in the MS
  21544.    OS/2 C-language include files. Programmers may also wish to use these when
  21545.    developing MS OS/2 programs in other computer languages, such as Pascal or
  21546.    assembly-language. If include files for a given language are not
  21547.    available, a programmer can translate the definitions given in this
  21548.    chapter by following these guidelines:
  21549.  
  21550.    ■  Numbers must be integers or fixed-point real numbers. MS OS/2 functions
  21551.       do not support floating-point numbers. An MS OS/2 program can use
  21552.       floating-point numbers if an appropriate run-time library or
  21553.       coprocessor is supplied and if floating-point numbers are not used as
  21554.       parameters to the MS OS/2 functions.
  21555.  
  21556.    ■  Structures must be packed. Some compilers align each new field in a
  21557.       structure on word or double-word boundaries. This may leave unused
  21558.       bytes in a structure if a given field is smaller than the width between
  21559.       boundaries. MS OS/2 functions require that unused bytes be removed from
  21560.       structures.
  21561.  
  21562.    ■  Reserved fields in structures should be set to zero. Unless otherwise
  21563.       specified, MS OS/2 functions require that reserved fields be set to
  21564.       zero to avoid compatibility problems with future releases of MS OS/2.
  21565.  
  21566.    ■  Variable-length structures must be supported. Several MS OS/2 functions
  21567.       use variable-length structures to receive and/or return information. In
  21568.       a variable-length structure, the number of fields varies depending on
  21569.       when the structure is used. In the C language, programs typically
  21570.       support variable-length structures by allocating enough memory for the
  21571.       current number of fields and accessing those fields by using a pointer
  21572.       to the structure. Programs in other languages may use this method or
  21573.       devise their own method for supporting variable-length structures.
  21574.  
  21575.    ■  All 16-bit pointers must be relative to an explicitly defined segment
  21576.       register. Some compilers assume that the ds and ss registers contain
  21577.       the same value and implicitly use one segment for both. MS OS/2 does
  21578.       not guarantee that the ds and ss registers will be equal. This is
  21579.       especially true in dynamic-link libraries and programs that use
  21580.       callback functions (for example, window procedures).
  21581.  
  21582.    ■  All 32-bit pointers must consist of a selector:offset pair. A physical
  21583.       address, that is, an address that represents a 32-bit offset from the
  21584.       beginning of physical memory, cannot be used by MS OS/2 functions. (One
  21585.       exception to this rule is the VioGetPhysBuf function, which requires a
  21586.       physical address to video memory.)
  21587.  
  21588.  
  21589.  4.2  Types
  21590.  
  21591.    The following is a complete list, in alphabetical order, of the types that
  21592.    have been defined for the functions described in this manual. Many of
  21593.    these types begin with a letter that identifies what the type is used
  21594.    for──for example, H identifies a handle; P, a far pointer; NP, a near
  21595.    pointer; and U, an unsigned variable.
  21596.  
  21597. ╓┌─┌───────────────┌─────────────────────────────────────────────────────────╖
  21598.    Type            Meaning
  21599.    ──────────────────────────────────────────────────────────────────────────
  21600.    BOOL            16-bit Boolean value.
  21601.  
  21602.    BYTE            8-bit unsigned value.
  21603.  
  21604.    CHAR            8-bit signed value.
  21605.  
  21606.    COLOR           32-bit signed value used to hold a color value.
  21607.  
  21608.    ERRORID         32-bit value used as an error identifier.
  21609.  
  21610.    FALSE           Predefined constant set to zero.
  21611.    Type            Meaning
  21612.    ──────────────────────────────────────────────────────────────────────────
  21613.   FALSE           Predefined constant set to zero.
  21614.  
  21615.    HDC             32-bit value used as a device-context handle.
  21616.  
  21617.    HDIR            16-bit value used as a directory handle.
  21618.  
  21619.    HFILE           16-bit value used as a file handle.
  21620.  
  21621.    HKBD            16-bit value used as a logical-keyboard handle.
  21622.  
  21623.    HMF             32-bit value used as a metafile handle.
  21624.  
  21625.    HMODULE         16-bit value used as a module handle.
  21626.  
  21627.    HMONITOR        16-bit value used as a monitor handle.
  21628.  
  21629.    HMOU            16-bit value used as a mouse handle.
  21630.  
  21631.    HPIPE           16-bit value used as a pipe handle.
  21632.    Type            Meaning
  21633.    ──────────────────────────────────────────────────────────────────────────
  21634.   HPIPE           16-bit value used as a pipe handle.
  21635.  
  21636.    HPS             32-bit value used as a presentation-space handle.
  21637.  
  21638.    HQUEUE          16-bit value used as a queue handle.
  21639.  
  21640.    HRGN            16-bit value used as a region handle.
  21641.  
  21642.    HSEM            32-bit value used as a semaphore handle.
  21643.  
  21644.    HSYSSEM         32-bit value used as a system semaphore handle.
  21645.  
  21646.    HTIMER          16-bit value used as a timer handle.
  21647.  
  21648.    HVIO            16-bit value used as a video-device handle.
  21649.  
  21650.    INT             16-bit signed value.
  21651.  
  21652.    LONG            32-bit signed value.
  21653.    Type            Meaning
  21654.    ──────────────────────────────────────────────────────────────────────────
  21655.   LONG            32-bit signed value.
  21656.  
  21657.    NPBYTE          16-bit pointer to an 8-bit unsigned value.
  21658.  
  21659.    NPCH            16-bit pointer to a value or array of values.
  21660.  
  21661.    NPFN            16-bit pointer to a function with pascal calling type.
  21662.  
  21663.    NPSZ            16-bit pointer to a null-terminated string.
  21664.  
  21665.    NULL            Predefined null-pointer value set to zero.
  21666.  
  21667.    PBOOL           32-bit pointer to a Boolean value.
  21668.  
  21669.    PBYTE           32-bit pointer to an 8-bit unsigned value.
  21670.  
  21671.    PCH             32-bit pointer to a value or array of values.
  21672.  
  21673.    PCHAR           32-bit pointer to a value or array of values.
  21674.    Type            Meaning
  21675.    ──────────────────────────────────────────────────────────────────────────
  21676.   PCHAR           32-bit pointer to a value or array of values.
  21677.  
  21678.    PCOLOR          32-bit pointer to a color value.
  21679.  
  21680.    PERRORID        32-bit pointer to an error identifier.
  21681.  
  21682.    PFN             32-bit pointer to a function with pascal calling type.
  21683.  
  21684.    PFNSIGHANDLER   32-bit pointer to a function with pascal calling type.
  21685.  
  21686.    PHDC            32-bit pointer to a device-context handle.
  21687.  
  21688.    PHDIR           32-bit pointer to a directory handle.
  21689.  
  21690.    PHFILE          32-bit pointer to a file handle.
  21691.  
  21692.    PHKBD           32-bit pointer to a logical-keyboard handle.
  21693.  
  21694.    PHMF            32-bit pointer to a metafile handle.
  21695.    Type            Meaning
  21696.    ──────────────────────────────────────────────────────────────────────────
  21697.   PHMF            32-bit pointer to a metafile handle.
  21698.  
  21699.    PHMODULE        32-bit pointer to a module handle.
  21700.  
  21701.    PHMONITOR       32-bit pointer to a monitor handle.
  21702.  
  21703.    PHMOU           32-bit pointer to a mouse handle.
  21704.  
  21705.    PHPIPE          32-bit pointer to a pipe handle.
  21706.  
  21707.    PHPS            32-bit pointer to a presentation-space handle.
  21708.  
  21709.    PHQUEUE         32-bit pointer to a queue handle.
  21710.  
  21711.    PHRGN           32-bit pointer to a region handle.
  21712.  
  21713.    PHSEM           32-bit pointer to a semaphore handle.
  21714.  
  21715.    PHSYSSEM        32-bit pointer to a system-semaphore handle.
  21716.    Type            Meaning
  21717.    ──────────────────────────────────────────────────────────────────────────
  21718.   PHSYSSEM        32-bit pointer to a system-semaphore handle.
  21719.  
  21720.    PHTIMER         32-bit pointer to a timer handle.
  21721.  
  21722.    PHVIO           32-bit pointer to a video-device handle.
  21723.  
  21724.    PID             16-bit value used to hold a process identifier.
  21725.  
  21726.    PINT            32-bit pointer to a 16-bit signed value.
  21727.  
  21728.    PLONG           32-bit pointer to a 32-bit signed value.
  21729.  
  21730.    PPID            32-bit pointer to a process identifier.
  21731.  
  21732.    PSEL            32-bit pointer to a selector.
  21733.  
  21734.    PSHORT          32-bit pointer to a 16-bit signed value.
  21735.  
  21736.    PSZ             32-bit pointer to a null-terminated string.
  21737.    Type            Meaning
  21738.    ──────────────────────────────────────────────────────────────────────────
  21739.   PSZ             32-bit pointer to a null-terminated string.
  21740.  
  21741.    PTID            32-bit pointer to a thread identifier.
  21742.  
  21743.    PUCHAR          32-bit pointer to an unsigned value or array of values.
  21744.  
  21745.    PUINT           32-bit pointer to a 16-bit unsigned value.
  21746.  
  21747.    PULONG          32-bit pointer to a 32-bit unsigned value.
  21748.  
  21749.    PUSHORT         32-bit pointer to a 16-bit unsigned value.
  21750.  
  21751.    PVOID           32-bit pointer to an unspecified data type.
  21752.  
  21753.    SEL             16-bit value used to hold a segment selector.
  21754.  
  21755.    SHORT           16-bit signed value.
  21756.  
  21757.    TID             16-bit value used to hold a thread identifier.
  21758.    Type            Meaning
  21759.    ──────────────────────────────────────────────────────────────────────────
  21760.   TID             16-bit value used to hold a thread identifier.
  21761.  
  21762.    TRUE            Predefined constant set to 1.
  21763.  
  21764.    UCHAR           8-bit unsigned value.
  21765.  
  21766.    UINT            16-bit unsigned value.
  21767.  
  21768.    ULONG           32-bit unsigned value.
  21769.  
  21770.    USHORT          16-bit unsigned value.
  21771.    ──────────────────────────────────────────────────────────────────────────
  21772.  
  21773.  
  21774.  
  21775.  4.3  Macros
  21776.  
  21777.    The following is a complete list, in alphabetical order, of the macros
  21778.    that can be used with the functions described in this manual.
  21779.  
  21780.  
  21781.  ────────────────────────────────────────────────────────────────────────────
  21782.  DEFINEMUXSEMLIST
  21783.  ────────────────────────────────────────────────────────────────────────────
  21784.    DEFINEMUXSEMLIST (name, size)
  21785.  
  21786.    The DEFINEMUXSEMLIST macro creates a structure that is used to hold the
  21787.    semaphore list for the DosMuxSemWait function.
  21788.  
  21789.  Parameters
  21790.  
  21791.    name  Specifies the name of the structure to be created.
  21792.  
  21793.    size  Specifies the size of the structure; that is, the number of
  21794.    semaphores in the list.
  21795.  
  21796.  See Also
  21797.  
  21798.    DosMuxSemWait
  21799.  
  21800.  
  21801.  ────────────────────────────────────────────────────────────────────────────
  21802.  FIELDOFFSET
  21803.  ────────────────────────────────────────────────────────────────────────────
  21804.    FIELDOFFSET (type, field)
  21805.  
  21806.    The FIELDOFFSET macro computes the address offset of the specified field
  21807.    in the structure specified by the type parameter.
  21808.  
  21809.  Parameters
  21810.  
  21811.    type  Specifies the name of the structure.
  21812.  
  21813.    field  Specifies the name of a field defined within the given structure.
  21814.  
  21815.  
  21816.  ────────────────────────────────────────────────────────────────────────────
  21817.  HIBYTE
  21818.  ────────────────────────────────────────────────────────────────────────────
  21819.    HIBYTE (w)
  21820.  
  21821.    The HIBYTE macro retrieves the high-order unsigned byte from the 16-bit
  21822.    value specified by the w parameter.
  21823.  
  21824.  Parameters
  21825.  
  21826.    w  Specifies a 16-bit value.
  21827.  
  21828.  See Also
  21829.  
  21830.    HIUCHAR, LOBYTE
  21831.  
  21832.  
  21833.  ────────────────────────────────────────────────────────────────────────────
  21834.  HIUCHAR
  21835.  ────────────────────────────────────────────────────────────────────────────
  21836.    HIUCHAR (w)
  21837.  
  21838.    The HIUCHAR macro retrieves the high-order unsigned byte from the 16-bit
  21839.    value specified by the w parameter.
  21840.  
  21841.  Parameters
  21842.  
  21843.    w  Specifies a 16-bit value.
  21844.  
  21845.  See Also
  21846.  
  21847.    HIBYTE, LOUCHAR
  21848.  
  21849.  
  21850.  ────────────────────────────────────────────────────────────────────────────
  21851.  HIUSHORT
  21852.  ────────────────────────────────────────────────────────────────────────────
  21853.    HIUSHORT (l)
  21854.  
  21855.    The HIUSHORT macro retrieves the high-order, unsigned 16-bit word from the
  21856.    32-bit value specified by the l parameter.
  21857.  
  21858.  Parameters
  21859.  
  21860.    l  Specifies a 32-bit value.
  21861.  
  21862.  See Also
  21863.  
  21864.    LOUSHORT
  21865.  
  21866.  
  21867.  ────────────────────────────────────────────────────────────────────────────
  21868.  LOBYTE
  21869.  ────────────────────────────────────────────────────────────────────────────
  21870.    LOBYTE (w)
  21871.  
  21872.    The LOBYTE macro retrieves the low-order byte from the 16-bit value
  21873.    specified by the w parameter.
  21874.  
  21875.  Parameters
  21876.  
  21877.    w  Specifies a 16-bit value.
  21878.  
  21879.  See Also
  21880.  
  21881.    HIBYTE, LOUCHAR
  21882.  
  21883.  
  21884.  ────────────────────────────────────────────────────────────────────────────
  21885.  LOUCHAR
  21886.  ────────────────────────────────────────────────────────────────────────────
  21887.    LOUCHAR (w)
  21888.  
  21889.    The LOUCHAR macro retrieves the low-order unsigned byte from the 16-bit
  21890.    value specified by the w parameter.
  21891.  
  21892.  Parameters
  21893.  
  21894.    w  Specifies a 16-bit value.
  21895.  
  21896.  See Also
  21897.  
  21898.    HIUCHAR, LOBYTE
  21899.  
  21900.  
  21901.  ────────────────────────────────────────────────────────────────────────────
  21902.  LOUSHORT
  21903.  ────────────────────────────────────────────────────────────────────────────
  21904.    LOUSHORT (l)
  21905.  
  21906.    The LOUSHORT macro retrieves the low-order unsigned 16-bit word from the
  21907.    32-bit value specified by the l parameter.
  21908.  
  21909.  Parameters
  21910.  
  21911.    l  Specifies a 32-bit value.
  21912.  
  21913.  See Also
  21914.  
  21915.    HIUSHORT
  21916.  
  21917.  
  21918.  ────────────────────────────────────────────────────────────────────────────
  21919.  MAKELONG
  21920.  ────────────────────────────────────────────────────────────────────────────
  21921.    MAKELONG (l, h)
  21922.  
  21923.    The MAKELONG macro combines two 16-bit word values to create a 32-bit long
  21924.    integer.
  21925.  
  21926.  Parameters
  21927.  
  21928.    l  Specifies the low-order 16-bit word value for the new integer.
  21929.  
  21930.    h  Specifies the high-order 16-bit word value for the new integer.
  21931.  
  21932.  See Also
  21933.  
  21934.    MAKESHORT, MAKEULONG
  21935.  
  21936.  
  21937.  ────────────────────────────────────────────────────────────────────────────
  21938.  MAKEP
  21939.  ────────────────────────────────────────────────────────────────────────────
  21940.    MAKEP (sel, off)
  21941.  
  21942.    The MAKEP macro combines a segment selector and an address offset to
  21943.    create a far (32-bit) pointer to a memory address.
  21944.  
  21945.  Parameters
  21946.  
  21947.    sel  Specifies a segment selector. It must be a valid segment
  21948.    selector──for example, if it were created by using the DosAllocSeg
  21949.    function.
  21950.  
  21951.    off  Specifies an offset from the beginning of the given segment to the
  21952.    desired byte. The offset must specify an address within the segment.
  21953.  
  21954.  See Also
  21955.  
  21956.    DosAllocSeg, OFFSETOF, SELECTOROF
  21957.  
  21958.  
  21959.  ────────────────────────────────────────────────────────────────────────────
  21960.  MAKEPGINFOSEG
  21961.  ────────────────────────────────────────────────────────────────────────────
  21962.    MAKEPGINFOSEG (sel)
  21963.  
  21964.    The MAKEPGINFOSEG macro creates a far (32-bit) pointer to the first byte
  21965.    in the global information segment. The macro assumes that the selector
  21966.    specified by the sel parameter has been retrieved by using the
  21967.    DosGetInfoSeg function.
  21968.  
  21969.  Parameters
  21970.  
  21971.    sel  Specifies the segment selector of the global information segment.
  21972.  
  21973.  Example
  21974.  
  21975.    SEL selGlobalSeg, selLocalSeg;
  21976.    GINFOSEG FAR *pgis;
  21977.    DosGetInfoSeg(&selGlobalSeg, &selLocalSeg);
  21978.    pgis = MAKEPGINFOSEG(selGlobalSeg);
  21979.  
  21980.  See Also
  21981.  
  21982.    DosGetInfoSeg, MAKEPLINFOSEG
  21983.  
  21984.  
  21985.  ────────────────────────────────────────────────────────────────────────────
  21986.  MAKEPLINFOSEG
  21987.  ────────────────────────────────────────────────────────────────────────────
  21988.    MAKEPLINFOSEG (sel)
  21989.  
  21990.    The MAKEPLINFOSEG macro creates a far (32-bit) pointer to the first byte
  21991.    in the local information segment. The macro assumes that the selector
  21992.    specified by the sel parameter has been retrieved by using the
  21993.    DosGetInfoSeg function.
  21994.  
  21995.  Parameters
  21996.  
  21997.    sel  Specifies the segment selector of the local information segment.
  21998.  
  21999.  Example
  22000.  
  22001.    SEL selGlobalSeg, selLocalSeg;
  22002.    LINFOSEG FAR *plis;
  22003.    DosGetInfoSeg(&selGlobalSeg, &selLocalSeg);
  22004.    lgis = MAKEPGINFOSEG(selGlobalSeg);
  22005.  
  22006.  See Also
  22007.  
  22008.    DosGetInfoSeg, MAKEPGINFOSEG
  22009.  
  22010.  
  22011.  ────────────────────────────────────────────────────────────────────────────
  22012.  MAKESHORT
  22013.  ────────────────────────────────────────────────────────────────────────────
  22014.    MAKESHORT (l, h)
  22015.  
  22016.    The MAKESHORT macro combines two 8-bit values to create a 16-bit integer.
  22017.  
  22018.  Parameters
  22019.  
  22020.    l  Specifies the low-order 8-bit value of the new integer.
  22021.  
  22022.    h  Specifies the high-order 8-bit value of the new integer.
  22023.  
  22024.  See Also
  22025.  
  22026.    MAKELONG, MAKEUSHORT
  22027.  
  22028.  
  22029.  ────────────────────────────────────────────────────────────────────────────
  22030.  MAKETYPE
  22031.  ────────────────────────────────────────────────────────────────────────────
  22032.    MAKETYPE (v, type)
  22033.  
  22034.    The MAKETYPE macro casts the variable specified by the v parameter as a
  22035.    variable having the type specified by the type parameter. This macro
  22036.    permits the contents of the variable to be accessed as if the variable had
  22037.    the specified type.
  22038.  
  22039.  Parameters
  22040.  
  22041.    v  Specifies the name of the variable to be cast.
  22042.  
  22043.    type  Specifies the name of the data type for the cast.
  22044.  
  22045.  
  22046.  ────────────────────────────────────────────────────────────────────────────
  22047.  MAKEULONG
  22048.  ────────────────────────────────────────────────────────────────────────────
  22049.    MAKEULONG (l, h)
  22050.  
  22051.    The MAKEULONG macro combines two 16-bit values to create a 32-bit unsigned
  22052.    integer.
  22053.  
  22054.  Parameters
  22055.  
  22056.    l  Specifies the low-order 16-bit value of the new integer.
  22057.  
  22058.    h  Specifies the high-order 16-bit value of the new integer.
  22059.  
  22060.  See Also
  22061.  
  22062.    MAKELONG, MAKEUSHORT
  22063.  
  22064.  
  22065.  ────────────────────────────────────────────────────────────────────────────
  22066.  MAKEUSHORT
  22067.  ────────────────────────────────────────────────────────────────────────────
  22068.    MAKEUSHORT (l, h)
  22069.  
  22070.    The MAKEUSHORT macro combines two 8-bit values to create a 16-bit unsigned
  22071.    integer.
  22072.  
  22073.  Parameters
  22074.  
  22075.    l  Specifies the low-order 8-bit value of the new integer.
  22076.  
  22077.    h  Specifies the high-order 8-bit value of the new integer.
  22078.  
  22079.  See Also
  22080.  
  22081.    MAKESHORT, MAKEULONG
  22082.  
  22083.  
  22084.  ────────────────────────────────────────────────────────────────────────────
  22085.  OFFSETOF
  22086.  ────────────────────────────────────────────────────────────────────────────
  22087.    OFFSETOF (p)
  22088.  
  22089.    The OFFSETOF macro retrieves the address offset of the specified far
  22090.    pointer.
  22091.  
  22092.  Parameters
  22093.  
  22094.    p  Specifies a far (32-bit) pointer.
  22095.  
  22096.  See Also
  22097.  
  22098.    SELECTOROF
  22099.  
  22100.  
  22101.  ────────────────────────────────────────────────────────────────────────────
  22102.  SELECTOROF
  22103.  ────────────────────────────────────────────────────────────────────────────
  22104.    SELECTOROF (p)
  22105.  
  22106.    The SELECTOROF macro retrieves the selector from the specified far
  22107.    pointer.
  22108.  
  22109.  Parameters
  22110.  
  22111.    p  Specifies a far (32-bit) pointer.
  22112.  
  22113.  See Also
  22114.  
  22115.    OFFSETOF
  22116.  
  22117.  
  22118.  4.4  Structures
  22119.  
  22120.    The following is a complete list, in alphabetical order, of the structures
  22121.    used by the functions described in this manual.
  22122.  
  22123.  
  22124.  ────────────────────────────────────────────────────────────────────────────
  22125.  BIOSPARAMETERBLOCK
  22126.  ────────────────────────────────────────────────────────────────────────────
  22127.    typedef struct _BIOSPARAMETERBLOCK {    /* bspblk */
  22128.        USHORT usBytesPerSector;
  22129.        BYTE   bSectorsPerCluster;
  22130.        USHORT usReservedSectors;
  22131.        BYTE   cFATs;
  22132.        USHORT cRootEntries;
  22133.        USHORT cSectors;
  22134.        BYTE   bMedia;
  22135.        USHORT usSectorsPerFAT;
  22136.        USHORT usSectorsPerTrack;
  22137.        USHORT cHeads;
  22138.        ULONG  cHiddenSectors;
  22139.        ULONG  cLargeSectors;
  22140.        BYTE   abReserved[6];
  22141.        USHORT cCylinders;
  22142.        BYTE   bDeviceType;
  22143.        USHORT fsDeviceAttr;
  22144.    } BIOSPARAMETERBLOCK;
  22145.  
  22146.    The BIOSPARAMETERBLOCK structure contains BIOS parameter blocks.
  22147.  
  22148.  Fields
  22149.  
  22150.    usBytesPerSector  Specifies the bytes per sector.
  22151.  
  22152.    bSectorsPerCluster  Specifies the sectors per cluster.
  22153.  
  22154.    usReservedSectors  Specifies the reserved sectors.
  22155.  
  22156.    cFATs  Specifies the number of file-allocation tables.
  22157.  
  22158.    cRootEntries  Specifies the maximum number of entries in the root
  22159.    directory.
  22160.  
  22161.    cSectors  Specifies the number of sectors.
  22162.  
  22163.    bMedia  Specifies the media descriptor.
  22164.  
  22165.    usSectorsPerFAT  Specifies the number of sectors per file-allocation
  22166.    table.
  22167.  
  22168.    usSectorsPerTrack  Specifies the number of sectors per track.
  22169.  
  22170.    cHeads  Specifies the number of heads.
  22171.  
  22172.    cHiddenSectors  Specifies the number of hidden sectors.
  22173.  
  22174.    cLargeSectors  Specifies the number of large sectors.
  22175.  
  22176.    abReserved[6]  Specifies six reserved bytes. These must be zero.
  22177.  
  22178.    cCylinders  Specifies the number of cylinders defined for the device.
  22179.  
  22180.    bDeviceType  Specifies the type of device. It can be one of the following
  22181.    values:
  22182.  
  22183.    Value               Meaning
  22184.    ──────────────────────────────────────────────────────────────────────────
  22185.    DEVTYPE_48TPI       48 tracks-per-inch, low-density floppy-disk drive
  22186.  
  22187.    DEVTYPE_96TPI       96 tracks-per-inch, high-density floppy-disk drive
  22188.  
  22189.    DEVTYPE_35          3.5-inch (720K) floppy-disk drive
  22190.  
  22191.    DEVTYPE_8SD         8-inch, single-density floppy-disk drive
  22192.  
  22193.    DEVTYPE_8DD         8-inch, double-density floppy-disk drive
  22194.  
  22195.    DEVTYPE_FIXED       Fixed disk
  22196.  
  22197.    DEVTYPE_TAPE        Tape drive
  22198.  
  22199.    DEVTYPE_UNKNOWN     Other (unknown type of device)
  22200.    ──────────────────────────────────────────────────────────────────────────
  22201.  
  22202.    fsDeviceAttr  Specifies information about the drive. If this value is
  22203.    0x0001, the media are not removable. If it is 0x0002, the media can detect
  22204.    changes. This field can be one or both of these values.
  22205.  
  22206.  See Also
  22207.  
  22208.    DSK_GETDEVICEPARAMS, DSK_SETDEVICEPARAMS
  22209.  
  22210.  
  22211.  ────────────────────────────────────────────────────────────────────────────
  22212.  CODEPAGEINFO
  22213.  ────────────────────────────────────────────────────────────────────────────
  22214.    typedef struct _CODEPAGEINFO {    /* cpi */
  22215.        PBYTE pbTransTable;
  22216.        USHORT idCodePage;
  22217.        USHORT idTable;
  22218.    } CODEPAGEINFO;
  22219.  
  22220.    The CODEPAGEINFO structure specifies the code page and the translation
  22221.    table to be set.
  22222.  
  22223.  Fields
  22224.  
  22225.    pbTransTable  Points to the keyboard translation table.
  22226.  
  22227.    idCodePage  Specifies a code-page identifier. It can be one of the
  22228.    following values:
  22229.  
  22230.    Number      Code page
  22231.    ──────────────────────────────────────────────────────────────────────────
  22232.    437         United States
  22233.  
  22234.    850         Multilingual
  22235.  
  22236.    860         Portuguese
  22237.  
  22238.    863         French-Canadian
  22239.  
  22240.    865         Nordic
  22241.    ──────────────────────────────────────────────────────────────────────────
  22242.  
  22243.    idTable  Specifies the translation table to be replaced. If this value is
  22244.    0xFFFF, it specifies the custom translation table.
  22245.  
  22246.  See Also
  22247.  
  22248.    KBD_SETNLS
  22249.  
  22250.  
  22251.  ────────────────────────────────────────────────────────────────────────────
  22252.  COUNTRYCODE
  22253.  ────────────────────────────────────────────────────────────────────────────
  22254.    typedef struct _COUNTRYCODE {    /* ctryc */
  22255.        USHORT country;
  22256.        USHORT codepage;
  22257.    } COUNTRYCODE;
  22258.  
  22259.    The COUNTRYCODE structure contains the country code and code-page
  22260.    identifier.
  22261.  
  22262.  Fields
  22263.  
  22264.    country  Specifies the country code. It can be one of the following
  22265.    values:
  22266.  
  22267. ╓┌─┌─────────┌───────────────────────────────────────────────────────────────╖
  22268.    Country   Country
  22269.    code
  22270.    ──────────────────────────────────────────────────────────────────────────
  22271.    001       United States
  22272.  
  22273.    002       Canada (French)
  22274.  
  22275.    003       Latin America
  22276.  
  22277.    031       Netherlands
  22278.  
  22279.    032       Belgium
  22280.  
  22281.    033       France
  22282.  
  22283.    Country   Country
  22284.    code
  22285.    ──────────────────────────────────────────────────────────────────────────
  22286. 
  22287.    034       Spain
  22288.  
  22289.    039       Italy
  22290.  
  22291.    041       Switzerland (French)
  22292.  
  22293.    041       Switzerland (German)
  22294.  
  22295.    044       United Kingdom
  22296.  
  22297.    045       Denmark
  22298.  
  22299.    046       Sweden
  22300.  
  22301.    047       Norway
  22302.  
  22303.    049       Germany
  22304.    Country   Country
  22305.    code
  22306.    ──────────────────────────────────────────────────────────────────────────
  22307.   049       Germany
  22308.  
  22309.    061       Australia
  22310.  
  22311.    351       Portugal
  22312.  
  22313.    358       Finland
  22314.    ──────────────────────────────────────────────────────────────────────────
  22315.  
  22316.  
  22317.    If this field is zero, the function uses the current country code.
  22318.  
  22319.    codepage  Specifies the code-page identifier. It can be one of the
  22320.    following values:
  22321.  
  22322.    Number      Code page
  22323.    ──────────────────────────────────────────────────────────────────────────
  22324.    437         United States
  22325.  
  22326.    850         Multilingual
  22327.  
  22328.    860         Portuguese
  22329.  
  22330.    863         French-Canadian
  22331.  
  22332.    865         Nordic
  22333.    ──────────────────────────────────────────────────────────────────────────
  22334.  
  22335.    If this field is zero, the function uses the current code-page identifier.
  22336.  
  22337.  See Also
  22338.  
  22339.    DosCaseMap, DosGetCollate, DosGetCtryInfo, DosGetDBCSEv
  22340.  
  22341.  
  22342.  ────────────────────────────────────────────────────────────────────────────
  22343.  COUNTRYINFO
  22344.  ────────────────────────────────────────────────────────────────────────────
  22345.    typedef struct _COUNTRYINFO {    /* ctryi */
  22346.        USHORT country;
  22347.        USHORT codepage;
  22348.        USHORT fsDateFmt;
  22349.        CHAR   szCurrency[5];
  22350.        CHAR   szThousandsSeparator[2];
  22351.        CHAR   szDecimal[2];
  22352.        CHAR   szDateSeparator[2];
  22353.        CHAR   szTimeSeparator[2];
  22354.        UCHAR  fsCurrencyFmt;
  22355.        UCHAR  cDecimalPlace;
  22356.        UCHAR  fsTimeFmt;
  22357.        USHORT abReserved1[2];
  22358.        CHAR   szDataSeparator[2];
  22359.        USHORT abReserved2[5];
  22360.    } COUNTRYINFO;
  22361.  
  22362.    The COUNTRYINFO structure contains country-dependent formatting
  22363.    information.
  22364.  
  22365.  Fields
  22366.  
  22367.    country  Specifies the country code. It can be one of the following
  22368.    values:
  22369.  
  22370. ╓┌─┌─────────┌───────────────────────────────────────────────────────────────╖
  22371.    Country   Country
  22372.    code
  22373.    ──────────────────────────────────────────────────────────────────────────
  22374.    001       United States
  22375.  
  22376.    002       Canada (French)
  22377.  
  22378.    003       Latin America
  22379.  
  22380.    031       Netherlands
  22381.  
  22382.    032       Belgium
  22383.  
  22384.    033       France
  22385.  
  22386.    034       Spain
  22387.  
  22388.    Country   Country
  22389.    code
  22390.    ──────────────────────────────────────────────────────────────────────────
  22391. 
  22392.    039       Italy
  22393.  
  22394.    041       Switzerland (French)
  22395.  
  22396.    041       Switzerland (German)
  22397.  
  22398.    044       United Kingdom
  22399.  
  22400.    045       Denmark
  22401.  
  22402.    046       Sweden
  22403.  
  22404.    047       Norway
  22405.  
  22406.    049       Germany
  22407.  
  22408.    061       Australia
  22409.    Country   Country
  22410.    code
  22411.    ──────────────────────────────────────────────────────────────────────────
  22412.   061       Australia
  22413.  
  22414.    351       Portugal
  22415.  
  22416.    358       Finland
  22417.    ──────────────────────────────────────────────────────────────────────────
  22418.  
  22419.  
  22420.    codepage  Specifies a reserved value; must be zero.
  22421.  
  22422.    fsDateFmt  Specifies the date format. It can be one of the following
  22423.    values:
  22424.  
  22425.    Value                 Meaning
  22426.    ──────────────────────────────────────────────────────────────────────────
  22427.    DATEFMT_MM_DD_YY      Month, day, year (mm/dd/yy)
  22428.  
  22429.    DATEFMT_DD_MM_YY      Day, month, year (dd/mm/yy)
  22430.  
  22431.    DATEFMT_YY_MM_DD      Year, month, day (yy/mm/dd)
  22432.    ──────────────────────────────────────────────────────────────────────────
  22433.  
  22434.    szCurrency[5]  Specifies the currency indicator. It is a null-terminated
  22435.    string.
  22436.  
  22437.    szThousandsSeparator[2]  Specifies the thousands separator. It is a
  22438.    null-terminated string.
  22439.  
  22440.    szDecimal[2]  Specifies the decimal separator. It is a null-terminated
  22441.    string.
  22442.  
  22443.    szDateSeparator[2]  Specifies the date separator. It is a null-terminated
  22444.    string.
  22445.  
  22446.    szTimeSeparator[2]  Specifies the time separator. It is a null-terminated
  22447.    string.
  22448.  
  22449.    fsCurrencyFmt  Specifies the currency format. It can be any combination of
  22450.    the following values:
  22451.  
  22452.    Value               Meaning
  22453.    ──────────────────────────────────────────────────────────────────────────
  22454.    CURRENCY_FOLLOW     Currency indicator follows the money value. If this
  22455.                        value is not given, the currency indicator precedes
  22456.                        the money value.
  22457.  
  22458.    CURRENCY_SPACE      One space appears between the currency indicator and
  22459.                        the money value. If this value is not given, no space
  22460.                        appears between the currency indicator and the money
  22461.                        value.
  22462.  
  22463.    CURRENCY_DECIMAL    Specified currency indicator replaces the decimal
  22464.                        indicator. If this value is given, other fsCurrencyFmt
  22465.                        values are ignored.
  22466.    ──────────────────────────────────────────────────────────────────────────
  22467.  
  22468.    cDecimalPlace  Specifies the number of decimal places (in binary) used in
  22469.    the currency value.
  22470.  
  22471.    fsTimeFmt  Specifies the time format for file directory presentation. If
  22472.    this field is 0x0001, the time is presented in 24-hour (military-time)
  22473.    format. Otherwise, time is presented in a 12-hour format, with "a" and "p"
  22474.    used for A.M. and P.M. indicators.
  22475.  
  22476.    abReserved1[2]  Specifies a reserved value; must be zero.
  22477.  
  22478.    szDataSeparator[2]  Specifies a data-list separator. It is a
  22479.    null-terminated string.
  22480.  
  22481.    abReserved2[5]  Specifies a reserved value; must be zero.
  22482.  
  22483.  See Also
  22484.  
  22485.    DosGetCtryInfo
  22486.  
  22487.  
  22488.  ────────────────────────────────────────────────────────────────────────────
  22489.  CPID
  22490.  ────────────────────────────────────────────────────────────────────────────
  22491.    typedef struct _CPID {    /* cpid */
  22492.        USHORT idCodePage;
  22493.        USHORT Reserved;
  22494.    } CPID;
  22495.  
  22496.    The CPID structure specifies the code-page identifier for a logical
  22497.    keyboard.
  22498.  
  22499.  Fields
  22500.  
  22501.    idCodePage  Specifies the code-page ID. It can be one of the following
  22502.    values:
  22503.  
  22504.    Number      Code page
  22505.    ──────────────────────────────────────────────────────────────────────────
  22506.    437         United States
  22507.  
  22508.    850         Multilingual
  22509.  
  22510.    860         Portuguese
  22511.  
  22512.    863         French-Canadian
  22513.  
  22514.    865         Nordic
  22515.    ──────────────────────────────────────────────────────────────────────────
  22516.  
  22517.    Reserved  Specifies a reserved value; must be zero.
  22518.  
  22519.  See Also
  22520.  
  22521.    KBD_GETCODEPAGEID
  22522.  
  22523.  
  22524.  ────────────────────────────────────────────────────────────────────────────
  22525.  DATETIME
  22526.  ────────────────────────────────────────────────────────────────────────────
  22527.    typedef struct _DATETIME {    /* date */
  22528.        UCHAR   hours;
  22529.        UCHAR   minutes;
  22530.        UCHAR   seconds;
  22531.        UCHAR   hundredths;
  22532.        UCHAR   day;
  22533.        UCHAR   month;
  22534.        USHORT  year;
  22535.        SHORT   timezone;
  22536.        UCHAR   weekday;
  22537.    } DATETIME;
  22538.  
  22539.    The DATETIME structure contains the date and time.
  22540.  
  22541.  Fields
  22542.  
  22543.    hours  Specifies the current hour using values from 0 through 23.
  22544.  
  22545.    minutes  Specifies the current minute using values from 0 through 59.
  22546.  
  22547.    seconds  Specifies the current second using values from 0 through 59.
  22548.  
  22549.    hundredths  Specifies the current hundredths of a second using values from
  22550.    0 through 99.
  22551.  
  22552.    day  Specifies the current day of the month using values from 1 through
  22553.    31.
  22554.  
  22555.    month  Specifies the current month of the year using values from 1 through
  22556.    12.
  22557.  
  22558.    year  Specifies the current year.
  22559.  
  22560.    timezone  Specifies the difference (in minutes) between the current time
  22561.    zone and Greenwich Mean Time (GMT). This field is positive for time zones
  22562.    west of Greenwich; it is negative for time zones east of Greenwich. For
  22563.    example, for Eastern Standard Time this field is 300 (that is, five hours,
  22564.    5 -1x+1 60, after GMT). If this field is -1, the time zone is undefined.
  22565.  
  22566.    weekday  Specifies the current day of the week using values from 0 through
  22567.    6 (Sunday equals zero).
  22568.  
  22569.  See Also
  22570.  
  22571.    DosGetDateTime, DosSetDateTime
  22572.  
  22573.  
  22574.  ────────────────────────────────────────────────────────────────────────────
  22575.  DCBINFO
  22576.  ────────────────────────────────────────────────────────────────────────────
  22577.    typedef struct _DCBINFO {    /* dcbinf */
  22578.        USHORT usWriteTimeout;
  22579.        USHORT usReadTimeout;
  22580.        BYTE   fbCtlHndShake;
  22581.        BYTE   fbFlowReplace;
  22582.        BYTE   fbTimeout;
  22583.        BYTE   bErrorReplacementChar;
  22584.        BYTE   bBreakReplacementChar;
  22585.        BYTE   bXONChar;
  22586.        BYTE   bXOFFChar;
  22587.    } DCBINFO;
  22588.  
  22589.    The DCBINFO structure holds device-control block information.
  22590.  
  22591.  Fields
  22592.  
  22593.    usWriteTimeout  Specifies the time-out in one-hundredths of a second. If
  22594.    set to zero, the time-out is 0.01 seconds; if set to 1, the time-out is
  22595.    0.02 seconds, and so on.
  22596.  
  22597.    usReadTimeout  Specifies the time-out in one-hundredths of a second. If
  22598.    set to zero, the time-out is 0.01 seconds; if set to 1, the time-out is
  22599.    0.02 seconds, and so on.
  22600.  
  22601.    fbCtlHndShake  Specifies the control and handshaking modes for the DTR and
  22602.    other signals. It can be a combination of the following values:
  22603.  
  22604.    Value                 Meaning
  22605.    ──────────────────────────────────────────────────────────────────────────
  22606.    MODE_DTR_CONTROL      Enable the data-terminal-ready (DTR) control mode.
  22607.  
  22608.    MODE_DTR_HANDSHAKE    Enable the data-terminal-ready (DTR) input
  22609.                          handshaking mode.
  22610.  
  22611.    MODE_CTS_HANDSHAKE    Enable output handshaking using the clear-to-send
  22612.                          (CTS) signal.
  22613.  
  22614.    MODE_DSR_HANDSHAKE    Enable output handshaking using the data-set-ready
  22615.                          (DSR) signal.
  22616.  
  22617.    MODE_DCD_HANDSHAKE    Enable output handshaking using the
  22618.                          data-carrier-detect (DCD) signal.
  22619.  
  22620.    MODE_DSR_SENSITIVITY  Enable input sensitivity using the data-set-ready
  22621.                          (DSR) signal.
  22622.    ──────────────────────────────────────────────────────────────────────────
  22623.  
  22624.    fbFlowReplace  Specifies the flow control and replacement character modes.
  22625.    It can be a combination of the following values:
  22626.  
  22627.    Value                   Meaning
  22628.    ──────────────────────────────────────────────────────────────────────────
  22629.    MODE_AUTO_TRANSMIT      Enable automatic transmit flow control (XON/XOFF).
  22630.  
  22631.    MODE_AUTO_RECEIVE       Enable automatic receive flow control (XON/XOFF).
  22632.  
  22633.    MODE_ERROR_CHAR         Enable error replacement character.
  22634.  
  22635.    MODE_NULL_STRIPPING     Enable null stripping (remove null bytes).
  22636.  
  22637.    MODE_BREAK_CHAR         Enable break replacement character.
  22638.  
  22639.    MODE_RTS_CONTROL        Enable the request-to-send (RTS) control mode.
  22640.  
  22641.    MODE_RTS_HANDSHAKE      Enable the request-to-send (RTS) input handshaking
  22642.                            mode.
  22643.  
  22644.    MODE_TRANSMIT_TOGGLE    Enable toggling on transmit mode.
  22645.    ──────────────────────────────────────────────────────────────────────────
  22646.  
  22647.    fbTimeout  Specifies the time-out processing for the device. It can be a
  22648.    combination of the following values:
  22649.  
  22650.    Value                       Meaning
  22651.    ──────────────────────────────────────────────────────────────────────────
  22652.    MODE_NO_WRITE_TIMEOUT       Enable write infinite time-out processing.
  22653.  
  22654.    MODE_READ_TIMEOUT           Enable normal read time-out processing.
  22655.  
  22656.    MODE_WAIT_READ_TIMEOUT      Enable wait-for-something read time-out
  22657.                                processing.
  22658.  
  22659.    MODE_NOWAIT_READ_TIMEOUT    Enable no-wait read time-out processing.
  22660.    ──────────────────────────────────────────────────────────────────────────
  22661.  
  22662.    bErrorReplacementChar  Specifies the error replacement character.
  22663.  
  22664.    bBreakReplacementChar  Specifies the break replacement character.
  22665.  
  22666.    bXONChar  Specifies the transmission on (XON) character.
  22667.  
  22668.    bXOFFChar  Specifies the transmission off (XOFF) character.
  22669.  
  22670.  See Also
  22671.  
  22672.    ASYNC_GETDCBINFO, ASYNC_SETDCBINFO
  22673.  
  22674.  
  22675.  ────────────────────────────────────────────────────────────────────────────
  22676.  DEVICEPARAMETERBLOCK
  22677.  ────────────────────────────────────────────────────────────────────────────
  22678.    typedef struct _DEVICEPARAMETERBLOCK {    /* dvpblck */
  22679.        USHORT reserved1;
  22680.        USHORT cCylinders;
  22681.        USHORT cHeads;
  22682.        USHORT cSectorsPerTrack;
  22683.        USHORT reserved2;
  22684.        USHORT reserved3;
  22685.        USHORT reserved4;
  22686.        USHORT reserved5;
  22687.    } DEVICEPARAMETERBLOCK;
  22688.  
  22689.    The DEVICEPARAMETERBLOCK structure contains device parameters for the
  22690.    physical disk.
  22691.  
  22692.  Fields
  22693.  
  22694.    reserved1  Specifies a reserved value; must be zero.
  22695.  
  22696.    cCylinders  Specifies the number of cylinders on the physical device.
  22697.  
  22698.    cHeads  Specifies the number of heads on the physical device.
  22699.  
  22700.    cSectorsPerTrack  Specifies the number of sectors per track on the
  22701.    physical device.
  22702.  
  22703.    reserved2-reserved5  Specifies a reserved value; must be zero.
  22704.  
  22705.  See Also
  22706.  
  22707.    PDSK_GETPHYSDEVICEPARAMS
  22708.  
  22709.  
  22710.  ────────────────────────────────────────────────────────────────────────────
  22711.  DOSFSRSEM
  22712.  ────────────────────────────────────────────────────────────────────────────
  22713.    typedef struct _DOSFSRSEM {    /* dosfsrs */
  22714.        USHORT cb;
  22715.        PID    pid;
  22716.        TID    tid;
  22717.        USHORT cUsage;
  22718.        USHORT client;
  22719.        ULONG  sem;
  22720.    } DOSFSRSEM;
  22721.  
  22722.    The DOSFSRSEM structure contains information for a fast-safe RAM
  22723.    semaphore.
  22724.  
  22725.  Fields
  22726.  
  22727.    cb  Specifies the length of the structure (in bytes). It must be set to
  22728.    14.
  22729.  
  22730.    pid  Specifies the process identifier of the process that owns the
  22731.    semaphore. If this field is zero, the semaphore is not owned.
  22732.  
  22733.    tid  Specifies the thread identifier of the thread that owns the
  22734.    semaphore.
  22735.  
  22736.    cUsage  Specifies the number of times the owner has issued a
  22737.    DosFSRamSemRequest function without a corresponding DosFSRamSemClear
  22738.    function.
  22739.  
  22740.    client  Specifies any owner-recorded information that may be needed
  22741.    through maintain the semaphore and the resource being managed.
  22742.  
  22743.    sem  Specifies the RAM semaphore to be used in this request.
  22744.  
  22745.  See Also
  22746.  
  22747.    DosFSRamSemClear, DosFSRamSemRequest
  22748.  
  22749.  
  22750.  ────────────────────────────────────────────────────────────────────────────
  22751.  FDATE
  22752.  ────────────────────────────────────────────────────────────────────────────
  22753.    typedef struct _FDATE {    /* fdate */
  22754.        unsigned day     : 5;
  22755.        unsigned month   : 4;
  22756.        unsigned year    : 7;
  22757.    } FDATE;
  22758.  
  22759.    The FDATE structure is used in various other structures to specify the
  22760.    day, month, and year.
  22761.  
  22762.  Fields
  22763.  
  22764.    day  Specifies the day.
  22765.  
  22766.    month  Specifies the month.
  22767.  
  22768.    year  Specifies the year.
  22769.  
  22770.  See Also
  22771.  
  22772.    FILEFINDBUF, FILESTATUS, FSINFO
  22773.  
  22774.  
  22775.  ────────────────────────────────────────────────────────────────────────────
  22776.  FILEFINDBUF
  22777.  ────────────────────────────────────────────────────────────────────────────
  22778.    typedef struct _FILEFINDBUF {    /* findbuf */
  22779.        FDATE  fdateCreation;
  22780.        FTIME  ftimeCreation;
  22781.        FDATE  fdateLastAccess;
  22782.        FTIME  ftimeLastAccess;
  22783.        FDATE  fdateLastWrite;
  22784.        FTIME  ftimeLastWrite;
  22785.        ULONG  cbFile;
  22786.        ULONG  cbFileAlloc;
  22787.        USHORT attrFile;
  22788.        UCHAR  cchName;
  22789.        CHAR   achName[13];
  22790.    } FILEFINDBUF;
  22791.  
  22792.    The FILEFINDBUF structure contains information about a file.
  22793.  
  22794.  Fields
  22795.  
  22796.    fdateCreation  Specifies the date the file was created.
  22797.  
  22798.    ftimeCreation  Specifies the time the file was created.
  22799.  
  22800.    fdateLastAccess  Specifies the date the file was last accessed.
  22801.  
  22802.    ftimeLastAccess  Specifies the time the file was last accessed.
  22803.  
  22804.    fdateLastWrite  Specifies the date the file was last written to.
  22805.  
  22806.    ftimeLastWrite  Specifies the time the file was last written to.
  22807.  
  22808.    cbFile  Specifies the end of file data.
  22809.  
  22810.    cbFileAlloc  Specifies the allocated file size.
  22811.  
  22812.    attrFile  Specifies the file attributes.
  22813.  
  22814.    cchName  Specifies the length of the null-terminated filename.
  22815.  
  22816.    achName[13]  Specifies the null-terminated filename.
  22817.  
  22818.  See Also
  22819.  
  22820.    DosFindFirst, DosFindNext, FDATE, FTIME
  22821.  
  22822.  
  22823.  ────────────────────────────────────────────────────────────────────────────
  22824.  FILELOCK
  22825.  ────────────────────────────────────────────────────────────────────────────
  22826.    typedef struct _FILELOCK {    /* flock */
  22827.        LONG lOffset;
  22828.        LONG lRange;
  22829.    } FILELOCK;
  22830.  
  22831.    The FILELOCK structure contains information about the starting position
  22832.    and number of bytes of a portion of a file to be locked or unlocked.
  22833.  
  22834.  Fields
  22835.  
  22836.    lFileOffset  Specifies the offset from the beginning of the file to the
  22837.    start of the area to be locked or unlocked.
  22838.  
  22839.    lRangeLength  Specifies the length of the locked or unlocked area (in
  22840.    bytes).
  22841.  
  22842.  See Also
  22843.  
  22844.    DosFileLocks
  22845.  
  22846.  
  22847.  ────────────────────────────────────────────────────────────────────────────
  22848.  FILESTATUS
  22849.  ────────────────────────────────────────────────────────────────────────────
  22850.    typedef struct _FILESTATUS {    /* fsts */
  22851.        FDATE  fdateCreation;
  22852.        FTIME  ftimeCreation;
  22853.        FDATE  fdateLastAccess;
  22854.        FTIME  ftimeLastAccess;
  22855.        FDATE  fdateLastWrite;
  22856.        FTIME  ftimeLastWrite;
  22857.        ULONG  cbFile;
  22858.        ULONG  cbFileAlloc;
  22859.        USHORT attrFile;
  22860.    } FILESTATUS;
  22861.  
  22862.    The FILESTATUS structure contains information about the status of a file.
  22863.  
  22864.  Fields
  22865.  
  22866.    fdateCreation  Specifies the date the file was created.
  22867.  
  22868.    ftimeCreation  Specifies the time the file was created.
  22869.  
  22870.    fdateLastAccess  Specifies the date the file was last accessed.
  22871.  
  22872.    ftimeLastAccess  Specifies the time the file was last accessed.
  22873.  
  22874.    fdateLastWrite  Specifies the date the file was last written to.
  22875.  
  22876.    ftimeLastWrite  Specifies the time the file was last written to.
  22877.  
  22878.    cbFile  Specifies the end of file data.
  22879.  
  22880.    cbFileAlloc  Specifies the allocated file size.
  22881.  
  22882.    attrFile  Specifies the file attributes.
  22883.  
  22884.  Comments
  22885.  
  22886.    The cbFile, cbFileAlloc, and attrFile fields are not used by the
  22887.    DosSetFileInfo function.
  22888.  
  22889.  See Also
  22890.  
  22891.    DosQFileInfo, DosSetFileInfo
  22892.  
  22893.  
  22894.  ────────────────────────────────────────────────────────────────────────────
  22895.  FONTINFO
  22896.  ────────────────────────────────────────────────────────────────────────────
  22897.    typedef struct _FONTINFO {    /* finfo */
  22898.        USHORT idCodePage;
  22899.        USHORT idFont;
  22900.    } FONTINFO;
  22901.  
  22902.    The FONTINFO structure specifies the code-page and font identifiers for a
  22903.    printer font.
  22904.  
  22905.  Fields
  22906.  
  22907.    idCodePage  Specifies the code-page ID. It can be one of the following
  22908.    values:
  22909.  
  22910.    Number      Code page
  22911.    ──────────────────────────────────────────────────────────────────────────
  22912.    437         United States
  22913.  
  22914.    850         Multilingual
  22915.  
  22916.    860         Portuguese
  22917.  
  22918.    863         French-Canadian
  22919.  
  22920.    865         Nordic
  22921.    ──────────────────────────────────────────────────────────────────────────
  22922.  
  22923.    idFont  Specifies the font. The permitted font ID depends on the printer
  22924.    and on the loaded fonts.
  22925.  
  22926.  See Also
  22927.  
  22928.    PRT_ACTIVATEFONT, PRT_QUERYACTIVEFONT, PRT_VERIFYFONT
  22929.  
  22930.  
  22931.  ────────────────────────────────────────────────────────────────────────────
  22932.  FRAME
  22933.  ────────────────────────────────────────────────────────────────────────────
  22934.    typedef struct _FRAME {    /* frm */
  22935.        BYTE bCharsPerLine;
  22936.        BYTE bLinesPerInch;
  22937.    } FRAME;
  22938.  
  22939.    The FRAME structure contains frame-control information for a printer.
  22940.  
  22941.  Fields
  22942.  
  22943.    bCharsPerLine  Specifies the number of characters on a line, either 80 or
  22944.    132.
  22945.  
  22946.    bLinesPerInch  Specifies the number of lines per inch, either 6 or 8.
  22947.  
  22948.  See Also
  22949.  
  22950.    PRT_GETFRAMECTL, PRT_SETFRAMECTL
  22951.  
  22952.  
  22953.  ────────────────────────────────────────────────────────────────────────────
  22954.  FSALLOCATE
  22955.  ────────────────────────────────────────────────────────────────────────────
  22956.    typedef struct _FSALLOCATE {    /* fsalloc */
  22957.        ULONG  idFileSystem;
  22958.        ULONG  cSectorUnit;
  22959.        ULONG  cUnit;
  22960.        ULONG  cUnitAvail;
  22961.        USHORT cbSector;
  22962.    } FSALLOCATE;
  22963.  
  22964.    The FSALLOCATE structure contains information about a disk drive.
  22965.  
  22966.  Fields
  22967.  
  22968.    idFileSystem  Specifies the file-system identifier.
  22969.  
  22970.    cSectorUnit  Specifies the number of sectors per allocation unit.
  22971.  
  22972.    cUnit  Specifies the number of allocation units.
  22973.  
  22974.    cUnitAvail  Specifies the available allocation units.
  22975.  
  22976.    cbSector  Specifies the bytes per sector.
  22977.  
  22978.  See Also
  22979.  
  22980.    DosQFSInfo
  22981.  
  22982.  
  22983.  ────────────────────────────────────────────────────────────────────────────
  22984.  FSINFO
  22985.  ────────────────────────────────────────────────────────────────────────────
  22986.    typedef struct _FSINFO {    /* fsinf */
  22987.        FDATE fdateCreation;
  22988.        FTIME ftimeCreation;
  22989.        VOLUMELABEL vol;
  22990.    } FSINFO;
  22991.  
  22992.    The FSINFO structure contains information about the volume label of a
  22993.    disk.
  22994.  
  22995.  Fields
  22996.  
  22997.    fdateCreation  Specifies the date the volume label was created.
  22998.  
  22999.    ftimeCreation  Specifies the time the volume label was created.
  23000.  
  23001.    vol  Specifies a VOLUMELABEL structure that will contain the name of the
  23002.    volume label.
  23003.  
  23004.  See Also
  23005.  
  23006.    DosQFSInfo, VOLUMELABEL
  23007.  
  23008.  
  23009.  ────────────────────────────────────────────────────────────────────────────
  23010.  FTIME
  23011.  ────────────────────────────────────────────────────────────────────────────
  23012.    typedef struct _FTIME {    /* ftime */
  23013.        unsigned twosecs : 5;
  23014.        unsigned minutes : 6;
  23015.        unsigned hours   : 5;
  23016.    } FTIME;
  23017.  
  23018.    The FTIME structure contains the time in seconds, minutes, and hours.
  23019.  
  23020.  Fields
  23021.  
  23022.    twosecs  Specifies the number of seconds divided by two. To get the actual
  23023.    value, you must multiply it by two. For example, a value of 1 specifies 2
  23024.    seconds, a value of 2 specifies 4 seconds, and so on.
  23025.  
  23026.    minutes  Specifies the minutes.
  23027.  
  23028.    hours  Specifies the hours.
  23029.  
  23030.  See Also
  23031.  
  23032.    FILEFINDBUF, FILESTATUS
  23033.  
  23034.  
  23035.  ────────────────────────────────────────────────────────────────────────────
  23036.  GINFOSEG
  23037.  ────────────────────────────────────────────────────────────────────────────
  23038.    typedef struct _GINFOSEG {    /* gis */
  23039.        ULONG   time;
  23040.        ULONG   msecs;
  23041.        UCHAR   hour;
  23042.        UCHAR   minutes;
  23043.        UCHAR   seconds;
  23044.        UCHAR   hundredths;
  23045.        USHORT  timezone;
  23046.        USHORT  cusecTimerInterval;
  23047.        UCHAR   day;
  23048.        UCHAR   month;
  23049.        USHORT  year;
  23050.        UCHAR   weekday;
  23051.        UCHAR   uchMajorVersion;
  23052.        UCHAR   uchMinorVersion;
  23053.        UCHAR   chRevisionLetter;
  23054.        UCHAR   sgCurrent;
  23055.        UCHAR   sgMax;
  23056.        UCHAR   cHugeShift;
  23057.        UCHAR   fProtectModeOnly;
  23058.        USHORT  pidForeground;
  23059.        UCHAR   fDynamicSched;
  23060.        UCHAR   csecMaxWait;
  23061.        USHORT  cmsecMinSlice;
  23062.        USHORT  cmsecMaxSlice;
  23063.        USHORT  bootdrive;
  23064.        UCHAR   amecRAS[32];
  23065.        UCHAR   csgWindowableVioMax;
  23066.        UCHAR   csgPMMax;
  23067.    } GINFOSEG;
  23068.  
  23069.    The GINFOSEG structure contains various global information.
  23070.  
  23071.  Fields
  23072.  
  23073.    time  Specifies the time from January 1, 1970 (in seconds).
  23074.  
  23075.    msecs  Specifies the current system time (in milliseconds).
  23076.  
  23077.    hour  Specifies the current hour using values from 0 through 23.
  23078.  
  23079.    minutes  Specifies the current minute using values from 0 through 59.
  23080.  
  23081.    seconds  Specifies the current second using values from 0 through 59.
  23082.  
  23083.    hundredths  Specifies the current hundredths of a second using values from
  23084.    0 through 99.
  23085.  
  23086.    timezone  Specifies the difference (in minutes) between the current time
  23087.    zone and Greenwich Mean Time (GMT). This field is positive for time zones
  23088.    west of Greenwich; it is negative for time zones east of Greenwich. For
  23089.    example, for Eastern Standard Time this field is 300 (that is, five hours,
  23090.    5 -1x+1 60, after GMT). If this field is -1, the time zone is undefined.
  23091.  
  23092.    cusecTimerInterval  Specifies the timer interval (in milliseconds).
  23093.  
  23094.    day  Specifies the current day of the month using values from 1 through
  23095.    31.
  23096.  
  23097.    month  Specifies the current month of the year using values from 1 through
  23098.    12.
  23099.  
  23100.    year  Specifies the current year.
  23101.  
  23102.    weekday  Specifies the current day of the week using values from 0 through
  23103.    6 (Sunday equals zero).
  23104.  
  23105.    uchMajorVersion  Specifies the major version number.
  23106.  
  23107.    uchMinorVersion  Specifies the minor version number.
  23108.  
  23109.    chRevisionLetter  Specifies the revision letter.
  23110.  
  23111.    sgCurrent  Specifies the current foreground screen group.
  23112.  
  23113.    sgMax  Specifies the maximum number of screen groups.
  23114.  
  23115.    cHugeShift  Specifies the shift count for huge segments.
  23116.  
  23117.    fProtectModeOnly  Specifies the protected-mode-only indicator.
  23118.  
  23119.    pidForeground  Specifies the identifier of the current foreground process.
  23120.  
  23121.    fDynamicSched  Specifies the dynamic variation flag (1 equals enabled).
  23122.  
  23123.    csecMaxWait  Specifies the maximum wait (in seconds).
  23124.  
  23125.    cmsecMinSlice  Specifies the minimum time slice (in milliseconds).
  23126.  
  23127.    cmsecMaxSlice  Specifies the maximum time slice (in milliseconds).
  23128.  
  23129.    bootdrive  Specifies the boot drive.
  23130.  
  23131.    amecRAS[32]  Specifies that each bit corresponds to a system-trace major
  23132.    code from 0x0000 through 0x00FF. The most significant bit (leftmost) of
  23133.    the first byte in the array corresponds to major code 0x0000. If a bit is
  23134.    cleared, the trace is disabled. If a bit is set, the trace is enabled.
  23135.  
  23136.    csgWindowableVioMax  Specifies the maximum number of VIO window-compatible
  23137.    sessions.
  23138.  
  23139.    csgPMMax  Specifies the maximum number of Presentation Manager sessions.
  23140.  
  23141.  See Also
  23142.  
  23143.    DosGetInfoSeg, LINFOSEG
  23144.  
  23145.  
  23146.  ────────────────────────────────────────────────────────────────────────────
  23147.  HOTKEY
  23148.  ────────────────────────────────────────────────────────────────────────────
  23149.    typedef struct _HOTKEY {    /* htky */
  23150.        USHORT fsHotKey;
  23151.        UCHAR  uchScancodeMake;
  23152.        UCHAR  uchScancodeBreak;
  23153.        USHORT idHotKey;
  23154.    } HOTKEY;
  23155.  
  23156.    The HOTKEY structure contains information for the session-manager hot key.
  23157.  
  23158.  Fields
  23159.  
  23160.    fsHotKey  Specifies the setting for the session-manager hot key. It can be
  23161.    a combination of the following values:
  23162.  
  23163.    Value           Meaning
  23164.    ──────────────────────────────────────────────────────────────────────────
  23165.    RIGHTSHIFT      Right SHIFT key down.
  23166.  
  23167.    LEFTSHIFT       Left SHIFT key down.
  23168.  
  23169.    LEFTCONTROL     Left CONTROL key down.
  23170.  
  23171.    LEFTALT         Left ALT key down.
  23172.  
  23173.    RIGHTCONTROL    Right CONTROL key down.
  23174.  
  23175.    RIGHTALT        Right ALT key down.
  23176.  
  23177.    SCROLLLOCK      SCROLL LOCK key down.
  23178.  
  23179.    NUMLOCK         NUMLOCK key down.
  23180.  
  23181.    CAPSLOCK        CAPSLOCK key down.
  23182.  
  23183.    SYSREQ          SYSREQ key down.
  23184.    ──────────────────────────────────────────────────────────────────────────
  23185.  
  23186.    uchScancodeMake  Specifies the scan code of the hot-key "make." If this
  23187.    field is given, the system detects the hot key when the user presses the
  23188.    key that generates this scan code.
  23189.  
  23190.    uchScancodeBreak  Specifies the scan code of the hot-key "break." If this
  23191.    field is given, the system detects the hot key when the user releases the
  23192.    key that generates this scan code.
  23193.  
  23194.    idHotKey  Specifies the session-manager hot-key identifier. It must be a
  23195.    value from 0 through 15.
  23196.  
  23197.  Comments
  23198.  
  23199.    The scancodeMake and scancodeBreak fields are mutually exclusive; only one
  23200.    may be specified.
  23201.  
  23202.  See Also
  23203.  
  23204.    KBD_GETSESMGRHOTKEY, KBD_SETSESMGRHOTKEY
  23205.  
  23206.  
  23207.  ────────────────────────────────────────────────────────────────────────────
  23208.  KBDINFO
  23209.  ────────────────────────────────────────────────────────────────────────────
  23210.    typedef struct _KBDINFO {    /* kbst */
  23211.        USHORT cb;
  23212.        USHORT fsMask;
  23213.        USHORT chTurnAround;
  23214.        USHORT fsInterim;
  23215.        USHORT fsState;
  23216.    } KBDINFO;
  23217.  
  23218.    The KBDINFO structure contains status information for a logical keyboard.
  23219.  
  23220.  Fields
  23221.  
  23222.    cb  Specifies the length (in bytes) of the KBDINFO structure. It must be
  23223.    set to 10.
  23224.  
  23225.    fsMask  Specifies the current keyboard modes. It can be a combination of
  23226.    the following values:
  23227.  
  23228. ╓┌─┌───────────────────────────────┌─────────────────────────────────────────╖
  23229.    Value                           Meaning
  23230.    ──────────────────────────────────────────────────────────────────────────
  23231.    KEYBOARD_ECHO_ON                Echo mode turned on.
  23232.  
  23233.    KEYBOARD_ECHO_OFF               Echo mode turned off.
  23234.  
  23235.    KEYBOARD_BINARY_MODE            Binary mode turned on.
  23236.  
  23237.    KEYBOARD_ASCII_MODE             ASCII mode turned on.
  23238.  
  23239.    KEYBOARD_MODIFY_STATE           The fsState field is to be modified.
  23240.                                    Applies to the KbdSetStatus function only.
  23241.  
  23242.    KEYBOARD_MODIFY_INTERIM         The fsInterim field is to be modified.
  23243.                                    Applies to the KbdSetStatus function only.
  23244.  
  23245.    KEYBOARD_MODIFY_TURNAROUND      The chTurnAround field is to be modified.
  23246.                                    Applies to the KbdSetStatus function only.
  23247.  
  23248.    KEYBOARD_2B_TURNAROUND          Two-byte turn-around character. If not
  23249.    Value                           Meaning
  23250.    ──────────────────────────────────────────────────────────────────────────
  23251.   KEYBOARD_2B_TURNAROUND          Two-byte turn-around character. If not
  23252.                                    given, the turn-around character is one
  23253.                                    byte.
  23254.  
  23255.    KEYBOARD_SHIFT_REPORT           Shift reporting turned on.
  23256.    ──────────────────────────────────────────────────────────────────────────
  23257.  
  23258.  
  23259.    Note that echo mode is either turned on or off. Only one input mode,
  23260.    binary or ASCII, can be turned on at any given time.
  23261.  
  23262.    chTurnAround  Specifies the turn-around character. If this field value
  23263.    includes 0x0080, the character is two-bytes packed in the low and high
  23264.    bytes of this field. Otherwise, the character is a single byte in the low
  23265.    byte.
  23266.  
  23267.    fsInterim  Specifies the interim character flags. If this field is 0x0020,
  23268.    the program has requested character conversion. If it is 0x0080, the
  23269.    interim character flag is on.
  23270.  
  23271.    fsState  Specifies the state of the shift keys. It can be any combination
  23272.    of the following values:
  23273.  
  23274.    Value           Meaning
  23275.    ──────────────────────────────────────────────────────────────────────────
  23276.    RIGHTSHIFT      Right SHIFT key down.
  23277.  
  23278.    LEFTSHIFT       Left SHIFT key down.
  23279.  
  23280.    CONTROL         CONTROL key down.
  23281.  
  23282.    ALT             ALT key down.
  23283.  
  23284.    SCROLLLOCK_ON   SCROLL LOCK mode turned on.
  23285.  
  23286.    NUMLOCK_ON      NUMLOCK mode turned on.
  23287.  
  23288.    CAPSLOCK_ON     CAPSLOCK mode turned on.
  23289.  
  23290.    INSERT_ON       INSERT mode turned on.
  23291.    ──────────────────────────────────────────────────────────────────────────
  23292.  
  23293.  See Also
  23294.  
  23295.    KbdGetStatus, KbdSetStatus
  23296.  
  23297.  
  23298.  ────────────────────────────────────────────────────────────────────────────
  23299.  KBDKEYINFO
  23300.  ────────────────────────────────────────────────────────────────────────────
  23301.    typedef struct _KBDKEYINFO {    /* kbci */
  23302.        UCHAR  chChar;
  23303.        UCHAR  chScan;
  23304.        UCHAR  fbStatus;
  23305.        UCHAR  bNlsShift;
  23306.        USHORT fsState;
  23307.        ULONG  time;
  23308.    } KBDKEYINFO;
  23309.  
  23310.    The KBDKEYINFO structure contains information when a key is pressed.
  23311.  
  23312.  Fields
  23313.  
  23314.    chChar  Specifies the character derived from translation of the chScan
  23315.    field.
  23316.  
  23317.    chScan  Specifies the scan code received from the keyboard, identifying
  23318.    the key pressed. This scan code may be modified during the translation
  23319.    process.
  23320.  
  23321.    fbStatus  Specifies the state of the retrieved scan code. It can be any
  23322.    combination of the following values:
  23323.  
  23324.    Value                 Meaning
  23325.    ──────────────────────────────────────────────────────────────────────────
  23326.    SHIFT_KEY_IN          Shift key is received (valid only in binary mode
  23327.                          when shift reporting is turned on).
  23328.  
  23329.    CONVERSION_REQUEST    Conversion requested.
  23330.  
  23331.    FINAL_CHAR_IN         Final character received.
  23332.  
  23333.    INTERIM_CHAR_IN       Interim character received.
  23334.    ──────────────────────────────────────────────────────────────────────────
  23335.  
  23336.    bNlsShift  Specifies a reserved value; must be zero.
  23337.  
  23338.    fsState  Specifies the state of the shift keys. It can be any combination
  23339.    of the following values:
  23340.  
  23341. ╓┌─┌───────────────┌─────────────────────────────────────────────────────────╖
  23342.    Value           Meaning
  23343.    ──────────────────────────────────────────────────────────────────────────
  23344.    RIGHTSHIFT      Right SHIFT key down.
  23345.  
  23346.    LEFTSHIFT       Left SHIFT key down.
  23347.  
  23348.    CONTROL         Either CONTROL key down.
  23349.  
  23350.    ALT             Either ALT key down.
  23351.  
  23352.    SCROLLLOCK_ON   SCROLL LOCK mode turned on.
  23353.  
  23354.    Value           Meaning
  23355.    ──────────────────────────────────────────────────────────────────────────
  23356. 
  23357.    NUMLOCK_ON      NUMLOCK mode turned on.
  23358.  
  23359.    CAPSLOCK_ON     CAPSLOCK mode turned on.
  23360.  
  23361.    INSERT_ON       INSERT key turned on.
  23362.  
  23363.    LEFTCONTROL     Left CONTROL key down.
  23364.  
  23365.    LEFTALT         Left ALT key down.
  23366.  
  23367.    RIGHTCONTROL    Right CONTROL key down.
  23368.  
  23369.    RIGHTALT        Right ALT key down.
  23370.  
  23371.    SCROLLLOCK      SCROLL LOCK key down.
  23372.  
  23373.    NUMLOCK         NUMLOCK key down.
  23374.  
  23375.    Value           Meaning
  23376.    ──────────────────────────────────────────────────────────────────────────
  23377. 
  23378.    CAPSLOCK        CAPSLOCK key down.
  23379.  
  23380.    SYSREQ          SYSREQ key down.
  23381.    ──────────────────────────────────────────────────────────────────────────
  23382.  
  23383.  
  23384.    time  Specifies the time stamp of the keystroke (in milliseconds).
  23385.  
  23386.  See Also
  23387.  
  23388.    KbdCharIn, KbdPeek, KBD_PEEKCHAR
  23389.  
  23390.  
  23391.  ────────────────────────────────────────────────────────────────────────────
  23392.  KBDTYPE
  23393.  ────────────────────────────────────────────────────────────────────────────
  23394.    typedef struct _KBDTYPE {    /* kbdtyp */
  23395.        USHORT usType;
  23396.        USHORT reserved1;
  23397.        USHORT reserved2;
  23398.    } KBDTYPE;
  23399.  
  23400.    The KBDTYPE structure contains information about the keyboard type.
  23401.  
  23402.  Fields
  23403.  
  23404.    usType  Specifies the keyboard type. If this field is 0x0000, an IBM PC/AT
  23405.    keyboard is specified. If it is 0x0001, an IBM enhanced keyboard is
  23406.    specified. Values from 0x0002 to 0x0007 are reserved for Japanese
  23407.    keyboards.
  23408.  
  23409.    reserved1  Specifies a reserved value; must be zero.
  23410.  
  23411.    reserved2  Specifies a reserved value; must be zero.
  23412.  
  23413.  See Also
  23414.  
  23415.    KBD_GETKEYBDTYPE
  23416.  
  23417.  
  23418.  ────────────────────────────────────────────────────────────────────────────
  23419.  KBDTRANS
  23420.  ────────────────────────────────────────────────────────────────────────────
  23421.    typedef struct _KBDTRANS {    /* kbxl */
  23422.        UCHAR  chChar;
  23423.        UCHAR  chScan;
  23424.        UCHAR  fbStatus;
  23425.        UCHAR  bNlsShift;
  23426.        USHORT fsState;
  23427.        ULONG  time;
  23428.        USHORT fsDD;
  23429.        USHORT fsXlate;
  23430.        USHORT fsShift;
  23431.        USHORT sZero;
  23432.    } KBDTRANS;
  23433.  
  23434.    The KBDTRANS structure contains translated character information.
  23435.  
  23436.  Fields
  23437.  
  23438.    chChar  Specifies the character value of the translated scan code. The
  23439.    function copies the value to this field before returning.
  23440.  
  23441.    chScan  Specifies the scan code of the keystroke to be translated. This
  23442.    field must be set before the function is called.
  23443.  
  23444.    fbStatus  Specifies the state of the returned scan code. It can be any
  23445.    combination of the following values:
  23446.  
  23447.    Value                 Meaning
  23448.    ──────────────────────────────────────────────────────────────────────────
  23449.    SHIFT_KEY_IN          Shift key received (valid only in binary mode when
  23450.                          shift reporting is turned on).
  23451.  
  23452.    CONVERSION_REQUEST    Conversion requested.
  23453.  
  23454.    FINAL_CHAR_IN         Final character received.
  23455.  
  23456.    INTERIM_CHAR_IN       Interim character received.
  23457.    ──────────────────────────────────────────────────────────────────────────
  23458.  
  23459.    bNlsShift  Specifies a reserved value; must be zero.
  23460.  
  23461.    fsState  Specifies the state of the shift keys. It can be one of the
  23462.    following values:
  23463.  
  23464. ╓┌─┌─────────────────┌───────────────────────────────────────────────────────╖
  23465.    Value             Meaning
  23466.    ──────────────────────────────────────────────────────────────────────────
  23467.    RIGHTSHIFT        Right SHIFT key down.
  23468.  
  23469.    LEFTSHIFT         Left SHIFT key down.
  23470.  
  23471.    CONTROL           Either CONTROL key down.
  23472.  
  23473.    ALT               Either ALT key down.
  23474.  
  23475.    SCROLLLOCK_ON     SCROLL LOCK mode turned on.
  23476.  
  23477.    NUMLOCK_ON        NUMLOCK mode turned on.
  23478.  
  23479.    CAPSLOCK_ON       CAPSLOCK mode turned on.
  23480.    Value             Meaning
  23481.    ──────────────────────────────────────────────────────────────────────────
  23482.   CAPSLOCK_ON       CAPSLOCK mode turned on.
  23483.  
  23484.    INSERT_ON         INSERT mode turned on.
  23485.  
  23486.    LEFTCONTROL       Left CONTROL key down.
  23487.  
  23488.    LEFTALT           Left ALT key down.
  23489.  
  23490.    RIGHTCONTROL      Right CONTROL key down.
  23491.  
  23492.    RIGHTALT          Right ALT key down.
  23493.  
  23494.    SCROLLLOCK        SCROLL LOCK key down.
  23495.  
  23496.    NUMLOCK           NUMLOCK key down.
  23497.  
  23498.    CAPSLOCK          CAPSLOCK key down.
  23499.  
  23500.    SYSREQ            SYSREQ key down.
  23501.    Value             Meaning
  23502.    ──────────────────────────────────────────────────────────────────────────
  23503.   SYSREQ            SYSREQ key down.
  23504.    ──────────────────────────────────────────────────────────────────────────
  23505.  
  23506.  
  23507.    time  Specifies the time stamp of the keystroke (in milliseconds).
  23508.  
  23509.    fsDD  Defined for monitor packets. For more information, see the DosMonReg
  23510.    function.
  23511.  
  23512.    fsXlate  Specifies the translation flags. If this field is 0x0000,
  23513.    translation is incomplete. If it is 0x0001, translation is complete.
  23514.  
  23515.    fsShift  Specifies the state of translation across successive calls.
  23516.    Initially, this field should be zero. It should be reset to zero when the
  23517.    caller wants to start a new translation. Note that it may take several
  23518.    calls to the KbdXlate function to complete a character, so this field
  23519.    should not be changed unless a new translation is desired. This field is
  23520.    cleared when translation is complete.
  23521.  
  23522.    sZero  Specifies a reserved value; must be zero.
  23523.  
  23524.  See Also
  23525.  
  23526.    DosMonReg, KbdXlate
  23527.  
  23528.  
  23529.  ────────────────────────────────────────────────────────────────────────────
  23530.  LINECONTROL
  23531.  ────────────────────────────────────────────────────────────────────────────
  23532.    typedef struct _LINECONTROL {    /* lnctl */
  23533.        BYTE bDataBits;
  23534.        BYTE bParity;
  23535.        BYTE bStopBits;
  23536.        BYTE fbTransBreak;
  23537.    } LINECONTROL;
  23538.  
  23539.    The LINECONTROL structure contains line characteristics for a device.
  23540.  
  23541.  Fields
  23542.  
  23543.    bDataBits  Specifies the number of data bits to be used. It can be one of
  23544.    the following values:
  23545.  
  23546.    Value     Meaning
  23547.    ──────────────────────────────────────────────────────────────────────────
  23548.    0x05      5 data bits
  23549.  
  23550.    0x06      6 data bits
  23551.  
  23552.    0x07      7 data bits
  23553.  
  23554.    0x08      8 data bits
  23555.    ──────────────────────────────────────────────────────────────────────────
  23556.  
  23557.    bParity  Specifies the type of parity checking. It can be one of the
  23558.    following values:
  23559.  
  23560.    Value     Meaning
  23561.    ──────────────────────────────────────────────────────────────────────────
  23562.    0x00      No parity
  23563.  
  23564.    0x01      Odd parity
  23565.  
  23566.    0x02      Even parity
  23567.  
  23568.    0x03      Mark parity (parity bit always 1)
  23569.  
  23570.    0x04      Space parity (parity bit always 0)
  23571.    ──────────────────────────────────────────────────────────────────────────
  23572.  
  23573.    bStopBits  Specifies the number of stop bits used. It can be one of the
  23574.    following values:
  23575.  
  23576.    Value     Meaning
  23577.    ──────────────────────────────────────────────────────────────────────────
  23578.    0x00      1 stop bit
  23579.  
  23580.    0x01      1.5 stop bits (valid only with 5-bit word length)
  23581.  
  23582.    0x02      2 stop bits (not valid with 5-bit word length)
  23583.    ──────────────────────────────────────────────────────────────────────────
  23584.  
  23585.    fbTransBreak  Specifies whether the device is transmitting a break
  23586.    character. If this field is 0x00, a break character is not transmitted. If
  23587.    it is 0x01, a break character is transmitted.
  23588.  
  23589.  Comments
  23590.  
  23591.    The ASYNC_GETLINECTRL function (0x0001, 0x0062) uses all four bytes. The
  23592.    ASYNC_SETLINECTRL function (0x0001, 0x0042) uses only the first three
  23593.    bytes.
  23594.  
  23595.  See Also
  23596.  
  23597.    ASYNC_GETLINECTRL, ASYNC_SETLINECTRL
  23598.  
  23599.  
  23600.  ────────────────────────────────────────────────────────────────────────────
  23601.  LINFOSEG
  23602.  ────────────────────────────────────────────────────────────────────────────
  23603.    typedef struct _LINFOSEG {    /* lis */
  23604.        PID     pidCurrent;
  23605.        PID     pidParent;
  23606.        USHORT  prtyCurrent;
  23607.        TID     tidCurrent;
  23608.        USHORT  sgCurrent;
  23609.        UCHAR   rfProcStatus;
  23610.        UCHAR   dummy1;
  23611.        BOOL    fForeground;
  23612.        UCHAR   typeProcess;
  23613.        UCHAR   dummy2;
  23614.        SEL     selEnvironment;
  23615.        USHORT  offCmdLine;
  23616.        USHORT  cbDataSegment;
  23617.        USHORT  cbStack;
  23618.        USHORT  cbHeap;
  23619.        HMODULE hmod;
  23620.        SEL     selDS;
  23621.    } LINFOSEG;
  23622.  
  23623.    The LINFOSEG structure contains information local to the current process.
  23624.  
  23625.  Fields
  23626.  
  23627.    pidCurrent  Specifies the identifier of the current process.
  23628.  
  23629.    pidParent  Specifies the identifier of the parent process.
  23630.  
  23631.    prtyCurrent  Specifies the priority of the current thread.
  23632.  
  23633.    tidCurrent  Specifies the identifier of the current thread.
  23634.  
  23635.    sgCurrent  Specifies the current screen group.
  23636.  
  23637.    rfProcStatus  Specifies the subscreen group.
  23638.  
  23639.    dummy1  Reserved.
  23640.  
  23641.    fForeground  Specifies that the current process is in foreground.
  23642.  
  23643.    typeProcess  Specifies the process type. It can be one of the following
  23644.    values:
  23645.  
  23646.    Value     Meaning
  23647.    ──────────────────────────────────────────────────────────────────────────
  23648.    0         Process is running in a full-screen protected mode session.
  23649.  
  23650.    1         Process is running in the compatibility box.
  23651.  
  23652.    2         Process is running in a VIO-windowed session.
  23653.  
  23654.    3         Process is running in the Presentation Manager screen group.
  23655.  
  23656.    4         Process is running as a detached process.
  23657.    ──────────────────────────────────────────────────────────────────────────
  23658.  
  23659.    dummy2  Reserved.
  23660.  
  23661.    selEnvironment  Specifies the selector to the application's copy of the
  23662.    environment.
  23663.  
  23664.    offCmdLine  Specifies the offset to the environment where the command line
  23665.    that is used to run the current application is copied.
  23666.  
  23667.    cbDataSegment  Specifies the size of the default data segment.
  23668.  
  23669.    cbStack  Specifies the size of the stack.
  23670.  
  23671.    cbHeap  Specifies the size of the heap.
  23672.  
  23673.    hmod  Identifies the program.
  23674.  
  23675.    selDS  Specifies the default data segment.
  23676.  
  23677.  Comments
  23678.  
  23679.    The following fields are contained in registers at startup:
  23680.  
  23681.    Field           Register
  23682.    ──────────────────────────────────────────────────────────────────────────
  23683.    SelEnvironment  ax
  23684.  
  23685.    offCmdLine      bx
  23686.  
  23687.    cbDataSegment   cx
  23688.  
  23689.    cbStack         dx
  23690.  
  23691.    cbHeap          si
  23692.  
  23693.    hmod            di
  23694.  
  23695.    selDS           ds
  23696.    ──────────────────────────────────────────────────────────────────────────
  23697.  
  23698.  See Also
  23699.  
  23700.    DosGetInfoSeg, GINFOSEG
  23701.  
  23702.  
  23703.  ────────────────────────────────────────────────────────────────────────────
  23704.  MODEMSTATUS
  23705.  ────────────────────────────────────────────────────────────────────────────
  23706.    typedef struct _MODEMSTATUS {    /* mdmst */
  23707.        BYTE fbModemOn;
  23708.        BYTE fbModemOff;
  23709.    } MODEMSTATUS;
  23710.  
  23711.    The MODEMSTATUS structure contains information about modem-control
  23712.    signals.
  23713.  
  23714.  Fields
  23715.  
  23716.    fbModemOn  Specifies the modem-control signals to be enabled. It can be
  23717.    one or both of the following values:
  23718.  
  23719.    Value     Meaning
  23720.    ──────────────────────────────────────────────────────────────────────────
  23721.    DTR_ON    Data-terminal-ready (DTR) signal enabled.
  23722.  
  23723.    RTS_ON    Ready-to-transmit (RTS) signal enabled.
  23724.    ──────────────────────────────────────────────────────────────────────────
  23725.  
  23726.    If it is 0x00, no signals are enabled.
  23727.  
  23728.    fbModemOff  Specifies the modem-control signals to be disabled. It can be
  23729.    one or both of the following values:
  23730.  
  23731.    Value     Meaning
  23732.    ──────────────────────────────────────────────────────────────────────────
  23733.    DTR_OFF   Data-terminal-ready (RTR) signal disabled.
  23734.  
  23735.    RTS_OFF   Ready-to-transmit (RTS) signal disabled.
  23736.    ──────────────────────────────────────────────────────────────────────────
  23737.  
  23738.    If it is 0xFF, no signals are enabled.
  23739.  
  23740.  Comments
  23741.  
  23742.    Any values other than those specified for the fbModemOn and fbModemOff
  23743.    fields will cause an error value.
  23744.  
  23745.  See Also
  23746.  
  23747.    ASYNC_SETMODEMCTRL
  23748.  
  23749.  
  23750.  ────────────────────────────────────────────────────────────────────────────
  23751.  MONIN
  23752.  ────────────────────────────────────────────────────────────────────────────
  23753.    typedef struct _MONIN {    /* mnin */
  23754.        USHORT cb;
  23755.        BYTE abReserved[18];
  23756.        BYTE abBuffer[108];
  23757.    } MONIN;
  23758.  
  23759.    The MONIN structure contains monitor-input information.
  23760.  
  23761.  Fields
  23762.  
  23763.    cb  Specifies the length of the structure (in bytes). The structure must
  23764.    be at least 64 bytes; 128 bytes is the recommended length.
  23765.  
  23766.    abReserved[18]  Specifies a reserved space.
  23767.  
  23768.    abBuffer[108]  Specifies a buffer area which must be greater than or equal
  23769.    to the buffer used by the device driver.
  23770.  
  23771.  See Also
  23772.  
  23773.    DosMonReg
  23774.  
  23775.  
  23776.  ────────────────────────────────────────────────────────────────────────────
  23777.  MONITORPOSITION
  23778.  ────────────────────────────────────────────────────────────────────────────
  23779.    typedef struct _MONITORPOSITION {    /* mnpos */
  23780.        USHORT fPosition;
  23781.        USHORT index;
  23782.        PBYTE  pbInBuf;
  23783.        USHORT offOutBuf;
  23784.    } MONITORPOSITION;
  23785.  
  23786.    The MONITORPOSITION structure contains information about a monitor.
  23787.  
  23788.  Fields
  23789.  
  23790.    fposition  Specifies the position-flag parameter used in the DosMonReg
  23791.    function. It can be one of the following values:
  23792.  
  23793.    Value             Meaning
  23794.    ──────────────────────────────────────────────────────────────────────────
  23795.    MONITOR_DEFAULT   Place the monitor anywhere in the chain.
  23796.  
  23797.    MONITOR_BEGIN     Place the monitor at the beginning of the chain, in
  23798.                      front of any other monitors already in the chain.
  23799.  
  23800.    MONITOR_END       Place the monitor at the end of the chain, after any
  23801.                      other monitors already in the chain.
  23802.    ──────────────────────────────────────────────────────────────────────────
  23803.  
  23804.    index  Specifies a device-specific value.
  23805.  
  23806.    pbInBuf  Points to the monitor-input buffer that is initialized by the
  23807.    monitor dispatcher and used by the DosMonRead function.
  23808.  
  23809.    offOutBuf  Specifies the offset to the monitor-output buffer that is
  23810.    initialized by the monitor dispatcher and used by the DosMonWrite
  23811.    function.
  23812.  
  23813.  See Also
  23814.  
  23815.    DosMonRead, DosMonReg, DosMonWrite, MON_REGISTERMONITOR
  23816.  
  23817.  
  23818.  ────────────────────────────────────────────────────────────────────────────
  23819.  MONOUT
  23820.  ────────────────────────────────────────────────────────────────────────────
  23821.    typedef struct _MONOUT {    /* mnout */
  23822.        USHORT cb;
  23823.        BYTE abReserved[18];
  23824.        BYTE abBuffer[108];
  23825.    } MONOUT;
  23826.  
  23827.    The MONOUT structure contains monitor-output information.
  23828.  
  23829.  Fields
  23830.  
  23831.    cb  Specifies the length of the structure (in bytes). The structure must
  23832.    be at least 64 bytes; 128 bytes is the recommended length.
  23833.  
  23834.    abReserved[18]  Specifies a reserved space.
  23835.  
  23836.    abBuffer[108]  Specifies a buffer area which must be greater than or equal
  23837.    to the buffer used by the device driver.
  23838.  
  23839.  See Also
  23840.  
  23841.    DosMonReg
  23842.  
  23843.  
  23844.  ────────────────────────────────────────────────────────────────────────────
  23845.  MOUEVENTINFO
  23846.  ────────────────────────────────────────────────────────────────────────────
  23847.    typedef struct _MOUEVENTINFO {   /* mouev */
  23848.        USHORT fs;
  23849.        ULONG  time;
  23850.        USHORT row;
  23851.        USHORT col;
  23852.    } MOUEVENTINFO;
  23853.  
  23854.    The MOUEVENTINFO structure contains information about a mouse event.
  23855.  
  23856.  Fields
  23857.  
  23858.    fs  Specifies the action that generated the mouse event. It can be any
  23859.    combination of the following values:
  23860.  
  23861.    Value                         Meaning
  23862.    ──────────────────────────────────────────────────────────────────────────
  23863.    MOUSE_MOTION                  Mouse moved with no buttons down.
  23864.  
  23865.    MOUSE_MOTION_WITH_BN1_DOWN    Mouse moved with button 1 down.
  23866.  
  23867.    MOUSE_BN1_DOWN                Button 1 down.
  23868.  
  23869.    MOUSE_MOTION_WITH_BN2_DOWN    Mouse moved with button 2 down.
  23870.  
  23871.    MOUSE_BN2_DOWN                Button 2 down.
  23872.  
  23873.    MOUSE_MOTION_WITH_BN3_DOWN    Mouse moved with button 3 down.
  23874.  
  23875.    MOUSE_BN3_DOWN                Button 3 down.
  23876.    ──────────────────────────────────────────────────────────────────────────
  23877.  
  23878.    If the mouse button is released with no motion, this field is zero.
  23879.  
  23880.    time  Specifies the number of milliseconds since MS OS/2 was booted.
  23881.  
  23882.    row  Specifies the x-coordinate of the mouse.
  23883.  
  23884.    col  Specifies the y-coordinate of the mouse.
  23885.  
  23886.  See Also
  23887.  
  23888.    MouReadEventQue
  23889.  
  23890.  
  23891.  ────────────────────────────────────────────────────────────────────────────
  23892.  MOUQUEINFO
  23893.  ────────────────────────────────────────────────────────────────────────────
  23894.    typedef struct _MOUQUEINFO {    /* mouqi */
  23895.        USHORT cEvents;
  23896.        USHORT cmaxEvents;
  23897.    } MOUQUEINFO;
  23898.  
  23899.    The MOUQUEINFO structure contains information about the mouse queue.
  23900.  
  23901.  Fields
  23902.  
  23903.    cEvents  Specifies the number of event-queue elements. It can be any value
  23904.    between zero and the maximum queue size.
  23905.  
  23906.    cmaxEvents  Specifies the maximum queue size (the maximum number of queue
  23907.    elements).
  23908.  
  23909.  See Also
  23910.  
  23911.    MouGetNumQueEl
  23912.  
  23913.  
  23914.  ────────────────────────────────────────────────────────────────────────────
  23915.  MUXSEM
  23916.  ────────────────────────────────────────────────────────────────────────────
  23917.    typedef struct _MUXSEM {    /* mxs */
  23918.        USHORT zero;
  23919.        HSEM   hsem;
  23920.    } MUXSEM;
  23921.  
  23922.    The MUXSEM structure contains the semaphore used in the MUXSEMLIST
  23923.    structure.
  23924.  
  23925.  Fields
  23926.  
  23927.    zero  Specifies a reserved value; must be zero.
  23928.  
  23929.    hsem  Identifies the semaphore. The handle must have been created
  23930.    previously by using the DosCreateSem or DosOpenSem function.
  23931.  
  23932.  See Also
  23933.  
  23934.    DosCreateSem, DosOpenSem, MUXSEMLIST
  23935.  
  23936.  
  23937.  ────────────────────────────────────────────────────────────────────────────
  23938.  MUXSEMLIST
  23939.  ────────────────────────────────────────────────────────────────────────────
  23940.    typedef struct _MUXSEMLIST {    /* mxsl */
  23941.        USHORT cmxs;
  23942.        MUXSEM amxs[16];
  23943.    } MUXSEMLIST;
  23944.  
  23945.    The MUXSEMLIST structure contains a list of up to 16 semaphores.
  23946.  
  23947.  Fields
  23948.  
  23949.    cmxs  Specifies the number of semaphores in the list.
  23950.  
  23951.    amxs[16]  Specifies an array of MUXSEM structures.
  23952.  
  23953.  See Also
  23954.  
  23955.    DosMuxSemWait, MUXSEM
  23956.  
  23957.  
  23958.  ────────────────────────────────────────────────────────────────────────────
  23959.  NOPTRRECT
  23960.  ────────────────────────────────────────────────────────────────────────────
  23961.    typedef struct _NOPTRRECT {    /* mourt */
  23962.        USHORT row;
  23963.        USHORT col;
  23964.        USHORT cRow;
  23965.        USHORT cCol;
  23966.    } NOPTRRECT;
  23967.  
  23968.    The NOPTRRECT structure contains the exclusion rectangle for the mouse.
  23969.  
  23970.  Fields
  23971.  
  23972.    row  Specifies the x-coordinate of the upper-left corner.
  23973.  
  23974.    col  Specifies the y-coordinate of the upper-left corner.
  23975.  
  23976.    cRow  Specifies the x-coordinate of the lower-right corner.
  23977.  
  23978.    cCol  Specifies the y-coordinate of the lower-right corner.
  23979.  
  23980.  Comments
  23981.  
  23982.    The units for these fields depend on the current video mode. For text
  23983.    mode, values are given in character cells. For graphics mode, values are
  23984.    given in pels. The fields must not exceed the minimum and maximum
  23985.    coordinate values for screen height and width.
  23986.  
  23987.  See Also
  23988.  
  23989.    MouRemovePtr
  23990.  
  23991.  
  23992.  ────────────────────────────────────────────────────────────────────────────
  23993.  PIDINFO
  23994.  ────────────────────────────────────────────────────────────────────────────
  23995.    typedef struct _PIDINFO {    /* pidi */
  23996.        PID pid;
  23997.        TID tid;
  23998.        PID pidParent;
  23999.    } PIDINFO;
  24000.  
  24001.    The PIDINFO structure contains process identifiers.
  24002.  
  24003.  Fields
  24004.  
  24005.    pid  Specifies the process identifier of the calling process.
  24006.  
  24007.    tid  Specifies the thread identifier of the calling thread.
  24008.  
  24009.    pidParent  Specifies the process identifier of the parent process of the
  24010.    calling process.
  24011.  
  24012.  See Also
  24013.  
  24014.    DosGetPID
  24015.  
  24016.  
  24017.  ────────────────────────────────────────────────────────────────────────────
  24018.  PIPEINFO
  24019.  ────────────────────────────────────────────────────────────────────────────
  24020.    typedef struct _PIPEINFO {    /* nmpinf */
  24021.        USHORT cbOut;
  24022.        USHORT cbIn;
  24023.        BYTE   cbMaxInst;
  24024.        BYTE   cbCurInst;
  24025.        BYTE   cbName;
  24026.        CHAR   szName[1];
  24027.    } PIPEINFO;
  24028.  
  24029.    The PIPEINFO structure contains named-pipe information retrieved by using
  24030.    the DosQNmPipeInfo function. The length of the structure varies depending
  24031.    on the length of the szName field.
  24032.  
  24033.  Fields
  24034.  
  24035.    cbOut  Specifies the size of the buffer for outgoing data.
  24036.  
  24037.    cbIn  Specifies the size of the buffer for incoming data.
  24038.  
  24039.    cbMaxInst  Specifies the maximum number of pipe instances that can be
  24040.    created.
  24041.  
  24042.    cbCurInst  Specifies the number of current pipe instances.
  24043.  
  24044.    cbName  Specifies the length of the pipe name.
  24045.  
  24046.    szName[1]  Contains a null-terminated string with the pipe name, including
  24047.    the computer name if the pipe is remote.
  24048.  
  24049.  See Also
  24050.  
  24051.    DosQNmPipeInfo
  24052.  
  24053.  
  24054.  ────────────────────────────────────────────────────────────────────────────
  24055.  PTRACEBUF
  24056.  ────────────────────────────────────────────────────────────────────────────
  24057.    typedef struct _PTRACEBUF {    /* ptrcbf */
  24058.        PID    pid;
  24059.        TID    tid;
  24060.        USHORT cmd;
  24061.        USHORT value;
  24062.        USHORT offv;
  24063.        USHORT segv;
  24064.        USHORT mte;
  24065.        USHORT rAX;
  24066.        USHORT rBX;
  24067.        USHORT rCX;
  24068.        USHORT rDX;
  24069.        USHORT rSI;
  24070.        USHORT rDI;
  24071.        USHORT rBP;
  24072.        USHORT rDS;
  24073.        USHORT rES;
  24074.        USHORT rIP;
  24075.        USHORT rCS;
  24076.        USHORT rF;
  24077.        USHORT rSP;
  24078.        USHORT rSS;
  24079.    } PTRACEBUF;
  24080.  
  24081.    The PTRACEBUF structure contains various debugging information.
  24082.  
  24083.  Fields
  24084.  
  24085.    pid  Specifies the process identifier of the program being debugged.
  24086.  
  24087.    tid  Specifies the thread identifier of the program being debugged.
  24088.  
  24089.    cmd  Specifies the command to carry out. It can be one of the following
  24090.    values:
  24091.  
  24092. ╓┌─┌─────────┌───────────────────────────────────────────────────────────────╖
  24093.    Value     Meaning
  24094.    ──────────────────────────────────────────────────────────────────────────
  24095.    0x0001    Read memory I-space.
  24096.  
  24097.    0x0002    Read memory D-space.
  24098.  
  24099.    0x0003    Read registers.
  24100.  
  24101.    0x0004    Write memory I-space.
  24102.  
  24103.    0x0005    Write memory D-space.
  24104.  
  24105.    0x0006    Write registers.
  24106.  
  24107.    0x0007    Go (with signal).
  24108.  
  24109.    0x0008    Terminate child process.
  24110.    Value     Meaning
  24111.    ──────────────────────────────────────────────────────────────────────────
  24112.   0x0008    Terminate child process.
  24113.  
  24114.    0x0009    Single step.
  24115.  
  24116.    0x000A    Stop child process.
  24117.  
  24118.    0x000B    Freeze child process.
  24119.  
  24120.    0x000C    Resume child process.
  24121.  
  24122.    0x000D    Convert segment number to selector.
  24123.  
  24124.    0x000E    Get floating-point registers. The segv and offv fields must
  24125.              specify the address of a 94-byte buffer that receives the
  24126.              floating-point register values.
  24127.  
  24128.    0x000F    Set floating-point registers. The segv and offv fields must
  24129.              specify the address of a 94-byte buffer that contains the
  24130.              floating-point register values.
  24131.    Value     Meaning
  24132.    ──────────────────────────────────────────────────────────────────────────
  24133.             floating-point register values.
  24134.  
  24135.    0x0010    Get library-module name. The value field must contain the handle
  24136.              of the library module. The segv and offv fields must contain the
  24137.              address of the buffer that receives the name. This command
  24138.              should be used instead of the DosGetModHandle and DosGetModName
  24139.              functions to verify the name of a library loaded by the program
  24140.              being debugged.
  24141.    ──────────────────────────────────────────────────────────────────────────
  24142.  
  24143.  
  24144.    When the function returns, it copies a code that specifies the command
  24145.    result to the field. The return code can be one of the following values:
  24146.  
  24147. ╓┌─┌─────────┌───────────────────────────────────────────────────────────────╖
  24148.    Value     Meaning
  24149.    ──────────────────────────────────────────────────────────────────────────
  24150.    0x0000    Success return code.
  24151.  
  24152.    Value     Meaning
  24153.    ──────────────────────────────────────────────────────────────────────────
  24154. 
  24155.    0xFFFF    Error. The error code is in the value field.
  24156.  
  24157.    0xFFFE    About to receive signal.
  24158.  
  24159.    0xFFFD    Single-step interrupt.
  24160.  
  24161.    0xFFFC    Hit break point.
  24162.  
  24163.    0xFFFB    Parity error.
  24164.  
  24165.    0xFFFA    Process dying.
  24166.  
  24167.    0xFFF9    General protection fault occurred. The fault type is in the
  24168.              value field. The segv and offv fields contain the address that
  24169.              caused the fault.
  24170.  
  24171.    0xFFF8    Library module has just been loaded. The value field contains
  24172.              the library-module handle.
  24173.    Value     Meaning
  24174.    ──────────────────────────────────────────────────────────────────────────
  24175.             the library-module handle.
  24176.  
  24177.    0xFFF7    Process has not used 287 yet.
  24178.    ──────────────────────────────────────────────────────────────────────────
  24179.  
  24180.  
  24181.    value  Specifies the value to be used for a given command, or a return
  24182.    value from a command. If an error occurs, the field is set to one of the
  24183.    following values:
  24184.  
  24185.    Value     Meaning
  24186.    ──────────────────────────────────────────────────────────────────────────
  24187.    0x0001    Bad command.
  24188.  
  24189.    0x0002    Child process not found.
  24190.  
  24191.    0x0005    Child process untraceable.
  24192.    ──────────────────────────────────────────────────────────────────────────
  24193.  
  24194.    offv  Specifies the offset from the given segment.
  24195.  
  24196.    segv  Specifies a segment selector.
  24197.  
  24198.    mte  Specifies the module handle that contains the segment.
  24199.  
  24200.    rAX  Specifies the ax register.
  24201.  
  24202.    rBX  Specifies the bx register.
  24203.  
  24204.    rCX  Specifies the cx register.
  24205.  
  24206.    rDX  Specifies the dx register.
  24207.  
  24208.    rSI  Specifies the si register.
  24209.  
  24210.    rDI  Specifies the di register.
  24211.  
  24212.    rBP  Specifies the bp register.
  24213.  
  24214.    rDS  Specifies the ds register.
  24215.  
  24216.    rES  Specifies the es register.
  24217.  
  24218.    rIP  Specifies the ip register.
  24219.  
  24220.    rCS  Specifies the cs register.
  24221.  
  24222.    rF  Specifies flags.
  24223.  
  24224.    rSP  Specifies the sp register.
  24225.  
  24226.    rSS  Specifies the ss register.
  24227.  
  24228.  See Also
  24229.  
  24230.    DosGetModHandle, DosGetModName, DosPTrace
  24231.  
  24232.  
  24233.  ────────────────────────────────────────────────────────────────────────────
  24234.  PTRDRAWFUNCTION
  24235.  ────────────────────────────────────────────────────────────────────────────
  24236.    typedef struct _PTRDRAWFUNCTION {    /* ptrdfnc */
  24237.        PFN pfnDraw;
  24238.        PCH pchDataSeg;
  24239.    } PTRDRAWFUNCTION;
  24240.  
  24241.    The PTRDRAWFUNCTION structure contains information about a pointer-draw
  24242.    function.
  24243.  
  24244.  Fields
  24245.  
  24246.    pfnDraw  Points to the pointer-draw function.
  24247.  
  24248.    pchDataSeg  Points to the data segment of the pointer-draw function.
  24249.  
  24250.  See Also
  24251.  
  24252.    MOU_SETPROTDRAWADDRESS, MOU_SETREALDRAWADDRESS,
  24253.    PTR_GETPTRDRAWADDRESSFUNCTION
  24254.  
  24255.  
  24256.  ────────────────────────────────────────────────────────────────────────────
  24257.  PTRLOC
  24258.  ────────────────────────────────────────────────────────────────────────────
  24259.    typedef struct _PTRLOC {    /* moupl */
  24260.        USHORT row;
  24261.        USHORT col;
  24262.    } PTRLOC;
  24263.  
  24264.    The PTRLOC structure contains the position of the mouse.
  24265.  
  24266.  Fields
  24267.  
  24268.    row  Specifies the x-coordinate of the mouse.
  24269.  
  24270.    col  Specifies the y-coordinate of the mouse.
  24271.  
  24272.  Comments
  24273.  
  24274.    The values of the row and col fields depend on the current video mode of
  24275.    the screen (as defined by the VioSetMode function). For text mode, values
  24276.    are given in character cells. For graphics mode, values are given in pels.
  24277.  
  24278.  See Also
  24279.  
  24280.    MouGetPtrPos, MouSetPtrPos, VioSetMode
  24281.  
  24282.  
  24283.  ────────────────────────────────────────────────────────────────────────────
  24284.  PTRSHAPE
  24285.  ────────────────────────────────────────────────────────────────────────────
  24286.    typedef struct _PTRSHAPE {    /* moups */
  24287.        USHORT cb;
  24288.        USHORT col;
  24289.        USHORT row;
  24290.        USHORT colHot;
  24291.        USHORT rowHot;
  24292.    } PTRSHAPE;
  24293.  
  24294.    The PTRSHAPE structure contains information about the shape of the mouse.
  24295.  
  24296.  Fields
  24297.  
  24298.    cb  Specifies the length in bytes of the AND and XOR masks.
  24299.  
  24300.    col  Specifies the width of each mask. For text mode, the width is given
  24301.    in character cells. For graphics mode, the width is given in pels. This
  24302.    value must be greater than or equal to 1.
  24303.  
  24304.    row  Specifies the height of each mask. For text mode, the width is given
  24305.    in character cells. For graphics mode, the height is given in pels. This
  24306.    value must be greater than or equal to 1.
  24307.  
  24308.    colHot  Specifies the horizontal offset from the upper-left corner of the
  24309.    pointer shape to the hot spot. For text mode, the offset is given in
  24310.    character cells. For graphics mode, the offset is given in pels.
  24311.  
  24312.    rowHot  Specifies the vertical offset from the upper-left corner of the
  24313.    pointer shape to the hot spot. For text mode, the offset is given in
  24314.    character cells. For graphics mode, the offset is given in pels.
  24315.  
  24316.  Comments
  24317.  
  24318.    The cb field of this structure is always equal to the height times the
  24319.    width (row -1x+1 col). If the current video mode requires multiple bit
  24320.    planes, the row and col fields specify the width and height of the first
  24321.    plane only, but the function copies all bit planes to the specified
  24322.    buffer.
  24323.  
  24324.  See Also
  24325.  
  24326.    MouGetPtrShape, MouSetPtrShape
  24327.  
  24328.  
  24329.  ────────────────────────────────────────────────────────────────────────────
  24330.  QUEUERESULT
  24331.  ────────────────────────────────────────────────────────────────────────────
  24332.    typedef struct _QUEUERESULT {    /* qresc */
  24333.        PID pidProcess;
  24334.        USHORT usEventCode;
  24335.    } QUEUERESULT;
  24336.  
  24337.    The QUEUERESULT structure contains the result of a queue-reading
  24338.    operation.
  24339.  
  24340.  Fields
  24341.  
  24342.    pidProcess  Specifies the process identifier of the process that added the
  24343.    element to the queue.
  24344.  
  24345.    usEventCode  Specifies a program-supplied event code. MS OS/2 does not use
  24346.    this field and reserves it for any use a program may make of it.
  24347.  
  24348.  See Also
  24349.  
  24350.    DosPeekQueue, DosReadQueue
  24351.  
  24352.  
  24353.  ────────────────────────────────────────────────────────────────────────────
  24354.  RATEDELAY
  24355.  ────────────────────────────────────────────────────────────────────────────
  24356.    typedef struct _RATEDELAY {    /* rtdly */
  24357.        USHORT usDelay;
  24358.        USHORT usRate;
  24359.    } RATEDELAY;
  24360.  
  24361.    The RATEDELAY structure contains typamatic information.
  24362.  
  24363.  Fields
  24364.  
  24365.    usDelay  Specifies the typamatic delay (in milliseconds). A value greater
  24366.    than the maximum value defaults to the maximum value.
  24367.  
  24368.    usRate  Specifies the typamatic rate (characters-per-second). A value
  24369.    greater than the maximum value defaults to the maximum value.
  24370.  
  24371.  See Also
  24372.  
  24373.    KBD_SETTYPAMATICRATE
  24374.  
  24375.  
  24376.  ────────────────────────────────────────────────────────────────────────────
  24377.  RESULTCODES
  24378.  ────────────────────────────────────────────────────────────────────────────
  24379.    typedef struct _RESULTCODES {    /* resc */
  24380.        USHORT codeTerminate;
  24381.        USHORT codeResult;
  24382.    } RESULTCODES;
  24383.  
  24384.    The RESULTCODES structure contains the results of a process when it
  24385.    terminates.
  24386.  
  24387.  Fields
  24388.  
  24389.    codeTerminate  Specifies the child-process identifier if the child process
  24390.    is asynchronous. Otherwise, it specifies the termination code of the child
  24391.    process. The termination code can be one of the following values:
  24392.  
  24393.    Value             Meaning
  24394.    ──────────────────────────────────────────────────────────────────────────
  24395.    TC_EXIT           Normal exit
  24396.  
  24397.    TC_HARDERROR      Hard-error termination
  24398.  
  24399.    TC_TRAP           Trap operation
  24400.  
  24401.    TC_KILLPROCESS    Unintercepted DosKillProcess function
  24402.    ──────────────────────────────────────────────────────────────────────────
  24403.  
  24404.    codeResult  Specifies the result code of the terminating process in its
  24405.    last call to the DosExit function. Specifies the exit code of the child
  24406.    process if the child process is synchronous. This field is not used for an
  24407.    asynchronous child process. The exit code is specified in the last call by
  24408.    the child process to the DosExit function.
  24409.  
  24410.  See Also
  24411.  
  24412.    DosCwait, DosExecPgm, DosExit, DosKillProcess
  24413.  
  24414.  
  24415.  ────────────────────────────────────────────────────────────────────────────
  24416.  RXQUEUE
  24417.  ────────────────────────────────────────────────────────────────────────────
  24418.    typedef struct _RXQUEUE {    /* rxq */
  24419.        USHORT cch;
  24420.        USHORT cb;
  24421.    } RXQUEUE;
  24422.  
  24423.    The RXQUEUE structure contains the number of characters in the queue and
  24424.    the size of the queue.
  24425.  
  24426.  Fields
  24427.  
  24428.    cch  Specifies the number of characters received or to be transmitted in
  24429.    the device-driver queue.
  24430.  
  24431.    cb  Specifies the size of the queue (in bytes).
  24432.  
  24433.  See Also
  24434.  
  24435.    ASYNC_GETINQUECOUNT, ASYNC_GETOUTQUECOUNT
  24436.  
  24437.  
  24438.  ────────────────────────────────────────────────────────────────────────────
  24439.  SCALEFACT
  24440.  ────────────────────────────────────────────────────────────────────────────
  24441.    typedef struct _SCALEFACT {    /* mousc */
  24442.        USHORT rowScale;
  24443.        USHORT colScale;
  24444.    } SCALEFACT;
  24445.  
  24446.    The SCALEFACT structure contains information for scaling the mouse.
  24447.  
  24448.  Fields
  24449.  
  24450.    rowScale  Specifies the vertical scaling factor (the number of mickeys the
  24451.    mouse must move to change the vertical mouse position by one screen unit).
  24452.  
  24453.    colScale  Specifies the horizontal scaling factor (the number of mickeys
  24454.    the mouse must move to change the horizontal mouse position by one screen
  24455.    unit).
  24456.  
  24457.  Comments
  24458.  
  24459.    The rowScale and colScale fields specify mickeys and will always be in the
  24460.    range 1 through 32,767. The screen units may be character cells or pels,
  24461.    depending on the current video mode.
  24462.  
  24463.  See Also
  24464.  
  24465.    MouGetScaleFact, MouSetScaleFact
  24466.  
  24467.  
  24468.  ────────────────────────────────────────────────────────────────────────────
  24469.  SCREENGROUP
  24470.  ────────────────────────────────────────────────────────────────────────────
  24471.    typedef struct _SCREENGROUP {    /* scrgrp */
  24472.        USHORT idScreenGrp;
  24473.        USHORT fTerminate;
  24474.    } SCREENGROUP;
  24475.  
  24476.    The SCREENGROUP structure contains information about the screen group.
  24477.  
  24478.  Fields
  24479.  
  24480.    idScreenGrp  Specifies the screen-group identifier of the new foreground
  24481.    screen or for notification action. The identifier can range from zero to
  24482.    the maximum number of screen groups. The sgMax field in the global
  24483.    descriptor table (GDT) information segment specifies the maximum number of
  24484.    screen groups.
  24485.  
  24486.    fTerminate  Specifies if the screen group is terminating. If it is 0x0000,
  24487.    the screen group is switching. If it is 0xFFFF, the screen group is
  24488.    terminating.
  24489.  
  24490.  See Also
  24491.  
  24492.    KBD_SETFGNDSCREENGRP, MOU_SCREENSWITCH
  24493.  
  24494.  
  24495.  ────────────────────────────────────────────────────────────────────────────
  24496.  SHIFTSTATE
  24497.  ────────────────────────────────────────────────────────────────────────────
  24498.    typedef struct _SHIFTSTATE {    /* shftst */
  24499.        USHORT fsState;
  24500.        BYTE   fNLS;
  24501.    } SHIFTSTATE;
  24502.  
  24503.    The SHIFTSTATE structure contains information about the shift state of the
  24504.    default keyboard of the current screen group.
  24505.  
  24506.  Fields
  24507.  
  24508.    fsState  Specifies the state of the shift keys. It can be any combination
  24509.    of the following values:
  24510.  
  24511. ╓┌─┌─────────────────┌───────────────────────────────────────────────────────╖
  24512.    Value             Meaning
  24513.    ──────────────────────────────────────────────────────────────────────────
  24514.    RIGHTSHIFT        Right SHIFT key down.
  24515.  
  24516.    LEFTSHIFT         Left SHIFT key down.
  24517.  
  24518.    CONTROL           Either CONTROL key down.
  24519.  
  24520.    ALT               Either ALT key down.
  24521.  
  24522.    SCROLLLOCK_ON     SCROLL LOCK mode turned on.
  24523.  
  24524.    NUMLOCK_ON        NUMLOCK mode turned on.
  24525.  
  24526.    CAPSLOCK_ON       CAPSLOCK mode turned on.
  24527.  
  24528.    INSERT_ON         INSERT mode turned on.
  24529.  
  24530.    Value             Meaning
  24531.    ──────────────────────────────────────────────────────────────────────────
  24532. 
  24533.    LEFTCONTROL       Left CONTROL key down.
  24534.  
  24535.    LEFTALT           Left ALT key down.
  24536.  
  24537.    RIGHTCONTROL      Right CONTROL key down.
  24538.  
  24539.    RIGHTALT          Right ALT key down.
  24540.  
  24541.    SCROLLLOCK        SCROLL LOCK key down.
  24542.  
  24543.    NUMLOCK           NUMLOCK key down.
  24544.  
  24545.    CAPSLOCK          CAPSLOCK key down.
  24546.  
  24547.    SYSREQ            SYSREQ key down.
  24548.    ──────────────────────────────────────────────────────────────────────────
  24549.  
  24550.  
  24551.    fNLS  Specifies the state of the national-language-support keys. This is
  24552.    zero for the United States.
  24553.  
  24554.  See Also
  24555.  
  24556.    KBD_GETSHIFTSTATE, KBD_SETSHIFTSTATE
  24557.  
  24558.  
  24559.  ────────────────────────────────────────────────────────────────────────────
  24560.  STARTDATA
  24561.  ────────────────────────────────────────────────────────────────────────────
  24562.    typedef struct _STARTDATA {    /* stdata */
  24563.        USHORT Length;
  24564.        USHORT Related;
  24565.        USHORT FgBg;
  24566.        USHORT TraceOpt;
  24567.        PSZ    PgmTitle;
  24568.        PSZ    PgmName;
  24569.        PBYTE  PgmInputs;
  24570.        PBYTE  TermQ;
  24571.        PBYTE  Environment;
  24572.        USHORT InheritOpt;
  24573.        USHORT SessionType;
  24574.        PSZ    IconFile;
  24575.        ULONG  PgmHandle;
  24576.        USHORT PgmControl;
  24577.        USHORT InitXPos;
  24578.        USHORT InitYPos;
  24579.        USHORT InitXSize;
  24580.        USHORT InitYSize;
  24581.    } STARTDATA;
  24582.  
  24583.    The STARTDATA structure contains information about a session that will be
  24584.    started with the DosStartSession function.
  24585.  
  24586.  Fields
  24587.  
  24588.    Length  Specifies the length of the structure (in bytes). It must be set
  24589.    to 50 bytes.
  24590.  
  24591.    Related  Specifies whether the session created is related to the calling
  24592.    session. If this field is FALSE, the new session is an independent session
  24593.    (not related). If it is TRUE, the new session is a child session
  24594.    (related).
  24595.  
  24596.    FgBg  Specifies whether the new session is started in the foreground or in
  24597.    the background. If this field is TRUE, the session is started in the
  24598.    background. If it is FALSE, the session is started in the foreground.
  24599.  
  24600.    TraceOpt  Specifies whether the program started in the new session is
  24601.    executed under conditions for tracing. If this field is 0, there is no
  24602.    tracing. If it is 1, there is tracing.
  24603.  
  24604.    PgmTitle  Points to the null-terminated string that specifies the program
  24605.    title. The string can be up to 32 bytes long, including the null
  24606.    terminating character. If the address specified is zero or if the
  24607.    null-terminated string is NULL, the initial title is the value of the
  24608.    PgmName field minus any leading drive and path information.
  24609.  
  24610.    PgmName  Points to the null-terminated string that specifies the drive,
  24611.    path, and filename of the program to be loaded.
  24612.  
  24613.    PgmInputs  Points to the null-terminated string that specifies the input
  24614.    arguments to be passed to the program.
  24615.  
  24616.    TermQ  Points to the null-terminated string that specifies the full path
  24617.    name of an MS OS/2 queue or is equal to zero. This parameter is optional.
  24618.  
  24619.    Environment  Points to an environment string that is to be passed to the
  24620.    program started in the new session. If this field is zero, the program in
  24621.    the new session inherits the environment of the parent session if the
  24622.    InheritOpt field is zero, or the environment of the program calling
  24623.    DosStartSession if the InheritOpt field is one.
  24624.  
  24625.    InheritOpt  Specifies whether the program started in the new session
  24626.    inherits the environment and open file handles of the calling process. If
  24627.    this field is zero, inheritance is from the parent session. If this field
  24628.    is 1, inheritance is from the calling process.
  24629.  
  24630.    SessionType  Specifies the type of session that should be created. It is
  24631.    one of the following values:
  24632.  
  24633.    Value     Meaning
  24634.    ──────────────────────────────────────────────────────────────────────────
  24635.    0         Use the data specified by the PgmHandle field or allow MS OS/2
  24636.              to establish the session type.
  24637.  
  24638.    1         Start the process in a full-screen session.
  24639.  
  24640.    2         Start the process in a window session for programs using the
  24641.              base video subsystem.
  24642.  
  24643.    3         Start the process in a window session for programs using the
  24644.              Presentation Manager application programming interface.
  24645.    ──────────────────────────────────────────────────────────────────────────
  24646.  
  24647.    IconFile  Points to a null-terminated string that contains the
  24648.    fully-qualified device, path name, and filename of an icon definition. The
  24649.    system provides an icon for window applications if an icon filename is not
  24650.    provided by the DosStartSession call.
  24651.  
  24652.    PgmHandle  Specifies a program handle.
  24653.  
  24654.    PgmControl  Specifies the initial state for a window application. This
  24655.    field is ignored by full-screen sessions. It can be any combination of the
  24656.    following values:
  24657.  
  24658.    Value     Meaning
  24659.    ──────────────────────────────────────────────────────────────────────────
  24660.    0         Invisible
  24661.  
  24662.    2         Maximize
  24663.  
  24664.    4         Minimize
  24665.  
  24666.    8         No auto close
  24667.  
  24668.    32768     Use specified position and size
  24669.    ──────────────────────────────────────────────────────────────────────────
  24670.  
  24671.    InitXPos  Specifies the initial x coordinate (in pels) for the
  24672.    initial-session window, where (0,0) is the lower-left corner of the
  24673.    display. This field is ignored for full-screen sessions.
  24674.  
  24675.    InitYPos  Specifies the initial y coordinate (in pels) for the
  24676.    initial-session window, where (0,0) is the lower-left corner of the
  24677.    display. This field is ignored for full-screen sessions.
  24678.  
  24679.    InitXSize  Specifies the width (in pels) for the initial-session window.
  24680.    This field is ignored for full-screen sessions.
  24681.  
  24682.    InitYSize  Specifies the height (in pels) for the initial-session window.
  24683.    This field is ignored for full-screen sessions.
  24684.  
  24685.  See Also
  24686.  
  24687.    DosStartSession
  24688.  
  24689.  
  24690.  ────────────────────────────────────────────────────────────────────────────
  24691.  STATUSDATA
  24692.  ────────────────────────────────────────────────────────────────────────────
  24693.    typedef struct _STATUSDATA {    /* stsdata */
  24694.        USHORT Length;
  24695.        USHORT SelectInd;
  24696.        USHORT BindInd;
  24697.    } STATUSDATA;
  24698.  
  24699.    The STATUSDATA structure contains status information about a session.
  24700.  
  24701.  Fields
  24702.  
  24703.    Length  Specifies the length of the data structure (in bytes).
  24704.  
  24705.    SelectInd  Specifies whether the target session should be set as
  24706.    selectable or nonselectable. It can be one of the following values:
  24707.  
  24708.    Value                   Meaning
  24709.    ──────────────────────────────────────────────────────────────────────────
  24710.    TARGET_UNCHANGED        Leave current setting unchanged.
  24711.  
  24712.    TARGET_SELECTABLE       Set as selectable.
  24713.  
  24714.    TARGET_NOT_SELECTABLE   Set as nonselectable.
  24715.    ──────────────────────────────────────────────────────────────────────────
  24716.  
  24717.    BindInd  Specifies which session to bring to the foreground the next time
  24718.    the parent session is selected. It can be one of the following values:
  24719.  
  24720.    Value               Meaning
  24721.    ──────────────────────────────────────────────────────────────────────────
  24722.    BIND_UNCHANGED      Leave current setting unchanged.
  24723.  
  24724.    BIND_CHILD          A bond between the parent session and the child
  24725.                        session is established. The child session is brought
  24726.                        to the foreground the next time the parent session is
  24727.                        selected. If the child session is selected, the child
  24728.                        session is brought to the foreground.
  24729.  
  24730.    BIND_NONE           Any bond previously established with the specified
  24731.                        child session is broken. The parent session is brought
  24732.                        to the foreground the next time the parent session is
  24733.                        selected and the child session is brought to the
  24734.                        foreground the next time the child session is
  24735.                        selected.
  24736.    ──────────────────────────────────────────────────────────────────────────
  24737.  
  24738.  See Also
  24739.  
  24740.    DosSetSession
  24741.  
  24742.  
  24743.  ────────────────────────────────────────────────────────────────────────────
  24744.  STRINGINBUF
  24745.  ────────────────────────────────────────────────────────────────────────────
  24746.    typedef struct _STRINGINBUF {    /* kbsi */
  24747.        USHORT cb;
  24748.        USHORT cchIn;
  24749.    } STRINGINBUF;
  24750.  
  24751.    The STRINGINBUF structure contains information about the length of the
  24752.    buffer used by the KbdStringIn function.
  24753.  
  24754.  Fields
  24755.  
  24756.    cb  Specifies the length of the buffer (in bytes). The maximum value is
  24757.    0x00FF.
  24758.  
  24759.    cchIn  Specifies the number of bytes read. The maximum value is 0x00FF.
  24760.  
  24761.  See Also
  24762.  
  24763.    KbdStringIn
  24764.  
  24765.  
  24766.  ────────────────────────────────────────────────────────────────────────────
  24767.  TRACKFORMAT
  24768.  ────────────────────────────────────────────────────────────────────────────
  24769.    typedef struct _TRACKFORMAT {    /* trckfmt */
  24770.        BYTE bCommand;
  24771.        USHORT usHead;
  24772.        USHORT usCylinder;
  24773.        USHORT usReserved;
  24774.        USHORT cSectors;
  24775.        struct {
  24776.            BYTE bCylinder;
  24777.            BYTE bHead;
  24778.            BYTE idSector;
  24779.            BYTE bBytesSector;
  24780.        } FormatTable[1];
  24781.    } TRACKFORMAT;
  24782.  
  24783.    The TRACKFORMAT structure contains information about the disk drive.
  24784.  
  24785.  Fields
  24786.  
  24787.    bCommand  Specifies the type of track layout. If this field is 0x0000, the
  24788.    track layout contains nonconsecutive sectors or does not start with sector
  24789.    1. If it is 0x0001, the track layout starts with sector 1 and contains
  24790.    only consecutive sectors.
  24791.  
  24792.    usHead  Specifies the number of the physical head on which to perform the
  24793.    operation.
  24794.  
  24795.    usCylinder  Specifies the cylinder number for the operation.
  24796.  
  24797.    cSectors  Specifies the number of sectors on the track being formatted.
  24798.  
  24799.    FormatTable[1]  Specifies the format table. It is an array of structures
  24800.    that contain the cylinder number, head number, sector identifier, and
  24801.    bytes per sector for each sector on the track. The bCylinder field
  24802.    specifies the cylinder number. The bHead field specifies the head number.
  24803.    The idSector field specifies the sector identifier, and the bBytesSector
  24804.    field specifies the number of bytes per sector. The first element defines
  24805.    these values for the first sector. The number of elements depends on the
  24806.    number of sectors on the track. The bBytesSector field can be one of the
  24807.    following values:
  24808.  
  24809.    Value     Meaning
  24810.    ──────────────────────────────────────────────────────────────────────────
  24811.    0x0000    128 bytes per sector
  24812.  
  24813.    0x0001    256 bytes per sector
  24814.  
  24815.    0x0002    512 bytes per sector
  24816.  
  24817.    0x0003    1024 bytes per sector
  24818.    ──────────────────────────────────────────────────────────────────────────
  24819.  
  24820.    All the cylinder and head numbers must be the same.
  24821.  
  24822.  See Also
  24823.  
  24824.    DSK_FORMATVERIFY
  24825.  
  24826.  
  24827.  ────────────────────────────────────────────────────────────────────────────
  24828.  TRACKLAYOUT
  24829.  ────────────────────────────────────────────────────────────────────────────
  24830.    typedef struct _TRACKLAYOUT {    /* trckl */
  24831.        BYTE   bCommand;
  24832.        USHORT usHead;
  24833.        USHORT usCylinder;
  24834.        USHORT usFirstSector;
  24835.        USHORT cSectors;
  24836.        struct {
  24837.            USHORT usSectorNumber;
  24838.            USHORT usSectorSize;
  24839.        } TrackTable[1];
  24840.    } TRACKLAYOUT;
  24841.  
  24842.    The TRACKLAYOUT structure contains track-layout information.
  24843.  
  24844.  Fields
  24845.  
  24846.    bCommand  Specifies the type of track layout. If this field is 0x0000, the
  24847.    track layout contains nonconsecutive sectors or does not start with sector
  24848.    1. If it is 0x0001, the track layout starts with sector 1, and contains
  24849.    only consecutive sectors.
  24850.  
  24851.    usHead  Specifies the physical head on the disk drive on which to perform
  24852.    the operation.
  24853.  
  24854.    usCylinder  Specifies the cylinder number on which to perform the
  24855.    operation.
  24856.  
  24857.    usFirstSector  Specifies the logical sector number at which to start the
  24858.    operation. The logical sector number is the index in the track-layout
  24859.    table to the first sector. Index 0 specifies the first sector, index 1 the
  24860.    second, and so on.
  24861.  
  24862.    cSectors  Specifies the number of sectors on which to perform the
  24863.    operation, up to the maximum specified in the track-layout table. The
  24864.    function does not step heads and tracks.
  24865.  
  24866.    TrackTable[1]  Specifies the track-layout table. It is an array of
  24867.    structures that contain the numbers and sizes of the sectors in the track.
  24868.    The first element in this field defines the sector number and size (in
  24869.    bytes) of the first sector on the track, the second element defines the
  24870.    second sector, and so on. For each element of TrackTable, the
  24871.    usSectorNumber field specifies the sector number, and the usSectorSize
  24872.    field specifies the size of the sector. The number of elements depends on
  24873.    the number of sectors on the track.
  24874.  
  24875.  See Also
  24876.  
  24877.    PDSK_READPHYSTRACK, DSK_READTRACK, PDSK_VERIFYPHYSTRACK,
  24878.    DSK_VERIFYTRACK, DSK_WRITETRACK, PDSK_WRITEPHYSTRACK
  24879.  
  24880.  
  24881.  ────────────────────────────────────────────────────────────────────────────
  24882.  VIOCONFIGINFO
  24883.  ────────────────────────────────────────────────────────────────────────────
  24884.    typedef struct _VIOCONFIGINFO {    /* vioin */
  24885.        USHORT cb;
  24886.        USHORT adapter;
  24887.        USHORT display;
  24888.        ULONG  cbMemory;
  24889.    } VIOCONFIGINFO;
  24890.  
  24891.    The VIOCONFIGINFO structure contains configuration information about the
  24892.    screen.
  24893.  
  24894.  Fields
  24895.  
  24896.    cb  Specifies the length of the structure (in bytes). This field must be
  24897.    set to 10 before calling the VioGetConfig function.
  24898.  
  24899.    adapter  Specifies the display-adapter type. It can be one of the
  24900.    following values:
  24901.  
  24902.    Value                   Meaning
  24903.    ──────────────────────────────────────────────────────────────────────────
  24904.    DISPLAY_MONOCHROME      Monochrome/printer adapter
  24905.  
  24906.    DISPLAY_CGA             Color graphics adapter
  24907.  
  24908.    DISPLAY_EGA             Enhanced graphics adapter
  24909.  
  24910.    DISPLAY_VGA             Video graphics array or IBM Personal System/2
  24911.                            display adapter
  24912.  
  24913.    DISPLAY_8514A           PS/2 Display adapter 8514/A
  24914.    ──────────────────────────────────────────────────────────────────────────
  24915.  
  24916.    display  Specifies the display/monitor type. It can be one of the
  24917.    following values:
  24918.  
  24919.    Value                   Meaning
  24920.    ──────────────────────────────────────────────────────────────────────────
  24921.    MONITOR_MONOCHROME      Monochrome display
  24922.  
  24923.    MONITOR_COLOR           Color display
  24924.  
  24925.    MONITOR_ENHANCED        Enhanced color display
  24926.  
  24927.    MONITOR_8503            8503 monochrome display
  24928.  
  24929.    MONITOR_851X_COLOR      8512 or 8513 color display
  24930.  
  24931.    MONITOR_8514            8514 color display
  24932.    ──────────────────────────────────────────────────────────────────────────
  24933.  
  24934.    cbMemory  Specifies the amount of memory on the adapter (in bytes).
  24935.  
  24936.  See Also
  24937.  
  24938.    VioGetConfig
  24939.  
  24940.  
  24941.  ────────────────────────────────────────────────────────────────────────────
  24942.  VIOCURSORINFO
  24943.  ────────────────────────────────────────────────────────────────────────────
  24944.    typedef struct _VIOCURSORINFO {    /* vioci */
  24945.        USHORT yStart;
  24946.        USHORT cEnd;
  24947.        USHORT cx;
  24948.        USHORT attr;
  24949.    } VIOCURSORINFO;
  24950.  
  24951.    The VIOCURSORINFO structure contains information about the cursor.
  24952.  
  24953.  Fields
  24954.  
  24955.    yStart  Specifies the horizontal scan line that marks the top line of the
  24956.    cursor. Scan lines are numbered from 0 to n-1, where n is the maximum
  24957.    height of a character cell. Scan line 0 is at the top of the character
  24958.    cell.
  24959.  
  24960.    cEnd  Specifies the horizontal scan line that marks the bottom line of the
  24961.    cursor.
  24962.  
  24963.    cx  Specifies the width of the cursor in columns (for text mode) or in
  24964.    pels (for graphics mode). The maximum width in text mode is 1. If zero is
  24965.    given, the function uses a default width: 1 for text mode or the width of
  24966.    a character cell for graphics mode.
  24967.  
  24968.    attr  Specifies the attribute of the cursor. If this field is 0xFFFF, the
  24969.    function hides the cursor (removes it from the screen). Any other value
  24970.    sets the current character attribute of the cursor.
  24971.  
  24972.  See Also
  24973.  
  24974.    VioGetCurType, VioSetCurType
  24975.  
  24976.  
  24977.  ────────────────────────────────────────────────────────────────────────────
  24978.  VIOFONTINFO
  24979.  ────────────────────────────────────────────────────────────────────────────
  24980.    typedef struct _VIOFONTINFO {    /* viofi */
  24981.        USHORT cb;
  24982.        USHORT type;
  24983.        USHORT cxCell;
  24984.        USHORT cyCell;
  24985.        PVOID  pbData;
  24986.        USHORT cbData;
  24987.    } VIOFONTINFO;
  24988.  
  24989.    The VIOFONTINFO structure contains information about the font.
  24990.  
  24991.  Fields
  24992.  
  24993.    cb  Specifies the length of the structure (in bytes). It must be set to
  24994.    14.
  24995.  
  24996.    type  Specifies the request type. This field must be VGFI_GETCURFONT to
  24997.    retrieve the current font. It must be VGFI_GETROMFONT to retrieve a ROM
  24998.    font. It must be 0x0000 to set a font.
  24999.  
  25000.    cxCell  Specifies the width (in pels) of each character cell in the font.
  25001.  
  25002.    cyCell  Specifies the height (in pels) of each character cell in the font.
  25003.  
  25004.    pbData  Points to the buffer that receives the requested font table or can
  25005.    be set to NULL to direct the VioGetFont function to supply an address. In
  25006.    the latter case, the function copies the address of the font to this
  25007.    field. The address specifies either a RAM or a ROM address, depending on
  25008.    the request type.
  25009.  
  25010.    For the VioSetFont function, it points to the buffer that contains the
  25011.    font table to set a font. The format of the font table depends on the
  25012.    display adapter and screen mode.
  25013.  
  25014.    cbData  Specifies the length of the font (in bytes).
  25015.  
  25016.  Comments
  25017.  
  25018.    When requesting a ROM font, the cxCell and cyCell fields must be set
  25019.    before calling the VioGetFont function. These fields identify the font to
  25020.    be retrieved.
  25021.  
  25022.  See Also
  25023.  
  25024.    VioGetFont, VioSetFont
  25025.  
  25026.  
  25027.  ────────────────────────────────────────────────────────────────────────────
  25028.  VIOINTENSITY
  25029.  ────────────────────────────────────────────────────────────────────────────
  25030.    typedef struct _VIOINTENSITY {    /* vioint */
  25031.        USHORT  cb;
  25032.        USHORT  type;
  25033.        USHORT  fs;
  25034.    } VIOINTENSITY;
  25035.  
  25036.    The VIOINTENSITY structure contains status information about foreground
  25037.    and background color.
  25038.  
  25039.  Fields
  25040.  
  25041.    cb  Specifies the length of the structure (in bytes). It must be set to 6.
  25042.  
  25043.    type  Specifies the request type. To retrieve the blink/background
  25044.    intensity switch, this field must be set to 0x0002.
  25045.  
  25046.    fs  Specifies foreground and background color status. This field must be
  25047.    set to 0x0000 for blinking foreground colors, or 0x0001 for high-intensity
  25048.    background colors.
  25049.  
  25050.  See Also
  25051.  
  25052.    VioGetState, VioSetState, VIOOVERSCAN, VIOPALSTATE
  25053.  
  25054.  
  25055.  ────────────────────────────────────────────────────────────────────────────
  25056.  VIOMODEINFO
  25057.  ────────────────────────────────────────────────────────────────────────────
  25058.    typedef struct _VIOMODEINFO {    /* viomi */
  25059.        USHORT cb;
  25060.        UCHAR  fbType;
  25061.        UCHAR  color;
  25062.        USHORT col;
  25063.        USHORT row;
  25064.        USHORT hres;
  25065.        USHORT vres;
  25066.    } VIOMODEINFO;
  25067.  
  25068.    The VIOMODEINFO structure contains information about the screen mode.
  25069.  
  25070.  Fields
  25071.  
  25072.    cb  Specifies the length of the data structure (in bytes). This field must
  25073.    be set to 12.
  25074.  
  25075.    fbType  Specifies the screen mode. It is one of the following values:
  25076.  
  25077.    Value               Meaning
  25078.    ──────────────────────────────────────────────────────────────────────────
  25079.    VGMT_OTHER          Set adapter to other than a monochrome/printer
  25080.                        adapter. If this value is not given, the
  25081.                        monochrome/printer adapter is assumed by default.
  25082.  
  25083.    VGMT_GRAPHICS       Set graphics mode. If this value is not given, the
  25084.                        adapter is set to text mode.
  25085.  
  25086.    VGMT_DISABLEBURST   Disable color-burst mode. If this value is not given,
  25087.                        color-burst mode is enabled.
  25088.    ──────────────────────────────────────────────────────────────────────────
  25089.  
  25090.    color  Specifies the number of colors (defined as a power of 2). This is
  25091.    equivalent to the number of color bits that define the color. It is one of
  25092.    the following values:
  25093.  
  25094.    Value     Meaning
  25095.    ──────────────────────────────────────────────────────────────────────────
  25096.    COLORS_2  2 colors
  25097.  
  25098.    COLORS_4  4 colors
  25099.  
  25100.    COLORS_16 16 colors
  25101.    ──────────────────────────────────────────────────────────────────────────
  25102.  
  25103.    col  Specifies the number of text columns.
  25104.  
  25105.    row  Specifies the number of text rows.
  25106.  
  25107.    hres  Specifies the number of pel columns (horizontal resolution).
  25108.  
  25109.    vres  Specifies the number of pel rows (vertical resolution).
  25110.  
  25111.  See Also
  25112.  
  25113.    VioGetMode, VioSetMode
  25114.  
  25115.  
  25116.  ────────────────────────────────────────────────────────────────────────────
  25117.  VIOOVERSCAN
  25118.  ────────────────────────────────────────────────────────────────────────────
  25119.    typedef struct _VIOOVERSCAN {    /* vioos */
  25120.        USHORT  cb;
  25121.        USHORT  type;
  25122.        USHORT  color;
  25123.    } VIOOVERSCAN;
  25124.  
  25125.    The VIOOVERSCAN structure contains the overscan (border) screen color.
  25126.  
  25127.  Fields
  25128.  
  25129.    cb  Specifies the length of the structure (in bytes). It must be set to 6.
  25130.  
  25131.    type  Specifies the request type. To retrieve the overscan (border) color,
  25132.    this field must be set to 0x0001.
  25133.  
  25134.    color  Specifies the color value.
  25135.  
  25136.  See Also
  25137.  
  25138.    VioGetState, VioSetState, VIOINTENSITY, VIOPALSTATE
  25139.  
  25140.  
  25141.  ────────────────────────────────────────────────────────────────────────────
  25142.  VIOPALSTATE
  25143.  ────────────────────────────────────────────────────────────────────────────
  25144.    typedef struct _VIOPALSTATE {    /* viopal */
  25145.        USHORT cb;
  25146.        USHORT type;
  25147.        USHORT iFirst;
  25148.        USHORT acolor[1];
  25149.    } VIOPALSTATE;
  25150.  
  25151.    The VIOPALSTATE structure contains the screen-palette registers.
  25152.  
  25153.  Fields
  25154.  
  25155.    cb  Specifies the length of the structure (in bytes). The length
  25156.    determines how many palette registers are retrieved. The maximum length is
  25157.    38 bytes for 16 registers.
  25158.  
  25159.    type  Specifies the request type. To retrieve the palette register state,
  25160.    this field must be set to 0x0000.
  25161.  
  25162.    iFirst  Specifies the first palette register to be retrieved. This field
  25163.    must be a value from 0x0000 to 0x000F. The function retrieves the palette
  25164.    registers in sequential order. The number of registers retrieved depends
  25165.    on the structure size specified by the cb field.
  25166.  
  25167.    acolor[1]  Specifies the array that receives the color values for the
  25168.    palette registers.
  25169.  
  25170.  See Also
  25171.  
  25172.    VioGetState, VioSetState, VIOINTENSITY, VIOOVERSCAN
  25173.  
  25174.  
  25175.  ────────────────────────────────────────────────────────────────────────────
  25176.  VIOPHYSBUF
  25177.  ────────────────────────────────────────────────────────────────────────────
  25178.    typedef struct _VIOPHYSBUF {    /* viopb */
  25179.        PBYTE pBuf;
  25180.        ULONG cb;
  25181.        SEL   asel[1];
  25182.    } VIOPHYSBUF;
  25183.  
  25184.    The VIOPHYSBUF structure contains information about the physical video
  25185.    buffer.
  25186.  
  25187.  Fields
  25188.  
  25189.    pBuf  Points to the physical video buffer. The address must be in the
  25190.    range 0x000A0000 through 0x000BFFFF; this depends on the display adapter
  25191.    and the video mode.
  25192.  
  25193.    cb  Specifies the length of the physical video buffer (in bytes).
  25194.  
  25195.    asel[1]  Specifies the array that receives the selectors used to address
  25196.    the physical video buffer. If more than one selector is received, the
  25197.    first selector addresses the first 64K bytes of the physical video buffer,
  25198.    the second selector addresses the next 64K bytes, and so on. The number of
  25199.    selectors depends on the actual size of the physical buffer as specified
  25200.    by the cb field. The last selector may address less than 64K bytes of
  25201.    buffer.
  25202.  
  25203.  Comments
  25204.  
  25205.    The actual size of the asel[1] field depends on the size of physical
  25206.    memory. The program must ensure that there is adequate space to receive
  25207.    all selectors.
  25208.  
  25209.  See Also
  25210.  
  25211.    VioGetPhysBuf
  25212.  
  25213.  
  25214.  ────────────────────────────────────────────────────────────────────────────
  25215.  VOLUMELABEL
  25216.  ────────────────────────────────────────────────────────────────────────────
  25217.    typedef struct _VOLUMELABEL {    /* vol */
  25218.        BYTE cch;
  25219.        CHAR szVolLabel[12];
  25220.    } VOLUMELABEL;
  25221.  
  25222.    The VOLUMELABEL structure contains the volume label.
  25223.  
  25224.  Fields
  25225.  
  25226.    cch  Specifies the length of the achVolLabel[12] field (excluding the
  25227.    null-terminating character).
  25228.  
  25229.    achVolLabel[12]  Specifies a null-terminated string that specifies the
  25230.    volume label. When a volume label is being set by using the DosSetFSInfo
  25231.    function, any trailing spaces are ignored.
  25232.  
  25233.  See Also
  25234.  
  25235.    DosQFSInfo, DosSetFSInfo
  25236.  
  25237.  
  25238.  
  25239.  ────────────────────────────────────────────────────────────────────────────
  25240.  Chapter 5  File Formats
  25241.  
  25242.         5.1     Introduction
  25243.         5.2     Keyboard Translation Tables
  25244.             5.2.1     Predefined Translation Tables
  25245.             5.2.2     Translation-Table Format
  25246.             5.2.3     Key Types
  25247.                 5.2.3.1    Alphabetic Key (Type 0x0001)
  25248.                 5.2.3.2    Special-Character Key (Type 0x0002)
  25249.                 5.2.3.3    Special-Character Key (Type 0x0003)
  25250.                 5.2.3.4    Special-Character Key (Type 0x0004)
  25251.                 5.2.3.5    Special-Character Key (Type 0x0005)
  25252.                 5.2.3.6    Function Key (Type 0x0006)
  25253.                 5.2.3.7    Keypad Key (Type 0x0007)
  25254.                 5.2.3.8    Special-Action Key (Type 0x0008)
  25255.                 5.2.3.9    PRINTSCREEN Key (Type 0x0009)
  25256.                 5.2.3.10   SYSREQ Key (Type 0x000A)
  25257.                 5.2.3.11   Accent Key (Type 0x000B)
  25258.                 5.2.3.12   Shift Key (Type 0x000C)
  25259.                 5.2.3.13   General Toggle Key (Type 0x000D)
  25260.                 5.2.3.14   ALT Key (Type 0x000E)
  25261.                 5.2.3.15   NUMLOCK Key (Type 0x000F)
  25262.                 5.2.3.16   CAPSLOCK Key (Type 0x0010)
  25263.                 5.2.3.17   SCROLL LOCK Key (Type 0x0011)
  25264.                 5.2.3.18   Extended-Shift Key (Type 0x0012)
  25265.                 5.2.3.19   Extended-Toggle Key (Type 0x0013)
  25266.                 5.2.3.20   Special Foreign Key (Type 0x0014)
  25267.                 5.2.3.21   Special Foreign Key (Type 0x0015)
  25268.         5.3     Video Modes and Fonts
  25269.             5.3.1     Screen Modes
  25270.             5.3.2     Screen Attributes
  25271.             5.3.3     Physical-Screen Buffer Addresses
  25272.             5.3.4     Video Fonts
  25273.         5.4     Resource-File Formats
  25274.             5.4.1     Pointer and Icon Resources
  25275.             5.4.2     Bitmap Format
  25276.             5.4.3     String and Message Resources
  25277.             5.4.4     Menu Resource
  25278.             5.4.5     Accelerator-Table Resource
  25279.             5.4.6     Dialog Templates
  25280.             5.4.7     Dialog-Include Resource
  25281.             5.4.8     Font Resource
  25282.             5.4.9     Font-Directory Resource
  25283.             5.4.10    Binary Data
  25284.             5.4.11    MS OS/2 Internal Resources
  25285.  
  25286.  5.1  Introduction
  25287.  
  25288.    This chapter describes the format of the files and related structures used
  25289.    by MS OS/2 functions. The following topics are described in detail:
  25290.  
  25291.    ■  Keyboard translation tables
  25292.  
  25293.    ■  Video fonts
  25294.  
  25295.    ■  Resources
  25296.  
  25297.    This chapter describes the formats as returned by or required by the MS
  25298.    OS/2 functions that use them. The formats described here may not fully
  25299.    describe the format of data when it is stored in an MS OS/2 system file.
  25300.    For example, the system default keyboard translation tables are stored in
  25301.    the keyboard.dcp file. This file usually contains header information and
  25302.    several translation tables. Although the translation-table format is
  25303.    described in this chapter, the header information and the organization of
  25304.    the tables in the files are not.
  25305.  
  25306.    In general, this chapter describes only the details needed to develop data
  25307.    formats for use with MS OS/2 programs. The programmer can choose an
  25308.    appropriate file-storage format.
  25309.  
  25310.  
  25311.  5.2  Keyboard Translation Tables
  25312.  
  25313.    This section describes the format and contents of MS OS/2 translation
  25314.    tables. MS OS/2 uses translation tables to translate keystroke scan codes
  25315.    into character values.
  25316.  
  25317.  5.2.1  Predefined Translation Tables
  25318.  
  25319.    MS OS/2 provides several predefined translation tables. These tables,
  25320.    defined in the keyboard.dcp file, specify the translations for keyboard
  25321.    scan codes to character values for a variety of character sets and
  25322.    languages. Each translation table is identified by a code-page identifier.
  25323.    The code-page ID may be used in the DosSetCp, KbdSetCp, and VioSetCp
  25324.    functions to set the translation table for the system. The DosGetCp,
  25325.    KbdGetCp, and VioGetCp functions also retrieve the code-page ID for the
  25326.    current system translation table.
  25327.  
  25328.    The following is a list of the MS OS/2 predefined translation tables and
  25329.    their code-page identifiers:
  25330.  
  25331.    Number          Code page
  25332.    ──────────────────────────────────────────────────────────────────────────
  25333.    437             United States
  25334.  
  25335.    850             Multilingual
  25336.  
  25337.    860             Portuguese
  25338.  
  25339.    863             French-Canadian
  25340.  
  25341.    865             Nordic
  25342.  
  25343.    0x0000          Default (none)
  25344.    ──────────────────────────────────────────────────────────────────────────
  25345.  
  25346.    A user can set the translation tables for the system by using the codepage
  25347.    and devinfo commands in the config.sys file. The keyb command can be used
  25348.    to change the current translation table.
  25349.  
  25350.  5.2.2  Translation-Table Format
  25351.  
  25352.    MS OS/2 lets a program create and set custom translation tables for the
  25353.    keyboard by using the KbdSetCustXt function. The function takes a pointer
  25354.    to translation table. The translation table is a structure that has the
  25355.    following general form:
  25356.  
  25357.      Translation-table header
  25358.      Key-definition 1
  25359.      Key-definition 2
  25360.             .
  25361.             .
  25362.             .
  25363.      Key-definition 127
  25364.      Accent-key table
  25365.  
  25366.    The translation-table header defines the translation table's code-page ID,
  25367.    the size of the translation table, the keyboard for which it was designed,
  25368.    and other information about the translation table. The key-definition
  25369.    entries define key-translation type, the accent keys that can be used in
  25370.    combination with this key, and the actual translated character values. A
  25371.    translation table may have up to 127 key-definition entries. The
  25372.    accent-table entry defines the scan- and character-code translations for
  25373.    accent-and-character key combinations. This accent table contains seven
  25374.    accent entries and accent-key definitions.
  25375.  
  25376.    struct {
  25377.        USHORT XTableID;
  25378.        USHORT XTableFlags1;
  25379.        USHORT XTableFlags2;
  25380.        USHORT KbdType;
  25381.        USHORT KbdSubType;
  25382.        USHORT XTableLen;
  25383.        USHORT EntryCount;
  25384.        USHORT EntryWidth;
  25385.        USHORT Country;
  25386.        USHORT TableTypeID;
  25387.        USHORT Reserved[10];
  25388.        struct {
  25389.                USHORT AccentFlags:7;
  25390.                USHORT KeyType:9;
  25391.                CHAR Char1;
  25392.                CHAR Char2;
  25393.                CHAR Char3;
  25394.                CHAR Char4;
  25395.                CHAR Char5;
  25396.        } KeyDef[127];
  25397.        struct {
  25398.                BYTE NonAccent[2];
  25399.                BYTE CtlAccent[2];
  25400.                BYTE AltAccent[2];
  25401.                BYTE Map[20][2];
  25402.        } AccentEntry[7];
  25403.    };
  25404.  
  25405. ╓┌─┌───────────────┌─────────────────────────────────────────────────────────╖
  25406.    Field           Description
  25407.    ──────────────────────────────────────────────────────────────────────────
  25408.    XTableID        Specifies the code-page ID for this translation.
  25409.  
  25410.    XTableFlags1    Specifies the first set of table flags. For more
  25411.                    information, see the values listed in Table 5.1.
  25412.    Field           Description
  25413.    ──────────────────────────────────────────────────────────────────────────
  25414.                   information, see the values listed in Table 5.1.
  25415.  
  25416.    XTableFlags2    Specifies a reserved value; must be zero.
  25417.  
  25418.    KbdType         Specifies the keyboard type. This field is 0x0000 for an
  25419.                    IBM PC/AT keyboard and 0x0001 for an IBM Enhanced
  25420.                    keyboard.
  25421.  
  25422.    KbdSubType      Specifies a reserved value; must be zero.
  25423.  
  25424.    XTableLen       Specifies the length of the translation table (in bytes).
  25425.  
  25426.    EntryCount      Specifies the number of key-definition entries.
  25427.  
  25428.    EntryWidth      Specifies the width of each key-definition entry (in
  25429.                    bytes).
  25430.  
  25431.    Country         Specifies the country-code or language ID. This ID
  25432.                    consists of two letters that represent the name of a
  25433.    Field           Description
  25434.    ──────────────────────────────────────────────────────────────────────────
  25435.                   consists of two letters that represent the name of a
  25436.                    country. The first letter is stored in the high- order
  25437.                    byte, the second in the low-order byte. For more
  25438.                    information, see the codes listed in Table 5.2.
  25439.  
  25440.    TableTypeID     Specifies the table type. The low-order byte specifies the
  25441.                    type, the high-order byte the subtype. This field must be
  25442.                    0x0001.
  25443.  
  25444.    Reserved[10]    Specifies an array of reserved values. Each element must
  25445.                    be zero.
  25446.  
  25447.    AccentFlags     Specifies the translation for accent keys. This field
  25448.                    occupies bits 0 through 6.
  25449.  
  25450.    KeyType         Specifies the translation of the keys. This field occupies
  25451.                    bits 11 through 15.
  25452.  
  25453.    Char1           Specifies a translated-character value. Typically used
  25454.    Field           Description
  25455.    ──────────────────────────────────────────────────────────────────────────
  25456.   Char1           Specifies a translated-character value. Typically used
  25457.                    when no shift keys are pressed.
  25458.  
  25459.    Char2           Specifies a translated-character value. Typically used
  25460.                    when shift keys are pressed.
  25461.  
  25462.    Char3           Specifies a translated-character value. Typically used
  25463.                    when the ALT GR (alternate-graphics) key is pressed.
  25464.  
  25465.    Char4           Specifies a translated-character value.
  25466.  
  25467.    Char5           Specifies a translated-character value.
  25468.  
  25469.    NonAccent[2]    Specifies the character value and scan code for the key
  25470.                    when not used as an accent character. The first byte
  25471.                    contains the character value, the second the scan code.
  25472.  
  25473.    CtlAccent[2]    Specifies the character value and scan code for the key
  25474.                    when used with the CONTROL key. The first byte
  25475.    Field           Description
  25476.    ──────────────────────────────────────────────────────────────────────────
  25477.                   when used with the CONTROL key. The first byte
  25478.                    contains the character value, the second the scan code.
  25479.  
  25480.    AltAccent[2]    Specifies the character value and scan code for the key
  25481.                    when used with the ALT key. The first byte contains
  25482.                    the character value, the second the scan code.
  25483.  
  25484.    Map[20][2]      Specifies an array of scan-code and character-value pairs
  25485.                    for accented translation. The array has 20 elements. Each
  25486.                    element has two bytes; the first byte contains the scan
  25487.                    code of a key to be accented and the second contains the
  25488.                    character value of the accented key.
  25489.    ──────────────────────────────────────────────────────────────────────────
  25490.  
  25491.  
  25492.    The XTableFlags1 field can be any combination of the values listed in
  25493.    Table 5.1:
  25494.  
  25495.    Table 5.1
  25496.    Table-Flag Values
  25497.    ──────────────────────────────────────────────────────────────────────────
  25498.    Value    Meaning
  25499.    ──────────────────────────────────────────────────────────────────────────
  25500.    0x0001   SHIFT+ALT is used in place of CONTROL+ALT.
  25501.  
  25502.    0x0002   Left ALT key is the ALT GR (alternate-graphics) key.
  25503.  
  25504.    0x0004   Right ALT key is the ALT GR (alternate-graphics) key.
  25505.  
  25506.    0x0008   CAPSLOCK key is interpreted as a SHIFTLOCK key.
  25507.  
  25508.    0x0010   Default table for the language. Used by the keyb command to
  25509.             locate the default translation table if switching between several
  25510.             translation tables.
  25511.  
  25512.    0x0020   SHIFTLOCK key is a toggle key. If not given, the key is a
  25513.             latch key.
  25514.  
  25515.    0x0040   Accent is sent as a character. If not valid, beep is sounded.
  25516.  
  25517.    0x0080   When the CAPSLOCK is down and the SHIFT key is pressed,
  25518.             the Char5 field is used in the key-definition entry.
  25519.    ──────────────────────────────────────────────────────────────────────────
  25520.  
  25521.    The Country field specifies the country or language identifier. It can be
  25522.    any of the codes listed in Table 5.2:
  25523.  
  25524.    Table 5.2
  25525.    Country and Language Codes
  25526.    ──────────────────────────────────────────────────────────────────────────
  25527. ╓┌─┌───────────────┌─────────────────────────────────────────────────────────╖
  25528.    Code            Country/Language
  25529.    ──────────────────────────────────────────────────────────────────────────
  25530.    US              United States
  25531.  
  25532.    UK              United Kingdom
  25533.  
  25534.    GR              Germany
  25535.  
  25536.    FR              France
  25537.  
  25538.    Code            Country/Language
  25539.    ──────────────────────────────────────────────────────────────────────────
  25540. 
  25541.    IT              Italy
  25542.  
  25543.    SP              Spain
  25544.  
  25545.    DK              Denmark
  25546.  
  25547.    NL              Netherlands
  25548.  
  25549.    SU              Finland
  25550.  
  25551.    NO              Norway
  25552.  
  25553.    PO              Portugal
  25554.  
  25555.    SV              Sweden
  25556.  
  25557.    SF              Switzerland (French)
  25558.  
  25559.    Code            Country/Language
  25560.    ──────────────────────────────────────────────────────────────────────────
  25561. 
  25562.    SG              Switzerland (German)
  25563.  
  25564.    CF              French-Canadian
  25565.  
  25566.    BE              Belgium
  25567.  
  25568.    LA              Latin America (Spanish)
  25569.    ──────────────────────────────────────────────────────────────────────────
  25570.  
  25571.  
  25572.    Note that each accent entry should have the space character defined as one
  25573.    of its accented characters and be translated to the same value as the
  25574.    accent character itself. The reason for this is that, by definition, an
  25575.    accent key followed by the space character maps to the accent character
  25576.    alone. If the table is not set up this way, a "not-an-accent" beep sounds
  25577.    when the accent key, followed by a space, is pressed.
  25578.  
  25579.  5.2.3  Key Types
  25580.  
  25581.    The KeyType field specifies whether the scan code represents an
  25582.    alphabetic, special, function, shift, or other type of key. It also
  25583.    defines how to translate the key when a given shift key is down or active.
  25584.    This field can be one of the following values:
  25585.  
  25586. ╓┌─┌─────────────┌───────────────────────────────────────────────────────────╖
  25587.    Value         Meaning
  25588.    ──────────────────────────────────────────────────────────────────────────
  25589.    0x0001        Alphabetic-character key
  25590.  
  25591.    0x0002        Special nonalphabetic-character key
  25592.  
  25593.    0x0003        Special nonalphabetic-character key with
  25594.                  CAPSLOCK translation
  25595.  
  25596.    0x0004        Special nonalphabetic-character key with ALT translation
  25597.  
  25598.    0x0005        Special nonalphabetic-character key with CAPSLOCK and
  25599.                  ALT translations
  25600.  
  25601.    Value         Meaning
  25602.    ──────────────────────────────────────────────────────────────────────────
  25603. 
  25604.    0x0006        Function key
  25605.  
  25606.    0x0007        Keypad key
  25607.  
  25608.    0x0008        Action key that performs a special action when the
  25609.                  CONTROL key is pressed
  25610.  
  25611.    0x0009        PRINTSCREEN key
  25612.  
  25613.    0x000A        SYSREQ key
  25614.  
  25615.    0x000B        Accent key (also called a dead key)
  25616.  
  25617.    0x000C        Shift key (for example, SHIFT or CONTROL)
  25618.  
  25619.    0x000D        General toggle key
  25620.  
  25621.    0x000E        ALT key
  25622.    Value         Meaning
  25623.    ──────────────────────────────────────────────────────────────────────────
  25624.   0x000E        ALT key
  25625.  
  25626.    0x000F        NUMLOCK key
  25627.  
  25628.    0x0010        CAPSLOCK key
  25629.  
  25630.    0x0011        SCROLL LOCK key
  25631.  
  25632.    0x0012        Extended-shift key
  25633.  
  25634.    0x0013        Extended-toggle key
  25635.  
  25636.    0x0014        Special character key with CAPSLOCK translations for
  25637.                  foreign-language keyboards
  25638.  
  25639.    0x0015        Special character key with ALT translations for
  25640.                  foreign-language keyboards
  25641.    ──────────────────────────────────────────────────────────────────────────
  25642.  
  25643.    Value         Meaning
  25644.    ──────────────────────────────────────────────────────────────────────────
  25645. 
  25646.  
  25647.    The AccentFlags field of a key-definition entry has seven flags that are
  25648.    individually set if a corresponding entry in the accent table applies to
  25649.    this scan code. If an accent key is pressed immediately before the current
  25650.    key, and if the bit for that accent key is set in the AccentFlags field
  25651.    for the current key, the corresponding accent-table entry is searched for
  25652.    the replacement character value. If no replacement is found, the
  25653.    "not-an-accent" beep sounds and the accent character and current character
  25654.    are passed as two separate characters.
  25655.  
  25656.    The SPACEBAR should have a flag set in its AccentFlags field for each
  25657.    possible accent (that is, for each defined accent entry in the accent
  25658.    table).
  25659.  
  25660.    When no shift keys are pressed, the Char1 field specifies the
  25661.    translated-character value (except where otherwise noted).
  25662.  
  25663.    The ALT key, the ALT-GR key, or both, may be present on a keyboard
  25664.    as specified by the XTableFlags1 field in the translation-table header. In
  25665.    most cases, if the ALT GR key is specified, the Char3 field specifies
  25666.    the translated-character value when the given key is pressed at the same
  25667.    time as the ALT key.
  25668.  
  25669.    Any key combination that does not have an explicit definition is assumed
  25670.    to be undefined──for example, pressing the CONTROL key with the 3 key.
  25671.    The system marks the keystroke packet as an undefined translation and
  25672.    passes the packet on to any keyboard monitors. The scan code in the packet
  25673.    remains unchanged but the character value is set to zero. Although the
  25674.    system passes the packet to monitors, it does not copy the undefined
  25675.    translation to the keyboard-input buffer.
  25676.  
  25677.    The system uses the masks listed in Table 5.3 to set and clear the
  25678.    keyboard shift-status word:
  25679.  
  25680.    Table 5.3
  25681.    Shift-Key Masks
  25682.    ──────────────────────────────────────────────────────────────────────────
  25683.    Key             Char1       Char2       Char3
  25684.    ──────────────────────────────────────────────────────────────────────────
  25685.    SHIFT           0x01        0x00        0x00
  25686.    (right)
  25687.  
  25688.    SHIFT           0x02        0x00        0x00
  25689.    (left)
  25690.  
  25691.    CONTROL+SHIFT   0x04        0x01        0x04
  25692.  
  25693.    ALT+SHIFT       0x08        0x02        0x08
  25694.  
  25695.    SCROLL LOCK     0x10        0x10        0x10
  25696.  
  25697.    NUMLOCK         0x20        0x20        0x20
  25698.  
  25699.    CAPSLOCK        0x40        0x40        0x40
  25700.  
  25701.    SYSREQ          0x80        0x80        -
  25702.    ──────────────────────────────────────────────────────────────────────────
  25703.  
  25704.    The following sections describe the key types in detail.
  25705.  
  25706.    5.2.3.1  Alphabetic Key (Type 0x0001)
  25707.  
  25708.    An alphabetic key (type 0x0001) is any character key that represents a
  25709.    letter.
  25710.  
  25711.    Shift key     Field used
  25712.    ──────────────────────────────────────────────────────────────────────────
  25713.    None          Char1
  25714.  
  25715.    SHIFT         Char2
  25716.  
  25717.    CAPSLOCK      Char2
  25718.  
  25719.    SHIFT and     Char1
  25720.    CAPSLOCK
  25721.  
  25722.    CONTROL       Char1 to compute an ASCII control value.
  25723.  
  25724.    ALT           Char1 to compute an IBM PC keyboard scan code.
  25725.  
  25726.    ALT GR        Char3 if this field is not zero.
  25727.    ──────────────────────────────────────────────────────────────────────────
  25728.  
  25729.    If a CONTROL key is pressed, the system subtracts 95 from the Char1
  25730.    field to compute an ASCII control value. The final value ranges from 1
  25731.    through 26.
  25732.  
  25733.    If an ALT key is pressed, the system uses the Char1 field as an index
  25734.    to a table of IBM PC keyboard scan codes. The final value is two bytes.
  25735.    The first byte is 0x00. The second byte is the corresponding IBM PC scan
  25736.    code.
  25737.  
  25738.    5.2.3.2  Special-Character Key (Type 0x0002)
  25739.  
  25740.    A special-character key (type 0x0002) represents a nonalphabetic character
  25741.    for which there is no CAPSLOCK or ALT translation.
  25742.  
  25743.    Shift key     Field used
  25744.    ──────────────────────────────────────────────────────────────────────────
  25745.    None          Char1
  25746.  
  25747.    SHIFT         Char2
  25748.  
  25749.    CAPSLOCK      Char1
  25750.  
  25751.    CONTROL       Computed ASCII control code.
  25752.  
  25753.    ALT           Undefined translation.
  25754.  
  25755.    ALT GR        Char3 if this field is not zero.
  25756.    ──────────────────────────────────────────────────────────────────────────
  25757.  
  25758.    If a CONTROL key is pressed, the system uses the scan code of the
  25759.    given key to generate an ASCII control code, as shown in the following
  25760.    list:
  25761.  
  25762.    Scan code     Control code
  25763.    ──────────────────────────────────────────────────────────────────────────
  25764.    0x03          0x00
  25765.  
  25766.    0x07          0x1E
  25767.  
  25768.    0x0C          0x1F
  25769.  
  25770.    0x1A          0x1B
  25771.  
  25772.    0x1B          0x1D
  25773.  
  25774.    0x2B          0x1C
  25775.    ──────────────────────────────────────────────────────────────────────────
  25776.  
  25777.    Only the scan codes listed generate control codes. A hyphen-character (-)
  25778.    key always generates control code 0x1F, even if the corresponding scan
  25779.    code is not listed. A hyphen-character key is any key whose Char1 field is
  25780.    0x2D.
  25781.  
  25782.    5.2.3.3  Special-Character Key (Type 0x0003)
  25783.  
  25784.    A special-character key (type 0x0003) represents a nonalphabetic character
  25785.    for which there is a CAPSLOCK translation but no ALT translation.
  25786.  
  25787.    Shift key     Field used
  25788.    ──────────────────────────────────────────────────────────────────────────
  25789.    None          Char1
  25790.  
  25791.    SHIFT         Char2
  25792.  
  25793.    CAPSLOCK      Char2
  25794.  
  25795.    SHIFT and     Char1
  25796.    CAPSLOCK
  25797.  
  25798.    CONTROL       Computed ASCII control code.
  25799.  
  25800.    ALT           Undefined translation.
  25801.  
  25802.    ALT GR        Char3 if this field is not zero.
  25803.    ──────────────────────────────────────────────────────────────────────────
  25804.  
  25805.    If a CONTROL key is pressed, the system uses the scan code of the
  25806.    given key to generate an ASCII control code, as shown in the following
  25807.    list:
  25808.  
  25809.    Scan code     Control code
  25810.    ──────────────────────────────────────────────────────────────────────────
  25811.    0x03          0x00
  25812.  
  25813.    0x07          0x1E
  25814.  
  25815.    0x0C          0x1F
  25816.  
  25817.    0x1A          0x1B
  25818.  
  25819.    0x1B          0x1D
  25820.  
  25821.    0x2B          0x1C
  25822.    ──────────────────────────────────────────────────────────────────────────
  25823.  
  25824.    Only the scan codes listed generate control codes. A hyphen-character (-)
  25825.    key always generates control code 0x1F, even if the corresponding scan
  25826.    code is not listed. A hyphen-character key is any key whose Char1 field is
  25827.    0x2D.
  25828.  
  25829.    5.2.3.4  Special-Character Key (Type 0x0004)
  25830.  
  25831.    A special-character key (type 0x0004) represents a nonalphabetic,
  25832.    non-action key for which there is an ALT translation but no
  25833.    CAPSLOCK translation. Typically, these keys represent numeric and
  25834.    punctuation characters. The SPACEBAR key is also a type 0x0004 key.
  25835.  
  25836.    Shift key     Field used
  25837.    ──────────────────────────────────────────────────────────────────────────
  25838.    None          Char1
  25839.  
  25840.    SHIFT         Char2
  25841.  
  25842.    CAPSLOCK      Char1
  25843.  
  25844.    CONTROL       Computed ASCII control code.
  25845.  
  25846.    ALT           Computed extended ASCII code.
  25847.  
  25848.    ALT GR        Char3 if this field is not zero.
  25849.    ──────────────────────────────────────────────────────────────────────────
  25850.  
  25851.    If a CONTROL key is pressed, the system uses the scan code of the
  25852.    given key to generate an ASCII control code, as shown in the following
  25853.    list:
  25854.  
  25855.    Scan code     Control code
  25856.    ──────────────────────────────────────────────────────────────────────────
  25857.    0x03          0x00
  25858.  
  25859.    0x07          0x1E
  25860.  
  25861.    0x0C          0x1F
  25862.  
  25863.    0x1A          0x1B
  25864.  
  25865.    0x1B          0x1D
  25866.  
  25867.    0x2B          0x1C
  25868.    ──────────────────────────────────────────────────────────────────────────
  25869.  
  25870.    Only the scan codes listed generate control codes. A hyphen-character (-)
  25871.    key always generates control code 0x1F, even if the corresponding scan
  25872.    code is not listed. A hyphen-character key is any key whose Char1 field is
  25873.    0x2D. Both the ALT+SPACEBAR and CONTROL+SPACEBAR combinations
  25874.    generate the ASCII space character.
  25875.  
  25876.    If the ALT key is pressed, the system uses the scan code of the given
  25877.    key to generate an extended ASCII code, as shown in the following list:
  25878.  
  25879. ╓┌─┌─────────────┌───────────────────────────────────────────────────────────╖
  25880.    Scan code     Control code
  25881.    ──────────────────────────────────────────────────────────────────────────
  25882.    0x02          0x78
  25883.  
  25884.    0x03          0x79
  25885.  
  25886.    0x04          0x7A
  25887.  
  25888.    0x05          0x7B
  25889.  
  25890.    0x06          0x7C
  25891.  
  25892.    0x07          0x7D
  25893.  
  25894.    0x08          0x7E
  25895.    Scan code     Control code
  25896.    ──────────────────────────────────────────────────────────────────────────
  25897.   0x08          0x7E
  25898.  
  25899.    0x09          0x7F
  25900.  
  25901.    0x0A          0x80
  25902.  
  25903.    0x0B          0x81
  25904.  
  25905.    0x0C          0x82
  25906.  
  25907.    0x0D          0x83
  25908.    ──────────────────────────────────────────────────────────────────────────
  25909.  
  25910.  
  25911.    The final value is two bytes. The first byte is 0x00 or 0xE0. The second
  25912.    byte is the corresponding extended ASCII code.
  25913.  
  25914.    5.2.3.5  Special-Character Key (Type 0x0005)
  25915.  
  25916.    A special-character key (type 0x0005) represents a nonalphabetic character
  25917.    that has both CAPSLOCK and ALT translations.
  25918.  
  25919.    Shift key     Field used
  25920.    ──────────────────────────────────────────────────────────────────────────
  25921.    None          Char1
  25922.  
  25923.    SHIFT         Char2
  25924.  
  25925.    CAPSLOCK      Char2
  25926.  
  25927.    SHIFT and     Char1
  25928.    CAPSLOCK
  25929.  
  25930.    CONTROL       Computed ASCII control code.
  25931.  
  25932.    ALT           Computed extended ASCII code.
  25933.  
  25934.    ALT GR        Char3 if this field is not zero.
  25935.    ──────────────────────────────────────────────────────────────────────────
  25936.  
  25937.    Only the scan codes listed generate control codes. A hyphen-character (-)
  25938.    key always generates control code 0x1F, even if the corresponding scan
  25939.    code is not listed. A hyphen-character key is any key whose Char1 field is
  25940.    0x2D.
  25941.  
  25942.    If the ALT key is pressed, the system uses the scan code of the given
  25943.    key to generate an extended ASCII code, as shown in the following list:
  25944.  
  25945. ╓┌─┌─────────────┌───────────────────────────────────────────────────────────╖
  25946.    Scan code     Control code
  25947.    ──────────────────────────────────────────────────────────────────────────
  25948.    0x02          0x78
  25949.  
  25950.    0x03          0x79
  25951.  
  25952.    0x04          0x7A
  25953.  
  25954.    0x05          0x7B
  25955.  
  25956.    0x06          0x7C
  25957.  
  25958.    Scan code     Control code
  25959.    ──────────────────────────────────────────────────────────────────────────
  25960. 
  25961.    0x07          0x7D
  25962.  
  25963.    0x08          0x7E
  25964.  
  25965.    0x09          0x7F
  25966.  
  25967.    0x0A          0x80
  25968.  
  25969.    0x0B          0x81
  25970.  
  25971.    0x0C          0x82
  25972.  
  25973.    0x0D          0x83
  25974.    ──────────────────────────────────────────────────────────────────────────
  25975.  
  25976.  
  25977.    The final value is two bytes. The first byte is 0x00 or 0xE0. The second
  25978.    byte is the corresponding extended ASCII code.
  25979.  
  25980.    5.2.3.6  Function Key (Type 0x0006)
  25981.  
  25982.    A function key (type 0x0006) represents a non-ASCII key that may be used
  25983.    to direct an action. The system uses the Char1 field to generate an
  25984.    extended ASCII code for the given key. The Char1 field should be set to
  25985.    the same value as the key──for example, 1 for the F1 key, 2 for the
  25986.    F2 key, and so on. The system generates the extended ASCII code by
  25987.    adding a value to Char1, as shown in the following list:
  25988.  
  25989.    Shift key     Extended code
  25990.    ──────────────────────────────────────────────────────────────────────────
  25991.    None          Adds 0x3A to Char1. The F11 and F12 keys are always
  25992.                  0x8B and 0x8C, respectively.
  25993.  
  25994.    SHIFT         Adds 0x53 to Char1. The SHIFT+F11 and SHIFT+F12 keys
  25995.                  are always 0x8D and 0x8E, respectively.
  25996.  
  25997.    CAPSLOCK      Same as no shift key.
  25998.  
  25999.    CONTROL       Adds 0x5D to Char1. The CONTROL+F11 and CONTROL+F12
  26000.                  keys are always 0x8F and 0x90, respectively.
  26001.  
  26002.    ALT           Adds 0x67 to Char1. The ALT+F11 and - 2ALT+F12+2
  26003.                  keys are always 0x91 and 0x92, respectively.
  26004.  
  26005.    ALT GR        Char3 if this field is not zero.
  26006.    ──────────────────────────────────────────────────────────────────────────
  26007.  
  26008.    5.2.3.7  Keypad Key (Type 0x0007)
  26009.  
  26010.    A keypad key (type 0x0007) represents a keypad character such as a
  26011.    direction or a numeric key.
  26012.  
  26013.    Shift key     Field used
  26014.    ──────────────────────────────────────────────────────────────────────────
  26015.    None          Char1 used to compute an extended ASCII code.
  26016.  
  26017.    SHIFT         Char2
  26018.  
  26019.    NUMLOCK       Char2
  26020.  
  26021.    SHIFT and     Same as no shift key.
  26022.    NUMLOCK
  26023.  
  26024.    CAPSLOCK      Same as no shift key.
  26025.  
  26026.    CONTROL       Special keypad codes.
  26027.  
  26028.    ALT           Build a character.
  26029.  
  26030.    ALT GR        Char3 if this field is not zero.
  26031.    ──────────────────────────────────────────────────────────────────────────
  26032.  
  26033.    The following list shows the required Char1 values based on the key-top
  26034.    labels:
  26035.  
  26036. ╓┌─┌─────────────┌───────────────────────────────────────────────────────────╖
  26037.    Key-top label Char1 value
  26038.    ──────────────────────────────────────────────────────────────────────────
  26039.    HOME/7        0x00
  26040.  
  26041.    UP/8          0x01
  26042.    Key-top label Char1 value
  26043.    ──────────────────────────────────────────────────────────────────────────
  26044.   UP/8          0x01
  26045.  
  26046.    PAGE UP/9     0x02
  26047.  
  26048.    -             0x03
  26049.  
  26050.    LEFT/4        0x04
  26051.  
  26052.    5             0x05
  26053.  
  26054.    RIGHT/6       0x06
  26055.  
  26056.    +             0x07
  26057.  
  26058.    END/1         0x08
  26059.  
  26060.    DOWN/2        0x09
  26061.  
  26062.    PAGE DOWN/3   0x0A
  26063.    Key-top label Char1 value
  26064.    ──────────────────────────────────────────────────────────────────────────
  26065.   PAGE DOWN/3   0x0A
  26066.  
  26067.    INS/0         0x0B
  26068.  
  26069.    DEL/.         0x0C
  26070.    ──────────────────────────────────────────────────────────────────────────
  26071.  
  26072.  
  26073.    The Char2 value should represent the ASCII equivalent of the key-top
  26074.    label. For example, Char2 for the HOME/7 key should be the ASCII
  26075.    character 7.
  26076.  
  26077.    When the system generates an extended ASCII code, it creates two bytes.
  26078.    The first byte is 0x00 or 0xE0. The second byte is a scan code equal to
  26079.    the Char1 field plus 0x47. The plus (+) and minus (-) keypad keys never
  26080.    generate extended ASCII values; they always return the Char2 field.
  26081.  
  26082.    If the ALT key is pressed and held down, the system builds a character
  26083.    value by accumulating keystrokes. For each keystroke, the system
  26084.    multiplies the accumulated value by 10, then adds the decimal value of the
  26085.    given key. For example, pressing the HOME/7 key adds 7 to the
  26086.    accumulated value. If the result is greater than 255, the high bits are
  26087.    truncated. If any key other than the numeric keys is pressed, the
  26088.    accumulated value is reset to zero. When the ALT key is released, the
  26089.    accumulated value becomes the character value and the scan code is set to
  26090.    zero.
  26091.  
  26092.    If the CONTROL key is pressed, the system generates special extended
  26093.    ASCII codes for the keypad keys, as shown in the following list:
  26094.  
  26095. ╓┌─┌─────────────┌───────────────────────────────────────────────────────────╖
  26096.    Key-top label Extended code
  26097.    ──────────────────────────────────────────────────────────────────────────
  26098.    HOME/7        0x77
  26099.  
  26100.    UP/8          0x8D
  26101.  
  26102.    PAGE UP/9     0x84
  26103.  
  26104.    -             0x8E
  26105.    Key-top label Extended code
  26106.    ──────────────────────────────────────────────────────────────────────────
  26107.   -             0x8E
  26108.  
  26109.    LEFT/4        0x73
  26110.  
  26111.    5             0x8F
  26112.  
  26113.    RIGHT/6       0x74
  26114.  
  26115.    +             0x90
  26116.  
  26117.    END/1         0x75
  26118.  
  26119.    DOWN/2        0x91
  26120.  
  26121.    PAGE DOWN/3   0x76
  26122.  
  26123.    INS/0         0x92
  26124.  
  26125.    DEL/.         0x93
  26126.    Key-top label Extended code
  26127.    ──────────────────────────────────────────────────────────────────────────
  26128.   DEL/.         0x93
  26129.    ──────────────────────────────────────────────────────────────────────────
  26130.  
  26131.  
  26132.    5.2.3.8  Special-Action Key (Type 0x0008)
  26133.  
  26134.    A special-action key (type 0x0008) represents an action key that carries
  26135.    out a special action when the CONTROL key is pressed. For example, the
  26136.    ENTER key generates the newline character in combination with the
  26137.    CONTROL key. When pressed alone, it generates the carriage-return
  26138.    character. The special action keys are given in the following list:
  26139.  
  26140.    Shift key     Field used
  26141.    ──────────────────────────────────────────────────────────────────────────
  26142.    None          Char1
  26143.  
  26144.    SHIFT         Char1
  26145.  
  26146.    CAPSLOCK      Char1
  26147.  
  26148.    CONTROL       Char2
  26149.  
  26150.    ALT           Undefined translation.
  26151.  
  26152.    ALT GR        Char3 if this field is not zero.
  26153.    ──────────────────────────────────────────────────────────────────────────
  26154.  
  26155.    5.2.3.9  PRINTSCREEN Key (Type 0x0009)
  26156.  
  26157.    The PRINTSCREEN (print-screen) key (type 0x0009) directs the system to
  26158.    copy the screen contents to the printer.
  26159.  
  26160.    Shift key     Field used
  26161.    ──────────────────────────────────────────────────────────────────────────
  26162.    None          Char1
  26163.  
  26164.    SHIFT         Directs the system to print the screen.
  26165.  
  26166.    CAPSLOCK      Char1
  26167.  
  26168.    CONTROL       Directs the system to echo each screen line to the printer.
  26169.  
  26170.    ALT           Undefined translation.
  26171.  
  26172.    ALT GR        Char3 if this field is not zero.
  26173.    ──────────────────────────────────────────────────────────────────────────
  26174.  
  26175.    5.2.3.10  SYSREQ Key (Type 0x000A)
  26176.  
  26177.    The SYSTEQ (system-request) key (type 0x000A) represents a special
  26178.    shift key. The Char1 field holds a bit mask that the system uses to set or
  26179.    clear the lower byte of the keyboard shift-status word. The Char2 field
  26180.    contains a bit mask that the system uses to set or clear the upper byte of
  26181.    the system's shift-status word. When the user presses this key, the system
  26182.    sets the shift-status word and clears it when the user releases the key.
  26183.    If a secondary-key prefix (0xE0) is received immediately prior to a shift
  26184.    key, the Char3 field is used in place of Char2 to set or clear the
  26185.    shift-status word.
  26186.  
  26187.    5.2.3.11  Accent Key (Type 0x000B)
  26188.  
  26189.    An accent key (also called a dead key) (type 0x000B) represents a
  26190.    character that is combined with another character to form a new character.
  26191.    For example, an umlaut key can be combined with the letter u to form an
  26192.    umlaut-u character. The Char1, Char2, and Char3 fields are indexes into
  26193.    the translation table's accent table. Each field must be a value from 1
  26194.    through 7.
  26195.  
  26196.    Shift key     Field used
  26197.    ──────────────────────────────────────────────────────────────────────────
  26198.    None          Char1
  26199.  
  26200.    SHIFT         Char2
  26201.  
  26202.    CAPSLOCK      Char1
  26203.  
  26204.    CONTROL       Char1, but use CtlAccent field in accent entry.
  26205.  
  26206.    ALT           Char1, but use AltAccent field in accent entry.
  26207.  
  26208.    ALT GR        Char3
  26209.    ──────────────────────────────────────────────────────────────────────────
  26210.  
  26211.    When an accent key is pressed with a CONTROL or ALT key, the
  26212.    system retrieves the character value from the CtlAccent[2] or AltAccent[2]
  26213.    field in the accent-table entry indexed by the Char1 field. These fields
  26214.    contain the scan and character codes for the key. If the fields are both
  26215.    zero, the key has an undefined translation.
  26216.  
  26217.    When an accent key is pressed by itself, the system uses the Char1 field
  26218.    as an index to an accent-table entry. When an accent key is pressed with a
  26219.    SHIFT key, the system uses the Char2 field as an index to an
  26220.    accent-table entry. When an accent key is pressed with an ALT GR key,
  26221.    the system uses the Char3 field as an index to an accent-table entry. The
  26222.    system then waits for the next key. If the next key does not specify
  26223.    accent keys in the corresponding AccentFlags field or the next key is not
  26224.    found in the Map[20][2] field of the accent-table entry, then the
  26225.    character specified by the NonAccent field is used for the accent key and
  26226.    the second key is translated normally. Both characters are passed to the
  26227.    keyboard-input buffer after the "not-an-accent" beep sounds.
  26228.  
  26229.    If a key does not change when a left or right SHIFT key is held down,
  26230.    it should use the same value for Char1 and Char2 so that the accent will
  26231.    apply in both the shifted and non-shifted cases. If the accent value is
  26232.    undefined when used with a SHIFT key or with the ALT GR key, the
  26233.    value in Char2 or Char3 should be zero.
  26234.  
  26235.    If an accent key does not have ALT or CONTROL key mapping, the
  26236.    AltAccent and CtlAccent fields should be set to zero.
  26237.  
  26238.    5.2.3.12  Shift Key (Type 0x000C)
  26239.  
  26240.    A shift key (type 0x000C) represents a shift whose state changes when the
  26241.    key is pressed or released. The SHIFT and CONTROL keys are typical
  26242.    shift keys.
  26243.  
  26244.    The Char1 field holds a bit mask that the system uses to set or clear the
  26245.    lower byte of the keyboard shift-status word. The Char2 field contains a
  26246.    bit mask that the system uses to set or clear the upper byte of the
  26247.    system's shift-status word. When the user presses the key, the system sets
  26248.    the shift-status word, and then clears it when the user releases the key.
  26249.    If a secondary-key prefix (0xE0) is received immediately prior to a shift
  26250.    key, the Char3 field is used in place of Char2 to set or clear the
  26251.    shift-status word.
  26252.  
  26253.    5.2.3.13  General Toggle Key (Type 0x000D)
  26254.  
  26255.    A general toggle key (type 0x000D) represents a shift key whose state
  26256.    changes when the key is pressed but not when it is released. The
  26257.    CAPSLOCK key is a typical toggle key.
  26258.  
  26259.    The Char1 field holds a bit mask that the system uses to set or clear the
  26260.    lower byte of the keyboard shift-status word. The Char2 field contains a
  26261.    bit mask that the system uses to set or clear the upper byte of the
  26262.    system's shift-status word. The system uses Char1 to set the lower byte of
  26263.    the shift-status word when the user first presses the key. Thereafter the
  26264.    system alternates between setting and clearing on each subsequent press.
  26265.    The system uses Char2 to set the upper-byte word when the user presses the
  26266.    key and to clear it when the user releases the key. If a secondary-key
  26267.    prefix (0xE0) is received immediately prior to a toggle key, the Char3
  26268.    field is used in place of Char2 to set or clear the shift-status word.
  26269.  
  26270.    5.2.3.14  ALT Key (Type 0x000E)
  26271.  
  26272.    The ALT key (type 0x000E) represents a special shift key that works in
  26273.    combination with the keypad keys to build character values. The ALT
  26274.    key requires its own key type so that the system knows to clear the
  26275.    accumulated value when the user begins to build a character using the
  26276.    keypad. Otherwise, the system treats the ALT key the same as any other
  26277.    shift key.
  26278.  
  26279.    The Char1 field holds a bit mask that the system uses to set or clear the
  26280.    lower byte of the keyboard shift-status word. The Char2 field contains a
  26281.    bit mask that the system uses to set or clear the upper byte of the
  26282.    system's shift-status word. When the user presses the key, the system sets
  26283.    the shift-status word and clears it when the user releases the key. If a
  26284.    secondary-key prefix (0xE0) is received immediately prior to a shift key,
  26285.    the Char3 field is used in place of Char2 to set or clear the shift-status
  26286.    word.
  26287.  
  26288.    If the XTableFlags1 field specifies an ALT GR key, the ALT key may
  26289.    be treated as that key.
  26290.  
  26291.    5.2.3.15  NUMLOCK Key (Type 0x000F)
  26292.  
  26293.    The NUMLOCK key (type 0x000F) represents a special toggle key that,
  26294.    when pressed in combination with the CONTROL key, directs the system
  26295.    to temporarily stop screen output. Otherwise, the system treats the
  26296.    NUMLOCK the same as any other toggle key. When CONTROL+NUMLOCK
  26297.    stops screen output, the next keystroke (if it generates a valid
  26298.    character) restores output.
  26299.  
  26300.    The Char1 field holds a bit mask that the system uses to set or clear the
  26301.    lower byte of the keyboard shift-status word. The Char2 field contains a
  26302.    bit mask that the system uses to set or clear the upper byte of the
  26303.    system's shift-status word. The system uses Char1 to set the lower byte of
  26304.    the shift-status word when the user first presses the key. Thereafter the
  26305.    system alternates between setting and clearing on each press. The system
  26306.    uses Char2 to set the upper-byte word when the user presses the key and to
  26307.    clear it when the user releases the key. If a secondary-key prefix (0xE0)
  26308.    is received immediately prior to a toggle key, the Char3 field is used in
  26309.    place of Char2 to set or clear the shift-status word.
  26310.  
  26311.    5.2.3.16  CAPSLOCK Key (Type 0x0010)
  26312.  
  26313.    The CAPSLOCK key (type 0x0010) represents a special toggle key. This
  26314.    key type only applies when the XTableFlags1 field specifies that the
  26315.    CAPSLOCK key is to be processed like a SHIFTLOCK key. When
  26316.    processed as a SHIFTLOCK key, the CAPSLOCK key sets the keyboard
  26317.    shift-status word but cannot be used to clear the word. To do this, a
  26318.    SHIFT key must be pressed.
  26319.  
  26320.    The Char1 field holds a bit mask that the system uses to set the lower
  26321.    byte of the keyboard shift-status word. The Char2 field contains a bit
  26322.    mask that the system uses to set or clear the upper byte of the system's
  26323.    shift-status word. The system uses Char1 to set the lower byte of the
  26324.    shift-status word when the user first presses the key. Thereafter the
  26325.    system clears the byte only if the user presses a SHIFT key. The
  26326.    system uses Char2 to set the upper-byte word when the user presses the key
  26327.    and to clear it when the user releases the key. If a secondary-key prefix
  26328.    (0xE0) is received immediately prior to a toggle key, the Char3 field is
  26329.    used in place of Char2 to set or clear the shift-status word.
  26330.  
  26331.    5.2.3.17  SCROLL LOCK Key (Type 0x0011)
  26332.  
  26333.    The SCROLL LOCK key (type 0x0011) represents a special toggle key that
  26334.    generates a CONTROL+BREAK signal for a program when it is pressed with
  26335.    the CONTROL key. Otherwise, the system treats the SCROLL LOCK key
  26336.    the same as any other toggle key.
  26337.  
  26338.    The Char1 field holds a bit mask that the system uses to set or clear the
  26339.    lower byte of the keyboard shift-status word. The Char2 field contains a
  26340.    bit mask that the system uses to set or clear the upper byte of the
  26341.    system's shift-status word. The system uses Char1 to set the lower byte of
  26342.    the shift-status word when the user first presses the key. Thereafter the
  26343.    system alternates between setting and clearing on each press. The system
  26344.    uses Char2 to set the upper-byte word when the user presses the key and to
  26345.    clear it when the user releases the key. If a secondary-key prefix (0xE0)
  26346.    is received immediately prior to a toggle key, the Char3 field is used in
  26347.    place of Char2 to set or clear the shift-status word.
  26348.  
  26349.    5.2.3.18  Extended-Shift Key (Type 0x0012)
  26350.  
  26351.    An extended-shift key (type 0x0012) represents a shift key that is used in
  26352.    conjunction with national-language support. The key is similar to the
  26353.    shift key (type 0x000C) but sets or clears the extra
  26354.    national-language-support byte of the keyboard-status word.
  26355.  
  26356.    The character fields are defined as follows:
  26357.  
  26358.    Field     Description
  26359.    ──────────────────────────────────────────────────────────────────────────
  26360.    Char1     Specifies the bit mask in which the bits that are on define the
  26361.              field used for the Char2 value. Only the bits in the
  26362.              national-language-support shift-status byte that correspond to
  26363.              the bits in this byte will be altered by the Char2 value.
  26364.  
  26365.    Char2     Specifies the bit mask used to set or clear bits in the
  26366.              extended-status byte when the key is pressed or released.
  26367.  
  26368.    Char3     Specifies the replacement bit mask for Char2 when the secondary
  26369.              key prefix (0xE0) is recognized immediately prior to this key
  26370.              being pressed.
  26371.    ──────────────────────────────────────────────────────────────────────────
  26372.  
  26373.    Char1 and Char2 can define single shift-status bits to set, clear, or
  26374.    toggle. Char2 can be a set of coded bits (delineated by Char1) that will
  26375.    be set to a numeric value when the key is pressed and cleared to zero when
  26376.    released. When Char1 has all bits on, the whole byte can be set to Char2.
  26377.  
  26378.    5.2.3.19  Extended-Toggle Key (Type 0x0013)
  26379.  
  26380.    An extended-toggle key (type 0x0013) represents a shift key that is used
  26381.    in conjunction with national-language support. The key is similar to the
  26382.    toggle key (type 0x000D) but it sets or clears the extra
  26383.    national-language-support byte of the keyboard-status word.
  26384.  
  26385.    The character fields are defined as follows:
  26386.  
  26387.    Field     Description
  26388.    ──────────────────────────────────────────────────────────────────────────
  26389.    Char1     Specifies the bit mask in which the bits that are on define the
  26390.              field used for the Char2 value. Only the bits in the
  26391.              national-language-support shift-status byte that correspond to
  26392.              the bits in this byte will be altered by the Char2 value.
  26393.  
  26394.    Char2     Specifies the bit mask used to set or clear bits in the
  26395.              extended-status byte when the key is pressed.
  26396.  
  26397.    Char3     Specifies the replacement bit mask for Char2 when the
  26398.              secondary-key prefix (0xE0) is recognized immediately prior to
  26399.              this key being pressed.
  26400.    ──────────────────────────────────────────────────────────────────────────
  26401.  
  26402.    Char1 and Char2 can define single shift-status bits to set, clear, or
  26403.    toggle. Char2 can be a set of coded bits (delineated by Char1) that will
  26404.    be set to a numeric value when the key is pressed and set to zero when
  26405.    released. When Char1 has all bits on, the whole byte can be set to Char2.
  26406.  
  26407.    5.2.3.20  Special Foreign Key (Type 0x0014)
  26408.  
  26409.    A special foreign key (type 0x0014) represents any character that may need
  26410.    a CAPSLOCK translation.
  26411.  
  26412.    Shift key     Field used
  26413.    ──────────────────────────────────────────────────────────────────────────
  26414.    None          Char1
  26415.  
  26416.    SHIFT         Char2
  26417.  
  26418.    CAPSLOCK      Char4
  26419.  
  26420.    CAPSLOCK      Char5
  26421.    and SHIFT
  26422.  
  26423.    CONTROL       Computed ASCII control value.
  26424.  
  26425.    ALT           No effect.
  26426.  
  26427.    ALT-GR        Char3
  26428.    ──────────────────────────────────────────────────────────────────────────
  26429.  
  26430.    5.2.3.21  Special Foreign Key (Type 0x0015)
  26431.  
  26432.    A special foreign key (type 0x0015) represents any character that may need
  26433.    an ALT translation.
  26434.  
  26435.    Shift key     Field used
  26436.    ──────────────────────────────────────────────────────────────────────────
  26437.    None          Char1
  26438.  
  26439.    SHIFT         Char2
  26440.  
  26441.    CAPSLOCK      No effect.
  26442.  
  26443.    CONTROL       Computed ASCII control value.
  26444.  
  26445.    ALT           Char4
  26446.  
  26447.    ALT-GR        Char3
  26448.    ──────────────────────────────────────────────────────────────────────────
  26449.  
  26450.    When ALT or ALT+SHIFT is pressed, the scan code and translated
  26451.    character code are equal.
  26452.  
  26453.  
  26454.  5.3  Video Modes and Fonts
  26455.  
  26456.    This section provides brief descriptions of the device-dependent values
  26457.    that may be used with the MS OS/2 video functions. In particular, it
  26458.    describes screen modes, screen attributes, video fonts, and
  26459.    physical-screen buffer addresses for the following display adapters:
  26460.  
  26461.      IBM Monochrome/Printer Adapter
  26462.      IBM Color Graphics Adapter (CGA)
  26463.      IBM Enhanced Graphics Adapter (EGA)
  26464.      IBM PS/2 Video Graphics Array (VGA)
  26465.      IBM PS/2 Display Adapter
  26466.  
  26467.  5.3.1  Screen Modes
  26468.  
  26469.    The VioSetMode function sets the screen mode for the display adapter. The
  26470.    screen mode defines the type of output (text or graphics) and the
  26471.    resolution of the output; that is, it defines the width and height of the
  26472.    screen in character cells or pels. The available screen modes depend on
  26473.    the display's device driver as well as on the display adapter. Not all
  26474.    screen modes for a given display adapter are supported by the
  26475.    corresponding MS OS/2 display device driver. In general, an MS OS/2
  26476.    display device driver supports at least one text mode and one graphics
  26477.    mode and, in many cases, the device driver supports all modes.
  26478.  
  26479.    Tables 5.4 and 5.5 list the screen modes available for the IBM Monochrome
  26480.    Printer Adapter, Color Graphics Adapter, Enhanced Graphics Adapter, Video
  26481.    Graphics Array, PS/2 Display Adapter, and any adapter that is one-hundred
  26482.    percent compatible with these.
  26483.  
  26484.    Table 5.4
  26485.    Text Modes
  26486.    ──────────────────────────────────────────────────────────────────────────
  26487. ╓┌─┌───────┌────┌──────┌──────┌───────┌───────────┌───────────┌──────────────╖
  26488.                        Cell   Cell    Vertical    Horizontal
  26489.    Columns Rows Colors width  height  resolution  resolution  Display
  26490.    ──────────────────────────────────────────────────────────────────────────
  26491.    80      25   2      9      14      720         350         Monochrome/
  26492.  
  26493.                                                               Printer Adapter
  26494.  
  26495.    80      25   2      9      16      720         400         VGA, PS/2
  26496.                                                               Display Adapter
  26497.  
  26498.    40      25   16     8      8       320         200         CGA, EGA, VGA,
  26499.                                                               PS/2 Display
  26500.                                                               Adapter
  26501.  
  26502.    40      25   16     8      14      320         350         EGA, VGA, and
  26503.                                                               PS/2 Display
  26504.                        Cell   Cell    Vertical    Horizontal
  26505.    Columns Rows Colors width  height  resolution  resolution  Display
  26506.    ──────────────────────────────────────────────────────────────────────────
  26507.                                                              PS/2 Display
  26508.                                                               Adapter
  26509.  
  26510.    40      25   16     9      16      360         400         VGA, PS/2
  26511.                                                               Display Adapter
  26512.  
  26513.    80      25   16     8      8       640         200         CGA, EGA, VGA,
  26514.                                                               PS/2 Display
  26515.                                                               Adapter
  26516.  
  26517.    80      25   16     8      14      640         350         EGA, VGA, PS/2
  26518.                                                               Display Adapter
  26519.  
  26520.    80      25   16     9      16      720         400         VGA, PS/2
  26521.                                                               Display Adapter
  26522.  
  26523.    ──────────────────────────────────────────────────────────────────────────
  26524.  
  26525.                        Cell   Cell    Vertical    Horizontal
  26526.    Columns Rows Colors width  height  resolution  resolution  Display
  26527.    ──────────────────────────────────────────────────────────────────────────
  26528. 
  26529.  
  26530.    Table 5.5
  26531.    Graphics Modes
  26532.    ──────────────────────────────────────────────────────────────────────────
  26533.    Colors  Vertical    Horizontal  Display
  26534.            resolution  resolution
  26535.    ──────────────────────────────────────────────────────────────────────────
  26536.    4       320         200         CGA, EGA, VGA, and PS/2 Display Adapter
  26537.  
  26538.    2       640         200         CGA, EGA, VGA, and PS/2 Display Adapter
  26539.  
  26540.    16      320         200         EGA, VGA, PS/2 Display Adapter
  26541.  
  26542.    16      640         200         EGA, VGA, PS/2 Display Adapter
  26543.  
  26544.    2       640         350         EGA, VGA, PS/2 Display Adapter
  26545.  
  26546.    16      640         350         EGA, VGA, PS/2 Display Adapter
  26547.  
  26548.    2       640         480         VGA, PS/2 Display Adapter
  26549.  
  26550.    16      640         480         VGA, PS/2 Display Adapter
  26551.  
  26552.    256     320         200         VGA, PS/2 Display Adapter
  26553.    ──────────────────────────────────────────────────────────────────────────
  26554.  
  26555.    When the screen is in graphics mode, MS OS/2 supports only the following
  26556.    Vio functions:
  26557.  
  26558.      VioRegister
  26559.      VioDeRegister
  26560.      VioGetPhysBuf
  26561.      VioSavRedrawWait
  26562.      VioSavRedrawUndo
  26563.      VioScrLock
  26564.      VioScrUnLock
  26565.      VioPopUp
  26566.      VioEndPopUp
  26567.      VioModeWait
  26568.      VioModeUndo
  26569.      VioGetFont (request type 1 only)
  26570.      VioGetConfig
  26571.      VioSetState (request types 0 and 1 only)
  26572.      VioGetState (request types 0 and 1 only)
  26573.      VioSetMode
  26574.      VioGetMode
  26575.  
  26576.  5.3.2  Screen Attributes
  26577.  
  26578.    The screen attributes define the background and foreground colors and
  26579.    appearance of text when the screen is in text mode. A screen attribute is
  26580.    an 8-bit bit mask whose fields define the color and intensity of a
  26581.    character, as well as other attributes, such as underlining and blinking.
  26582.    The VioWrtCellStr, VioWrtCharStrAtt, VioWrtNAttr, and VioWrtNCell
  26583.    functions use screen attributes as input parameters. The meaning of the
  26584.    fields within a screen-attribute bit mask depends on the display adapter.
  26585.  
  26586.    For the Monochrome/Printer Adapter, the screen attribute can be a
  26587.    combination of the following values:
  26588.  
  26589.    Value       Meaning
  26590.    ──────────────────────────────────────────────────────────────────────────
  26591.    0x00        Blank character
  26592.  
  26593.    0x01        Underlined character
  26594.  
  26595.    0x07        Normal character
  26596.  
  26597.    0x08        High-intensity character
  26598.  
  26599.    0x70        Reverse-video character
  26600.  
  26601.    0x80        Blinking character or high-intensity background (depends on
  26602.                whether display-adapter blinker is active)
  26603.    ──────────────────────────────────────────────────────────────────────────
  26604.  
  26605.    For the Color Graphics Adapter and the Enhanced Graphics Adapter, the
  26606.    screen attribute can be a combination of the following values:
  26607.  
  26608.    Value       Meaning
  26609.    ──────────────────────────────────────────────────────────────────────────
  26610.    0x00        Black character
  26611.  
  26612.    0x01        Blue character
  26613.  
  26614.    0x02        Green character
  26615.  
  26616.    0x04        Red character
  26617.  
  26618.    0x08        High-intensity character
  26619.  
  26620.    0x10        Blue background
  26621.  
  26622.    0x20        Green background
  26623.  
  26624.    0x40        Red background
  26625.  
  26626.    0x80        Blinking character
  26627.    ──────────────────────────────────────────────────────────────────────────
  26628.  
  26629.  5.3.3  Physical-Screen Buffer Addresses
  26630.  
  26631.    The physical-screen buffer address is the starting address of the display
  26632.    adapter's video-buffer memory. This starting address, as well as the size
  26633.    of the video memory and the format and meaning of the contents of the
  26634.    memory, depends on the display adapter and the screen mode.
  26635.  
  26636.  5.3.4  Video Fonts
  26637.  
  26638.    The VioGetFont and VioSetFont functions retrieve and set video fonts for
  26639.    the text-mode screen. These functions can be used with displays, such as
  26640.    the Enhanced Graphics Adapter and the Video Graphics Array, that accept
  26641.    downloadable fonts. To use a custom font, a program can either create it
  26642.    or modify a copy of an existing font. A program uses the VioSetFont
  26643.    function to set the current font and the VioGetFont function to copy
  26644.    existing fonts from the display.
  26645.  
  26646.    For the Enhanced Graphics Adapter and Video Graphics Array, a video font
  26647.    is an array of 256 character cells. Each cell consists of an array of
  26648.    scan-line data. The cell height specifies number of scan lines for each
  26649.    cell. The width of the cell specifies the number of bytes for each scan
  26650.    line. Each bit represents a single pel in the character cell. If the bit
  26651.    is 1, the pel is the foreground color. If the bit is 0, the pel is the
  26652.    background color.
  26653.  
  26654.    Some VGA text modes specify character widths of 9 pels. The video fonts
  26655.    used with this mode supply only 8 bits. The display provides the
  26656.    additional background pel automatically.
  26657.  
  26658.  
  26659.  5.4  Resource-File Formats
  26660.  
  26661.    An application can access the resources of an application or dynamic-link
  26662.    library by using the DosGetResource function. MS OS/2 has several
  26663.    predefined resource formats that Presentation Manager applications can use
  26664.    to create pointers, icons, bitmaps, menus, accelerator tables, and dialog
  26665.    windows. Other MS OS/2 programs can also access these resources directly,
  26666.    or they can define and access their own resources. The following is a list
  26667.    of the predefined resource formats:
  26668.  
  26669. ╓┌─┌───────────────────┌─────────────────────────────────────────────────────╖
  26670.    Resource type       Resource format
  26671.    ──────────────────────────────────────────────────────────────────────────
  26672.    Resource type       Resource format
  26673.    ──────────────────────────────────────────────────────────────────────────
  26674.    RT_POINTER          Mouse-pointer shape
  26675.  
  26676.    RT_BITMAP           Bitmap
  26677.  
  26678.    RT_MENU             Menu template
  26679.  
  26680.    RT_DIALOG           Dialog template
  26681.  
  26682.    RT_STRING           String tables
  26683.  
  26684.    RT_FONTDIR          Font directory
  26685.  
  26686.    RT_FONT             Font
  26687.  
  26688.    RT_ACCELTABLE       Accelerator tables
  26689.  
  26690.    RT_RCDATA           Binary data
  26691.  
  26692.    RT_MESSAGE          Error-message tables
  26693.    Resource type       Resource format
  26694.    ──────────────────────────────────────────────────────────────────────────
  26695.   RT_MESSAGE          Error-message tables
  26696.  
  26697.    RT_DLGINCLUDE       Dialog-include filename
  26698.  
  26699.    RT_VKEYTBL          Scan-code to virtual-key tables
  26700.  
  26701.    RT_KEYTBL           Key to font-glyph tables
  26702.  
  26703.    RT_CHARTBL          Glyph to character tables
  26704.  
  26705.    RT_DISPLAYINFO      Screen-display information
  26706.    ──────────────────────────────────────────────────────────────────────────
  26707.  
  26708.  
  26709.    Predefined resources such as pointers, dialog windows, and fonts can be
  26710.    created using Presentation Manager applications such as Icon Editor,
  26711.    Dialog Editor, and Font Editor. Other resources can be generated by using
  26712.    the MS OS/2 Resource Compiler (rc). Resource Compiler also adds resources
  26713.    to the executable file for applications and dynamic-link libraries.
  26714.  
  26715.    Presentation Manager applications use the following functions to retrieve
  26716.    resources from an application's executable file or a dynamic-link library.
  26717.    Some functions carry out additional steps, such as creating windows and
  26718.    bitmaps, and do not provide direct access to the data loaded.
  26719.  
  26720.    ■  GpiLoadBitmap
  26721.  
  26722.    ■  GpiLoadFonts
  26723.  
  26724.    ■  WinLoadPointer
  26725.  
  26726.    ■  WinLoadMenu
  26727.  
  26728.    ■  WinLoadDlg
  26729.  
  26730.    ■  WinLoadAccelTable
  26731.  
  26732.    ■  WinLoadMessage
  26733.  
  26734.    ■  WinLoadString
  26735.  
  26736.    The following sections describe the internal format of the predefined
  26737.    resources. The format descriptions are useful for MS OS/2 programs that
  26738.    create new resources or that load these resources directly by using the
  26739.    DosGetResource function.
  26740.  
  26741.  5.4.1  Pointer and Icon Resources
  26742.  
  26743.    The RT_POINTER resource represents a pointer or icon resource. A pointer
  26744.    or icon resource is a special bitmap that contains two bit masks.
  26745.    Presentation Manager applications use the resource to draw mouse pointers
  26746.    or icons on the display. The WinLoadPointer function is typically used to
  26747.    load a pointer or icon resource and create a pointer handle. An
  26748.    application can draw the pointer or icon by passing the pointer handle to
  26749.    the WinDrawPointer function.
  26750.  
  26751.    The pointer and icon resources have the following format:
  26752.  
  26753.    /* These fields are identical to the BITMAPFILEHEADER structure. */
  26754.  
  26755.    USHORT usType;               /* PT for pointer or IC for icon      */
  26756.    ULONG cbSize;                /* size of resource (in bytes)        */
  26757.    USHORT xHotspot;             /* x-coordinate of hot spot           */
  26758.    USHORT yHotspot;             /* y-coordinate of hot spot           */
  26759.    ULONG offBits;               /* offset to abANDMask array          */
  26760.  
  26761.    /* These fields are identical to the BITMAPINFOHEADER structure. */
  26762.  
  26763.    ULONG cbFix;                 /* size of BITMAPINFOHEADER structure */
  26764.    USHORT cx;                   /* width of bitmap (in pels)          */
  26765.    USHORT cy;                   /* height of bitmap (in pels)         */
  26766.    USHORT cPlanes;              /* count of color planes in bitmaps   */
  26767.    USHORT cBitCount;            /* count of bits per pel              */
  26768.  
  26769.    /* These fields define the masks and mask colors. */
  26770.  
  26771.    RGB argbColor[1];            /* array of RGB colors                */
  26772.    BYTE abANDMask[1];           /* array for AND mask                 */
  26773.    BYTE abXORMask[1];           /* array for XOR mask                 */
  26774.  
  26775.    The only difference between resources is the usType field. For icon
  26776.    resources this field is set to IC; for pointer resources the field is PT.
  26777.  
  26778.    The size of the argbColor, abANDMask, and abXORMask fields depends on the
  26779.    number of color planes and bits per pel specified by the cPlanes and
  26780.    cBitCount fields. The size of each bit mask also depends on the width and
  26781.    height of the bitmap. The bytes of the abXORMask field start immediately
  26782.    after the last byte in abANDMask.
  26783.  
  26784.    Icon Editor can be used to create pointers and icons. The POINTER and ICON
  26785.    statements in Resource Compiler use the pointer and icon files created by
  26786.    Icon Editor to generate pointer and icon resources.
  26787.  
  26788.  5.4.2  Bitmap Format
  26789.  
  26790.    The RT_BITMAP resource represents a bitmap. Presentation Manager
  26791.    applications typically load the bitmap by using the GpiLoadBitmap
  26792.    function. This function returns a handle to the bitmap. An application can
  26793.    use the GpiSetBitmap function subsequently to set the bitmap as the
  26794.    current bitmap of a memory device context.
  26795.  
  26796.    A bitmap resource has the following format:
  26797.  
  26798.    /* These fields are identical to the BITMAPFILEHEADER structure. */
  26799.  
  26800.    USHORT usType;               /* BM                                 */
  26801.    ULONG cbSize;                /* size of resource (in bytes)        */
  26802.    USHORT xHotspot;             /* x-coordinate of hot spot           */
  26803.    USHORT yHotspot;             /* y-coordinate of hot spot           */
  26804.    ULONG offBits;               /* offset to abBitmap array           */
  26805.  
  26806.    /* These fields are identical to the BITMAPINFOHEADER structure. */
  26807.  
  26808.    ULONG cbFix;                 /* size of BITMAPINFOHEADER structure */
  26809.    USHORT cx;                   /* width of bitmap (in pels)          */
  26810.    USHORT cy;                   /* height of bitmap (in pels)         */
  26811.    USHORT cPlanes;              /* count of color planes in bitmaps   */
  26812.    USHORT cBitCount;            /* count of bits per pel              */
  26813.  
  26814.    /* These fields define the bitmap and its colors. */
  26815.  
  26816.    RGB argbColor[1];            /* array of RGB colors                */
  26817.    BYTE abBitmap[1];            /* array for bitmap bits              */
  26818.  
  26819.    The size of the argbColor and abBitmap fields depends on the number of
  26820.    color planes and bits per pel specified by the cPlanes and cBitCount
  26821.    fields. The size of the abBitmap field also depends on the width and
  26822.    height of the bitmap.
  26823.  
  26824.    Icon Editor can be used to create bitmaps. The BITMAP statement in
  26825.    Resource Compiler uses the bitmap files created by Icon Editor to generate
  26826.    bitmap resources.
  26827.  
  26828.  5.4.3  String and Message Resources
  26829.  
  26830.    The RT_STRING or RT_MESSAGE resource is a table of exactly 16 charac- ter
  26831.    strings representing error messages and other text used by an application.
  26832.    Presentation Manager applications typically load individual strings from a
  26833.    table by using the WinLoadString or WinLoadMessage function. These
  26834.    functions use a string identifier to determine the table containing the
  26835.    string and the string's location in the table.
  26836.  
  26837.    Each string or message resource consists of a table of exactly 16 entries.
  26838.    Each entry has the following form:
  26839.  
  26840.    BYTE cchText;       /* length of string including zero terminator */
  26841.    SZ szText[cchText]; /* zero-terminated string                     */
  26842.  
  26843.    String and message tables have resource identifiers starting at 1. Each
  26844.    string also has a unique identifier. A string's identifier determines
  26845.    which table the string is in and where in the table it is located. The
  26846.    following C-language expressions specify the location of a string:
  26847.  
  26848.    USHORT idString;       /* string ID                              */
  26849.    USHORT idTable;        /* resource ID of string or message table */
  26850.    USHORT iString;        /* index in table of string               */
  26851.  
  26852.    idTable = (idString / 16) + 1;
  26853.    iString = idString % 16;
  26854.  
  26855.    For example, if the string identifier is 1, the string is in table 1 at
  26856.    entry 1. If the string identifier is 17, the string is in table 2 at entry
  26857.    1.
  26858.  
  26859.    The STRINGTABLE and MESSAGETABLE statements in Resource Compiler generate
  26860.    string and message resources.
  26861.  
  26862.  5.4.4  Menu Resource
  26863.  
  26864.    The RT_MENU resource represents a menu template. A menu template contains
  26865.    all the data needed to create a menu. A Presentation Manager application
  26866.    typically loads a menu-template resource by using the WinLoadMenu
  26867.    function.
  26868.  
  26869.    A menu-template resource has the following format:
  26870.  
  26871.    ULONG cbSize;               /* size of menu template (in bytes)  */
  26872.    USHORT idCodePage;          /* code page for menu names          */
  26873.    USHORT idClass;             /* menu window-class ID              */
  26874.    USHORT cItems;              /* number of items in menu           */
  26875.  
  26876.    /* These fields are repeated for each item. */
  26877.  
  26878.    USHORT fStyle;              /* menu-style flags                  */
  26879.    USHORT fAttributes;         /* menu-attribute flags              */
  26880.    USHORT cmd;                 /* menu-item ID                      */
  26881.    SZ szItemName[1];           /* null-terminated menu name         */
  26882.  
  26883.    If a menu item is a submenu, its fields are followed immediately by the
  26884.    menu-template resource that defines the menu items in that submenu.
  26885.  
  26886.    The length of the szItemName field is variable and depends on the menu
  26887.    item. If the menu item has no name, for example, if it is a menu
  26888.    separator, no szItemName field is given.
  26889.  
  26890.    The MENU statement in Resource Compiler generates menu templates.
  26891.  
  26892.  5.4.5  Accelerator-Table Resource
  26893.  
  26894.    The RT_ACCELTABLE resource represents a keyboard-accelerator table.
  26895.    Accelerator tables are used by Presentation Manager applications to
  26896.    translate keystrokes into commands; that is, they translate WM_CHAR
  26897.    messages into WM_COMMAND, WM_SYSCOMMAND, or WM_HELP messages. An
  26898.    application typically loads accelerator tables by using the
  26899.    WinLoadAccelTable function.
  26900.  
  26901.    The accelerator-table resource has the following format:
  26902.  
  26903.    /* These fields are identical to the ACCELTABLE structure. */
  26904.  
  26905.    USHORT cAccel;           /* number of accelerators in the table */
  26906.    USHORT codepage;         /* code page for text                  */
  26907.  
  26908.    /* These fields are identical to the ACCEL structure. */
  26909.  
  26910.    USHORT fs;                /* accelerator flags                  */
  26911.    USHORT key;               /* keystroke to be translated         */
  26912.    USHORT cmd;               /* command ID of translated keystroke */
  26913.  
  26914.    The fields defining the keystroke and command are repeated for each
  26915.    accelerator in the table. The fs field specifies whether the key field
  26916.    represents a virtual key, a scan code, or a key combination.
  26917.  
  26918.    The ACCELTABLE statement in Resource Compiler generates accelerator-table
  26919.    resources.
  26920.  
  26921.  5.4.6  Dialog Templates
  26922.  
  26923.    The RT_DIALOG resource represents a dialog-template resource. A
  26924.    dialog-template resource contains all the data needed to create a dialog
  26925.    window and corresponding child controls. Presentation Manager applications
  26926.    typically use the WinLoadDlg or WinDlgBox function to load the resource.
  26927.    The function creates the dialog window and control windows specified by
  26928.    the template.
  26929.  
  26930.    Some applications load the resource directly by using the DosGetResource
  26931.    function. Loading a dialog-template resource directly allows an
  26932.    application to examine and modify the data before creating the dialog
  26933.    window. The application can then pass the data to the WinCreateDlg
  26934.    function to create the dialog window, or extract individual parameters
  26935.    from the data and pass the parameters to functions such as WinCreateWindow
  26936.    to create other types of windows.
  26937.  
  26938.    A dialog-template resource has the following form:
  26939.  
  26940.    /* These fields are identical to the DLGTEMPLATE structure. */
  26941.  
  26942.    USHORT      cbTemplate;       /* number of bytes in the template   */
  26943.    USHORT      type;             /* dialog type                       */
  26944.    USHORT      codepage;         /* code-page for text                */
  26945.    USHORT      offadlgti;        /* offset to 1st dialog item (12)    */
  26946.    USHORT      fsTemplateStatus; /* template-status flags             */
  26947.    USHORT      iItemFocus;       /* index to initial focus window     */
  26948.    USHORT      coffPresParams;   /* offset to presentation parameters */
  26949.    DLGTITEM    adlgti[1]         /* array of DLGTITEM structures      */
  26950.  
  26951.    /* These fields are identical to the DLGTITEM structure. */
  26952.  
  26953.    USHORT    fsItemStatus;     /* item-status flags                   */
  26954.    USHORT    cChildren;        /* number of child windows             */
  26955.    USHORT    cchClassName;     /* number of characters in class name  */
  26956.    USHORT    offClassName;     /* offset to class name or class ID    */
  26957.    USHORT    cchText;          /* number of characters in window text */
  26958.    USHORT    offText;          /* offset to window text               */
  26959.    ULONG     flStyle;          /* window styles                       */
  26960.    SHORT     x;                /* x-coordinate of window              */
  26961.    SHORT     y;                /* y-coordinate of window              */
  26962.    SHORT     cx;               /* width of window                     */
  26963.    SHORT     cy;               /* height of window                    */
  26964.    USHORT    id;               /* window ID                           */
  26965.    USHORT    offPresParams;    /* offset to presentation parameters   */
  26966.    USHORT    offCtlData;       /* offset to class-specific data       */
  26967.  
  26968.    The fields defining the dialog items are repeated for each window in the
  26969.    template. Data such as class name and window text appears after the fields
  26970.    for the last window. If a window has child windows, the fields of the
  26971.    child windows immediately follow the fields for the parent window. If the
  26972.    cchClassName field is zero, the offClassName field must contain a valid
  26973.    window-class identifier. The format of the class-specific data depends on
  26974.    the window class. In general, the first word of the presentation parameter
  26975.    data and the class-specific data must specify the length of that data in
  26976.    bytes.
  26977.  
  26978.    Dialog Box Editor can be used to create dialog-template resources. The
  26979.    Resource Compiler statements DLGTEMPLATE and WINDOWTEMPLATE generate
  26980.    dialog-template resources.
  26981.  
  26982.  5.4.7  Dialog-Include Resource
  26983.  
  26984.    The RT_DLGINCLUDE resource is a filename. This resource typically is used
  26985.    in conjunction with a dialog-template resource that has the same resource
  26986.    identifier. The dialog-include resource specifies the include file that
  26987.    contains definitions for constants used in the dialog template. Although
  26988.    the resource is useful to Dialog Box Editor, other applications probably
  26989.    will not need it.
  26990.  
  26991.    The DLGINCLUDE statement in Resource Compiler generates dialog-include
  26992.    resources.
  26993.  
  26994.  5.4.8  Font Resource
  26995.  
  26996.    The RT_FONT resource represents a font resource. A font resource consists
  26997.    of the font metrics and character data that describe a font. Presentation
  26998.    Manager applications load font resources by using the GpiLoadFont
  26999.    function. This function makes all font resources in a specified
  27000.    dynamic-link library available to the application.
  27001.  
  27002.    A font resource is identical in format to a font file. For more
  27003.    information, see the Microsoft Operating System/2 Programmer's Reference,
  27004.    Volume 2.
  27005.  
  27006.    Font Editor can be used to create fonts. The FONT statement in Resource
  27007.    Compiler uses the font created by Font Editor to generate font resources.
  27008.  
  27009.  5.4.9  Font-Directory Resource
  27010.  
  27011.    The RT_FONTDIR resource represents a font directory. A font directory
  27012.    consists of the font metrics of a corresponding font resource. MS OS/2
  27013.    uses font directories to load information about a font without having to
  27014.    load the entire font into memory.
  27015.  
  27016.    The font-directory resource has the following form:
  27017.  
  27018.    USHORT usFontDir;   /* resource type (always 6)                */
  27019.    USHORT cFonts;      /* count of fonts in directory             */
  27020.    USHORT cbSize;      /* size of each directory entry (in bytes) */
  27021.  
  27022.    /* These fields are repeated for each font. */
  27023.  
  27024.    USHORT idFont;       /* resource ID for corresponding font     */
  27025.    FOCAMETRICS foca;    /* font metrics from font file            */
  27026.  
  27027.    The FONTDIR statement in Resource Compiler generates a font-directory
  27028.    resource. The FONT statement of Resource Compiler also generates a font
  27029.    directory. It does this as it generates the font resource, so the FONTDIR
  27030.    statement is rarely used.
  27031.  
  27032.  5.4.10  Binary Data
  27033.  
  27034.    The RT_RCDATA resource represent one or more bytes of binary data. The
  27035.    binary can have any format. The application defines the content of the
  27036.    data.
  27037.  
  27038.    The RCDATA statement in Resource Compiler generates binary-data resources.
  27039.  
  27040.  5.4.11  MS OS/2 Internal Resources
  27041.  
  27042.    The RT_VKEYTBL, RT_KEYTBL, RT_CHARTBL, and RT_DISPLAYINFO resources
  27043.    represent data used internally by MS OS/2. MS OS/2 uses this data to carry
  27044.    out system-level tasks──for example, translating scan codes to virtual
  27045.    keys and translating code points in a code page to font gylphs.
  27046.  
  27047.  
  27048.  
  27049.  ────────────────────────────────────────────────────────────────────────────
  27050.  Appendix A  Error Values
  27051.  
  27052.         A.1     Introduction
  27053.         A.2     Errors
  27054.  
  27055.  A.1  Introduction
  27056.  
  27057.    This chapter contains the possible error values that can be returned by
  27058.    the MS OS/2 base system functions. Before you can use these errors in your
  27059.    application, you must define the INCL_BASE, INCL_ERRORS, or INCL_DOSERRORS
  27060.    constant before including the os2.h file. The following code is a typical
  27061.    example:
  27062.  
  27063.    #define INCL_DOS
  27064.    #define INCL_DOSERRORS
  27065.  
  27066.    #include <os2.h>
  27067.  
  27068.  
  27069.  A.2  Errors
  27070.  
  27071.    The following list gives the error values that may be returned by the Dos,
  27072.    Kbd, Mou, and Vio functions. The error values are listed in numerical
  27073.    order, and the corresponding error constant is given for each value.
  27074.  
  27075.  
  27076.    0       NO_ERROR
  27077.  
  27078.    1       ERROR_INVALID_FUNCTION
  27079.    2       ERROR_FILE_NOT_FOUND
  27080.    3       ERROR_PATH_NOT_FOUND
  27081.    4       ERROR_TOO_MANY_OPEN_FILES
  27082.    5       ERROR_ACCESS_DENIED
  27083.    6       ERROR_INVALID_HANDLE
  27084.    7       ERROR_ARENA_TRASHED
  27085.    8       ERROR_NOT_ENOUGH_MEMORY
  27086.    9       ERROR_INVALID_BLOCK
  27087.    10      ERROR_BAD_ENVIRONMENT
  27088.    11      ERROR_BAD_FORMAT
  27089.    12      ERROR_INVALID_ACCESS
  27090.    13      ERROR_INVALID_DATA
  27091.  
  27092.    15      ERROR_INVALID_DRIVE
  27093.    16      ERROR_CURRENT_DIRECTORY
  27094.    17      ERROR_NOT_SAME_DEVICE
  27095.    18      ERROR_NO_MORE_FILES
  27096.    19      ERROR_WRITE_PROTECT
  27097.    20      ERROR_BAD_UNIT
  27098.    21      ERROR_NOT_READY
  27099.    22      ERROR_BAD_COMMAND
  27100.    23      ERROR_CRC
  27101.    24      ERROR_BAD_LENGTH
  27102.    25      ERROR_SEEK
  27103.    26      ERROR_NOT_DOS_DISK
  27104.    27      ERROR_SECTOR_NOT_FOUND
  27105.    28      ERROR_OUT_OF_PAPER
  27106.    29      ERROR_WRITE_FAULT
  27107.    30      ERROR_READ_FAULT
  27108.    31      ERROR_GEN_FAILURE
  27109.    32      ERROR_SHARING_VIOLATION
  27110.    33      ERROR_LOCK_VIOLATION
  27111.    34      ERROR_WRONG_DISK
  27112.    35      ERROR_FCB_UNAVAILABLE
  27113.    36      ERROR_SHARING_BUFFER_EXCEEDED
  27114.    50      ERROR_NOT_SUPPORTED
  27115.  
  27116.    80      ERROR_FILE_EXISTS
  27117.    81      ERROR_DUP_FCB
  27118.    82      ERROR_CANNOT_MAKE
  27119.    83      ERROR_FAIL_I24
  27120.    84      ERROR_OUT_OF_STRUCTURES
  27121.    85      ERROR_ALREADY_ASSIGNED
  27122.    86      ERROR_INVALID_PASSWORD
  27123.    87      ERROR_INVALID_PARAMETER
  27124.    88      ERROR_NET_WRITE_FAULT
  27125.    89      ERROR_NO_PROC_SLOTS
  27126.    90      ERROR_NOT_FROZEN
  27127.    91      ERR_TSTOVFL
  27128.    92      ERR_TSTDUP
  27129.    93      ERROR_NO_ITEMS
  27130.    95      ERROR_INTERRUPT
  27131.    100     ERROR_TOO_MANY_SEMAPHORES
  27132.    101     ERROR_EXCL_SEM_ALREADY_OWNED
  27133.    102     ERROR_SEM_IS_SET
  27134.    103     ERROR_TOO_MANY_SEM_REQUESTS
  27135.    104     ERROR_INVALID_AT_INTERRUPT_TIME
  27136.    105     ERROR_SEM_OWNER_DIED
  27137.    106     ERROR_SEM_USER_LIMIT
  27138.  
  27139.    107     ERROR_DISK_CHANGE
  27140.    108     ERROR_DRIVE_LOCKED
  27141.    109     ERROR_BROKEN_PIPE
  27142.    110     ERROR_OPEN_FAILED
  27143.    111     ERROR_BUFFER_OVERFLOW
  27144.    112     ERROR_DISK_FULL
  27145.    113     ERROR_NO_MORE_SEARCH_HANDLES
  27146.    114     ERROR_INVALID_TARGET_HANDLE
  27147.    115     ERROR_PROTECTION_VIOLATION
  27148.    116     ERROR_VIOKBD_REQUEST
  27149.    117     ERROR_INVALID_CATEGORY
  27150.    118     ERROR_INVALID_VERIFY_SWITCH
  27151.    119     ERROR_BAD_DRIVER_LEVEL
  27152.    120     ERROR_CALL_NOT_IMPLEMENTED
  27153.    121     ERROR_SEM_TIMEOUT
  27154.    122     ERROR_INSUFFICIENT_BUFFER
  27155.    123     ERROR_INVALID_NAME
  27156.    124     ERROR_INVALID_LEVEL
  27157.    125     ERROR_NO_VOLUME_LABEL
  27158.    126     ERROR_MOD_NOT_FOUND
  27159.    127     ERROR_PROC_NOT_FOUND
  27160.    128     ERROR_WAIT_NO_CHILDREN
  27161.    129     ERROR_CHILD_NOT_COMPLETE
  27162.    130     ERROR_DIRECT_ACCESS_HANDLE
  27163.    131     ERROR_NEGATIVE_SEEK
  27164.    132     ERROR_SEEK_ON_DEVICE
  27165.    133     ERROR_IS_JOIN_TARGET
  27166.    134     ERROR_IS_JOINED
  27167.    135     ERROR_IS_SUBSTED
  27168.    136     ERROR_NOT_JOINED
  27169.    137     ERROR_NOT_SUBSTED
  27170.    138     ERROR_JOIN_TO_JOIN
  27171.    139     ERROR_SUBST_TO_SUBST
  27172.    140     ERROR_JOIN_TO_SUBST
  27173.    141     ERROR_SUBST_TO_JOIN
  27174.    142     ERROR_BUSY_DRIVE
  27175.    143     ERROR_SAME_DRIVE
  27176.    144     ERROR_DIR_NOT_ROOT
  27177.    145     ERROR_DIR_NOT_EMPTY
  27178.    146     ERROR_IS_SUBST_PATH
  27179.    147     ERROR_IS_JOIN_PATH
  27180.    148     ERROR_PATH_BUSY
  27181.    149     ERROR_IS_SUBST_TARGET
  27182.    150     ERROR_SYSTEM_TRACE
  27183.    151     ERROR_INVALID_EVENT_COUNT
  27184.    152     ERROR_TOO_MANY_MUXWAITERS
  27185.    153     ERROR_INVALID_LIST_FORMAT
  27186.    154     ERROR_LABEL_TOO_LONG
  27187.    155     ERROR_TOO_MANY_TCBS
  27188.    156     ERROR_SIGNAL_REFUSED
  27189.    157     ERROR_DISCARDED
  27190.    158     ERROR_NOT_LOCKED
  27191.    159     ERROR_BAD_THREADID_ADDR
  27192.    160     ERROR_BAD_ARGUMENTS
  27193.    161     ERROR_BAD_PATHNAME
  27194.    162     ERROR_SIGNAL_PENDING
  27195.    163     ERROR_UNCERTAIN_MEDIA
  27196.    164     ERROR_MAX_THRDS_REACHED
  27197.    165     ERROR_MONITORS_NOT_SUPPORTED
  27198.    166     ERROR_UNC_DRIVER_NOT_INSTALLED
  27199.    167     ERROR_LOCK_FAILED
  27200.    168     ERROR_SWAPIO_FAILED
  27201.  
  27202.    169     ERROR_SWAPIN_FAILED
  27203.    170     ERROR_BUSY
  27204.  
  27205.    180     ERROR_INVALID_SEGMENT_NUMBER
  27206.    181     ERROR_INVALID_CALLGATE
  27207.    182     ERROR_INVALID_ORDINAL
  27208.    183     ERROR_ALREADY_EXISTS
  27209.    184     ERROR_NO_CHILD_PROCESS
  27210.    185     ERROR_CHILD_ALIVE_NOWAIT
  27211.    186     ERROR_INVALID_FLAG_NUMBER
  27212.    187     ERROR_SEM_NOT_FOUND
  27213.    188     ERROR_INVALID_STARTING_CODESEG
  27214.    189     ERROR_INVALID_STACKSEG
  27215.    190     ERROR_INVALID_MODULETYPE
  27216.    191     ERROR_INVALID_EXE_SIGNATURE
  27217.    192     ERROR_EXE_MARKED_INVALID
  27218.    193     ERROR_BAD_EXE_FORMAT
  27219.    194     ERROR_ITERATED_DATA_EXCEEDS_64K
  27220.    195     ERROR_INVALID_MINALLOCSIZE
  27221.    196     ERROR_DYNLINK_FROM_INVALID_RING
  27222.    197     ERROR_IOPL_NOT_ENABLED
  27223.    198     ERROR_INVALID_SEGDPL
  27224.    199     ERROR_AUTODATASEG_EXCEEDS_64k
  27225.    200     ERROR_RING2SEG_MUST_BE_MOVABLE
  27226.    201     ERROR_RELOC_CHAIN_XEEDS_SEGLIM
  27227.    202     ERROR_INFLOOP_IN_RELOC_CHAIN
  27228.    203     ERROR_ENVVAR_NOT_FOUND
  27229.    204     ERROR_NOT_CURRENT_CTRY
  27230.    205     ERROR_NO_SIGNAL_SENT
  27231.    206     ERROR_FILENAME_EXCED_RANGE
  27232.    207     ERROR_RING2_STACK_IN_USE
  27233.    208     ERROR_META_EXPANSION_TOO_LONG
  27234.    209     ERROR_INVALID_SIGNAL_NUMBER
  27235.    210     ERROR_THREAD_1_INACTIVE
  27236.    211     ERROR_INFO_NOT_AVAIL
  27237.    212     ERROR_LOCKED
  27238.    213     ERROR_BAD_DYNALINK
  27239.    214     ERROR_TOO_MANY_MODULES
  27240.    215     ERROR_NESTING_NOT_ALLOWED
  27241.  
  27242.    230     ERROR_BAD_PIPE
  27243.    231     ERROR_PIPE_BUSY
  27244.    232     ERROR_NO_DATA
  27245.    233     ERROR_PIPE_NOT_CONNECTED
  27246.    234     ERROR_MORE_DATA
  27247.  
  27248.    240     ERROR_VC_DISCONNECTED
  27249.  
  27250.    303     ERROR_INVALID_PROCID
  27251.    304     ERROR_INVALID_PDELTA
  27252.    305     ERROR_NOT_DESCENDANT
  27253.    306     ERROR_NOT_SESSION_MANAGER
  27254.    307     ERROR_INVALID_PCLASS
  27255.    308     ERROR_INVALID_SCOPE
  27256.    309     ERROR_INVALID_THREADID
  27257.    310     ERROR_DOSSUB_SHRINK
  27258.    311     ERROR_DOSSUB_NOMEM
  27259.    312     ERROR_DOSSUB_OVERLAP
  27260.    313     ERROR_DOSSUB_BADSIZE
  27261.    314     ERROR_DOSSUB_BADFLAG
  27262.    315     ERROR_DOSSUB_BADSELECTOR
  27263.    316     ERROR_MR_MSG_TOO_LONG
  27264.  
  27265.    317     ERROR_MR_MID_NOT_FOUND
  27266.    318     ERROR_MR_UN_ACC_MSGF
  27267.    319     ERROR_MR_INV_MSGF_FORMAT
  27268.    320     ERROR_MR_INV_IVCOUNT
  27269.    321     ERROR_MR_UN_PERFORM
  27270.    322     ERROR_TS_WAKEUP
  27271.    323     ERROR_TS_SEMHANDLE
  27272.    324     ERROR_TS_NOTIMER
  27273.    326     ERROR_TS_HANDLE
  27274.    327     ERROR_TS_DATETIME
  27275.    328     ERROR_SYS_INTERNAL
  27276.    329     ERROR_QUE_CURRENT_NAME
  27277.    330     ERROR_QUE_PROC_NOT_OWNED
  27278.    331     ERROR_QUE_PROC_OWNED
  27279.    332     ERROR_QUE_DUPLICATE
  27280.    333     ERROR_QUE_ELEMENT_NOT_EXIST
  27281.    334     ERROR_QUE_NO_MEMORY
  27282.    335     ERROR_QUE_INVALID_NAME
  27283.    336     ERROR_QUE_INVALID_PRIORITY
  27284.    337     ERROR_QUE_INVALID_HANDLE
  27285.    338     ERROR_QUE_LINK_NOT_FOUND
  27286.    339     ERROR_QUE_MEMORY_ERROR
  27287.    340     ERROR_QUE_PREV_AT_END
  27288.    341     ERROR_QUE_PROC_NO_ACCESS
  27289.    342     ERROR_QUE_EMPTY
  27290.    343     ERROR_QUE_NAME_NOT_EXIST
  27291.    344     ERROR_QUE_NOT_INITIALIZED
  27292.    345     ERROR_QUE_UNABLE_TO_ACCESS
  27293.    346     ERROR_QUE_UNABLE_TO_ADD
  27294.    347     ERROR_QUE_UNABLE_TO_INIT
  27295.    349     ERROR_VIO_INVALID_MASK
  27296.    350     ERROR_VIO_PTR
  27297.    351     ERROR_VIO_APTR
  27298.    352     ERROR_VIO_RPTR
  27299.    353     ERROR_VIO_CPTR
  27300.    354     ERROR_VIO_LPTR
  27301.    355     ERROR_VIO_MODE
  27302.    356     ERROR_VIO_WIDTH
  27303.    357     ERROR_VIO_ATTR
  27304.    358     ERROR_VIO_ROW
  27305.    359     ERROR_VIO_COL
  27306.    360     ERROR_VIO_TOPROW
  27307.    361     ERROR_VIO_BOTROW
  27308.    362     ERROR_VIO_RIGHTCOL
  27309.    363     ERROR_VIO_LEFTCOL
  27310.    364     ERROR_SCS_CALL
  27311.    365     ERROR_SCS_VALUE
  27312.    366     ERROR_VIO_WAIT_FLAG
  27313.    367     ERROR_VIO_UNLOCK
  27314.    368     ERROR_SGS_NOT_SESSION_MGR
  27315.    369     ERROR_SMG_INVALID_SGID
  27316.    369     ERROR_SMG_INVALID_SESSION_ID
  27317.    370     ERROR_SMG_NOSG
  27318.    370     ERROR_SMG_NO_SESSIONS
  27319.    371     ERROR_SMG_GRP_NOT_FOUND
  27320.    371     ERROR_SMG_SESSION_NOT_FOUND
  27321.    372     ERROR_SMG_SET_TITLE
  27322.    373     ERROR_KBD_PARAMETER
  27323.    374     ERROR_KBD_NO_DEVICE
  27324.    375     ERROR_KBD_INVALID_IOWAIT
  27325.    376     ERROR_KBD_INVALID_LENGTH
  27326.    377     ERROR_KBD_INVALID_ECHO_MASK
  27327.  
  27328.    378     ERROR_KBD_INVALID_INPUT_MASK
  27329.    379     ERROR_MON_INVALID_PARMS
  27330.    380     ERROR_MON_INVALID_DEVNAME
  27331.    381     ERROR_MON_INVALID_HANDLE
  27332.    382     ERROR_MON_BUFFER_TOO_SMALL
  27333.    383     ERROR_MON_BUFFER_EMPTY
  27334.    384     ERROR_MON_DATA_TOO_LARGE
  27335.    385     ERROR_MOUSE_NO_DEVICE
  27336.    386     ERROR_MOUSE_INV_HANDLE
  27337.    387     ERROR_MOUSE_INV_PARMS
  27338.    388     ERROR_MOUSE_CANT_RESET
  27339.    389     ERROR_MOUSE_DISPLAY_PARMS
  27340.    390     ERROR_MOUSE_INV_MODULE
  27341.    391     ERROR_MOUSE_INV_ENTRY_PT
  27342.    392     ERROR_MOUSE_INV_MASK
  27343.    393     NO_ERROR_MOUSE_NO_DATA
  27344.    394     NO_ERROR_MOUSE_PTR_DRAWN
  27345.    395     ERROR_INVALID_FREQUENCY
  27346.    396     ERROR_NLS_NO_COUNTRY_FILE
  27347.    397     ERROR_NLS_OPEN_FAILED
  27348.    398     ERROR_NLS_NO_CTRY_CODE
  27349.    398     ERROR_NO_COUNTRY_OR_CODEPAGE
  27350.    399     ERROR_NLS_TABLE_TRUNCATED
  27351.    400     ERROR_NLS_BAD_TYPE
  27352.    401     ERROR_NLS_TYPE_NOT_FOUND
  27353.    402     ERROR_VIO_SMG_ONLY
  27354.    403     ERROR_VIO_INVALID_ASCIIZ
  27355.    404     ERROR_VIO_DEREGISTER
  27356.    405     ERROR_VIO_NO_POPUP
  27357.    406     ERROR_VIO_EXISTING_POPUP
  27358.    407     ERROR_KBD_SMG_ONLY
  27359.    408     ERROR_KBD_INVALID_ASCIIZ
  27360.    409     ERROR_KBD_INVALID_MASK
  27361.    410     ERROR_KBD_REGISTER
  27362.    411     ERROR_KBD_DEREGISTER
  27363.    412     ERROR_MOUSE_SMG_ONLY
  27364.    413     ERROR_MOUSE_INVALID_ASCIIZ
  27365.    414     ERROR_MOUSE_INVALID_MASK
  27366.    415     ERROR_MOUSE_REGISTER
  27367.    416     ERROR_MOUSE_DEREGISTER
  27368.    417     ERROR_SMG_BAD_ACTION
  27369.    418     ERROR_SMG_INVALID_CALL
  27370.    419     ERROR_SCS_SG_NOTFOUND
  27371.    420     ERROR_SCS_NOT_SHELL
  27372.    421     ERROR_VIO_INVALID_PARMS
  27373.    422     ERROR_VIO_FUNCTION_OWNED
  27374.    423     ERROR_VIO_RETURN
  27375.    424     ERROR_SCS_INVALID_FUNCTION
  27376.    425     ERROR_SCS_NOT_SESSION_MGR
  27377.    426     ERROR_VIO_REGISTER
  27378.    427     ERROR_VIO_NO_MODE_THREAD
  27379.    428     ERROR_VIO_NO_SAVE_RESTORE_THD
  27380.    429     ERROR_VIO_IN_BG
  27381.    430     ERROR_VIO_ILLEGAL_DURING_POPUP
  27382.    431     ERROR_SMG_NOT_BASESHELL
  27383.    432     ERROR_SMG_BAD_STATUSREQ
  27384.    433     ERROR_QUE_INVALID_WAIT
  27385.    434     ERROR_VIO_LOCK
  27386.    435     ERROR_MOUSE_INVALID_IOWAIT
  27387.    436     ERROR_VIO_INVALID_HANDLE
  27388.    437     ERROR_VIO_ILLEGAL_DURING_LOCK
  27389.    438     ERROR_VIO_INVALID_LENGTH
  27390.  
  27391.    439     ERROR_KBD_INVALID_HANDLE
  27392.    440     ERROR_KBD_NO_MORE_HANDLE
  27393.    441     ERROR_KBD_CANNOT_CREATE_KCB
  27394.    442     ERROR_KBD_CODEPAGE_LOAD_INCOMPL
  27395.    443     ERROR_KBD_INVALID_CODEPAGE_ID
  27396.    444     ERROR_KBD_NO_CODEPAGE_SUPPORT
  27397.    445     ERROR_KBD_FOCUS_REQUIRED
  27398.    446     ERROR_KBD_FOCUS_ALREADY_ACTIVE
  27399.    447     ERROR_KBD_KEYBOARD_BUSY
  27400.    448     ERROR_KBD_INVALID_CODEPAGE
  27401.    449     ERROR_KBD_UNABLE_TO_FOCUS
  27402.    450     ERROR_SMG_SESSION_NON_SELECT
  27403.    451     ERROR_SMG_SESSION_NOT_FOREGRND
  27404.    452     ERROR_SMG_SESSION_NOT_PARENT
  27405.    453     ERROR_SMG_INVALID_START_MODE
  27406.    454     ERROR_SMG_INVALID_RELATED_OPT
  27407.    455     ERROR_SMG_INVALID_BOND_OPTION
  27408.    456     ERROR_SMG_INVALID_SELECT_OPT
  27409.    457     ERROR_SMG_START_IN_BACKGROUND
  27410.    458     ERROR_SMG_INVALID_STOP_OPTION
  27411.    459     ERROR_SMG_BAD_RESERVE
  27412.    460     ERROR_SMG_PROCESS_NOT_PARENT
  27413.    461     ERROR_SMG_INVALID_DATA_LENGTH
  27414.    462     ERROR_SMG_NOT_BOUND
  27415.    463     ERROR_SMG_RETRY_SUB_ALLOC
  27416.    464     ERROR_KBD_DETACHED
  27417.    465     ERROR_VIO_DETACHED
  27418.    466     ERROR_MOU_DETACHED
  27419.    467     ERROR_VIO_FONT
  27420.    468     ERROR_VIO_USER_FONT
  27421.    469     ERROR_VIO_BAD_CP
  27422.    470     ERROR_VIO_NO_CP
  27423.    471     ERROR_VIO_NA_CP
  27424.    472     ERROR_INVALID_CODE_PAGE
  27425.    473     ERROR_CPLIST_TOO_SMALL
  27426.    474     ERROR_CP_NOT_MOVED
  27427.    475     ERROR_MODE_SWITCH_INIT
  27428.    476     ERROR_CODE_PAGE_NOT_FOUND
  27429.    477     ERROR_UNEXPECTED_SLOT_RETURNED
  27430.    478     ERROR_SMG_INVALID_TRACE_OPTION
  27431.    479     ERROR_VIO_INTERNAL_RESOURCE
  27432.    480     ERROR_VIO_SHELL_INIT
  27433.    481     ERROR_SMG_NO_HARD_ERRORS
  27434.    482     ERROR_CP_SWITCH_INCOMPLETE
  27435.    483     ERROR_VIO_TRANSPARENT_POPUP
  27436.    484     ERROR_CRITSEC_OVERFLOW
  27437.    485     ERROR_CRITSEC_UNDERFLOW
  27438.    486     ERROR_VIO_BAD_RESERVE
  27439.    487     ERROR_INVALID_ADDRESS
  27440.    488     ERROR_ZERO_SELECTORS_REQUESTED
  27441.    489     ERROR_NOT_ENOUGH_SELECTORS_AVA
  27442.    490     ERROR_INVALID_SELECTOR
  27443.    491     ERROR_SMG_INVALID_PROGRAM_TYPE
  27444.    492     ERROR_SMG_INVALID_PGM_CONTROL
  27445.    493     ERROR_SMG_INVALID_INHERIT_OPT
  27446.    494     ERROR_VIO_EXTENDED_SG
  27447.    495     ERROR_VIO_NOT_PRES_MGR_SG
  27448.    496     ERROR_VIO_SHIELD_OWNED
  27449.    497     ERROR_VIO_NO_MORE_HANDLES
  27450.    498     ERROR_VIO_SEE_ERROR_LOG
  27451.    499     ERROR_VIO_ASSOCIATED_DC
  27452.    500     ERROR_KBD_NO_CONSOLE
  27453.  
  27454.    501     ERROR_MOUSE_NO_CONSOLE
  27455.    502     ERROR_MOUSE_INVALID_HANDLE
  27456.    503     ERROR_SMG_INVALID_DEBUG_PARMS
  27457.    504     ERROR_KBD_EXTENDED_SG
  27458.    505     ERROR_MOU_EXTENDED_SG
  27459.    506     ERROR_SMG_INVALID_ICON_FILE
  27460.  
  27461.  
  27462.    0xF000  ERROR_USER_DEFINED_BASE
  27463.  
  27464.    0       ERROR_I24_WRITE_PROTECT
  27465.    1       ERROR_I24_BAD_UNIT
  27466.    2       ERROR_I24_NOT_READY
  27467.    3       ERROR_I24_BAD_COMMAND
  27468.    4       ERROR_I24_CRC
  27469.    5       ERROR_I24_BAD_LENGTH
  27470.    6       ERROR_I24_SEEK
  27471.    7       ERROR_I24_NOT_DOS_DISK
  27472.    8       ERROR_I24_SECTOR_NOT_FOUND
  27473.    9       ERROR_I24_OUT_OF_PAPER
  27474.    10      ERROR_I24_WRITE_FAULT
  27475.    11      ERROR_I24_READ_FAULT
  27476.    12      ERROR_I24_GEN_FAILURE
  27477.    13      ERROR_I24_DISK_CHANGE
  27478.    15      ERROR_I24_WRONG_DISK
  27479.    16      ERROR_I24_UNCERTAIN_MEDIA
  27480.    17      ERROR_I24_CHAR_CALL_INTERRUPTED
  27481.    18      ERROR_I24_NO_MONITOR_SUPPORT
  27482.    19      ERROR_I24_INVALID_PARAMETER
  27483.  
  27484.            /* Values for error CLASS */
  27485.  
  27486.    1       ERRCLASS_OUTRES
  27487.    2       ERRCLASS_TEMPSIT
  27488.    3       ERRCLASS_AUTH
  27489.    4       ERRCLASS_INTRN
  27490.    5       ERRCLASS_HRDFAIL
  27491.    6       ERRCLASS_SYSFAIL
  27492.    7       ERRCLASS_APPERR
  27493.    8       ERRCLASS_NOTFND
  27494.    9       ERRCLASS_BADFMT
  27495.    10      ERRCLASS_LOCKED
  27496.    11      ERRCLASS_MEDIA
  27497.    12      ERRCLASS_ALREADY
  27498.    13      ERRCLASS_UNK
  27499.    14      ERRCLASS_CANT
  27500.    15      ERRCLASS_TIME
  27501.  
  27502.            /* Values for error ACTION */
  27503.  
  27504.    1       ERRACT_RETRY
  27505.    2       ERRACT_DLYRET
  27506.    3       ERRACT_USER
  27507.    4       ERRACT_ABORT
  27508.    5       ERRACT_PANIC
  27509.    6       ERRACT_IGNORE
  27510.    7       ERRACT_INTRET
  27511.  
  27512.  
  27513.            /* Values for error LOCUS */
  27514.  
  27515.    1       ERRLOC_UNK
  27516.    2       ERRLOC_DISK
  27517.    3       ERRLOC_NET
  27518.    4       ERRLOC_SERDEV
  27519.    5       ERRLOC_MEM
  27520.  
  27521.            /*                                           */
  27522.            /* intercomponent error codes   */
  27523.            /* (from 8000H or 32768)         */
  27524.            /*                                           */
  27525.    32768   ERROR_SWAPPER_NOT_ACTIVE
  27526.    32769   ERROR_INVALID_SWAPID
  27527.    32770   ERROR_IOERR_SWAP_FILE
  27528.    32771   ERROR_SWAP_TABLE_FULL
  27529.    32772   ERROR_SWAP_FILE_FULL
  27530.    32773   ERROR_CANT_INIT_SWAPPER
  27531.    32774   ERROR_SWAPPER_ALREADY_INIT
  27532.    32775   ERROR_PMM_INSUFFICIENT_MEMORY
  27533.    32776   ERROR_PMM_INVALID_FLAGS
  27534.    32777   ERROR_PMM_INVALID_ADDRESS
  27535.    32778   ERROR_PMM_LOCK_FAILED
  27536.    32779   ERROR_PMM_UNLOCK_FAILED
  27537.    32780   ERROR_PMM_MOVE_INCOMPLETE
  27538.    32781   ERROR_UCOM_DRIVE_RENAMED
  27539.    32782   ERROR_UCOM_FILENAME_TRUNCATED
  27540.    32783   ERROR_UCOM_BUFFER_LENGTH
  27541.    32784   ERROR_MON_CHAIN_HANDLE
  27542.    32785   ERROR_MON_NOT_REGISTERED
  27543.    32786   ERROR_SMG_ALREADY_TOP
  27544.    32787   ERROR_PMM_ARENA_MODIFIED
  27545.    32788   ERROR_SMG_PRINTER_OPEN
  27546.    32789   ERROR_PMM_SET_FLAGS_FAILED
  27547.    32790   ERROR_INVALID_DOS_DD
  27548.    65026   ERROR_CPSIO_CODE_PAGE_INVALID
  27549.    65027   ERROR_CPSIO_NO_SPOOLER
  27550.    65028   ERROR_CPSIO_FONT_ID_INVALID
  27551.    65033   ERROR_CPSIO_INTERNAL_ERROR
  27552.    65034   ERROR_CPSIO_INVALID_PTR_NAME
  27553.    65037   ERROR_CPSIO_NOT_ACTIVE
  27554.    65039   ERROR_CPSIO_PID_FULL
  27555.    65040   ERROR_CPSIO_PID_NOT_FOUND
  27556.    65043   ERROR_CPSIO_READ_CTL_SEQ
  27557.    65045   ERROR_CPSIO_READ_FNT_DEF
  27558.    65047   ERROR_CPSIO_WRITE_ERROR
  27559.    65048   ERROR_CPSIO_WRITE_FULL_ERROR
  27560.    65049   ERROR_CPSIO_WRITE_HANDLE_BAD
  27561.    65074   ERROR_CPSIO_SWIT_LOAD
  27562.    65077   ERROR_CPSIO_INV_COMMAND
  27563.    65078   ERROR_CPSIO_NO_FONT_SWIT
  27564.  
  27565.  
  27566.  
  27567.  ────────────────────────────────────────────────────────────────────────────
  27568.  Appendix B  ANSI Escape Sequences
  27569.  
  27570.         B.1     Introduction
  27571.         B.2     Cursor Functions
  27572.             B.2.1     Cursor Position
  27573.             B.2.2     Cursor Up
  27574.             B.2.3     Cursor Down
  27575.             B.2.4     Cursor Forward
  27576.             B.2.5     Cursor Backward
  27577.             B.2.6     Save Cursor Position
  27578.             B.2.7     Restore Cursor Position
  27579.         B.3     Erase Functions
  27580.             B.3.1     Erase Display
  27581.             B.3.2     Erase Line
  27582.         B.4     Screen Graphics Functions
  27583.             B.4.1     Set Graphics Rendition
  27584.             B.4.2     Set Mode
  27585.             B.4.3     Reset Mode
  27586.  
  27587.  B.1  Introduction
  27588.  
  27589.    This appendix lists all the escape sequences that can be used in the
  27590.    functions such as DosWrite and VioWrtTTY to control the operation of the
  27591.    screen while in text mode. The escape sequences can be used in family API,
  27592.    advanced video-input-and-output (AVIO) and full-screen programs.
  27593.  
  27594.    The ANSI escape sequences affect cursor positioning, erase functions, and
  27595.    screen graphics. The sequences must be typed exactly as shown with all
  27596.    parameters replaced with appropriate values. No spaces are allowed. The
  27597.    ESC in the syntax represents the escape character (27).
  27598.  
  27599.  
  27600.  B.2  Cursor Functions
  27601.  
  27602.    The following functions affect the movement of the cursor.
  27603.  
  27604.  B.2.1  Cursor Position
  27605.  
  27606.      ESC[row;colH
  27607.  
  27608.      or
  27609.  
  27610.      ESC[row;colf
  27611.  
  27612.  
  27613.    These two sequences move the cursor to the position specified by the
  27614.    parameters. When no parameters are provided, the cursor moves to the home
  27615.    position (the upper-left corner of the screen).
  27616.  
  27617.  B.2.2  Cursor Up
  27618.  
  27619.      ESC[nA
  27620.  
  27621.  
  27622.    This sequence moves the cursor up n rows without changing columns. If the
  27623.    cursor is already on the top line, MS OS/2 ignores this sequence.
  27624.  
  27625.  B.2.3  Cursor Down
  27626.  
  27627.      ESC[nB
  27628.  
  27629.    This sequence moves the cursor down n rows without changing columns. If
  27630.    the cursor is already on the bottom row, MS OS/2 ignores this sequence.
  27631.  
  27632.  B.2.4  Cursor Forward
  27633.  
  27634.      ESC[nC
  27635.  
  27636.    This sequence moves the cursor forward n columns without changing lines.
  27637.    If the cursor is already in the far-right column, MS OS/2 ignores this
  27638.    sequence.
  27639.  
  27640.  B.2.5  Cursor Backward
  27641.  
  27642.      ESC[nD
  27643.  
  27644.    This sequence moves the cursor back n columns without changing lines. If
  27645.    the cursor is already in the far-left column, MS OS/2 ignores this
  27646.    sequence.
  27647.  
  27648.  B.2.6  Save Cursor Position
  27649.  
  27650.      ESC[s
  27651.  
  27652.    This sequence saves the current cursor position. This position can be
  27653.    restored with the Restore Cursor Position sequence.
  27654.  
  27655.  B.2.7  Restore Cursor Position
  27656.  
  27657.      ESC[u
  27658.  
  27659.    This sequence restores the cursor position to the Save Cursor Position
  27660.    value.
  27661.  
  27662.  
  27663.  B.3  Erase Functions
  27664.  
  27665.    The following functions erase the screen.
  27666.  
  27667.  B.3.1  Erase Display
  27668.  
  27669.      ESC[2J
  27670.  
  27671.    This sequence erases the screen and moves the cursor to the home position
  27672.    (the upper-left corner of the screen).
  27673.  
  27674.  B.3.2  Erase Line
  27675.  
  27676.      ESC[K
  27677.  
  27678.    This sequence erases from the cursor to the end of the line (including the
  27679.    cursor position).
  27680.  
  27681.  
  27682.  B.4  Screen Graphics Functions
  27683.  
  27684.    The following functions affect screen graphics.
  27685.  
  27686.  B.4.1  Set Graphics Rendition
  27687.  
  27688.  
  27689.      ESC[g; ... ;gm
  27690.  
  27691.    This sequence calls the graphics functions specified by the following
  27692.    numeric values. These functions remain until the next occurrence of this
  27693.    sequence. This sequence works only if the screen device supports graphics.
  27694.  
  27695.    The g variable may be any of the following values:
  27696.  
  27697. ╓┌─┌───────┌─────────────────────────────────────────────────────────────────╖
  27698.    Value   Function
  27699.    ──────────────────────────────────────────────────────────────────────────
  27700.    0       All attributes off
  27701.    Value   Function
  27702.    ──────────────────────────────────────────────────────────────────────────
  27703.    0       All attributes off
  27704.  
  27705.    1       Bold on
  27706.  
  27707.    2       Faint on
  27708.  
  27709.    3       Italic on
  27710.  
  27711.    5       Blink on
  27712.  
  27713.    6       Rapid-blink on
  27714.  
  27715.    7       Reverse video on
  27716.  
  27717.    8       Concealed on
  27718.  
  27719.    30      Black foreground
  27720.  
  27721.    31      Red foreground
  27722.    Value   Function
  27723.    ──────────────────────────────────────────────────────────────────────────
  27724.   31      Red foreground
  27725.  
  27726.    32      Green foreground
  27727.  
  27728.    33      Yellow foreground
  27729.  
  27730.    34      Blue foreground
  27731.  
  27732.    35      Magenta foreground
  27733.  
  27734.    36      Cyan foreground
  27735.  
  27736.    37      White foreground
  27737.  
  27738.    40      Black background
  27739.  
  27740.    41      Red background
  27741.  
  27742.    42      Green background
  27743.    Value   Function
  27744.    ──────────────────────────────────────────────────────────────────────────
  27745.   42      Green background
  27746.  
  27747.    43      Yellow background
  27748.  
  27749.    44      Blue background
  27750.  
  27751.    45      Magenta background
  27752.  
  27753.    46      Cyan background
  27754.  
  27755.    47      White background
  27756.  
  27757.    48      Subscript
  27758.  
  27759.    49      Superscript
  27760.    ──────────────────────────────────────────────────────────────────────────
  27761.  
  27762.  
  27763.    The values 30 through 47 meet the ISO 6429 standard.
  27764.  
  27765.  B.4.2  Set Mode
  27766.  
  27767.      ESC[-1=sh
  27768.  
  27769.    This sequence changes the screen width or type. The s variable can be one
  27770.    of the following numeric values:
  27771.  
  27772.    Value   Function
  27773.    ──────────────────────────────────────────────────────────────────────────
  27774.    0       40 -1x+1 25 black and white
  27775.  
  27776.    1       40 -1x+1 25 color
  27777.  
  27778.    2       80 -1x+1 25 black and white
  27779.  
  27780.    3       80 -1x+1 25 color
  27781.  
  27782.    4       320 -1x+1 200 color
  27783.  
  27784.    5       320 -1x+1 200 black and white
  27785.  
  27786.    6       640 -1x+1 200 black and white
  27787.  
  27788.    7       Wraps at the end of each line
  27789.    ──────────────────────────────────────────────────────────────────────────
  27790.  
  27791.  B.4.3  Reset Mode
  27792.  
  27793.      ESC[-1=sl
  27794.  
  27795.    The values for this escape sequence are the same as for Set Mode, except
  27796.    that the value 7 resets the mode that causes wrapping at the end of each
  27797.    line.
  27798.  
  27799.  
  27800.  
  27801.  ────────────────────────────────────────────────────────────────────────────
  27802.  Appendix C  Country and Code-Page
  27803.  
  27804.         C.1     Introduction
  27805.         C.2     Supported Countries
  27806.         C.3     Code Pages
  27807.  
  27808.  C.1  Introduction
  27809.  
  27810.    MS OS/2 supports multiple countries and languages, allowing for
  27811.    customization. This appendix lists the countries and languages supported
  27812.    by MS OS/2 and gives the related country and keyboard codes. The five
  27813.    supported code pages are also given.
  27814.  
  27815.  
  27816.  C.2  Supported Countries
  27817.  
  27818.    MS OS/2 supports these countries:
  27819.  
  27820. ╓┌─┌────────────────────────┌───────────────────┌───────────────────┌────────╖
  27821.    Country                  Country code        Keyboard code
  27822.    ──────────────────────────────────────────────────────────────────────────
  27823.    United States            001                 US
  27824.  
  27825.    Canada (French)          002                 CF
  27826.  
  27827.    Country                  Country code        Keyboard code
  27828.    ──────────────────────────────────────────────────────────────────────────
  27829. 
  27830.    Latin America            003                 LA
  27831.  
  27832.    Netherlands              031                 NL
  27833.  
  27834.    Belgium                  032                 BE
  27835.  
  27836.    France                   033                 FR
  27837.  
  27838.    Spain                    034                 SP
  27839.  
  27840.    Italy                    039                 IT
  27841.  
  27842.    Switzerland (French)     041                 SF
  27843.  
  27844.    Switzerland (German)     041                 SG
  27845.  
  27846.    United Kingdom           044                 UK
  27847.  
  27848.    Country                  Country code        Keyboard code
  27849.    ──────────────────────────────────────────────────────────────────────────
  27850. 
  27851.    Denmark                  045                 DK
  27852.  
  27853.    Sweden                   046                 SV
  27854.  
  27855.    Norway                   047                 NO
  27856.  
  27857.    Germany                  049                 GR
  27858.  
  27859.    Australia                061                 ──
  27860.  
  27861.    Portugal