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

Home NTDEV
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: https://www.osr.com/osr-learning-library/


What difference between Custom Data and Custom Context in WDF

Alex_FunkyAlex_Funky Member - All Emails Posts: 159

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?

Comments

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,483

    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: 7,886
    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.

    Peer

    Peter Viscarola
    OSR
    @OSRDrivers

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!
Kernel Debugging 30 Mar 2020 OSR Seminar Space
Developing Minifilters 15 Jun 2020 LIVE ONLINE
Writing WDF Drivers 22 June 2020 LIVE ONLINE
Internals & Software Drivers 28 Sept 2020 Dulles, VA