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.

90 lines
1.5 KiB

  1. extern "C" {
  2. #include <nt.h>
  3. #include <ntrtl.h>
  4. #include <nturtl.h>
  5. }
  6. #include <ole2.h>
  7. #include <windows.h>
  8. #include <olectl.h>
  9. #include <stdio.h>
  10. #include <iadmext.h>
  11. #include <coimp.hxx>
  12. CAdmExt::CAdmExt()
  13. {
  14. }
  15. CAdmExt::~CAdmExt()
  16. {
  17. }
  18. HRESULT
  19. CAdmExt::QueryInterface(REFIID riid, void **ppObject) {
  20. if (riid==IID_IUnknown || riid==IID_IADMEXT) {
  21. *ppObject = (IADMEXT *) this;
  22. }
  23. else {
  24. return E_NOINTERFACE;
  25. }
  26. AddRef();
  27. return NO_ERROR;
  28. }
  29. ULONG
  30. CAdmExt::AddRef()
  31. {
  32. DWORD dwRefCount;
  33. InterlockedIncrement((long *)&g_dwRefCount);
  34. dwRefCount = InterlockedIncrement((long *)&m_dwRefCount);
  35. return dwRefCount;
  36. }
  37. ULONG
  38. CAdmExt::Release()
  39. {
  40. DWORD dwRefCount;
  41. InterlockedDecrement((long *)&g_dwRefCount);
  42. dwRefCount = InterlockedDecrement((long *)&m_dwRefCount);
  43. //
  44. // This is now a member of class factory.
  45. // It is not dynamically allocated, so don't delete it.
  46. //
  47. /*
  48. if (dwRefCount == 0) {
  49. delete this;
  50. return 0;
  51. }
  52. */
  53. return dwRefCount;
  54. }
  55. HRESULT STDMETHODCALLTYPE
  56. CAdmExt::Initialize(void)
  57. {
  58. return ERROR_SUCCESS;
  59. }
  60. HRESULT STDMETHODCALLTYPE
  61. CAdmExt::EnumDcomCLSIDs(
  62. /* [size_is][out] */ CLSID *pclsidDcom,
  63. /* [in] */ DWORD dwEnumIndex)
  64. {
  65. HRESULT hresReturn = HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS);
  66. if (dwEnumIndex == 0) {
  67. *pclsidDcom = CLSID_DCOMADMEXT;
  68. hresReturn = S_OK;
  69. }
  70. return hresReturn;
  71. }
  72. HRESULT STDMETHODCALLTYPE
  73. CAdmExt::Terminate(void)
  74. {
  75. return ERROR_SUCCESS;
  76. }