RevertToSelf

Description

Restores the security attributes for a COM object that is running on COM+ and impersonating the client.

Applies to

TransactionServer objects

Syntax

transactionserver.RevertToSelf (  )

Argument

Description

transactionserver

Reference to the TransactionServer service instance

Returns

Integer. Returns 1 if it succeeds and -1 if an error occurs.

Usage

COM objects running on COM+ can use the ImpersonateClient function to run in the client's security context so that the object has access to the same resources as the client. Use RevertToSelf to restore the object’s security context.

Examples

Example 1

The following example creates an instance of the TransactionServer service and checks whether the COM object is currently running in the client’s security context. If it is, it reverts to the object’s security context:

TransactionServer txninfo_test

integer li_rc


li_rc = GetContextService( "TransactionServer",  &

     txninfo_test )

IF  txninfo_test.IsImpersonating() THEN  &

    txninfo_test.RevertToSelf()

See also