Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.0 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1997.
  5. //
  6. // File: cshelp.cpp
  7. //
  8. // Contents: Helper functions for working with the class store
  9. //
  10. // Classes:
  11. //
  12. // Functions: DeletePackageAndDependants
  13. //
  14. // History: 6-26-1997 stevebl Created
  15. //
  16. //---------------------------------------------------------------------------
  17. #include "precomp.hxx"
  18. void DeleteApp(IClassAdmin * pca, APPDETAIL &ad)
  19. {
  20. // I would here try to delete any IIDs associated with this app but
  21. // there is no way to determine which IIDs ARE associated with this app.
  22. // Delete any CLSIDs associated with this app
  23. DWORD nIndex = ad.cClasses;
  24. while (nIndex--)
  25. {
  26. // Deliberately ignoring the return code
  27. pca->DeleteClass(ad.prgClsIdList[nIndex]);
  28. }
  29. }
  30. //+--------------------------------------------------------------------------
  31. //
  32. // Function: DeletePackageAndDependants
  33. //
  34. // Synopsis: deletes a package from the class store along with all of the
  35. // other objects that are associated with it (CLSIDs, etc)
  36. //
  37. // Arguments: [pca] - IClassAdmin pointer
  38. // [szName] - name of the package to be removed
  39. // [ppd] - pointer to the PACKAGEDETAIL structure
  40. //
  41. // Returns: S_OK on success
  42. //
  43. // History: 6-26-1997 stevebl Created
  44. //
  45. //---------------------------------------------------------------------------
  46. HRESULT DeletePackageAndDependants(IClassAdmin * pca, LPOLESTR szName, PACKAGEDETAIL * ppd)
  47. {
  48. // First delete the package. Any CLSIDs or IIDs that were
  49. // implemented solely by this package can now be deleted from the
  50. // class store. If they are also implemented by other packages that
  51. // are still in the class store, then deleting them will return an
  52. // error which we can safely ignore.
  53. HRESULT hr = pca->DeletePackage(szName);
  54. DWORD nApp = ppd->cApps;
  55. while (nApp--)
  56. {
  57. DeleteApp(pca, ppd->pAppDetail[nApp]);
  58. }
  59. return hr;
  60. }