Static Wikipedia February 2008 (no images)

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu

Web Analytics
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.

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 usings 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
Static Wikipedia 2008 (no images)

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -

Static Wikipedia 2007 (no images)

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -

Static Wikipedia 2006 (no images)

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu