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.

57 lines
1.7 KiB

  1. #ifndef __C_FACTORY_H__
  2. #define __C_FACTORY_H__
  3. #include <objbase.h>
  4. #include "ccom.h"
  5. typedef struct tagFACTARRAY {
  6. const CLSID *lpClsId;
  7. #ifndef UNDER_CE
  8. LPSTR lpstrRegistryName;
  9. LPSTR lpstrProgID;
  10. LPSTR lpstrVerIndProfID;
  11. #else // UNDER_CE
  12. LPTSTR lpstrRegistryName;
  13. LPTSTR lpstrProgID;
  14. LPTSTR lpstrVerIndProfID;
  15. #endif // UNDER_CE
  16. }FACTARRAY, *LPFACTARRAY;
  17. class CFactory : public IClassFactory, CCom
  18. {
  19. public:
  20. //---- Inherit IUnknown ----
  21. HRESULT __stdcall QueryInterface(REFIID refIID, void** ppv);
  22. ULONG __stdcall AddRef();
  23. ULONG __stdcall Release();
  24. //---- Inherit IClassFactory ----
  25. STDMETHOD(CreateInstance)(THIS_
  26. LPUNKNOWN pUnknownOuter,
  27. REFIID refIID,
  28. LPVOID *ppv) ;
  29. STDMETHOD(LockServer)(THIS_
  30. BOOL bLock) ;
  31. //----------------------------------------------------------------
  32. CFactory(VOID); // Cponstructor
  33. ~CFactory(); // Destructor
  34. static HRESULT GetClassObject(const CLSID& clsid,
  35. const IID& iid,
  36. void** ppv) ;
  37. static BOOL IsLocked() { // Function to determine if component can be unloaded
  38. return (m_cServerLocks > 0);
  39. }
  40. static HRESULT CanUnloadNow (VOID); // Functions to [un]register all components
  41. static HRESULT RegisterServer (VOID);
  42. static HRESULT UnregisterServer (VOID);
  43. public:
  44. static LONG m_cServerLocks; // Count of locks (static value)
  45. static LONG m_cComponents; // Count of componets (static value)
  46. static HMODULE m_hModule; // Module handle (static value)
  47. static FACTARRAY m_fData;
  48. LONG m_cRef; // Reference Count
  49. } ;
  50. #endif //__C_FACTORY_H__