[comp.windows.ms] Setting priority and giving up timeslice in DOS programs under WIN /3

dmwatt@athena.mit.edu (Dave Watt) (10/20/90)

Two things:
1)  I've been making some small changes to Drew Derbyshire's free UUPC/extended
package to improve how it runs under Windows.  I added code to tell one program
to give up its timeslice when it's running under Windows in enhanced mode, and
it's just waiting to dial the phone.  But I discovered that having this UUPOLL
program running in background <really> slows down other DOS-programs I want to
run under Windows, especially programs with lots of high-resolution graphics.
It would be better if I could set UUPOLL to run at a low priority while it's
waiting for an hour, and then when the hour is up, giving it a high priority
so UUCP can run quickly, in addition to any giving-up-timeslice games.  Does
anyone know how to do this in a DOS program?

2)  For the curious, the information below explains how to identify whether
a DOS program is running under Windows in enhanced mode, give up your time-
slice, and set and end critical sections.  I got it from PD1:<MSDOS.INFO>
INTER590.ZIP on simtel20 or wuarchive.  The list is authoritative, complete,
and useful to anyone who does any DOS programming at all.


Thanks in advance!

- Dave Watt


INT 2F - Multiplex - MS WINDOWS - ENHANCED WINDOWS INSTALLATION CHECK
        AX = 1600h
Return: AL = 00h if Enhanced Windows 3.x or Windows/386 2.x not running
        AL = 80h if Enhanced Windows 3.x or Windows/386 2.x not running
        AL = 01h if Windows/386 2.x running
        AL = FFh if Windows/386 2.x running
        AL = anything else
            AL = Windows major version number >= 3
            AH = Windows minor version number
Note:   INT 2F/AH=16h comprises an API for non-Windows programs (DOS device
          drivers, TSRs, and applications) to cooperate with multitasking
          Windows/386 2.x and Windows 3.x and higher enhanced mode.
        certain calls are also supported in the Microsoft 80286 DOS extender in
          Windows standard mode
SeeAlso: AX=4680h
---------------------------------------------
INT 2F - Multiplex - MS Windows 3 - INSTALLATION CHECK
        AX = 4680h
Return: AX = 0000h MS Windows 3.0 running in real (/R) or standard (/S) mode
           nonzero  no Windows, Windows prior to 3.0, or Windows3 in enhanced
                    mode
Note:   not officially documented, but Microsoft has indicated that they
          intend to provide an installation check which works in all modes
SeeAlso: AX=1600h
---------------------------------------------
INT 2Fh - Multiplex - MS WINDOWS - RELEASE CURRENT VIRTUAL MACHINE TIME-SLICE
        AX = 1680h
Return: AL = 00h if the call is supported
        AL = 80h (unchanged) if the call is not supported
Notes:  programs can use this function, even when not running under Windows in
          386 enhanced mode, because OS/2 can use the call to detect idleness
          even though it does not support the complete enhanced Windows API.
        this call will be supported in OS/2 2.0 for multitasking DOS
          applications
        does not block the program; it just gives up the remainder of the time
          slice
---------------------------------------------
INT 2Fh - Multiplex - MS WINDOWS 3+ - BEGIN CRITICAL SECTION
        AX = 1681h
Notes:  used to prevent a task switch from occurring
        should be followed by an INT 2F/AX=1682h call as soon as possible
        not supported in Windows/386 2.x. Get INDOS flag with INT 21/AH=34h and
          and increment by hand.
SeeAlso: AX=1682h, INT 21/AH=34h
---------------------------------------------
INT 2Fh - Multiplex - MS WINDOWS 3+ - END CRITICAL SECTION
        AX = 1682h
Note:   not supported in Windows/386 2.x.  Get INDOS flag with INT 21/AH=34h
          and decrement by hand.