3.1.4.2 SetContext (Opnum 1)

The SetContext method sets the context for the current shadow copy creation process.

 DWORD SetContext(
         [in] handle_t hBinding,
         [in] unsigned long Context);
  

hBinding: An RPC binding handle (as defined in [C706]).

Context: The context to be used for the shadow copy operations. It MUST be set to one of the CONTEXT_VALUES specified in section 2.2.2.2.

Return Values: The method returns one of the values as specified in section 2.2.4. The most common error codes are listed below.

Return value/code

Description

0x80070005

E_ACCESSDENIED

The caller does not have the permissions to perform the operation.

0x8004231B

FSRVP_E_UNSUPPORTED_CONTEXT

The context value specified is invalid.

0x80042316

FSRVP_E_SHADOW_COPY_SET_IN_PROGRESS

Creation of another shadow copy set is in progress.

If the Context parameter contains an invalid value, the server MUST fail the call with FSRVP_E_UNSUPPORTED_CONTEXT.

The server MUST get the requestor client address corresponding to the hBinding parameter as specified in [C706] section 2.12.1.

If ContextSet is TRUE, the server MUST process as follows:

  • If the requestor client address is not the same as ShadowCopyClientAddress, the server MUST fail the call with FSRVP_E_SHADOW_COPY_SET_IN_PROGRESS.

  • Otherwise, if the requestor client address is the same as ShadowCopyClientAddress, the server MUST process as follows:

    • Remove the ShadowCopySet if a ShadowCopySet exists in the GlobalShadowCopySetTable where ShadowCopySet.Status is not equal to "Recovered".

    • Set ContextSet to FALSE.

    • Set ShadowCopyClientAddress to NULL.

    • Increment the ShadowCopyClientRetryCount.

    • If ShadowCopyClientRetryCount exceeds the implementation-specific count<5>, the server MUST fail the call with FSRVP_E_SHADOW_COPY_SET_IN_PROGRESS.

Otherwise, if ContextSet is FALSE, set ShadowCopyClientRetryCount to 0. 

The server MUST set ShadowCopyClientAddress to the retrieved requestor client address.

The server MUST update CurrentContext to Context, set ContextSet to TRUE, start the Message Sequence Timer (as specified in section 3.1.2) with a timeout value of 180 seconds, and return ZERO to the caller.