locked
E_AccessDenied in Metro Style App when accessing driver with CreateDeviceAccessInstance

    Question

  • Hi All,

    I have a filter driver. And I can communicate with the filter driver in a Destkop app.
    While in Metro Style App, when trying to access the filter driver with
    CreateDeviceAccessInstance(IID_IDeviceIoControl, deviceInterfacePath,GENERIC_READ,&deviceAccessAsync);
    I get the error : Access Denied.

    As describe in these 3 article: article1, article2, article3, there are some rule to follow so that Metro Style App could access the driver.

    So I strickly follow the 4 rules from Eric as bellow.
    1. Ensure that the driver inf has the property key set to enable access to metro applications.
    2. The device metadata has been authored for the device and it has been loaded into the system.
    3. The device metadata has the right information notably the PrivilegedApplications section
    4. The application manifest as the interface guid declared as a DeviceCapability.

    The following is my configuration. I wonder what's wrong with them.


    The INF file:

    [MyFilter.NTamd64.Interfaces]
    AddInterface={a5dcbf10-6530-11d2-901f-00c04fb951ed},,MyFilter_Interface    ; in bold is HID device interface class GUID

    [MyFilter_Interface]
    AddProperty=MyFilter_Interface_AddProperty

    [MyFilter_Interface_AddProperty]
    {026e516e-b814-414b-83cd-856d6fef4822},6,0x11,,1 ; Privileged Interface



    PackageInfo.xml

      <MetadataKey>
        <HardwareIDList>
          <HardwareID>DOID:USB\VID_0CF3&amp;PID_3006&amp;REV_0001</HardwareID>
        </HardwareIDList>
        <Locale default="true">en-US</Locale>
        <LastModifiedDate>2012-02-5T11:46:53.5108690Z</LastModifiedDate>
      </MetadataKey>


    SoftwareInfo.xml

    <PrivilegedApplications>
        <Package>
            <!-- I set the name and publisher of my app as the following values. -->
            <Identity Name="Microsoft.SDKSamples.MoFx2App" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />    
        </Package>
    </PrivilegedApplications>


    Package.appxmanifest of the Metro Style App. Make the app available to access the device.

    <Capabilities>
        <DeviceCapability Name="a5dcbf10-6530-11d2-901f-00c04fb951ed" />
    </Capabilities>

    There is an icon in Device & Printer Panel, just as the configuration in Device Metadata Package.
    Device in Device&Printer Panel

    It's said that software only driver could not be accessed in Metro Style App.

    My filter driver is not a software only driver. It has a bluetooth dongle to work with it.

    The dongle use a USB to connect to the PC, so there is a USB driver below my filter driver.

    Does this matter ?

    I wonder what's wrong with my configuration or the process which lead to the Access Denied.

    Any help from you will be highly appreciated.

    Thanks



    • Edited by Cary_Win8 Thursday, February 9, 2012 12:34 PM format
    Thursday, February 9, 2012 12:29 PM

Answers

  • Cary,

    You also need to set the custom access attribute of the privileged app declaration in the device metadata.

    Best Wishes - Eric


    • Marked as answer by Cary_Win8 Thursday, March 1, 2012 12:58 PM
    Tuesday, February 21, 2012 10:35 PM
    Moderator
  • Cary,

    Are you sure you enabled test signing (and after that re-booted your computer).

    Best Wishes - Eric

    • Marked as answer by Cary_Win8 Saturday, March 31, 2012 5:46 AM
    Friday, March 30, 2012 3:55 AM
    Moderator

All replies

  • Cary,

    You also need to set the custom access attribute of the privileged app declaration in the device metadata.

    Best Wishes - Eric


    • Marked as answer by Cary_Win8 Thursday, March 1, 2012 12:58 PM
    Tuesday, February 21, 2012 10:35 PM
    Moderator
  • Hi Eric,

    Thanks for you help.

    It works now.

    Cary

    Friday, March 2, 2012 1:52 AM
  • Cary,

    Good to hear!

    Best Wishes - Eric

    Friday, March 2, 2012 1:59 AM
    Moderator
  • Hi Eric,

    Those codes work all righ in Windows 8 Developer Preview.

    As I move my codes to Windows 8 Customer Preview, I got a "Access denied." again.

    I strictly followed those steps and my codes just do not work.

    I wonder where should I pay attention to.

    Regards

    Cary


    Cary

    Thursday, March 29, 2012 7:24 AM
  • Cary,

    Are you sure you enabled test signing (and after that re-booted your computer).

    Best Wishes - Eric

    • Marked as answer by Cary_Win8 Saturday, March 31, 2012 5:46 AM
    Friday, March 30, 2012 3:55 AM
    Moderator
  • Hi Eric,

    It works all right now if I enable test signing.

    Thanks for your help.

    I can access the driver in Win 8 Develop Preview with the driver unsigned and Driver Digital Signature Enforcement disabled.

    So, is it a new restriction on Win 8 Cusumer Preview that I have to enable testing signing and sign the driver ?

    Regards

    Cary


    Cary

    Saturday, March 31, 2012 5:49 AM
  • Cary,

    I was unaware that would work in Win8 Developer Preview.  It is for sure required in Consumer Preview.

    Best Wishes - Eric

    Saturday, March 31, 2012 6:32 AM
    Moderator
  • Hi Eric,

    Thanks for your reply.
    I have another 2 questions on this issue.

    1. Who will provide the Driver Metadat Package ?
    If hardware vendor provides the Driver Metadata Package, they do not know the App Identity.
    If App developer provides the Driver Metadata Package, they may not know the hardware id or model id. And the app could not access new device, for the new device may have another hareware id.

    2. Where is Driver Metadata Package stored ?
    As I remove the package from %ProgramData%\Microsoft\Windows\DeviceMetadataStore and %ProgramData%\Microsoft\Windows\DeviceMetadataCache\mrccache, the Device Icon is still in the Device&Printer Panel.

    I am wondering where is those information stored, in registry or somewhere else ?
    The key could not be found in registry.

    Regards

    Cary


    • Edited by Cary_Win8 Sunday, April 1, 2012 6:55 AM
    Sunday, April 1, 2012 6:54 AM
  • Cary,

    We are working on documentation to address that scenario, that we aim to post soon.

    Best Wishes - Eric

    Tuesday, April 3, 2012 6:12 PM
    Moderator
  • hi Cary,

    is your filter driver an upper filter driver or lower filter driver? as my metro app need to communicate directly with my keyboard lower filter driver as well by sending custo ioctl. the lower filter driver is sitting below my class driver. is that same situation as your?if yes, can you tell how you make  it wok?

    Monday, June 30, 2014 9:45 PM
  • hi Eric,

    my metro app need to communicate directly with my keyboard lower filter driver as well by sending custom ioctl. the lower filter driver is sitting below my class driver. how that can be done?

    Cary,

    We are working on documentation to address that scenario, that we aim to post soon.

    Best Wishes - Eric


    Wednesday, July 2, 2014 11:22 PM