none
E_ACCESSDENIED when call (ICreateDeviceAccessAsync*)->GetResult( param1, param2)

    คำถาม

  • I need realize communication between Metro and UMDF, and there is a example of UMDF released by Official Windows SDK;
    http://code.msdn.microsoft.com/Custom-device-access-sample-43bde679/view/Discussions

    I fellow the reference, and debug my code, but some question:

    NO.1: the class ICreateDeviceAccessAsync interfaces are different from Official Windows SDK Sample(release at 2012-03-23). for example, ICreateDeviceAccessAsync::GetResult(), the new interface have two parameter, [_In_ REFIID riid] and_[COM_Outptr_ void **deviceAccess], but the code in official example, there is just one parameter, [[out]  IUnknown **deviceAccess]; so my question, are there any other changes?

    NO.2: I fellow the steps to build driver and metro apps one by one. firstly, run [bcdecit.exe /set testsigning on] bat; secondary, build driver and metro; next, build metadata package, install driver; but finally in metro apps, call ICreateDeviceAccessAsync::GetResult(), return E_ACCESSDENIED.
    So, Are there any other critical steps I missed?

    Actually, it was work correctly couple of weeks ago, but now, the same code, almost same environment, but return access denied. so strange.

    OS: is windows 8 consumer preview. Evaluation copy, build 8250.

    IDE: visual studio 11 ultimate beta x86 dvd 808056.

    Or, there are update from Microsoft? some critical steps are changed?

    This question blocked me server days, so sincerity need help.

    thank you very much.


    • แก้ไขโดย Leonard.Lau 26 เมษายน 2555 8:44
    26 เมษายน 2555 8:40

คำตอบ

ตอบทั้งหมด

  • Leonard,

    You will want to enable test signing:

        bcdedit.exe -set TESTSIGNING ON

    from an elevated command prompt.

    Best Wishes - Eric

    26 เมษายน 2555 9:23
    ผู้ดูแล
  • Eric:

    I already done this, and the operation completed successfully. but still access denied.

    26 เมษายน 2555 9:27
  • Leonard,

    Here are more complete instructions:

    Use traceview from the WDK to view the error messages reported from deviceaccess.dll.  The output from that will tell you what part of the authentication process failed.  If you point traceview at the public symbol server, you should be able to add deviceaccess.dll to your trace session through the UI and get trace message decoding.

    If you don’t have test signing enabled on the system (and haven’t rebooted since enabling it) the device metadata system won’t set the properties that enable device access.  But it will set the other properties, so you may still see the fancy device icon.

    The instructions below will help you figure out if the device property is actually being set on their device.

    DRAFT instructions:

    Debug the device container properties by Using Ddodiag.exe If you debug a device metadata package problem or any device properties problem, we recommend that you use Ddodiag.exe.

    Beginning with Windows 7, the Ddodiag.exe supports listing all values of the device properties in device containers.

    Follow these steps to run Ddodiag.exe:

    1.    Launch command prompt.

    2.    Type “Start /wait ddodiag.exe –o <Filename.xml>” and hit enter key.

    3.    Type notepad.exe <Filename.xml>.

    Note:  The xml contains all properties of device containers in the system. If you are investigating given specific device problem, find the hardwareID or ModelID in the XML output file and see the properties of the device container. If you are investigating whether given property value is set or not, try to find the value in that XML output file.

    Here is how you can quickly tell if Device Metadata is installed properly:

    1.       For the relevant Hardware ID - look for the DDO element (the device container) and see all properties that belong to the container.   One of the properties is MetadataPath. 

    2.       If filename listed in MetadataPath does not match the target name, it isn’t installed properly and solution is to re-install the device metadata.


    If device metadata is installed properly, the values you set for Manufacturer Name or Package Name for that Hardware ID should be listed properly.  At this point, look for the relevant properties needed are properly declared in device metadata.

     Best Wishes - Eric

    26 เมษายน 2555 15:47
    ผู้ดูแล
  • Hi Eric:
    thank you for your advices, but still not work;
    the result when I run command "start /wait ddodiag.exe -o <Filename.xml>" is :

    ========================================================================
    <?xml version="1.0" encoding="UTF-8"?>
    <DDODiag>
      <DDO instanceId="DDO:{00000000-0000-0000-FFFF-FFFFFFFFFFFF}">
        <PropertyStore propertyCount="49">
          <Property>......</Property>
          <Property key="PKEY_DeviceDisplay_MetadataChecksum" type="VT_LPWSTR">
            <!-- this is Metadata package name -->
            <Value>977ec54f-5e59-4e91-8374-b6087f106b81</Value>
          </Property>
          <Property>......</Property>
          <Property key="51236583-0c4a-4fe8-b81f-166aec13f510, 104" type="VT_VECTOR | VT_LPWSTR" vectorCount="1">
            <Value>8F449DC0-2930-439A-BBD8-5E29DCC83195_gqphyyfw6k8dp!App</Value>
          </Property>  
          <Property>......</Property>
          <Property key="PKEY_DeviceDisplay_MetadataPath" type="VT_LPWSTR">
            <!-- the Metadata package Path is correct also -->
            <Value>c:\programdata\microsoft\windows\devicemetadatacache\dmrccache\multiloc\977ec54f-5e59-4e91-8374-b6087f106b81</Value>
          </Property>
          </PropertyStore>
        <DFO instanceId="DFO:ROOT\UNKNOWN\0000">
          <PropertyStore propertyCount="44">
          <Property>......</Property>
          <Property key="PKEY_Device_ClassGuid" type="VT_CLSID">
          <!-- the ClassGuid -->
            <Value>{78A1C341-4539-11D3-B88D-00C04FAD5171}</Value>
          </Property>
          </PropertyStore>
          <DIO instanceId="DIO:\\?\ROOT#UNKNOWN#0000#{5aeb7494-24d3-494c-a5a5-a171f47861b1}">
            <PropertyStore propertyCount="6">
            <Property key="PKEY_DeviceInterface_Enabled" type="VT_BOOL">
              <Value>true</Value>
            </Property>
            <Property key="PKEY_Device_InstanceId" type="VT_LPWSTR">
              <Value>ROOT\UNKNOWN\0000</Value>
            </Property>
            <Property key="PKEY_DeviceInterface_DevicePath" type="VT_LPWSTR">
              <!-- AddInterface={5AEB7494-24D3-494C-A5A5-A171F47861B1},,Echo_Interface ; replace this GUID with targeted driver's interface class GUID -->
              <Value>\\?\ROOT#UNKNOWN#0000#{5aeb7494-24d3-494c-a5a5-a171f47861b1}</Value>
            </Property>
            <Property key="PKEY_DeviceInterface_ClassGuid" type="VT_CLSID">
              <Value>{5AEB7494-24D3-494C-A5A5-A171F47861B1}</Value>
            </Property>
            <Property key="026e516e-b814-414b-83cd-856d6fef4822, 6" type="VT_BOOL">
              <Value>true</Value>
            </Property>
            <Property key="PKEY_Device_ContainerId" type="VT_CLSID">
              <Value>{00000000-0000-0000-FFFF-FFFFFFFFFFFF}</Value>
            </Property>
          </PropertyStore>
        </DIO>
      </DFO>
      </DDO>
      <DDO>.....</DDO>
    </DDODiag>
    ===========================================================

    I can see that metadatapath is correct, and Manufacturer Name or Package Name for that Hardware ID is also correct.

    the follow is code of setting process:
    a) the result of bcdedit:
    the operation completed successfully.
    b) the part of driver inx file:

    [Echo_Install.NT]
    CopyFiles=UMDriverCopy ;,FileList,FileList1

    [Echo_Install.NT.Interfaces]

    AddInterface={5AEB7494-24D3-494C-A5A5-A171F47861B1},,Echo_Interface ; replace this GUID with targeted driver's interface class GUID

    [Echo_Interface]

    AddProperty=Echo_Interface_AddProperty

    c) the setting of Metro Package.appxmanifest file
      <Capabilities>
        <Capability Name="internetClient" />
        <DeviceCapability Name="5AEB7494-24D3-494C-A5A5-A171F47861B1" />
      </Capabilities>

    d) when I debug the follow code, return hr=E_ACCESSDENIED;

    ICreateDeviceAccessAsync* g_DeviceAccess;
    IDeviceIoControl* g_DeviceIoCtrl;

    hr = g_DeviceAccess->GetResult(IID_IDeviceIoControl , (void **)&g_DeviceIoCtrl);

    I think I finish all steps necessary, but still not work correctly.
    if you need any other info about my problem, please let me known.

    thanks Eric,
    Look forward to hearing from you.

    best wishes
    Leonard.

    27 เมษายน 2555 2:37
  • the follow is files snippet in folder of DeviceMetadataCache.

    1.  Package Info:

      <MetadataKey>
        <HardwareIDList>
          <HardwareID>DOID:ComputerMetadata\{6de5d951-d755-576b-bd09-c5cf66b27234}</HardwareID>
        </HardwareIDList>
        <ModelIDList>
          <ModelID>5AEB7494-24D3-494C-A5A5-A171F47861B1</ModelID>
        </ModelIDList>
        <Locale default="true">en-US</Locale>
        <LastModifiedDate>2012-04-27T01:16:19Z</LastModifiedDate>
        <MultipleLocale xmlns="true</MultipleLocale">http://schemas.microsoft.com/windows/2010/08/DeviceMetadata/PackageInfov2">true</MultipleLocale>
      </MetadataKey>

    2.  Software Info:

      <PrivilegedApplications>
        <Package>
          <Identity Name="8F449DC0-2930-439A-BBD8-5E29DCC83195" Publisher="CN=Leonard" AccessCustomDriver="true" />
        </Package>
      </PrivilegedApplications>

    =========================================

    are there any critical steps that I missed or do not correct?

    ====================

    the Metro Solution Project, right-click and see Properties, 

    at label of [Signing], the [Sign the clickOnce manifests] is disable?

    is there impact about Metro apps?

    • แก้ไขโดย Leonard.Lau 27 เมษายน 2555 8:20 add
    27 เมษายน 2555 7:46
  • I have the same problem as Leonard. :(
    8 พฤษภาคม 2555 2:14
  • Are you using an external device?
    9 พฤษภาคม 2555 20:10
    ผู้ดูแล
  • Hi Eric:

    I did not using an external device, just used for communication between Metro Apps with Desktop Apps;

    But It is not stabilize, some machine work, but other not work.

    10 พฤษภาคม 2555 8:31
  • You should not have any communication between your desktop and Metro style apps.
    10 พฤษภาคม 2555 9:02
    ผู้ดูแล
  • if I have requirement that must to do this, then how?

    and what is the use of UMDF?

    10 พฤษภาคม 2555 9:14
  • Communication between desktop and Metro style apps is not supported.

    WDF is composed of KMDF and UMDF.  UMDF is a driver model.

    10 พฤษภาคม 2555 9:24
    ผู้ดูแล
  • could I make communication channel with Metro App and WDF?

    10 พฤษภาคม 2555 9:33
  • I have done this.  Eric, does MS plan to disable this functionality?

    15 พฤษภาคม 2555 0:25
  • I have done this.  Eric, does MS plan to disable this functionality?

                           

    Communication between desktop and Metro style apps is not allowed.


    15 พฤษภาคม 2555 0:38
    ผู้ดูแล
  • This is a Metro app communicating with a user-mode driver, which is implemented as a service and can do things that are normally not allowed by Metro apps.  Will this technique continue to be supported?  The Metro app currently passes certification.  If it is not supported, how will MS enforce this while still maintaining support for Metro apps communicating with user-mode drivers?
    15 พฤษภาคม 2555 23:20
  • Hi Eric Hanson:

    would you mind to tell me what metadata package use for  during Metro app communicating with a user-mode driver?

    when I create a Metadata.package with Device Metadata Authoring Wizard .

    under the associations tap, what means about "Hardware ID" and "Model ID"?

    In  my metadata package, 

    Hardware ID is auto-generated, when I finish to fill the "System manufacture" blank. the value is :

    ComputerMetadata\{6de5d951-d755-576b-bd09-c5cf66b27234};

    Is that necessary? what is it used for?

    Model ID is driver GUID, which defined in [AddInterface] of *.inx files in my Driver solution.

    and Is that necessary? if not necessary, how to make association with Metro app and Driver?

    if not an external device, what about virtual device? software only?

    our driver is software only, so the Hardware ID is "ComputerMetadata";

    Is that ok to communicate with Metro App and user mode driver?

    To the question, Do the virtual device of software driver only need a Hardware ID or Model ID or not? and how?

    Look forward to your respond. 

    thanks.

    18 พฤษภาคม 2555 1:36
  • by the way, Eric Hanson, could you tell me how to check whether the command line "bcdedit.exe /set testsigning on" is executed correctly or not? Is there any command lines or methods to query test signing status?

    And sometime when finished copying packages to system's local metadata store, in the folder "DeviceMetadataCache", I could not find any cache files about my metadata package, and in "Devices and Printers" page, I could not see the relevant icon about my device. no matter that I restart computer or press "F5" function key lots of times, it is still not work.

    but sometimes when finished copying package, I can see the cache files in folder "DeviceMetadataCache" immediately, and in "Devices and Printers" page it is normal too.

    18 พฤษภาคม 2555 8:39
  • by the way, Eric Hanson, could you tell me how to check whether the command line "bcdedit.exe /set testsigning on" is executed correctly or not? Is there any command lines or methods to query test signing status?


    Once you set it and re-boot you will see test mode in the lower right hand corner of the desktop.
    24 พฤษภาคม 2555 21:03
    ผู้ดูแล
  • Hi Eric Hanson:

    would you mind to tell me what metadata package use for  during Metro app communicating with a user-mode driver?

    when I create a Metadata.package with Device Metadata Authoring Wizard .

    under the associations tap, what means about "Hardware ID" and "Model ID"?

    In  my metadata package, 

    Hardware ID is auto-generated, when I finish to fill the "System manufacture" blank. the value is :

    ComputerMetadata\{6de5d951-d755-576b-bd09-c5cf66b27234};

    Is that necessary? what is it used for?

    Model ID is driver GUID, which defined in [AddInterface] of *.inx files in my Driver solution.

    and Is that necessary? if not necessary, how to make association with Metro app and Driver?

    if not an external device, what about virtual device? software only?

    our driver is software only, so the Hardware ID is "ComputerMetadata";

    Is that ok to communicate with Metro App and user mode driver?

    To the question, Do the virtual device of software driver only need a Hardware ID or Model ID or not? and how?

    Look forward to your respond. 

    thanks.

    Leonard,

    Communication from a Metro style device app and a software only driver is not allowed. 

    Below is a sample that demonstrates UMDF to an external USB device:

    http://code.msdn.microsoft.com/OSR-USB-FX2-Sample-2a69f5a6#content

    Best Wishes - Eric

    24 พฤษภาคม 2555 21:45
    ผู้ดูแล
  • Once you set it and re-boot you will see test mode in the lower right hand corner of the desktop.

    Hi Eric:

    Yes, some machines are ok if doing what you said; but as I said above, some machine never show "Test Mode" in lower right hand corner until restart computer more than 5 times. So strange, why?

    28 พฤษภาคม 2555 6:24
  • Dear Eric

    I have one question fuzzy me a long time. I followed the Custom driver access sample to access my own onboard device driver,such as watchdog, i sucessfully access the driver. but only i set the testsigning on it's work, when i turn the testsigning off, the App always return the access denied error.why?

    And one more question, could this type(the same like the Custom Driver Access) of app pass the certification of the Windows store. What is the condition if i want to upload this type of app to the Windows store. i mean if i want to publish my Watchdog App how can i do? Thank you..

    14 มกราคม 2556 15:49