How to use _inp and _outp in VC++
-
I want to access the basic port by using this simple functions _inp and _outp which are used in the TurboC compilers or say compilers for DOS. In windows i tried to use them in my MFC programe but there are Runtime errrors stating Unprivilaged instruction . I also tried to use the assmebly code for the same but the same error is disaplayed . can anyone suggest me any other option for this thankin you vikas Vikas Amin Embin Technology Bombay vikas.amin@embin.com
-
I want to access the basic port by using this simple functions _inp and _outp which are used in the TurboC compilers or say compilers for DOS. In windows i tried to use them in my MFC programe but there are Runtime errrors stating Unprivilaged instruction . I also tried to use the assmebly code for the same but the same error is disaplayed . can anyone suggest me any other option for this thankin you vikas Vikas Amin Embin Technology Bombay vikas.amin@embin.com
I am afraid you are out of luck in the Windows world. Input and output instructions are privileged, which means that only device drivers are allowed to use them. The purpose of this is to protect system integrity and to let the operating system arbitrate access to the hardware, which is considered a shared resource. If you are trying to control a specific piece of hardware, you should contact the manufacturer to see if they provide a Windows driver and interface software that you can use.
Software Zen:
delete this;
-
I want to access the basic port by using this simple functions _inp and _outp which are used in the TurboC compilers or say compilers for DOS. In windows i tried to use them in my MFC programe but there are Runtime errrors stating Unprivilaged instruction . I also tried to use the assmebly code for the same but the same error is disaplayed . can anyone suggest me any other option for this thankin you vikas Vikas Amin Embin Technology Bombay vikas.amin@embin.com
You will need to create a miniport driver (.sys) that can map that memory and access that I/O. After that you can create a macro that uses the inp/outp syntax to call the miniport. See MSDN for more info on miniports.
-
I want to access the basic port by using this simple functions _inp and _outp which are used in the TurboC compilers or say compilers for DOS. In windows i tried to use them in my MFC programe but there are Runtime errrors stating Unprivilaged instruction . I also tried to use the assmebly code for the same but the same error is disaplayed . can anyone suggest me any other option for this thankin you vikas Vikas Amin Embin Technology Bombay vikas.amin@embin.com
vikas amin wrote:
I want to access the basic port by using this simple functions _inp and _outp which are used in the TurboC compilers or say compilers for DOS.
What about simple Api like
ReadFile
andWriteFile
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV
-
I want to access the basic port by using this simple functions _inp and _outp which are used in the TurboC compilers or say compilers for DOS. In windows i tried to use them in my MFC programe but there are Runtime errrors stating Unprivilaged instruction . I also tried to use the assmebly code for the same but the same error is disaplayed . can anyone suggest me any other option for this thankin you vikas Vikas Amin Embin Technology Bombay vikas.amin@embin.com
I have used the IO library you can find at http://www.logix4u.net/inpout32.htm[^] This allows your code to run on Windows 9x or XP. Works nicely! As I recall, the documentation is a bit poor, for example, it is not clear that the input and output calls are 8-bit. (This may have been fixed by now.)