Partager via


IWMDMDeviceSession::EndSession

banner art

The EndSession method ends a device session.

Syntax

HRESULT EndSession(
  WMDM_SESSION_TYPE  type,
  BYTE*  pCtx,
  DWORD  dwSizeCtx
);

Parameters

type

[in]  Type of session to end, composed of any logical combination of the following defined bit fields.

Session type Description
WMDM_SESSION_TRANSFER_TO_DEVICE This session includes transferring content to the device.
WMDM_SESSION_TRANSFER_FROM_DEVICE This session includes transferring content from the device.
WMDM_SESSION_DELETE This session includes deleting content on the device.
WMDM_SESSION_CUSTOM The session type is device specific.

pCtx

[in]  Pointer to the session context buffer for private communication between the application and the service provider. Windows Media Device Manager does not do anything with this context except validate it. It can be NULL if dwSizeCtx is 0.

dwSizeCtx

[in]  Size of the context buffer, in bytes. If the size is 0, pCtx is ignored. If the size is non-zero, pCtx must be a valid pointer

Return Values

The method returns an HRESULT. All the interface methods in Windows Media Device Manager and service provider can return any of the following classes of error codes:

  • Standard COM error codes
  • Windows error codes converted to HRESULT values
  • Windows Media Device Manager error codes

For a complete list of possible error codes, see Error Codes.

Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK The method succeeded
E_INVALIDARG The session type to end does not match the current session type.
WMDM_E_CALL_OUT_OF_SEQUENCE Attempted to call EndSession before BeginSession.

Remarks

The session brackets a group of operations to a device, allowing Windows Media Device Manager components to optimize performance by performing common setup and shutdown functions only once, rather than with each individual transfer. For details see BeginSession.

In response to an EndSession call, Windows Media Device Manager calls EndSession on the secure content provider and the service provider. If either of them fails the call, Windows Media Device Manager returns an error. In that case, it is possible that EndSession succeeded for one of the components.

Applications having knowledge of the underlying service provider can use the context buffer to pass context-specific data to it.

Requirements

Header: Defined in wmdm.idl.

Library: mssachlp.lib

See Also