Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 482
Tom Avatar asked Jan 30 '10 10:01

Tom


1 Answers

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

like image 166
stukelly Avatar answered Sep 25 '22 16:09

stukelly