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.

67 lines
2.0 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999-2000 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 (*LPCREATEINST)( IUnknown ** ppunkOut );
  17. typedef HRESULT (*CATIDREGISTER)( ICatRegister *, BOOL );
  18. typedef struct _ClassTable {
  19. LPCREATEINST pfnCreateInstance; // creation function for class
  20. const CLSID * rclsid; // classes in this DLL
  21. LPCTSTR pszName; // Class name for debugging
  22. LPCTSTR pszComModel; // String indicating COM threading model
  23. CATIDREGISTER pfnCatIDRegister; // catagory/component ID support registration
  24. const CLSID * rclsidAppId; // the App ID for this component
  25. LPCTSTR pszSurrogate; // the surrogate for the component - "" or NULL indicates use the COM default.
  26. } CLASSTABLE[], *LPCLASSTABLE;
  27. typedef struct _CategoryIdTable {
  28. const CATID * rcatid; // CATID GUID
  29. LPCTSTR pszName; // CATID name
  30. } CATIDTABLE[], *LPCATIDTABLE;
  31. // CFactory
  32. class
  33. CFactory:
  34. public IClassFactory
  35. {
  36. private:
  37. // IUnknown
  38. LONG m_cRef;
  39. // IClassFactory data
  40. LPCREATEINST m_pfnCreateInstance;
  41. private: // Methods
  42. CFactory( );
  43. ~CFactory();
  44. STDMETHOD( HrInit )( LPCREATEINST lpfn );
  45. public: // Methods
  46. friend HRESULT CALLBACK
  47. DllGetClassObject( REFCLSID rclsid, REFIID riid, void** ppv );
  48. // IUnknown
  49. STDMETHOD( QueryInterface )( REFIID riid, LPVOID *ppv );
  50. STDMETHOD_( ULONG, AddRef )(void);
  51. STDMETHOD_( ULONG, Release )(void);
  52. // IClassFactory
  53. STDMETHOD( CreateInstance )( IUnknown *punkOuter, REFIID riid, LPVOID *ppv );
  54. STDMETHOD( LockServer )( BOOL fLock );
  55. };
  56. typedef CFactory* LPCFACTORY ;