Web - Amazon

We provide Linux to the World


We support WINRAR [What is this] - [Download .exe file(s) for Windows]

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
SITEMAP
Audiobooks by Valerio Di Stefano: Single Download - Complete Download [TAR] [WIM] [ZIP] [RAR] - Alphabetical Download  [TAR] [WIM] [ZIP] [RAR] - Download Instructions

Make a donation: IBAN: IT36M0708677020000000008016 - BIC/SWIFT:  ICRAITRRU60 - VALERIO DI STEFANO or
Privacy Policy Cookie Policy Terms and Conditions
User-Mode Driver Framework - Wikipedia, the free encyclopedia

User-Mode Driver Framework

From Wikipedia, the free encyclopedia

The User-Mode Driver Framework is a device-driver development platform first introduced with Microsoft's Windows Vista operating system, and is also available for Windows XP. It facilitates the creation of drivers for certain classes of devices, where the driver operates entirely in user-land.

Badly written drivers can cause severe damage to a system since all drivers have high privileges and direct access to the kernel. The new User-Mode Drivers in Windows Vista are not able to directly access the kernel but instead use it through a dedicated API. If an error occurs the new framework allows for an immediate restart of the driver and does not impact the system. Typically these devices are connected to the computer through a bus technology such as USB or Firewire.

The first version of the UMDF was shipped as part of Windows Media Player version 10. Code-named "Crescent", it was designed to support the Media Transfer Protocol driver, and no public interfaces or documentation was provided for it. After this, Microsoft decided to turn UMDF into a device driver development platform.[1]

Contents

[edit] COM-style Architecture

A UMDF Driver is a COM based DLL, but UMDF doesn't use the COM runtime library, only uses COM as a programming pattern. UMDF does not use COM for loading, unloading, or controlling concurrency (that is apartment)

UMDF calls DllGetClassObject to get a pointer to an IClassFactory interface in the driver and then uses the CreateInstance method of the IClassFactory interface to create an instance of the driver object. The DLL provides routines that COM will use to get the IWDFDriver-based object:

  • DllCanUnloadNow
  • DllGetClassObject
  • DllRegisterServer
  • DllUnregisterServer

[edit] DllMain

UMDF driver is a Dynamic Link Library (DLL), that runs as an in-process COM server, and contains the code for DllMain, which is a well-known entry point for a DLL.

BOOL WINAPI DllMain(
       HINSTANCE ModuleHandle,
       DWORD Reason,
       PVOID /* Reserved */)
{
  if (DLL_PROCESS_ATTACH == Reason) {

    WPP_INIT_TRACING(MYDRIVER_TRACING_ID);

    g_ModuleHandle = ModuleHandle;
  }
  else if (DLL_PROCESS_DETACH == Reason) {

    WPP_CLEANUP();
  }

  return TRUE;
};

UMDF supports IXX abstract classes with which any KMDF developer as following:

  • IWDFDriver
  • IWDFDevice
  • IWDFFile
  • IWDFIoQueue
  • IWDFIoRequest
  • IWDFIoTarget
  • IWDFMemory
  • IWDFObject

[edit] IUnknown interface

COM interfaces are C++ abstract base classes. These UDMF objects provide signatures for the routines (callback functions) they support in the form of abstract classes (interfaces), that are pure virtual functions, UDMF driver which support an interface must implement all the functions in that callback's interface. And COM objects all support an interface called IUnknown.

IUnknown interface supports three methods:

interface IUnknown
{
 virtual ULONG AddRef(void) = 0; 
 virtual HRESULT QueryInterface(REFIID riid, void **ppvObject) = 0;
 virtual ULONG Release(void) = 0; 
};

[edit] IDriverEntry interface

UMDF driver must support IDriverEntry interface, and need to implement OnAddDevice callbacks.

class CMyDriver : public IDriverEntry, public CUnknown
{
   virtual ULONG STDMETHODCALLTYPE AddRef(VOID){
       return __super::AddRef();
   }

   virtual ULONG STDMETHODCALLTYPE Release(VOID){
       return __super::Release();
   }

   virtual HRESULT STDMETHODCALLTYPE QueryInterface(__in REFIID InterfaceId, __out PVOID *Object){
       return __super::Release(InterfaceId, Object);
   }  
   
   virtual HRESULT Initialize(__in IWDFDriver* FxDriver,__in IWDFDeviceInitialize * FxDeviceInit){...}
   
   virtual HRESULT STDMETHODCALLTYPE OnDeviceAdd( __in IWDFDriver *FxWdfDriver, __in IWDFDeviceInitialize *FxDeviceInit){
     ...
   }    
   
   virtual VOID STDMETHODCALLTYPE OnDeinitialize(__in IWDFDriver *FxWdfDriver) {
       return;
   }
   ...
};

[edit] IDevicePnpHardware interface

Create CMyDevice class that inherits from IIDevicePnpHardware and CUnknown class.

class CMyDevice : public CUnknown, public IDevicePnpHardware
{
 private:
   IWDFDevice *m_FxDevice;
 public:
 HRESULT Initialize(__in IWDFDriver* FxDriver,__in IWDFDeviceInitialize * FxDeviceInit)
 {
  return S_OK;
 }
 
 HRESULT OnPrepareHardware(__in IWDFDevice * /* FxDevice */)
 {
  return S_OK;
 }
 ...
};

[edit] References

  1. ^ Charles Torre, Peter Wieland, Peter Wieland: User Mode Driver Framework, Microsoft, 2006-09-18.

[edit] See also

[edit] External links

In other languages
Our "Network":

Project Gutenberg
https://gutenberg.classicistranieri.com

Encyclopaedia Britannica 1911
https://encyclopaediabritannica.classicistranieri.com

Librivox Audiobooks
https://librivox.classicistranieri.com

Linux Distributions
https://old.classicistranieri.com

Magnatune (MP3 Music)
https://magnatune.classicistranieri.com

Static Wikipedia (June 2008)
https://wikipedia.classicistranieri.com

Static Wikipedia (March 2008)
https://wikipedia2007.classicistranieri.com/mar2008/

Static Wikipedia (2007)
https://wikipedia2007.classicistranieri.com

Static Wikipedia (2006)
https://wikipedia2006.classicistranieri.com

Liber Liber
https://liberliber.classicistranieri.com

ZIM Files for Kiwix
https://zim.classicistranieri.com


Other Websites:

Bach - Goldberg Variations
https://www.goldbergvariations.org

Lazarillo de Tormes
https://www.lazarillodetormes.org

Madame Bovary
https://www.madamebovary.org

Il Fu Mattia Pascal
https://www.mattiapascal.it

The Voice in the Desert
https://www.thevoiceinthedesert.org

Confessione d'un amore fascista
https://www.amorefascista.it

Malinverno
https://www.malinverno.org

Debito formativo
https://www.debitoformativo.it

Adina Spire
https://www.adinaspire.com