Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging

The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.

Check out The OSR Learning Library at:

What difference between Custom Data and Custom Context in WDF

Alex_FunkyAlex_Funky Member - All Emails Posts: 171

What difference between Custom Data and Custom Context in WDF object? For example WdfObjectGetTypedContext & WdfObjectGetCustomTypeData ?
What are best approaches to impl C++ inheritance style with WDF objects?


  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,627

    WDF handles are handles, not types. You can't do inheritance with those.

    Every WDF object can have a context structure. You will always want one with a WDFDEVICE, often with a WDFFILEOBJECT, and sometimes with a WDFQUEUE or WDFREQUEST, but any object can have one or more contexts.

    WdfObjectGetCustomTypeData is only used if you create your own structures that you want KMDF to handle like its own objects. I have never used that, and it's hard for me to think of a use case.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,090
    edited July 13

    Typical WDF drivers call neither of these functions. WdgObjectGetTypedContext is called by your accessor function, that you declare with WDF_CONTEXT_DECLARE_TYPE_WITH_NAME. See the doc page.

    The other, as Mr. Roberts describes, if for rolling your own WDF objects, about which see here.


    Peter Viscarola

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Internals & Software Drivers 25 Jan 2021 LIVE ONLINE
Developing Minifilters 8 March 2021 LIVE ONLINE