How to write to I/O ports in Windows XP? (Delphi7)

delphi, delphi-7, io, windows

Solution

Have a look at the IO.DLL from Geek Hideout.

IO.DLL allows seamless port I/O operations for Windows 95/98/NT/2000/XP using the same library.

Here is an example: Parallel Port I/O Using Delphi V 6.0

Problem

I am trying to write to ports 0x60 and 0x64, with no luck. Delphi code: ``` procedure PortOut(IOport: WORD; Value: BYTE); assembler; register; asm XCHG DX,AX OUT DX,AL end; ``` Upon calling PortOut, I get an EPrivilege Privileged instruction exception, because `IN` and `OUT` may only execute as Ring0. I would like to know how I can get Ring0 privileges my an application or how I could write to ports 0x60 and 0x64 using some existing external library.

Original source