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.

118 lines
3.2 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1998-2002 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: classfac.cpp
  6. * Content: a generic class factory
  7. *
  8. *
  9. * This is a generic C class factory. All you need to do is implement
  10. * a function called DoCreateInstance that will create an instace of
  11. * your object.
  12. *
  13. * GP_ stands for "General Purpose"
  14. *
  15. * History:
  16. * Date By Reason
  17. * ==== == ======
  18. * 10/13/98 jwo Created it.
  19. ***************************************************************************/
  20. #include "dnwsocki.h"
  21. #ifndef DPNBUILD_LIBINTERFACE
  22. #ifdef __MWERKS__
  23. #define EXP __declspec(dllexport)
  24. #else
  25. #define EXP
  26. #endif // __MWERKS__
  27. //**********************************************************************
  28. // Constant definitions
  29. //**********************************************************************
  30. //**********************************************************************
  31. // Macro definitions
  32. //**********************************************************************
  33. //**********************************************************************
  34. // Structure definitions
  35. //**********************************************************************
  36. //**********************************************************************
  37. // Variable definitions
  38. //**********************************************************************
  39. //**********************************************************************
  40. // Function prototypes
  41. //**********************************************************************
  42. //**********************************************************************
  43. // Function definitions
  44. //**********************************************************************
  45. /*
  46. * DP8WSCF_CreateInstance
  47. *
  48. * Creates an instance of a DNServiceProvider object
  49. */
  50. STDMETHODIMP DP8WSCF_CreateInstance(
  51. LPCLASSFACTORY This,
  52. LPUNKNOWN pUnkOuter,
  53. REFIID riid,
  54. LPVOID *ppvObj
  55. )
  56. {
  57. HRESULT hr = S_OK;
  58. _IDirectPlayClassFactory* pcf;
  59. if( pUnkOuter != NULL )
  60. {
  61. return CLASS_E_NOAGGREGATION;
  62. }
  63. pcf = (_IDirectPlayClassFactory*) This;
  64. *ppvObj = NULL;
  65. /*
  66. * create the object by calling DoCreateInstance. This function
  67. * must be implemented specifically for your COM object
  68. */
  69. hr = DoCreateInstance(This, pUnkOuter, pcf->clsid, riid, ppvObj);
  70. if (FAILED(hr))
  71. {
  72. *ppvObj = NULL;
  73. return hr;
  74. }
  75. return S_OK;
  76. } /* DP8WSCF_CreateInstance */
  77. IClassFactoryVtbl TCPIPClassFactoryVtbl =
  78. {
  79. DPCF_QueryInterface, // common\classfactory.cpp will implement the rest of these
  80. DPCF_AddRef,
  81. DPCF_Release,
  82. DP8WSCF_CreateInstance, // MASONB: TODO: Finish making these CLSID specific
  83. DPCF_LockServer
  84. };
  85. #ifndef DPNBUILD_NOIPX
  86. IClassFactoryVtbl IPXClassFactoryVtbl =
  87. {
  88. DPCF_QueryInterface, // common\classfactory.cpp will implement the rest of these
  89. DPCF_AddRef,
  90. DPCF_Release,
  91. DP8WSCF_CreateInstance,
  92. DPCF_LockServer
  93. };
  94. #endif // ! DPNBUILD_NOIPX
  95. #endif // ! DPNBUILD_LIBINTERFACE