Called by the operating system to start a Miracast connected session.



NTSTATUS StartMiracastSession(
  _In_  PVOID                         pMiracastContext,
  _In_  SOCKET                        MiracastRTSPSocket,
  _Out_ MIRACAST_SESSION_INFO         *pSessionInfo
{ ... }


pMiracastContext [in]

A pointer to a context associated with a display adapter.

The operating system obtained the context when it called the Miracast user-mode driver's CreateMiracastContext function.

MiracastRTSPSocket [in]

The operating system-supplied network socket handle of the Real Time Streaming Protocol (RTSP).

Note  The Miracast user-mode driver should not close this socket. When the StopMiracastSession function is called, the operating system will close this socket.
pWfdConnectionStats [in]

A pointer to a MIRACAST_WFD_CONNECTION_STATS structure that indicates the Wi-Fi Direct connection statistics.

pSessionInfo [out]

A pointer to a MIRACAST_SESSION_INFO structure that the Miracast user-mode driver should complete after it has obtained the capabilities of the Miracast sink.

Return value

On success, this function returns STATUS_SUCCESS. Otherwise, the function returns an error code defined in the Ntstatus.h header, including the following:

Return codeDescription

The current suggested encode rate cannot sustain a Miracast sink that supports more than 1024 x 768 pixels.



When this function is called, the Miracast user-mode driver should start communicating with the Miracast sink using the Miracast protocol. The driver should gather the capabilities of the sink and the attributes of the monitor that's connected to the sink. The driver should perform enough of the negotiation with the sink to determine whether a monitor is connected to the sink or not. If the driver determines that a monitor is connected to the sink, it should also determine whether the current suggested bit rate is high enough to at least support the lowest sink supported mode of 1024 x 768 pixels.

The driver should also set the value of these members of MIRACAST_SESSION_INFO pointed to by pSessionInfo in these cases:


The driver should set this member to indicate that the sink reported that a monitor connected to the sink during an M3 message exchange.


The driver should set this member to indicate that the driver will reduce the modes exposed to the operating system based on the current suggested encode rate. In the case that a monitor is connected to the sink, the driver should return from StartMiracastSession before it calls the display miniport driver to send a monitor hot-plug detection (HPD) awareness value. This procedure should avoid any deadlocks that could arise due to messages from kernel- to user-mode not being delivered while this thread is in the control of the user-mode function.

Thread Safety

The operating system guarantees that only one of the CreateMiracastContext, DestroyMiracastContext, StartMiracastSession, and StopMiracastSession functions is called at a time.


Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Target platform



Netdispumdddi.h (include Netdispumdddi.h)

See also




Send comments about this topic to Microsoft