Jump to content

DosDevConfig (OS/2 1.x): Difference between revisions

From EDM2
Ak120 (talk | contribs)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[image:legacy.png]]
This is the legacy function, please visit [[OS2 API:CPI:DosDevConfig|DosDevConfig]] for the current version.
==Description==
This call gets information about attached devices.
This call gets information about attached devices.


==Syntax==
==Syntax==
<PRE>
  DosDevConfig (DeviceInfo, Item, Parm)
  DosDevConfig


    (DeviceInfo, Item, Parm)
</PRE>
==Parameters==
==Parameters==
; DeviceInfo (PVOID) - output : Address of the byte-wide field containing the requested information.  
;DeviceInfo (PVOID) - output: Address of the byte-wide field containing the requested information.
 
;Item (USHORT) - input: Device information requested.
; Item (USHORT) - input : Device information requested.
:0 - Number of printers attached
 
:1 - Number of RS232 ports
'''Value        Definition'''
:2 - Number of diskette drives
0       Number of printers attached
:3 - Presence of math coprocessor (where 0 = not present, 1 = present)
1       Number of RS232 ports
:4 - PC Submodel Type (where the return is the system submodel byte)
2       Number of diskette drives
:5 - PC Model Type (where the return is the system model byte)
3       Presence of math coprocessor (where 0 = not present, 1 = present)
:6 - Display adapter type (where 0 = monochrome mode compatible, 1 = other).
4       PC Submodel Type ( where the return is the system submodel byte)
;Parm (USHORT) - input: Reserved for future use and should be set to zero.
5       PC Model Type ( where the return is the system model byte)
6       Display adapter type (where 0 = monochrome mode compatible, 1 = other).  
 
; Parm (USHORT) - input : Reserved for future use and should be set to zero.


==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code descriptions are:
 
* 0 NO_ERROR
Return code descriptions are:
*87 ERROR_INVALID_PARAMETER


* 0        NO_ERROR
* 87        ERROR_INVALID_PARAMETER
==Remarks==
==Remarks==
The system model (function 5) and submodel (function 4) information is obtained from BIOS.
The system model (function 5) and submodel (function 4) information is obtained from BIOS.


In addition, the number of devices attached in a PS/2 environment reflect only devices that are "awake". Devices that are "asleep" are not counted.  
In addition, the number of devices attached in a PS/2 environment reflect only devices that are "awake". Devices that are "asleep" are not counted.


==Example Code==
==Bindings==
===C Binding===
===C===
<PRE>
<PRE>
#define INCL_DOSDEVICES
#define INCL_DOSDEVICES
Line 46: Line 33:
USHORT  rc = DosDevConfig(DeviceInfo, Item, Parm);
USHORT  rc = DosDevConfig(DeviceInfo, Item, Parm);


PVOID           DeviceInfo;    /* Returned information */
PVOID   DeviceInfo;    /* Returned information */
USHORT           Item;          /* Item number */
USHORT Item;          /* Item number */
USHORT           Parm;          /* Reserved */
USHORT Parm;          /* Reserved */
 
USHORT  rc;            /* return */
</PRE>
 
===MASM===
<PRE>
EXTRN  DosDevConfig:FAR
INCL_DOSDEVICES    EQU 1
 
PUSH@  OTHER  DeviceInfo  ;Requested information (returned)
PUSH  WORD    Item        ;Item number
PUSH  WORD    Parm        ;Reserved (must be zero)
CALL  DosDevConfig


USHORT          rc;            /* return */
Returns WORD
</PRE>
</PRE>


==Example Code==
This example gets information about model type, monitor and coprocessor and display it.  
This example gets information about model type, monitor and coprocessor and display it.  
<PRE>
<PRE>
Line 65: Line 66:
USHORT rc;
USHORT rc;


   if(!DosDevConfig(&DeviceInfo,           /* Returned information */
   if(!DosDevConfig(&DeviceInfo,         /* Returned information */
                     MACHINE_MODEL,         /* Item number */
                     MACHINE_MODEL,       /* Item number */
                     RESERVED))             /* Reserved */
                     RESERVED))           /* Reserved */
       printf("Model Type %d ",DeviceInfo);
       printf("Model Type %d ",DeviceInfo);


   if(!DosDevConfig(&DeviceInfo,           /* Returned information */
   if(!DosDevConfig(&DeviceInfo,         /* Returned information */
                     DISPLAY_TYPE,           /* Item number */
                     DISPLAY_TYPE,         /* Item number */
                     RESERVED))             /* Reserved */
                     RESERVED))           /* Reserved */
       if (DeviceInfo)
       if (DeviceInfo)
         printf("Color display ");
         printf("Colour display ");
       else
       else
         printf("Mono display ");
         printf("Mono display ");


   if(!DosDevConfig(&DeviceInfo,           /* Returned information */
   if(!DosDevConfig(&DeviceInfo,         /* Returned information */
                     FIND_COPROCESSOR,       /* Item number */
                     FIND_COPROCESSOR,     /* Item number */
                     RESERVED))             /* Reserved */
                     RESERVED))           /* Reserved */
       if (DeviceInfo)
       if (DeviceInfo)
         printf("Coprocessor");
         printf("Coprocessor");
Line 87: Line 88:
</PRE>
</PRE>


===MASM Binding===
[[Category:Dos16]]
<PRE>
EXTRN  DosDevConfig:FAR
INCL_DOSDEVICES    EQU 1
 
PUSH@  OTHER  DeviceInfo    ;Requested information (returned)
PUSH  WORD    Item          ;Item number
PUSH  WORD    Parm          ;Reserved (must be zero)
CALL  DosDevConfig
 
Returns WORD
</PRE>
==Related Functions==
*
 
 
[[Category:The OS/2 API Project]]

Latest revision as of 03:04, 26 January 2020

This call gets information about attached devices.

Syntax

DosDevConfig (DeviceInfo, Item, Parm)

Parameters

DeviceInfo (PVOID) - output
Address of the byte-wide field containing the requested information.
Item (USHORT) - input
Device information requested.
0 - Number of printers attached
1 - Number of RS232 ports
2 - Number of diskette drives
3 - Presence of math coprocessor (where 0 = not present, 1 = present)
4 - PC Submodel Type (where the return is the system submodel byte)
5 - PC Model Type (where the return is the system model byte)
6 - Display adapter type (where 0 = monochrome mode compatible, 1 = other).
Parm (USHORT) - input
Reserved for future use and should be set to zero.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 87 ERROR_INVALID_PARAMETER

Remarks

The system model (function 5) and submodel (function 4) information is obtained from BIOS.

In addition, the number of devices attached in a PS/2 environment reflect only devices that are "awake". Devices that are "asleep" are not counted.

Bindings

C

#define INCL_DOSDEVICES

USHORT  rc = DosDevConfig(DeviceInfo, Item, Parm);

PVOID   DeviceInfo;    /* Returned information */
USHORT  Item;          /* Item number */
USHORT  Parm;          /* Reserved */

USHORT  rc;            /* return */

MASM

EXTRN  DosDevConfig:FAR
INCL_DOSDEVICES     EQU 1

PUSH@  OTHER   DeviceInfo  ;Requested information (returned)
PUSH   WORD    Item        ;Item number
PUSH   WORD    Parm        ;Reserved (must be zero)
CALL   DosDevConfig

Returns WORD

Example Code

This example gets information about model type, monitor and coprocessor and display it.

#define INCL_DOSDEVICES

#define MACHINE_MODEL 5
#define DISPLAY_TYPE 6
#define FIND_COPROCESSOR 3
#define RESERVED 0L

BYTE   DeviceInfo;
USHORT rc;

   if(!DosDevConfig(&DeviceInfo,          /* Returned information */
                    MACHINE_MODEL,        /* Item number */
                    RESERVED))            /* Reserved */
      printf("Model Type %d ",DeviceInfo);

   if(!DosDevConfig(&DeviceInfo,          /* Returned information */
                    DISPLAY_TYPE,         /* Item number */
                    RESERVED))            /* Reserved */
      if (DeviceInfo)
         printf("Colour display ");
      else
         printf("Mono display ");

   if(!DosDevConfig(&DeviceInfo,          /* Returned information */
                    FIND_COPROCESSOR,     /* Item number */
                    RESERVED))            /* Reserved */
      if (DeviceInfo)
         printf("Coprocessor");
      else
         printf("No Coprocessor");