4.2.3.1 Synchronous Delivery of IWbemServices ExecQuery and ExecMethod Operations

This section contains the information exchanged between SAI-NAV009 (client) and SAI-NAV009-2 (server).

First the client tries to connect to the server and obtains IwbemServices for namespace root\cimv2 as outlined in 4.1.1.

Client calls ExecQuery method on IWbemServices interface pointer with "select * from win32_process where Name='calc.exe'" as strQuery. It is assumed that an instance of calc.exe is running on the server:

 - WMI: IWbemServices:ExecQuery Request, Flags=32
   + StrQueryLanguage: WQL
   + StrQuery: select * from win32_process where Name='calc.exe'
   + Pad: 2 Bytes
   + Flags: 32 (0x20)
   + Ctx: NULL
  

In response to the method executed above, the server returns an IEnumWbemClassObject interface pointer:

 - WMI: IWbemServices:ExecQuery Response, ReturnValue=WBEM_S_NO_ERROR
   + Enum: OBJREFSTANDARD - {027947E1-D731-11CE-A357-000000000001}
   + Pad: 2 Bytes
     ReturnValue: 0x00000000 - WBEM_S_NO_ERROR - Indicates a successful completion to the method call.
  

The client uses IRemUnknown and IRemUnknown2, as specified in [MS-DCOM], to obtain an IWbemFetchSmartEnum interface pointer from the IEnumWbemClassObject interface pointer. From this the client knows whether the server is optimized:

  
 - DCOM: IRemUnknown2:RemQueryInterface Request, DCOM Version=5.7  Causality Id={8E2416FE-0A3F-42BE-A9B0-F30624C94619}
   + HeaderReq: DCOM Version=5.7  Causality Id={8E2416FE-0A3F-42BE-A9B0-F30624C94619}
     QueriedObjectIpId: {0002E41C-06C4-0000-1F17-07BCF2EEB3F8}
     PublicObjectReferenceCount: 5 (0x5)
     NumRequestedIIds: 1 (0x1)
   + Size: 1 Elements
   + InterfaceIds:

Server responds with a valid IWbemFetchSmartEnum interface pointer. This means that the server is optimized:

  
 - DCOM: IRemUnknown2:RemQueryInterface Response, ORPCFNULL - No additional information in this packet
   + HeaderResp: ORPCFNULL - No additional information in this packet
   + RemqiresultPtr: Pointer To 0x00020000
   + Size: 1 Elements
   + QueryInterfaceResults: 
   + ReturnValue: Success
  

The client then calls the IWbemFetchSmartEnum::GetSmartEnum method to obtain the IWbemWCOSmartEnum interface pointer:

 WMI: IWbemFetchSmartEnum:GetSmartEnum Request
  

Server responds with a valid IWbemWCOSmartEnum interface pointer:

 - WMI: IWbemFetchSmartEnum:GetSmartEnum Response, ReturnValue=WBEM_S_NO_ERROR
   + SmartEnum: OBJREFSTANDARD - {423EC01E-2E35-11D2-B604-00104B703EFD}
   + Pad: 2 Bytes
     ReturnValue: 0x00000000 - WBEM_S_NO_ERROR - Indicates a successful completion to the method call.
  

The client uses the IWbemWCOSmartEnum::Next method repeatedly to retrieve the IwbemClassObject interface pointers that contains the result set:

 - WMI: IWbemWCOSmartEnum:Next Request, Timeout=0 UCount=10
     proxyGUID: {7F666EB6-FA61-48E8-8464-224C8E909D22}
     Timeout: WBEM_NO_WAIT(Call returns immediately, regardless of whether any objects are available.)
     UCount: 10 (0xA)
  

Server responds with the result set with one win32_process object for calc.exe instance running. The results are encoded as an ObjectArray as specified in section 2.2.14:

 - WMI: IWbemWCOSmartEnum:Next Response, PuReturned=1 BuffSize=9101 ReturnValue=0x00000300 - Unknown Value
     PuReturned: 1 (0x1)
     BuffSize: 9101 (0x238D)
   + BufferPtrSize: Pointer To 0x00020000, 9101 Elements
   + ObjectArray: 
   + Pad: 2 Bytes
     ReturnValue: 0x00000300 - Unknown Value
 + msrpc: c/o Continued Response: IWbemWCOSmartEnum(WMIRP) {423EC01E-2E35-11D2-B604-00104B703EFD}  Call=0xA  Context=0x6  Hint=0xD1C  Cancels=0x0 InstanceQuarlifier error: Unknown QualifierType
  

Client obtains __RELPATH property from IwbemClassObject as \\SAI-NAV009-2\root\cimv2:Win32_Process.Handle="724".

Client makes ExecMethod operation on IWbemServices interface pointer to call terminate() method on win32_process object corresponding to calc.exe instance obtained above. This action terminates the process calc.exe on the server:

 - WMI: IWbemServices:ExecMethod Request, Flags=0
   + StrObjectPath: \\SAI-NAV009-2\root\cimv2:Win32_Process.Handle="724"
   + StrMethodName: Terminate
   + Pad: 2 Bytes
     Flags: Unknown
   + Ctx: NULL
   + InParams: OBJREFCUSTOM - {DC12A681-737F-11CF-884D-00AA004B2E24}
   + OutParams: NULL
   + CallResult: NULL
  

Server responds with ResultValue as WBEM_S_NO_ERROR. This means that Terminate method was successfully executed on Win32_Process object:

 - WMI: IWbemServices:ExecMethod Response, ReturnValue=WBEM_S_NO_ERROR
   + OutParams: OBJREFCUSTOM - {DC12A681-737F-11CF-884D-00AA004B2E24}
   + CallResult: NULL
     Pad: 0 Bytes
     ReturnValue: 0x00000000 - WBEM_S_NO_ERROR - Indicates a successful completion to the method call.)
  

To confirm that calc.exe instance is indeed terminated on the server, client makes the same ExecQuery operation on IWbemServices interface pointer obtained from the server:

 + DCOM: WMI protocol Request, DCOM Version=5.7  Causality Id={8E2416FE-0A3F-42BE-A9B0-F30624C94619}
 - WMI: IWbemServices:ExecQuery Request, Flags=32
   + StrQueryLanguage: WQL
   + StrQuery: select * from win32_process where Name='calc.exe'
   + Pad: 2 Bytes
   + Flags: 32 (0x20)
   + Ctx: NULL
  

In response to the method executed above, the server returns an IEnumWbemClassObject interface pointer:

 - WMI: IWbemServices:ExecQuery Response, ReturnValue=WBEM_S_NO_ERROR
   + Enum: OBJREFSTANDARD - {027947E1-D731-11CE-A357-000000000001}
   + Pad: 2 Bytes
     ReturnValue: 0x00000000 - WBEM_S_NO_ERROR - Indicates a successful completion to the method call.
  

The client uses IRemUnknown and IRemUnknown2, as specified in [MS-DCOM], to obtain an IWbemFetchSmartEnum interface pointer from the IEnumWbemClassObject interface pointer. From this the client knows whether the server is optimized:

  
 - DCOM: IRemUnknown2:RemQueryInterface Request, DCOM Version=5.7  Causality Id={8E2416FE-0A3F-42BE-A9B0-F30624C94619}
   + HeaderReq: DCOM Version=5.7  Causality Id={8E2416FE-0A3F-42BE-A9B0-F30624C94619}
     QueriedObjectIpId: {0001F82E-06C4-0000-829F-784637EF2774}
     PublicObjectReferenceCount: 5 (0x5)
     NumRequestedIIds: 1 (0x1)
   + Size: 1 Elements
   + InterfaceIds:

Server responds with a valid IWbemFetchSmartEnum interface pointer. This means that the server is optimized:

  
 - DCOM: IRemUnknown2:RemQueryInterface Response, ORPCFNULL - No additional information in this packet
   + HeaderResp: ORPCFNULL - No additional information in this packet
   + RemqiresultPtr: Pointer To 0x00020000
   + Size: 1 Elements
   + QueryInterfaceResults: 
   + ReturnValue: Success

The client then calls the IWbemFetchSmartEnum::GetSmartEnum method to obtain the IWbemWCOSmartEnum interface pointer:

 WMI: IWbemFetchSmartEnum:GetSmartEnum Request
  

Server responds with a valid IWbemWCOSmartEnum interface pointer:

 - WMI: IWbemFetchSmartEnum:GetSmartEnum Response, ReturnValue=WBEM_S_NO_ERROR
   + SmartEnum: OBJREFSTANDARD - {423EC01E-2E35-11D2-B604-00104B703EFD}
   + Pad: 2 Bytes
     ReturnValue: 0x00000000 - WBEM_S_NO_ERROR - Indicates a successful completion to the method call.
  

The client uses the IWbemWCOSmartEnum::Next method repeatedly to retrieve the IwbemClassObject interface pointers that contain the result set:

 - WMI: IWbemWCOSmartEnum:Next Request, Timeout=0 UCount=10
     proxyGUID: {09EFDDA0-3E1E-40E2-B87A-F73895BEAACA}
     Timeout: WBEM_NO_WAIT(Call returns immediately, regardless of whether any objects are available.)
     UCount: 10 (0xA)
  

Server responds with the result set this time with no calc.exe instances. This proves that the terminate method was called on win32_process object, and has terminated calc.exe instance on the server:

 - WMI: IWbemWCOSmartEnum:Next Response, PuReturned=0 BuffSize=0 ReturnValue=WBEM_S_FALSE
     PuReturned: 0 (0x0)
     BuffSize: 0 (0x0)
   + BufferPtrSize: Pointer To NULL
     Pad: 0 Bytes
     ReturnValue: 0x00000001 - WBEM_S_FALSE - Either no more CIM objects are available, the number of returned CIM objects is less than the number requested, or this is the end of an enumeration.