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.

58 lines
1.9 KiB

  1. //+-------------------------------------------------------------------
  2. //
  3. // File: stdcf.hxx
  4. //
  5. // Contents: class implementing standard CF for internal OLE classes
  6. //
  7. // Classes: CStdClassFactory
  8. //
  9. // History: Rickhi 06-24-97 Created
  10. //
  11. //+-------------------------------------------------------------------
  12. #ifndef __STDCLASSFACTORY_HXX__
  13. #define __STDCLASSFACTORY_HXX__
  14. // CreateInstance function ptr definition
  15. typedef HRESULT (* LPFNCREATEINSTANCE)(IUnknown* pUnkOuter,
  16. REFIID riid, void** ppv);
  17. //+----------------------------------------------------------------
  18. //
  19. // Class: CStdClassFactory
  20. //
  21. // Purpose: The standard implementation of class factory object
  22. // for internal OLE classes.
  23. //
  24. // History: Rickhi 06-24-97 Created
  25. //
  26. // Notes: This class should be used whenever you need to have
  27. // a class factory object for any class implemented by
  28. // OLE32. Simply pass a creation function ptr to the ctor.
  29. // When ICF::CI is called, it will delegate to your
  30. // creation function.
  31. //
  32. //-----------------------------------------------------------------
  33. class CStdClassFactory : public IClassFactory
  34. {
  35. public:
  36. // Constructor
  37. CStdClassFactory(DWORD dwIndex)
  38. : _cRefs(1), _dwIndex(dwIndex) {}
  39. // IUnknown methods
  40. STDMETHOD (QueryInterface) (REFIID riid, void **ppv);
  41. STDMETHOD_(ULONG,AddRef) (void);
  42. STDMETHOD_(ULONG,Release) (void);
  43. // IClassFactory methods
  44. STDMETHOD (CreateInstance)(IUnknown *pUnkOuter, REFIID riid, void **ppv);
  45. STDMETHOD (LockServer) (BOOL fLock) { return S_OK; }
  46. private:
  47. ULONG _cRefs; // CF reference count
  48. DWORD _dwIndex; // index of entry in global class table
  49. };
  50. #endif // __STDCLASSFACTORY_HXX__