Search code examples
vb.netdriverisa-bus

ISA port communication with Visual Basic


Is there any chance how I could write something to ISA card in Visual Basic .Net for Windows XP and higher? (I know Win XP and higher have restriction so U cant directly write data to port)

I have also done some research and if I understand the situation I have only 2 options:

  1. Write driver (very problematic option :)) or

  2. Try to use existing driver in kernel32 like driver to serial/paralel port.

If there arent any other options, how I have to modify "using of serial/paralel port" to use it for ISA port?


Solution

  • Modern versions of Windows will not allow direct port I/O from a user application. Your program is running in Ring 3, not Ring 0. You need some kind of driver to do the port I/O on your application's behalf.

    The first thing to do would be to contact the card manufacturer and see if they made a Windows driver for your board.

    If a Windows driver is not available, and you are only looking to do basic reigster reads and writes (no interrupts or DMA), there are some freely-downloadable libraries that you can download to do port I/O. Basically, the library includes a dummy "driver" that sits in Ring 0 and does the I/O for you. I have the most experience with WinIO.

    WinIO has a C/C++ API, nothing .Net/CLR. You will need to use P/Invoke to call the WinIO functions from managed code.

    If you search around, you may find a toolkit similar to WinIO that provides APIs for managed code. (Edit: Here is one I have bookmarked called DirectIO.)

    The biggest problem with WinIO is that you are limited to basic register reads/writes. If you need interrupts or DMA, you are out of luck. At that point, you will need to write a "real" driver.

    Writing a driver can be a pretty major task for the uninitiated (there is a lot you will screw up). You will need to start by getting a copy of the Windows Driver Kit, and studying Microsoft's Kernel Mode Driver Framework. You could also look into purchasing a copy of Jungo WinDriver. WinDriver is a third party tool that simplifies driver development considerably, but it is quite expensive for a one-off project.