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.

200 lines
5.0 KiB

  1. /*++
  2. (c) 1998 Seagate Software, Inc. All rights reserved.
  3. Module Name:
  4. About.cpp
  5. Abstract:
  6. This component implements the ISnapinAbout
  7. interface for the Remote Storage Snapin.
  8. Author:
  9. Art Bragg [abragg] 04-Aug-1997
  10. Revision History:
  11. --*/
  12. #include "stdafx.h"
  13. #include <NtVerP.h>
  14. #include "RsBuild.h"
  15. #include "About.h"
  16. /////////////////////////////////////////////////////////////////////////////
  17. //
  18. ///////////////////////////////////////////////////////////////////////
  19. // ISnapinAbout
  20. ///////////////////////////////////////////////////////////////////////
  21. CAbout::CAbout()
  22. {
  23. m_hSmallImage = NULL;
  24. m_hSmallImageOpen = NULL;
  25. m_hLargeImage = NULL;
  26. m_hAppIcon = NULL;
  27. }
  28. CAbout::~CAbout()
  29. {
  30. DestroyBitmapObjects();
  31. DestroyIconObject();
  32. }
  33. void CAbout::DestroyBitmapObjects(void)
  34. {
  35. if (NULL != m_hSmallImage) {
  36. DeleteObject(m_hSmallImage);
  37. m_hSmallImage = NULL;
  38. }
  39. if (NULL != m_hSmallImageOpen) {
  40. DeleteObject(m_hSmallImageOpen);
  41. m_hSmallImageOpen = NULL;
  42. }
  43. if (NULL != m_hLargeImage) {
  44. DeleteObject(m_hLargeImage);
  45. m_hLargeImage = NULL;
  46. }
  47. }
  48. void CAbout::DestroyIconObject(void)
  49. {
  50. if (NULL != m_hAppIcon) {
  51. DestroyIcon(m_hAppIcon);
  52. m_hAppIcon = NULL;
  53. }
  54. }
  55. HRESULT CAbout::AboutHelper(UINT nID, LPOLESTR* lpPtr)
  56. {
  57. WsbTraceIn( L"CAbout::AboutHelper", L"lpPtr = <0x%p>", lpPtr );
  58. HRESULT hr = S_OK;
  59. try {
  60. WsbAffirmPointer( lpPtr );
  61. CWsbStringPtr s;
  62. s.LoadFromRsc( _Module.m_hInst, nID );
  63. *lpPtr = 0;
  64. WsbAffirmHr( s.CopyTo( lpPtr ) );
  65. } WsbCatch( hr );
  66. WsbTraceOut( L"CAbout::AboutHelper", L"hr = <%ls>, *lpPtr = <%ls>", WsbHrAsString( hr ), WsbPtrToStringAsString( lpPtr ) );
  67. return( hr );
  68. }
  69. STDMETHODIMP CAbout::GetSnapinDescription(LPOLESTR* lpDescription)
  70. {
  71. WsbTraceIn( L"CAbout::GetSnapinDescription", L"lpDescription = <0x%p>", lpDescription );
  72. HRESULT hr = AboutHelper(IDS_DESCRIPTION, lpDescription);
  73. WsbTraceOut( L"CAbout::GetSnapinDescription", L"hr = <%ls>, *lpDescription = <%ls>", WsbHrAsString( hr ), WsbPtrToStringAsString( lpDescription ) );
  74. return( hr );
  75. }
  76. STDMETHODIMP CAbout::GetProvider(LPOLESTR* lpName)
  77. {
  78. WsbTraceIn( L"CAbout::GetProvider", L"lpName = <0x%p>", lpName );
  79. HRESULT hr = AboutHelper(IDS_COMPANY, lpName);
  80. WsbTraceOut( L"CAbout::GetProvider", L"hr = <%ls>, *lpName = <%ls>", WsbHrAsString( hr ), WsbPtrToStringAsString( lpName ) );
  81. return( hr );
  82. }
  83. STDMETHODIMP CAbout::GetSnapinVersion(LPOLESTR* lpVersion)
  84. {
  85. WsbTraceIn( L"CAbout::GetSnapinVersion", L"lpVersion = <0x%p>", lpVersion );
  86. HRESULT hr = S_OK;
  87. try {
  88. *lpVersion = 0;
  89. CWsbStringPtr s;
  90. s.Alloc( 100 );
  91. swprintf( s, L"%hs.%d [%ls]", VER_PRODUCTVERSION_STRING, VER_PRODUCTBUILD, RS_BUILD_VERSION_STRING );
  92. WsbAffirmHr( s.CopyTo( lpVersion ) );
  93. } WsbCatch( hr );
  94. WsbTraceOut( L"CAbout::GetSnapinVersion", L"hr = <%ls>, *lpVersion = <%ls>", WsbHrAsString( hr ), WsbPtrToStringAsString( lpVersion ) );
  95. return( hr );
  96. }
  97. STDMETHODIMP CAbout::GetSnapinImage(HICON* hAppIcon)
  98. {
  99. WsbTraceIn( L"CAbout::GetSnapinImage", L"hAppIcon = <0x%p>", hAppIcon );
  100. AFX_MANAGE_STATE( AfxGetStaticModuleState());
  101. HRESULT hr = S_OK;
  102. try {
  103. WsbAffirmPointer( hAppIcon )
  104. DestroyIconObject();
  105. m_hAppIcon = LoadIcon( AfxGetInstanceHandle(), MAKEINTRESOURCE( IDI_BLUESAKKARA ) );
  106. *hAppIcon = m_hAppIcon;
  107. WsbAffirmPointer( *hAppIcon );
  108. } WsbCatch( hr );
  109. WsbTraceOut( L"CAbout::GetSnapinImage", L"hr = <%ls>, *lpVersion = <%ls>", WsbHrAsString( hr ), WsbPtrToPtrAsString( (void**)hAppIcon ) );
  110. return( hr );
  111. }
  112. STDMETHODIMP
  113. CAbout::GetStaticFolderImage(
  114. HBITMAP* hSmallImage,
  115. HBITMAP* hSmallImageOpen,
  116. HBITMAP* hLargeImage,
  117. COLORREF* cLargeMask
  118. )
  119. {
  120. WsbTraceIn( L"CAbout::GetStaticFolderImage", L"" );
  121. AFX_MANAGE_STATE( AfxGetStaticModuleState());
  122. HRESULT hr = S_OK;
  123. try {
  124. DestroyBitmapObjects();
  125. m_hSmallImage = LoadBitmap( AfxGetInstanceHandle(), MAKEINTRESOURCE( IDB_SMALL_SAKKARA ) );
  126. *hSmallImage = m_hSmallImage;
  127. WsbAffirmStatus( 0 != *hSmallImage );
  128. m_hSmallImageOpen = LoadBitmap( AfxGetInstanceHandle(), MAKEINTRESOURCE( IDB_SMALL_SAKKARA ) );
  129. *hSmallImageOpen = m_hSmallImageOpen;
  130. WsbAffirmStatus( 0 != *hSmallImageOpen );
  131. m_hLargeImage = LoadBitmap( AfxGetInstanceHandle(), MAKEINTRESOURCE( IDB_LARGE_SAKKARA ) );
  132. *hLargeImage = m_hLargeImage;
  133. WsbAffirmStatus( 0 != *hLargeImage );
  134. *cLargeMask = RGB( 0xFF, 0x00, 0xFF ); // Magenta
  135. } WsbCatch( hr );
  136. WsbTraceOut( L"CAbout::GetStaticFolderImage", L"hr = <%ls>", WsbHrAsString( hr ) );
  137. return( hr );
  138. }