Skip to content

Latest commit

 

History

History
155 lines (121 loc) · 5.12 KB

nf-comsvcs-coenterservicedomain.md

File metadata and controls

155 lines (121 loc) · 5.12 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:comsvcs.CoEnterServiceDomain
CoEnterServiceDomain function (comsvcs.h)
Used to enter code that can then use COM+ services.
CoEnterServiceDomain
CoEnterServiceDomain function [COM+]
_cos_CoEnterServiceDomain
comsvcs/CoEnterServiceDomain
cos.coenterservicedomain
cos\coenterservicedomain.htm
cos
84640b3b-1f43-4bec-abf6-c295cfb3da8b
12/05/2018
CoEnterServiceDomain, CoEnterServiceDomain function [COM+], _cos_CoEnterServiceDomain, comsvcs/CoEnterServiceDomain, cos.coenterservicedomain
comsvcs.h
Windows
Windows XP [desktop apps only]
Windows Server 2003 [desktop apps only]
ComSvcs.lib
ComSvcs.dll
Windows
19H1
CoEnterServiceDomain
comsvcs/CoEnterServiceDomain
c++
APIRef
kbSyntax
DllExport
ComSvcs.dll
CoEnterServiceDomain

CoEnterServiceDomain function

-description

Used to enter code that can then use COM+ services.

-parameters

-param pConfigObject [in]

A pointer to the IUnknown interface of the object, created from the CServiceConfig class, that contains the configuration information for the services to be used within the enclosed code.

-returns

This method can return the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_FAIL, as well as the following values.

Return code Description
S_OK
The method completed successfully.
CO_E_SXS_CONFIG
The side-by-side assembly configuration of the CServiceConfig object is invalid.
CO_E_THREADPOOL_CONFIG
The thread pool configuration of the CServiceConfig object is invalid. The thread apartment model cannot be reconfigured by calling CoEnterServiceDomain.
CO_E_TRACKER_CONFIG
The tracker configuration of the CServiceConfig object is invalid.
COMADMIN_E_PARTITION_ACCESSDENIED
The caller does not have access permissions for the COM+ partition.

-remarks

Code that is enclosed between calls to CoEnterServiceDomain and CoLeaveServiceDomain runs in its own context and behaves as though it were a method that is called on an object created within the context. CoEnterServiceDomain cannot switch to a different apartment model, so the enclosed code runs in the caller's apartment and on the caller's thread. It is an error to try to change the apartment model through the CServiceConfig object when calling CoEnterServiceDomain.

CoEnterServiceDomain first creates a context that is configured as specified by the CServiceConfig object that is passed as the pConfigObject parameter. Policies on both the client and server sides are then triggered as if a method call had occurred. The new context is then pushed onto a context stack and becomes the current context.

Because of their efficient design and because no thread marshaling is involved, using CoEnterServiceDomain and CoLeaveServiceDomain involves significantly reduced overhead as compared to an equivalent method call.

CoEnterServiceDomain and CoLeaveServiceDomain are particularly useful in applications, which can use these functions to access COM+ services without needing to create a component to do so.

The CoEnterServiceDomain and CoLeaveServiceDomain pairs can be nested.

-see-also

COM+ Services Without Components

CServiceConfig

CoCreateActivity

CoLeaveServiceDomain