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.

128 lines
3.2 KiB

  1. //+------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1997
  5. //
  6. // File: cclsto.hxx
  7. //
  8. // Contents: Definition for Class factory and IUnknown methods
  9. // for CAppContainer
  10. //
  11. // Author: DebiM
  12. //
  13. //-------------------------------------------------------------------------
  14. class CAppContainerCF : public IClassFactory
  15. {
  16. public:
  17. CAppContainerCF();
  18. ~CAppContainerCF();
  19. virtual HRESULT __stdcall QueryInterface(REFIID riid, void * * ppvObject);
  20. virtual ULONG __stdcall AddRef();
  21. virtual ULONG __stdcall Release();
  22. virtual HRESULT __stdcall CreateInstance(IUnknown * pUnkOuter, REFIID riid, void * * ppvObject);
  23. virtual HRESULT __stdcall LockServer(BOOL fLock);
  24. HRESULT __stdcall CreateConnectedInstance(
  25. LPOLESTR pszPath,
  26. PSID pUserSid,
  27. BOOL fCache,
  28. void * * ppvObject);
  29. protected:
  30. unsigned long m_uRefs;
  31. };
  32. #define CLSIDCACHESIZE 20
  33. #define CACHE_PURGE_TIME 1800 // 30 mins.
  34. typedef struct CacheClsid_t {
  35. CLSID Clsid;
  36. DWORD Ctx;
  37. DWORD Time;
  38. } CacheClsidType;
  39. typedef struct ClsidCache_t {
  40. CacheClsidType ElemArr[20];
  41. DWORD start, end, sz;
  42. } ClsidCacheType;
  43. //
  44. // ClassContainer class.
  45. //
  46. class CAppContainer :
  47. public IClassAccess
  48. {
  49. private:
  50. WCHAR m_szContainerName[_MAX_PATH];
  51. WCHAR * m_szClassName;
  52. WCHAR * m_szPackageName;
  53. BOOL m_fOpen;
  54. HANDLE m_ADsContainer;
  55. HANDLE m_ADsPackageContainer;
  56. WCHAR * m_szPolicyName;
  57. GUID m_PolicyId;
  58. ClsidCacheType m_KnownMissingClsidCache;
  59. public:
  60. CAppContainer();
  61. CAppContainer(LPOLESTR pszPath, HRESULT *phr);
  62. ~CAppContainer(void);
  63. // IUnknown
  64. HRESULT __stdcall QueryInterface(
  65. REFIID iid,
  66. void ** ppv );
  67. ULONG __stdcall AddRef();
  68. ULONG __stdcall Release();
  69. //
  70. // IClassAccess
  71. //
  72. HRESULT __stdcall GetAppInfo(
  73. uCLSSPEC * pClassSpec, // Class Spec (CLSID/Ext/MIME)
  74. QUERYCONTEXT * pQryContext, // Query Attributes
  75. PACKAGEDISPINFO * pPackageInfo
  76. );
  77. HRESULT __stdcall EnumPackages (
  78. LPOLESTR pszPackageName,
  79. GUID *pCategory,
  80. ULONGLONG *pLastUsn,
  81. DWORD dwAppFlags, // AppType options
  82. IEnumPackage **ppIEnumPackage
  83. );
  84. //
  85. // Utility functions
  86. //
  87. HRESULT __stdcall GetPackageDetails (
  88. LPOLESTR pszPackageId,
  89. PACKAGEDETAIL *pPackageDetail
  90. );
  91. DWORD __stdcall ChooseBestFit(
  92. PACKAGEDISPINFO *PackageInfo,
  93. UINT *rgPriority,
  94. DWORD cRowsFetched
  95. );
  96. HRESULT __stdcall UpdateUsn(CSUSN *pStoreUsn);
  97. HRESULT __stdcall GetStoreUsn(CSUSN *pStoreUsn);
  98. //----------------------------------------------------------------------
  99. protected:
  100. unsigned long m_uRefs;
  101. };