Removing a Gateway

The DoRemove function in GWSETUP.C shows how to remove a gateway service’s entire installation. The following procedure lists the steps for removing a gateway in the order in which DoRemove performs them. You can use the steps that are relevant for removing your gateway.

    To remove a gateway
  1. Present a dialog box in which the administrator can select an application to remove. The ShowChooseServiceDlg function displays such a dialog box.
  2. Determine whether the gateway service is running by calling the FServiceRunning function. If it is running, attempt to stop the service.
  3. Remove the directory object. Call the HrRemoveGateway function to remove a gateway object from a given site. This function is defined in EXCHINST.C.
  4. Remove performance monitoring for the service by calling the HrRemoveServicePerfMon function. If the lpfUnloadCounters parameter returned from this function call is TRUE, continue with step 5. If it is FALSE, multiple instances of the gateway are installed. In this case, perform steps 7 and 8, and then begin again at step 1.

    Note The performance counters are unloaded and the registry entries are deleted only after all instances of the gateway have been removed.

  5. Call the FUnloadCounters function to unload the counters used in performance monitoring.
  6. Remove the gateway’s keys from the Windows NT Registry by calling the HrRemoveRegistry function.
  7. Remove the gateway service from the Windows NT service control manager by calling the HrRemoveService function.
  8. Delete the files belonging to the gateway using the EDKDeleteNode function.

The DoRemove function removes gateway components from the local computer. Server components in the Microsoft Exchange Server directory must be removed in a separate step using directory access functions. For example, address types and Administrator extensions are not removed because they may be needed by other applications.

When removing a gateway, your program should not remove address templates and extension DLLs and their associated objects. This is because these components may still be in the process of being used by other applications.