nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv)); if (NS_FAILED(rv)) return rv;  nsIComponentManager* compMgr; rv = servMgr->GetService(kComponentManagerCID, nsIComponentManager::GetIID(), (nsISupports**)&compMgr);
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* aServMgr, const char *path){  nsresult rv;  nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));  if (NS_FAILED(rv)) return rv;  nsIComponentManager* compMgr;  rv = servMgr->GetService(kComponentManagerCID,                            nsIComponentManager::GetIID(),                            (nsISupports**)&compMgr);  if (NS_FAILED(rv)) return rv;  rv = compMgr->UnregisterComponent(kProfileCID, path);  (void)servMgr->ReleaseService(kComponentManagerCID, compMgr);  return rv;}