Jump to content

DevHelp GetDOSVar

From EDM2
Revision as of 18:07, 24 November 2017 by Martini (talk | contribs) (Martini moved page DevHlp GetDosVar to DevHlp GetDOSVar)

DevHlp_GetDosVar returns the address of a kernel variable.

Syntax

C

DevHelp_GetDOSVar ( USHORT VarNumber, USHORT VarMember, PPVOID KernelVar )

Assembler

Calling Sequence in Assembler

    MOV   AL, index                ; Index wanted.
    MOV   CX, VarMember            ; Only used by index 14 and 16.
    MOV   DL, DevHlp GetDOSVar

    CALL   Device Help 

Parameters

C

VarNumber (USHORT)
The index into the list of read only variables
    DHGETDOSV_SYSINFOSEG                                       1
    DHGETDOSV_LOCINFOSEG                                       2
    DHGETDOSV_VECTORSDF                                        4
    DHGETDOSV_VECTORREBOOT                                     5
    DHGETDOSV_VECTORMSATS                                      6
    DHGETDOSV_YIELDFLAG                                        7
    DHGETDOSV_TCYIELDFLAG                                      8
    DHGETDOSV_DOSCODEPAGE                                      11
    DHGETDOSV_INTERRUPTLEV                                     13
    DHGETDOSV_DEVICECLASSTABLE                                 14
    DHGETDOSV_DMQSSELECTOR                                     15
    DHGETDOSV_APMINFO                                          16
    DHGETDOSV_APM11INFO                                        17
    DHGETDOSV_CPUMODE                                          18
    DHGETDOSV_CPUMODE                                          19
    DHGETDOSV_TOTALCPUS                                        20
VarMember (USHORT)
Applicable only to VarNumber 14 or 16.

For VarNumber = 14

    VarMember=1                     (Disk) has a maximum of 32
                                    entries in the DCT.
    VarMember=2                     Mouse) has a maximum of 3
                                    entries in the DCT.

For VarNumber = 16


    VarMember=0                     Query presence of APM BIOS.
    VarMember=1                     Query presence of APM BIOS and
                                    establish connection.
KernelVar (PPVOID)
Pointer to the address of requested variable to be returned.


Assembler


Return Code

C

Success Indicator
Clear if successful; returns address of the requested variable in KernelVar.
Possible errors
None.

Assembler

  • C Clear if successful. AX BX points to the index.
  • C Set if error.

Remarks

The following table contains the list of read-only variables

Index      Variable Description
 1        GlobalInfoSeg WORD.  Valid at task time and interrupt
          time, but not at INIT time.  See below.
 2        LocalInfoSeg DWORD.  Selector/segment address of local
          information segment for the current Local Descriptor
          Table (LDT).  Valid only at task time.  See below.
 3        Reserved.
 4        VectorSDF DWORD.  Pointer to the stand-alone dump
          facility. Valid at task time and interrupt time.
 5        VectorReboot DWORD.  Pointer to restart the operating
          system. Valid at task time and interrupt time.
 6        Reserved.
 7        YieldFlag BYTE.  Indicator for performing yields.
          Valid only at task time.
 8        TCYieldFlag BYTE.  Indicator for performing
          time-critical yields. Valid only at task time.
 9        Reserved.
10        Reserved.
11        DOS session Code Page Tag pointer  DWORD.
          Segment offset of the DOS session s current code page
          tag.  Valid only at task time.
12        Reserved.
13        Interrupt Level
14        DeviceClass Table (See DH_RegisterDeviceClass)
15        DMQS Selector   Point to XGA adapter.  DMQS
          information offset is assumed to start at zero.
16        APMInfo APMStruc. Advanced Power Management BIOS
          Information
17        APMInfo  APMStruc version 1.1. Advanced Power
          Management BIOS Information
18        SMP_Active  DWORD Information on the operating system
          (OS) support for more than 1 CPU. Returns 1 if the OS
          has SMP support and 0 if the OS has uniprocessor
          support.
19        PSDInfo.psd_flags  DWORD PSD status area where several
          pieces of useful information about the PSD can be
          obtained. After obtaining the variable address, the
          caller must test the bit for the desired aspect of the
          PSD. The PSD flags definition is as follows 
          PSD_INITIALIZED (0x80000000) PSD has been initialized
          PSD_INSTALLED (0x40000000) PSD has been installed
          PSD_ADV_INT_MODE (0x20000000) PSD is in advaanced
          interrupt mode PSD_KERNEL_PIC (0x10000000) Let the
          kernel interrupt manager EOI
20        cProcessors  DWORD Information for the Multi-Processor
          environment. Indicates the number of processors
          currently running in the MP environment. A value of 1
          is returned in Uni-Processor environment.

GlobalInfoSeg (PSEL) : Address of the global information segment structure, as defined below

Time (ULONG)
Time in seconds since 1/1/1970.
Millisecs (ULONG)
Time in milliseconds.
Hours (UCHAR)
Current hour.
Minute (UCHAR)
Current minute.
Seconds (UCHAR)
Current second.
HundredSec (UCHAR)
Current hundreth of a second.
TimeZone (USHORT)
Minutes from UTC. If FFFFH, TimeZone is undefined.
Interval (USHORT)
Timer interval in tenths of milliseconds.
Day (UCHAR)
Day.
Month (UCHAR)
Month.
Year (USHORT)
Year.
Weekday (UCHAR)
Day of the week
       Sunday
       Monday
       Tuesday
       Wednesday
       Thursday
       Friday
       Saturday 
   
MajorVersion (UCHAR)
Major version number.
MinorVersion (UCHAR)
Minor version number.
Revision (UCHAR)
Revision letter.
CurrentSession (UCHAR)
Current foreground full-screen session.
MaxNumSessions (UCHAR)
Maximum number of full-screen sessions.
HugeShift (UCHAR)
Shift count for huge segments.
ProtModeInd (UCHAR)
Protect-mode-only indicator
       DOS and OS/2 sessions.
       OS/2 session only. 
LastProcess (USHORT)
Process ID of the current foreground process.
DynVarFlag (UCHAR)
Dynamic variation flag
       Absolute.
       Enabled. 
   
MaxWait (UCHAR)
Maximum wait in seconds.
MinTimeSlice (USHORT)
Minimum time slice in milliseconds.
MaxTimeSlice (USHORT)
Maximum time slice in milliseconds.
BootDrive (USHORT)
Drive from which the system startup occurred
       Drive A
       Drive B
       n
           Drive n.
TraceFlags (UCHAR)
Thirty-two system trace major code flags. Each bit corresponds to a trace major code 00H-FFH. The most significant bit (left-most) of the first byte corresponds to major code 00H. Values are
  • Trace disabled.
  • Trace enabled.
MaxTextSessions (UCHAR)
Maximum number of VIO windowable sessions.
MaxPMSessions (UCHAR)
Maximum number of Presentation Manager sessions.

LocalInfoSeg (PSEL)

Address of the selector for the local information segment structure, as defined below

ProcessID (PID)
Current Process ID.
ParentProcessID (PID)
Parent Process ID.
ThreadPrty (USHORT)
Priority of current thread.
ThreadID (TID)
Current Thread ID.
SessionID (USHORT)
Current Session ID.
ProcStatus (UCHAR)
Process status.
Unused (UCHAR)
Unused.
ForegroundProcess (BOOL)
Current process is in foreground (has keyboard focus)
               Implies YES
               Implies NO. 
TypeProcess (UCHAR)
Type of process
               Full screen protect-mode session.
               Requires real mode.
               VIO windowable protect-mode session.
               Presentation Manager protect-mode session.
               Detached protect-mode process. 
           
Unused (UCHAR)
Unused.
EnvironmentSel (SEL)
Environment selector.
CmdLineOff (USHORT)
Command line offset in the segment addressed by EnvironmentSel.
DataSegLen (USHORT)
Length of the data segment in bytes.
StackSize (USHORT)
Stack size in bytes.
HeapSize (USHORT)
Heap size in bytes.
HModule (UHMODULE)
Module handle.
DSSel (SEL)
Data segment selector.

APMInfo

Advanced Power Management BIOS Information, as defined below

APM CodeSeg (WORD)
APM 16-bit code segment (real-mode segment base address). From APM BIOS, INT 15h AX=5302H.
APMDataSeg (WORD)
APM16 - bitdatasegment( real - modesegmentbaseaddress ) .FromAPMBIOS ,INT15hAX = 5302H .
APM Offset (WORD)
Offset to entry point. From APM BIOS, INT 15h AX=5302H.
APM Flags (WORD)
APM capability flags. From APM BIOS, INT 15h AX=5300H.
APM Level (WORD)
APM revision level. From APM BIOS, INT 15h AX=5300H.
APM CPUIdle (6 bytes (DF))
APM Services Entry Point for CPU Idle and Busy Functions.

Note: APM CodeSeg and APM DataSeg are segment addresses, not selectors. It is the responsibility of the device driver to convert the segment address to a valid protect-mode selector.

The first time GetDOSVar is called at device-driver initialization with index (AL) = 10H and CX = 1, the system sets the values for APM CodeSeg, APM DataSeg, APM Offset, APM Flags, and APM Level. On return, AX BX points to the APMInfo structure.

If GetDOSVar is called at device-driver initialization with index (AL) = 10h and CX = 0, the system sets the values for APM Flags and APM Level. On return, AX BX points to the APMInfo structure. Other fields in the APMInfo structure might have been set by a previous call to GetDOSVar with index = 10h and CX = 1.

If GetDOSVar is called after device-driver initialization with index (AL) = 10H, no information in the APMInfo structure is modified. On return, AX BX points to the APMInfo structure.

APM CPUIdle contains the address of the CPU Idle and Busy processing routines from the Power Management Services device driver. This variable is initially empty (NULL) until Power Management Services loads and places the addresses for the CPU Idle and Busy routines into the variable area. The variable address must be the 16 16 Selector Offset. The Offset is 0-extended to 32 bits, and the value must be represented in 16 32 format. The APM CPUIdle function utilizes the AX register as the control selection flag for BUSY (AX=00001H) and IDLE (AX=0000H) requests.

These variables are maintained by the kernel for the benefit of physical device drivers. Notice that the address returned is the address of the indicated variable; the variable can contain a vector to some facility, or it can contain a structure.

Example Code

C


Assembler


Related Functions