dos12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
DosGetMachineMode (1.2)
Function Group                                      Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_DOSMISC
 
USHORT DosGetMachineMode(pbMachineMode)
PBYTE pbMachineMode;    /* pointer to variable for machine mode */
 
The DosGetMachineMode function retrieves the current machine mode──that is,
whether the current mode is real or protected.
 
The DosGetMachineMode function is a family API function.
 
Parameter      Description
────────────────────────────────────────────────────────────────────────────
 
pbMachineMode  Points to the variable that receives the machine mode. If
               this parameter is MODE_REAL, the current mode is real mode,
               808x or 80x86. If this parameter is MODE_PROTECTED, the
               current mode is protected mode, 80x86.
 
Return Value
 
The return value is zero if the function is successful. Otherwise, it is an
error value.
 
The DosGetMachineMode function allows a program that is running in real mode
to avoid calling functions that are not available when it is in real mode.
 
Example
 
This example calls the DosGetMachineMode function and displays the machine
mode under which the current process is running:
 
BYTE bMode;
DosGetMachineMode(&bMode);
if (bMode == MODE_PROTECTED)
    VioWrtTTY("Protected mode\r\n", 16, 0);
else
    VioWrtTTY("Real mode\r\n", 11, 0);
 
                                      ♦