none
WDDM display driver support for Video Capture devices RRS feed

  • Question

  • Hi

    I am trying access the Output Protection Management (OPM) interface directly from an AVStream driver.

    This link (https://msdn.microsoft.com/en-us/library/windows/hardware/ff569894(v=vs.85).aspx) states that "the video capture driver sends a IRP_MN_QUERY_INTERFACE  request to the display port driver (part of Dxgkrnl.sys) for the display miniport driver. After the display port driver receives such a request, it calls the miniport driver's DxgkDdiQueryInterface function and passes a pointer to a QUERY_INTERFACE structure that contains information to initialize the private interface."

    PFILE_OBJECT FileObject;
    PDEVICE_OBJECT DeviceObject;
    UNICODE_STRING dxgkrnl;

    RtlInitUnicodeString(&dxgkrnl, L"\\Device\\Dxgkrnl");
    status = IoGetDeviceObjectPointer(&dxgkrnl, FILE_ALL_ACCESS, &FileObject, &DeviceObject);
    if (NT_SUCCESS(status))
    {
       PIRP Irp;
       IO_STATUS_BLOCK IoSt;
       KEVENT Event;
       PIO_STACK_LOCATION IoStack;
       DXGK_OPM_INTERFACE Opm;

       KeInitializeEvent(&Event, NotificationEvent, FALSE);

       Irp = IoBuildDeviceIoControlRequest(IRP_MJ_PNP, DeviceObject, NULL, 0, NULL, 0, FALSE, &Event, &IoSt);
       if (Irp)
       {
          IoStack = IoGetNextIrpStackLocation(pIrp);
          IoStack->FileObject = FileObject;
          IoStack->MinorFunction = IRP_MN_QUERY_INTERFACE;
          IoStack->Parameters.QueryInterface.InterfaceType = (LPGUID)&GUID_DEVINTERFACE_OPM;
          IoStack->Parameters.QueryInterface.Size = sizeof(DXGK_OPM_INTERFACE);
          IoStack->Parameters.QueryInterface.Version = DXGK_OPM_INTERFACE_VERSION_1;
          IoStack->Parameters.QueryInterface.Interface = (PINTERFACE)&Opm;
          IoStack->Parameters.QueryInterface.InterfaceSpecificData = NULL;
          Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;

          status = IoCallDriver(DeviceObject, Irp);
          if (status == STATUS_PENDING)
          {
             KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
             status = IoSt.Status;
          }
       }
       ObDereferenceObject(DeviceObject);
    }

    The problem is that IoCallDriver is returning STATUS_INVALID_DEVICE_REQUEST due to the Dxgkrn driver not implementing the IRP_MJ_PNP dispatch handler - IoCallDriver simply ends up calling IopInvalidDeviceRequest.

    Is the correct way to access the OPM interface?

    Best Regards

    Steven Broadmeadow

    Friday, December 11, 2015 10:50 AM

All replies

  • Completely invalid approach and ideas.
    1. OPM DDI interface is exposed by WDDM miniport driver, NOT by dxgkrnl. It is useless asking dxgkrnl for something which it doesn't supply.
    2. Quoted link is about child device of WDDM miniport. Topic is unrelated to OPM DDI interface.
    3. Quoted link is not applicable to regular 3rd party driver developers. It states "...tightly coupled with WDDM miniport...". Thus this only applies to the developer of WDDM miniport drivers (Intel, AMD and NVidia).
    Saturday, December 12, 2015 4:49 PM