VOGONS


First post, by TinPlat

User metadata
Rank Newbie
Rank
Newbie

Hello everyone,

I have been working on a project to add IntelliMouse-style scroll wheel support to Windows 3.1 in 386 enhanced mode. The idea is to have a VxD (WHEELVXD.386) that hooks IRQ12 (or uses I/O trapping on port 0x60) to parse PS/2 packets, detect the wheel via the standard rate sequence (200 → 100 → 80 Hz), and accumulate wheel deltas. A companion patch to the DDK mouse driver (MOUSE.DRV) exports WheelSupported and GetWheelDelta that forward calls to the VxD.

What is working so far:
- The VxD compiles without errors (MASM 5.10B, link386, addhdr).
- Windows 3.1 boots normally with device=WHEELVXD.386 in SYSTEM.INI.
- MOUSE.DRV exports the two functions (GetProcAddress returns valid addresses).

The problem:
- Calling INT 2Fh, AX=1684h, BX=0xE5E5 returns ES:DI = 0 (NULL). The VxD API entry point is not found.
- Consequently, WheelSupported and GetWheelDelta always return 0.

What I have tried:
- Direct IRQ12 hooking (via VPICD_Virtualize_IRQ) – Windows boots but the entry point still not found.
- I/O trapping with Install_IO_Handler on port 0x60 – same result.
- Removing all memory allocation (_PageAllocate) to isolate the issue – still no entry point.
- Verified the device ID in Declare_Virtual_Device matches 0xE5E5.
- Verified the VxD is in SYSTEM directory and the .386 file passes addhdr.

My suspicion:
- The VxD may be failing initialization silently (e.g., _PageAllocate returns error, or I/O handler installation fails), causing Windows to load it but not register its device ID correctly.
- Or the device ID 0xE5E5 might conflict with something else, though I chose it arbitrarily.

What I am asking for:
If anyone here has experience with Windows 3.1 VxD development, I would be very grateful if you could take a look at the code and point out what I am missing or doing wrong. The full source code (including build scripts and test programs) is available on GitHub:

github.com/qv1145145/Windows-3.1-PS-2-Mouse-Wheel-Support/

Any insights, suggestions, or even a small fix would be highly appreciated. I am happy to provide additional details if needed.

Thank you in advance for your time and help!

Reply 1 of 1, by javispedro1

User metadata
Rank Member
Rank
Member

I have done this in VBADOS: https://git.javispedro.com/cgit/vbados.git/ab … 6-enhanced-mode
You have the patch needed for VKD right there. Otherwise VKD will always virtualize the mouse first and you can't do anything with it.
You need to patch the VKD source with that then install vbmouse.exe/vbmouse.drv. It works outside VBox too, and the latest version from source even supports later mice with vertical+horizontal wheel .

My only problem with my approach is that since this VKD is MS sample code I'm not happy with re-distributing it, so I can only distribute the patch. But it seems your AI has no problem with that and happily puts MS copyright code in github...