Virtual device driver and handling interrupts

A while ago i asked if it was possible to use an unmodified 16bit dos application to access I/O ports on an XP machine. i was told this direct hardware access was impossible and there was no way to do it.

well I did more research anyway and found an example Virtual device driver. this VDD hooks the I/O ports i want and makes the appropriate calls to a driver i made. this allows the DOS app to read and write to I/O port ranges for an old ISA card. that all seems to work.

The ISA card uses IRQ 10 though. and during a test run in the program it fails to receive an interrupt from the PC.

So my question is how do a simulate interrupts? how do i know when the PC made an interrupt signal, how do i intercept this. i found a few obscure things about this function: VDDSimulateInterrupt(). but nothing explaining what else i need.

Do i need to handle interrupts in my driver and talk to the driver through the VDD? can the VDD handle interrupts directly? I just need to be able to tell the DOS app when an interrupt happens, using the VDD. unfortunately there are no examples or documentation on such things. the most i get is: oh just use VDDSimulateInterrupt. this is kind of like if someone asked how a car works and i tell them, well you just step on the gas and it goes. never mind even starting it or filling the tank, let alone the complexities of the engine.

if anyone has any examples, any documentation or anything they’ve made themselves that they would be willing to share that would be fantastic. Any insight is appreciated.

xxxxx@gmail.com wrote:

well I did more research anyway and found an example Virtual device driver. this VDD hooks the I/O ports i want and makes the appropriate calls to a driver i made. this allows the DOS app to read and write to I/O port ranges for an old ISA card. that all seems to work.

True. VDDs are an antique technology, but they still work in 32-bit
Windows. They don’t work in 64-bit Windows, where 16-bit apps are
simply not available.

The ISA card uses IRQ 10 though. and during a test run in the program it fails to receive an interrupt from the PC.

I don’t understand this sentence. Cards do not receive interrupts from
the PC. The interrupt always comes from the card.

So my question is how do a simulate interrupts? how do i know when the PC made an interrupt signal, how do i intercept this. i found a few obscure things about this function: VDDSimulateInterrupt(). but nothing explaining what else i need.

The PC never “makes an interrupt signal”. The interrupt comes from the
board.

http://www.osronline.com/DDKx/other/vdd_6ecu.htm

Do i need to handle interrupts in my driver and talk to the driver through the VDD? can the VDD handle interrupts directly?

Yes/no. Your driver has to notify your VDD, which has to notify the
16-bit app.

unfortunately there are no examples or documentation on such things. the most i get is: oh just use VDDSimulateInterrupt. this is kind of like if someone asked how a car works and i tell them, well you just step on the gas and it goes. never mind even starting it or filling the tank, let alone the complexities of the engine.

I hope this is not surprising. 16-bit code has not been relevant for a
very long time. ISA boards were obsolete long before that. No one has
written a new VDD in a decade.

There are sample VDDs in the 3790 DDK (I think the marketing name was
“Windows Server 2003 DDK”).


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

forgive my noobie blunders, and probably sloppy use of terminology. This is the first time i’ve programmed drivers and my knowledge is foggy at best.

I have the 3790 DDK. there doesn’t seem to be a whole lot for interrupt simulation in a VDD, at least not enough for me to understand what’s going on yet.

I understand what i’m doing is outdated. unfortunately this ISA card and Dos program are needed to run test equipment. the company that made them has no plans to redesign the card or software. right now we are stuck running in on windows 95. the machines are getting old and when the hardware gives out we can’t buy any kind of computer to replace it that runs windows 95 anymore.

xxxxx@gmail.com wrote:

I have the 3790 DDK. there doesn’t seem to be a whole lot for interrupt simulation in a VDD, at least not enough for me to understand what’s going on yet.

No doubt. This is a complicated interaction between several entities
that are impersonating one another to various degrees.

The com_vdd sample includes a call to VDDSimulateInterrupt. You can see
in VDDInitialize that they set up a table of I/O port handlers and calls
VDDInstallIoHook to register them. Now, when a 16-bit app does I/O on
those ports, these VDD functions are called.

Those functions then have to decide what to do with those I/O port
requests. They might need to be passed down to a kernel mode driver to
affect real hardware, or they might be handled entirely within the VDD.
If the handler needs to fire an interrupt to the DOS app, it uses
VDDSimulateInterrupt.

If this is mission-critical, you might consider contracting out the work.

I understand what i’m doing is outdated. unfortunately this ISA card and Dos program are needed to run test equipment. the company that made them has no plans to redesign the card or software. right now we are stuck running in on windows 95. the machines are getting old and when the hardware gives out we can’t buy any kind of computer to replace it that runs windows 95 anymore.

Windows 95 runs just fine inside a VM, assuming you can find a computer
these days that has an ISA slot.

The card can’t be that complicated. I’ll bet you could redesign the
device as a USB peripheral for less than the cost of putting together a
VDD, and have a solution that will last another 20 years.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Tim Roberts wrote:

Those functions then have to decide what to do with those I/O port requests.

This is really the key point in all of this. A driver is just a
translator. It translates between two entities that speak different
languages. You just need to figure out how and when to do the translation.

You keep saying you want to simulate an interrupt. What is the trigger
for that? Under what circumstances will you need to simulate the
interrupt? If you’re talking about forwarding a hardware interrupt to
the 16-bit app, then you have several connections to make.

  • You will need a kernel driver for your device
  • Your kernel driver will need to expose a user-mode interface, like an
    ioctl
  • Your VDD will need to register itself with the kernel driver, using
    something like inverted call
  • In your kernel driver’s ISR/DPC, you will signal the VDD by completing
    the inverted call
  • When the inverted call completes, the VDD with then issue
    VDDSimulateInterrupt and resubmit the inverted call


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

On 15-Aug-2013 20:35, xxxxx@gmail.com wrote:

I understand what i’m doing is outdated. unfortunately this ISA card and Dos program are needed to run test equipment. the company that made them has no plans to redesign the card or software. right now we are stuck running in on windows 95. the machines are getting old and when the hardware gives out we can’t buy
any kind of computer to replace it that runs windows 95 anymore.

While your win95 machines last, use this time to move to a modern,
supportable solution, rather than looking at the DOS box thing under
Windows - which is going to obsolescence itself.
Fortunately, now we have alternative operating
systems that run on old or weird hardware (with some tweaking).
And, as Mr. Roberts wrote: “If this is mission-critical, you might
consider contracting out the work.”
– pa