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.

179 lines
5.4 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. faxproppg.cpp
  5. Abstract:
  6. This file contains my implementation of IExtendPropertyPage for the IComponent interface.
  7. Environment:
  8. WIN32 User Mode
  9. Author:
  10. Darwin Ouyang (t-darouy) 30-Sept-1997
  11. --*/
  12. // faxcompdata.cpp : Implementation of CFaxComponentData
  13. #include "stdafx.h"
  14. #include "faxcprppg.h" // IExtendPropertyPage for IComponent
  15. #include "faxadmin.h"
  16. #include "faxsnapin.h"
  17. #include "faxcomp.h"
  18. #include "faxcompd.h"
  19. #include "faxdataobj.h"
  20. #include "faxhelper.h"
  21. #include "faxstrt.h"
  22. #include "iroot.h"
  23. #include "dcomputer.h"
  24. #pragma hdrstop
  25. ////////////////////////////////////////////////////////////////////////////////////////////////////
  26. ////////////////////////////////////////////////////////////////////////////////////////////////////
  27. ////////////////////////////////////////////////////////////////////////////////////////////////////
  28. ////////////////////////////////////////////////////////////////////////////////////////////////////
  29. //
  30. //
  31. // CFaxComponentExtendPropertyPage
  32. //
  33. //
  34. HRESULT
  35. STDMETHODCALLTYPE
  36. CFaxComponentExtendPropertySheet::CreatePropertyPages(
  37. IN LPPROPERTYSHEETCALLBACK lpProvider,
  38. IN LONG_PTR handle,
  39. IN LPDATAOBJECT lpIDataObject)
  40. /*++
  41. Routine Description:
  42. This routine dispatches the CreateProperPages to the correct node by
  43. extracting the cookie from lpIdataobject.
  44. Arguments:
  45. lpProvider - PROPERTSHEETCALLBACK pointer.
  46. handle - MMC routing handle
  47. lpIDataobject - the data object associated with the destination node
  48. Return Value:
  49. HRESULT indicating SUCCEEDED() or FAILED()
  50. --*/
  51. {
  52. DebugPrint(( TEXT(" ************************ Trace: CFaxComponentExtendPropertySheet::CreatePropertyPages") ));
  53. CFaxDataObject * myDataObject = NULL;
  54. LONG_PTR cookie;
  55. HRESULT hr;
  56. assert( lpIDataObject != NULL );
  57. assert( lpProvider != NULL );
  58. if( lpIDataObject == NULL || lpProvider == NULL ) {
  59. return E_POINTER;
  60. }
  61. myDataObject = ExtractOwnDataObject( lpIDataObject );
  62. if( myDataObject == NULL ) {
  63. return E_UNEXPECTED;
  64. }
  65. cookie = myDataObject->GetCookie();
  66. if( myDataObject->GetContext() == CCT_RESULT ) {
  67. DebugPrint(( TEXT("Trace: CFaxComponentExtendPropertySheet::CreatePropertyPages - RESULT context") ));
  68. // regular property sheet request, dispatch it
  69. if( cookie == NULL ) {
  70. DebugPrint(( TEXT("Trace: CFaxComponentExtendPropertySheet::CreatePropertyPages - ROOT node") ));
  71. // root object
  72. assert( m_pFaxComponent != NULL );
  73. hr = m_pFaxComponent->pOwner->globalRoot->ComponentPropertySheetCreatePropertyPages( m_pFaxComponent, lpProvider, handle, myDataObject );
  74. } else {
  75. DebugPrint(( TEXT("Trace: CFaxComponentExtendPropertySheet::CreatePropertyPages - SUBNODE") ));
  76. // subfolder
  77. try {
  78. hr = ((CInternalNode *)cookie)->ComponentPropertySheetCreatePropertyPages( m_pFaxComponent, lpProvider, handle, myDataObject );
  79. } catch ( ... ) {
  80. DebugPrint(( TEXT("Invalid Cookie: 0x%08x"), cookie ));
  81. assert( FALSE ); // got passed an INVALID COOKIE!?!?!?!?
  82. hr = E_UNEXPECTED;
  83. }
  84. }
  85. } else {
  86. // the MMC shouldn't call us with any other type of request!
  87. assert( FALSE );
  88. }
  89. return hr;
  90. }
  91. HRESULT
  92. STDMETHODCALLTYPE
  93. CFaxComponentExtendPropertySheet::QueryPagesFor(
  94. IN LPDATAOBJECT lpDataObject)
  95. /*++
  96. Routine Description:
  97. This routine dispatches the QueryPagesFor to the correct node by
  98. extracting the cookie from lpIdataobject.
  99. Arguments:
  100. lpDataobject - the data object associated with the destination node
  101. Return Value:
  102. HRESULT indicating SUCCEEDED() or FAILED()
  103. --*/
  104. {
  105. DebugPrint(( TEXT(" ************************ Trace: CFaxComponentExtendPropertySheet::QueryPagesFor") ));
  106. CFaxDataObject * myDataObject = NULL;
  107. LONG_PTR cookie;
  108. HRESULT hr;
  109. assert( lpDataObject != NULL );
  110. if( lpDataObject == NULL ) {
  111. return E_POINTER;
  112. }
  113. myDataObject = ExtractOwnDataObject( lpDataObject );
  114. if( myDataObject == NULL ) {
  115. return E_UNEXPECTED;
  116. }
  117. cookie = myDataObject->GetCookie();
  118. if( myDataObject->GetContext() == CCT_RESULT ) {
  119. // regular property sheet request, dispatch it
  120. if( cookie == NULL ) {
  121. // root object
  122. assert( m_pFaxComponent != NULL );
  123. hr = m_pFaxComponent->pOwner->globalRoot->ComponentPropertySheetQueryPagesFor( m_pFaxComponent, myDataObject );
  124. } else {
  125. // subfolder
  126. try {
  127. hr = ((CInternalNode *)cookie)->ComponentPropertySheetQueryPagesFor( m_pFaxComponent, myDataObject );
  128. } catch ( ... ) {
  129. DebugPrint(( TEXT("Invalid Cookie: 0x%08x"), cookie ));
  130. assert( FALSE ); // got passed an INVALID COOKIE!?!?!?!?
  131. hr = E_UNEXPECTED;
  132. }
  133. }
  134. } else {
  135. // the MMC shouldn't call us with any other type of request!
  136. assert( FALSE );
  137. }
  138. return hr;
  139. }