locked
Directly access driver from Metro style apps

    Question

  • Allow me to ask a very dump question. I was asked to find a way to directly call to a WDM driver to set IOCTL calls or KSProperty calls from Metro style apps. From the samples I read so far, it seems that no Metro style apps call directly into the driver, they do this via a custom C++ WinRT components. May I know if it is technically not possible for a Metro style apps to call directly into driver even if the Metro style apps is written in C++?

     

    Thank you.

    Tuesday, November 29, 2011 8:36 AM

Answers

  • Yes,

     

    The Creatfile method will not work for Metro style apps.  Below are the requirements for this to work:

     

    1. Ensure that the driver inf has the property key set to enable access to metro applications. Look at the OSRUSBFX2 sample INF for information on how to set this property key.
     
    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

    • Marked as answer by Angela Yan Monday, December 12, 2011 6:13 AM
    Tuesday, December 06, 2011 10:20 PM
    Moderator
  • Angela,

     

    Yes:  this means driver/device to support IDeviceIoControl.

    Support in the //build preview covers built in devices and devices attached to external busses such as the MoFx2App Sample and external credit card readers.

     

    Best Wishes - Eric

    Saturday, December 10, 2011 12:13 AM
    Moderator

All replies

  • Angela,

     

    Which device do you want to talk to?

     

    Best Wishes - Eric

    Tuesday, November 29, 2011 10:34 PM
    Moderator
  • Hi Eric,

     

    I need to talk to a filer driver for web cam, an AVStreamDriver for USB audio device and a HDAudio driver.

     

    Thank you.

    Wednesday, November 30, 2011 2:36 AM
  • Angela,

    The requirement is C++ code to IDeviceIoControl to transfer information between a Metro style app and a custom driver.    It is your choice whether to write it as a monolithic app or with a Windows Runtime Component like the FX2 sample app does. 

    I am looking into the three drivers you mention to see if they will work.  Below is a presentation that covers the question in general:

    http://channel9.msdn.com/Events/BUILD/BUILD2011/HW-747T

    Best Wishes - Eric

     

    Thursday, December 01, 2011 9:56 PM
    Moderator
  • Hi Eric,

     

    Thanks for the help. I will definitely check out the presentation. Just a short question, is it true that a Metro style apps can only send IOCTL and KSProperty call to driver via IDeviceIoControl interface (Meaning, the old CreateFile way does not work any more)? And is there a link or any info page that states the requirement for the driver (or the C++ component) to be able to support the IDeviceIoControl interface, I can't find anything related this in the API documentation?

     

    Looking forward to your answer.

    Thank you.

    Angela

    Friday, December 02, 2011 9:17 AM
  • Yes,

     

    The Creatfile method will not work for Metro style apps.  Below are the requirements for this to work:

     

    1. Ensure that the driver inf has the property key set to enable access to metro applications. Look at the OSRUSBFX2 sample INF for information on how to set this property key.
     
    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

    • Marked as answer by Angela Yan Monday, December 12, 2011 6:13 AM
    Tuesday, December 06, 2011 10:20 PM
    Moderator
  • The Creatfile method will not work for Metro style apps.  Below are the requirements for this to work:

    Hi Eric,

    Thank you for the help. I assume the "this" in your sentence means for a driver/device to support IDeviceIoControl interface.

    Any update on the 3 drivers scenario I mentioned above? Or do you mean as long as the 3 drivers fulfill the 4 points in your email, they can be called by IDeviceIoControl too?

     

    Thank you.

    Angela

    Wednesday, December 07, 2011 10:14 AM
  • Angela,

     

    Yes:  this means driver/device to support IDeviceIoControl.

    Support in the //build preview covers built in devices and devices attached to external busses such as the MoFx2App Sample and external credit card readers.

     

    Best Wishes - Eric

    Saturday, December 10, 2011 12:13 AM
    Moderator
  • Hi Eric,

     I have UMDF-Fx2 sample Driver and Custom Access Sample Metro App from MSDN. The entire setup is already available the metadata, INF are all fine. I want to see the entire flow of control from the metro app to the UMDF driver. I mean when I make IOCTL call it should hit the driver code. I don't have the hardware. Is there any way to simulate or use a virtual h/w for this pupose. My concern is not the communication between driver and device but the communication between app and driver which I want to visualize. Is this possible without an actual Hardware in place.

    Thanks and Regards

    Preyes M

    Wednesday, September 17, 2014 5:23 AM
  • This may be helpful:

    http://blogs.msdn.com/b/usbcoreblog/archive/2009/10/10/getting-started-with-usb-driver-development.aspx

    4. Obtain a test device

    • In most cases, the developer for a new driver will be given a device and/or a specification for a device and told to write a driver for it. If the device is just in prototype development phase, it will be helpful to use below Device Simulation Framework (DSF) to build a simulator following the specification for development and testing purposes.
    • OSR Learning Kits has all the required hardware specifications to implement a driver. It can be obtained from http://www.osronline.com/. OSR Learning Kits is the best actual hardware to study USB samples in WDK.
    • You can use the Device Simulation Framework (DSF) which is a part of WDK for USB Devices to test your driver (Choose install it during WDK installation). DSF only uses software to simulate USB devices, so that you do not need any special hardware. DSF has already created some sample USB Device Simulators such as HID Generic Device, Loopback Device, Audio Device and Keyboard Device. You can use them directly if you install DSF on your computer. There is an instruction to guide you to test your USB driver with a USB Device Simulator.


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, September 17, 2014 7:20 PM
    Moderator
  • Hey Eric,

      Thanks for the Hardware Simulation idea. My only query is without an hardware/Simulation can i make a IOCTL call from the sample metro app and check if it is received in the UMD / KMD driver code.  if there is any other sample for the developer to see the flow of instruction from the metro style app to the KMD / UMD driver code.

    Thanks

    Preyes M

    Thursday, September 18, 2014 3:19 AM
  • Preyes M,

    It might be possible as a test.  Your actual driver needs to be for hardware (or filtering hardware).  You are unable to make a WSDA for a device that does not belong to your company and release it to the Windows Store (for instance a physical serial port would not work as everyone on the computer would expect to be able to use it).  

    You could run it as an experiment / proof of concept perhaps.  It is much easier with the sample and the sample USB board.  I estimate the time involved in a non-hardware test to be significant.


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, September 19, 2014 11:43 PM
    Moderator