4.1 General Hookup Example

The following example demonstrates how to get a handle that the DCOM Class Object can use to make the rest of the calls.

  • The client initializes COM by calling the CoInitializeEx function. For more information, see [MSDN-CoInitialize].

  • The client initializes COM security by calling the CoInitializeSecurity function. In this call, the client sets the impersonation level and authentication level that will be used by COM for subsequent calls. The IMSAdminBaseW interface does not provide any additional security by itself; it relies on COM for this.<46>

  • The client creates an instance of the IMSAdminBaseW interface using a CoCreateInstance COM call and passing the remote computer name.

  • The client queries the IMSAdminBaseW interface from the pointer returned by CoCreateInstance.

  • From this point, the client has a valid pointer to the IMSAdminBaseW interface that can be used to perform additional processing via the other methods defined on the interface.

  • After the client has finished processing, it releases the interface pointer and call the CoUninitialize function to clear up the COM context.