DosDevConfig
Syntax
Gets information about attached devices.
#define INCL_DOSPROCESS #include <os2.h> PVOID pdevinfo; /* Address of the area where the information is returned. */ ULONG item; /* Device information to be returned. */ APIRET ulrc; /* Return Code. */ ulrc = DosDevConfig(pdevinfo, item);
Parameters
pdevinfo (PVOID) - output
Address of the area where the information is returned.
All returned device information is BYTE-sized, so this should be the address of a BYTE variable.
item (ULONG) - input
Device information to be returned.
This parameter has one of the possible values:
- DEVINFO_PRINTER Number of parallel or printer ports.
- DEVINFO_RS232
Number of RS232 ports.
- DEVINFO_FLOPPY
Number of diskette drives.
- DEVINFO_COPROCESSOR
Presence of math coprocessor hardware:
- No coprocessor hardware
- Coprocessor hardware installed
- DEVINFO_SUBMODEL
PC Submodel Type. The returned information is the system submodel byte. 5
- DEVINFO_MODEL
PC Model Type. The returned information is the system model byte. 6
- DEVINFO_ADAPTER
Type of primary display adapter:
- Monochrome or printer adapter
- Other
ulrc (APIRET) - returns
Return Code.
DosDevConfig returns one of the following values:
- NO_ERROR 87 - ERROR_INVALID_PARAMETER
For a full list of error codes, see Errors.
Return
ulrc (APIRET) - returns
Return Code.
DosDevConfig returns one of the following values:
NO_ERROR 87
ERROR_INVALID_PARAMETER
For a full list of error codes, see Errors.
Example Code
This example gets information about the installed devices and displays it. Some return code checking was omitted for brevity.
#define INCL_DOSDEVICES /* Device values */ #define INCL_DOSERRORS /* Error values */ #include <os2.h> #include <stdio.h> int main(VOID) { BYTE Model = 0, /* Model number */ SubModel = 0, /* Submodel */ Adapter = 0, /* Display adapter type */ CoProc = 0, /* Math coprocessor installed? */ Printers = 0; /* Number of printers */ APIRET rc = NO_ERROR; /* Return code */ rc = DosDevConfig(&Model, DEVINFO_MODEL); if (rc != NO_ERROR) { printf("DosDevConfig error: return code = %u\n", rc); return 1; } rc = DosDevConfig(&SubModel, DEVINFO_SUBMODEL); printf(" Model/SubModel: %d / %d\n", Model, SubModel); rc = DosDevConfig(&Adapter, DEVINFO_ADAPTER); printf(" Display type: %s\n", (Adapter ? "Color" : "Monochrome")); rc = DosDevConfig(&CoProc, DEVINFO_COPROCESSOR); printf(" Math co-processor? %s\n", (CoProc ? "Yes" : "No")); rc = DosDevConfig(&Printers, DEVINFO_PRINTER); printf("Number of printers: %d\n", Printers); return NO_ERROR; }