The IGlobalOptions::Set (objidlbase.h) method 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:
COMGLB_EXCEPTION_HANDLE: This is the default behavior. This setting causes the COM runtime to handle fatal exceptions.
COMGLB_EXCEPTION_DONOT_HANDLE: This causes the COM runtime not to handle fatal exceptions.
COMGLB_EXCEPTION_DONOT_HANDLE_FATAL: Alias for COMGLB_EXCEPTION_DONOT_HANDLE. Supported in Windows 7 and later.
COMGLB_EXCEPTION_DONOT_HANDLE_ANY: When set and a fatal exception occurs in a COM method, this causes the COM runtime to not handle the exception.
When set and a non-fatal exception occurs in a COM method, this causes the COM runtime to create a Windows Error Reporting (WER) dump and terminate the process.
Supported in Windows 7 and later.
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:
COMGLB_RPC_THREADPOOL_SETTING_PRIVATE_POOL: Instructs RPC to use a dedicated private thread pool.
Possible values for the COMGLB_RPC_THREADPOOL_SETTING property in the Query method are:
COMGLB_RPC_THREADPOOL_SETTING_PRIVATE_POOL: RPC uses a dedicated private thread pool.
COMGLB_RPC_THREADPOOL_SETTING_DEFAULT_POOL: RPC uses the system default thread pool.
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:
COMGLB_FAST_RUNDOWN: Indicates that stubs in the current process are subjected to fast stub rundown behavior, which means that stubs are run down on termination of the client process, instead of waiting for normal cleanup timeouts to expire.
COMGLB_STA_MODALLOOP_REMOVE_TOUCH_MESSAGES: Remove touch messages from the message queue in the STA modal loop.
COMGLB_STA_MODALLOOP_SHARED_QUEUE_REMOVE_INPUT_MESSAGES: Input messages are removed in
the STA modal loop when the thread's message queue is attached.
COMGLB_STA_MODALLOOP_SHARED_QUEUE_DONOT_REMOVE_INPUT_MESSAGES: Input messages aren't removed in
the STA modal loop when the thread's message queue is attached.
COMGLB_STA_MODALLOOP_SHARED_QUEUE_REORDER_POINTER_MESSAGES: Pointer input messages aren't removed in the STA modal loop when the thread's message queue is attached but are temporarily masked to avoid deadlocks arising from the attached queue.
COMGLB_RESERVED1: Reserved for future use.
COMGLB_RESERVED2: Reserved for future use.
COMGLB_RESERVED3: Reserved for future use.
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:
COMGLB_UNMARSHALING_POLICY_NORMAL: Unmarshaling behavior is the same as versions before than Windows 8. EOAC_NO_CUSTOM_MARSHAL restrictions apply if this flag is set in CoInitializeSecurity. Otherwise, there are no restrictions. This is the default for processes that aren't in the app container.
COMGLB_UNMARSHALING_POLICY_STRONG: Unmarshaling allows only a system-trusted list of hardened unmarshalers and unmarshalers allowed per-process by the CoAllowUnmarshalerCLSID function. This is the default for processes in the app container.
COMGLB_UNMARSHALING_POLICY_HYBRID: Unmarshaling data whose source is app container allows only a system-trusted list of hardened unmarshalers and unmarshalers allowed per-process by the CoAllowUnmarshalerCLSID function. Unmarshaling behavior for data with a source that's not app container is unchanged from previous versions.
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.