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.

159 lines
4.6 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 2000-2002 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: ServProv.h
  6. * Content: Service Provider Header File
  7. *@@BEGIN_MSINTERNAL
  8. * History:
  9. * Date By Reason
  10. * ==== == ======
  11. * 03/17/00 mjn Created
  12. * 05/02/00 mjn Fixed RefCount issue
  13. * 07/06/00 mjn Fixes to support SP handle to Protocol
  14. * 08/05/00 RichGr IA64: Use %p format specifier in DPFs for 32/64-bit pointers and handles.
  15. * 08/20/00 mjn Changed m_bilink to m_bilinkServiceProviders
  16. * 10/15/01 vanceo Added GetGUID
  17. *@@END_MSINTERNAL
  18. *
  19. ***************************************************************************/
  20. #ifndef __SERV_PROV_H__
  21. #define __SERV_PROV_H__
  22. #undef DPF_SUBCOMP
  23. #define DPF_SUBCOMP DN_SUBCOMP_CORE
  24. //**********************************************************************
  25. // Constant definitions
  26. //**********************************************************************
  27. //**********************************************************************
  28. // Macro definitions
  29. //**********************************************************************
  30. //**********************************************************************
  31. // Structure definitions
  32. //**********************************************************************
  33. typedef struct _DIRECTNETOBJECT DIRECTNETOBJECT;
  34. typedef struct IDP8ServiceProvider IDP8ServiceProvider; // DPSP8.h
  35. //**********************************************************************
  36. // Variable definitions
  37. //**********************************************************************
  38. //**********************************************************************
  39. // Function prototypes
  40. //**********************************************************************
  41. //**********************************************************************
  42. // Class prototypes
  43. //**********************************************************************
  44. // class for ServiceProvider objects
  45. class CServiceProvider
  46. {
  47. public:
  48. CServiceProvider() // Constructor
  49. {
  50. };
  51. ~CServiceProvider() // Destructor
  52. {
  53. };
  54. HRESULT Initialize(DIRECTNETOBJECT *const pdnObject
  55. #ifdef DPNBUILD_PREALLOCATEDMEMORYMODEL
  56. ,const XDP8CREATE_PARAMS * const pDP8CreateParams
  57. #else // ! DPNBUILD_PREALLOCATEDMEMORYMODEL
  58. #ifndef DPNBUILD_ONLYONESP
  59. ,const GUID *const pguid
  60. #endif // ! DPNBUILD_ONLYONESP
  61. #ifndef DPNBUILD_LIBINTERFACE
  62. ,const GUID *const pguidApplication
  63. #endif // ! DPNBUILD_LIBINTERFACE
  64. #endif // ! DPNBUILD_PREALLOCATEDMEMORYMODEL
  65. );
  66. #undef DPF_MODNAME
  67. #define DPF_MODNAME "CServiceProvider::AddRef"
  68. void AddRef( void )
  69. {
  70. LONG lRefCount;
  71. #if ((defined(DPNBUILD_LIBINTERFACE)) && (defined(DPNBUILD_ONLYONESP)))
  72. DNASSERT(m_lRefCount >= 0);
  73. #else // ! DPNBUILD_LIBINTERFACE or ! DPNBUILD_ONLYONESP
  74. DNASSERT(m_lRefCount > 0);
  75. #endif // DPNBUILD_LIBINTERFACE and DPNBUILD_ONLYONESP
  76. DNASSERT(m_pdnObject != NULL);
  77. lRefCount = DNInterlockedIncrement(&m_lRefCount);
  78. DPFX(DPFPREP, 9,"[0x%p] new RefCount [%ld]",this,lRefCount);
  79. #if ((defined(DPNBUILD_LIBINTERFACE)) && (defined(DPNBUILD_ONLYONESP)))
  80. DNProtocolAddRef(m_pdnObject);
  81. #endif // DPNBUILD_LIBINTERFACE and DPNBUILD_ONLYONESP
  82. };
  83. #if ((defined(DPNBUILD_LIBINTERFACE)) && (defined(DPNBUILD_ONLYONESP)))
  84. void Deinitialize( void );
  85. void Release( void )
  86. {
  87. LONG lRefCount;
  88. DNASSERT(m_lRefCount > 0);
  89. DNASSERT(m_pdnObject != NULL);
  90. lRefCount = DNInterlockedDecrement(&m_lRefCount);
  91. DPFX(DPFPREP, 9,"[0x%p] new RefCount [%ld]",this,lRefCount);
  92. DNProtocolRelease(m_pdnObject);
  93. };
  94. #else // ! DPNBUILD_LIBINTERFACE or ! DPNBUILD_ONLYONESP
  95. void Release( void );
  96. #endif // ! DPNBUILD_LIBINTERFACE or ! DPNBUILD_ONLYONESP
  97. #ifndef DPNBUILD_ONLYONESP
  98. BOOL CheckGUID( const GUID *const pGUID )
  99. {
  100. if (m_guid == *pGUID)
  101. return(TRUE);
  102. return(FALSE);
  103. };
  104. void GetGUID( GUID *const pGUID )
  105. {
  106. memcpy(pGUID, &m_guid, sizeof(m_guid));
  107. };
  108. #endif // ! DPNBUILD_ONLYONESP
  109. HRESULT GetInterfaceRef( IDP8ServiceProvider **ppIDP8SP );
  110. HANDLE GetHandle( void )
  111. {
  112. return( m_hProtocolSPHandle );
  113. };
  114. #ifndef DPNBUILD_ONLYONESP
  115. CBilink m_bilinkServiceProviders;
  116. #endif // ! DPNBUILD_ONLYONESP
  117. private:
  118. #ifndef DPNBUILD_ONLYONESP
  119. GUID m_guid;
  120. #endif // ! DPNBUILD_ONLYONESP
  121. LONG m_lRefCount;
  122. IDP8ServiceProvider *m_pISP;
  123. HANDLE m_hProtocolSPHandle;
  124. DIRECTNETOBJECT *m_pdnObject;
  125. };
  126. #undef DPF_MODNAME
  127. #endif // __SERV_PROV_H__