Though one... And unfortunately, depends on which OS you develop

You'll need an external component (DLL, OCX, VxD, etc) to be able to access hardware at low level. This holds especially for any NT-based OS, since the OS "protects"

the hardware.
Once you have the external component, accessing your choice of port depends on the programming model of the component.