IGlobalOptions interface
Sets and queries global properties of the Component Object Model (COM) runtime.
When to implement
You don't need to implement this interface, because the COM runtime implements it.
When to use
Use the IGlobalOptions interface to set and query certain global properties of the COM runtime.
Prior to Windows 7, you must call CoInitializeSecurity before calling the methods defined on the IGlobalOptions interface. Otherwise, these methods return E_FAIL.
Starting with Windows 7, you must call CoInitializeSecurity before calling the Set/Query methods for the COMGLB_APPID property and before calling the Set method for the COMGLB_EXCEPTION_HANDLING property with a value of COMGLB_EXCEPTION_HANDLE. You must also call CoInitializeSecurity before calling the Set method for the COMGLB_RO_SETTINGS property with a value of COMGLB_FAST_RUNDOWN. Otherwise, these methods return E_FAIL. You don't need to call CoInitializeSecurity before calling the Set/Query methods for other properties.
Members
The IGlobalOptions interface inherits from the IUnknown interface. IGlobalOptions also has these types of members:
Methods
The IGlobalOptions interface has these methods.
| Method | Description |
|---|---|
| Query |
Queries the specified global property of the COM runtime. |
| Set |
Sets the specified global property of the COM runtime. |
Remarks
The following global properties of the COM runtime can be set and queried with this interface.
| Property | Values |
|---|---|
|
COMGLB_APPID |
The AppID for the process. This is the only supported property on Windows XP. |
|
COMGLB_EXCEPTION_HANDLING |
Possible values for the COMGLB_EXCEPTION_HANDLING property are:
By default, the COM runtime handles fatal exceptions raised during method invocations by returning the RPC_E_SERVERFAULT error code to the client. An application disables this behavior to allow exceptions to propagate to WER, which creates application process dumps and terminates the application. This prevents possible data corruption and allows an application vendor to debug the dumps. Note Even if COM runtime exception handling is disabled, exceptions might not propagate to WER if there is another application-level exception handler in the process that handles the exception.
For new applications, it is recommended that the COMGLB_EXCEPTION_HANDLING property be set to COMGLB_EXCEPTION_DONOT_HANDLE_ANY. |
|
COMGLB_RPC_THREADPOOL_SETTING |
Possible values for the COMGLB_RPC_THREADPOOL_SETTING property in the Set method are:
Possible values for the COMGLB_RPC_THREADPOOL_SETTING property in the Query method are:
RPC uses the system thread pool by default in Windows 7. Since the system thread pool is shared by multiple components in the process, COM and RPC operations may behave incorrectly if the thread pool state is corrupted by a component. The COMGLB_RPC_THREADPOOL_SETTING property can be used to change the RPC thread pool behavior. Changing the default behavior will incur a performance penalty since this causes RPC to use an extra thread. Therefore, care should be exercised when changing this setting. It is recommended that this setting is changed only for application compatibility reasons. Note This property must be set immediately after COM is initialized in the process. If this property is set after performing any operations that cause COM to initialize the RPC channel (for example, marshaling or unmarshalling object references), the Set method will fail.
Note This property is only supported in Windows 7 and later versions of Windows. |
|
COMGLB_RO_SETTINGS |
Possible values for the COMGLB_RO_SETTINGS property are:
Note This property is only supported in Windows 8 and later versions of Windows. |
|
COMGLB_UNMARSHALING_POLICY |
Possible values for the COMGLB_UNMARSHALING_POLICY property are:
Note This property is only supported in Windows 8 and later versions of Windows. |
It's important for applications that detect crashes and other exceptions that might be generated while executing inbound COM calls, for example a call on a local server or when executing the IDropTarget::Drop method, to set COMGLB_EXCEPTION_HANDLING to COMGLB_EXCEPTION_DONOT_HANDLE to disable COM behavior of catching exceptions. Failure to do this can lead to corrupt process state, for example locks held when these exceptions are thrown are abandoned, and the process could enter an inconsistent state.
All such applications should execute this code at startup.
IGlobalOptions *pGlobalOptions;
hr = CoCreateInstance(CLSID_GlobalOptions, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pGlobalOptions));
if (SUCCEEDED(hr))
{
hr = pGlobalOptions->Set(COMGLB_EXCEPTION_HANDLING, COMGLB_EXCEPTION_DONOT_HANDLE);
pGlobalOptions->Release();
}
Requirements
|
Minimum supported client |
Windows Vista [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows Server 2003 [desktop apps | Windows Store apps] |
|
Header |
|
|
IDL |
|
|
IID |
IID_IGlobalOptions is defined as 0000015B-0000-0000-C000-000000000046 |
See also