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. USB CreateFile() Access is denied

USB CreateFile() Access is denied

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 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.
  • _ Offline
    _ Offline
    __John_
    wrote on last edited by
    #1

    When trying to open a USB keyboard device I get "Access is denied".

    HANDLE hDevice = CreateFile (
    lpDevicePath,
    GENERIC_READ | GENERIC_WRITE,
    FILE_SHARE_READ | FILE_SHARE_WRITE,
    NULL,
    OPEN_EXISTING,
    FILE_FLAG_OVERLAPPED,
    NULL);

    lpDevicePath is: \\?\root#rdp_kbd#0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd} If I do not ask for any access, i.e...

    HANDLE hDevice = CreateFile (
    lpDevicePath,
    0,
    FILE_SHARE_READ | FILE_SHARE_WRITE,
    NULL,
    OPEN_EXISTING,
    FILE_FLAG_OVERLAPPED,
    NULL);

    I get a valid handle but I get "Access is denied" when I use it to call WinUsb_Initialize(). Any ideas? Thanks.

    “If I had asked people what they wanted, they would have said faster horses.” ― Henry Ford

    D 1 Reply Last reply
    0
    • _ __John_

      When trying to open a USB keyboard device I get "Access is denied".

      HANDLE hDevice = CreateFile (
      lpDevicePath,
      GENERIC_READ | GENERIC_WRITE,
      FILE_SHARE_READ | FILE_SHARE_WRITE,
      NULL,
      OPEN_EXISTING,
      FILE_FLAG_OVERLAPPED,
      NULL);

      lpDevicePath is: \\?\root#rdp_kbd#0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd} If I do not ask for any access, i.e...

      HANDLE hDevice = CreateFile (
      lpDevicePath,
      0,
      FILE_SHARE_READ | FILE_SHARE_WRITE,
      NULL,
      OPEN_EXISTING,
      FILE_FLAG_OVERLAPPED,
      NULL);

      I get a valid handle but I get "Access is denied" when I use it to call WinUsb_Initialize(). Any ideas? Thanks.

      “If I had asked people what they wanted, they would have said faster horses.” ― Henry Ford

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      See here.

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous

      _ 1 Reply Last reply
      0
      • D David Crow

        See here.

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous

        _ Offline
        _ Offline
        __John_
        wrote on last edited by
        #3

        Thanks David.

        “If I had asked people what they wanted, they would have said faster horses.” ― Henry Ford

        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