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. Sir,can you help me

Sir,can you help me

Scheduled Pinned Locked Moved C / C++ / MFC
c++debugginghelpquestion
5 Posts 2 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.
  • M Offline
    M Offline
    momer
    wrote on last edited by
    #1

    Hi! When I use DeviceIoControl() to communicate with a special device in my VC++ application,the DeviceIoControl() returns zero,and the Getlasterror() returns 50. I defined an IOCTL command in my driver,and used CreateFile to retrieve the device handle. I set a breakpoint at IRP dispatch instance in my driver code with SoftICE, but it seems that the DeviceIoControl() can not communictate with the driver. What's the matter then? Thanks for help! momer -- modified at 2:03 Tuesday 20th September, 2005

    B 1 Reply Last reply
    0
    • M momer

      Hi! When I use DeviceIoControl() to communicate with a special device in my VC++ application,the DeviceIoControl() returns zero,and the Getlasterror() returns 50. I defined an IOCTL command in my driver,and used CreateFile to retrieve the device handle. I set a breakpoint at IRP dispatch instance in my driver code with SoftICE, but it seems that the DeviceIoControl() can not communictate with the driver. What's the matter then? Thanks for help! momer -- modified at 2:03 Tuesday 20th September, 2005

      B Offline
      B Offline
      Branislav
      wrote on last edited by
      #2

      Did you use open, start, stop and close device driver (sys) dinamicly? It is look like driver not started.

      M 1 Reply Last reply
      0
      • B Branislav

        Did you use open, start, stop and close device driver (sys) dinamicly? It is look like driver not started.

        M Offline
        M Offline
        momer
        wrote on last edited by
        #3

        Hi!Branislav, Before use DeviceIoControl() I have used the CreateFile() to retrieve the device handle,and I suppose the CreateFile() can open the device driver. And I can know that the CreateFile() resposes by the IRP_MJ_CREATE with SoftICE,so I think the device driver (sys) has been opened before the application runs to DeviceIoControl(). Thanks! momer

        B 1 Reply Last reply
        0
        • M momer

          Hi!Branislav, Before use DeviceIoControl() I have used the CreateFile() to retrieve the device handle,and I suppose the CreateFile() can open the device driver. And I can know that the CreateFile() resposes by the IRP_MJ_CREATE with SoftICE,so I think the device driver (sys) has been opened before the application runs to DeviceIoControl(). Thanks! momer

          B Offline
          B Offline
          Branislav
          wrote on last edited by
          #4

          Before use any function to call driver you must start driver service if you did not have automatic start during instalation driver. For more details see http://www.l5sg.com/products/source_code.php source code for tipical install, start and stop a service or driver. You can use that code to open and start driver before call CreateFile, ... and after, before the end of your program, close service or driver. All you can check in Administrative Tools\Services. And most important thing is that you must be Administrator or privelege level like administrator.

          M 1 Reply Last reply
          0
          • B Branislav

            Before use any function to call driver you must start driver service if you did not have automatic start during instalation driver. For more details see http://www.l5sg.com/products/source_code.php source code for tipical install, start and stop a service or driver. You can use that code to open and start driver before call CreateFile, ... and after, before the end of your program, close service or driver. All you can check in Administrative Tools\Services. And most important thing is that you must be Administrator or privelege level like administrator.

            M Offline
            M Offline
            momer
            wrote on last edited by
            #5

            Hi!Branislav, Yes.My device is an USB vedio capture and the driver is a streaming minidriver,so when I plug the device into pc,the pnp manager can load and install the minidriver automaticly and then the I/O manager start the minidriver.In fact,as long as the vedio capture device plug into pc,my minidriver begins capturing vedio and audio data from the usb bus.So,I believe that the driver have been started before my calling CreateFile. And,every time the application runs to CreateFile,the SoftICE tells me that the minidriver have recieved a SRB,which is SRB_UNKNOWN_DEVICE_COMMAND. Thanks for help! momer

            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