I have to agree wholeheartedly with slarty on this, the whole point of the protected sub-systems is to prevent this sort of shenanigans, If you are however determined to follow the dark path there are ways. I suggest you begin my studying the NT kernel: the NT executive and the HAL in particular. There are a few ways to go about it, one being to use the HAL functions,the other is to bypass the HAL completely doing this however will most likely render your code totally un-portable. Since you want to be able to execute your code from windows you are going to need a Kernel mode device driver which will allow you to skip the LPC, which is used as RPC for user-mode api's, and implement the HAL functions. You will need the Windows DDK(Driver Devolpement Kit) for all this. The other and even more suicidal method you could use to destroy your computer with, would be to create a DMA kernel mode driver which will basically allow you to overwrite your kernel if you feel like it(and dont blame me if you do! this will not use IRQ's just pure memory acces so you better know where you're going) There is also the interesting method of abusing undocumented kernel entry points with drivers,so I have provided some links for you but you will most likely find the best information on this from Hoglund at http://www.rootkit.com. He's a great guy and IMHO the undisputed champion of mucking about in the seedy underworld of the Windows kernel. Now that I have sufficiently attempted to disuade you, if you do have a go at the daunting task ahead have fun and let me know if you find something interesting.

http://www.microsoft.com/whdc/ddk/winddk.mspx
http://www.windowsitlibrary.com/Content/280/01/1.html
http://www.sybera.de/download/ioport_mapping.doc

-Maestr0

Edit: You can of course do all the interrupt access you like in a 16-bit environment due to the fact NT creates a VDM(virtual dos machine) in memory and just pretends for your sake to make you happy, but if you're attempting something you shouldnt Windows will catch you(still protected process aka user-mode)