IWDFFile2::GetRelatedFileObject method (wudfddi.h)
[Warning: UMDF 2 is the latest version of UMDF and supersedes UMDF 1. All new UMDF drivers should be written using UMDF 2. No new features are being added to UMDF 1 and there is limited support for UMDF 1 on newer versions of Windows 10. Universal Windows drivers must use UMDF 2. For more info, see Getting Started with UMDF.]
The GetRelatedFileObject method retrieves the IWDFFile interface of a related file object, which is a file object that has a technology-specific relationship with another file object.
Syntax
void GetRelatedFileObject(
[out] IWDFFile **ppRelatedFileObj
);
Parameters
[out] ppRelatedFileObj
The address of a location that receives a pointer to the IWDFFile interface of a UMDF file object. This file object is related to the file object that exposes the IWDFFile2 interface's parent IWDFFile interface.
Return value
None
Remarks
Use of related file objects is technology-specific. For example, kernel streaming uses related file objects to represent the parent filters of child pins.
For more information about related file objects, see the GetRelatedFileObject member of the kernel-mode FILE_OBJECT structure.
Examples
The following code example retrieves the IWDFFile interface of a related file object, from the IWDFFile interface that a driver's IQueueCallbackCreate::OnCreateFile callback function receives.
VOID
STDMETHODCALLTYPE
CMyQueue::OnCreateFile(
__in IWDFIoQueue *pWdfQueue,
__in IWDFIoRequest *pWdfRequest,
__in IWDFFile* pWdfFileObject
)
...
IWDFFile* pWdfRelatedFileObject = NULL;
IWDFFile2* pWdfFileObject2 = NULL;
HRESULT hr = S_OK;
//
// Obtain IWDFFile2 interface from IWDFFile.
//
hr = pWdfFileObject->QueryInterface(IID_PPV_ARGS(&pWdfFileObject2));
if (!SUCCEEDED(hr))
{
goto Done;
}
pWdfFileObject2->GetRelatedFileObject(&pWdfRelatedFileObject);
...
Requirements
Requirement | Value |
---|---|
End of support | Unavailable in UMDF 2.0 and later. |
Target Platform | Desktop |
Minimum UMDF version | 1.9 |
Header | wudfddi.h (include Wudfddi.h) |
DLL | WUDFx.dll |