IWMSEventAuthorizationPlugin::GetAuthorizedEvents
Previous | Next |
IWMSEventAuthorizationPlugin::GetAuthorizedEvents
The GetAuthorizedEvents method retrieves an array of events that must be authorized by the plug-in.
Syntax
HRESULT GetAuthorizedEvents( VARIANT* pvarEvents );
Parameters
pvarEvents
[out] Pointer to a VARIANT containing a SAFEARRAY of WMS_EVENT_TYPE enumeration values.
Return Values
If the method succeeds, the plug-in must return S_OK. To report an error, the plug-in can return any HRESULT other than S_OK. If the plug-in uses the IWMSEventLog interface to log error information directly to the Windows Event Viewer, it is recommended that it return NS_E_PLUGIN_ERROR_REPORTED. Typically, the server attempts to make plug-in error information available to the server object model, the Windows Event Viewer, and the troubleshooting list in the details pane of the Windows Media Services MMC. However, if the plug-in uses the IWMSEventLog interface to send custom error information to the Windows Event Viewer, returning NS_E_PLUGIN_ERROR_REPORTED stops the server from also logging to the event viewer. For more information about retrieving plug-in error information, see Identifying Plug-in Errors.
Example Code
The following example illustrates a possible implementation of the GetAuthorizedEvents method for an access control list (ACL) authorization plug-in.
HRESULT STDMETHODCALLTYPE CACLPlugin::GetAuthorizedEvents( VARIANT *pvarEvents ) { HRESULT hr = S_OK; long iEvents = 0; long nNumEvents SAFEARRAY *psa = NULL; SAFEARRAYBOUND rgsabound[1]; // Identify the events the plug-in can authorize. WMS_EVENT_TYPE wmsEvents[] = { WMS_EVENT_DESCRIBE, WMS_EVENT_OPEN, WMS_EVENT_GET_PARAMETER, WMS_EVENT_VALIDATE_PUSH_DISTRIBUTION }; // Set up the safearray boundaries and create the array. rgsabound[0].lLbound = 0; nNumEvents = sizeof( wmsEvents ) / sizeof( WMS_EVENT_TYPE ); rgsabound[0].cElements = nNumEvents; psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); // Add each of the events to the safearray. for( iEvents = 0; iEvents < nNumEvents && SUCCEEDED(hr); iEvents++ ) { VARIANT varElement; VariantInit( &varElement ); V_VT(&varElement) = VT_I4; V_I4(&varElement) = pWMSEvents[iEvents]; hr = SafeArrayPutElement( psa, &iEvents, &varElement ); VariantClear( &varElement ); } V_ARRAY(pvarEvents) = psa; return ( hr ); }
Requirements
Header: event.h.
Library: WMSServerTypeLib.dll.
Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.
See Also
Previous | Next |