DxgkCbMiracastSendMessage routine

Sends an asynchronous message to the user-mode display driver.

Syntax


DXGKCB_MIRACAST_SEND_MESSAGE DxgkCbMiracastSendMessage;

NTSTATUS* DxgkCbMiracastSendMessage(
  _In_      HANDLE MiracastHandle,
  _In_      ULONG InputBufferSize,
  _In_      VOID *pInputBuffer,
  _In_      ULONG OutBufferSize,
  _Out_     VOID *pOutputBuffer,
  _In_opt_  DXGKCB_MIRACAST_SEND_MESSAGE_CALLBACK pCallback,
  _In_opt_  PVOID pCallbackContext
)
{ ... }

Parameters

MiracastHandle [in]

A driver-supplied handle to the Miracast display device. This handle was originally passed in the MiracastHandle member of the DXGK_MIRACAST_DISPLAY_CALLBACKS structure in a call to the DxgkDdiMiracastCreateContext function.

InputBufferSize [in]

The size, in bytes, of the input buffer pointed to by pInputBuffer.

pInputBuffer [in]

A pointer to the input buffer. InputBufferSize specifies the size of the buffer.

See Remarks for more info about the input buffer.

OutBufferSize [in]

The size, in bytes, of the output buffer pointed to by pOutputBuffer.

pOutputBuffer [out]

A pointer to the output buffer. OutBufferSize specifies the size of the buffer.

See Remarks for more info about the output buffer.

pCallback [in, optional]

An optional pointer, supplied by the display miniport driver, to the DxgkCbMiracastSendMessageCallback callback function.

If the display miniport driver supplies the pointer to DxgkCbMiracastSendMessageCallback, then after the user-mode driver handles the message, the operating system sends a message to the user-mode driver asynchronously by calling DxgkCbMiracastSendMessageCallback.

See Return value and Remarks sections for more about calls to DxgkCbMiracastSendMessageCallback.

pCallbackContext [in, optional]

An optional driver-supplied pointer to the driver-supplied callback context. The operating system passes this context to the driver-supplied callback routine after the operation has completed.

Return value

Returns STATUS_PENDING if it successfully delivers the message. Otherwise, it returns one of the error codes that are defined in Ntstatus.h.

If the display miniport driver needs to know the status of message handling in user mode, it should supply the DxgkCbMiracastSendMessageCallback function in the pCallback parameter and check the return status in that function's pIoStatusBlock parameter.

Remarks

If the display miniport driver supplies the pInputBuffer and pOutputBuffer buffers, it is the driver’s responsibility to hold these two buffers until the DxgkCbMiracastSendMessageCallback function is called. Otherwise, a random memory corruption issue can be created.

If the driver supplies the DxgkCbMiracastSendMessageCallback in the pCallback parameter, it's possible that DxgkCbMiracastSendMessageCallback will return before DxgkCbMiracastSendMessage returns.

Example calling sequence

Here's example code that shows how to use this function:


typedef struct _CALLBACK_CONTEXT
{
    UCHAR InputBuffer[INPUT_BUFFER_SIZE];
    UCHAR OutputBuffer[OUTPUT_BUFFER_SIZE];
} CALLBACK_CONTEXT, *PCALLBACK_CONTEXT;

...

_IRQL_requires_(PASSIVE_LEVEL)
VOID
DriverCallbackFunction(
    _In_ PVOID Context,
    _In_ PIO_STATUS_BLOCK pIoStatusBlock
    )
{
    PCALLBACK_CONTEXT CallbackContex = (PCALLBACK_CONTEXT)Context;

    ExFreePool(CallbackContex);
}

...

    CallbackContex = (PCALLBACK_CONTEXT)ExAllocatePoolWithTag(
                            PagedPool,
                            sizeof(CALLBACK_CONTEXT),
                            DRIVER_TAG);

    if (CallbackContex == NULL)
    {
        return STATUS_NO_MEMORY;
    }

    RtlZeroMemory(CallbackContex, sizeof(CALLBACK_CONTEXT));

    CallbackContex->InputBuffer[0] = 0xaa;
    CallbackContex->InputBuffer[1] = 0x55;

    Status = 
      pDeviceContext->MiracastCallbacks.DxgkCbMiracastSendMessage(
          pDeviceContext->MiracastCallbacks.MiracastHandle,
          sizeof(CallbackContex->InputBuffer),
          CallbackContex->InputBuffer,
          sizeof(CallbackContex->OutputBuffer),
          CallbackContext->OutputBuffer,
          &DriverCallbackFunction,
          CallbackContex);


Requirements

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Header

Dispmprt.h (include Dispmprt.h)

IRQL

PASSIVE_LEVEL

See also

DXGK_MIRACAST_DISPLAY_CALLBACKS
DxgkCbMiracastSendMessageCallback
DxgkDdiMiracastCreateContext

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft