Metro Device Application - Access Denied RRS feed

  • Question

  • I have been unable to obtain access permissions to connect to my driver through a metro application. Sorry for the long post..

    I am running Windows 8 Consumer Preview Build 8250.

    1. Device metadata package was created using the device metadata wizard application. (I have tried both windows 7 and windows 8 variants)

    2. I have verified that the Metadata has been transitioned to the 'DeviceMetadataCache' folder upon the driver loading for my hardware device.

    3. 'Package.appxmanifest' within the C# application project has been populated with the Identity Name, Publisher, Application ID, and the DeviceCapability device interface GUIDs for the drivers. Which matches the software information within the device meta data package.

    4. The driver has been installed, and is implemented with WDM (Is this a problem?). The driver .inf, AND 'IoSetDeviceInterfacePropertyData' function has been called when the driver is registered on the system.

    5. I have converted the code example from the Managed C++ example, into a pure C# implementation. (I also have a managed C++ library, with these calls, so that I could verify I still get the access denied error through the managed C++ implemetation, to make sure the conversion wasn't the problem.)

    6. When calling 'GetResult' on the ICreateDeviceAccessAsync object, an Access Denied error occurs.

    7. I have tried 'bcdedit.exe -set TESTSIGNING ON', even though my driver is signed, and loads fine in either case.


     1. Am I missing something obvious?
     2. The driver this application is attempting to access is using WDM, is that OK? (Using standard 'IoDeviceCreate').
     3. I have seen some posts that mention using TraceView to watch deviceaccess.dll output, but I haven't had any luck getting this to work. Is anyone able to provide more detailed information on how to do this?

    Thanks for any help.

    Peter Groset


    Wednesday, July 11, 2012 6:56 PM

All replies

  • Peter,

    1) Are you able to open the interface using a desktop application running unelevated?

    2) Did you enable test signing and reboot before applying the metadata?

    There's no problem using a UMDF, KMDF or WDM driver.  If you follow the ReCreateException pattern in the THROW_HR from the Fx2 sample and do not swallow the exception, you may see some more details in VS when you run into this error. 

    Best Wishes - Eric

    Thursday, July 12, 2012 8:09 AM
  • Thanks for the followup, it turns out the driver was being built without the restricted property being set. Once that was set properly I was able to obtain access to the driver.

    I do have another question however. As our implementation relies on events from the hardware. A specific ioctl code is used to receive events from the driver, which marks the IO as pending. In the Win32 implementation, once the pending result is received, a 'WaitForMultipleObjects' function call is used to wait until the IO has been completed. However, with this metro implementation, using 'DeviceIoControlSync', this ioctl is being returned immediately with a bytes returned value of 0, which seems to just be completed as success when the status code of the iocontrol was actually pending. The functionality seems the same for the 'DeviceIoControlAsync' method as well, which I had assumed /hoped was implemented using overlapped structures.

    Assuming all of my assumptions are correct, is there any chance this behavior is going to change in the future, to better account for pending transfers? If not, is there any better method than a crude polling mechanism and changing our driver behavior? Thanks for your time.

    Peter Groset


    Friday, July 13, 2012 8:07 PM
  • I have the question as you. When I call GetResult, access denied is returned. I use wdk8 develop the

    pci device driver. You mention "Thanks for the followup, it turns out the driver was being built without the restricted property being set. Once that was set properly I was able to obtain access to the driver."  I just want to know how to set the restricted property of the driver ???

    Maybe the reason is the same as you. 

    thank you very much!

    Friday, August 3, 2012 3:32 PM
  • HI peter,

    i just come across the same issue of you situation.....i always get the Access Denied error form my custom driver....

    i install the metadata package manually...just follow the step that Microsoft release from here..http://msdn.microsoft.com/en-us/library/windows/hardware/ff548708(v=vs.85).aspx

    but i can't find anything in your step 2.... it's seem that my metadata didn't copy to "DeviceMetadataCache" 

    could you tall me how do you install your metadata package...and how can i find it like you does in your step 2...

    thank you...

    Friday, November 2, 2012 6:22 AM