3.1.4.3.1 IWbemServices::OpenNamespace (Opnum 3)

The IWbemServices::OpenNamespace method provides the client with an IWbemServices interface pointer that is scoped to the requested namespace. The specified namespace MUST be a child namespace of the current namespace through which this method is called.

 HRESULT OpenNamespace(
   [in] const BSTR strNamespace,
   [in] long lFlags,
   [in] IWbemContext* pCtx,
   [out, in, unique] IWbemServices** ppWorkingNamespace,
   [out, in, unique] IWbemCallResult** ppResult
 );

strNamespace: MUST be the CIM path to the target namespace. This parameter MUST NOT be NULL.

lFlags: Flags that affect the behavior of the OpenNamespace method. The behavior of each flag MUST be interpreted as follows:

  • If this bit is not set, the server MUST make the method call synchronous.

  • If this bit is set, the server MUST make the method call semisynchronously.

    Name

    Value

    WBEM_FLAG_RETURN_IMMEDIATELY

    0x00000010

Any other DWORD value that does not match the preceding condition MUST be treated as invalid.

pCtx: This parameter MUST be NULL.

ppWorkingNamespace: This parameter MUST NOT be NULL on input when WBEM_FLAG_RETURN_IMMEDIATELY is not set. If the method returns WBEM_S_NO_ERROR, ppWorkingNamespace MUST receive a pointer to an IWbemServices interface pointer to the requested namespace.

The output parameter MUST be based on the state of the lFlags parameter (whether WBEM_FLAG_RETURN_IMMEDIATELY is set) as listed in the following table.

Flag state

Success operation

Failure operation

WBEM_FLAG_RETURN_IMMEDIATELY is not set.

MUST be set to the requested IWbemServices interface.

MUST be set to NULL if the input parameter is not-NULL.

WBEM_FLAG_RETURN_IMMEDIATELY is set.

MUST be set to NULL if the input parameter is not-NULL.

MUST be set to NULL if the input parameter is not-NULL.

ppResult: The output parameter MUST be filled according to the state of the lFlags parameter (whether WBEM_FLAG_RETURN_IMMEDIATELY is set) as listed in the following table.

Flag state

Success operation

Failure operation

WBEM_FLAG_RETURN_IMMEDIATELY is not set.

MUST be set to NULL if the input parameter is not-NULL.

MUST be set to NULL if the input parameter is not-NULL.

WBEM_FLAG_RETURN_IMMEDIATELY is set.

MUST be set to the requested IWbemCallResult interface.

MUST be set to NULL if the input parameter is not-NULL.

This parameter MUST NOT be NULL on input when WBEM_FLAG_RETURN_IMMEDIATELY equals 1. In such a case, it receives a pointer to an IWbemCallResult interface pointer.

Return Values: This method MUST return an HRESULT value that MUST indicate the status of the method call. The server MUST return WBEM_S_NO_ERROR, as specified in section 2.2.11, to indicate the successful completion of the method.

WBEM_S_NO_ERROR (0x00)

Requirements described in the parameter definitions are checked, and if the requirements are not met, the server returns WBEM_E_INVALID_PARAMETER.

In response to the IWbemServices::OpenNamespace method, the server MUST evaluate whether the strNamespace parameter, which is specified in the preceding list, is a child of the namespace that is associated with the current interface pointer. If the requested namespace does not exist as a child namespace, the server MUST return WBEM_E_INVALID_NAMESPACE. If the requested namespace exists as a child namespace of the current interface pointer, the server MUST create another IWbemServices interface pointer associated with this namespace and return WBEM_S_NO_ERROR.

If the method returns a success code, the method MUST fill one of the two output parameters, as indicated by the use of the lFlags parameter, which is previously specified.

The successful synchronous method execution MUST fill the ppWorkingNamespace parameter with an IWbemServices interface pointer and MUST return WBEM_S_NO_ERROR.

The semisynchronous method execution MUST follow the rules that are specified in section 3.1.1.1.2.

The failed method execution MUST set the output parameters to NULL and MUST return an error in the format that is specified in section 2.2.11.

If the ppResult input parameter is non-NULL, the server MUST deliver the result of the requested operation (regardless whether WBEM_FLAG_RETURN_IMMEDIATELY is set) via the IWbemCallResult, similar to the semisynchronous execution case.