Leaked source code of windows server 2003
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.

135 lines
3.0 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999-2002 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CFactory.h
  7. //
  8. // Description:
  9. // Class Factory implementation.
  10. //
  11. // Maintained By:
  12. // Geoffrey Pease (GPease) 22-NOV-1999
  13. //
  14. //////////////////////////////////////////////////////////////////////////////
  15. #pragma once
  16. typedef HRESULT (*PFN_FACTORY_METHOD)( IUnknown ** );
  17. typedef HRESULT (*PFN_CATEGORY_REGISTRAR)( ICatRegister *, BOOL );
  18. enum EAppIDRunAsIdentity
  19. {
  20. airaiInvalid,
  21. airaiMinimum = airaiInvalid,
  22. airaiLaunchingUser,
  23. airaiInteractiveUser,
  24. airaiNetworkService,
  25. airaiLocalService,
  26. airaiMaximum
  27. };
  28. struct SAppIDInfo
  29. {
  30. const GUID * pAppID;
  31. PCWSTR pcszName;
  32. size_t cchName;
  33. UINT idsLaunchPermission;
  34. UINT idsAccessPermission;
  35. DWORD nAuthenticationLevel;
  36. EAppIDRunAsIdentity eairai;
  37. };
  38. struct SPrivateClassInfo
  39. {
  40. PFN_FACTORY_METHOD pfnCreateInstance;
  41. const CLSID * pClassID;
  42. PCWSTR pcszName;
  43. size_t cchName;
  44. };
  45. enum EClassThreadingModel
  46. {
  47. ctmInvalid,
  48. ctmMinimum = ctmInvalid,
  49. ctmFree,
  50. ctmApartment,
  51. ctmCreator,
  52. ctmMaximum
  53. };
  54. struct SPublicClassInfo
  55. {
  56. PFN_FACTORY_METHOD pfnCreateInstance;
  57. const CLSID * pClassID;
  58. PCWSTR pcszName;
  59. size_t cchName;
  60. PCWSTR pcszProgID;
  61. size_t cchProgID;
  62. EClassThreadingModel ectm;
  63. const GUID * pAppID;
  64. PFN_CATEGORY_REGISTRAR pfnRegisterCatID;
  65. };
  66. struct SCatIDInfo
  67. {
  68. const CATID * pcatid;
  69. PCWSTR pcszName;
  70. };
  71. struct STypeLibInfo
  72. {
  73. DWORD idTypeLibResource;
  74. BOOL fAtEnd;
  75. };
  76. //////////////////////////////////////////////////////////////////////////////
  77. //++
  78. //
  79. // class CFactory
  80. //
  81. // Description:
  82. // Class implementing a COM class factory.
  83. //
  84. //--
  85. //////////////////////////////////////////////////////////////////////////////
  86. class
  87. CFactory
  88. : public IClassFactory
  89. {
  90. private:
  91. // IUnknown
  92. LONG m_cRef;
  93. // IClassFactory data
  94. PFN_FACTORY_METHOD m_pfnCreateInstance;
  95. private: // Methods
  96. CFactory( void );
  97. ~CFactory( void );
  98. STDMETHOD( HrInit )( PFN_FACTORY_METHOD lpfn );
  99. public: // Methods
  100. //
  101. // Public, non interface methods.
  102. //
  103. static HRESULT S_HrCreateInstance( PFN_FACTORY_METHOD lpfn, CFactory ** ppFactoryInstanceOut );
  104. //
  105. // IUnknown
  106. //
  107. STDMETHOD( QueryInterface )( REFIID riid, LPVOID *ppv );
  108. STDMETHOD_( ULONG, AddRef )( void );
  109. STDMETHOD_( ULONG, Release )( void );
  110. //
  111. // IClassFactory
  112. //
  113. STDMETHOD( CreateInstance )( IUnknown * punkOuterIn, REFIID riidIn, LPVOID * ppvOut );
  114. STDMETHOD( LockServer )( BOOL fLock );
  115. }; //*** class CFactory