Bewerken

Delen via


MbbDeviceReceiveDeviceServiceSessionData function (mbbcx.h)

Client drivers call the MbbDeviceReceiveServiceSessionData method to pass received device service session data up to an application through the MBBCx framework.

Syntax

void MbbDeviceReceiveDeviceServiceSessionData(
  WDFDEVICE      Device,
  DSS_SESSION_ID SessionId,
  WDFMEMORY      Data
);

Parameters

Device

A handle to a framework device object the client driver obtained from a previous call to WdfDeviceCreate.

SessionId

The ID of the device service session obtained from a previous call to MbbAdapterGetSessionId.

Data

A driver-allocated WDFMEMORY object containing the data to pass to the application.

Return value

None

Remarks

For more information, see Handling device service sessions.

Example

The following example shows how a client driver might pass received DSS data to the framework's DSS receive handler.

VOID
MyReceiveDssData(
    _In_ PMY_DEVICE_CONTEXT DeviceContext,
    _In_ ULONG SessionId,
    _In_ PUCHAR InBuffer,
    _In_ ULONG InBufferSize
)
{
    NTSTATUS status = STATUS_SUCCESS;
    WDFMEMORY data;

    // Allocate the WDFMEMORY object from the received data buffer
    status = WdfMemoryAllocatePreallocated(WDF_NO_OBJECT_ATTRIBUTES,
                                            InBuffer,
                                            InBufferSize,
                                            &data);

    // Pass the received data to the framework
    if(NT_SUCCESS(status))
    {
        DeviceContext->DSSPacketsReceivedCount++;

        MbbDeviceReceiveServiceSessionData(DeviceContext->WdfDevice,
                                            SessionId,
                                            data);
        WdfObjectDelete(data);
    }
}

Requirements

Requirement Value
Minimum supported client Windows 10, version 1809
Target Platform Universal
Minimum KMDF version 1.27
Header mbbcx.h
Library mbbcxstub.lib
IRQL PASSIVE_LEVEL