Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to use _inp and _outp in VC++

How to use _inp and _outp in VC++

Scheduled Pinned Locked Moved C / C++ / MFC
c++comhelptutorial
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vikas amin
    wrote on last edited by
    #1

    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

    G D T N 4 Replies Last reply
    0
    • V vikas amin

      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

      G Offline
      G Offline
      Gary R Wheeler
      wrote on last edited by
      #2

      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;

      1 Reply Last reply
      0
      • V vikas amin

        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

        D Offline
        D Offline
        douglasjordan
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • V vikas amin

          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

          T Offline
          T Offline
          ThatsAlok
          wrote on last edited by
          #4

          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 and WriteFile

          "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

          1 Reply Last reply
          0
          • V vikas amin

            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

            N Offline
            N Offline
            normanS
            wrote on last edited by
            #5

            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.)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups