From ae62786c6ec4a9f3feb3d3701e5a63141cfa97cc Mon Sep 17 00:00:00 2001 From: 0x9dec1980 <0x9dec1980@gmail.com> Date: Thu, 29 Sep 2016 09:46:23 +0200 Subject: [PATCH] Microsoft Windows 3.1 DDK samples --- .../SAMPLES/CONTENTS.TXT | 243 +++++++ .../SAMPLES/EATPAGES/EATPAGES | 25 + .../SAMPLES/EATPAGES/EATPAGES.ASM | 223 +++++++ .../SAMPLES/EATPAGES/EATPAGES.DEF | 18 + .../SAMPLES/EATPAGES/EATPAGES.LNK | 6 + .../SAMPLES/EATPAGES/README.TXT | 7 + .../SAMPLES/EATPAGES/VXDSTUB.ASM | 250 +++++++ .../SAMPLES/GENERIC/GENERIC | 26 + .../SAMPLES/GENERIC/GENERIC.ASM | 265 ++++++++ .../SAMPLES/GENERIC/GENERIC.DEF | 18 + .../SAMPLES/GENERIC/GENERIC.LNK | 6 + .../SAMPLES/GENERIC/README.TXT | 8 + .../SAMPLES/GENERIC/VXDSTUB.ASM | 250 +++++++ .../SAMPLES/GPTRAP/GPTRAP | 27 + .../SAMPLES/GPTRAP/GPTRAP.ASM | 138 ++++ .../SAMPLES/GPTRAP/GPTRAP.DEF | 19 + .../SAMPLES/GPTRAP/GPTRAP.LNK | 6 + .../SAMPLES/GPTRAP/README.TXT | 6 + .../SAMPLES/GPTRAP/VXDSTUB.ASM | 250 +++++++ .../SAMPLES/VDIALOG/DOSACC.ASM | 113 ++++ .../SAMPLES/VDIALOG/README.TXT | 21 + .../SAMPLES/VDIALOG/VDEVICE.INC | 26 + .../SAMPLES/VDIALOG/VDIALOG | 23 + .../SAMPLES/VDIALOG/VDIALOG.ASM | 251 +++++++ .../SAMPLES/VDIALOG/VDIALOG.DEF | 16 + .../SAMPLES/VDIALOG/VDIALOG.LNK | 5 + .../SAMPLES/VDIALOG/WINACC.C | 346 ++++++++++ .../SAMPLES/VDIALOG/WINACC.DEF | 28 + .../SAMPLES/VDIALOG/WINACC.H | 13 + .../SAMPLES/VDIALOG/WINACC.RC | 23 + .../SAMPLES/VDIALOG/XXXACC | 43 ++ .../SAMPLES/VFINTD/README.TXT | 133 ++++ .../SAMPLES/VFINTD/TSTFINT.ASM | 125 ++++ .../SAMPLES/VFINTD/VFINTD | 32 + .../SAMPLES/VFINTD/VFINTD.ASM | 285 ++++++++ .../SAMPLES/VFINTD/VFINTD.DEF | 17 + .../SAMPLES/VFINTD/VFINTD.INC | 27 + .../SAMPLES/VFINTD/VFINTD.LNK | 6 + .../SAMPLES/VHOOK86D/README.TXT | 11 + .../SAMPLES/VHOOK86D/VHOOK86D | 23 + .../SAMPLES/VHOOK86D/VHOOK86D.ASM | 113 ++++ .../SAMPLES/VHOOK86D/VHOOK86D.DEF | 15 + .../SAMPLES/VHOOK86D/VHOOK86D.LNK | 5 + .../SAMPLES/VIDLED/README.TXT | 10 + .../SAMPLES/VIDLED/VIDLED | 25 + .../SAMPLES/VIDLED/VIDLED.ASM | 133 ++++ .../SAMPLES/VIDLED/VIDLED.DEF | 17 + .../SAMPLES/VIDLED/VIDLED.INC | 6 + .../SAMPLES/VIDLED/VIDLED.LNK | 6 + .../SAMPLES/VITD/DOSIT.ASM | 249 +++++++ .../SAMPLES/VITD/DOSIT.INC | 36 + .../SAMPLES/VITD/GETCOUNT.ASM | 167 +++++ .../SAMPLES/VITD/ITIMER.INC | 115 ++++ .../SAMPLES/VITD/README.TXT | 10 + .../SAMPLES/VITD/SAMPLE.ASM | 59 ++ .../SAMPLES/VITD/VITD | 23 + .../SAMPLES/VITD/VITD.ASM | 622 ++++++++++++++++++ .../SAMPLES/VITD/VITD.DEF | 18 + .../SAMPLES/VITD/VITD.LNK | 5 + .../SAMPLES/VKXD/README.TXT | 19 + .../SAMPLES/VKXD/VKXD | 25 + .../SAMPLES/VKXD/VKXD.ASM | 185 ++++++ .../SAMPLES/VKXD/VKXD.DEF | 19 + .../SAMPLES/VKXD/VKXD.LNK | 6 + .../SAMPLES/VMIOD/README.TXT | 20 + .../SAMPLES/VMIOD/VMIOD | 23 + .../SAMPLES/VMIOD/VMIOD.ASM | 317 +++++++++ .../SAMPLES/VMIOD/VMIOD.DEF | 17 + .../SAMPLES/VMIOD/VMIOD.INC | 27 + .../SAMPLES/VMIOD/VMIOD.LNK | 6 + .../SAMPLES/VMIRQD/README.TXT | 21 + .../SAMPLES/VMIRQD/VMIRQD | 26 + .../SAMPLES/VMIRQD/VMIRQD.ASM | 404 ++++++++++++ .../SAMPLES/VMIRQD/VMIRQD.DEF | 17 + .../SAMPLES/VMIRQD/VMIRQD.INC | 27 + .../SAMPLES/VMIRQD/VMIRQD.LNK | 6 + .../SAMPLES/VMPAGES/README.TXT | 5 + .../SAMPLES/VMPAGES/VMPAGES | 29 + .../SAMPLES/VMPAGES/VMPAGES.ASM | 111 ++++ .../SAMPLES/VMPAGES/VMPAGES.DEF | 16 + .../SAMPLES/VMPAGES/VMPAGES.INC | 6 + .../SAMPLES/VMPAGES/VMPAGES.LNK | 5 + .../SAMPLES/VMPAGES/VMPGS.ASM | 121 ++++ .../SAMPLES/VNMID/README.TXT | 7 + .../SAMPLES/VNMID/VNMID | 23 + .../SAMPLES/VNMID/VNMID.ASM | 185 ++++++ .../SAMPLES/VNMID/VNMID.DEF | 16 + .../SAMPLES/VNMID/VNMID.LNK | 6 + .../SAMPLES/VPOSTD/LIBENTRY.ASM | 76 +++ .../SAMPLES/VPOSTD/MAKEFILE | 242 +++++++ .../SAMPLES/VPOSTD/POSTAPP.C | 172 +++++ .../SAMPLES/VPOSTD/POSTAPP.DEF | 15 + .../SAMPLES/VPOSTD/POSTAPP.H | 16 + .../SAMPLES/VPOSTD/POSTAPP.ICO | Bin 0 -> 766 bytes .../SAMPLES/VPOSTD/POSTAPP.LNK | 6 + .../SAMPLES/VPOSTD/POSTAPP.RC | 22 + .../SAMPLES/VPOSTD/POSTDOS.C | 213 ++++++ .../SAMPLES/VPOSTD/POSTHOST.C | 362 ++++++++++ .../SAMPLES/VPOSTD/POSTHOST.DEF | 20 + .../SAMPLES/VPOSTD/POSTHOST.H | 26 + .../SAMPLES/VPOSTD/POSTHOST.LNK | 5 + .../SAMPLES/VPOSTD/README.TXT | 72 ++ .../SAMPLES/VPOSTD/VPOSTD.ASM | 527 +++++++++++++++ .../SAMPLES/VPOSTD/VPOSTD.DEF | 15 + .../SAMPLES/VPOSTD/VPOSTD.INC | 32 + .../SAMPLES/VPOSTD/VPOSTD.LNK | 7 + .../SAMPLES/VWATCHD/README.TXT | 15 + .../SAMPLES/VWATCHD/TEST.C | 41 ++ .../SAMPLES/VWATCHD/VWATCHD | 31 + .../SAMPLES/VWATCHD/VWATCHD.ASM | 466 +++++++++++++ .../SAMPLES/VWATCHD/VWATCHD.DEF | 16 + .../SAMPLES/VWATCHD/VWATCHD.INC | 16 + .../SAMPLES/VWATCHD/VWATCHD.LNK | 5 + .../SAMPLES/VWFD/README.TXT | 18 + .../SAMPLES/VWFD/TSTWF.ASM | 135 ++++ .../SAMPLES/VWFD/VWFD | 31 + .../SAMPLES/VWFD/VWFD.ASM | 242 +++++++ .../SAMPLES/VWFD/VWFD.DEF | 17 + .../SAMPLES/VWFD/VWFD.INC | 6 + .../SAMPLES/VWFD/VWFD.LNK | 6 + .../SAMPLES/VXDID.TXT | 103 +++ 121 files changed, 9663 insertions(+) create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/CONTENTS.TXT create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/EATPAGES create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/EATPAGES.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/EATPAGES.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/EATPAGES.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/README.TXT create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/VXDSTUB.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/GENERIC create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/GENERIC.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/GENERIC.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/GENERIC.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/README.TXT create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/VXDSTUB.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/GPTRAP create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/GPTRAP.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/GPTRAP.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/GPTRAP.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/README.TXT create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/VXDSTUB.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/DOSACC.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/README.TXT create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDEVICE.INC create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDIALOG create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDIALOG.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDIALOG.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDIALOG.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/WINACC.C create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/WINACC.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/WINACC.H create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/WINACC.RC create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/XXXACC create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/README.TXT create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/TSTFINT.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD.INC create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/README.TXT create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/VHOOK86D create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/VHOOK86D.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/VHOOK86D.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/VHOOK86D.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/README.TXT create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED.INC create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/DOSIT.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/DOSIT.INC create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/GETCOUNT.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/ITIMER.INC create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/README.TXT create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/SAMPLE.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/VITD create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/VITD.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/VITD.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/VITD.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/README.TXT create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/VKXD create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/VKXD.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/VKXD.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/VKXD.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/README.TXT create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD.INC create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/README.TXT create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD.INC create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/README.TXT create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES.INC create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPGS.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/README.TXT create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/VNMID create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/VNMID.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/VNMID.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/VNMID.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/LIBENTRY.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/MAKEFILE create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTAPP.C create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTAPP.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTAPP.H create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTAPP.ICO create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTAPP.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTAPP.RC create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTDOS.C create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTHOST.C create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTHOST.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTHOST.H create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTHOST.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/README.TXT create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/VPOSTD.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/VPOSTD.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/VPOSTD.INC create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/VPOSTD.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/README.TXT create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/TEST.C create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD.INC create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/README.TXT create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/TSTWF.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD.ASM create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD.DEF create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD.INC create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD.LNK create mode 100644 WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VXDID.TXT diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/CONTENTS.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/CONTENTS.TXT new file mode 100644 index 00000000..b2f117ae --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/CONTENTS.TXT @@ -0,0 +1,243 @@ + +* PLEASE NOTE: This is sample code that was written to illustrate possible +* usage of services that are documented in the Windows Device Development +* Kit. Microsoft does not guarantee the accuracy or reliability of this +* code. + + +Please see the README.TXT file, and source files for more detailed +information on each VxD. + +============================================================================= +EATPAGES.386 + +This VxD demonstrates the use of the Linked List services, as well +as the System Page Allocator functions. The VxD will simply allocate +half of the free physical pages at boot time, and free them at +system exit. This can be useful to simulate low memory conditions. + +Uses the following services: + VMMCall _GetDemandPageInfo + VMMCall _PageAllocate + VMMCall _PageFree + VMMCall List_Create + VMMCall List_Allocate + VMMCall List_Attach_Tail + VMMCall List_Get_First + VMMCall List_Get_Next + VMMCall List_Remove + VMMCall List_Deallocate + +============================================================================= +GENERIC.386 + +The basic structure of a VxD is illustrated by this VxD. As written, +it can be loaded although it performs no function. This VxD can be +used as a base set of source files to start a VxD project. + +============================================================================= +GPTRAP.386 + +This VxD uses the Hook_PM_Fault to catch GP faults. When this VxD receives +control because of a GP fault, it will execute an INT 1. If execution is +continued, control is passed to the next handler in the fault handler chain. + +The "VxDStub" code for this VxD is an example in itself. The stub hooks +INT 2Fh then terminates with stay resident. When Windows later loads, +this TSR responds to the INT 2Fh, AX=1605h (Windows initialization) +broadcast. The TSR returns a structure that will cause the VxD to be loaded. +Thus, no "device=" line is required in the SYSTEM.INI file. + +Uses the following services: + VMMCall Hook_PM_Fault + +============================================================================= +VDIALOG.386 + +The purpose of this sample VxD is to demonstrate the basic use of the +Install_IO_Handler and Shell_Resolve_Contention function calls. The +Install_IO_Handler call enables this VxD to trap IN and OUT's to a port +from any VM. The Shell_Resolve_Contention call is then used to display a +dialog box when another VM attempts to use a port that is already assigned +to another VM. + +This VxD also demonstrates the use of Enable_Local_Trapping and +Disable_Local_Trapping to allow the owner of the port in question to +freely do I/O to the port without overhead. + +Uses the following services: + VMMCall Install_IO_Handler + VMMCall Enable_Local_Trapping + VMMCall Disable_Local_Trapping + + VxDCall Shell_Resolve_Contention + +============================================================================= +VFINTD.386 + +This sample has been provided to demonstrate the technique of +handling the virtualization of a particular IRQ. + +Uses the following services: + VxDCall VPICD_Virtualize_IRQ + VxDCall VPICD_Set_Int_Request + VxDCall VPICD_Clear_Int_Request + VxDCall VPICD_Phys_EOI + +============================================================================= +VIDLED.386 + +This VxD demonstrates how to use the Call_When_Idle function. + +Uses the following services: + VMMCall Call_When_Idle + +============================================================================= +VITD.386 + +This VxD provides a simulation of a hardware interval timer for virtual +machines. To install it, build VITD.386, place the final VITD.386 in +the Windows SYSTEM directory, and add a "device=VITD.386" line in the +[386enh] section of the SYSTEM.INI and restart Windows. + +Please see the README.TXT file, and source files for more detailed +information. + +Uses the following services: + VMMCall _Allocate_Device_CB_Area + VMMCall Fatal_Memory_Error + VMMCall Install_Mult_IO_Handlers + VMMCall Get_VM_Exec_Time + VMMCall Cancel_Time_Out + VMMCall Call_Priority_VM_Event + VMMCall Begin_Nest_Exec + VMMCall Exec_Int + VMMCall End_Nest_Exec + + VxDCall VTD_Get_Version + VxDCall VTD_Begin_Min_Int_Period + VxDCall VTD_Get_Interrupt_Period + VxDCall VTD_End_Min_Int_Period + +============================================================================= +VKXD.386 + +This VxD makes the F9 key act as the ALT-ENTER keypress sequence. +It shows how to use the Force_Keys API of the Virtual Keyboard +Device (VKD). + +Uses the following services: + VxDCall VKD_Define_Hot_Key + VxDCall VKD_Cancel_Hot_Key_State + VxDCall VKD_Force_Keys + +============================================================================= +VMIOD.386 + +This VxD can be used to monitor the I/O traffic associated with a particular +device. Specifically, IN's and OUT's to a single I/O port will trigger +debugging output on the secondary monitor of the system. Note that you +must have a secondary monitor to use this VxD. + +Uses the following services: + VMMCall Install_IO_Handler + VMMCall Get_Profile_Hex_Int + VMMCall Clear_Mono_Screen + VMMCall Set_Mono_Cur_Pos + VMMCall Out_Mono_String + +============================================================================= +VMIRQD.386 + +This VxD can be used to monitor the activity associated with a particular +hardware interrupt (IRQ). Specifically, hardware interrupts, EOIs, IRETs, +virtual interrupts, and mask changes associated with a particular IRQ +will trigger debugging output on the secondary monitor of the system. +Note that you must have a secondary monitor to use this VxD. + +Uses the following services: + VMMCall Get_Profile_Decimal_Int + VMMCall Clear_Mono_Screen + VMMCall Set_Mono_Cur_Pos + VMMCall Out_Mono_String + + VxDCall VPICD_Virtualize_IRQ + VxDCall VPICD_Set_Int_Request + VxDCall VPICD_Clear_Int_Request + VxDCall VPICD_Phys_EOI + +============================================================================= +VMPAGES.386 + +This VxD demonstrates how to export a VxD service (in this case GetVMPgCount), +to an application. + +Uses the following services: + VMMCall _GetVMPgCount + +============================================================================= +VNMID.386 + +This VxD shows how to hook the NMI (Non-maskable interrupt). It +currently does not actually DO anything with the NMI except to +chain to the previous handler. + +Uses the following services: + VMMCall Get_NMI_Handler_Addr + VMMCall Set_NMI_Handler_Addr + VMMCall Hook_NMI_Event + +============================================================================= +VPOSTD.386 + +This collection of programs demonstrates one way a VxD can cause a message +to be posted to a Windows application. This example also shows a fairly +useful implementation of real and protected mode APIs. + +Uses the following services: + VMMCall _Allocate_Device_CB_Area + VMMCall Fatal_Memory_Error + VMMCall Get_Sys_VM_Handle + VMMCall Test_Sys_VM_Handle + VMMCall Get_Crit_Section_Status + VMMCall Call_When_VM_Ints_Enabled + VMMCall Call_Priority_VM_Event + VMMCall Begin_Nest_Exec + VMMCall Simulate_Push + VMMCall Simulate_Far_Call + VMMCall Resume_Exec + VMMCall End_Nest_Exec + +============================================================================= +VWATCHD.386 + +VwatchD is a Virtual Device that demonstrates the basic structure of +a VxD. This VxD issues a Trace_Out (ie: sends messages to the COMx: +port) at it's entry points. By watching the messages it displays, you +can study the situations which cause the various VxD entry points to +be called. + +This VxD shows all major entry points, VERY simple APIs (separate APIs +for V86 mode as well as PM mode), and a "debug_dump" section. + +Uses the following services: + VMMCall _Allocate_Device_CB_Area + VMMCall Get_System_Time + + VxDCall VwatchD_Get_Version + +============================================================================= +VWFD.386 + +This VxD, when installed on a system running Windows in enhanced mode, +allows DOS applications to determine if they are running in a window +or full-screen. TSTWF.ASM is a sample DOS program that uses the VWFD +API. + +Uses the following services: + VMMCall _Allocate_Device_CB_Area + VMMCall Fatal_Memory_Error + VMMCall Hook_Device_Service + VMMCall Get_Next_VM_Handle + VMMCall Test_Cur_VM_Handle + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/EATPAGES b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/EATPAGES new file mode 100644 index 00000000..365a3b3f --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/EATPAGES @@ -0,0 +1,25 @@ +# sample make file for building EatPages virtual device for Windows + +# comment this definition out with a "#", if building a non-debugging version +Debug=-DDEBUG + +all : eatpages.386 + +vxdstub.obj: vxdstub.asm + masm -I..\include vxdstub; + +vxdstub.exe: vxdstub.obj + link vxdstub.obj; + + +eatpages.obj : eatpages.asm ..\include\debug.inc ..\include\vmm.inc + masm5 -p -w2 -Mx $(Debug) -I..\include eatpages.asm; + +OBJS = eatpages.obj + +eatpages.386: eatpages.def $(OBJS) vxdstub.exe + link386 @eatpages.lnk + addhdr eatpages.386 + mapsym32 eatpages + copy eatpages.386 eatpages.exe + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/EATPAGES.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/EATPAGES.ASM new file mode 100644 index 00000000..f6124963 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/EATPAGES.ASM @@ -0,0 +1,223 @@ +PAGE 58,132 +;****************************************************************************** +TITLE EATPAGES - Steals Free pages +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1991 +; +; Title: EATPAGES.ASM - Steals Free pages +; +; Version: 3.00 +; +; Date: 1-Jun-1991 +; +; Author: Neil Sandlin +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; +;============================================================================== + + .386p + +;****************************************************************************** +; I N C L U D E S +;****************************************************************************** + + .XLIST + INCLUDE VMM.Inc + INCLUDE Debug.Inc + .LIST + +pageitem STRUC +pagehandle dd ? +pageitem ENDS + + +;****************************************************************************** +; V I R T U A L D E V I C E D E C L A R A T I O N +;****************************************************************************** + +Declare_Virtual_Device EATPAGES, 3, 0, EATPAGES_Control, Undefined_Device_ID ,,, + + + +;****************************************************************************** +; L O C A L D A T A +;****************************************************************************** + +VxD_IDATA_SEG + +pageinfo DemandInfoStruc <0> +numpages dd 0 + +VxD_IDATA_ENDS + + +VxD_DATA_SEG + +pagelist dd ? + +VxD_DATA_ENDS + + +;****************************************************************************** +; I N I T I A L I Z A T I O N C O D E +;****************************************************************************** + +VxD_ICODE_SEG + + +;****************************************************************************** +; +; EATPAGES_Init_Complete +; +; DESCRIPTION: +; This routine is called during system boot. The sole function +; is to find out how many free pages there are in the system, +; allocate half of them, and keep track of the allocations using +; the linked list services. +; +; +;============================================================================== + +BeginProc EATPAGES_Init_Complete + + +;---------------------------------------------------------------------------- +; Create linked list +;---------------------------------------------------------------------------- + mov eax, LF_Alloc_Error ;handle out of memory + mov ecx, SIZE PageItem ;ECX = size of each list node + VMMCall List_Create + mov [PageList], esi ;save list handle + +;---------------------------------------------------------------------------- +; Get free page information +;---------------------------------------------------------------------------- + xor eax, eax + mov esi, OFFSET32 pageinfo + VMMCall _GetDemandPageInfo, + + mov ecx, [esi.DIFree_Count] ;number of free pages + shr ecx, 1 ;divide by two + mov esi, [pagelist] ;point to linked list + +;---------------------------------------------------------------------------- +; Allocate half of all free pages +;---------------------------------------------------------------------------- +di_loop: + push ecx ;pageallocate uses ecx + VMMCall _PageAllocate,<1,PG_SYS,0,0,0,-1,0,PageLocked> + pop ecx ;restore + or eax, eax ;failed? + jz short di_next ;ok, done + mov edi, eax ;save handle + + VMMCall List_Allocate ;get new node in eax + jc short di_listerr ;woops, ran out of memory + VMMCall List_Attach_Tail ;put it at the end + + inc [numpages] ;another stolen + mov [eax.pagehandle], edi ;save memory handle + loop di_loop ;and again + jmp short di_next + +di_listerr: ;out of list memory + mov eax, edi ;reload handle + VMMCall _PageFree, ;and free page + +di_next: + + +IFDEF DEBUG + mov ecx, [numpages] + Trace_Out "EATPAGES installed - #ECX pages stolen" +ENDIF + clc + ret + +EndProc EATPAGES_Init_Complete + +VxD_ICODE_ENDS + +VxD_CODE_SEG + +;****************************************************************************** +; +; EATPAGES_System_Exit +; +; DESCRIPTION: +; This routine frees the pages that were allocated at Init_Complete. +; +; +;============================================================================== + +BeginProc EATPAGES_System_Exit + +;---------------------------------------------------------------------------- +; Free all allocated pages +;---------------------------------------------------------------------------- + mov esi, [PageList] ;get list handle + VMMCall List_Get_First + jz short chse_ex ;probably won't jump + +se_loop: + push eax + mov eax, [eax.pagehandle] ;get handle + VMMCall _PageFree, + pop eax + + push eax ;save current node pointer + VMMCall List_Get_Next ;get next one + mov edx, eax ;save next pointer + pop eax ;restore current + + VMMCall List_Remove ;take current off list + VMMCall List_Deallocate ;and get rid of it + + mov eax, edx ;restore next pointer + or eax, eax ;last one? + jnz se_loop ;yes, all deallocated + +chse_ex: + clc + ret + +EndProc EATPAGES_System_Exit + +VxD_CODE_ENDS + + +;****************************************************************************** + +VxD_LOCKED_CODE_SEG + +;****************************************************************************** +; +; EATPAGES_Control +; +; DESCRIPTION: +; +; This is a call-back routine to handle the messages that are sent +; to VxD's. +; +; +;============================================================================== + +BeginProc EATPAGES_Control + + Control_Dispatch Init_Complete, EATPAGES_Init_Complete + Control_Dispatch System_Exit, EATPAGES_System_Exit + clc + ret + +EndProc EATPAGES_Control + +VxD_LOCKED_CODE_ENDS + + END diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/EATPAGES.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/EATPAGES.DEF new file mode 100644 index 00000000..807943b2 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/EATPAGES.DEF @@ -0,0 +1,18 @@ +LIBRARY EATPAGES + +DESCRIPTION 'EatPages VxD Sample for Microsoft Windows' + +STUB 'VXDSTUB.EXE' + +EXETYPE DEV386 + +SEGMENTS + _LTEXT PRELOAD NONDISCARDABLE + _LDATA PRELOAD NONDISCARDABLE + _ITEXT CLASS 'ICODE' DISCARDABLE + _IDATA CLASS 'ICODE' DISCARDABLE + _TEXT CLASS 'PCODE' NONDISCARDABLE + _DATA CLASS 'PCODE' NONDISCARDABLE + +EXPORTS + EATPAGES_DDB @1 diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/EATPAGES.LNK b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/EATPAGES.LNK new file mode 100644 index 00000000..9cd829c7 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/EATPAGES.LNK @@ -0,0 +1,6 @@ +eatpages.obj +eatpages.386 /NOI /NOD /NOP +eatpages.map /MAP + +eatpages.def + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/README.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/README.TXT new file mode 100644 index 00000000..1dedab58 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/README.TXT @@ -0,0 +1,7 @@ + +EATPAGES.386 + +This VxD demonstrates the use of the Linked List services, as well +as the System Page Allocator functions. The VxD will simply allocate +half of the free physical pages at boot time, and free them at +system exit. This can be useful to simulate low memory conditions. diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/VXDSTUB.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/VXDSTUB.ASM new file mode 100644 index 00000000..0404c3dd --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/EATPAGES/VXDSTUB.ASM @@ -0,0 +1,250 @@ + name vxdstub +;************************************************************************ +; +; (C) Copyright MICROSOFT Corp., 1990-1991 +; +; Title: VXDSTUB.ASM +; +; Date: 1-Jun-1991 +; +; Author: Neil Sandlin +; +;************************************************************************ + INCLUDE INT2FAPI.INC +;----------------------------- M A C R O S ------------------------------ +Writel MACRO addr + push ax + push bx + push cx + push dx + + mov dx,offset &addr ;Print + mov cx,&addr&l + mov bx,1 ;stdout + mov ah,40h ;write + int 21h + + pop dx + pop cx + pop bx + pop ax + ENDM + +;----------------------------- E Q U A T E S ----------------------------- + +cr equ 0dh +lf equ 0ah + + +_TEXT segment word public 'CODE' + assume cs:_TEXT,ds:_DATA + +;*----------------------- TSR Data Area ---------------------* +InstData Win386_Startup_Info_Struc <> +oldint dd 0 + +;*----------------------- TSR Code --------------------------* + + +handle2f proc + cmp ax,1605h + jnz @f + push di + lea di,InstData + mov word ptr cs:[di].SIS_Next_Ptr,bx + mov word ptr cs:[di][2].SIS_Next_Ptr,es + pop di + push cs + pop es + lea bx,InstData +@@: + jmp DWORD PTR [oldint] +handle2f endp + + ALIGN 16 +init_fence: + +_TEXT ends + +;*---------------------- Initialization Data ------------------------* + +_DATA segment word public 'DATA' + +TSR_rsv dw ? + +intmsg db cr,lf,'Hooking interrupt ' +intmsgx dd ? + db cr,lf +intmsgl equ $-intmsg + +hndmsg db cr,lf,'ISR entry point: ' +hndmsga dd ? + db ':' +hndmsgb dd ? + db ', length=' +hndmsgc dd ? + db 'h bytes' + db cr,lf +hndmsgl equ $-hndmsg + +tsrmsg db 'TSR; reserving ' +tsrmsgx dd ? + db ' paragraphs' + db cr,lf +tsrmsgl equ $-tsrmsg + +_DATA ends + + +_TEXT segment word public 'CODE' +;*-------------------------- Initialization Code ----------------------* + +vxdstub proc far + mov ax, _DATA + mov ds, ax + +; get a pointer to the name of the load file in the environment seg. + + mov ah,62h + int 21h ;bx -> psp + mov es,bx + mov bx,2ch ;environment segment + mov es,es:[bx] + xor di,di + mov cx,-1 ;big number + xor al,al ;search for a null + cld +@@: + repne scasb ;get past one null and stop + cmp byte ptr es:[di],0 ;another null + jnz @b ;no. + add di,3 ;skip the word before the name. + +; prepare part of the instance data list. Stuff in pointer to the file name +; and refernce data + + lea si,InstData + mov word ptr CS:[si].SIS_Version,3 + mov word ptr CS:[si].SIS_Virt_Dev_File_Ptr,di + mov word ptr CS:[si][2].SIS_Virt_Dev_File_Ptr,es + + mov word ptr cs:[si].SIS_Instance_Data_Ptr,0 + mov word ptr cs:[si][2].SIS_Instance_Data_Ptr,0 + +; Write message and hook interrupt 2f + mov ax, 2fh + mov bx, offset intmsgx + call hexasc + + Writel intmsg + + mov ah, 35h + mov al, 2fh + int 21h ; get old vector + mov WORD PTR cs:oldint,bx ; save old vector here + mov WORD PTR cs:oldint+2,es + + push ds + mov dx, offset handle2f + push cs ; get current code segment + pop ds + mov ah, 25h + mov al, 2fh ; vector to hook + int 21h ; hook that vector + pop ds + + +; Print out some information about the handler + + push cs ; code segment + pop ax + mov bx, offset hndmsga + call hexasc + + mov ax, offset handle2f ; offset of ISR + mov bx, offset hndmsgb + call hexasc + + mov ax, offset init_fence ; length in bytes of handler + mov bx, offset hndmsgc + call hexasc + + Writel hndmsg + +; Compute size of TSR area + + mov dx, offset init_fence ; start of initialization code + add dx, 15 ; round it off to paragraph + shr dx, 1 ; divide by 16 + shr dx, 1 + shr dx, 1 + shr dx, 1 + add dx, 32 ; add in PSP + mov TSR_rsv, dx ; save it + + mov ax, dx + mov bx, offset tsrmsgx + call hexasc + + Writel tsrmsg + +; Terminate and stay resident + + mov ax, 3100h ; TSR + mov dx, TSR_rsv ; # of paragraphs to reserve + int 21h ; TSR +vxdstub endp + + + +;************************************************************************ +; +; HEXASC +; +; This subroutine formats hex values into ASCII +; (utility routine from Advanced MS-DOS Programming) +; +; +;************************************************************************ + +hexasc proc near ; converts word to hex ASCII + ; call with AX = value, + ; DS:BX = address for string + ; returns AX, BX destroyed + + push cx ; save registers + push dx + + mov dx,4 ; initialize character counter +hexasc1: + mov cx,4 ; isolate next four bits + rol ax,cl + mov cx,ax + and cx,0fh + add cx,'0' ; convert to ASCII + cmp cx,'9' ; is it 0-9? + jbe hexasc2 ; yes, jump + add cx,'A'-'9'-1 ; add fudge factor for A-F + +hexasc2: ; store this character + mov [bx],cl + inc bx ; bump string pointer + + dec dx ; count characters converted + jnz hexasc1 ; loop, not four yet + + pop dx ; restore registers + pop cx + ret ; back to caller + +hexasc endp + + + +_TEXT ends + + + + end vxdstub + + \ No newline at end of file diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/GENERIC b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/GENERIC new file mode 100644 index 00000000..fe1f0382 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/GENERIC @@ -0,0 +1,26 @@ +# sample make file for building vxd virtual device for Windows + +# comment this definition out with a "#", if building a non-debugging version +Debug=-DDEBUG + +all : generic.386 + +vxdstub.obj: vxdstub.asm + masm -I..\include vxdstub; + +vxdstub.exe: vxdstub.obj + link vxdstub.obj; + + +generic.obj : generic.asm ..\include\debug.inc ..\include\vmm.inc + masm5 -p -w2 -Mx $(Debug) -I..\include generic.asm; + + +generic.386: generic.def generic.obj vxdstub.exe + link386 @generic.lnk + addhdr generic.386 + mapsym32 generic + +generic.exe: generic.386 + copy generic.386 generic.exe + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/GENERIC.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/GENERIC.ASM new file mode 100644 index 00000000..6878ea06 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/GENERIC.ASM @@ -0,0 +1,265 @@ +PAGE 58,132 +;****************************************************************************** +TITLE GENERIC - Generic VxD +;****************************************************************************** +; +; Title: GENERIC.ASM - Generic VxD +; +; Version: 1.00 +; +; Date: +; +; Author: +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; +;============================================================================== + + .386p + +;****************************************************************************** +; I N C L U D E S +;****************************************************************************** + + .XLIST + INCLUDE VMM.Inc + INCLUDE Debug.Inc + .LIST + + +;****************************************************************************** +; V I R T U A L D E V I C E D E C L A R A T I O N +;------------------------------------------------------------------------------ +; The VxD declaration statement defines the VxD name, version number, +; control proc entry point, VxD ID, initialization order, and VM API +; entry points. What follows is a minimal VxD declaration, defining +; only the name, version, control proc, and an undefined ID. Depending +; on the requirements of the VxD, the following may be added: +; +; - Defined VxD ID: See VXDID.TXT for more information +; - Init order: If your Vxd MUST load before or after a specific VxD, +; the init order can be defined. See VMM.INC for the +; definition of the init order of the standard devices. +; - V86,PM API: You may wish to allow application or library code running +; in a virtual machine to communicate with your VxD directly. +; See the chapter entitled "VxD APIs (Call-Ins)" in the +; Virtual Device Adaptation Guide. +; +;****************************************************************************** + +Declare_Virtual_Device VXD, 1, 0, VXD_Control, Undefined_Device_ID ,,, + + +;****************************************************************************** +; D A T A +;****************************************************************************** + +VxD_IDATA_SEG +; Initialization data here - discarded after Init_Complete +VxD_IDATA_ENDS + + +VxD_DATA_SEG +; Normal Data here +VxD_DATA_ENDS + + +VxD_LOCKED_DATA_SEG +; Pagelocked data here - try to keep this to a minimum. +VxD_LOCKED_DATA_ENDS + + + +;****************************************************************************** +; I N I T I A L I Z A T I O N C O D E +;------------------------------------------------------------------------------ +; Code in the initialization segment is discarded after Init_Complete +;****************************************************************************** + +VxD_ICODE_SEG + +;****************************************************************************** +; +; VXD_Device_Init +; +; DESCRIPTION: +; This is a shell for a routine that is called at system BOOT. +; Typically, a VxD would do its initialization in this routine. +; +; ENTRY: +; EBX = System VM handle +; +; EXIT: +; Carry clear to indicate load success +; Carry set to abort loading this VxD +; +; USES: +; flags +; +;============================================================================== + +BeginProc VXD_Device_Init + + clc ;no error - load VxD + ret + +EndProc VXD_Device_Init + +VxD_ICODE_ENDS + + + +;****************************************************************************** +; C O D E +;------------------------------------------------------------------------------ +; The 'body' of the VxD would typically be in the standard code segment. +;****************************************************************************** + +VxD_CODE_SEG + + +;****************************************************************************** +; +; VXD_Create_VM +; +; DESCRIPTION: +; This is a shell for a routine that is called when a virtual +; machine is created. A typical VxD might perform some action +; here to prepare for handling the new VM in the system. +; +; ENTRY: +; EBX = VM handle +; +; EXIT: +; Carry clear to continue creating VM +; Carry set to abort the creation of the VM +; +; USES: +; flags +; +;============================================================================== + +BeginProc VXD_Create_VM + + clc ;no error - continue + ret + +EndProc VXD_Create_VM + + +VxD_CODE_ENDS + + + +;****************************************************************************** +; P A G E L O C K E D C O D E +;------------------------------------------------------------------------------ +; Memory is a scarce resource. Use this only where necessary. +;****************************************************************************** +VxD_LOCKED_CODE_SEG + +;****************************************************************************** +; +; VXD_Control +; +; DESCRIPTION: +; +; This is a call-back routine to handle the messages that are sent +; to VxD's to control system operation. Every VxD needs this function +; regardless if messages are processed or not. The control proc must +; be in the LOCKED code segment. +; +; The Control_Dispatch macro used in this procedure simplifies +; the handling of messages. To handle a particular message, add +; a Control_Dispatch statement with the message name, followed +; by the procedure that should handle the message. +; +; The two messages handled in this sample control proc, Device_Init +; and Create_VM, are done only to illustrate how messages are +; typically handled by a VxD. A VxD is not required to handle any +; messages. +; +; ENTRY: +; EAX = Message number +; EBX = VM Handle +; +;============================================================================== + +BeginProc VXD_Control + + Control_Dispatch Device_Init, VXD_Device_Init + Control_Dispatch Create_VM, VXD_Create_VM + clc + ret + +EndProc VXD_Control + +VxD_LOCKED_CODE_ENDS + + + +;****************************************************************************** +; R E A L M O D E C O D E +;****************************************************************************** + +;****************************************************************************** +; +; Real mode initialization code +; +; DESCRIPTION: +; This code is called when the system is still in real mode, and +; the VxDs are being loaded. +; +; This routine as coded shows how a VxD (with a defined VxD ID) +; could check to see if it was being loaded twice, and abort the +; second without an error message. Note that this would require +; that the VxD have an ID other than Undefined_Device_ID. See +; the file VXDID.TXT more details. +; +; ENTRY: +; AX = VMM Version +; BX = Flags +; Bit 0: duplicate device ID already loaded +; Bit 1: duplicate ID was from the INT 2F device list +; Bit 2: this device is from the INT 2F device list +; EDX = Reference data from INT 2F response, or 0 +; SI = Environment segment, passed from MS-DOS +; +; EXIT: +; BX = ptr to list of pages to exclude (0, if none) +; SI = ptr to list of instance data items (0, if none) +; EDX = DWORD of reference data to be passed to protect mode init +; +;============================================================================== + +VxD_REAL_INIT_SEG + +BeginProc VxD_Real_Init_Proc + + test bx, Duplicate_Device_ID ; check for already loaded + jnz short duplicate ; jump if so + + xor bx, bx ; no exclusion table + xor si, si ; no instance data table + xor edx, edx ; no reference data + + mov ax, Device_Load_Ok + ret + +duplicate: + mov ax, Abort_Device_Load + No_Fail_Message + ret + +EndProc VxD_Real_Init_Proc + + +VxD_REAL_INIT_ENDS + + + END + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/GENERIC.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/GENERIC.DEF new file mode 100644 index 00000000..92c96c2a --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/GENERIC.DEF @@ -0,0 +1,18 @@ +LIBRARY VXD + +DESCRIPTION 'GENERIC Sample VxD for Microsoft Windows' + +STUB 'VXDSTUB.EXE' + +EXETYPE DEV386 + +SEGMENTS + _LTEXT PRELOAD NONDISCARDABLE + _LDATA PRELOAD NONDISCARDABLE + _ITEXT CLASS 'ICODE' DISCARDABLE + _IDATA CLASS 'ICODE' DISCARDABLE + _TEXT CLASS 'PCODE' NONDISCARDABLE + _DATA CLASS 'PCODE' NONDISCARDABLE + +EXPORTS + VXD_DDB @1 diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/GENERIC.LNK b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/GENERIC.LNK new file mode 100644 index 00000000..5cd23d37 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/GENERIC.LNK @@ -0,0 +1,6 @@ +generic.obj +generic.386 /NOI /NOD /NOP +generic.map /MAP + +generic.def + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/README.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/README.TXT new file mode 100644 index 00000000..e726443f --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/README.TXT @@ -0,0 +1,8 @@ + +GENERIC.386 + +The basic structure of a VxD is illustrated by this VxD. As written, +it can be loaded although it performs no function. This VxD can be +used as a base set of source files to start a VxD project. + + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/VXDSTUB.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/VXDSTUB.ASM new file mode 100644 index 00000000..0404c3dd --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GENERIC/VXDSTUB.ASM @@ -0,0 +1,250 @@ + name vxdstub +;************************************************************************ +; +; (C) Copyright MICROSOFT Corp., 1990-1991 +; +; Title: VXDSTUB.ASM +; +; Date: 1-Jun-1991 +; +; Author: Neil Sandlin +; +;************************************************************************ + INCLUDE INT2FAPI.INC +;----------------------------- M A C R O S ------------------------------ +Writel MACRO addr + push ax + push bx + push cx + push dx + + mov dx,offset &addr ;Print + mov cx,&addr&l + mov bx,1 ;stdout + mov ah,40h ;write + int 21h + + pop dx + pop cx + pop bx + pop ax + ENDM + +;----------------------------- E Q U A T E S ----------------------------- + +cr equ 0dh +lf equ 0ah + + +_TEXT segment word public 'CODE' + assume cs:_TEXT,ds:_DATA + +;*----------------------- TSR Data Area ---------------------* +InstData Win386_Startup_Info_Struc <> +oldint dd 0 + +;*----------------------- TSR Code --------------------------* + + +handle2f proc + cmp ax,1605h + jnz @f + push di + lea di,InstData + mov word ptr cs:[di].SIS_Next_Ptr,bx + mov word ptr cs:[di][2].SIS_Next_Ptr,es + pop di + push cs + pop es + lea bx,InstData +@@: + jmp DWORD PTR [oldint] +handle2f endp + + ALIGN 16 +init_fence: + +_TEXT ends + +;*---------------------- Initialization Data ------------------------* + +_DATA segment word public 'DATA' + +TSR_rsv dw ? + +intmsg db cr,lf,'Hooking interrupt ' +intmsgx dd ? + db cr,lf +intmsgl equ $-intmsg + +hndmsg db cr,lf,'ISR entry point: ' +hndmsga dd ? + db ':' +hndmsgb dd ? + db ', length=' +hndmsgc dd ? + db 'h bytes' + db cr,lf +hndmsgl equ $-hndmsg + +tsrmsg db 'TSR; reserving ' +tsrmsgx dd ? + db ' paragraphs' + db cr,lf +tsrmsgl equ $-tsrmsg + +_DATA ends + + +_TEXT segment word public 'CODE' +;*-------------------------- Initialization Code ----------------------* + +vxdstub proc far + mov ax, _DATA + mov ds, ax + +; get a pointer to the name of the load file in the environment seg. + + mov ah,62h + int 21h ;bx -> psp + mov es,bx + mov bx,2ch ;environment segment + mov es,es:[bx] + xor di,di + mov cx,-1 ;big number + xor al,al ;search for a null + cld +@@: + repne scasb ;get past one null and stop + cmp byte ptr es:[di],0 ;another null + jnz @b ;no. + add di,3 ;skip the word before the name. + +; prepare part of the instance data list. Stuff in pointer to the file name +; and refernce data + + lea si,InstData + mov word ptr CS:[si].SIS_Version,3 + mov word ptr CS:[si].SIS_Virt_Dev_File_Ptr,di + mov word ptr CS:[si][2].SIS_Virt_Dev_File_Ptr,es + + mov word ptr cs:[si].SIS_Instance_Data_Ptr,0 + mov word ptr cs:[si][2].SIS_Instance_Data_Ptr,0 + +; Write message and hook interrupt 2f + mov ax, 2fh + mov bx, offset intmsgx + call hexasc + + Writel intmsg + + mov ah, 35h + mov al, 2fh + int 21h ; get old vector + mov WORD PTR cs:oldint,bx ; save old vector here + mov WORD PTR cs:oldint+2,es + + push ds + mov dx, offset handle2f + push cs ; get current code segment + pop ds + mov ah, 25h + mov al, 2fh ; vector to hook + int 21h ; hook that vector + pop ds + + +; Print out some information about the handler + + push cs ; code segment + pop ax + mov bx, offset hndmsga + call hexasc + + mov ax, offset handle2f ; offset of ISR + mov bx, offset hndmsgb + call hexasc + + mov ax, offset init_fence ; length in bytes of handler + mov bx, offset hndmsgc + call hexasc + + Writel hndmsg + +; Compute size of TSR area + + mov dx, offset init_fence ; start of initialization code + add dx, 15 ; round it off to paragraph + shr dx, 1 ; divide by 16 + shr dx, 1 + shr dx, 1 + shr dx, 1 + add dx, 32 ; add in PSP + mov TSR_rsv, dx ; save it + + mov ax, dx + mov bx, offset tsrmsgx + call hexasc + + Writel tsrmsg + +; Terminate and stay resident + + mov ax, 3100h ; TSR + mov dx, TSR_rsv ; # of paragraphs to reserve + int 21h ; TSR +vxdstub endp + + + +;************************************************************************ +; +; HEXASC +; +; This subroutine formats hex values into ASCII +; (utility routine from Advanced MS-DOS Programming) +; +; +;************************************************************************ + +hexasc proc near ; converts word to hex ASCII + ; call with AX = value, + ; DS:BX = address for string + ; returns AX, BX destroyed + + push cx ; save registers + push dx + + mov dx,4 ; initialize character counter +hexasc1: + mov cx,4 ; isolate next four bits + rol ax,cl + mov cx,ax + and cx,0fh + add cx,'0' ; convert to ASCII + cmp cx,'9' ; is it 0-9? + jbe hexasc2 ; yes, jump + add cx,'A'-'9'-1 ; add fudge factor for A-F + +hexasc2: ; store this character + mov [bx],cl + inc bx ; bump string pointer + + dec dx ; count characters converted + jnz hexasc1 ; loop, not four yet + + pop dx ; restore registers + pop cx + ret ; back to caller + +hexasc endp + + + +_TEXT ends + + + + end vxdstub + + \ No newline at end of file diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/GPTRAP b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/GPTRAP new file mode 100644 index 00000000..6ef35728 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/GPTRAP @@ -0,0 +1,27 @@ +# sample make file for building gptrap virtual device for Windows + +# comment this definition out with a "#", if building a non-debugging version +Debug=-DDEBUG + +all : gptrap.exe + +vxdstub.obj: vxdstub.asm + masm -Mx -p -w2 -I..\include vxdstub; + +vxdstub.exe: vxdstub.obj + link vxdstub.obj; + + +gptrap.obj : gptrap.asm ..\include\debug.inc ..\include\vmm.inc + masm5 -p -w2 -Mx $(Debug) -I..\include gptrap.asm; + +OBJS = gptrap.obj + +gptrap.386: vxdstub.exe gptrap.def $(OBJS) + link386 @gptrap.lnk + addhdr gptrap.386 + mapsym32 gptrap + +gptrap.exe: gptrap.386 + copy gptrap.386 gptrap.exe + \ No newline at end of file diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/GPTRAP.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/GPTRAP.ASM new file mode 100644 index 00000000..5a06b4fc --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/GPTRAP.ASM @@ -0,0 +1,138 @@ +PAGE 58,132 +;****************************************************************************** +TITLE VXD - GPTrap +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1991 +; +; Title: GPTRAP - executes INT1 on invalid GP fault +; +; Version: 3.00 +; +; Date: 1-Jun-1991 +; +; Author: Neil Sandlin +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; +;============================================================================== + + .386p + +;****************************************************************************** +; I N C L U D E S +;****************************************************************************** + + .XLIST + INCLUDE VMM.Inc + INCLUDE Debug.Inc + .LIST + + +;****************************************************************************** +; V I R T U A L D E V I C E D E C L A R A T I O N +;****************************************************************************** + +Declare_Virtual_Device GPTrap, 3, 0, GPTrap_Control, Undefined_Device_ID ,,, + + +;****************************************************************************** +; L O C A L D A T A +;****************************************************************************** + +VxD_LOCKED_DATA_SEG + +OldGPFaultHandler dd ? + +VxD_LOCKED_DATA_ENDS + + + + +;****************************************************************************** +; I N I T I A L I Z A T I O N C O D E +;****************************************************************************** + +VxD_ICODE_SEG + + +;****************************************************************************** +; +; GPTrap_Sys_Critical_Init +; +; DESCRIPTION: +; This routine sets up the GP fault handler. Note that this +; must be called at Sys_Critical_Init in order for it to be +; hooked AFTER the standard GP fault handler. This way, we +; only get control when a BAD gp fault happens. +; +; +;============================================================================== + +BeginProc GPTrap_Sys_Critical_Init + + + mov esi, OFFSET32 MyGPFaultHandler + mov eax, 0dh ; gp faults + VMMCall Hook_PM_Fault + mov [OldGPFaultHandler], esi + + clc + ret +EndProc GPTrap_Sys_Critical_Init + +VxD_ICODE_ENDS + + +;****************************************************************************** + +VxD_LOCKED_CODE_SEG + +;****************************************************************************** +; +; GPTrap_Control +; +; DESCRIPTION: +; +; This is a call-back routine to handle the messages that are sent +; to VxD's to control system operation. +; +; +;============================================================================== + +BeginProc GPTrap_Control + + Control_Dispatch Sys_Critical_Init, GPTrap_Sys_Critical_Init + clc + ret + +EndProc GPTrap_Control + +;****************************************************************************** +; +; MyGPFaultHandler +; +; DESCRIPTION: +; This is the actual gp fault handler. It does only a debug +; break to get control to the debugger. +; +;============================================================================== + +BeginProc MyGPFaultHandler + + int 1 ;DEBUG BREAK + jmp DWORD PTR [OldGPFaultHandler] + +EndProc MyGPFaultHandler + + +VxD_LOCKED_CODE_ENDS + + + END + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/GPTRAP.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/GPTRAP.DEF new file mode 100644 index 00000000..9e221feb --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/GPTRAP.DEF @@ -0,0 +1,19 @@ +LIBRARY GPTRAP + +DESCRIPTION 'GPTRAP Sample VxD for Microsoft Windows' + +STUB 'VXDSTUB.EXE' + +EXETYPE DEV386 + +SEGMENTS + _LTEXT PRELOAD NONDISCARDABLE + _LDATA PRELOAD NONDISCARDABLE + _ITEXT CLASS 'ICODE' DISCARDABLE + _IDATA CLASS 'ICODE' DISCARDABLE + _TEXT CLASS 'PCODE' NONDISCARDABLE + _DATA CLASS 'PCODE' NONDISCARDABLE + +EXPORTS + GPTrap_DDB @1 + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/GPTRAP.LNK b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/GPTRAP.LNK new file mode 100644 index 00000000..e8b6b214 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/GPTRAP.LNK @@ -0,0 +1,6 @@ +gptrap.obj +gptrap.386 /NOI /NOD /NOP +gptrap.map /MAP + +gptrap.def + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/README.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/README.TXT new file mode 100644 index 00000000..d3ea1cb1 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/README.TXT @@ -0,0 +1,6 @@ + +GPTRAP.386 + +This VxD will hook itself so it gets control on GP faults. It then +executes an INT 1, and passes control to the next handler. + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/VXDSTUB.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/VXDSTUB.ASM new file mode 100644 index 00000000..0404c3dd --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/GPTRAP/VXDSTUB.ASM @@ -0,0 +1,250 @@ + name vxdstub +;************************************************************************ +; +; (C) Copyright MICROSOFT Corp., 1990-1991 +; +; Title: VXDSTUB.ASM +; +; Date: 1-Jun-1991 +; +; Author: Neil Sandlin +; +;************************************************************************ + INCLUDE INT2FAPI.INC +;----------------------------- M A C R O S ------------------------------ +Writel MACRO addr + push ax + push bx + push cx + push dx + + mov dx,offset &addr ;Print + mov cx,&addr&l + mov bx,1 ;stdout + mov ah,40h ;write + int 21h + + pop dx + pop cx + pop bx + pop ax + ENDM + +;----------------------------- E Q U A T E S ----------------------------- + +cr equ 0dh +lf equ 0ah + + +_TEXT segment word public 'CODE' + assume cs:_TEXT,ds:_DATA + +;*----------------------- TSR Data Area ---------------------* +InstData Win386_Startup_Info_Struc <> +oldint dd 0 + +;*----------------------- TSR Code --------------------------* + + +handle2f proc + cmp ax,1605h + jnz @f + push di + lea di,InstData + mov word ptr cs:[di].SIS_Next_Ptr,bx + mov word ptr cs:[di][2].SIS_Next_Ptr,es + pop di + push cs + pop es + lea bx,InstData +@@: + jmp DWORD PTR [oldint] +handle2f endp + + ALIGN 16 +init_fence: + +_TEXT ends + +;*---------------------- Initialization Data ------------------------* + +_DATA segment word public 'DATA' + +TSR_rsv dw ? + +intmsg db cr,lf,'Hooking interrupt ' +intmsgx dd ? + db cr,lf +intmsgl equ $-intmsg + +hndmsg db cr,lf,'ISR entry point: ' +hndmsga dd ? + db ':' +hndmsgb dd ? + db ', length=' +hndmsgc dd ? + db 'h bytes' + db cr,lf +hndmsgl equ $-hndmsg + +tsrmsg db 'TSR; reserving ' +tsrmsgx dd ? + db ' paragraphs' + db cr,lf +tsrmsgl equ $-tsrmsg + +_DATA ends + + +_TEXT segment word public 'CODE' +;*-------------------------- Initialization Code ----------------------* + +vxdstub proc far + mov ax, _DATA + mov ds, ax + +; get a pointer to the name of the load file in the environment seg. + + mov ah,62h + int 21h ;bx -> psp + mov es,bx + mov bx,2ch ;environment segment + mov es,es:[bx] + xor di,di + mov cx,-1 ;big number + xor al,al ;search for a null + cld +@@: + repne scasb ;get past one null and stop + cmp byte ptr es:[di],0 ;another null + jnz @b ;no. + add di,3 ;skip the word before the name. + +; prepare part of the instance data list. Stuff in pointer to the file name +; and refernce data + + lea si,InstData + mov word ptr CS:[si].SIS_Version,3 + mov word ptr CS:[si].SIS_Virt_Dev_File_Ptr,di + mov word ptr CS:[si][2].SIS_Virt_Dev_File_Ptr,es + + mov word ptr cs:[si].SIS_Instance_Data_Ptr,0 + mov word ptr cs:[si][2].SIS_Instance_Data_Ptr,0 + +; Write message and hook interrupt 2f + mov ax, 2fh + mov bx, offset intmsgx + call hexasc + + Writel intmsg + + mov ah, 35h + mov al, 2fh + int 21h ; get old vector + mov WORD PTR cs:oldint,bx ; save old vector here + mov WORD PTR cs:oldint+2,es + + push ds + mov dx, offset handle2f + push cs ; get current code segment + pop ds + mov ah, 25h + mov al, 2fh ; vector to hook + int 21h ; hook that vector + pop ds + + +; Print out some information about the handler + + push cs ; code segment + pop ax + mov bx, offset hndmsga + call hexasc + + mov ax, offset handle2f ; offset of ISR + mov bx, offset hndmsgb + call hexasc + + mov ax, offset init_fence ; length in bytes of handler + mov bx, offset hndmsgc + call hexasc + + Writel hndmsg + +; Compute size of TSR area + + mov dx, offset init_fence ; start of initialization code + add dx, 15 ; round it off to paragraph + shr dx, 1 ; divide by 16 + shr dx, 1 + shr dx, 1 + shr dx, 1 + add dx, 32 ; add in PSP + mov TSR_rsv, dx ; save it + + mov ax, dx + mov bx, offset tsrmsgx + call hexasc + + Writel tsrmsg + +; Terminate and stay resident + + mov ax, 3100h ; TSR + mov dx, TSR_rsv ; # of paragraphs to reserve + int 21h ; TSR +vxdstub endp + + + +;************************************************************************ +; +; HEXASC +; +; This subroutine formats hex values into ASCII +; (utility routine from Advanced MS-DOS Programming) +; +; +;************************************************************************ + +hexasc proc near ; converts word to hex ASCII + ; call with AX = value, + ; DS:BX = address for string + ; returns AX, BX destroyed + + push cx ; save registers + push dx + + mov dx,4 ; initialize character counter +hexasc1: + mov cx,4 ; isolate next four bits + rol ax,cl + mov cx,ax + and cx,0fh + add cx,'0' ; convert to ASCII + cmp cx,'9' ; is it 0-9? + jbe hexasc2 ; yes, jump + add cx,'A'-'9'-1 ; add fudge factor for A-F + +hexasc2: ; store this character + mov [bx],cl + inc bx ; bump string pointer + + dec dx ; count characters converted + jnz hexasc1 ; loop, not four yet + + pop dx ; restore registers + pop cx + ret ; back to caller + +hexasc endp + + + +_TEXT ends + + + + end vxdstub + + \ No newline at end of file diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/DOSACC.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/DOSACC.ASM new file mode 100644 index 00000000..6cdb8387 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/DOSACC.ASM @@ -0,0 +1,113 @@ + name dosacc +;**************************************************************************** +; (C) Copyright MICROSOFT Corp., 1990 +; +; Date: 8-Oct-1990 +; +; Author: Neil Sandlin +; +; +; DOSACC +; +; This DOS application demonstrates the functionality of the +; VDIALOG VxD. +; +; +;**************************************************************************** + + include vdevice.inc + +_DATA segment word public 'DATA' + +value db ? + +accmsg db cr,lf,'Value read from port ' +accmsga dd ? + db ':' +accmsgb dd ? + db cr,lf +accmsgl equ $-accmsg + + +_DATA ends + +_TEXT segment word public 'CODE' + assume cs:_TEXT,ds:_DATA + +;*--------------------------------------------------------------------* + +dosacc proc far + mov ax,_DATA + mov ds,ax + + mov ax, vdev_addr + mov bx, offset accmsga + call hexasc + + mov ax, -1 + mov dx, vdev_addr + in al, dx ; read the port + mov bx, offset accmsgb + call hexasc + + mov WORD PTR accmsgb, 2020h + +; Write message + + Writel accmsg + + + mov ax,4c00h ; exit to DOS + int 21h +dosacc endp + +;************************************************************************ +; +; HEXASC +; +; This subroutine formats hex values into ASCII +; +;************************************************************************ + +hexasc proc near ; converts word to hex ASCII + ; call with AX = value, + ; DS:BX = address for string + ; returns AX, BX destroyed + + push cx ; save registers + push dx + + mov dx,4 ; initialize character counter +hexasc1: + mov cx,4 ; isolate next four bits + rol ax,cl + mov cx,ax + and cx,0fh + add cx,'0' ; convert to ASCII + cmp cx,'9' ; is it 0-9? + jbe hexasc2 ; yes, jump + add cx,'A'-'9'-1 ; add fudge factor for A-F + +hexasc2: ; store this character + mov [bx],cl + inc bx ; bump string pointer + + dec dx ; count characters converted + jnz hexasc1 ; loop, not four yet + + pop dx ; restore registers + pop cx + ret ; back to caller + +hexasc endp + + +_TEXT ends + + +;*--------------------------------------------------------------------* + + + end dosacc + + \ No newline at end of file diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/README.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/README.TXT new file mode 100644 index 00000000..1698364e --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/README.TXT @@ -0,0 +1,21 @@ + +VDIALOG.386 + + +This VxD demonstrates how to serialize I/O to a device under enhanced +mode Windows. To find out what this means exactly, install this VxD +by putting a "device=" line in the [386enh] section of your SYSTEM.INI. +Restart Windows, and try running the accompanying sample programs, WINACC +and DOSACC. These two application programs simply try to perform an +IN instruction to a predetermined, but undefined port. The VDIALOG +VxD will protect multiple VM's from accessing the port (either reading +or writing), and display a dialog box to resolve the contention. + +*) Open a DOS box. +*) Execute DOSACC.EXE in that DOS box. +*) Switch back to Windows. DO NOT DESTROY THE DOS BOX (EG: Don't "exit".) +*) Execute WINACC.EXE. +*) Admire the dialog box that has appeared. If no contention box has + appeared, you've probably done something wrong. Make sure you've + added the "device=" line for the VDIALOG device in your system. + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDEVICE.INC b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDEVICE.INC new file mode 100644 index 00000000..fdcf7966 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDEVICE.INC @@ -0,0 +1,26 @@ +;----------------------------- M A C R O S ------------------------------ +Writel MACRO addr + push ax + push bx + push cx + push dx + + mov dx,offset &addr ;Print + mov cx,&addr&l + mov bx,1 ;stdout + mov ah,40h ;write + int 21h + + pop dx + pop cx + pop bx + pop ax + ENDM + +;----------------------------- E Q U A T E S ----------------------------- + +cr equ 0dh +lf equ 0ah + +vdev_addr equ 200h + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDIALOG b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDIALOG new file mode 100644 index 00000000..6ed1d2c6 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDIALOG @@ -0,0 +1,23 @@ +# sample make file for building vdialog virtual device for Windows + +# comment this definition out with a "#", if building a non-debugging version +Debug=-DDEBUG + +all : vdialog.386 + +.asm.obj: + masm5 -p -w2 -Mx $(Debug) -I..\include $*; + +.asm.lst: + masm5 -l -p -w2 -Mx $(Debug) -I..\include $*; + + +vdialog.obj : vdialog.asm ..\include\debug.inc ..\include\vmm.inc + + +OBJS = vdialog.obj + +vdialog.386: vdialog.def $(OBJS) + link386 @vdialog.lnk + addhdr vdialog.386 + mapsym32 vdialog diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDIALOG.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDIALOG.ASM new file mode 100644 index 00000000..384bbef5 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDIALOG.ASM @@ -0,0 +1,251 @@ +PAGE 58,132 +;****************************************************************************** +TITLE VDIALOG - +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1990 +; +; Title: VDIALOG.ASM - +; +; Version: 3.00 +; +; Date: 8-Oct-1990 +; +; Author: Neil Sandlin +; +; +; The purpose of this sample VxD is to demonstrate the basic +; use of the Install_IO_Handler and Shell_Resolve_Contention +; function calls. The Install_IO_Handler call enables this +; VxD to trap IN and OUT's to a port from any VM. The +; Shell_Resolve_Contention call is then used to display a +; dialog box when another VM attempts to use a port that +; is already assigned. +; +; This VxD also demonstrates the use of Enable_Local_Trapping +; and Disable_Local_Trapping to allow the owner of the port in +; question to freely do I/O to the port without overhead. +; +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; +;============================================================================== + + .386p + +;****************************************************************************** +; I N C L U D E S +;****************************************************************************** + + .XLIST + INCLUDE VMM.Inc + INCLUDE Debug.Inc + INCLUDE Shell.inc + INCLUDE Vdevice.inc + .LIST + +;****************************************************************************** +; V I R T U A L D E V I C E D E C L A R A T I O N +;****************************************************************************** + +Declare_Virtual_Device VDIALOG, 3, 0, VDIALOG_Control, Undefined_Device_ID ,,, + + +;****************************************************************************** +; L O C A L D A T A +;****************************************************************************** + + +VxD_LOCKED_DATA_SEG + +Device_Name db "VDIALOG ",0 +VDIALOG_Owner dd ? + + +VxD_LOCKED_DATA_ENDS + + + + +;****************************************************************************** +; I N I T I A L I Z A T I O N C O D E +;****************************************************************************** + +VxD_ICODE_SEG + + +;****************************************************************************** +; +; VDIALOG_Device_Init +; +; DESCRIPTION: +; +; This routine is called during Windows startup. It needs to +; install the I/O handler for our device, and set up the system +; VM as the default owner. +; +; +;============================================================================== + +BeginProc VDIALOG_Device_Init + + mov edx, vdev_addr + mov esi, OFFSET32 My_VDIALOG_Hook + VMMCall Install_IO_Handler + + xor eax, eax + mov VDIALOG_Owner, eax ; no current owner + +IFDEF DEBUG + Trace_Out "VDIALOG installed" +ENDIF + + clc + ret + +EndProc VDIALOG_Device_Init + +VxD_ICODE_ENDS + + +VxD_CODE_SEG + +;****************************************************************************** +; +; VDIALOG_Destroy_VM +; +; DESCRIPTION: +; +; This routine is called when a VM is destroyed. We need to check +; to see if the VM in question is the current owner of the device. +; +;============================================================================== +BeginProc VDIALOG_Destroy_VM + + cmp ebx, VDIALOG_Owner ; Destroying device owner? + jnz short VDM_Exit + + xor eax, eax + mov VDIALOG_Owner, eax ; no current owner + +VDM_Exit: + clc + ret + +EndProc VDIALOG_Destroy_VM + +VxD_CODE_ENDS + + +;****************************************************************************** + +VxD_LOCKED_CODE_SEG + +;****************************************************************************** +; +; VDIALOG_Control +; +; DESCRIPTION: +; +; This is a call-back routine to handle the messages that are sent +; to VxD's to control system operation. +; +;============================================================================== +BeginProc VDIALOG_Control + + Control_Dispatch Device_Init, VDIALOG_Device_Init + Control_Dispatch Destroy_VM, VDIALOG_Destroy_VM + clc + ret + +EndProc VDIALOG_Control + +VxD_LOCKED_CODE_ENDS + + +VxD_CODE_SEG + +;***************************************************************************** +; +; My_VDIALOG_Hook +; +; DESCRIPTION: +; +; This routine is called for every I/O access to our port. First, +; it checks to see if the VM issuing the I/O is the current owner. +; If not, it displays a dialog box so the user can decide what to +; do. +; +;***************************************************************************** + +BeginProc My_VDIALOG_Hook + +;--------------------------------------------------------------------- +; Resolve Contention +;--------------------------------------------------------------------- + pushad ; save regs + mov eax, VDIALOG_Owner ; get previous owner + cmp eax, ebx ; same as current owner? + jz short process_io ; yes, just handle it + or eax, eax ; was there an old owner? + jz short new_owner ; no + + mov esi, OFFSET32 Device_Name + VxDCall Shell_Resolve_Contention + + jc short dont_process ; hmmm, couldn't resolve + + cmp ebx, VDIALOG_Owner ; if contention winner is + ; the current owner, + je short dont_process ; then we shouldn't process + +new_owner: + +IFDEF DEBUG + Trace_Out "VDIALOG: New Owner #EBX" +ENDIF + + mov edx, vdev_addr ; our port address + VMMCall Disable_Local_Trapping ; give winner free access + + xchg ebx, VDIALOG_Owner ; save new owner, get old + or ebx, ebx ; no old owner? + jz short process_io ; no, just process + VMMCall Enable_Local_Trapping ; old owner now locked out + +process_io: + popad + +;--------------------------------------------------------------------- +; Handle I/O +;--------------------------------------------------------------------- + Dispatch_Byte_IO Fall_Through, + in al,dx ; do real in + ret + +VDIALOG_Out: + out dx,al ; do real out + ret + +dont_process: + popad ; restore regs + mov al, 0Eh ; indicate error to sample + ; apps +IFDEF DEBUG + Trace_Out "VDIALOG: I/O inhibited for VM #EBX" +ENDIF + + ret + +EndProc My_VDIALOG_Hook + + +VxD_CODE_ENDS + + + END diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDIALOG.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDIALOG.DEF new file mode 100644 index 00000000..731ea845 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDIALOG.DEF @@ -0,0 +1,16 @@ +LIBRARY VDIALOG + +DESCRIPTION 'VDIALOG Sample VxD for Microsoft Windows' + +EXETYPE DEV386 + +SEGMENTS + _LTEXT PRELOAD NONDISCARDABLE + _LDATA PRELOAD NONDISCARDABLE + _ITEXT CLASS 'ICODE' DISCARDABLE + _IDATA CLASS 'ICODE' DISCARDABLE + _TEXT CLASS 'PCODE' NONDISCARDABLE + _DATA CLASS 'PCODE' NONDISCARDABLE + +EXPORTS + VDIALOG_DDB @1 diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDIALOG.LNK b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDIALOG.LNK new file mode 100644 index 00000000..f5a991dc --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/VDIALOG.LNK @@ -0,0 +1,5 @@ +vdialog.obj +vdialog.386 /NOI /NOD /NOP +vdialog.map /MAP + +vdialog.def diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/WINACC.C b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/WINACC.C new file mode 100644 index 00000000..d9da314f --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/WINACC.C @@ -0,0 +1,346 @@ +/* + (C) Copyright MICROSOFT Corp., 1991 +*/ +/**************************************************************************** + + PROGRAM: Winacc.c + + PURPOSE: Demonstrates the functionality of the VDIALOG VxD + + FUNCTIONS: + + WinMain() - calls initialization function, processes message loop + InitApplication() - initializes window data and registers window + InitInstance() - saves instance handle and creates main window + MainWndProc() - processes messages + About() - processes messages for "About" dialog box + + COMMENTS: + + Windows can have several copies of your application running at the + same time. The variable hInst keeps track of which instance this + application is so that processing will be to the correct window. + +****************************************************************************/ + +#include "windows.h" /* required for all Windows applications */ +#include "winacc.h" /* specific to this program */ + +HANDLE hInst; /* current instance */ + +/**************************************************************************** + + FUNCTION: WinMain(HANDLE, HANDLE, LPSTR, int) + + PURPOSE: calls initialization function, processes message loop + + COMMENTS: + + Windows recognizes this function by name as the initial entry point + for the program. This function calls the application initialization + routine, if no other instance of the program is running, and always + calls the instance initialization routine. It then executes a message + retrieval and dispatch loop that is the top-level control structure + for the remainder of execution. The loop is terminated when a WM_QUIT + message is received, at which time this function exits the application + instance by returning the value passed by PostQuitMessage(). + + If this function must abort before entering the message loop, it + returns the conventional value NULL. + +****************************************************************************/ + +int PASCAL WinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow) +HANDLE hInstance; /* current instance */ +HANDLE hPrevInstance; /* previous instance */ +LPSTR lpCmdLine; /* command line */ +int nCmdShow; /* show-window type (open/icon) */ +{ + MSG msg; /* message */ + + if (!hPrevInstance) /* Other instances of app running? */ + if (!InitApplication(hInstance)) /* Initialize shared things */ + return (FALSE); /* Exits if unable to initialize */ + + /* Perform initializations that apply to a specific instance */ + + if (!InitInstance(hInstance, nCmdShow)) + return (FALSE); + + /* Acquire and dispatch messages until a WM_QUIT message is received. */ + + while (GetMessage(&msg, /* message structure */ + NULL, /* handle of window receiving the message */ + NULL, /* lowest message to examine */ + NULL)) /* highest message to examine */ + { + TranslateMessage(&msg); /* Translates virtual key codes */ + DispatchMessage(&msg); /* Dispatches message to window */ + } + return (msg.wParam); /* Returns the value from PostQuitMessage */ +} + + +/**************************************************************************** + + FUNCTION: InitApplication(HANDLE) + + PURPOSE: Initializes window data and registers window class + + COMMENTS: + + This function is called at initialization time only if no other + instances of the application are running. This function performs + initialization tasks that can be done once for any number of running + instances. + + In this case, we initialize a window class by filling out a data + structure of type WNDCLASS and calling the Windows RegisterClass() + function. Since all instances of this application use the same window + class, we only need to do this when the first instance is initialized. + + +****************************************************************************/ + +BOOL InitApplication(hInstance) +HANDLE hInstance; /* current instance */ +{ + WNDCLASS wc; + + /* Fill in window class structure with parameters that describe the */ + /* main window. */ + + wc.style = NULL; /* Class style(s). */ + wc.lpfnWndProc = MainWndProc; /* Function to retrieve messages for */ + /* windows of this class. */ + wc.cbClsExtra = 0; /* No per-class extra data. */ + wc.cbWndExtra = 0; /* No per-window extra data. */ + wc.hInstance = hInstance; /* Application that owns the class. */ + wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = "WinaccMenu"; /* Name of menu resource in .RC file. */ + wc.lpszClassName = "WinaccWClass"; /* Name used in call to CreateWindow. */ + + /* Register the window class and return success/failure code. */ + + return (RegisterClass(&wc)); + +} + + +/**************************************************************************** + + FUNCTION: InitInstance(HANDLE, int) + + PURPOSE: Saves instance handle and creates main window + + COMMENTS: + + This function is called at initialization time for every instance of + this application. This function performs initialization tasks that + cannot be shared by multiple instances. + + In this case, we save the instance handle in a static variable and + create and display the main program window. + +****************************************************************************/ + +BOOL InitInstance(hInstance, nCmdShow) +HANDLE hInstance; /* Current instance identifier. */ +int nCmdShow; /* Param for first ShowWindow() call. */ +{ + HWND hWnd; /* Main window handle. */ + short xClient, yClient; + + /* Save the instance handle in static variable, which will be used in */ + /* many subsequence calls from this application to Windows. */ + + hInst = hInstance; + + SizeWindow (&xClient, &yClient); + + /* Create a main window for this application instance. */ + + hWnd = CreateWindow( + "WinaccWClass", /* See RegisterClass() call. */ + "Winacc Sample Application", /* Text for window title bar. */ + WS_OVERLAPPEDWINDOW, /* Window style. */ + CW_USEDEFAULT, /* Default horizontal position. */ + CW_USEDEFAULT, /* Default vertical position. */ + xClient, yClient, + NULL, /* Overlapped windows have no parent. */ + NULL, /* Use the window class menu. */ + hInstance, /* This instance owns this window. */ + NULL /* Pointer not needed. */ + ); + + /* If window could not be created, return "failure" */ + + if (!hWnd) + return (FALSE); + + /* Make the window visible; update its client area; and return "success" */ + + ShowWindow(hWnd, nCmdShow); /* Show the window */ + UpdateWindow(hWnd); /* Sends WM_PAINT message */ + return (TRUE); /* Returns the value from PostQuitMessage */ + +} + +void SizeWindow (short *pxClient, short *pyClient) +{ + HDC hdc; + TEXTMETRIC tm; + short xSize = 35; + short ySize = 20; + + hdc = CreateIC ("DISPLAY", NULL, NULL, NULL); + GetTextMetrics (hdc, &tm); + DeleteDC (hdc); + + *pxClient = 2* GetSystemMetrics (SM_CXBORDER) + xSize*tm.tmAveCharWidth; + *pyClient = 2* GetSystemMetrics (SM_CXBORDER) + + ySize*(tm.tmHeight+tm.tmExternalLeading); +} + + +/**************************************************************************** + + FUNCTION: MainWndProc(HWND, unsigned, WORD, LONG) + + PURPOSE: Processes messages + + MESSAGES: + + WM_COMMAND - application menu (About dialog box) + WM_DESTROY - destroy window + + COMMENTS: + + To process the IDM_ABOUT message, call MakeProcInstance() to get the + current instance address of the About() function. Then call Dialog + box which will create the box according to the information in your + winacc.rc file and turn control over to the About() function. When + it returns, free the intance address. + +****************************************************************************/ + +long FAR PASCAL MainWndProc(hWnd, message, wParam, lParam) +HWND hWnd; /* window handle */ +unsigned message; /* type of message */ +WORD wParam; /* additional information */ +LONG lParam; /* additional information */ +{ + FARPROC lpProcAbout; /* pointer to the "About" function */ + + short y; + static short cxChar, cyChar; + HDC hdc; + PAINTSTRUCT ps; + TEXTMETRIC tm; + char szBuffer [132]; + static int count; + + switch (message) { + + /*------------------------ C R E A T E -----------------------*/ + case WM_CREATE: + hdc = GetDC (hWnd); + GetTextMetrics (hdc, &tm); + cxChar = tm.tmAveCharWidth; + cyChar = tm.tmHeight + tm.tmExternalLeading; + y = 0; + ReleaseDC (hWnd, hdc); + break; + + /*------------------------ P A I N T -------------------------*/ + case WM_PAINT: + hdc = BeginPaint (hWnd, &ps); + y = 0; + + TextOut (hdc, cxChar, cyChar*y++, szBuffer, + wsprintf (szBuffer, "Value read from port %.4X = %.2X", + cvdev_addr, count)); + + EndPaint (hWnd, &ps); + break; + + case WM_COMMAND: /* message: command from application menu */ + if (wParam == IDM_ABOUT) { + lpProcAbout = MakeProcInstance(About, hInst); + + DialogBox(hInst, /* current instance */ + "AboutBox", /* resource to use */ + hWnd, /* parent handle */ + lpProcAbout); /* About() instance address */ + + FreeProcInstance(lpProcAbout); + break; + } + + else if (wParam == IDM_ACTION) { + _asm{ + mov dx, vdev_addr + in al, dx + xor ah, ah + mov count, ax + } + InvalidateRect (hWnd, NULL, TRUE); + break; + } + + else /* Lets Windows process it */ + return (DefWindowProc(hWnd, message, wParam, lParam)); + + case WM_DESTROY: /* message: window being destroyed */ + PostQuitMessage(0); + break; + + default: /* Passes it on if unproccessed */ + return (DefWindowProc(hWnd, message, wParam, lParam)); + } + return (NULL); +} + + +/**************************************************************************** + + FUNCTION: About(HWND, unsigned, WORD, LONG) + + PURPOSE: Processes messages for "About" dialog box + + MESSAGES: + + WM_INITDIALOG - initialize dialog box + WM_COMMAND - Input received + + COMMENTS: + + No initialization is needed for this particular dialog box, but TRUE + must be returned to Windows. + + Wait for user to click on "Ok" button, then close the dialog box. + +****************************************************************************/ + +BOOL FAR PASCAL About(hDlg, message, wParam, lParam) +HWND hDlg; /* window handle of the dialog box */ +unsigned message; /* type of message */ +WORD wParam; /* message-specific information */ +LONG lParam; +{ + switch (message) { + case WM_INITDIALOG: /* message: initialize dialog box */ + return (TRUE); + + case WM_COMMAND: /* message: received a command */ + if (wParam == IDOK /* "OK" box selected? */ + || wParam == IDCANCEL) { /* System menu close command? */ + EndDialog(hDlg, TRUE); /* Exits the dialog box */ + return (TRUE); + } + break; + } + return (FALSE); /* Didn't process a message */ +} diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/WINACC.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/WINACC.DEF new file mode 100644 index 00000000..68bce20f --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/WINACC.DEF @@ -0,0 +1,28 @@ +; module-definition file for winacc -- used by LINK.EXE + +NAME Winacc ; application's module name + +DESCRIPTION 'Sample Application for Microsoft Windows for use with VDialogD' + +EXETYPE WINDOWS ; required for all applications for Windows + +STUB 'WINSTUB.EXE' ; Generates error message if application + ; is run without Windows + +;CODE can be moved in memory +CODE PRELOAD MOVEABLE + +;DATA must be MULTIPLE if program can be invoked more than once +DATA PRELOAD MOVEABLE MULTIPLE + + +HEAPSIZE 1024 +STACKSIZE 5120 ; recommended minimum for applications for Windows + + +; All functions that will be called by any Windows routine +; MUST be exported. + +EXPORTS + MainWndProc @1 ; name of window processing function + About @2 ; name of "About" processing function diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/WINACC.H b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/WINACC.H new file mode 100644 index 00000000..a6ad53b0 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/WINACC.H @@ -0,0 +1,13 @@ +#define IDM_ABOUT 100 +#define IDM_ACTION 101 + +int PASCAL WinMain(HANDLE, HANDLE, LPSTR, int); +BOOL InitApplication(HANDLE); +BOOL InitInstance(HANDLE, int); +void SizeWindow (short *, short *); +long FAR PASCAL MainWndProc(HWND, unsigned, WORD, LONG); +BOOL FAR PASCAL About(HWND, unsigned, WORD, LONG); + + +#define vdev_addr 0200h +#define cvdev_addr 0x0200 diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/WINACC.RC b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/WINACC.RC new file mode 100644 index 00000000..5647534f --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/WINACC.RC @@ -0,0 +1,23 @@ +#include "windows.h" +#include "winacc.h" + +WinaccMenu MENU +BEGIN + MENUITEM "&Read!", IDM_ACTION + POPUP "&Help" + BEGIN + MENUITEM "&About Winacc...", IDM_ABOUT + END +END + +AboutBox DIALOG 22, 17, 144, 75 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "About Winacc" +BEGIN + CTEXT "Microsoft Windows" -1, 0, 5, 144, 8 + CTEXT "Winacc Application" -1, 0, 14, 144, 8 + CTEXT "Version 3.1" -1, 0, 34, 144, 8 + DEFPUSHBUTTON "OK" IDOK, 53, 59, 32, 14, WS_GROUP +END + + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/XXXACC b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/XXXACC new file mode 100644 index 00000000..1b17b641 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VDIALOG/XXXACC @@ -0,0 +1,43 @@ +# Standard Windows make file. The utility MAKE.EXE compares the +# creation date of the file to the left of the colon with the file(s) +# to the right of the colon. If the file(s) on the right are newer +# then the file on the left, Make will execute all of the command lines +# following this line that are indented by at least one tab or space. +# Any valid MS-DOS command line may be used. + +# This line allows NMAKE to work as well + +all: winacc.exe dosacc.exe + + +# Update the resource if necessary + +winacc.res: winacc.rc winacc.h + rc -r winacc.rc + + +# Update the object file if necessary + +winacc.obj: winacc.c winacc.h + cl -c -AS -Gsw -Oas -W3 -Zpei winacc.c + + +# Update the executable file if necessary, and if so, add the resource back in. + +winacc.exe: winacc.obj winacc.def + link /CO/NOD winacc,,, libw slibcew, winacc.def + rc winacc.res + + +# If the .res file is new and the .exe file is not, update the resource. +# Note that the .rc file can be updated without having to either +# compile or link the file. + +winacc.exe: winacc.res + rc winacc.res + +dosacc.obj: dosacc.asm vdevice.inc + masm -W2 dosacc.asm; + +dosacc.exe: dosacc.obj + link dosacc.obj; diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/README.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/README.TXT new file mode 100644 index 00000000..e56e8b62 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/README.TXT @@ -0,0 +1,133 @@ + +VFINTD.386 + +Summary: +-------- + +Normally, hardware interrupts in Windows enhanced mode are +classified either as "global" or as "owned". Global interrupts +will typically be reflected into whichever virtual machine is +currently running, while owned interrupts will be reflected into +the machine that owns that interrupt. For example, the floppy +device is one that should be made global, because any virtual +machine should be able to use it and receive interrupts from it. +On the other hand, an application that exclusively handles the +communication with a non-standard device would become confused +if interrupts from the device were routed to some other virtual +machine. For this reason, these interrupts should be "owned". + +Some software developers may want to be able to "capture" global +interrupts temporarily in one virtual machine, effectively +making the interrupt "owned". VFINTD.386 is a sample VxD which +does just that. With this VxD installed in an enhanced mode Windows +system, an application can issue the appropriate API calls to force +all interrupts coming from the floppy device to be reflected into +the app's VM, regardless of which VM is currently running. + + +Background: +----------- + +The PIC (Programmable Interrupt Controller) contains an IMR +(Interrupt Mask Register) which defines which hardware interrupts +are currently enabled and which are masked. You can display the +contents of the IMR with DEBUG. For example, from the DOS prompt, +issue the commands: + + debug + i21 + +This will display the value of port 21 on your machine, which is +the IMR for the hardware interrupts IRQ0 - IRQ7. The format of the +IMR is such that for each bit (0-7) that is on, the corresponding +IRQ (Interrupt ReQuest) is disabled. So, a typical IMR value might +be x'98', which indicates that IRQ3, IRQ4, and IRQ7 are all masked, +meaning those interrupts are disabled. + + x'98' = b'10011000', masked IRQ's = '7..43...' + + NOTE: On AT systems, there are two hardware PIC's, and thus two + IMR's which correspond to the fifteen possible IRQ's (IRQ 9 is + cascaded to IRQ2, tying up the usage of one IRQ). This point + is only mentioned here for completeness, but is not necessary to + understand the overall picture. + +When a DOS device driver or TSR installs an interrupt handler for +a particular IRQ, it sets up the interrupt vector and unmasks the +corresponding bit in the IMR. When Windows is running, DOS drivers +and TSRs are normally shared by all virtual machines. Thus, if an +interrupt occurs while an arbitrary VM is running, Windows would not +need to perform a virtual machine task switch in order to access the +interrupt handler, because it resides in the address space of each +virtual machine. + +On the other hand, if an interrupt handler for a previously masked +IRQ is installed WITHIN a virtual machine, and an interrupt occurs +while another virtual machine is executing, Windows would have to +make a task switch in order for that local interrupt handler to be +accessible and executable. + + +Windows Default Behavior: +------------------------- + +In Windows enhanced mode, the virtualization of the PICs is done +by the VPICD. If no other action is taken with regard to an IRQ, +then VPICD will handle interrupts according to the following +default behavior: + +When Windows enhanced mode boots, VPICD examines the value of +the IMR's in the system to determine which interrupts are masked. +If an interrupt was not masked (was enabled), Windows must assume +that there is already a valid interrupt handler installed. These +IRQ's are then flagged as "global", so that Windows can avoid the +overhead of task switching to have them serviced. The remaining +IRQ's, which were masked (disabled), are flagged as "local" or +"owned". Interrupts for these IRQ's will only be reflected into +the particular virtual machine that unmasks them. + + +Changing the Default Behavior: +------------------------------ + +It is possible to change the default behavior of interrupt handling +described above by installing a VxD which virtualizes the IRQ. This +is done with the VxDCall "VPICD_Virtualize_IRQ". What this call +does is to replace the VPICD default callback routines with ones +supplied in the VxD. For example, the VCD (Virtual COMM Device) +does this to control interrupts from comm devices regardless of the +state of the IMR at Windows load time. + +The VFINTD sample VxD also uses this function to allow an app to +"capture" the interrupts on IRQ6 (floppy device), which is normally +global. For example, a backup program that needs to directly access +the floppy controller hardware to improve performance would "lose" +interrupts to other virtual machines unless action was taken to +change the global nature of IRQ6. The VFINTD can be used in this +case to capture the "focus" of the floppy device and the interrupts +it generates. + + +Using VFINTD: +------------- + +There are two pieces to this sample, the VxD and a sample DOS app. +All the files that have the VFINTD file name are a part of the VxD. +The DOS app has the name TSTFINT. The only purpose of the DOS app is +to capture the floppy interrupts. A release of this focus is not +done in the sample app, but this functionality is provided in the +VxD. + +To install the VxD in your machine, put the line: + device=VFINTD.386 + +in the [386enh] section of your system.ini. Then, put that file in +your Windows SYSTEM directory. Once the machine is booted, you can +issue a "TSTFINT" from a DOS VM to capture the floppy interrupts. +TSTFINT will print the VxD's version number to indicate that it has +successfully communicated with the VxD. + +This sample has been provided to demonstrate the technique of +handling the virtualization of a particular IRQ. It would make a +good base for other VxDs that need to perform similar functions. + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/TSTFINT.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/TSTFINT.ASM new file mode 100644 index 00000000..4e7eee75 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/TSTFINT.ASM @@ -0,0 +1,125 @@ +; (C) Copyright MICROSOFT Corp., 1990 +; + name vfintd +; +; This is a small test app which calls the VxD API for the +; VFINTD device. + + include vfintd.inc +; +cr equ 0dh +lf equ 0ah + +_DATA segment word public 'DATA' +hellow db 'VxD Version = ' +vfintdx db 4 dup (?) + db cr,lf +hellowl equ $-hellow + +no_support_msg db 'Can not function. Are we in a DOS box under Windows? ',\ + 'Is VFINTD installed?', cr,lf +no_support_msg_len equ $ - no_support_msg + +VxDFunc dd ? +_DATA ends + + + +_TEXT segment word public 'CODE' + assume cs:_TEXT,ds:_DATA + +;*--------------------------------------------------------------------* +; This routine will get the VxD Device API entry point via +; an INT 2F call. Then, calling that entry point, it will +; retrieve the version number of the VxD, and more importantly +; set the focus for floppy interrupts. +; + +vfintd proc far + mov ax,_DATA + mov ds,ax + + mov bx,VFINTD_Dev_ID ; get VxD ID + mov ax,1684h ; Get Device API Entry Point + int 2fh + mov ax,es + or ax,di ; installed? + jz no_support ; no + + mov WORD PTR [VxDFunc], di + mov WORD PTR [VxDFunc+2], es + + mov ax,0 ; get version + call VxDFunc + + mov bx,offset vfintdx + call hexasc + + mov dx,offset hellow ;Print VxD version number + mov cx,hellowl + mov bx,1 ;stdout + mov ah,40h ;write + int 21h + + mov ax,100h ; Set focus + call VxDFunc + jmp short ByeBye + +no_support: + mov dx,offset no_support_msg ;Print error message + mov cx,no_support_msg_len + mov bx,1 ;stdout + mov ah,40h ;write + int 21h + +ByeBye: + mov ax,4c00h + int 21h +vfintd endp + + +;-------------------------------------------------------------------- +; +; hexasc +; +; convert hex to ascii +; +;-------------------------------------------------------------------- +hexasc proc near ; converts word to hex ASCII + ; call with AX = value, + ; DS:BX = address for string + ; returns AX, BX destroyed + + push cx ; save registers + push dx + + mov dx,4 ; initialize character counter +hexasc1: + mov cx,4 ; isolate next four bits + rol ax,cl + mov cx,ax + and cx,0fh + add cx,'0' ; convert to ASCII + cmp cx,'9' ; is it 0-9? + jbe hexasc2 ; yes, jump + add cx,'A'-'9'-1 ; add fudge factor for A-F + +hexasc2: ; store this character + mov [bx],cl + inc bx ; bump string pointer + + dec dx ; count characters converted + jnz hexasc1 ; loop, not four yet + + pop dx ; restore registers + pop cx + ret ; back to caller + +hexasc endp + + + +_TEXT ends + + end vfintd + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD new file mode 100644 index 00000000..f48aa151 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD @@ -0,0 +1,32 @@ +# sample make file for building vfintd virtual device for Windows + +# comment this definition out with a "#", if building a non-debugging version +Debug=-DDEBUG + +all : vfintd.386 tstfint.exe + +.asm.obj: + masm5 -p -w2 -Mx $(Debug) -I..\include $*; + +.asm.lst: + masm5 -l -p -w2 -Mx $(Debug) -I..\include $*; + + +tstfint.obj: tstfint.asm vfintd.inc + +tstfint.exe: tstfint.obj + link tstfint.obj; + + +vfintd.obj : vfintd.asm vfintd.inc \ + ..\include\debug.inc \ + ..\include\vmm.inc \ + ..\include\vpicd.inc + +OBJS = vfintd.obj + +vfintd.386: vfintd.def $(OBJS) + link386 @vfintd.lnk + addhdr vfintd.386 + mapsym32 vfintd + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD.ASM new file mode 100644 index 00000000..9638ac72 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD.ASM @@ -0,0 +1,285 @@ +PAGE 58,132 +;****************************************************************************** +TITLE VFINTD - +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1990 +; +; Title: VFINTD.ASM - +; +; Version: 3.00 +; +; Date: Oct-10-1990 +; +; Author: Neil Sandlin +; +; This is a sample VxD which allows an application to "trap" floppy +; interrupts, even though this "global" interrupt would normally be +; reflected into whatever VM is running. +; +; PLEASE NOTE: This is not an official Microsoft product. This is sample +; code that was written to illustrate possible applications of functions +; that are documented in the Windows Device Development Kit. Microsoft +; does not guarantee the accuracy or reliability of this code. +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; +;============================================================================== + + .386p + +;****************************************************************************** +; I N C L U D E S +;****************************************************************************** + + .XLIST + INCLUDE VMM.Inc + INCLUDE Debug.Inc + INCLUDE VPICD.Inc + INCLUDE vfintd.inc + .LIST + + +;****************************************************************************** +; V I R T U A L D E V I C E D E C L A R A T I O N +;****************************************************************************** + +Declare_Virtual_Device VFINTD, 3, 0, VFINTD_Control, VFINTD_Dev_ID ,, \ + VFINTD_API_Proc, VFINTD_API_Proc + + +;****************************************************************************** +; L O C A L D A T A +;****************************************************************************** + +VxD_LOCKED_DATA_SEG + +VFINTD_Owner dd 0 + +VFINTD_IRQ_Desc VPICD_IRQ_Descriptor <6,VPICD_Opt_Read_Hw_IRR, \ + OFFSET32 VFINTD_Hw_INT,,OFFSET32 VFINTD_EOI> + +VxD_LOCKED_DATA_ENDS + + +;****************************************************************************** +; I N I T I A L I Z A T I O N C O D E +;****************************************************************************** + +VxD_ICODE_SEG + + +;****************************************************************************** +; +; VFINTD_Device_Init +; +; DESCRIPTION: +; +; This function is called during enhanced mode startup. The only +; thing we do here is inform the VPICD that we want to virtualize +; the floppy IRQ. From then on, hardware interrupts and EOI's will +; flow through our own routines. +; +; +;============================================================================== + +BeginProc VFINTD_Device_Init + +IFDEF DEBUG + mov eax,VFINTD_Dev_ID + Trace_Out "Floppy IRQ router: dev=#ax" +ENDIF + + mov edi, OFFSET32 VFINTD_IRQ_Desc + VxDcall VPICD_Virtualize_IRQ + + clc + ret +EndProc VFINTD_Device_Init + +VxD_ICODE_ENDS + + + +;****************************************************************************** + +VxD_LOCKED_CODE_SEG + +;****************************************************************************** +; +; VFINTD_Destroy_VM +; +; DESCRIPTION: +; +; This function is called when a VM is destroyed. It checks to see +; if the VM being destroyed has the focus. If so, it releases the +; focus. +; +; +;============================================================================== + +BeginProc VFINTD_Destroy_VM + cmp [VFINTD_Owner], ebx ;the same vm? + jnz short VFINTD_dvmexit + xor eax,eax + mov [VFINTD_Owner], eax + +IFDEF DEBUG + Trace_Out "VFINTD: Owner=#eax" +ENDIF + +VFINTD_dvmexit: + clc + ret +EndProc VFINTD_Destroy_VM + +;****************************************************************************** +; +; VFINTD_Control +; +; DESCRIPTION: +; +; This routine is the main entry from VMM. All message traffic +; comes through this routine. +; +; +;============================================================================== + +BeginProc VFINTD_Control + + Control_Dispatch Device_Init, VFINTD_Device_Init + Control_Dispatch Destroy_VM, VFINTD_Destroy_VM + clc + ret + +EndProc VFINTD_Control + + +;VxD_LOCKED_CODE_ENDS + + +;VxD_CODE_SEG + + +;****************************************************************************** +; A P I +;****************************************************************************** + + +BeginDoc +;****************************************************************************** +; +; VFINTD_API_Proc +; +; DESCRIPTION: +; +; This is the exported API procedure that is callable from VM's. +; An application needs only to use INT 2Fh, AX=1684h, BX=device ID +; and a call back address is returned. Then, when the +; address is called, eventually it ends up here. +; +; +;============================================================================== +EndDoc + +BeginProc VFINTD_API_Proc + + and [ebp.Client_Flags], NOT CF_Mask ; clear VM's carry flag + + cmp [ebp.Client_AX], 0 ; check out value in VM's AX + jne SHORT VFINTD_API_Test_Set + mov [ebp.Client_AX], 300h ; API - Get Version Number + jmp SHORT VFINTD_exit + +VFINTD_API_Test_Set: + cmp [ebp.Client_AX], 100h ; VM requesting floppy focus + jne SHORT VFINTD_API_Test_Release + mov [VFINTD_Owner], ebx ; set focus + jmp SHORT VFINTD_exit + +VFINTD_API_Test_Release: + cmp [ebp.Client_AX], 200h ; VM releasing focus + jne SHORT VFINTD_API_Invalid + xor eax,eax + mov [VFINTD_Owner], eax ; release focus + jmp SHORT VFINTD_exit + +VFINTD_API_Invalid: + or [ebp.Client_Flags], CF_Mask + +VFINTD_exit: + mov eax,[VFINTD_Owner] + +IFDEF DEBUG + Trace_Out "VFINTD: Owner=#eax" +ENDIF + + ret + +EndProc VFINTD_API_Proc + +VxD_CODE_ENDS + + + +VxD_LOCKED_CODE_SEG + + +;****************************************************************************** +; H A R D W A R E I N T E R R U P T R O U T I N E S +;****************************************************************************** + +;****************************************************************************** +; +; VFINTD_Hw_Int +; +; DESCRIPTION: +; +; This is the routine that gets control on a floppy interrupt. +; If the variable VFINTD_Owner contains a VM control block address, +; then the interrupt is reflected into that VM. +; +; +;============================================================================== + +BeginProc VFINTD_Hw_Int, High_Freq + + cmp [VFINTD_Owner], 0 ; has focus been set? + jz short VFINTD_Hw_exit + mov ebx, [VFINTD_Owner] ; load the owner VM + +VFINTD_Hw_exit: + VxDjmp VPICD_Set_Int_Request + +EndProc VFINTD_Hw_Int + + + +;****************************************************************************** +; +; VFINTD_EOI +; +; DESCRIPTION: +; +; This routine is required by VPICD. It performs default +; processing. +; +; +;============================================================================== +BeginProc VFINTD_EOI, High_Freq + + VxDCall VPICD_Phys_EOI + VxDjmp VPICD_Clear_Int_Request + +EndProc VFINTD_EOI + + +VxD_LOCKED_CODE_ENDS + + END + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD.DEF new file mode 100644 index 00000000..17b64be0 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD.DEF @@ -0,0 +1,17 @@ +LIBRARY VFINTD + +DESCRIPTION 'VFINTD Sample VxD for Microsoft Windows' + +EXETYPE DEV386 + +SEGMENTS + _LTEXT PRELOAD NONDISCARDABLE + _LDATA PRELOAD NONDISCARDABLE + _ITEXT CLASS 'ICODE' DISCARDABLE + _IDATA CLASS 'ICODE' DISCARDABLE + _TEXT CLASS 'PCODE' NONDISCARDABLE + _DATA CLASS 'PCODE' NONDISCARDABLE + +EXPORTS + VFINTD_DDB @1 + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD.INC b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD.INC new file mode 100644 index 00000000..6515c008 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD.INC @@ -0,0 +1,27 @@ +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1990 +; +; Title: VFINTD.INC +; +; Version: 3.00 +; +; Date: 10-OCT-1990 +; +; Author: nbs +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; +;============================================================================== + +; +; This is the virtual device ID for this VxD. It is a unique number assigned +; to this device. For more information on VxD IDs, please see the VXDID.TXT +; file. +; +VFINTD_Dev_ID equ 7fe5h diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD.LNK b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD.LNK new file mode 100644 index 00000000..afec9a8e --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VFINTD/VFINTD.LNK @@ -0,0 +1,6 @@ +vfintd.obj +vfintd.386 /NOI /NOD /NOP +vfintd.map /MAP + +vfintd.def + \ No newline at end of file diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/README.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/README.TXT new file mode 100644 index 00000000..bb69bdd3 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/README.TXT @@ -0,0 +1,11 @@ + +VHOOK86D.386 + +This is a simple VxD that will hook the V86 INT chain by using the +Hook_V86_Int_Chain service. For more information on the +Hook_V86_Int_Chain service, please consult the Virtual Device Adaptation +Guide of the DDK. + +WARNING: This VxD, by default, will hook INT 2fh. + This VxD may impair system performance. It is intended + only to be a demonstration. diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/VHOOK86D b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/VHOOK86D new file mode 100644 index 00000000..bdbe9705 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/VHOOK86D @@ -0,0 +1,23 @@ +# sample make file for building vhook86d virtual device for Windows + +# comment this definition out with a "#", if building a non-debugging version +Debug=-DDEBUG + +.asm.obj: + masm5 -p -w2 -Mx $(Debug) -I..\include $*; + +.asm.lst: + masm5 -l -p -w2 -Mx $(Debug) -I..\include $*; + +all : VHook86D.386 + +VHook86D.obj VHook86D.lst: VHook86D.asm \ + ..\include\debug.inc \ + ..\include\vmm.inc + +OBJS = VHook86D.obj + +VHook86D.386: VHook86D.def $(OBJS) + link386 @VHook86D.lnk + addhdr VHook86D.386 + mapsym32 VHook86D diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/VHOOK86D.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/VHOOK86D.ASM new file mode 100644 index 00000000..1ecb5930 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/VHOOK86D.ASM @@ -0,0 +1,113 @@ +PAGE 58,132 +;****************************************************************************** +Title VHOOK86D.ASM +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1992 +; +; Title: VHOOK86D.ASM +; +; Version: 3.10 +; +; Date: 14-Jan-1992 +; +; Author: Todd Cole +; +; +; Description: +; This is a simple VxD that will hook the V86 INT chain. +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; 29-Feb-1992 bjm General cleanup. +;============================================================================== +;****************************************************************************** + + .386p + + .xlist + include vmm.inc + include debug.inc + .list + + +;****************************************************************************** +; declare virtual device +;============================================================================== + +Declare_Virtual_Device VHook86D, 3, 0ah, VHook86D_Control, Undefined_Device_ID, \ + Undefined_Init_Order,, + + +Hooked_Int equ 2fh ; This is the interrupt we want + ; to hook. + +;****************************************************************************** +; Initialization Code +;============================================================================== + +VXD_ICODE_SEG + +BeginProc VHook86D_Sys_Crit_Init + + Trace_Out "VHook86D: Sys Critical Init." + + mov eax, Hooked_Int + mov esi, OFFSET32 VHook86D_V86_Int_Handler + VMMCall Hook_V86_Int_Chain + + clc + ret + +EndProc VHook86D_Sys_Crit_Init + +VXD_ICODE_ENDS + + +;****************************************************************************** +; Code +;------------------------------------------------------------------------------ +VXD_CODE_SEG + + +;****************************************************************************** +; Control dispatch proc +;============================================================================== +BeginProc VHook86D_Control + + Control_Dispatch Sys_Critical_Init, VHook86D_Sys_Crit_Init + clc + ret + +EndProc VHook86D_Control + + +;-------------------------------------------------------------------- +; VHook86D_V86_Int_Handler +;-------------------------------------------------------------------- +BeginProc VHook86D_V86_Int_Handler + + pushad + mov ax,[ebp.Client_AX] + mov bx,[ebp.Client_BX] + mov cx,[ebp.Client_CX] + mov dx,[ebp.Client_DX] + mov si,[ebp.Client_SI] + mov di,[ebp.Client_DI] + Trace_Out "VHook86D: Got INT. AX=#AX BX=#BX CX=#CX DX=#DX SI=#SI DI=#DI" + popad + + stc ; don't consume the interrupt + ret + +EndProc VHook86D_V86_Int_Handler + +;============================================================================== + +VXD_CODE_ENDS + + END diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/VHOOK86D.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/VHOOK86D.DEF new file mode 100644 index 00000000..a196fc3d --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/VHOOK86D.DEF @@ -0,0 +1,15 @@ +LIBRARY VHook86D + +DESCRIPTION 'VHOOK86D Sample VxD for Microsoft Windows' + +EXETYPE DEV386 + +SEGMENTS + _LTEXT PRELOAD NONDISCARDABLE + _LDATA PRELOAD NONDISCARDABLE + _ITEXT CLASS 'ICODE' DISCARDABLE + _TEXT CLASS 'PCODE' NONDISCARDABLE + _DATA CLASS 'PCODE' NONDISCARDABLE + +EXPORTS + VHook86D_DDB @1 diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/VHOOK86D.LNK b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/VHOOK86D.LNK new file mode 100644 index 00000000..b4cf59dd --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VHOOK86D/VHOOK86D.LNK @@ -0,0 +1,5 @@ +vhook86d.obj +vhook86d.386 /NOI /NOD /NOP +vhook86d.map /MAP + +vhook86d.def diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/README.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/README.TXT new file mode 100644 index 00000000..e57010ae --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/README.TXT @@ -0,0 +1,10 @@ + +VIDLED.386 + +This VxD demonstrates how to use the Call_When_Idle function. + +WARNING: This VxD issues a Trace_Out call on every idle call-back. + This VxD may impair system performance. It is intended + only to be a demonstration. + + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED new file mode 100644 index 00000000..18fa24ce --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED @@ -0,0 +1,25 @@ +# sample make file for building VIdleD virtual device for Windows + +# comment this definition out with a "#", if building a non-debugging version +Debug=-DDEBUG + +all : vidled.386 + +.asm.obj: + masm5 -p -w2 -Mx $(Debug) -I..\include $*; + +.asm.lst: + masm5 -l -p -w2 -Mx $(Debug) -I..\include $*; + + + +VIdleD.obj : VIdleD.asm VIdleD.inc ..\include\debug.inc ..\include\vmm.inc + + +OBJS = VIdleD.obj + +VIdleD.386: VIdleD.def $(OBJS) + link386 @VIdleD.lnk + addhdr VIdleD.386 + mapsym32 VIdleD + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED.ASM new file mode 100644 index 00000000..2096500e --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED.ASM @@ -0,0 +1,133 @@ +PAGE 58,132 +;****************************************************************************** +TITLE VIdleD +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1992 +; +; Title: VIdleD.ASM +; +; Version: 3.10 +; +; Date: 21-Feb-1992 +; +; Author: Bernie McIlroy +; +; Description: This VxD demonstrates how to use the Call_When_Idle function. +; WARNING: This VxD issues a Trace_Out call on every idle +; call-back. This VxD may impair system performance. +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; +;============================================================================== + + .386p + +;****************************************************************************** +; I N C L U D E S +;****************************************************************************** + + .XLIST + INCLUDE VMM.Inc + INCLUDE Debug.Inc + INCLUDE VIdleD.Inc + .LIST + + +;****************************************************************************** +; V I R T U A L D E V I C E D E C L A R A T I O N +;****************************************************************************** + +Declare_Virtual_Device VIdleD, 3, 0ah, VIdleD_Control, VIdleD_Dev_ID,, , + + +;****************************************************************************** +; I N I T I A L I Z A T I O N C O D E +;****************************************************************************** + +VxD_ICODE_SEG + + +;****************************************************************************** +; +; VIdleD_Device_Init +; +; DESCRIPTION: +; This routine installs the handler that will be called when +; the system is idle. +; +; +;============================================================================== + +BeginProc VIdleD_Sys_Critical_Init + +IFDEF DEBUG + Trace_Out "VIdleD installed" +ENDIF + mov esi, OFFSET32 VIdled_Idle_Handler + VMMCall Call_When_Idle + + clc + ret +EndProc VIdleD_Sys_Critical_Init + +VxD_ICODE_ENDS + + +VxD_LOCKED_CODE_SEG + +;****************************************************************************** +; +; VIdleD_Control +; +; DESCRIPTION: +; +; This is a call-back routine to handle the messages that are sent +; to VxD's to control system operation. +; +; +;============================================================================== + +BeginProc VIdleD_Control + + clc + Control_Dispatch Sys_Critical_Init, VIdleD_Sys_Critical_Init + ret + +EndProc VIdleD_Control + + + +;****************************************************************************** +; +; VIdleD_Idle_Handler +; +; DESCRIPTION: +; +; This function gets control when Windows detects an idle condition +; in the system. +; +; ENTRY: +; EBX = System VM handle +; EBP = Client register structure. Return with carry set to pass the +; call to the next handler. Return with carry clear to "eat" +; the call-back and indicate the System VM is not idle. +; +; +;============================================================================== +BeginProc VIdleD_Idle_Handler + Trace_Out "VIdleD: System idle detected." + or [ebp.Client_Flags], CF_Mask ; set the client carry flag + ret +EndProc VIdleD_Idle_Handler + + +VxD_LOCKED_CODE_ENDS + + + END diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED.DEF new file mode 100644 index 00000000..20479935 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED.DEF @@ -0,0 +1,17 @@ +LIBRARY VIdleD + +DESCRIPTION 'VIDLED Sample VxD for Microsoft Windows' + +EXETYPE DEV386 + +SEGMENTS + _LTEXT PRELOAD NONDISCARDABLE + _LDATA PRELOAD NONDISCARDABLE + _ITEXT CLASS 'ICODE' DISCARDABLE + _IDATA CLASS 'ICODE' DISCARDABLE + _TEXT CLASS 'PCODE' NONDISCARDABLE + _DATA CLASS 'PCODE' NONDISCARDABLE + +EXPORTS + VIdleD_DDB @1 + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED.INC b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED.INC new file mode 100644 index 00000000..86da2623 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED.INC @@ -0,0 +1,6 @@ +; +; This is the virtual device ID for this VxD. It is a unique number assigned +; to this device. For more information on VxD IDs, please see the VXDID.TXT +; file. +; +VIdleD_Dev_ID equ 7fe9h diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED.LNK b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED.LNK new file mode 100644 index 00000000..a28b3566 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VIDLED/VIDLED.LNK @@ -0,0 +1,6 @@ +VIdleD.obj +VIdleD.386 /NOI /NOD /NOP +VIdleD.map /MAP + +VIdleD.def + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/DOSIT.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/DOSIT.ASM new file mode 100644 index 00000000..9a7923b2 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/DOSIT.ASM @@ -0,0 +1,249 @@ +; (C) Copyright MICROSOFT Corp., 1991 +; +; Author: Neil Sandlin +; + + name dosit +; +; + include dosit.inc + include itimer.inc + + + +_TEXT segment word public 'CODE' + assume cs:_TEXT,ds:_DATA + + +dosit proc far + mov ax, _DATA + mov ds, ax + mov es, ax + + mov ax, 1600h ; check for enhanced windows + int 2fh ; hello windows? + test al, 7fh ; significant bits + jnz short running_enhanced ; ok + + Writel errmsg ; display error + jmp dosit_exit + + +running_enhanced: +;----------------------------------------------------------------------- +; install handler +;----------------------------------------------------------------------- + push es + mov ah, 35h + mov al, ITIMER_VECTOR + int 21h ; get old vector + mov WORD PTR cs:oldint,bx ; save old vector here + mov WORD PTR cs:oldint+2,es + pop es + + push ds + mov dx, offset handler + push cs ; get current code segment + pop ds + mov ah, 25h + mov al, ITIMER_VECTOR ; vector to hook + int 21h ; hook that vector + pop ds + +;----------------------------------------------------------------------- +; set up interval timer +;----------------------------------------------------------------------- + + + mov si, offset Count ; point to count + call Set_Count + mov WORD PTR Count, 0 ; clear it out + mov WORD PTR Count+2, 0 ; clear it out + + mov Timer_rupt, 0 ; indicate no interrupt yet + mov al, ITIMER_RUNNING OR ITIMER_ENHANCED + mov dx, ITIMER_STATE + out dx, al ; start timer + +;----------------------------------------------------------------------- +; wait for timer completion +;----------------------------------------------------------------------- + + Writel cnthdr + +cntloop: + push cx + mov di, offset Count ; put it here + Call Get_Count + + mov cx, 4 ; output doubleword + mov si, offset Count ; source + mov di, offset cntmsg ; destination + call hextrans ; make it ascii + Writel cntmsg + + mov cx, 0ffffh ; spin a while +chugloop: loop chugloop ; waste system resources + mov cx, 0ffffh ; spin a while +chugloop2: loop chugloop2 ; waste system resources + + pop cx + + cmp BYTE PTR Timer_rupt, 0ffh ; get the interrupt? + jz short dosit_rupt ; yes + + jmp cntloop + + jmp dosit_exit + +dosit_rupt: + mov di, offset Count ; put it here + Call Get_Count + + mov cx, 4 ; output doubleword + mov si, offset Count ; source + mov di, offset cntmsg ; destination + call hextrans ; make it ascii + Writel cntmsg + Writel ruptmsg ; display + +dosit_exit: + mov ax, 4C00h ; exit + int 21h ; + +dosit endp + + + +;************************************************************************ +; +; Set_Count +; +;************************************************************************ + +Set_Count proc near + mov dx, ITIMER_COUNT ; count register + mov cx, 4 ; 4 bytes to process +sc_loop: + lodsb ; get byte into al + out dx, al ; send it on out + loop sc_loop ; do it again + ret +Set_Count endp + + + +;************************************************************************ +; +; Get_Count +; +;************************************************************************ + +Get_Count proc near + mov dx, ITIMER_COUNT ; count register + mov cx, 4 ; 4 bytes to process +gc_loop: + in al, dx ; get a byte + stosb ; save it in our area + loop gc_loop ; do it again + ret +Get_Count endp + + +;************************************************************************ +; +; hextrans +; +; This subroutine formats hex values into ASCII +; +; ENTRY: +; CX = # of bytes to convert +; DS:SI-> input hex value (in memory) +; ES:DI-> output area +; +; USES: +; AX, SI, DI +;************************************************************************ + +hextrans proc near + + push bx + push cx + + cmp cx, 0 ; must be higher + jna hextexit ; nope + add si, cx ; point to end of value + dec si ; now pointing at last byte +hext1: + push cx + lodsb ; get hex byte + sub si, 2 ; make this a decrement + + mov bx, ax ; save for next nibble + mov cx, 4 ; isolate next four bits + shr ax, cl ; get top nibble + and ax, 0fh + + cvt_nibble ; make it ascii + stosb ; save it in destination + mov ax, bx ; retrieve original byte + and ax, 0fh + cvt_nibble ; make it ascii + stosb ; save it in destination + pop cx + loop hext1 + +hextexit: + pop cx + pop bx + ret ; back to caller + +hextrans endp + + +;********************************************************************** + +handler proc far + push ds + push ax + mov ax, _DATA + mov ds, ax + + mov Timer_rupt, 0ffh ; we got the 'rupt + + pop ax + pop ds + iret +handler endp + + +_TEXT ends + + +;*------------------------------- Data ---------------------------------* + +_DATA segment word public 'DATA' + +oldint dd ? +Count dd 2000h + +errmsg db 'This program must run in a DOS box under Enhanced Windows.' + db cr, lf +errmsgl equ $-errmsg + +cnthdr db 'Interval Timer Count = ' +cnthdrl equ $-cnthdr + +cntmsg db 8 dup (?) + db 8 dup (bs) +cntmsgl equ $-cntmsg + +ruptmsg db cr, lf, 'Interrupt from interval timer received!' +ruptmsgl equ $-ruptmsg + +Timer_rupt db ? + +_DATA ends + + + end dosit diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/DOSIT.INC b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/DOSIT.INC new file mode 100644 index 00000000..d149e642 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/DOSIT.INC @@ -0,0 +1,36 @@ +; (C) Copyright MICROSOFT Corp., 1991 + +;----------------------------- M A C R O S ------------------------------ +Writel MACRO addr + push ax + push bx + push cx + push dx + + mov dx,offset &addr ;Print + mov cx,&addr&l + mov bx,1 ;stdout + mov ah,40h ;write + int 21h + + pop dx + pop cx + pop bx + pop ax + ENDM + +cvt_nibble MACRO + add ax, '0' ; convert to ASCII + cmp ax, '9' ; is it 0-9? + jbe @f ; yes, jump + add ax, 'A'-'9'-1 ; make it 'A-F' +@@: + ENDM + +;----------------------------- E Q U A T E S ----------------------------- + +cr equ 0dh +lf equ 0ah +bs equ 08h + + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/GETCOUNT.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/GETCOUNT.ASM new file mode 100644 index 00000000..5f3de1a4 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/GETCOUNT.ASM @@ -0,0 +1,167 @@ +; (C) Copyright MICROSOFT Corp., 1991 +; +; Author: Neil Sandlin +; + + name dosit +; +; + include dosit.inc + include itimer.inc + + +ITIMER_COUNT equ 30h +ITIMER_STATE equ 31h + + +_TEXT segment word public 'CODE' + assume cs:_TEXT,ds:_DATA + + +dosit proc far + mov ax, _DATA + mov ds, ax + mov es, ax + + mov ax, 1600h ; check for enhanced windows + int 2fh ; hello windows? + test al, 7fh ; significant bits + jnz short running_enhanced ; ok + + Writel errmsg1 ; display error + jmp dosit_exit + + +running_enhanced: + Writel cnthdr + + mov di, offset Count ; put it here + Call Get_Count + + mov cx, 4 ; output doubleword + mov si, offset Count ; source + mov di, offset cntmsg ; destination + call hextrans ; make it ascii + Writel cntmsg + + +dosit_exit: + mov ax, 4C00h ; exit + int 21h ; + +dosit endp + + + +;************************************************************************ +; +; Set_Count +; +;************************************************************************ + +Set_Count proc near + mov dx, ITIMER_COUNT ; count register + mov cx, 4 ; 4 bytes to process +sc_loop: + lodsb ; get byte into al + out dx, al ; send it on out + loop sc_loop ; do it again + ret +Set_Count endp + + + +;************************************************************************ +; +; Get_Count +; +;************************************************************************ + +Get_Count proc near + mov dx, ITIMER_COUNT ; count register + mov cx, 4 ; 4 bytes to process +gc_loop: + in al, dx ; get a byte + stosb ; save it in our area + loop gc_loop ; do it again + ret +Get_Count endp + + +;************************************************************************ +; +; hextrans +; +; This subroutine formats hex values into ASCII +; +; ENTRY: +; CX = # of bytes to convert +; DS:SI-> input hex value (in memory) +; ES:DI-> output area +; +; USES: +; AX, SI, DI +;************************************************************************ + +hextrans proc near + + push bx + push cx + + cmp cx, 0 ; must be higher + jna hextexit ; nope + add si, cx ; point to end of value + dec si ; now pointing at last byte +hext1: + push cx + lodsb ; get hex byte + sub si, 2 ; make this a decrement + + mov bx, ax ; save for next nibble + mov cx, 4 ; isolate next four bits + shr ax, cl ; get top nibble + and ax, 0fh + + cvt_nibble ; make it ascii + stosb ; save it in destination + mov ax, bx ; retrieve original byte + and ax, 0fh + cvt_nibble ; make it ascii + stosb ; save it in destination + pop cx + loop hext1 + +hextexit: + pop cx + pop bx + ret ; back to caller + +hextrans endp + +_TEXT ends + +;*------------------------------- Data ---------------------------------* + +_DATA segment word public 'DATA' + +Count dd 800h + +errmsg1 db 'This program must run in a DOS box under Enhanced Windows.' + db cr, lf +errmsg1l equ $-errmsg1 + +cnthdr db 'Interval Timer Count = ' +cnthdrl equ $-cnthdr + +cntmsg db 8 dup (?) + db 8 dup (bs) +cntmsgl equ $-cntmsg + + +_DATA ends + + + + + end dosit + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/ITIMER.INC b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/ITIMER.INC new file mode 100644 index 00000000..7cadcb00 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/ITIMER.INC @@ -0,0 +1,115 @@ +; (C) Copyright MICROSOFT Corp., 1991 +;*********************************************************************** +; +; itimer.inc +; +; +; Summary: +; +; The Virtual Interval Timer is provided in enhanced mode Windows by +; the VITD VxD. The timer is strictly virtual in the sense that there +; is no real hardware directly associated with ports used in accessing +; the timer. In other words, this timer is simulated in software. The +; following comments will describe how to use the timer, and what +; its characteristics are. +; +; +; Basically, the VIT enables programs to measure elapsed CPU time in +; a virtual machine. This timer DOES NOT count down in real time. For +; every millesecond that a virtual machine is allowed to run, this +; timer is decremented by one. When the value of the timer is reaches +; zero, an interrupt will be posted to the virtual machine. +; +; VIT Registers: +; +; I/O address Description +; ----------- ----------- +; 30h --- VIT Count Register. This is a 32 bit +; register that contains the number of +; milleseconds remaining before a VIT +; interrupt occurs. The count register +; will be decremented only when the timer +; is running, as defined by the state +; register. Reading or writing this +; register is done bytewise, from the +; least significant byte to the most +; significant. +; +; 31h --- VIT State Register. The following bits +; are defined in this register: +; defined bits +; ------------ +; 00000001b ITIMER_RUNNING: This bit indicates that +; the timer is currently running. When +; writing to the state register, this bit +; is used to start or stop the timer. +; If this bit is set, the count register +; and all other bits in the state register +; are read/only. +; +; 00000010b ITIMER_ENHANCED: This bit can be used +; in conjunction with the ITIMER_RUNNING +; bit to start an interval in which the +; system timer is running at a much higher +; accuracy. +; +; 00000100b ITIMER_NO_RUPT: Setting this bit in the +; state register specifies that the timer +; should not reflect a timer interrupt when +; the count reaches zero. +; +; !!WARNING!! - Fast timer interrupt periods +; can be very, very expensive in terms of +; total system performance. For example, +; on some machines a timer interrupt of +; 1 millesecond will degrade total machine +; throughput by 10 percent and disk I/O by +; up to 50 percent. +; +; 10000000b ITIMER_ERROR: An error was encountered +; in setting the interval timer. Unexpected +; results may occur. +; +; +; VIT Interrupt: +; +; When the timer is running, and ITIMER_NO_RUPT has not been specified, +; an interrupt will be reflected into the virtual machine after the +; count register decrements to zero. This interrupt is made on vector +; 66h. +; +; +; Virtual Interval Timer Operation: +; +; When the interval timer count has been programmed, and the timer +; has been set to the "running" state, the interval count will be +; decremented by 1 for each millesecond that the virtual machine is +; scheduled and run. So, this count will indicate VM execution time, +; not real time. When the count reaches zero and an interrupt has +; been requested, then an interrupt will be posted to the virtual +; machine on vector 66h. +; +; Note that the interval timer may in fact decrement beyond zero. This +; depends on the accuracy of the hardware system timer, and also on +; the state of the system at the time of the "timeout". Also, the +; interrupt may not be reflected immediately to the virtual machine, +; because this event is scheduled to occur when the VM is enabled for +; interrupts and not in a critical section. +; +;************************************************************************ + +ITIMER_COUNT equ 30h + + +ITIMER_STATE equ 31h +; Bits defined in the state register +ITIMER_STOPPED EQU 0 +ITIMER_RUNNING EQU 01h +ITIMER_ENHANCED EQU 02h +ITIMER_NO_RUPT EQU 04h +ITIMER_ERROR EQU 80h + + +ITIMER_VECTOR equ 66h +ITIMER_SIG equ 1630h + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/README.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/README.TXT new file mode 100644 index 00000000..a5a3ff87 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/README.TXT @@ -0,0 +1,10 @@ + +VITD.386 + +This VxD provides a simulation of a hardware interval timer for virtual +machines. To install it, build VITD.386, place the final VITD.386 in +the Windows SYSTEM directory, and add a "device=VITD.386" line in the +[386enh] section of the SYSTEM.INI and restart Windows. + +The accompanying sample applications and header files provide documentation +on using the virtual interval timer. diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/SAMPLE.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/SAMPLE.ASM new file mode 100644 index 00000000..5e6d02fb --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/SAMPLE.ASM @@ -0,0 +1,59 @@ +; (C) Copyright MICROSOFT Corp., 1991 +; +; Author: Neil Sandlin +; + + name sample +; +; + include itimer.inc + + +_TEXT segment word public 'CODE' + assume cs:_TEXT,ds:_DATA + +sample proc far + mov ax, _DATA + mov ds, ax + mov es, ax + + mov ax, 1600h ; check for enhanced windows + int 2fh ; hello windows? + test al, 7fh ; significant bits + jnz short running_enhanced ; ok + jmp sample_exit +running_enhanced: + +;----------------------------------------------------------------------- +; set up interval timer +;----------------------------------------------------------------------- + + mov si, offset Count ; point to count + mov dx, ITIMER_COUNT ; count register + mov cx, 4 ; 4 bytes to process +sc_loop: + lodsb ; get byte into al + out dx, al ; send it on out + loop sc_loop ; do it again + + mov al, ITIMER_RUNNING OR ITIMER_NO_RUPT + mov dx, ITIMER_STATE + out dx, al ; start timer + +sample_exit: + mov ax, 4C00h ; exit + int 21h ; + +sample endp +_TEXT ends + +;*------------------------------- Data ---------------------------------* + +_DATA segment word public 'DATA' + +Count dd 2000h + +_DATA ends + + end sample + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/VITD b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/VITD new file mode 100644 index 00000000..6ff8802d --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/VITD @@ -0,0 +1,23 @@ +# sample make file for building vitd virtual device for Microsoft Windows + +# comment this definition out with a "#", if building a non-debugging version +Debug=-DDEBUG + +all : VITD.386 + +.asm.obj: + masm5 -p -w2 -Mx $(Debug) -I..\include $*; + +.asm.lst: + masm5 -l -p -w2 -Mx $(Debug) -I..\include $*; + + +vitd.obj : vitd.asm ..\include\debug.inc ..\include\vmm.inc + + +OBJS = vitd.obj + +vitd.386: vitd.def $(OBJS) + link386 @vitd.lnk + addhdr vitd.386 + mapsym32 vitd diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/VITD.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/VITD.ASM new file mode 100644 index 00000000..13d6df54 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/VITD.ASM @@ -0,0 +1,622 @@ +PAGE 58,132 +;****************************************************************************** +TITLE VITD - Virtual Interval Timer +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1991 +; +; Title: VITD.ASM - Virtual Interval Timer +; +; Version: 3.00 +; +; Date: 10-Jan-1991 +; +; Author: Neil Sandlin +; +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; +;============================================================================== + + .386p + +;****************************************************************************** +; I N C L U D E S +;****************************************************************************** + + .XLIST + INCLUDE VMM.Inc + INCLUDE Debug.Inc + INCLUDE VTD.Inc + INCLUDE ITIMER.Inc + .LIST + +;****************************************************************************** +; V I R T U A L D E V I C E D E C L A R A T I O N +;****************************************************************************** + +Declare_Virtual_Device VITD, 3, 0, VITD_Control, Undefined_Device_ID ,,, + + +;****************************************************************************** +; I N I T D A T A +;****************************************************************************** + + +VXD_IDATA_SEG + +Begin_VxD_IO_Table VITD_IO_Table + VxD_IO ITIMER_Count, VITD_Count + VxD_IO ITIMER_State, VITD_State +End_VxD_IO_Table VITD_IO_Table + + +VXD_IDATA_ENDS + + +;****************************************************************************** +; L O C A L D A T A +;****************************************************************************** + + +VITD_CB_DATA STRUC + +Timeout_Handle dd ? +Timeout_Start dd ? +Initial_Count dd ? +Current_Count dd ? +Access_byte db ? +Timer_State db ? + +VITD_CB_DATA ENDS + + +VxD_LOCKED_DATA_SEG + +VITD_CB_Offset dd 0 +VITD_VMM_Min dd ? + +VxD_LOCKED_DATA_ENDS + + + + +;****************************************************************************** +; I N I T I A L I Z A T I O N C O D E +;****************************************************************************** + +VxD_ICODE_SEG + + +;****************************************************************************** +; +; VITD_Sys_Crit_Init +; +; DESCRIPTION: +; +; This routine allocates space in the VM control block area for +; VM specific variables. +; +; ENTRY: +; +; EBX = Current VM Handle +; +; +;============================================================================== + +BeginProc VITD_Sys_Crit_Init + + push ebx + VMMCall _Allocate_Device_CB_Area, <, 0> + test eax, eax + jnz SHORT VITD_CB_OK +IFDEF DEBUG + Debug_Out "VITD: Allocate_Device_CB_Area failed" +ENDIF + VMMCall Fatal_Memory_Error + +VITD_CB_OK: + mov [VITD_CB_Offset], eax + pop ebx + + clc + ret + + +EndProc VITD_Sys_Crit_Init + + +;****************************************************************************** +; +; VITD_Device_Init +; +; DESCRIPTION: +; +; This routine installs the I/O handlers for the virtual timer +; hardware. +; +; ENTRY: +; +; EBX = Current VM Handle +; +;============================================================================== + +BeginProc VITD_Device_Init + + VxDCall VTD_Get_Version + VxDCall VTD_Get_Interrupt_Period + +IFDEF DEBUG + Trace_Out "VITD installed" + Trace_Out "Current interrupt rate=#EAX msecs. Min=#EBX, Max=#ECX" +ENDIF + + mov VITD_VMM_Min, ebx ; save minimum interval + mov edi, OFFSET32 VITD_IO_Table + VMMCall Install_Mult_IO_Handlers + jnc SHORT DI_ok1 + Trace_Out "VITD ERROR: installed only #ECX I/O handlers" +DI_ok1: + + clc + ret + +EndProc VITD_Device_Init + +VxD_ICODE_ENDS + + +VxD_CODE_SEG + +;****************************************************************************** +; +; VITD_Create_VM +; +; DESCRIPTION: +; +; This routine initializes the virtual timer registers. +; +; ENTRY: +; +; EBX = Current VM Handle +; +;============================================================================== + +BeginProc VITD_Create_VM + + mov edi, ebx ; vm block + add edi, [VITD_CB_Offset] ; point to our area + mov [edi.Access_Byte], 0 ; initialize + mov [edi.Timer_State], ITIMER_STOPPED ; initial state + + clc + ret + +EndProc VITD_Create_VM + + +;****************************************************************************** +; +; VITD_Destroy_VM +; +; DESCRIPTION: +; +; This routine has to cancel potential events on a destroyed VM. +; +; ENTRY: +; +; EBX = Current VM Handle +; +;============================================================================== + +BeginProc VITD_Destroy_VM + + mov edi, ebx ; vm block + add edi, [VITD_CB_Offset] ; point to our area + call VITD_Cancel ; cancel pending event, if any + +vdm_exit: + clc + ret + +EndProc VITD_Destroy_VM + +VxD_CODE_ENDS + + +;****************************************************************************** + +VxD_LOCKED_CODE_SEG + +;****************************************************************************** +; +; VITD_Control +; +; DESCRIPTION: +; +; This is a call-back routine to handle the messages that are sent +; to VxD's to control system operation. +; +; ENTRY: +; +; EBX = Current VM Handle +; +;============================================================================== + +BeginProc VITD_Control + + Control_Dispatch Sys_Critical_Init, VITD_Sys_Crit_Init + Control_Dispatch Device_Init, VITD_Device_Init + Control_Dispatch Destroy_VM, VITD_Destroy_VM + Control_Dispatch Create_VM, VITD_Create_VM + clc + ret + +EndProc VITD_Control + +VxD_LOCKED_CODE_ENDS + + + +VxD_CODE_SEG + +;****************************************************************************** +; +; VITD_Count +; +; DESCRIPTION: +; +; This routine handles byte I/O to the virtual count register. +; The basic algorithm is as follows: +; +; if I/O is a read ( IN al,countport ) +; get access byte +; if Timer is active and reading first byte +; decrement count by elapsed time +; return Current_Count[access_byte] +; +; else if I/O is a write ( OUT countport,al ) +; get access byte +; if Timer NOT active +; save Count[access_byte] +; +; ENTRY: +; +; EBX = Current VM Handle +; ECX = Type of I/O +; EDX = Port number +; EBP-> Client register structure +; +;****************************************************************************** + + +BeginProc VITD_Count + + mov edi, ebx ; vm block + add edi, [VITD_CB_Offset] ; point to our area + + Dispatch_Byte_IO Fall_Through, + +;--------------------------------------------------------------------- +; Handle Read Count Port +;--------------------------------------------------------------------- + call Update_Access_Byte ; load ECX with index + + or ecx, ecx ; first byte? + jnz SHORT vitc_no_adjust + test [edi.Timer_State], ITIMER_RUNNING ; timer pending? + jz SHORT vitc_no_adjust ; no, don't update + + VMMCall Get_VM_Exec_Time ; get current time + sub eax, [edi.Timeout_Start] ; now have elapsed time + mov ebx, [edi.Initial_Count] ; get original count + sub ebx, eax ; now have new count + mov [edi.Current_Count], ebx ; save it for output + +vitc_no_adjust: + mov eax, [edi.Current_Count] ; get entire count + shl ecx, 3 ; multipy index by 8 + shr eax, cl ; now have byte in al + ret + +;--------------------------------------------------------------------- +; Handle Write Count Port +;--------------------------------------------------------------------- +vitc_Out: + call Update_Access_Byte ; load ECX with index + test [edi.Timer_State], ITIMER_RUNNING ; timer pending? + jnz SHORT vitc_ro ; yes, count is R/O + mov BYTE PTR [edi.Initial_Count+ecx], al ; save count + mov BYTE PTR [edi.Current_Count+ecx], al ; save count +vitc_ro: + ret + + +EndProc VITD_Count + + +;****************************************************************************** +; +; Update_Access_Byte +; +; DESCRIPTION: +; +; When a VM does I/O to the virtual count register, it has to +; do it a byte at a time. This routine updates the byte index +; into the 4 byte register, so that each byte I/O accesses the +; next byte. The register is programmed starting from the lowest +; significant byte to the highest. +; +; +; ENTRY: +; +; +;****************************************************************************** + +BeginProc Update_Access_Byte + movzx ecx, [edi.Access_Byte] ; get byte to retrieve + cmp ecx, 3 ; will increment wrap? + jb SHORT vitc_go1 ; no + mov [edi.Access_Byte], 0 ; initialize + jmp SHORT vitc_go2 ; no +vitc_go1: + inc [edi.Access_Byte] ; for next time +vitc_go2: + ret + +EndProc Update_Access_Byte + + + +;****************************************************************************** +; +; VITD_State +; +; DESCRIPTION: +; +; This routine handles byte I/O to the virtual state register. +; The basic algorithm is as follows: +; +; if I/O is a read ( IN al,stateport ) +; return State +; +; else if I/O is a write ( OUT stateport,al ) +; if Timer_Start requested +; if Timer NOT running +; save new state +; if Enhanced requested +; Start enhanced VMM state +; Set up VM Timeout +; save handle and start time +; +; else /* Timer Stop requested */ +; if Timer running +; Cancel previous timer request +; save new state +; +; +; ENTRY: +; +; EBX = Current VM Handle +; ECX = Type of I/O +; EDX = Port number +; EBP-> Client register structure +; +;****************************************************************************** + + +BeginProc VITD_State + + mov edi, ebx ; vm block + add edi, [VITD_CB_Offset] ; point to our area + + + Dispatch_Byte_IO Fall_Through, +;--------------------------------------------------------------------- +; Handle Read State port +;--------------------------------------------------------------------- + movzx eax, [edi.Timer_State] ; get state + ret + +vits_Out: +;--------------------------------------------------------------------- +; Handle Write State port +;--------------------------------------------------------------------- + test eax, ITIMER_RUNNING ; Start timer request? + jz SHORT vits_stop_timer ; no + test [edi.Timer_State], ITIMER_RUNNING ; timer pending? + jnz SHORT vits_exit ; yes, state is R/O + + mov [edi.Timer_State], al ; save state + + test eax, ITIMER_ENHANCED ; going for accuracy? + jz SHORT vits_noenh ; no + mov eax, VITD_VMM_Min ; get minimum + VxDCall VTD_Begin_Min_Int_Period ; ok, here we go + +vits_noenh: + mov eax, [edi.Initial_Count] ; get msecs to wait + mov esi, OFFSET32 VITD_Timeout_Proc + xor edx, edx ; ref data + VMMCall Set_VM_Time_Out ; start timer running + or esi, esi ; was timeout not scheduled? + jz SHORT vits_abort ; hmmm... + mov [edi.Timeout_Handle], esi ; save handle + + VMMCall Get_VM_Exec_Time ; remember the start + mov [edi.Timeout_Start], eax ; for later + +IFDEF DEBUG + VxDCall VTD_Get_Interrupt_Period + Trace_Out "VITD Start: VM=#EBX, rate=#EAX msecs" +ENDIF + +vits_exit: + ret + +vits_abort: + mov [edi.Timer_State], ITIMER_ERROR ; woops... + ret + +vits_stop_timer: + test [edi.Timer_State], ITIMER_RUNNING ; timer pending? + jz SHORT vits_svst ; no event to cancel + call VITD_Cancel ; cancel pending event, if any +vits_svst: + mov [edi.Timer_State], al ; save new state + ret + + +EndProc VITD_State + + + +;****************************************************************************** +; +; VITD_Cancel +; +; DESCRIPTION: +; +; This routine will cancel a previous Timeout request made, if any. +; It is called if the VM stops the timer manually, or if the VM +; is destroyed. +; +; ENTRY: +; +; EBX = Current VM Handle +; EDI-> VITD CB area +; +;****************************************************************************** + + +BeginProc VITD_Cancel + + test [edi.Timer_State], ITIMER_RUNNING ; timer pending? + jz SHORT vcnl_exit ; no + mov esi, [edi.Timeout_Handle] ; get handle + VMMCall Cancel_Time_Out ; cancel it + test [edi.Timer_State], ITIMER_ENHANCED ; going for accuracy? + jz SHORT vcnl_exit ; no + mov eax, VITD_VMM_Min ; get minimum + VxDCall VTD_End_Min_Int_Period ; cancel min int + +vcnl_exit: + +IFDEF DEBUG + VxDCall VTD_Get_Interrupt_Period + Trace_Out "VITD Cancel: VM=#EBX, rate=#EAX msecs" +ENDIF + ret + + +EndProc VITD_Cancel + + +;****************************************************************************** +; +; VITD_Timeout_Proc +; +; DESCRIPTION: +; +; This routine is called by VMM when the requested time has +; elapsed in the virtual machine. The routine cancels the enhanced +; interval period, if it was in effect, updates the count, and +; queues an event to call VITD_Reflect_Int. Most likely, the +; Reflect_Int routine will be called immediately, because we +; are already in the VM we want. But, to be safe, the routine +; will not be called until the VM has enabled for interrupts +; and is not in a critical section. +; +; ENTRY: +; +; EBX = current VM (VM time-out was scheduled for) +; ECX = Number of EXTRA milleseconds that have elapsed +; EDX = Reference Data (0) +; EBP-> Client register structure +; +;****************************************************************************** + + +BeginProc VITD_Timeout_Proc + + + mov edi, ebx ; vm block + add edi, [VITD_CB_Offset] ; point to our area + + test [edi.Timer_State], ITIMER_ENHANCED ; going for accuracy? + jz SHORT vtmo_noenh ; no + mov eax, VITD_VMM_Min ; get minimum + VxDCall VTD_End_Min_Int_Period ; cancel min int + +vtmo_noenh: + xor eax, eax ; clear + sub eax, ecx ; now has overrun count + mov [edi.Current_Count], eax ; save here + + test [edi.Timer_State], ITIMER_NO_RUPT ; test to send rupt? + mov [edi.Timer_State], ITIMER_STOPPED ; and clear state + jnz SHORT vtmo_norupt ; no rupt needed + + xor eax, eax ; no boost + mov ecx, PEF_Wait_For_STI or PEF_Wait_Not_Crit ; better wait + mov edx, edi ; pointer to CB area + mov esi, OFFSET32 VITD_Reflect_Int + VMMCall Call_Priority_VM_Event ; do it + +vtmo_norupt: +IFDEF DEBUG + VxDCall VTD_Get_Interrupt_Period + Trace_Out "VITD Stop: VM=#EBX, rate=#EAX msecs" +ENDIF + ret + +EndProc VITD_Timeout_Proc + + + +;****************************************************************************** +; +; VITD_Reflect_Int +; +; DESCRIPTION: +; +; This routine is called to simulate an interval timer interrupt +; into the current VM. +; +; ENTRY: +; +; EBX = current VM (VM time-out was scheduled for) +; EDX-> VITD CB area +; EBP-> Client register structure +; +;****************************************************************************** + + +BeginProc VITD_Reflect_Int + + + mov edi, edx ; our CB area + + VMMCall Begin_Nest_Exec ; ready to call VM + mov eax, ITIMER_VECTOR ; get interrupt vector + VMMCall Exec_Int ; reflect + VMMCall End_Nest_Exec ; that's it + + ret + +EndProc VITD_Reflect_Int + + + +VxD_CODE_ENDS + + + + END + + \ No newline at end of file diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/VITD.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/VITD.DEF new file mode 100644 index 00000000..bb844353 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/VITD.DEF @@ -0,0 +1,18 @@ +; (C) Copyright MICROSOFT Corp., 1991 + +LIBRARY VITD + +DESCRIPTION 'VITD Sample VxD for Microsoft Windows' + +EXETYPE DEV386 + +SEGMENTS + _LTEXT PRELOAD NONDISCARDABLE + _LDATA PRELOAD NONDISCARDABLE + _ITEXT CLASS 'ICODE' DISCARDABLE + _IDATA CLASS 'ICODE' DISCARDABLE + _TEXT CLASS 'PCODE' NONDISCARDABLE + _DATA CLASS 'PCODE' NONDISCARDABLE + +EXPORTS + VITD_DDB @1 diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/VITD.LNK b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/VITD.LNK new file mode 100644 index 00000000..ac416f88 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VITD/VITD.LNK @@ -0,0 +1,5 @@ +vitd.obj +vitd.386 /NOI /NOD /NOP +vitd.map /MAP + +vitd.def diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/README.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/README.TXT new file mode 100644 index 00000000..6c5198ce --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/README.TXT @@ -0,0 +1,19 @@ + +VKXD.386 + +This is a tiny little VxD that lets you use F9 as the alt-enter +combination. To install it, put the file VKXD.386 in your Windows +SYSTEM directory, and add the following line in the [386enh] section +of your SYSTEM.INI: + + device=VKXD.386 + +Restart Windows and Voila! The F9 key will switch your DOS applications +from full-screen to windowed mode. + +Note: Under Windows version 3.1, the ALT-ENTER keypress sequence will +cause actions to be taken that did not happen in 3.0 (eg: in the Program +Manager, pressing ALT-ENTER when a program icon is selected will bring up +the "program item properties" dialog box). This VxD is given +as an example, and is not intended to be a "perfect" implementation of +a window to full-screen toggle key. diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/VKXD b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/VKXD new file mode 100644 index 00000000..4a91d5df --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/VKXD @@ -0,0 +1,25 @@ +# sample make file for building vkxd virtual device for Microsoft Windows + +# comment this definition out with a "#", if building a non-debugging version +Debug=-DDEBUG + +all : VKXD.386 + +.asm.obj: + masm5 -p -w2 -Mx $(Debug) -I..\include $*; + +.asm.lst: + masm5 -l -p -w2 -Mx $(Debug) -I..\include $*; + + +vkxd.obj : vkxd.asm ..\include\vkd.inc \ + ..\include\debug.inc \ + ..\include\vmm.inc + + +OBJS = vkxd.obj + +vkxd.386: vkxd.def $(OBJS) + link386 @vkxd.lnk + addhdr vkxd.386 + mapsym32 vkxd diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/VKXD.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/VKXD.ASM new file mode 100644 index 00000000..246ebaae --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/VKXD.ASM @@ -0,0 +1,185 @@ +PAGE 58,132 +;****************************************************************************** +TITLE VKXD - Virtual Keyboard Device +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1990-1991 +; +; Title: VKXD.ASM - Virtual Keyboard Extension Device +; +; Version: 3.00 +; +; Date: 8-Oct-1990 +; +; Author: Neil Sandlin +; +; This is a tiny little VxD to let you hit a function key and get the +; same effect as hitting "alt-enter" +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; 15-Apr-1991 bjm Added Cancel_Hot_Key_State in case of scanning normal +; keys. ALT-ENTER was a special case because it is also +; a hot key. Without Cancel_Hot_Key_State, normal keys +; would not be forced into a VM. +; +;============================================================================== + + .386p + +;****************************************************************************** +; I N C L U D E S +;****************************************************************************** + + .XLIST + INCLUDE VMM.Inc + INCLUDE Debug.Inc + INCLUDE VKD.Inc + .LIST + +Scan_F9 EQU 43h ; scan code for the "F9" key + +;****************************************************************************** +; V I R T U A L D E V I C E D E C L A R A T I O N +;****************************************************************************** + +Declare_Virtual_Device VKXD, 3, 0, VKXD_Control, Undefined_Device_ID ,,, + + +;****************************************************************************** +; L O C A L D A T A +;****************************************************************************** + +VxD_LOCKED_DATA_SEG + + ; Scan codes +VKXD_Buffer db 038h ; alt (down) + db 01ch ; enter (down) + db 09ch ; enter (up) + db 0b8h ; alt (up) +VKXD_Buffer_Len equ $-VKXD_Buffer + +VxD_LOCKED_DATA_ENDS + + + + +;****************************************************************************** +; I N I T I A L I Z A T I O N C O D E +;****************************************************************************** + +VxD_ICODE_SEG + + +;****************************************************************************** +; +; VKXD_Device_Init +; +; DESCRIPTION: +; +; This routine sets up the hot key call-back. +; +; +;============================================================================== + +BeginProc VKXD_Device_Init +IFDEF DEBUG + Trace_Out "VKXD installed" +ENDIF + + mov ax, Scan_F9 ; Hot key: scan code for F9 + mov ebx,0 ; shift state: don't care + mov esi, OFFSET32 VKXD_HK_Handler ; address of our handler + mov cl, CallOnPress ; call when hot key is released + mov edx, 1 ; reference data - arbitrary + VxDCall VKD_Define_Hot_Key ; set up hot key + + clc + ret +EndProc VKXD_Device_Init + +VxD_ICODE_ENDS + + + +;****************************************************************************** + +VxD_LOCKED_CODE_SEG + +;****************************************************************************** +; +; VKXD_Control +; +; DESCRIPTION: +; +; This is a call-back routine to handle the messages that are sent +; to VxD's to control system operation. +; +; +;============================================================================== + +BeginProc VKXD_Control + + Control_Dispatch Device_Init, VKXD_Device_Init + clc + ret + +EndProc VKXD_Control + +VxD_LOCKED_CODE_ENDS + + + +VxD_CODE_SEG + +;****************************************************************************** +; +; VKXD_HK_Handler +; +; DESCRIPTION: +; +; This routine is called when the hot key is pressed. Its only +; function is to call VKD_Force_Keys to simulate an alt-enter. +; +; ENTRY: +; +; AL = scan code of key +; AH = 0, if key just pressed (Hot_Key_Pressed) +; = 1, if key just released (Hot_Key_Released) +; = 2, if key is an auto-repeat press (Hot_Key_Repeated) +; = 3, hot key state ended (Hot_Key_Completed) +; EBX is hot key handle +; ECX = global shift state +; EDX is reference data +; EDI = elapsed time for delayed notification (milliseconds) +; (normally 0, but if PriorityNotify is specified +; then this value could be larger) +; +;****************************************************************************** +BeginProc VKXD_HK_Handler + + VxDCall VKD_Cancel_Hot_Key_State ; turn off hotkey mode + + mov ecx,VKXD_Buffer_Len + lea esi,VKXD_Buffer ; scan codes + VxDCall VKD_Force_Keys ; send to VM + +IFDEF DEBUG + jnc SHORT kbd_ok + Trace_Out "VKXD: VKD force key error" +kbd_ok: +ENDIF + + clc + ret + +EndProc VKXD_HK_Handler + +VxD_CODE_ENDS + + + END diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/VKXD.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/VKXD.DEF new file mode 100644 index 00000000..df908154 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/VKXD.DEF @@ -0,0 +1,19 @@ +; (C) Copyright MICROSOFT Corp., 1991 +; +LIBRARY VKXD + +DESCRIPTION 'VKXD Sample VxD for Microsoft Windows' + +EXETYPE DEV386 + +SEGMENTS + _LTEXT PRELOAD NONDISCARDABLE + _LDATA PRELOAD NONDISCARDABLE + _ITEXT CLASS 'ICODE' DISCARDABLE + _IDATA CLASS 'ICODE' DISCARDABLE + _TEXT CLASS 'PCODE' NONDISCARDABLE + _DATA CLASS 'PCODE' NONDISCARDABLE + +EXPORTS + VKXD_DDB @1 + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/VKXD.LNK b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/VKXD.LNK new file mode 100644 index 00000000..69acf83a --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VKXD/VKXD.LNK @@ -0,0 +1,6 @@ +vkxd.obj +vkxd.386 /NOI /NOD /NOP +vkxd.map /MAP + +vkxd.def + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/README.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/README.TXT new file mode 100644 index 00000000..cbb61b4a --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/README.TXT @@ -0,0 +1,20 @@ + +VMIOD + +This VxD displays data going in and out of a specified I/O port. +You have to have a secondary monitor on your system to use this +VxD. To install this, you need to put the following lines in +the [386Enh] section of your SYSTEM.INI file: + +DebugMono=TRUE +VMIOD_Port=nnnn +device=vmiod.386 + +where nnnn is the hex I/O port number to monitor. + +The technique use will only work for UNTRAPPED I/O ports. Most of +the hardware devices that Windows knows about (keyboard, timer, +video) are trapped ports, and thus can not be monitored by this +VxD. But for a simple demonstration of this program, try 3F5, a +floppy controller port. This port was untrapped in the retail +release of Windows 3.0 and 3.1. diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD new file mode 100644 index 00000000..3781a04b --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD @@ -0,0 +1,23 @@ +# sample make file for building vmiod virtual device for Windows + +# comment this definition out with a "#", if building a non-debugging version +Debug=-DDEBUG + +all : vmiod.386 + +.asm.obj: + masm5 -p -w2 -Mx $(Debug) -I..\include $*; + +.asm.lst: + masm5 -l -p -w2 -Mx $(Debug) -I..\include $*; + + +vmiod.obj : vmiod.asm vmiod.inc ..\include\debug.inc ..\include\vmm.inc + + +OBJS = vmiod.obj + +vmiod.386: vmiod.def $(OBJS) + link386 @vmiod.lnk + addhdr vmiod.386 + mapsym32 vmiod diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD.ASM new file mode 100644 index 00000000..27f884ac --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD.ASM @@ -0,0 +1,317 @@ +PAGE 58,132 +;****************************************************************************** +TITLE VMIOD - Virtual Device +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1992 +; +; Title: VMIOD.ASM - Virtual Device +; +; Version: 3.10 +; +; Date: 10-Mar-1992 +; +; Author: Neil Sandlin +; +; Description: +; This VxD demonstrates calling the Install_IO_Handler service. +; Although most VxDs that use this service are designed to virtualize +; the I/O port, this VxD will only write to a secondary monitor to +; display the activity on the port. +; +; THE SYSTEM WILL ONLY ALLOW ONE IO HANDLER PER PORT. What this +; means is that you can't install an I/O handler on a port that +; is already trapped in the system. +; +; This VxD only demonstrates I/O port trapping, NOT IRQ handling. +; See the VMIRQD VxD sample for more information about working +; with IRQs. +; +; NOTE: This VxD uses the Debug Monitor support that was added +; in Windows 3.1. You must have a secondary monitor in your system +; to see the effects of this VxD. To enable this support, put +; DebugMono=TRUE in your system.ini. +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; +;============================================================================== + + .386p + +;****************************************************************************** +; I N C L U D E S +;****************************************************************************** + + .XLIST + INCLUDE VMM.Inc + INCLUDE Debug.Inc + INCLUDE VMIOD.Inc + .LIST + + +;****************************************************************************** +; V I R T U A L D E V I C E D E C L A R A T I O N +;****************************************************************************** + +Declare_Virtual_Device VMIOD, 3, 0ah, VMIOD_Control, VMIOD_Dev_ID ,,, + + +;****************************************************************************** +; L O C A L D A T A +;****************************************************************************** + +VxD_LOCKED_DATA_SEG + +VMIOD_Port dd 0 +instring db " in #DX, #AL",0 +outstring db " out #AL, #DX",0 + +FirstMonoLine equ 2 +LastMonoLine equ 23 +CurrentLine db ? + +BlankPointer db " ",0 +NewLine db "---> ",0 + +VxD_LOCKED_DATA_ENDS + + + + +;****************************************************************************** +; I N I T I A L I Z A T I O N +;****************************************************************************** + +VxD_IDATA_SEG + +VMIOD_Ini_String db 'VMIOD_Port',0 + +VxD_IDATA_ENDS + +VxD_ICODE_SEG + + +;****************************************************************************** +; +; VMIOD_Device_Init +; +; DESCRIPTION: +; This routine installs our I/O port handler. +; +; +;============================================================================== + +BeginProc VMIOD_Device_Init + + call Mon_Init ; init secondary monitor + jc short diexit + + xor eax, eax ; zero default port + mov edi, OFFSET32 VMIOD_Ini_String + xor esi, esi ; [386enh] section + VMMCall Get_Profile_Hex_Int ; get defined port + mov [VMIOD_Port], eax ; save it + or eax,eax ; anything specified? + jz SHORT No_Port +; +; hook the port to watch +; + mov edx, eax ; port number + mov esi, OFFSET32 VMIOD_Trap ; address of our handler + VMMCall Install_IO_Handler + +IFDEF DEBUG + jc short bad_port + + mov eax, [VMIOD_Port] + Trace_Out "VMIOD: Installed on port #AX" + jmp short diexit +bad_port: + mov eax, [VMIOD_Port] + Trace_Out "VMIOD: Error installing on port #AX" + jmp short diexit +ENDIF + +No_Port: +IFDEF DEBUG + Trace_Out "VMIOD: No VMIOD_Port= specified in SYSTEM.INI" +ENDIF + +diexit: + + clc + ret +EndProc VMIOD_Device_Init + +VxD_ICODE_ENDS + + +;****************************************************************************** + +VxD_LOCKED_CODE_SEG + +;****************************************************************************** +; +; VMIOD_Control +; +; +;============================================================================== + +BeginProc VMIOD_Control + + Control_Dispatch Device_Init, VMIOD_Device_Init + clc + ret + +EndProc VMIOD_Control + +VxD_LOCKED_CODE_ENDS + + + +VxD_CODE_SEG + + +;****************************************************************************** +; +; VMIOD_Trap +; +; DESCRIPTION: +; This is the actual I/O handler for the port. There is no +; virtualization done, it just monitors what is read and written +; to the port. +; +;============================================================================== + +BeginProc VMIOD_Trap + + Dispatch_Byte_IO Fall_Through, + + in al,dx ; perform real I/O + + push esi + mov esi, OFFSET32 instring + call Mon_Out_String ; display + pop esi + ret + +VMIOD_Out_Handler: + + push esi + mov esi, OFFSET32 outstring + call Mon_Out_String ; display + pop esi + + out dx,al ; perform real I/O + + ret + +EndProc VMIOD_Trap + + +VxD_CODE_ENDS + + + +;****************************************************************************** +;****************************************************************************** +; +; Monitor Display Routines +; +;****************************************************************************** + +VxD_ICODE_SEG +;****************************************************************************** +; +; Mon_Init +; +; +;============================================================================== + +BeginProc Mon_Init + + + VMMCall Clear_Mono_Screen + jz short mon_init_error + + Mono_Out_At 0, 0, " VMIOD - I/O monitor " + Mono_Out_At 1, 0, " --------------------------------------------------------------------------- " + + mov byte ptr [CurrentLine], 2 + + clc + ret + +mon_init_error: + stc + ret + +EndProc Mon_Init + + +VxD_ICODE_ENDS + + +VxD_LOCKED_CODE_SEG + +;****************************************************************************** +; +; Mon_Out_String +; +; +; ENTRY: +; ESI - offset of string +; +; +;============================================================================== + +BeginProc Mon_Out_String + + pushad + + push esi ;save output string + push eax + push edx + + movzx edx, [CurrentLine] + shl edx, 8 ;column zero + VMMCall Set_Mono_Cur_Pos + mov esi, OFFSET32 BlankPointer + VMMCall Out_Mono_String + + movzx edx, [CurrentLine] ;update line pointer + inc edx + cmp edx, LastMonoLine ;too far? + jb short moc_ok + mov edx, FirstMonoLine +moc_ok: + mov [CurrentLine], dl + shl edx, 8 + VMMCall Set_Mono_Cur_Pos + + mov esi, OFFSET32 NewLine ;set up new line + VMMCall Out_Mono_String + + mov dh, [CurrentLine] + mov dl, 5 ;column 5 + VMMCall Set_Mono_Cur_Pos + + pop edx + pop eax + pop esi ;write new string + VMMCall Out_Mono_String + + popad + ret + +EndProc Mon_Out_String + +VxD_LOCKED_CODE_ENDS + + END + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD.DEF new file mode 100644 index 00000000..ed06f21b --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD.DEF @@ -0,0 +1,17 @@ +LIBRARY VMIOD + +DESCRIPTION 'VMIOD Sample VxD for Microsoft Windows' + +EXETYPE DEV386 + +SEGMENTS + _LTEXT PRELOAD NONDISCARDABLE + _LDATA PRELOAD NONDISCARDABLE + _ITEXT CLASS 'ICODE' DISCARDABLE + _IDATA CLASS 'ICODE' DISCARDABLE + _TEXT CLASS 'PCODE' NONDISCARDABLE + _DATA CLASS 'PCODE' NONDISCARDABLE + +EXPORTS + VMIOD_DDB @1 + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD.INC b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD.INC new file mode 100644 index 00000000..1b306da2 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD.INC @@ -0,0 +1,27 @@ +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1992 +; +; Title: VMIOD.INC +; +; Version: 3.10 +; +; Date: +; +; Author: +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; 10-Mar-92 bjm New device ID. +;============================================================================== + +; +; This is the virtual device ID for this VxD. It is a unique number assigned +; to this device. For more information on VxD IDs, please see the VXDID.TXT +; file. +; +VMIOD_Dev_ID equ 7febh diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD.LNK b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD.LNK new file mode 100644 index 00000000..ab4d3a64 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIOD/VMIOD.LNK @@ -0,0 +1,6 @@ +vmiod.obj +vmiod.386 /NOI /NOD /NOP +vmiod.map /MAP + +vmiod.def + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/README.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/README.TXT new file mode 100644 index 00000000..2db87519 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/README.TXT @@ -0,0 +1,21 @@ + +VMIRQD + +This VxD demonstrates the virtualizing of a hardware interrupt (IRQ). +You have to have a secondary monitor on your system to use this +VxD. To install this, you need to put the following lines in +your SYSTEM.INI file: + + +DebugMono=TRUE +VMIRQD_IRQ=x +device=vmirqd.386 + +where nnnn is the IRQ number to monitor. + +The technique use will only work for UNVIRTUALIZED IRQs. Most of +the hardware interrupts that Windows knows about (keyboard, timer, +mouse) use IRQs that are already virtualized, and thus can not be +monitored by this VxD. But for a simple demonstration of this +program, try IRQ 6, the floppy controller IRQ. This IRQ was +not virtualized in the retail release of Windows 3.0 and 3.1. diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD new file mode 100644 index 00000000..2589c9f2 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD @@ -0,0 +1,26 @@ +# sample make file for building vmirqd virtual device for Windows + +# comment this definition out with a "#", if building a non-debugging version +Debug=-DDEBUG + +all : vmirqd.386 + +.asm.obj: + masm5 -p -w2 -Mx $(Debug) -I..\include $*; + +.asm.lst: + masm5 -l -p -w2 -Mx $(Debug) -I..\include $*; + + +vmirqd.obj : vmirqd.asm vmirqd.inc \ + ..\include\vpicd.inc \ + ..\include\debug.inc \ + ..\include\vmm.inc + +OBJS = vmirqd.obj + +vmirqd.386: vmirqd.def $(OBJS) + link386 @vmirqd.lnk + addhdr vmirqd.386 + mapsym32 vmirqd + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD.ASM new file mode 100644 index 00000000..e6305a9c --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD.ASM @@ -0,0 +1,404 @@ +PAGE 58,132 +;****************************************************************************** +TITLE VMIRQD - Virtual Device +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1992 +; +; Title: VMIRQD.ASM - Virtual Device +; +; Version: 3.10 +; +; Date: 10-Mar-1992 +; +; Author: Neil Sandlin +; +; Description: +; This VxD demonstrates calling the VPICD_Virtualize_IRQ service. +; Although most VxDs that use this service are designed to only +; arbitrate the handling of the interrupt, this VxD will write +; to a secondary monitor to display the activity on the IRQ. +; +; THE SYSTEM WILL ONLY ALLOW ONE IRQ HANDLER PER IRQ. What this +; means is that you can't virtualize an IRQ that is already +; virtualized in the system. +; +; This VxD only demonstrates IRQ virtualization, NOT I/O port +; trapping. See the VMIOD VxD sample for more information about +; working with I/O port trapping. +; +; NOTE: This VxD uses the Debug Monitor support that was added +; in Windows 3.1. You must have a secondary monitor in your system +; to see the effects of this VxD. To enable this support, put +; DebugMono=TRUE in your system.ini. +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; +;============================================================================== + + .386p + +;****************************************************************************** +; I N C L U D E S +;****************************************************************************** + + .XLIST + INCLUDE VMM.Inc + INCLUDE Debug.Inc + INCLUDE VPICD.Inc + INCLUDE VMIRQD.Inc + .LIST + + +;****************************************************************************** +; V I R T U A L D E V I C E D E C L A R A T I O N +;****************************************************************************** + +Declare_Virtual_Device VMIRQD, 3, 0ah, VMIRQD_Control, VMIRQD_Dev_ID ,,, + + +;****************************************************************************** +; L O C A L D A T A +;****************************************************************************** + +VxD_LOCKED_DATA_SEG + +VMIRQD_IRQ_Handle dd ? +VMIRQD_IRQ db ? + + +FirstMonoLine equ 2 +LastMonoLine equ 23 +CurrentLine db ? + +vstring db "Virtual interrupt reflected",0 +rstring db "IRET executed",0 +mstring db "Mask change",0 +istring db "Physical Interrupt",0 +estring db "EOI issued" + +BlankPointer db " ",0 +NewLine db "---> ",0 + +VxD_LOCKED_DATA_ENDS + + + + +;****************************************************************************** +; I N I T I A L I Z A T I O N +;****************************************************************************** + +VxD_IDATA_SEG + +VMIRQD_Ini_String db 'VMIRQD_IRQ',0 + + +VMIRQD_IRQ_Desc VPICD_IRQ_Descriptor + +VxD_IDATA_ENDS + +VxD_ICODE_SEG + + +;****************************************************************************** +; +; VMIRQD_Device_Init +; +; DESCRIPTION: +; This routine will virtualize the IRQ specified in the SYSTEM.INI +; string VMIRQD_IRQ=x. +; +;============================================================================== + +BeginProc VMIRQD_Device_Init + + call Mon_Init ; init secondary monitor + jc short diexit + + mov eax, -1 ; default IRQ + mov edi, OFFSET32 VMIRQD_Ini_String + xor esi, esi ; [386enh] section + VMMCall Get_Profile_Decimal_Int ; get defined IRQ + mov BYTE PTR [VMIRQD_IRQ], al ; save it + cmp eax, -1 ; anything specified? + jz SHORT No_Irq + + mov edi, OFFSET32 VMIRQD_IRQ_Desc ; point to vpicd struct + mov [edi.VID_IRQ_Number], ax ; save it here + VxDCall VPICD_Virtualize_IRQ ; set up callbacks + + +IFDEF DEBUG + jc short bad_irq + + mov al, [VMIRQD_IRQ] + Trace_Out "VMIRQD: Installed on IRQ #AL" + jmp short diexit +bad_irq: + mov al, [VMIRQD_IRQ] + Trace_Out "VMIRQD: Error installing on IRQ #AL" + jmp short diexit +ENDIF + + +No_Irq: +IFDEF DEBUG + Trace_Out "VMIRQD: No VMIRQD_IRQ= specified in SYSTEM.INI" +ENDIF + +diexit: + clc + ret +EndProc VMIRQD_Device_Init + + +VxD_ICODE_ENDS + + + +;****************************************************************************** + +VxD_LOCKED_CODE_SEG + +;****************************************************************************** +; +; VMIRQD_Control +; +; +;============================================================================== + +BeginProc VMIRQD_Control + + Control_Dispatch Device_Init, VMIRQD_Device_Init + clc + ret + +EndProc VMIRQD_Control + + +;****************************************************************************** +; +; VMIRQD_Virt_Int +; +; DESCRIPTION: +; This routine is called by VPICD when a virtual interrupt is +; reflected. +; +;============================================================================== + +BeginProc VMIRQD_Virt_Int, High_Freq + + push esi + mov esi, OFFSET32 vstring + call Mon_Out_String + pop esi + + clc + ret + +EndProc VMIRQD_Virt_Int + +;****************************************************************************** +; +; VMIRQD_IRET +; +; DESCRIPTION: +; This routine is called by VPICD when the virtual machine IRETs +; at the end of an interrupt. +; +;============================================================================== + +BeginProc VMIRQD_IRET, High_Freq + + push esi + mov esi, OFFSET32 rstring + call Mon_Out_String + pop esi + + clc + ret + +EndProc VMIRQD_IRET + + +;****************************************************************************** +; +; VMIRQD_Mask_Change +; +; DESCRIPTION: +; This routine is called by VPICD when the virtual machine changes +; the state of the interrupt enabled flag in the mask register. +; +;============================================================================== + +BeginProc VMIRQD_Mask_Change, High_Freq + + push esi + mov esi, OFFSET32 mstring + call Mon_Out_String + pop esi + + clc + ret + +EndProc VMIRQD_Mask_Change + + +;****************************************************************************** +; H A R D W A R E I N T E R R U P T R O U T I N E S +;****************************************************************************** + +;****************************************************************************** +; +; VMIRQD_Hw_Int +; +; DESCRIPTION: +; This routine is called at the time of the actual hardware interrupt. +; +; +;============================================================================== + +BeginProc VMIRQD_Hw_Int, High_Freq + + push esi + mov esi, OFFSET32 istring + call Mon_Out_String + pop esi + + VxDjmp VPICD_Set_Int_Request + +EndProc VMIRQD_Hw_Int + + +;****************************************************************************** +; +; VMIRQD_EOI +; +; DESCRIPTION: +; This routine is called by VPICD when an EOI is performed. +; +; +;============================================================================== + +BeginProc VMIRQD_EOI, High_Freq + + push esi + mov esi, OFFSET32 estring + call Mon_Out_String + pop esi + + VxDCall VPICD_Phys_EOI + VxDjmp VPICD_Clear_Int_Request + +EndProc VMIRQD_EOI + +VxD_LOCKED_CODE_ENDS + + +;****************************************************************************** +;****************************************************************************** +; +; Monitor Display Routines +; +;****************************************************************************** + +VxD_ICODE_SEG + +;****************************************************************************** +; +; Mon_Init +; +; +;============================================================================== + +BeginProc Mon_Init + + VMMCall Clear_Mono_Screen + jz short mon_init_error + + Mono_Out_At 0, 0, " VMIRQD - IRQ monitor " + Mono_Out_At 1, 0, " --------------------------------------------------------------------------- " + + mov byte ptr [CurrentLine], 2 + + clc + ret + +mon_init_error: + Trace_Out "No mono display: VMIRQD" + stc + ret + + +EndProc Mon_Init + + +VxD_ICODE_ENDS + + +VxD_LOCKED_CODE_SEG + + +;****************************************************************************** +; +; Mon_Out_String +; +; DESCRIPTION: +; +; ENTRY: +; ESI - offset of string +; +; +;============================================================================== + +BeginProc Mon_Out_String + + pushad + + push esi ;save output string + movzx edx, [CurrentLine] + shl edx, 8 ;column zero + VMMCall Set_Mono_Cur_Pos + mov esi, OFFSET32 BlankPointer + VMMCall Out_Mono_String + + movzx edx, [CurrentLine] ;update line pointer + inc edx + cmp edx, LastMonoLine ;too far? + jb short moc_ok + mov edx, FirstMonoLine +moc_ok: + mov [CurrentLine], dl + shl edx, 8 + VMMCall Set_Mono_Cur_Pos + + mov esi, OFFSET32 NewLine ;set up new line + VMMCall Out_Mono_String + + mov dh, [CurrentLine] + mov dl, 5 ;column 5 + VMMCall Set_Mono_Cur_Pos + + pop esi ;write new string + VMMCall Out_Mono_String + + popad + ret + +EndProc Mon_Out_String + +VxD_LOCKED_CODE_ENDS + + END + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD.DEF new file mode 100644 index 00000000..320cddfd --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD.DEF @@ -0,0 +1,17 @@ +LIBRARY VMIRQD + +DESCRIPTION 'VMIRQD Sample VxD for Microsoft Windows' + +EXETYPE DEV386 + +SEGMENTS + _LTEXT PRELOAD NONDISCARDABLE + _LDATA PRELOAD NONDISCARDABLE + _ITEXT CLASS 'ICODE' DISCARDABLE + _IDATA CLASS 'ICODE' DISCARDABLE + _TEXT CLASS 'PCODE' NONDISCARDABLE + _DATA CLASS 'PCODE' NONDISCARDABLE + +EXPORTS + VMIRQD_DDB @1 + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD.INC b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD.INC new file mode 100644 index 00000000..c6b04aef --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD.INC @@ -0,0 +1,27 @@ +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1992 +; +; Title: VMIOD.INC - +; +; Version: 3.00 +; +; Date: +; +; Author: +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; 10-Mar-92 bjm New device ID. +;============================================================================== + +; +; This is the virtual device ID for this VxD. It is a unique number assigned +; to this device. For more information on VxD IDs, please see the VXDID.TXT +; file. +; +VMIRQD_Dev_ID equ 7fedh diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD.LNK b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD.LNK new file mode 100644 index 00000000..5bc5b0ea --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMIRQD/VMIRQD.LNK @@ -0,0 +1,6 @@ +vmirqd.obj +vmirqd.386 /NOI /NOD /NOP +vmirqd.map /MAP + +vmirqd.def + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/README.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/README.TXT new file mode 100644 index 00000000..de460e7b --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/README.TXT @@ -0,0 +1,5 @@ + +VMPAGES.386 + +This VxD demonstrates how to export a VxD service (in this case GetVMPgCount), +to an application. diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES new file mode 100644 index 00000000..8472a9cd --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES @@ -0,0 +1,29 @@ +# sample make file for building vmpages virtual device for Windows + +# comment this definition out with a "#", if building a non-debugging version +Debug=-DDEBUG + +all : vmpages.386 vmpgs.exe + +.asm.obj: + masm5 -p -w2 -Mx $(Debug) -I..\include $*; + +.asm.lst: + masm5 -l -p -w2 -Mx $(Debug) -I..\include $*; + + +vmpgs.obj : vmpgs.asm vmpages.inc + +vmpgs.exe : vmpgs.obj + link vmpgs.obj; + + +vmpages.obj : vmpages.asm ..\include\debug.inc ..\include\vmm.inc + + +OBJS = vmpages.obj + +vmpages.386: vmpages.def $(OBJS) + link386 @vmpages.lnk + addhdr vmpages.386 + mapsym32 vmpages diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES.ASM new file mode 100644 index 00000000..85ffbab3 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES.ASM @@ -0,0 +1,111 @@ +PAGE 58,132 +;****************************************************************************** +TITLE VMPAGES +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1991 +; +; Title: VMPAGES.ASM +; +; Version: 3.00 +; +; Date: 22-May-1991 +; +; Author: Neil Sandlin +; +; Description: This VxD demonstrates how to export a VxD service, +; GetVMPgCount, to an application. +; +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; +;============================================================================== + + .386p + +;****************************************************************************** +; I N C L U D E S +;****************************************************************************** + + .XLIST + INCLUDE VMM.Inc + INCLUDE Debug.Inc + INCLUDE VMPAGES.Inc + .LIST + + +;****************************************************************************** +; V I R T U A L D E V I C E D E C L A R A T I O N +;****************************************************************************** + +Declare_Virtual_Device VMPAGES, 3, 0, VMPAGES_Control, VMPAGES_Dev_ID,, \ + VMPAGES_API_PROC , VMPAGES_API_Proc + + + +VxD_LOCKED_CODE_SEG + +;****************************************************************************** +; +; VMPAGES_Control +; +; DESCRIPTION: +; +; This is a call-back routine to handle the messages that are sent +; to VxD's to control system operation. However, in this example, +; there's no code because we don't want any call-back calls. +; +; +;============================================================================== + +BeginProc VMPAGES_Control + + clc + ret + +EndProc VMPAGES_Control + + +VxD_LOCKED_CODE_ENDS + + +VxD_CODE_SEG + +BeginDoc +;****************************************************************************** +; +; VMPAGES_API_Proc +; +; DESCRIPTION: +; +; This is the exported API procedure that is callable from VM's. +; An application needs only to use INT 2Fh, AX=1684h, BX=device ID +; and a call back address is returned. Then, when the +; address is called, eventually it ends up here. +; +; +;============================================================================== +EndDoc + +BeginProc VMPAGES_API_Proc + + and [ebp.Client_Flags], NOT CF_Mask ; clear VM's carry flag + + Client_Ptr_Flat edi, ES, DI ; point to buffer + + VMMCall _GetVMPgCount, + mov [edi], eax + mov [edi+4], edx + + ret + +EndProc VMPAGES_API_Proc + +VxD_CODE_ENDS + + END diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES.DEF new file mode 100644 index 00000000..b4d52adc --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES.DEF @@ -0,0 +1,16 @@ +LIBRARY VMPAGES + +DESCRIPTION 'VMPAGES Sample VxD for Microsoft Windows' + +EXETYPE DEV386 + +SEGMENTS + _LTEXT PRELOAD NONDISCARDABLE + _LDATA PRELOAD NONDISCARDABLE + _ITEXT CLASS 'ICODE' DISCARDABLE + _IDATA CLASS 'ICODE' DISCARDABLE + _TEXT CLASS 'PCODE' NONDISCARDABLE + _DATA CLASS 'PCODE' NONDISCARDABLE + +EXPORTS + VMPAGES_DDB @1 diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES.INC b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES.INC new file mode 100644 index 00000000..a02f690d --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES.INC @@ -0,0 +1,6 @@ +; +; This is the virtual device ID for this VxD. It is a unique number assigned +; to this device. For more information on VxD IDs, please see the VXDID.TXT +; file. +; +VMPAGES_Dev_ID equ 7fe7h diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES.LNK b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES.LNK new file mode 100644 index 00000000..9b13fbc3 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPAGES.LNK @@ -0,0 +1,5 @@ +vmpages.obj +vmpages.386 /NOI /NOD /NOP +vmpages.map /MAP + +vmpages.def diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPGS.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPGS.ASM new file mode 100644 index 00000000..5ac4df9f --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VMPAGES/VMPGS.ASM @@ -0,0 +1,121 @@ + name vmpgs +;**************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1991 +; +; Title: VMPGS.ASM +; +; Version: 3.00 +; +; Date: 22-May-1991 +; +; Author: Neil Sandlin +; +; +; This small DOS application will call the VMPAGES API which +; returns the current count of 4k pages assigned to this VM. +; In order to see anything interesting happening, you need to +; run WDEB386 (or any other debugger that catches INT 1) and +; step through the code following the INT 1. +; +; The VMPAGES API is as follows: +; +; call VMPAGES_API_Callback +; +; entry: +; +; dx:ax = linear address +; es:di => 8 BYTE buffer to hold count information. See the +; Virtual Device Adaptation Guide in the Windows +; Device Driver Kit (DDK) for more information +; (under GetVMPgCount). +; +; exit: +; +; +;**************************************************************************** + + include VMPAGES.INC +_DATA segment word public 'DATA' + +Apientry dd ? + +VMCountBuff dd 2 dup (0) + + +cr equ 0dh +lf equ 0ah + +msg1 db cr,lf,'Not running Windows enhanced mode.',cr,lf +msg1l equ $-msg1 + +msg2 db cr,lf,'The VMPAGES VxD is not installed.',cr,lf +msg2l equ $-msg2 + +_DATA ends + + +_TEXT segment word public 'CODE' + assume cs:_TEXT,ds:_DATA + +;*--------------------------------------------------------------------* + +vmpgs proc far + mov ax,_DATA + mov ds,ax + + mov ax,1600h ; enhanced mode? + int 2fh ; api call + test al,7fh ; enhance mode running? + jz not_running_enhanced ; no + + mov ax,1684h ; Get Device API call + mov bx,VMPAGES_Dev_ID ; for the VMPAGES VxD + int 2fh ; do enhanced api + mov WORD PTR Apientry,di ; save the callback address + mov WORD PTR Apientry+2,es + + mov ax,es ; is VMPAGES installed? + or ax,di + jz VMPAGES_not_installed ; if not, split + + + int 1 + push ds + pop es + mov di, OFFSET VMCountBuff + call DWORD PTR Apientry ; call VMPAGES + + ; Our VMCountBuff now contains the info. However, this example + ; does nothing with this information. + + jmp short exit + +not_running_enhanced: + mov dx,offset msg1 ; load + mov cx,msg1l + jmp short write_msg ; go output + +VMPAGES_not_installed: + mov dx,offset msg2 ; load + mov cx,msg2l + +write_msg: + mov bx,1 ; stdout + mov ah,40h ; DOS write + int 21h + +exit: + mov ax,4c00h ; exit to DOS + int 21h +vmpgs endp + + +_TEXT ends + + +;*--------------------------------------------------------------------* + + + end vmpgs + \ No newline at end of file diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/README.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/README.TXT new file mode 100644 index 00000000..c1b3d515 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/README.TXT @@ -0,0 +1,7 @@ + +VNMID.386 + +This VxD shows how to hook the NMI (Non-maskable interrupt). It +currently does not actually DO anything with the NMI except to +chain to the previous handler. + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/VNMID b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/VNMID new file mode 100644 index 00000000..f9d4457a --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/VNMID @@ -0,0 +1,23 @@ +# sample make file for building vnmid virtual device for Windows + +# comment this definition out with a "#", if building a non-debugging version +Debug=-DDEBUG + +all : vnmid.386 + +.asm.obj: + masm5 -p -w2 -Mx $(Debug) -I..\include $*; + +.asm.lst: + masm5 -l -p -w2 -Mx $(Debug) -I..\include $*; + + +vnmid.obj : vnmid.asm ..\include\debug.inc ..\include\vmm.inc + + +OBJS = vnmid.obj + +vnmid.386: vnmid.def $(OBJS) + link386 @vnmid.lnk + addhdr vnmid.386 + mapsym32 vnmid diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/VNMID.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/VNMID.ASM new file mode 100644 index 00000000..db67b0bd --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/VNMID.ASM @@ -0,0 +1,185 @@ +PAGE 58,132 +;****************************************************************************** +TITLE VNMID - +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1990 +; +; Title: VNMID.ASM - +; +; Version: 3.00 +; +; Date: 8-Oct-1990 +; +; Author: Neil Sandlin +; +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; +;============================================================================== + + .386p + +;****************************************************************************** +; I N C L U D E S +;****************************************************************************** + + .XLIST + INCLUDE VMM.Inc + INCLUDE Debug.Inc + .LIST + +;****************************************************************************** +; V I R T U A L D E V I C E D E C L A R A T I O N +;****************************************************************************** + +Declare_Virtual_Device VNMID, 3, 0, VNMID_Control, Undefined_Device_ID ,,, + + +;****************************************************************************** +; L O C A L D A T A +;****************************************************************************** + +VxD_LOCKED_DATA_SEG + +NMI_Chain dd ? + +VxD_LOCKED_DATA_ENDS + + +;****************************************************************************** +; I N I T I A L I Z A T I O N C O D E +;****************************************************************************** + +VxD_ICODE_SEG + + +;****************************************************************************** +; +; VNMID_Device_Init +; +; DESCRIPTION: +; This routine installs the NMI handler. +; +; +;============================================================================== + +BeginProc VNMID_Device_Init + +IFDEF DEBUG + Trace_Out "VNMID installed." +ENDIF + + VMMcall Get_NMI_Handler_Addr ; get current handler + mov [NMI_Chain], esi + + mov esi, OFFSET32 VNMID_Handler ; setup up our NMI handler + VMMcall Set_NMI_Handler_Addr + + mov esi, OFFSET32 VNMID_Event_Handler ; setup our event handler + VMMcall Hook_NMI_Event + + clc + ret + +EndProc VNMID_Device_Init + +VxD_ICODE_ENDS + + + +;****************************************************************************** + +VxD_LOCKED_CODE_SEG + +;****************************************************************************** +; +; VNMID_Control +; +; DESCRIPTION: +; +; This is a call-back routine to handle the messages that are sent +; to VxD's to control system operation. +; +; +;============================================================================== + +BeginProc VNMID_Control + + Control_Dispatch Device_Init, VNMID_Device_Init + clc + ret + +EndProc VNMID_Control + + +;****************************************************************************** +; +; VNMID_Handler +; +; DESCRIPTION: +; +; This handler is called at NMI time, so what can be done here is +; limited. The following comes from the "Virtual Device Adaptation Guide": +; +; Notice that you NMI interrupt handler can only touch local data in the +; device's VxD_LOCKED_DATA_SEG. It cannot touch memory in a VM handle, +; V86 memory, or any other memory. It also cannot call ANY services, +; INCLUDING services that can be called during normal hardware interrupts. +; Because an NMI can occur at any time, it is difficult to do much of +; anything during interrupt time that is guaranteed not to reenter a +; non-reentrant procedure or affect a data structure. +; +; +;****************************************************************************** +BeginProc VNMID_Handler + +; Code inserted here would be executed in the event of an NMI + + jmp [NMI_Chain] ; chain to next + +EndProc VNMID_Handler + + +VxD_LOCKED_CODE_ENDS + + +VxD_CODE_SEG + +;****************************************************************************** +; +; VNMID_Event_Handler +; +; DESCRIPTION: +; +; This event handler is called sometime after the interrupt handler +; was called, when VMM has had a chance to get everything in order. +; Here, services can be called as required. +; +; ENTRY: +; +; +;****************************************************************************** + + +BeginProc VNMID_Event_Handler + +IFDEF DEBUG + Trace_Out "VNMID: Event received" +ENDIF + + clc + ret + +EndProc VNMID_Event_Handler + + +VxD_CODE_ENDS + + END + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/VNMID.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/VNMID.DEF new file mode 100644 index 00000000..57778b52 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/VNMID.DEF @@ -0,0 +1,16 @@ +LIBRARY VNMID + +DESCRIPTION 'VNMID Sample VxD for Microsoft Windows' + +EXETYPE DEV386 + +SEGMENTS + _LTEXT PRELOAD NONDISCARDABLE + _LDATA PRELOAD NONDISCARDABLE + _ITEXT CLASS 'ICODE' DISCARDABLE + _IDATA CLASS 'ICODE' DISCARDABLE + _TEXT CLASS 'PCODE' NONDISCARDABLE + _DATA CLASS 'PCODE' NONDISCARDABLE + +EXPORTS + VNMID_DDB @1 diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/VNMID.LNK b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/VNMID.LNK new file mode 100644 index 00000000..d640149e --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VNMID/VNMID.LNK @@ -0,0 +1,6 @@ +vnmid.obj +vnmid.386 /NOI /NOD /NOP +vnmid.map /MAP + +vnmid.def + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/LIBENTRY.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/LIBENTRY.ASM new file mode 100644 index 00000000..c375a6ca --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/LIBENTRY.ASM @@ -0,0 +1,76 @@ + PAGE ,132 + +; (C) Copyright MICROSOFT Corp., 1988-1991 +; +;* LIBENTRY.ASM +; +; Windows dynamic link library entry routine +; +; This module generates a code segment called INIT_TEXT. It +; initialises the local heap if one exists and then calls the +; C routine LibMain() which should have the form: +; +; BOOL FAR PASCAL LibMain( HANDLE hModule, WORD wDataSeg, +; int cbHeap, LPSTR lpszCmdLine ) +; +; The result of the call to LibMain is returned to Windows. +; The C routine should return TRUE if it completes initialisation +; successfully, FALSE if some error occurs. +; +;* + + +include cmacros.inc + +externFP ; the C routine to be called + +createSeg INIT_TEXT, INIT_TEXT, BYTE, PUBLIC, CODE +sBegin INIT_TEXT +assumes CS,INIT_TEXT + +?PLM=0 ; 'C' naming +externA <_acrtused> ; ensures that Win DLL startup code is linked + +?PLM=1 ; 'PASCAL' naming +externFP ; Windows heap init routine + +cProc LibEntry, ; entry point into DLL + +cBegin + push di ; handle of the module instance + push ds ; the .DLL's data seg (don't assume==hModule) + push cx ; heap size + push es ; command line segment + push si ; command line offset + + ; if we have some heap then initialize it + jcxz callc ; jump if no heap specified + + ; call the Windows function LocalInit() to set up the heap + ; LocalInit((LPSTR)start, WORD cbHeap); + + xor ax, ax + cCall LocalInit < ds, ax, cx > + test ax, ax ; did it do it ok ? + jz error ; quit if it failed + + ; invoke the C routine to do any special initialization + +callc: + call LibMain ; invoke the 'C' routine (result in AX) + jmp exit ; LibMain is responsible for stack clean up + +error: + pop si ; clean up stack on a LocalInit error + pop es + pop cx + pop ds + pop di + +exit: + +cEnd + +sEnd INIT_TEXT + +end LibEntry diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/MAKEFILE b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/MAKEFILE new file mode 100644 index 00000000..1523e59c --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/MAKEFILE @@ -0,0 +1,242 @@ +# +# Makefile for VPOSTD.386, POSTHOST.DLL, POSTAPP.EXE, and POSTDOS.EXE +# +# This is a sample demonstrating how to PostMessage from a VxD. +# +# Author: cjp +# + + +#DEBUG_POSTDOS = TRUE ; comment out for final build +#DEBUG_POSTAPP = TRUE ; comment out for final build +#DEBUG_POSTHOST = TRUE ; comment out for final build +#DEBUG_VPOSTD = TRUE ; comment out for final build + + +OUTPUT = aux +WINAPPS = d:\mwin +WINLIB = c:\windev\lib +WININC = c:\windev\include +!IFNDEF WINDIR +WINDIR = d:\mwin +!ENDIF + + +# +# for POSTDOS.EXE build +# + +!IFDEF DEBUG_POSTDOS + +DAS = masm /Zi +DCC = cl -c -Zi +DLN = link /CO +DZZ = POSTDOS: ***** DEBUG ***** DEBUG ***** DEBUG ***** DEBUG ***** + +!ELSE + +DAS = masm +DCC = cl -c +DLN = link +DZZ = POSTDOS: **** RELEASE *** RELEASE *** RELEASE *** RELEASE **** + +!ENDIF + +DSRCS = postdos.c +DOBJS = postdos.obj + + +# +# for POSTAPP.EXE build +# + +!IFDEF DEBUG_POSTAPP + +AAS = masm /Zi +ACC = cl -c -DDEBUG -AM -G2sw -Owd -W3 -Ziped +ALN = link /NOD/NOE/A:16/CO +ARC = rc -v -DDEBUG +AZZ = POSTAPP: ***** DEBUG ***** DEBUG ***** DEBUG ***** DEBUG ***** + +!ELSE + +AAS = masm +ACC = cl -c -DRELEASE -AM -G2sw -Ows -W3 -Zpe +ALN = link /NOD/NOE/A:16 +ARC = rc -v -DRELEASE +AZZ = POSTAPP: **** RELEASE *** RELEASE *** RELEASE *** RELEASE **** + +!ENDIF + +AMISC = postapp.def postapp.lnk + +AINCS = postapp.h +ASRCS = postapp.c +AOBJS = postapp.obj + + +# +# for POSTHOST.DLL build +# + +!IFDEF DEBUG_POSTHOST + +LAS = masm /Zi +LCC = cl -c -DDEBUG -Alnw -G2sw -Owd -W3 -Ziped +LLN = link /NOD/NOE/A:16/CO +LRC = rc -v -DDEBUG +LZZ = POSTHOST: ***** DEBUG ***** DEBUG ***** DEBUG ***** DEBUG ***** + +!ELSE + +LAS = masm +LCC = cl -c -DRELEASE -Alnw -G2sw -Ows -W3 -Zpe +LLN = link /NOD/NOE/A:16 +LRC = rc -v -DRELEASE +LZZ = POSTHOST: **** RELEASE *** RELEASE *** RELEASE *** RELEASE **** + +!ENDIF + +LMISC = posthost.def posthost.lnk + +LINCS = posthost.h +LSRCS = posthost.c libentry.asm +LOBJS = posthost.obj libentry.obj + + +# +# for VPOSTD.386 build +# + +!IFDEF DEBUG_VPOSTD + +VAS = masm5 -p -w2 -Mx -DDEBUG +VLN = link386 +VRC = rc -v -DDEBUG +VZZ = VPOSTD: ***** DEBUG ***** DEBUG ***** DEBUG ***** DEBUG ***** + +!ELSE + +VAS = masm5 -p -w2 -Mx -DRELEASE +VLN = link386 +VRC = rc -v -DRELEASE +VZZ = VPOSTD: **** RELEASE *** RELEASE *** RELEASE *** RELEASE **** + +!ENDIF + + +VMISC = vpostd.def vpostd.lnk + +VINCS = vpostd.inc +VSRCS = vpostd.asm +VOBJS = vpostd.obj + + +# +# now the rules +# + +all : vpostd.386 posthost.dll postapp.exe postdos.exe + @echo ================= BUILD COMPLETE =================== + @echo $(VZZ) + @echo $(LZZ) + @echo $(AZZ) + @echo $(DZZ) + @echo ================= BUILD COMPLETE =================== + + +# VPOSTD.386 + +vpostd.386 : $(VOBJS) vpostd.def + $(VLN) @vpostd.lnk + addhdr vpostd.386 + mapsym32 vpostd + @echo $(VZZ) + @echo $(VZZ) + @echo $(VZZ) + +vpostd.obj : vpostd.asm vpostd.inc + $(VAS) $*; + +vpostd.lst : vpostd.asm vpostd.inc + $(VAS) $*; + + +# POSTHOST.DLL + +posthost.dll: $(LOBJS) posthost.def + $(LLN) @posthost.lnk + implib posthost.lib posthost.def + $(LRC) posthost.dll + @echo $(LZZ) + @echo $(LZZ) + @echo $(LZZ) + +posthost.obj: posthost.c posthost.h + $(LCC) $*.c + +libentry.obj: libentry.asm + $(LAS) $*; + + +# POSTAPP.EXE + +postapp.exe : $(AOBJS) postapp.def postapp.res posthost.dll + $(ALN) @postapp.lnk + $(ARC) postapp.res + @echo $(AZZ) + @echo $(AZZ) + @echo $(AZZ) + +postapp.exe : postapp.res + $(ARC) postapp.res + @echo $(AZZ) + @echo $(AZZ) + @echo $(AZZ) + +postapp.obj : postapp.c postapp.h posthost.h + $(ACC) $*.c + +postapp.res : postapp.rc postapp.h postapp.ico + $(ARC) -r postapp.rc + + +# POSTDOS.EXE + +postdos.exe : $(DOBJS) + $(DLN) $*; + @echo $(DZZ) + @echo $(DZZ) + @echo $(DZZ) + +postdos.obj : postdos.c + $(DCC) $*.c + + +# MISC JUNK + +clean : + del *.386 + del *.lib + del *.dll + del *.exe + del *.res + del *.obj + del *.sym + del *.map + del *.lst + del *.zip + +zip : clean + pkzip -a vpostd.zip *.* + +ship : all + del *.lib + del *.res + del *.obj + del *.sym + del *.map + del *.lst + del *.zip + touch *.* + pkzip -a vpostd.zip *.* diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTAPP.C b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTAPP.C new file mode 100644 index 00000000..78413430 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTAPP.C @@ -0,0 +1,172 @@ +/* + + (C) Copyright MICROSOFT Corp., 1991 + +*/ + +/** postapp.c **/ + + +/* the includes we need */ + #include + #include "posthost.h" + #include "postapp.h" + + +/* prototypes for good measure */ + long FAR PASCAL WndProc( HWND, unsigned, WORD, LONG ); + + +/* globals, no less */ + char szAppName[] = "POSTAPP"; + + + + /** long FAR PASCAL WndProc( HWND, unsigned, WORD, LONG ) + * + * DESCRIPTION: + * This is just your normal everyday WndProc(). + * + * NOTES: + * + ** cjp */ + +long FAR PASCAL WndProc( HWND hWnd, unsigned iMsg, WORD wParam, LONG lParam ) +{ + switch ( iMsg ) + { + case WM_DESTROY: + if ( !phRegisterWindow( NULL ) ) + MessageBox( NULL, "Could not de-register window!", + "phRegisterWindow", MB_OK ); + + PostQuitMessage( 0 ); + break; + + case WM_COMMAND: + { + char szBuf[ 256 ]; + + switch ( wParam ) + { + case IDM_GETVERSION: + { + WORD wVersion = phGetVPOSTDVersion(); + + wsprintf( szBuf, "VPOSTD Version: %.4Xh", wVersion ); + MessageBox( hWnd, szBuf, "phGetVPOSTDVersion", MB_OK ); + } + break; + + case IDM_GETAPIADDR: + { + DWORD dwAPIAddr = phGetVPOSTDAPIAddr(); + + wsprintf( szBuf, "VPOSTD API Addr: %.8lXh", dwAPIAddr ); + MessageBox( hWnd, szBuf, "phGetVPOSTDAPIAddr", MB_OK ); + } + break; + + case IDM_CALLPOSTHOST: + if ( !phCallPostHost( 0x12345678 ) ) + MessageBox( hWnd, "UH-OH!", "phCallPostHost", MB_OK ); + break; + } + } + break; + + case WM_POSTHOSTPOST: + { + char szBuf[ 256 ]; + + wsprintf( szBuf, "VM ID: %d lParam: %.8lXh", wParam, lParam ); + MessageBox( hWnd, szBuf, "WM_POSTHOSTPOST", + MB_OK | MB_SYSTEMMODAL ); + } + break; + + default: + return ( DefWindowProc( hWnd, iMsg, wParam, lParam ) ); + } + + return ( 0L ); +} /* WndProc() */ + + + /** int PASCAL WinMain( HANDLE, HANDLE, LPSTR, int ) + * + * DESCRIPTION: + * This is just your normal everyday WinMain(). + * + * NOTES: + * + ** cjp */ + +int PASCAL WinMain( HANDLE hInstance, + HANDLE hPrevInstance, + LPSTR lpszCmdLine, + int nCmdShow ) +{ + WNDCLASS wndclass; + HWND hWnd; + MSG msg; + WORD wError; + + /* get the status of POSTHOST.DLL--hope for PHERR_NOERROR (0) */ + if ( (wError = phGetPostHostError()) != PHERR_NOERROR ) + { + char *szError; + + /* error checking and reporting */ + if ( wError == PHERR_NO386ENH ) + szError = "RUN ENHANCED WINDOWS!"; + + else if ( wError == PHERR_NOVPOSTD ) + szError = "INSTALL VPOSTD.386 FIRST!"; + + MessageBox( NULL, szError, "POSTHOST.DLL", MB_OK ); + + return ( FALSE ); + } + + if ( !hPrevInstance ) + { + wndclass.style = CS_HREDRAW | CS_VREDRAW; + wndclass.lpfnWndProc = WndProc; + wndclass.cbClsExtra = 0; + wndclass.cbWndExtra = 0; + wndclass.hInstance = hInstance; + wndclass.hIcon = LoadIcon( hInstance, "ICON_POSTAPP" ); + wndclass.hCursor = LoadCursor( NULL, IDC_ARROW ); + wndclass.hbrBackground = GetStockObject( WHITE_BRUSH ); + wndclass.lpszMenuName = "MENU_POSTAPP"; + wndclass.lpszClassName = szAppName; + + if ( !RegisterClass( &wndclass ) ) + return ( FALSE ); + } + + hWnd = CreateWindow( szAppName, "PostApp", + WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, CW_USEDEFAULT, 400, 60, + NULL, NULL, hInstance, NULL ); + + ShowWindow( hWnd, SW_SHOW ); + UpdateWindow( hWnd ); + + + if ( !phRegisterWindow( hWnd ) ) + MessageBox( hWnd, "UH-OH! Could not register window!", + "phRegisterWindow", MB_OK ); + + while ( GetMessage( &msg, NULL, 0, 0 ) ) + { + TranslateMessage( &msg ); + DispatchMessage( &msg ); + } + + return ( msg.wParam ); +} /* WinMain() */ + + +/** EOF: postapp.c **/ diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTAPP.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTAPP.DEF new file mode 100644 index 00000000..4b130173 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTAPP.DEF @@ -0,0 +1,15 @@ +NAME POSTAPP + +DESCRIPTION 'VPostD Sample VxD for Windows --By: Curtis J. Palmer' + +EXETYPE WINDOWS + +STUB 'WINSTUB.EXE' + +CODE LOADONCALL MOVEABLE +DATA LOADONCALL MOVEABLE MULTIPLE + +HEAPSIZE 4196 +STACKSIZE 5120 + +EXPORTS WndProc diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTAPP.H b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTAPP.H new file mode 100644 index 00000000..2f80d8dc --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTAPP.H @@ -0,0 +1,16 @@ +/** postapp.h **/ + +#ifndef _POSTAPP_H_ +#define _POSTAPP_H_ + +/* misc. defines */ + #define IDM_GETVERSION 100 + #define IDM_GETAPIADDR 101 + #define IDM_CALLPOSTHOST 102 + + +#endif + +/** EOF: postapp.h **/ + + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTAPP.ICO b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTAPP.ICO new file mode 100644 index 0000000000000000000000000000000000000000..6791f84ed1feb6235c62073384ac3b64b21923bb GIT binary patch literal 766 zcmbtSyAHxI3_K9RY%no*b7 zfC)>}tYElKfi>F=*^pauf*B)_>3v55SW!wej7-UboHLEiE4t1ylEu0#d|(Xsk?JaBwH-}H&c=-2zLIY0L2j~;P;UUG$7+}1m0dtM)q Y2OxKnqvb*tGLr!2WV}Wue + #include "postapp.h" + + +/* misc. resources */ + ICON_POSTAPP ICON postapp.ICO + + +/* the menu */ + MENU_POSTAPP MENU + BEGIN + MENUITEM "GetVersion!", IDM_GETVERSION + MENUITEM "GetAPIAddr!", IDM_GETAPIADDR + MENUITEM "CallPostHost!", IDM_CALLPOSTHOST + END + + +/** postapp.rc **/ diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTDOS.C b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTDOS.C new file mode 100644 index 00000000..b17bc31b --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTDOS.C @@ -0,0 +1,213 @@ +/* + (C) Copyright MICROSOFT Corp., 1991 +*/ + +/** postdos.c **/ + + +/* the includes required to build this file */ + #include + + +/* the DWORD value to post */ + #define PDC_POSTVALUE (0x1BADBABE) + + +/* quick Windows style typedefs */ + typedef unsigned short BOOL; + typedef unsigned short WORD; + typedef unsigned long DWORD; + + +/* these also */ + #ifndef TRUE + #define TRUE (1) + #define FALSE (0) + #endif + + +/* crude (very) debugging stuff */ + #ifdef DEBUG + #define D(x) {x;} + #define ODS(x) puts(x) + #else + #define D(x) + #define ODS(x) + #endif + + +/* defines for getting the device ID of VPOSTD... */ + #define VPOSTD_DEV_ID 0x7fe8 + + +/* global variables */ + WORD gwError; /* error status */ + DWORD VPOSTD_API = (DWORD)NULL; /* addr of VPOSTD RM API */ + + + /** WORD pdGetVPOSTDVersion( void ) + * + * DESCRIPTION: + * This function returns the version of VPOSTD. The HIBYTE() of the + * return value is the major version number; the LOBYTE() is the + * minor version number. + * + * ARGUMENTS: + * None. + * + * RETURN (WORD): + * The return value is the version of the VPOSTD. The HIBYTE() of the + * return value is the major version number; the LOBYTE() is the + * minor version number. The return value is zero if VPOSTD is not + * available. + * + * NOTES: + * + ** cjp */ + +WORD pdGetVPOSTDVersion( void ) +{ + WORD wReturn = 0x0000; /* assume the worst */ + + /* sanity check */ + if ( VPOSTD_API ) + { + _asm + { + mov ax, 0 ; func 0 is 'Get Version' + call dword ptr [VPOSTD_API] ; call VPOSTD + mov wReturn, ax ; stuff the return value + } + } + + /* return the result */ + return ( wReturn ); +} /* pdGetVPOSTDVersion() */ + + + /** BOOL pdCallPostHost( DWORD lParam ) + * + * DESCRIPTION: + * This function will call VPOSTD to post a message to the current + * hWnd that has been registered with phRegisterWindow (in Windows). + * Imagine this! Doing a PostMessage() to a Windows app from a + * DOS app! + * + * ARGUMENTS: + * DWORD lParam : Arbitrary DWORD to be posted as the lParam + * to the current registered window in Windows. + * + * RETURN (BOOL): + * The return value is TRUE if this function succeeds. It is FALSE + * if VPOSTD is not available. + * + * NOTES: + * + ** cjp */ + +BOOL pdCallPostHost( DWORD lParam ) +{ + BOOL fReturn = FALSE; /* assume bad things */ + + /* make sure we have the API entry point to VPOSTD */ + if ( VPOSTD_API ) + { + _asm + { + mov ax, 2 ; func 2 is 'Call PostHost' + mov dx, word ptr [lParam + 0] ; low word in DX + mov cx, word ptr [lParam + 2] ; high word in CX + + call dword ptr [VPOSTD_API] ; call VPOSTD + + mov fReturn, ax ; return result + } + } + + /* return the outcome of the function */ + return ( fReturn ); +} /* pdCallPostHost() */ + + + + /** short main( void ) + * + * DESCRIPTION: + * Your standard, everyday, run-of-the-mill, main()--with a few + * extras... + * + * ARGUMENTS: + * None. + * + * RETURN (short): + * Always TRUE. + * + * NOTES: + * + ** cjp */ + +short main( void ) +{ + /* get API entry to VPOSTD--if it is installed */ + _asm + { + mov ax, 1600h ; enhanced mode? + int 2Fh ; api call + test al, 7Fh ; enhance mode running? + jz not_running_enhanced ; no + + mov ax, 1684h ; get device API call + mov bx, VPOSTD_DEV_ID ; for the VPOSTD VxD + int 2Fh ; get api entry point + mov word ptr VPOSTD_API, di ; save the callback address + mov word ptr VPOSTD_API + 2, es + + mov ax, es ; is VPOSTD installed? + or ax, di + jz vxd_not_installed ; if not, split + + mov gwError, 0 ; show success (PHERR_NOERROR) + jmp get_out + +not_running_enhanced: + mov gwError, 1 ; no enh windows! (PHERR_NO386ENH) + jmp get_out ; return our error code + +vxd_not_installed: + mov gwError, 2 ; VPOSTD? (PHERR_NOVPOSTD) + +get_out: + } + + /* can we call VPOSTD? */ + if ( gwError ) + { + if ( gwError == 1 ) + puts( "RUN ENHANCED MODE WINDOWS FIRST!" ); + else + puts( "YOU MUST INSTALL VPOSTD.386 FIRST!" ); + } + + /* good! now run it through a small test... */ + else + { + BOOL fResult; + WORD wVersion = pdGetVPOSTDVersion(); + + printf( "Real Mode API Addr: %.8lXh\n", VPOSTD_API ); + printf( "VPOSTD.386 Version: %.4Xh\n", wVersion ); + + printf( "Posting [%.8lXh]...", PDC_POSTVALUE ); + + if ( ! (fResult = pdCallPostHost( PDC_POSTVALUE )) ) + puts( "FAILED! You need to run POSTAPP.EXE in Windows!" ); + else + puts( "SUCCESS!" ); + } + + /* return success--even though we may have failed */ + return ( TRUE ); +} /* main() */ + + +/** EOF: postdos.c **/ diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTHOST.C b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTHOST.C new file mode 100644 index 00000000..13996405 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTHOST.C @@ -0,0 +1,362 @@ +/* + (C) Copyright MICROSOFT Corp., 1991 +*/ + +/** posthost.c **/ + + +/* the includes required to build this file */ + #include + #include "posthost.h" + + +/* crude (very) debugging stuff */ + #ifdef DEBUG + #define D(x) {x;} + #define ODS(x) OutputDebugString(x) + #else + #define D(x) + #define ODS(x) + #endif + + +/* defines the device ID of VPOSTD... */ + #define VPOSTD_DEV_ID 0x7fe8 + + +/* internal function prototypes */ + void FAR PASCAL phCallBack( HWND hWnd, WORD wVMID, DWORD lParam ); + + +/* need to guarantee that phCallBack() is in FIXED (page-locked) segment */ + #pragma alloc_text( CALLBACK, phCallBack ) + + +/* global variables */ + HANDLE ghModule; /* handle (instance?) of .DLL */ + WORD gwError; /* status info on POSTHOST.DLL */ + DWORD VPOSTD_API = NULL; /* addr of VPOSTD PM API */ + + + + /** void FAR PASCAL phCallBack( HWND hWnd, WORD wVMID, DWORD lParam ) + * + * DESCRIPTION: + * This is the callback for the VPOSTD. It should be treated as + * an ISR--all rules of ISR's apply here. You may ONLY call + * PostMessage() and PostAppMessage() in an ISR. + * + * ARGUMENTS: + * ( HWND hWnd, WORD wVMID, DWORD lParam ) + * + * RETURN (void FAR PASCAL): + * None. We were 'far called' (simulated), so we must RETF. Also + * note that we are using the PL/M calling convention, so *we* pop + * the stuff off the stack--not the VPOSTD (RETF 8). + * + * NOTES: + * + ** cjp */ + +void FAR PASCAL phCallBack( HWND hWnd, WORD wVMID, DWORD lParam ) +{ + ODS( "POSTHOST: phCallBack() called...\r\n" ); + + /* quick sanity check--do *NOT* call IsWindow()!!! */ + if ( hWnd ) + { + /* post the message with the caller's VM ID and CX:DX lParam */ + PostMessage( hWnd, WM_POSTHOSTPOST, wVMID, lParam ); + } +} /* phCallBack() */ + + + /** WORD FAR PASCAL phGetPostHostError( void ) + * + * DESCRIPTION: + * This function returns the error status of POSTHOST.DLL. It should + * be used to determine if the .DLL is ready for business or if + * something is hosed. This is actually quite superfluous; the .DLL + * should just fail the LibMain(), but that is harsh for this example. + * This works well enough for this example. + * + * ARGUMENTS: + * None. + * + * RETURN (WORD FAR PASCAL): + * The return value is one of the following: + * + * PHERR_NOERROR (0) : Everything is cool. + * PHERR_NO386ENH (1) : You gotta run 386 Enh mode! + * PHERR_NOVPOSTD (2) : VPOSTD.386 is not installed. + * + * NOTES: + * + ** cjp */ + +WORD FAR PASCAL phGetPostHostError( void ) +{ + /* simply return gwError--was filled in during LibMain() */ + return ( gwError ); +} /* phGetPostHostError() */ + + + /** DWORD FAR PASCAL phGetVPOSTDAPIAddr void ) + * + * DESCRIPTION: + * This function is used to get the far pointer to the API that + * is exported by VPOSTD. + * + * ARGUMENTS: + * None. + * + * RETURN (DWORD FAR PASCAL): + * The return value is the address of the *Protect Mode* API that + * VPOSTD exports. It is NULL if VPOSTD is not available. + * + * NOTES: + * + ** cjp */ + +DWORD FAR PASCAL phGetVPOSTDAPIAddr( void ) +{ + /* return the far pointer to PM API entry */ + return ( VPOSTD_API ); +} /* phGetVPOSTDAPIAddr() */ + + + /** WORD FAR PASCAL phGetVPOSTDVersion( void ) + * + * DESCRIPTION: + * This function returns the version of VPOSTD. The HIBYTE() of the + * return value is the major version number; the LOBYTE() is the + * minor version number. + * + * ARGUMENTS: + * None. + * + * RETURN (WORD FAR PASCAL): + * The return value is the version of the VPOSTD. The HIBYTE() of the + * return value is the major version number; the LOBYTE() is the + * minor version number. The return value is zero if VPOSTD is not + * available. + * + * NOTES: + * + ** cjp */ + +WORD FAR PASCAL phGetVPOSTDVersion( void ) +{ + WORD wReturn = 0x0000; /* assume the worst */ + + /* sanity check */ + if ( VPOSTD_API ) + { + _asm + { + mov ax, 0 ; func 0 is 'Get Version' + call dword ptr [VPOSTD_API] ; call VPOSTD + mov wReturn, ax ; stuff the return value + } + } + + /* return the result */ + return ( wReturn ); +} /* phGetVPOSTDVersion() */ + + + /** BOOL FAR PASCAL phRegisterWindow( HWND hWnd ) + * + * DESCRIPTION: + * This function is used to register a window handle with VPOSTD + * to receive posts. In this example, only one window may receive + * messages at a time. + * + * ARGUMENTS: + * HWND hWnd : Window to receive posts. If NULL, the callback + * will be de-registered. + * + * RETURN (BOOL FAR PASCAL): + * The return value is TRUE if this function succeeds in setting + * the window handle in VPOSTD to hWnd. It is FALSE if it fails. + * + * NOTES: + * + ** cjp */ + +BOOL FAR PASCAL phRegisterWindow( HWND hWnd ) +{ + BOOL fReturn = FALSE; /* assume bad things */ + DWORD dwCallBack; + + + dwCallBack = hWnd ? (DWORD)phCallBack : NULL; + + /* make sure we have the API entry point to VPOSTD */ + if ( VPOSTD_API ) + { + _asm + { + mov ax, 1 ; func 1 is 'Register Callback' + mov bx, hWnd ; hWnd in bx + les di, dwCallBack ; callback addr in es:di + + call dword ptr [VPOSTD_API] ; hello VPOSTD... + + mov fReturn, ax ; return result + } + } + + /* return outcome of the function */ + return ( fReturn ); +} /* phRegisterWindow() */ + + + /** BOOL FAR PASCAL phCallPostHost( DWORD lParam ) + * + * DESCRIPTION: + * This function will call VPOSTD to post a message to the current + * hWnd that has been registered with phRegisterWindow. You could + * say that this is doing it the hard way, but it demonstrates what + * it is intended to demonstrate... + * + * ARGUMENTS: + * DWORD lParam : Arbitrary DWORD to be posted as the lParam + * to the current registered window. + * + * RETURN (BOOL FAR PASCAL): + * The return value is TRUE if this function succeeds. It is FALSE + * if VPOSTD is not available. + * + * NOTES: + * + ** cjp */ + +BOOL FAR PASCAL phCallPostHost( DWORD lParam ) +{ + BOOL fReturn = FALSE; /* assume bad things */ + + /* make sure we have the API entry point to VPOSTD */ + if ( VPOSTD_API ) + { + _asm + { + mov ax, 2 ; func 2 is 'Call PostHost' + mov dx, word ptr [lParam + 0] ; low word in DX + mov cx, word ptr [lParam + 2] ; high word in CX + + call dword ptr [VPOSTD_API] ; call VPOSTD + + mov fReturn, ax ; return result + } + } + + /* return the outcome of the function */ + return ( fReturn ); +} /* phCallPostHost() */ + + + /** BOOL FAR PASCAL WEP( int nArgument ) + * + * DESCRIPTION: + * Performs cleanup tasks when the .DLL is unloaded. The WEP() is + * called automatically by Windows when the .DLL is unloaded (no + * remaining tasks still have the .DLL loaded). It is strongly + * recommended that a .DLL have a WEP() function, even if it does + * nothing but return, as in this example. + * + * Make sure that the WEP() is @1 RESIDENTNAME in the EXPORTS + * section of the .DEF file. This ensures that the WEP() can + * be called as quickly as possible. Incidently, this is why + * the WEP() is called the WEP() instead of WindowsExitProcedure(). + * It takes up the minimum amount of space and is quickly located. + * + * + ** cjp */ + +BOOL FAR PASCAL WEP( int nArgument ) +{ + switch ( nArgument ) + { + case WEP_SYSTEM_EXIT: + ODS( "POSTHOST: WEP_SYSTEM_EXIT\r\n" ); + break; + + case WEP_FREE_DLL: + ODS( "POSTHOST: WEP_FREE_DLL\r\n" ); + break; + + default: + ODS( "POSTHOST: WEP_UNDEFINED!!!\r\n" ); + break; + } + + /* always return TRUE (1) */ + return ( TRUE ); +} /* WEP() */ + + + /** BOOL FAR PASCAL LibMain( HANDLE, WORD, WORD, LPSTR ) + * + * DESCRIPTION: + * Is called by LibInit(). LibInit() is called by Windows when + * the .DLL is loaded. LibInit() initializes the DLL's heap, if + * a HEAPSIZE value is specified in the DLL's .DEF file. Then + * LibInit() calls LibMain(). The LibMain() function below + * satisfies that call. + * + * The LibMain() function should perform additional initialization + * tasks required by the .DLL. In this example, the hModule is + * made global and the VPOSTD_API is justified. If the latter + * fails, the .DLL will be unloaded... + * + ** cjp */ + +BOOL FAR PASCAL LibMain( HANDLE hModule, + WORD wDataSeg, + WORD cbHeapSize, + LPSTR lpszCmdLine ) +{ + /* make instance handle global */ + ghModule = hModule; + + /* get API entry to VPOSTD--if it is installed */ + _asm + { + mov ax, 1600h ; enhanced mode? + int 2Fh ; api call + test al, 7Fh ; enhance mode running? + jz not_running_enhanced ; no + + mov ax, 1684h ; get device API call + mov bx, VPOSTD_DEV_ID ; for the VPOSTD VxD + int 2Fh ; get api entry point + mov word ptr VPOSTD_API, di ; save the callback address + mov word ptr VPOSTD_API + 2, es + + mov ax, es ; is VPOSTD installed? + or ax, di + jz vxd_not_installed ; if not, split + + mov gwError, 0 ; show success (PHERR_NOERROR) + jmp get_out + +not_running_enhanced: + mov gwError, 1 ; no enh windows! (PHERR_NO386ENH) + jmp get_out ; return our error code + +vxd_not_installed: + mov gwError, 2 ; VPOSTD? (PHERR_NOVPOSTD) + +get_out: + } + + /* jolly good show... */ + ODS( "POSTHOST: LibMain() succeeded...\r\n" ); + + /* return success--even though we may have failed */ + return ( TRUE ); +} /* LibMain() */ + + +/** EOF: posthost.c **/ diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTHOST.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTHOST.DEF new file mode 100644 index 00000000..e19e25ab --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTHOST.DEF @@ -0,0 +1,20 @@ +LIBRARY POSTHOST + +DESCRIPTION 'VPOSTD.386 support library for Microsoft Windows --by: cjp' + +EXETYPE WINDOWS + +SEGMENTS INIT_TEXT PRELOAD MOVEABLE + CALLBACK PRELOAD FIXED + +CODE LOADONCALL MOVEABLE DISCARDABLE +DATA MOVEABLE SINGLE + +HEAPSIZE 4096 + +EXPORTS WEP @1 RESIDENTNAME + phGetPostHostError @2 + phGetVPOSTDAPIAddr @3 + phGetVPOSTDVersion @4 + phRegisterWindow @5 + phCallPostHost @6 diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTHOST.H b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTHOST.H new file mode 100644 index 00000000..e11c03d4 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTHOST.H @@ -0,0 +1,26 @@ +/** posthost.h **/ + +#ifndef _POSTHOST_H_ +#define _POSTHOST_H_ + + +/* misc. defines */ + #define WM_POSTHOSTPOST (WM_USER + 1997) + + +/* error values as returned by phGetPostHostError() */ + #define PHERR_NOERROR 0 + #define PHERR_NO386ENH 1 + #define PHERR_NOVPOSTD 2 + + +/* public function prototypes */ + WORD FAR PASCAL phGetPostHostError( void ); + DWORD FAR PASCAL phGetVPOSTDAPIAddr( void ); + WORD FAR PASCAL phGetVPOSTDVersion( void ); + BOOL FAR PASCAL phRegisterWindow( HWND hWnd ); + BOOL FAR PASCAL phCallPostHost( DWORD lParam ); + +#endif + +/** EOF: posthost.h **/ diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTHOST.LNK b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTHOST.LNK new file mode 100644 index 00000000..e7436a29 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/POSTHOST.LNK @@ -0,0 +1,5 @@ +posthost.obj libentry.obj +posthost.dll +posthost +mdllcew libw +posthost.def; diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/README.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/README.TXT new file mode 100644 index 00000000..adc2f9c8 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/README.TXT @@ -0,0 +1,72 @@ + +VPOSTD.386 + + +VPOSTD.386, POSTHOST.DLL, POSTAPP.EXE, and POSTDOS.EXE +====================================================== + +This .ZIP file contains source demonstrating how a VxD can +cause a message to be posted to a Windows application. This +example also demonstrates how to implement an API for Real +and Protect mode to a VxD... among other things. + +There are four separate programs for this example: + + VPOSTD.386 : The VxD that coordinates activities. + + VPOSTD.ASM : Main body of VxD. + VPOSTD.INC : Header file for VPOSTD.ASM. + VPOSTD.DEF : Definition file for the VPOSTD VxD. + VPOSTD.LNK : Link file for building the VxD. + + + POSTHOST.DLL: The 'host' .DLL that VPOSTD.386 calls for + posting messages. + + POSTHOST.C : Main body of POSTHOST.DLL. + POSTHOST.H : Public header file for POSTHOST.DLL. + POSTHOST.DEF: Definition file for POSTHOST.DLL. + POSTHOST.LNK: Link file for building POSTHOST.DLL. + LIBENTRY.ASM: Entry stub for .DLL's. + + + POSTAPP.EXE : The Windows app who receives messages. + + POSTAPP.C : Main body of POSTAPP.EXE. + POSTAPP.H : Header file for POSTAPP.C. + POSTAPP.RC : Resource file for POSTAPP.EXE. + POSTAPP.DEF : Definition file for POSTAPP.EXE. + POSTAPP.ICO : Stupid icon for POSTAPP.EXE. + POSTAPP.LNK : Link file for building POSTAPP.EXE. + + + POSTDOS.EXE : DOS program that calls VPOSTD.386 to post + messages to POSTAPP.EXE through POSTHOST.DLL. + + POSTDOS.C : Main body of POSTDOS.EXE. + + +The MAKEFILE included will build all of these. Note that this +is a makefile for NMK or NMAKE. + + +To run this example, you need to do the following (if you goof +something up, it'll tell you about it): + + o Install VPOSTD.386: + -- copy VPOSTD.386 to your WINDOWS\SYSTEM directory + -- put 'device=VPOSTD.386' in your SYSTEM.INI file under + the [386Enh] section + -- reboot Windows + + o Run POSTAPP.EXE. This will cause POSTHOST.DLL to be loaded. + + o Now you can run POSTDOS.EXE in any DOS box--windowed or + full screen. Note that a System Modal dialog box is used. + + +Refer to the source code for details on how this all works. + + +Enjoy, Curt. +5/4/91 diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/VPOSTD.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/VPOSTD.ASM new file mode 100644 index 00000000..24b46792 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/VPOSTD.ASM @@ -0,0 +1,527 @@ + page 58,132 + title vpostd + +; (C) Copyright MICROSOFT Corp., 1991 +; +;** vpostd.asm +;* +;* DESCRIPTION: +;* This is a sample VxD demonstrating how you can PostMessage() +;* from a VxD. It requires a .DLL that you Simulate_Far_Call to +;* that will do the PostMessage() at the right time and priv. +;* +;* HISTORY: +;* 2/27/91 cjp wrote it +;* +;** cjp * + + + .386p ; VxD's are for real processors! + + + +;***************************** INCLUDES ********************************** + +.xlist + include vmm.inc ; this be required... unless your crazy. + include debug.inc ; optional; enabled if DEBUG defined + include shell.inc ; for dlg boxes and the like + include vpicd.inc ; if you are playing with interrupts + include vdd.inc ; for funky display control/status + + include vpostd.inc ; this is us +.list + + + +;******************** VIRTUAL DEVICE DECLARATION ************************* + +Declare_Virtual_Device VPOSTD, VPOSTD_VERMAJ, VPOSTD_VERMIN, VPOSTD_Control,\ + VPOSTD_DEV_ID,, VPOSTD_API_Proc, VPOSTD_API_Proc + + + +;*********************** LOCAL LOCKED DATA ******************************* + +VxD_LOCKED_DATA_SEG + align 4 + +VPOSTD_CB_Offset dd 0 + +VxD_LOCKED_DATA_ENDS + + + +;********************** INITIALIZATION DATA SEG ************************** + +VxD_IDATA_SEG + + ;; no discardable initialization data used in this VxD + +VxD_IDATA_ENDS + + + +;************************ NORMAL VXD DATA SEG **************************** + +VxD_DATA_SEG + +;; this info is registered by the POSTHOST.DLL + +PostHost_hWnd dw 0 ; as passed by POSTHOST.DLL +PostHost_Proc_Off32 dd 0 ; POSTHOST.DLL's post message addr +PostHost_Proc_Seg dw 0 + + +;; API jump table + +VPOSTD_API_Table label DWORD + dd offset32 VPOSTD_Get_Version + dd offset32 VPOSTD_Register_Callback + dd offset32 VPOSTD_Call_PostHost + +VPOSTD_Max_API = ($ - VPOSTD_API_Table) / 4 - 1 + +VxD_DATA_ENDS + + + + +;*************** INITIALIZATION CODE SEG: PROTECT MODE ******************* + +VxD_ICODE_SEG + + +;** VPOSTD_Sys_Crit_Init +;* +;* DESCRIPTION: +;* Phase 1. When this function is called, interrupts are not yet +;* enabled. Therefore, this phase should accomplish the following +;* tasks as quickly as possible: +;* +;* o Initialization of critical functions necessary +;* when interrupts are enabled. +;* +;* o Claiming a particular range of V86 pages if +;* necessary (such as the video memory for the VDD). +;* +;* o Initialization of data needed by the services +;* provided by this VxD (FAST stuff). +;* +;* o During this phase, the System VM Simulate_Int +;* and Exec_Int commands must NOT be used (can't). +;* +;* ENTRY: +;* EBX : VM Handle. +;* +;* EXIT: +;* Carry clear if successful. Set if fail--this will keep this +;* VxD from loading. +;* +;* NOTES: +;* +;** cjp * + +BeginProc VPOSTD_Sys_Crit_Init + + ;; This isn't a very important VxD, so we don't do much here. + + clc ; no error + ret + +EndProc VPOSTD_Sys_Crit_Init + + + +;** VPOSTD_Device_Init +;* +;* DESCRIPTION: +;* Phase 2. This is where the bulk of your initialization should +;* be done. Interrupts are enabled now and the Simulate_Int and +;* Exec_Int services are allowed. During this phase, you can: +;* +;* o Allocate your Control Block area and misc. memory. +;* +;* o Hook interrupts and I/O ports. +;* +;* o Specify instance data. +;* +;* The System VM's Control Block should be set up with the initial +;* state of the VxD. Since the System VM has already been created +;* calls such as Simulate_Int or Exec_Int are allowed. +;* +;* ENTRY: +;* EBX : VM Handle. +;* +;* EXIT: +;* Carry clear if successful. Set if fail--this will keep this +;* VxD from loading. +;* +;* NOTES: +;* +;** cjp * + +BeginProc VPOSTD_Device_Init + + VMMcall _Allocate_Device_CB_Area, <, 0> + test eax, eax + jnz short VPOSTD_CB_OK + + + ;; uh-oh... trouble... + + Debug_Out "VPOSTD_Device_Init: _Allocate_Device_CB_Area failed!" + VMMcall Fatal_Memory_Error + + +VPOSTD_CB_OK: + mov [VPOSTD_CB_Offset], eax ; gotta keep this around + + clc ; no error + ret + +EndProc VPOSTD_Device_Init + +VxD_ICODE_ENDS + + + +;************************** LOCKED CODE SEG ****************************** + + +VxD_LOCKED_CODE_SEG + +;** VPOSTD_Control +;* +;* DESCRIPTION: +;* +;* ENTRY: +;* +;* EXIT: +;* +;* NOTES: +;* +;** cjp * + +BeginProc VPOSTD_Control + + Control_Dispatch Sys_Critical_Init, VPOSTD_Sys_Crit_Init + Control_Dispatch Device_Init, VPOSTD_Device_Init + + clc + ret + +EndProc VPOSTD_Control + +VxD_LOCKED_CODE_ENDS + + + +;************************* PROTECT MODE CODE SEG ************************* + +VxD_CODE_SEG + + BeginDoc +;** VPOSTD_API_Proc +;* +;* DESCRIPTION: +;* This is the exported API procedure that is callable from VM's. +;* An application needs only to use INT 2Fh, AX=1684h, BX=device ID +;* and a call back address is returned. Then, when the address is +;* called, eventually it ends up here. +;* +;* +;* ENTRY: +;* EBX : VM Handle. +;* EBP : Client register structure. +;* Client_CS:IP : Instruction following API call. +;* Client_AX : Function number. +;* +;* EXIT: +;* Client: +;* Carry clear : success +;* Carry set : hosed +;* +;* NOTES: +;* +;** cjp * +EndDoc + +BeginProc VPOSTD_API_Proc + + ;; a short word from our sponsor + + movzx eax, [ebp.Client_AX] ; function # + + Trace_Out "VPOSTD_API_Proc: VM #EBX Function #EAX" + + cmp ax, VPOSTD_Max_API ; a valid service? + ja short VPOSTD_API_Failed + jmp VPOSTD_API_Table[ eax * 4 ] + + +VPOSTD_API_Success: + + Trace_Out "VPOSTD_API_Proc: Success! VM #EBX" + + and [ebp.Client_EFlags], NOT CF_Mask + jmp short VPOSTD_Exit + + +VPOSTD_API_Failed : + + Trace_Out "VPOSTD_API_Proc: Failed! VM #EBX" + + mov [ebp.Client_AX], 0 ; FALSE return value + or [ebp.Client_EFlags], CF_Mask + +VPOSTD_Exit: + ret + +EndProc VPOSTD_API_Proc + + + BeginDoc +;** VPOSTD_Get_Version +;* +;* DESCRIPTION: +;* This service gets the version number of this VxD. The major +;* version number is loaded into AH; the minor version number is +;* stuffed into AL. +;* +;* ENTRY: +;* EBX : VM Handle. +;* EBP : Client register structure. +;* Client_CS:IP : Instruction following API call. +;* +;* EXIT: +;* Client: +;* EAX : Major and minor version number. +;* Carry clear : Success. +;* +;* NOTES: +;* +;** cjp * +EndDoc + +BeginProc VPOSTD_Get_Version + + mov [ebp.Client_AX], (VPOSTD_VERMAJ shl 8) + VPOSTD_VERMIN + jmp VPOSTD_API_Success + +EndProc VPOSTD_Get_Version + + + BeginDoc +;** VPOSTD_Register_Callback +;* +;* DESCRIPTION: +;* This service sets the callback address and window handle for +;* the POSTHOST.DLL. Calling this procedure with ES:DI set to +;* NULL will de-register the callback, thus voiding the POSTHOST.DLL +;* from getting called. This should be done when the POSTHOST is +;* exiting or no longer requires posts. +;* +;* ENTRY: +;* EBX : VM Handle. +;* EBP : Client register structure. +;* Client_CS:IP : Instruction following API call. +;* Client_BX : Window handle to post to. +;* Client_ES:DI : PostHost proc address. +;* +;* EXIT: +;* Client: +;* Carry clear : Success; always does. +;* +;* NOTES: +;* +;** cjp * +EndDoc + +BeginProc VPOSTD_Register_Callback + + ;; just stuff ES:DI into our data seg--if null, de-register + + movzx eax, [ebp.Client_DI] ; grab offset + mov [PostHost_Proc_Off32], eax ; stuff it + mov ax, [ebp.Client_ES] ; grab seg + mov [PostHost_Proc_Seg], ax ; stuff it + + mov ax, [ebp.Client_BX] ; grab window handle + mov [PostHost_hWnd], ax ; stuff it + + mov [ebp.Client_AX], 1 ; successful (TRUE) return + jmp short VPOSTD_API_Success + +EndProc VPOSTD_Register_Callback + + + BeginDoc +;** VPOSTD_Call_PostHost +;* +;* DESCRIPTION: +;* This service is used to call the POSTHOST.DLL to post a message +;* to the hWnd that was registered with VPOSTD_Register_Callback. +;* If the callback address is NULL, then this service will fail-- +;* no sanity checks are made on the hWnd. +;* +;* ENTRY: +;* EBX : VM Handle. +;* EBP : Client register structure. +;* Client_CS:IP : Instruction following API call. +;* Client_CX:DX : DWORD data to be passed to PostHost. +;* +;* EXIT: +;* Client: +;* Carry clear : Success. +;* Carry set : Hosed. Callback address is NULL. +;* +;* NOTES: +;* +;** cjp * +EndDoc + +BeginProc VPOSTD_Call_PostHost + + Trace_Out "VPOSTD_Call_PostHost: Enter VM #EBX" + + movzx eax, [PostHost_Proc_Seg] ; is callback addr NULL? + or eax, [PostHost_Proc_Off32] + jz VPOSTD_API_Failed ; no go--fail! + + mov esi, ebx ; vm block of caller + add esi, [VPOSTD_CB_Offset] ; point to that VM's area + + mov ax, [ebp.Client_CX] + mov [esi.VPOSTD_CB_Client_CX], ax ; save the CX info + mov ax, [ebp.Client_DX] + mov [esi.VPOSTD_CB_Client_DX], ax ; save the DX info + + VMMcall Test_Sys_VM_Handle ; PostHost is in sys VM + jnz short VPOSTD_Schedule_Call ; we gotta be in sys VM... + + VMMcall Get_Crit_Section_Status ; need to wait for !crit? + jc short VPOSTD_Schedule_Call ; bummer... + + + ;; we know current VM is sys VM and critical section unowned + ;; so do the callback when ints are enabled--which they may be... + + Trace_Out "VPOSTD_Call_PostHost: IN SYS VM!!! VM #EBX" + + mov edx, ebx ; ref. data == sys VM handle + mov esi, offset32 VPOSTD_Call_PostHost_Now + VMMcall Call_When_VM_Ints_Enabled + + jmp short VPOSTD_Call_PostHost_Exit + + +VPOSTD_Schedule_Call: + + ;; This Trace_Out is really not the greatest thing to be doing + ;; here... we could be in an ISR and we're just wasting time! + ;; But it is nice for watching the flow of this VxD... + + Trace_Out "VPOSTD_Call_PostHost: SCHEDULE SYS VM! VM #EBX" + + + ;; Ok. We need to get the sys VM called sometime in the near + ;; future when everything stablizes. This callback is not that + ;; important, so we will wait until there is no critical section + ;; and interrupts have been enabled. We actually have to so we + ;; don't re-enter the PostHost... Call_Priority_VM_Event is your + ;; friend! + + mov edx, ebx ; ref. data == curr VM handle + VMMcall Get_Sys_VM_Handle ; wanna go to sys VM + mov eax, Low_Pri_Device_Boost ; low priority... + mov ecx, PEF_Wait_For_STI or PEF_Wait_Not_Crit + mov esi, offset32 VPOSTD_Call_PostHost_Now + VMMcall Call_Priority_VM_Event + + +VPOSTD_Call_PostHost_Exit: + + Trace_Out "VPOSTD_Call_PostHost: Exit VM #EBX" + + mov [ebp.Client_AX], 1 ; successful (TRUE) return + jmp VPOSTD_API_Success ; cool! + +EndProc VPOSTD_Call_PostHost + + + BeginDoc +;** VPOSTD_Call_PostHost_Now +;* +;* DESCRIPTION: +;* This routine is a callback for calling the POSTHOST.DLL's callback! +;* The .DLL's callback will receive the hWnd that was previously +;* registered as the only argument. This is really not necessary, +;* but it demonstrates how to pass info to a callback on the stack. +;* +;* ENTRY: +;* EBX : *System* VM Handle. +;* EDX : Reference data passed to this service (VM handle). +;* EBP : Client register structure. +;* +;* EXIT: +;* No change to client regs. We can trash EAX, EBX, ECX, EDX, ESI, +;* EDI, and Flags. +;* +;* NOTES: +;* +;** cjp * +EndDoc + +BeginProc VPOSTD_Call_PostHost_Now + + Push_Client_State ; gotta save this! + + VMMcall Begin_Nest_Exec ; prepare to call VM + + + ;; The callback in the .DLL is prototyped as follows: + ;; void FAR PASCAL phCallBack( HWND hWnd, WORD wVMID, DWORD lParam ) + + mov ax, [PostHost_hWnd] ; push hWnd for PostHost + VMMcall Simulate_Push + mov eax, [edx.CB_VMID] ; push VM ID of caller + VMMcall Simulate_Push + + + ;; we need to grab the CX:DX that the user passed from the + ;; correct VM--handle was passed in edx + + mov esi, edx ; vm block of caller + add esi, [VPOSTD_CB_Offset] ; point to that VM's area + + + ;; dealing with 16 bit PM app so Simulate_Push will do 16 bits + + mov ax, [esi.VPOSTD_CB_Client_CX] ; get the CX info + VMMcall Simulate_Push ; high word first + mov ax, [esi.VPOSTD_CB_Client_DX] ; get the DX info + VMMcall Simulate_Push ; low word second + + mov cx, [PostHost_Proc_Seg] ; CX:EDX -> PostHost... + mov edx, [PostHost_Proc_Off32] + + VMMcall Simulate_Far_Call ; set stuff up for call + VMMcall Resume_Exec ; finally! call it (immediate) + + VMMcall End_Nest_Exec ; whew! done with that + + Pop_Client_State ; restore client stuff now + + ret + + +EndProc VPOSTD_Call_PostHost_Now + + +VxD_CODE_ENDS + + + end + +;** EOF: vpostd.asm ** diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/VPOSTD.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/VPOSTD.DEF new file mode 100644 index 00000000..046179bf --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/VPOSTD.DEF @@ -0,0 +1,15 @@ +LIBRARY VPOSTD + +DESCRIPTION 'VPOSTD VxD Sample for Microsoft Windows --by: cjp' + +EXETYPE DEV386 + +SEGMENTS _LTEXT PRELOAD NONDISCARDABLE + _LDATA PRELOAD NONDISCARDABLE + _ITEXT CLASS 'ICODE' DISCARDABLE + _IDATA CLASS 'ICODE' DISCARDABLE + _TEXT CLASS 'PCODE' NONDISCARDABLE + _DATA CLASS 'PCODE' NONDISCARDABLE + +EXPORTS VPOSTD_DDB @1 + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/VPOSTD.INC b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/VPOSTD.INC new file mode 100644 index 00000000..67b43515 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/VPOSTD.INC @@ -0,0 +1,32 @@ +;** vpostd.inc +;* +;* DESCRIPTION: +;* This include file contains misc. equates that VPOSTD uses. +;* +;* HISTORY: +;* 2/27/91 cjp wrote it +;* +;* +;** cjp * + +VPOSTD_VERMAJ equ 3 +VPOSTD_VERMIN equ 0 + +; +; This is the virtual device ID for this VxD. It is a unique number assigned +; to this device. For more information on VxD IDs, please see the VXDID.TXT +; file. +; +VPOSTD_DEV_ID equ 7fe8h + +;; This is our Control Block (CB) structure; one per VM. + +VPOSTD_CB_DATA STRUC + +VPOSTD_CB_Client_DX dw ? +VPOSTD_CB_Client_CX dw ? + +VPOSTD_CB_DATA ENDS + + +;** EOF: vpostd.inc ** diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/VPOSTD.LNK b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/VPOSTD.LNK new file mode 100644 index 00000000..9bad60ee --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VPOSTD/VPOSTD.LNK @@ -0,0 +1,7 @@ +vpostd.obj +vpostd.386 /NOI/NOD/NOP +vpostd.map /MAP + +vpostd.def + + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/README.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/README.TXT new file mode 100644 index 00000000..77209947 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/README.TXT @@ -0,0 +1,15 @@ + +VWATCHD.386 + +VwatchD is a Virtual Device that demonstrates the basic structure of +VxD. TEST.EXE contains the DOS application that calls the VwatchD +V86 API entry. + +To Install VwatchD.386, copy the file VwatchD.386 to Windows\system +directory. Specify "device=VwatchD.386" in system.ini [386ehn] +section. + +A debug terminal needs to be setup to see the debugging output +by VwatchD. Also Win386.EXE debug version should be running. The +debug version of Win386.exe can be found in DDK source directory +VxD\tools\debug. diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/TEST.C b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/TEST.C new file mode 100644 index 00000000..1b43786f --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/TEST.C @@ -0,0 +1,41 @@ +#include +unsigned long dwTime ; + +void main (void) +{ +_asm { + push si + push di + xor di, di + mov es, di + mov ax, 1684h + mov bx, 7FE1h + int 2fh + mov ax, es + or ax, di + jz error_message + + mov ax, offset ret_place + push cs + push ax + push es + push di + retf ; far return to VxD entry point + +ret_place: + mov word ptr [dwTime+2], dx + mov word ptr [dwTime], ax + pop di + pop si + } + printf ("This VM was born at %lu milliseconds.", dwTime) ; + return ; + +error_message: + _asm { + pop di + pop si + } + puts ("VwatchD API not found.") ; + return ; +} diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD new file mode 100644 index 00000000..91aa5ff6 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD @@ -0,0 +1,31 @@ +# sample make file for building VwatchD virtual device for Windows + +# comment this definition out with a "#", if building a non-debugging version +Debug=-DDEBUG + +all : VwatchD.386 test.exe + +.asm.obj: + masm5 -p -w2 -Mx $(Debug) -I..\include $*; + +.asm.lst: + masm5 -l -p -w2 -Mx $(Debug) -I..\include $*; + + +test.obj: test.c + cl test.c -c -W3 + +test.exe: test.obj + link test.obj; + + +VwatchD.obj VwatchD.lst: VwatchD.asm VwatchD.inc \ + ..\include\debug.inc ..\include\vmm.inc + + +OBJS = VwatchD.obj + +VwatchD.386: VwatchD.def $(OBJS) + link386 @VwatchD.lnk + addhdr VwatchD.386 + mapsym32 VwatchD diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD.ASM new file mode 100644 index 00000000..c5ce3d7e --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD.ASM @@ -0,0 +1,466 @@ +Title VwatchD.ASM +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1991 +; +;By Keith Jin, Microsoft PSS, July 16, 1991 +; +; This code shows the basic structure of a VxD. It does nothing except +; output debug messages to the debug terminal. Please note, the Trace_Out +; and Debug_Out macros are only assemblyed when the 'DEBUG' switch is +; turned on. +; +;============================================================================== + + .386p + + .xlist + include vmm.inc + include debug.inc + include VwatchD.inc + .list + +VwatchD_CB_STRUCT STRUC +VM_Birth_Time dd ? +VwatchD_CB_STRUCT ENDS + +;****************************************************************************** +; declare virtual device +; +; The Declare_Virtual_Device macro creates a structure of data called +; Device Data Block (DDB). The name is this data block is _DDB. +; For this VxD, it will be VwatchD_DDB. This name must be exported in the +; .def file. (See VwatchD.DEF). This data structure is the only place that +; VMM will find various information about the VxD. See Virtual Device +; Adaptation Guide for more information. If this VxD exports services, +; you don't need to include the service table name in this macro. The +; service table just needs to be declared using the same VxD name. See +; VwatchD.INC. +; +;============================================================================== + +Declare_Virtual_Device VwatchD, 1, 0, VwatchD_Control, VwatchD_DEVICE_ID, \ + Undefined_Init_Order, VwatchD_V86_API,VwatchD_PM_API + +;****************************************************************************** +; data +;============================================================================== +VXD_DATA_SEG + public VwatchD_CB_Offset +VwatchD_CB_Offset dd 0 ; + +VXD_DATA_ENDS + +;***********Real Mode Initialization **************************************** +VxD_REAL_INIT_SEG + +BeginProc VwatchD_Real_Init + mov ax, Device_Load_Ok + mov bx, 0 ; No pages to exclude. + mov si, 0 ; No instance data items. + clc + ret +EndProc VwatchD_Real_Init + +VxD_REAL_INIT_ENDS + + +;**************************************************************************** +; init stuff +;============================================================================== + +VXD_IDATA_SEG + +; (some data used during initialization time) + +VXD_IDATA_ENDS + +VXD_ICODE_SEG ; Please see code and comments in VwatchD_Control first. + +;****************************************************************************** +; +; VwatchD_Sys_Crit_Init +; +; DESCRIPTION: Called during the first phase of PM init. +; +; ENTRY: EBX: Sys VM handle +; +; EXIT: carry flag clear. +; +; +;============================================================================== +BeginProc VwatchD_Sys_Crit_Init + + Trace_Out "VwatchD: Sys Critical Init." + + VMMCall _Allocate_Device_CB_Area, <, 0> + or eax, eax + jz short VwatchD_SCI_Error + mov [VwatchD_CB_Offset], eax + add eax, ebx + mov [eax.VM_Birth_Time], 0 + clc + ret + +VwatchD_SCI_Error: +; +; Debug_Out prints the message and breaks into the debugger. +; + Debug_Out "VwatchD: Fail to allocate VM CB area." + VMMjmp Fatal_Memory_Error + +EndProc VwatchD_Sys_Crit_Init + +;****************************************************************************** +; +; VwatchD_Device_Init +; +; DESCRIPTION: Called during the second phase of PM init. +; +; ENTRY: EBX: Sys VM handle +; +;============================================================================== +BeginProc VwatchD_Device_Init + + Trace_Out "VwatchD: Device Init." + clc + ret + +EndProc VwatchD_Device_Init + +;****************************************************************************** +; +; VwatchD_Init_Complete +; +; DESCRIPTION: Called during the final phase of PM init. +; +; ENTRY: EBX: Sys VM handle +; +; +;============================================================================== +BeginProc VwatchD_Init_Complete + + Trace_Out "VwatchD: Init Complete" + clc + ret + +EndProc VwatchD_Init_Complete + +VXD_ICODE_ENDS + +;****************************************************************************** +; Code +;------------------------------------------------------------------------------ +VXD_CODE_SEG + +;****************************************************************************** +; +; VwatchD_Control +; +; DESCRIPTION: The system (or VMM) calls this entry point for various events +; that is occuring in the system, for example, system init, system exit, +; VM create, VM init, or VM being destroyed... Here are some of the +; "messages." There are others not used here. This proc dispatches the +; call to the appropriate routines. Control_Dispatch is a macro. Please +; see VMM.INC for more detailed information. +;============================================================================== +BeginProc VwatchD_Control + + Control_Dispatch Sys_Critical_Init, VwatchD_Sys_Crit_Init + Control_Dispatch Device_Init, VwatchD_Device_Init + Control_Dispatch Init_Complete, VwatchD_Init_Complete + + Control_Dispatch SYS_VM_Init, VwatchD_SYS_VM_Init + + Control_Dispatch Create_VM, VwatchD_Create_VM + Control_Dispatch VM_Critical_Init, VwatchD_VM_Critical_Init + Control_Dispatch VM_Init, VwatchD_VM_Init + Control_Dispatch VM_Suspend, VwatchD_VM_Suspend + Control_Dispatch VM_Resume, VwatchD_VM_Resume + Control_Dispatch Query_Destroy, VwatchD_Query_Destroy + + Control_Dispatch Sys_VM_Terminate, VwatchD_Sys_VM_Terminate + Control_Dispatch VM_Terminate, VwatchD_VM_Terminate + Control_Dispatch Destroy_VM, VwatchD_Destroy_VM + Control_Dispatch VM_Not_Executeable, VwatchD_VM_Not_Executeable + + Control_Dispatch Set_Device_Focus, VwatchD_Set_Focus + + Control_Dispatch Power_Event, VwatchD_Power_Event + + Control_Dispatch System_Exit, VwatchD_System_Exit + Control_Dispatch Sys_Critical_Exit, VwatchD_Sys_Critical_Exit + +IFDEF DEBUG + Control_Dispatch Debug_Query, VwatchD_Debug_Query +ENDIF + +; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +; Various callback functions not implemented here. +; +; Control_Dispatch Begin_PM_App, VwatchD_Begin_PM_App +; Control_Dispatch End_PM_App, VwatchD_End_PM_App +; Control_Dispatch Begin_Message_Mode, VwatchD_Begin_Message_Mode +; Control_Dispatch End_Message_Mode, VwatchD_End_Message_Mode +; Control_Dispatch Reboot_Processor, VwatchD_Reboot_Processor + + clc + ret + +EndProc VwatchD_Control + +;****************************************************************************** +; Create VM +;============================================================================== + +BeginProc VwatchD_Create_VM + + Trace_Out "VwatchD: VM #EBX is being created." + + mov edi, [VwatchD_CB_Offset] + add edi, ebx + VMMCall Get_System_Time + mov [edi.VM_Birth_Time], eax + clc + ret + +EndProc VwatchD_Create_VM + +;****************************************************************************** +; System VM init +;============================================================================== +BeginProc VwatchD_SYS_VM_Init + + Trace_Out "VwatchD: System VM init (VM # is #EBX)" + clc + ret + +EndProc VwatchD_SYS_VM_Init + +;****************************************************************************** +; VM init +;============================================================================== +BeginProc VwatchD_VM_Init + + Trace_Out "VwatchD: VM #EBX init" + clc + ret + +EndProc VwatchD_VM_Init + +;****************************************************************************** +; VM Suspend +;============================================================================== +BeginProc VwatchD_VM_Suspend + + Trace_Out "VwatchD: VM #EBX Suspend" + clc + ret + +EndProc VwatchD_VM_Suspend + +;****************************************************************************** +; VM Resume +;============================================================================== +BeginProc VwatchD_VM_Resume + + Trace_Out "VwatchD: VM #EBX Resume" + clc + ret + +EndProc VwatchD_VM_Resume + +;****************************************************************************** +; VM Critical init +;============================================================================== +BeginProc VwatchD_VM_Critical_Init + + Trace_Out "VwatchD: VM #EBX Critical Init." + clc + ret + +EndProc VwatchD_VM_Critical_Init + +;****************************************************************************** +; VM Terminate +;============================================================================== +BeginProc VwatchD_VM_Terminate + + Trace_Out "VwatchD: VM #EBX terminates." + clc + ret + +EndProc VwatchD_VM_Terminate + +;****************************************************************************** +; Sys VM Terminate +;============================================================================== +BeginProc VwatchD_Sys_VM_Terminate + + Trace_Out "VwatchD: Sys VM terminates (VM # #EBX)." + clc + ret + +EndProc VwatchD_Sys_VM_Terminate + +;****************************************************************************** +; VM Not Executable +;============================================================================== +BeginProc VwatchD_VM_Not_Executeable + + Trace_Out "VwatchD: VM #EBX not executeable." + clc + ret + +EndProc VwatchD_VM_Not_Executeable + +;****************************************************************************** +; VM Query Destroy +;============================================================================== +BeginProc VwatchD_Query_Destroy + + Trace_Out "VwatchD: VM #EBX Query Destroy." + clc + ret + +EndProc VwatchD_Query_Destroy + +;****************************************************************************** +; VM Destroy +;============================================================================== +BeginProc VwatchD_Destroy_VM + + mov edi, [VwatchD_CB_Offset] + add edi, ebx + VMMCall Get_System_Time + sub eax, [edi.VM_Birth_Time] + Trace_Out "VwatchD: VM #EBX Destroyed. It was around for #eax milliseconds." + clc + ret + +EndProc VwatchD_Destroy_VM + +;****************************************************************************** +;VwatchD_Set_Focus +;============================================================================== + +BeginProc VwatchD_Set_Focus + + mov eax, edx + Trace_out "VwatchD: Set Device #EAX Focus to VM #EBX" + clc + ret + +EndProc VwatchD_Set_Focus + +;****************************************************************************** +; VM Power Event +;============================================================================== +BeginProc VwatchD_Power_Event + + Trace_Out "VwatchD: Power Event." + clc + ret + +EndProc VwatchD_Power_Event + +;****************************************************************************** +;VwatchD_System_Exit +;============================================================================== +BeginProc VwatchD_System_Exit + + Trace_Out "VwatchD: System Exit time." + clc + ret + +EndProc VwatchD_System_Exit + +;****************************************************************************** +;VwatchD_Sys_Critical_Exit +;============================================================================== +BeginProc VwatchD_Sys_Critical_Exit + + Trace_Out "VwatchD: Sys Critical Exit." + clc + ret + +EndProc VwatchD_Sys_Critical_Exit + +;****************************************************************************** +; VwatchD_Get_Version +; The only VwatchD service provided in this code. VxD services can be +; called by other VxDs. For example, "VxDCall VwatchD_Get_Version" +;============================================================================== +BeginProc VwatchD_Get_Version, Service + + Trace_Out "VwatchD: Service get version." + mov eax, 100h + clc + ret + +EndProc VwatchD_Get_Version +;****************************************************************************** +;VwatchD_V86_API +; Entry point for V86 API. This procedure can be a dispatch point for +; different functions of the API. +; +;Entry: EBX: Current VM handle +; EBP -> Client Register Struct +; +;Exit: Client_DX:AX = VM's birth time +;============================================================================== + +BeginProc VwatchD_V86_API + + Trace_Out "VwatchD: V86 API call from VM #EBX" + mov edi, [VwatchD_CB_Offset] + add edi, ebx + mov eax, [edi.VM_Birth_Time] + mov [ebp.Client_AX], ax + shr eax, 16 + mov [ebp.Client_DX], ax + clc + ret + +EndProc VwatchD_V86_API + +;****************************************************************************** +;VwatchD_PM_API +; Entry point for PM API. This procedure can be a dispatch point for +; different functions of the API. +; +;Entry: EBX: Current VM handle +; EBP -> Client Register Struct +;Exit: VwatchD version number in Client_DX:AX +;============================================================================== + +BeginProc VwatchD_PM_API + Trace_Out "VwatchD: PM API call from VM #EBX" + VxDCall VwatchD_Get_Version ; other VxDs can do the same. + mov [ebp.Client_AX], ax + shr eax, 16 + mov [ebp.Client_DX], ax + clc + ret +EndProc VwatchD_PM_API + +IFDEF DEBUG +;************************************************************************ +;* +;* The Debug_Query section! +;* +;* We get control here when a user enters ".VwatchD" when in WDEB386. +;* +;************************************************************************ +BeginProc VwatchD_Debug_Query + Trace_Out "VwatchD: We are displaying debug info now." + clc + ret +EndProc VwatchD_Debug_Query + +ENDIF + +VXD_CODE_ENDS + + END + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD.DEF new file mode 100644 index 00000000..fff5444e --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD.DEF @@ -0,0 +1,16 @@ +LIBRARY VwatchD + +DESCRIPTION 'VwatchD VxD Sample for Microsoft Windows' + +EXETYPE DEV386 + +SEGMENTS + _LTEXT PRELOAD NONDISCARDABLE + _LDATA PRELOAD NONDISCARDABLE + _ITEXT CLASS 'ICODE' DISCARDABLE + _IDATA CLASS 'ICODE' DISCARDABLE + _TEXT CLASS 'PCODE' NONDISCARDABLE + _DATA CLASS 'PCODE' NONDISCARDABLE + +EXPORTS + VwatchD_DDB @1 diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD.INC b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD.INC new file mode 100644 index 00000000..136ac221 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD.INC @@ -0,0 +1,16 @@ +;************************************************************************ +; VwatchD.INC, Keith Jin +;======================================================================== + +; +; This is the virtual device ID for this VxD. It is a unique number assigned +; to this device. For more information on VxD IDs, please see the VXDID.TXT +; file. +; +VwatchD_DEVICE_ID equ 7FE1h + +Begin_Service_Table VwatchD + +VwatchD_Service VwatchD_Get_Version + +End_Service_Table VwatchD diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD.LNK b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD.LNK new file mode 100644 index 00000000..ff468396 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWATCHD/VWATCHD.LNK @@ -0,0 +1,5 @@ +VwatchD.obj +VwatchD.386 /NOI /NOD /NOP +VwatchD.map /MAP + +VwatchD.def diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/README.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/README.TXT new file mode 100644 index 00000000..968765a4 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/README.TXT @@ -0,0 +1,18 @@ + +VWFD.386 + +This VxD, when installed on a system running Windows in enhanced mode, +allows DOS applications to determine if they are running in a window +or full-screen. This is accomplished via the API that VWFD supplies +TSTWF.ASM is a sample DOS program that uses the VWFD API. + + +To install this VxD, copy it to your Windows SYSTEM directory and +add the following line to your SYSTEM.INI. + +[386enh] + + ... + ... + + device=VWFD.386 diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/TSTWF.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/TSTWF.ASM new file mode 100644 index 00000000..67ab82f7 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/TSTWF.ASM @@ -0,0 +1,135 @@ + name tstwf +;**************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1990 +; +; Title: TSTWF.ASM +; +; Version: 3.00 +; +; Date: 15-Nov-1990 +; +; Author: Neil Sandlin +; +; +; This small DOS application will call the VWFD API which +; returns the state of a VM: Windowed or Full screen. +; The API's used by this application are: +; +; INT 2Fh, AX=1600h - determine if enhanced mode Windows is running +; INT 2Fh, AX=1684h - get VxD API callback address +; +; The VWFD API is as follows: +; +; call VWFD_API_Callback +; +; entry: +; BX=VMID of the VM to test +; +; exit: +; AX=0 if VM is full screen +; +;**************************************************************************** + + include VWFD.INC + +_DATA segment word public 'DATA' + +Apientry dd ? + +cr equ 0dh +lf equ 0ah + +msg1 db cr,lf,'Full Screen.',cr,lf +msg1l equ $-msg1 + +msg2 db cr,lf,'In a Window.',cr,lf +msg2l equ $-msg2 + +msg3 db cr,lf,'Not running Windows enhanced mode.',cr,lf +msg3l equ $-msg3 + +msg4 db cr,lf,'VWFD is not installed.',cr,lf +msg4l equ $-msg4 + +msg5 db cr,lf,'Specified VM does not exist.',cr,lf +msg5l equ $-msg5 +_DATA ends + + + +_TEXT segment word public 'CODE' + assume cs:_TEXT,ds:_DATA + +;*--------------------------------------------------------------------* + +tstwf proc far + mov ax,_DATA + mov ds,ax + + mov ax,1600h ; enhanced mode? + int 2fh ; api call + test al,7fh ; enhance mode running? + jz not_running_enhanced ; no + + mov ax,1684h ; Get Device API call + mov bx,VWFD_Dev_ID ; for the VWFD VxD + int 2fh ; do enhanced api + mov WORD PTR Apientry,di ; save the callback address + mov WORD PTR Apientry+2,es + + mov ax,es ; is VWFD installed? + or ax,di + jz vwfd_not_installed ; if not, split + + mov bx, 2 ; check for this VMID + call DWORD PTR Apientry ; call VWFD + ; if AX=0, we're running + ; fullscreen + + jc api_error + or ax,ax ; anything on? + jz full_screen + +; windowed + mov dx,offset msg2 ; + mov cx,msg2l + jmp short write_msg + +full_screen: + mov dx,offset msg1 ; load + mov cx,msg1l + jmp short write_msg ; go output + +not_running_enhanced: + mov dx,offset msg3 ; load + mov cx,msg3l + jmp short write_msg ; go output + +vwfd_not_installed: + mov dx,offset msg4 ; load + mov cx,msg4l + jmp short write_msg ; go output + +api_error: + mov dx,offset msg5 ; load + mov cx,msg5l + +write_msg: + mov bx,1 ; stdout + mov ah,40h ; DOS write + int 21h + + mov ax,4c00h ; exit to DOS + int 21h +tstwf endp + + +_TEXT ends + + +;*--------------------------------------------------------------------* + + end tstwf + + \ No newline at end of file diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD new file mode 100644 index 00000000..33b31cf0 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD @@ -0,0 +1,31 @@ +# sample make file for building vwfd virtual device for Microsoft Windows + +# comment this definition out with a "#", if building a non-debugging version +Debug=-DDEBUG + +all : vwfd.386 tstwf.exe + +.asm.obj: + masm5 -p -w2 -Mx $(Debug) -I..\include $*; + +.asm.lst: + masm5 -l -p -w2 -Mx $(Debug) -I..\include $*; + + +tstwf.obj: tstwf.asm vwfd.inc + +tstwf.exe: tstwf.obj + link tstwf.obj; + + +vwfd.obj : vwfd.asm ..\include\vdd.inc \ + ..\include\debug.inc \ + ..\include\vmm.inc + +OBJS = vwfd.obj + +vwfd.386: vwfd.def $(OBJS) + link386 @vwfd.lnk + addhdr vwfd.386 + mapsym32 vwfd + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD.ASM b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD.ASM new file mode 100644 index 00000000..c60b9751 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD.ASM @@ -0,0 +1,242 @@ +PAGE 58,132 +;****************************************************************************** +TITLE VWFD +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1990 +; +; Title: VWFD.ASM +; +; Version: 3.00 +; +; Date: 15-Nov-1990 +; +; Author: Neil Sandlin +; +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; +;============================================================================== + + .386p + +;****************************************************************************** +; I N C L U D E S +;****************************************************************************** + + .XLIST + INCLUDE VMM.Inc + INCLUDE Debug.Inc + INCLUDE VDD.Inc + INCLUDE VWFD.Inc + .LIST + + +VWFD_CB_DATA STRUC + +VWFD_State dd ? + +VWFD_CB_DATA ENDS + + +;****************************************************************************** +; V I R T U A L D E V I C E D E C L A R A T I O N +;****************************************************************************** + +Declare_Virtual_Device VWFD, 3, 0, VWFD_Control, VWFD_Dev_ID,, \ + VWFD_API_PROC , VWFD_API_Proc + + +;****************************************************************************** +; L O C A L D A T A +;****************************************************************************** + +VxD_LOCKED_DATA_SEG + ALIGN 4 + +VWFD_CB_Offset dd 0 +VDD_VMType_Proc dd 0 + +VxD_LOCKED_DATA_ENDS + + +VxD_ICODE_SEG + +;****************************************************************************** +; +; VWFD_Sys_Crit_Init +; +; DESCRIPTION: +; This routine gets some "VM BLOCK" memory. +; +; +;============================================================================== + +BeginProc VWFD_Sys_Crit_Init + + push ebx + VMMCall _Allocate_Device_CB_Area, <, 0> + test eax, eax + jnz SHORT VWFD_CB_OK + Debug_Out "VWFD: Allocate_Device_CB_Area failed" + VMMCall Fatal_Memory_Error + +VWFD_CB_OK: + mov [VWFD_CB_Offset], eax + pop ebx + + clc + ret + + +EndProc VWFD_Sys_Crit_Init + +;****************************************************************************** +; +; VWFD_Device_Init +; +; DESCRIPTION: +; This routine hooks the service that specifies the windowed +; state of a virtual machine. +; +; +;============================================================================== + +BeginProc VWFD_Device_Init + + mov eax, VDD_Set_VMType ; hook this service + mov esi, OFFSET32 VWFD_Set_VMType ; with this little front end + VMMCall Hook_Device_Service ; grab it + jc SHORT not_hooked ; huh? + mov [VDD_VMType_Proc], esi + +not_hooked: + clc + ret + + +EndProc VWFD_Device_Init + +VxD_ICODE_ENDS + + + +;****************************************************************************** + + +VxD_LOCKED_CODE_SEG + +;****************************************************************************** +; +; VWFD_Control +; +; DESCRIPTION: +; +; This is a call-back routine to handle the messages that are sent +; to VxD's to control system operation. +; +; +;============================================================================== + +BeginProc VWFD_Control + + Control_Dispatch Sys_Critical_Init, VWFD_Sys_Crit_Init + Control_Dispatch Device_Init, VWFD_Device_Init + clc + ret + +EndProc VWFD_Control + +;****************************************************************************** +; +; VWFD_Set_VMType +; +; DESCRIPTION: +; This routine keeps track of the windowed state of each VM. +; +; +;============================================================================== + +BeginProc VWFD_Set_VMType + + pushad + mov esi, ebx ; vm block + add esi, [VWFD_CB_Offset] ; point to our area + mov [esi.VWFD_State], eax ; save the current state + popad + jmp [VDD_VMType_Proc] ; chain to real handler + +EndProc VWFD_Set_VMType + + +VxD_LOCKED_CODE_ENDS + + +VxD_CODE_SEG + +BeginDoc +;****************************************************************************** +; +; VWFD_API_Proc +; +; DESCRIPTION: +; +; This is the exported API procedure that is callable from VM's. +; An application needs only to use INT 2Fh, AX=1684h, BX=device ID +; and a call back address is returned. Then, when the +; address is called, eventually it ends up here. +; +; ENTRY: +; ebp -> Client data area +; ebx -> Current VMCB +; +; +;============================================================================== +EndDoc + +BeginProc VWFD_API_Proc + + push ebx ; save ebx + + movzx eax, WORD PTR [ebp.Client_BX] ; Get requested VMID + or eax, eax ; non-zero? + jz short vmcb_ok ; zero, ebx is correct +vmid_scan: + cmp eax, [ebx.CB_VMID] ; found it? + je short vmcb_ok ; yes + VMMCall Get_Next_VM_Handle ; get next + VMMCall Test_Cur_VM_Handle ; back to start of list? + jne vmid_scan ; no + jmp short VWFD_API_Invalid ; return carry + +vmcb_ok: + mov esi, ebx ; vm block + add esi, [VWFD_CB_Offset] ; point to our area + mov edx, [esi.VWFD_State] ; get the state + + and [ebp.Client_Flags], NOT CF_Mask ; clear VM's carry flag + + mov [ebp.Client_AX], dx ; + shr dx, 16 + mov [ebp.Client_DX], dx + + jmp SHORT VWFD_exit + +VWFD_API_Invalid: + or [ebp.Client_Flags], CF_Mask + +VWFD_exit: + pop ebx ; restore ebx + ret + +EndProc VWFD_API_Proc + +VxD_CODE_ENDS + + END + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD.DEF b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD.DEF new file mode 100644 index 00000000..1e1567f7 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD.DEF @@ -0,0 +1,17 @@ +LIBRARY VWFD + +DESCRIPTION 'VWFD Sample VxD for Microsoft Windows' + +EXETYPE DEV386 + +SEGMENTS + _LTEXT PRELOAD NONDISCARDABLE + _LDATA PRELOAD NONDISCARDABLE + _ITEXT CLASS 'ICODE' DISCARDABLE + _IDATA CLASS 'ICODE' DISCARDABLE + _TEXT CLASS 'PCODE' NONDISCARDABLE + _DATA CLASS 'PCODE' NONDISCARDABLE + +EXPORTS + VWFD_DDB @1 + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD.INC b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD.INC new file mode 100644 index 00000000..8ff76e84 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD.INC @@ -0,0 +1,6 @@ +; +; This is the virtual device ID for this VxD. It is a unique number assigned +; to this device. For more information on VxD IDs, please see the VXDID.TXT +; file. +; +VWFD_Dev_ID equ 7fe0h diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD.LNK b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD.LNK new file mode 100644 index 00000000..56b25453 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VWFD/VWFD.LNK @@ -0,0 +1,6 @@ +VWFD.obj +VWFD.386 /NOI /NOD /NOP +VWFD.map /MAP + +VWFD.def + diff --git a/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VXDID.TXT b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VXDID.TXT new file mode 100644 index 00000000..c0ebe3d5 --- /dev/null +++ b/WDK-Samples/Microsoft Windows 3.1 DDK/SAMPLES/VXDID.TXT @@ -0,0 +1,103 @@ +How to Obtain a Virtual Device ID Number +========================================= + +Summary: + +In the DECLARE_VIRTUAL_DEVICE line of every VxD is the "VxD ID" field. +This field will be either a unique number assigned to that virtual +device, or the constant Undefined_Device_ID. + +Certain virtual devices for Windows must a have unique identifier. +A VxD that calls an MS-DOS device or a terminate-and-stay-resident +program must have an ID. An ID is also required for a VxD that provides any +of the following: + + - Service(s) + - a V86 mode API + - a protected mode API + +In addition, Windows provides no protection against loading a VxD using +Undefined_Device_ID more than once. When Windows loads, it gets a list of +all virtual devices to be loaded (through the INT 2fh, AX=1605h broadcast and +the SYSTEM.INI file). If a particular VxD is specified more than once and it +uses Undefined_Device_ID, that VxD will be loaded multiple times. If, +however, the virtual device has its own unique ID, Windows will recognize +the situation, inform the user, and abort the loading process (unless there +is code in the VxD to allow Windows to continue). + +In order to get a unique VxD ID, the form below needs to filled out and +returned to Microsoft. Via electronic-mail, the form can be sent to the +Internet address: vxdid@microsoft.com +This address can be reached from any service that has Internet access. +This includes Compuserve, MCI Mail, etc. + +A prefix may be required to connect to InterNet. For example, +CompuServe mail would be addressed as follows: + + >INTERNET:vxdid@microsoft.com + +Alternately, you can fax this information to Windows DDK Product +Support, at 1-206-93MS-FAX or mail the information to: + + Windows DDK Product Support Services + Microsoft Corporation + One Microsoft Way + Redmond, Washington 98052-6399 + +(E-mail is preferred and will probably have faster turn around time.) + +***************************************************************************** +***************************************************************************** +***************************************************************************** +Virtual Device ID Request +========================= + +Contact Name(s): + +Phone Number(s): ( ) ___- ____ + +CIS or Online Acct: ____________ + +Internet ID:_______________________________________ + + Company Name: + Address: + Address: + City/State/Zip: + Country: +# VxD's planned: + + +----- Repeat following section for each VxD ----- + + VxD Name: _______.386 Virtual __________ Device + + Will this VxD be loaded from TSR? Y/N ___ + + Will the VxD call out to a DOS TSR/device driver + via "INT 2Fh Call out" (INT 2Fh, AX=1607h) ? Y/N ___ + + Please provide estimated number of: + API's/Exports: V86? ___ PM? ___ + VxD Services? ___ + + If replacing a "standard" VxD, which one:______________ + +Purpose of VxD: + + + + +Technical Summary (eg: IRQ hooked, I/O ports trapped, etc): + + + + + +In what way or with what products will this VxD be distributed? + + + + + +Will its API or Services be documented for other companies to call?