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.

195 lines
5.8 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. faxproppg.cpp
  5. Abstract:
  6. This file contains my implementation of IExtendPropertyPage.
  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 "faxproppg.h"
  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. // CFaxExtendPropertyPage
  32. //
  33. //
  34. HRESULT
  35. STDMETHODCALLTYPE
  36. CFaxExtendPropertySheet::CreatePropertyPages(
  37. IN LPPROPERTYSHEETCALLBACK lpProvider,
  38. IN LONG_PTR handle,
  39. IN LPDATAOBJECT lpIDataObject)
  40. /*++
  41. Routine Description:
  42. This routine extracts the cookie from lpIDataObject and dispatches
  43. the call to the correct node object. It also handles the initialization
  44. case (the select computer dialog).
  45. Arguments:
  46. lpProvider - a pointer to the PROPERTSHEET callback
  47. handle - a MMC routing handle
  48. lpIDataObject - the data object for this object.
  49. Return Value:
  50. HRESULT indicating SUCCEEDED() or FAILED()
  51. --*/
  52. {
  53. DebugPrint(( TEXT(" ************************ Trace: CFaxExtendPropertySheet::CreatePropertyPages") ));
  54. CFaxDataObject * myDataObject;
  55. CFaxSelectComputerPropSheet * pFoo;
  56. LONG_PTR cookie;
  57. HRESULT hr;
  58. assert( lpIDataObject != NULL );
  59. assert( lpProvider != NULL );
  60. if( lpIDataObject == NULL || lpProvider == NULL ) {
  61. assert( FALSE );
  62. return E_POINTER;
  63. }
  64. myDataObject = ExtractOwnDataObject( lpIDataObject );
  65. if( myDataObject == NULL ) {
  66. return E_UNEXPECTED;
  67. }
  68. cookie = myDataObject->GetCookie();
  69. if( myDataObject->GetContext() == CCT_SNAPIN_MANAGER ) {
  70. // initialization case, handle it here!!
  71. DebugPrint(( TEXT("Trace: CFaxExtendPropertySheet::CreatePropertyPages - NODEMGR context") ));
  72. pFoo = new CFaxSelectComputerPropSheet( ::GlobalStringTable->GetInstance(), handle, m_pFaxSnapin->globalRoot );
  73. if (!pFoo) {
  74. return E_OUTOFMEMORY;
  75. }
  76. hr = lpProvider->AddPage( pFoo->GetHandle() );
  77. } else if( myDataObject->GetContext() == CCT_SCOPE ) {
  78. DebugPrint(( TEXT("Trace: CFaxExtendPropertySheet::CreatePropertyPages - SCOPE context") ));
  79. // regular property sheet request, dispatch it
  80. if( cookie == NULL ) {
  81. DebugPrint(( TEXT("Trace: CFaxExtendPropertySheet::CreatePropertyPages - ROOT node") ));
  82. // root object
  83. assert( m_pFaxSnapin != NULL );
  84. hr = m_pFaxSnapin->globalRoot->ComponentDataPropertySheetCreatePropertyPages( m_pFaxSnapin, lpProvider, handle, myDataObject );
  85. } else {
  86. DebugPrint(( TEXT("Trace: CFaxExtendPropertySheet::CreatePropertyPages - SUBNODE") ));
  87. // subfolder
  88. try {
  89. hr = ((CInternalNode *)cookie)->ComponentDataPropertySheetCreatePropertyPages( m_pFaxSnapin, lpProvider, handle, myDataObject );
  90. } catch ( ... ) {
  91. DebugPrint(( TEXT("Invalid Cookie: 0x%08x"), cookie ));
  92. assert( FALSE ); // got passed an INVALID COOKIE!?!?!?!?
  93. hr = E_UNEXPECTED;
  94. }
  95. }
  96. } else {
  97. // oops - mmc shouldn't be calling us with CCT_RESULT
  98. assert( FALSE );
  99. }
  100. return hr;
  101. }
  102. HRESULT
  103. STDMETHODCALLTYPE
  104. CFaxExtendPropertySheet::QueryPagesFor(
  105. IN LPDATAOBJECT lpDataObject)
  106. /*++
  107. Routine Description:
  108. This routine extracts the cookie from lpIDataObject and dispatches
  109. the call to the correct node object.
  110. Arguments:
  111. lpIDataObject - the data object for this object.
  112. Return Value:
  113. HRESULT indicating SUCCEEDED() S_OK, or S_FALSE
  114. or FAILED()
  115. --*/
  116. {
  117. DebugPrint(( TEXT(" ************************ Trace: CFaxExtendPropertySheet::QueryPagesFor") ));
  118. CFaxDataObject * myDataObject;
  119. LONG_PTR cookie;
  120. HRESULT hr;
  121. assert( lpDataObject != NULL );
  122. if( lpDataObject == NULL ) {
  123. return E_POINTER;
  124. }
  125. myDataObject = ExtractOwnDataObject( lpDataObject );
  126. if( myDataObject == NULL ) {
  127. assert( FALSE );
  128. return E_UNEXPECTED;
  129. }
  130. cookie = myDataObject->GetCookie();
  131. if( myDataObject->GetContext() == CCT_SNAPIN_MANAGER ) {
  132. // initialization case, handle it here!!
  133. hr = S_OK;
  134. } else if( myDataObject->GetContext() == CCT_SCOPE ) {
  135. // regular property sheet request, dispatch it
  136. if( cookie == NULL ) {
  137. // root object
  138. assert( m_pFaxSnapin );
  139. hr = m_pFaxSnapin->globalRoot->ComponentDataPropertySheetQueryPagesFor( m_pFaxSnapin, myDataObject );
  140. } else {
  141. // subfolder
  142. try {
  143. hr = ((CInternalNode *)cookie)->ComponentDataPropertySheetQueryPagesFor( m_pFaxSnapin, myDataObject );
  144. } catch ( ... ) {
  145. DebugPrint(( TEXT("Invalid Cookie: 0x%08x"), cookie ));
  146. assert( FALSE ); // got passed an INVALID COOKIE!?!?!?!?
  147. hr = E_UNEXPECTED;
  148. }
  149. }
  150. } else {
  151. // oops - mmc shouldn't be calling us with CCT_RESULT
  152. assert( FALSE );
  153. }
  154. return hr;
  155. }