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.

61 lines
1.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995
  5. //
  6. // File: factory.h
  7. //
  8. // Contents: Definition of the standard class factory class
  9. //
  10. //----------------------------------------------------------------------------
  11. //+---------------------------------------------------------------------------
  12. //
  13. // Class: CStdFactory (csf)
  14. //
  15. // Purpose: Standard implementation of a class factory.
  16. //
  17. //----------------------------------------------------------------------------
  18. class CStdFactory : public IClassFactory
  19. {
  20. public:
  21. typedef HRESULT (FNCREATE)(CMTScript *pMT, IUnknown **ppUnkObj);
  22. CStdFactory(CMTScript *pMT, FNCREATE *pfnCreate);
  23. ~CStdFactory() {};
  24. // IUnknown methods
  25. DECLARE_STANDARD_IUNKNOWN(CStdFactory);
  26. // IClassFactory methods
  27. STDMETHOD(CreateInstance)(IUnknown *pUnkOuter, REFIID riid, void ** ppvObject);
  28. STDMETHOD(LockServer)(BOOL fLock);
  29. private:
  30. CMTScript * _pMT;
  31. FNCREATE * _pfnCreate;
  32. };
  33. //+---------------------------------------------------------------------------
  34. //
  35. // Struct: REGCLASSDATA
  36. //
  37. // Purpose: Used to declare the classes we want to register with OLE.
  38. // A class factory that will create the class will be registered
  39. // for each entry.
  40. //
  41. //----------------------------------------------------------------------------
  42. struct REGCLASSDATA
  43. {
  44. const CLSID *pclsid; // CLSID to register
  45. CStdFactory::FNCREATE *pfnCreate; // Pointer to creation function
  46. DWORD ctxCreate; // CLSCTX to register this class with
  47. DWORD dwCookie; // Cookie returned from CoRegister...
  48. };
  49. HRESULT RegisterClassObjects(CMTScript *pMT);
  50. void UnregisterClassObjects();