none
Passing arguments in automation tables RRS feed

  • Question

  • I'm trying to implement DRMForwarding in my driver and examining the WinDDK gfxswap example from here: ...\WinDDK\7600.16385.1\src\audio\gfxswap.xp\driver\filter.cpp


    In the PropertyDrmSetControlID function of Filter.cpp, how is DrmData is "passed" to PropertyDrmSetControlID?  You'll notice that PropertyDrmSetControlID has no arguments where it is called in the automation table DEFINE_KSPROPERTY_TABLE (PinPropertyTable_DRM), yet the actual function definition has three arguments.

    Automation table:

    // Define the KSPROPERTY_DRMAUDIOSTREAM_CONTENTID property item.
    //
    DEFINE_KSPROPERTY_TABLE (PinPropertyTable_DRM)
    {
        DEFINE_KSPROPERTY_ITEM
        (
            KSPROPERTY_DRMAUDIOSTREAM_CONTENTID,    // property item defined in ksmedia.h
            NULL,                                   // does not support "get"
            sizeof(KSPROPERTY),                     // minimum buffer length for property
            sizeof(ULONG)+sizeof(DRMRIGHTS),        // minimum buffer length for returned data
            PropertyDrmSetContentId,                // our "set" property handler
            NULL,                                   // default values
            0,                                      // related properties
            NULL,
            NULL,                                   // no raw serialization handler
            0                                       // don't serialize
        )
    };
    
    

    ...

    Function:

    /*****************************************************************************
     * PropertyDrmSetContentId
     *****************************************************************************
     *
     * Arguments:
     *    irp       - Irp which asked us to do the set.
     *    property  - not used in this function.
     *    drmData   - The content ID and the DRM rights.
     */
    NTSTATUS PropertyDrmSetContentId
    (
        IN PIRP         irp,
        IN PKSPROPERTY  property,
        IN PVOID        drmData
    )
    {
        PAGED_CODE ();
    
        ULONG       contentId = *(PULONG)drmData;
        DRMRIGHTS*  drmRights = (PDRMRIGHTS)(((PULONG)drmData) + 1);

     

    I don't see how this works, unless the drmData argument is actually just an "offsetted" memory location on the stack, which is kinda how they extract the drmRights variable.

    Any light you can shed on this will be helpful for me; I'm not very familiar with automation tables. 


    Thursday, March 21, 2013 10:20 PM