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.

90 lines
2.9 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 2001 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: ClassFactory.h
  6. * Content: Base ClassFactory implementation
  7. *
  8. *
  9. * History:
  10. * Date By Reason
  11. * ==== == ======
  12. * 07/20/2001 masonb Created
  13. *
  14. ***************************************************************************/
  15. #ifndef __CLASS_FACTORY_H__
  16. #define __CLASS_FACTORY_H__
  17. #ifdef DPNBUILD_LIBINTERFACE
  18. #define GET_OBJECT_FROM_INTERFACE(a) (a)
  19. #else // ! DPNBUILD_LIBINTERFACE
  20. /*==========================================================================
  21. *
  22. * Instructions for use:
  23. *
  24. * 1) Declare an object count variable: LONG g_lLobbyObjectCount = 0;
  25. * 2) Implement a standard IClassFactory::CreateInstance function capable of
  26. * creating your object.
  27. * 3) Declare a VTBL variable: IClassFactoryVtbl DN_MyVtbl =
  28. * {DPCF_QueryInterface, DPCF_AddRef, DPCF_Release, <Your CreateInstance func>, DPCF_LockServer};
  29. * 4) In DllGetClassObject, call DPCFUtil_DllGetClassObject passing appropriate parameters
  30. * 5) In DllCanUnloadNow return S_OK if your object count variable is zero, or S_FALSE if it isn't
  31. *
  32. ***************************************************************************/
  33. //**********************************************************************
  34. // Class Factory definitions
  35. //**********************************************************************
  36. typedef struct _IDirectPlayClassFactory
  37. {
  38. IClassFactoryVtbl *lpVtbl; // lpVtbl Must be first element (to match external imp.)
  39. LONG lRefCount;
  40. CLSID clsid;
  41. LONG* plClassFacObjCount;
  42. } _IDirectPlayClassFactory, *_PIDirectPlayClassFactory;
  43. STDMETHODIMP DPCF_QueryInterface(IClassFactory* pInterface, REFIID riid, LPVOID *ppv);
  44. STDMETHODIMP_(ULONG) DPCF_AddRef(IClassFactory* pInterface);
  45. STDMETHODIMP_(ULONG) DPCF_Release(IClassFactory* pInterface);
  46. STDMETHODIMP DPCF_LockServer(IClassFactory *pInterface, BOOL fLock);
  47. HRESULT DPCFUtil_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv, IClassFactoryVtbl* pVtbl, LONG* plClassFacObjCount);
  48. //**********************************************************************
  49. // COM Object definitions
  50. //**********************************************************************
  51. extern CFixedPool g_fpInterfaceLists;
  52. extern CFixedPool g_fpObjectDatas;
  53. #define GET_OBJECT_FROM_INTERFACE(a) ((INTERFACE_LIST*)(a))->pObject->pvData
  54. struct _INTERFACE_LIST;
  55. struct _OBJECT_DATA;
  56. typedef struct _INTERFACE_LIST
  57. {
  58. void *lpVtbl;
  59. LONG lRefCount;
  60. IID iid;
  61. _INTERFACE_LIST *pIntNext;
  62. _OBJECT_DATA *pObject;
  63. } INTERFACE_LIST, *LPINTERFACE_LIST;
  64. typedef struct _OBJECT_DATA
  65. {
  66. LONG lRefCount;
  67. void *pvData;
  68. _INTERFACE_LIST *pIntList;
  69. } OBJECT_DATA, *LPOBJECT_DATA;
  70. #endif // ! DPNBUILD_LIBINTERFACE
  71. #endif // __CLASS_FACTORY_H__