Introduction to Virtual Device Drivers



Download 274.5 Kb.
Page62/80
Date19.01.2022
Size274.5 Kb.
#58083
1   ...   58   59   60   61   62   63   64   65   ...   80
VXDS

Functions


The following is an alphabetical listing of the Interrupt 2Fh functions.

Interrupt 2Fh Function 1600h

mov ax, 1600h ; Get Windows Installed State

int 2Fh ; multiplex interrupt
test al, 7Fh

jz No_EM_Win ; Windows not running

Get Installed State (Interrupt 2Fh Function 1600h) determines whether Windows is running. If a program intends to use a Windows function, it must first use this function to make sure that Windows is running.

This function has no parameters.

 The return value is 00h or 80h in the AL register if Windows is not running. If Windows is running, the return value is the major version number in the AL register, and the minor version number in the AH register.

Interrupt 2Fh Function 1602h

mov ax, 1602h ; Get Windows Entry Point

int 2Fh ; multiplex interrupt
mov word ptr [WinAddr], di

mov word ptr [WinAddr+2], es ; es:di contains entry-point address


Get Windows Entry Point (Interrupt 2Fh Function 1602h) returns the address of the Windows entry-point procedure. Applications can call this procedure to direct Windows/386 version 2.x to carry out specific actions.

This function is obsolete. Do not use.

This function has no parameters.

 The return value contains the Windows entry-point address in the ES:DI registers.

See also Interrupt 2Fh Function 1683h Get Current Virtual Machine ID

Interrupt 2Fh Function 1605h

xor bx, bx

mov es, bx ; es:bx contains 0000h:0000h
mov cx, 0000h

mov dx, [Flags] ; bit 0 clear if Windows 95


mov di, [Ver_Num] ; major/minor version numbers

; (in high/low bytes)


xor si, si

mov ds, si ; ds:si contains 0000h:0000h


mov ax, 1605h ; Windows Initialization Notification

int 2fh ; multiplex interrupt


cmp cx, 0

jne no_initialize ; if nonzero, don't continue initialization

Windows Initialization Notification (Interrupt 2Fh Function 1605h) notifies MS-DOS device drivers and TSRs that Windows is starting. Windows calls this function as it starts allowing MS-DOS device drivers and TSRs that monitor Interrupt 2Fh the opportunity to prepare for running in the Windows environment.

Flags

Specifies whether Windows 95 is initializing. Bit 0 set to 0 for Windows 95; bit 0 set to 1 for other, previous versions of Windows. Only bit 0 is used; all other bits reserved and undefined.



Ver_Num

Specifies the version number of Windows. The major version number is in the high-order byte, the minor version number in low-order byte.

 The return value is 0 in the CX register if all MS-DOS device drivers and TSRs monitoring Interrupt 2Fh can run in the Windows environment, and Windows can proceed with initialization. Otherwise, the CX register is nonzero and Windows must terminate.

Any MS-DOS device driver or TSR that either cannot run in the Windows environment, or must adapt its operation when in the Windows environment should add itself to the Interrupt 2Fh chain and watch for this function.

If the device driver or TSR cannot run in the Windows environment, it should set the CX register to a nonzero value, display a message informing the user of its incompatibility with Windows, and return. Windows does not print a message of its own. Instead, it calls Windows Termination Notification (Interrupt 2Fh Function 1606h) and returns to MS-DOS.

If the device driver or TSR can run in the Windows environment, it should do the following:



  1. Call the next device driver or TSR in the Interrupt 2Fh chain to allow all device drivers and TSRs in the chain an opportunity to respond to this function.

  2. Upon return from the interrupt chain, carry out the following actions:

  • Free any extended memory. The device driver or TSR takes this action only if it has previously allocated extended memory using the Extended Memory Specification (XMS) interface.

  • Switch the processor to real mode, or set the DS:SI register pair to the address of an Enable/Disable Virtual 8086 Mode callback function. The device driver or TSR takes this action only if it has previously switched the processor to virtual 8086 mode. If standard-mode Windows is starting, the device driver or TSR must switch the processor to real mode - the callback function is permitted for Windows only.

  • Initialize a Win386_Startup_Info_Struc structure, and copy the address of the structure to the ES:BX register pair. The device driver or TSR carries out this action only if Windows is starting.



  1. Return (using the iret instruction) but without changing the CX register.

For more information about these procedures, see the following "Comments" section.

The device driver or TSR must preserve all registers and restore the original values before returning. The only exceptions to this rule are changes made to the BX, CX, DS, ES, and SI registers as a result of following the previous procedure.




Download 274.5 Kb.

Share with your friends:
1   ...   58   59   60   61   62   63   64   65   ...   80




The database is protected by copyright ©ininet.org 2024
send message

    Main page