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.

190 lines
4.6 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (C) Microsoft Corporation
  4. //
  5. // Module Name:
  6. //
  7. // About.cpp
  8. //
  9. // Abstract:
  10. //
  11. // Implementation file for the CSnapinAbout class.
  12. //
  13. // The CSnapinAbout class implements the ISnapinAbout interface which
  14. // enables the MMC console to get copyright and version information from the
  15. // snap-in.
  16. // The console also uses this interface to obtain images for the static
  17. // folder from the snap-in.
  18. //////////////////////////////////////////////////////////////////////////////
  19. #include "Precompiled.h"
  20. #include "About.h"
  21. #include <ntverp.h>
  22. //////////////////////////////////////////////////////////////////////////////
  23. /*++
  24. CSnapinAbout::GetSnapinDescription
  25. Enables the console to obtain the text for the snap-in's description box.
  26. HRESULT GetSnapinDescription(
  27. LPOLESTR * lpDescription // Pointer to the description text.
  28. );
  29. Parameters
  30. lpDescription
  31. [out] Pointer to the text for the description box on an About property page.
  32. Return Values
  33. S_OK
  34. The text was successfully obtained.
  35. Remarks
  36. Memory for out parameters must be allocated using CoTaskMemAlloc.
  37. --*/
  38. //////////////////////////////////////////////////////////////////////////////
  39. STDMETHODIMP CSnapinAbout::GetSnapinDescription (LPOLESTR *lpDescription)
  40. {
  41. USES_CONVERSION;
  42. TCHAR szBuf[256];
  43. if (::LoadString(_Module.GetResourceInstance(), IDS_NAPSNAPIN_DESC, szBuf, 256) == 0)
  44. return E_FAIL;
  45. *lpDescription = (LPOLESTR)CoTaskMemAlloc((lstrlen(szBuf) + 1) * sizeof(TCHAR));
  46. if (*lpDescription == NULL)
  47. return E_OUTOFMEMORY;
  48. ocscpy(*lpDescription, T2OLE(szBuf));
  49. return S_OK;
  50. }
  51. //////////////////////////////////////////////////////////////////////////////
  52. /*++
  53. CSnapinAbout::GetProvider
  54. Enables the console to obtain the snap-in provider's name.
  55. HRESULT GetProvider(
  56. LPOLESTR * lpName // Pointer to the provider's name
  57. );
  58. Parameters
  59. lpName
  60. [out] Pointer to the text making up the snap-in provider's name.
  61. Return Values
  62. S_OK
  63. The name was successfully obtained.
  64. Remarks
  65. Memory for out parameters must be allocated using CoTaskMemAlloc.
  66. --*/
  67. //////////////////////////////////////////////////////////////////////////////
  68. STDMETHODIMP CSnapinAbout::GetProvider (LPOLESTR *lpName)
  69. {
  70. USES_CONVERSION;
  71. TCHAR szBuf[256];
  72. if (::LoadString(_Module.GetResourceInstance(), IDS_NAPSNAPIN_PROVIDER, szBuf, 256) == 0)
  73. return E_FAIL;
  74. *lpName = (LPOLESTR)CoTaskMemAlloc((lstrlen(szBuf) + 1) * sizeof(TCHAR));
  75. if (*lpName == NULL)
  76. return E_OUTOFMEMORY;
  77. ocscpy(*lpName, T2OLE(szBuf));
  78. return S_OK;
  79. }
  80. //////////////////////////////////////////////////////////////////////////////
  81. /*++
  82. CSnapinAbout::GetSnapinVersion
  83. Enables the console to obtain the snap-in's version number.
  84. HRESULT GetSnapinVersion(
  85. LPOLESTR* lpVersion // Pointer to the version number.
  86. );
  87. Parameters
  88. lpVersion
  89. [out] Pointer to the text making up the snap-in's version number.
  90. Return Values
  91. S_OK
  92. The version number was successfully obtained.
  93. Remarks
  94. Memory for out parameters must be allocated using CoTaskMemAlloc.
  95. --*/
  96. //////////////////////////////////////////////////////////////////////////////
  97. STDMETHODIMP CSnapinAbout::GetSnapinVersion (LPOLESTR *lpVersion)
  98. {
  99. CString version(LVER_PRODUCTVERSION_STR);
  100. *lpVersion = (LPOLESTR)CoTaskMemAlloc(
  101. version.GetLength() + sizeof(WCHAR));
  102. if (*lpVersion == NULL)
  103. {
  104. return E_OUTOFMEMORY;
  105. }
  106. wcscpy(*lpVersion, (LPCWSTR)version);
  107. return S_OK;
  108. }
  109. //////////////////////////////////////////////////////////////////////////////
  110. /*++
  111. CSnapinAbout::GetSnapinImage
  112. Enables the console to obtain the snap-in's main icon to be used in the About box.
  113. Parameters
  114. hAppIcon
  115. [out] Pointer to the handle of the main icon of the snap-in that is to be used in the About property page.
  116. Return Values
  117. S_OK
  118. The handle to the icon was successfully obtained.
  119. ISSUE: What do I return if I can't get the icon?
  120. Remarks
  121. Memory for out parameters must be allocated using CoTaskMemAlloc.
  122. --*/
  123. //////////////////////////////////////////////////////////////////////////////
  124. STDMETHODIMP CSnapinAbout::GetSnapinImage (HICON *hAppIcon)
  125. {
  126. if ( NULL == (*hAppIcon = ::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_NAP_SNAPIN_IMAGE) ) ) )
  127. return E_FAIL;
  128. return S_OK;
  129. }
  130. STDMETHODIMP CSnapinAbout::GetStaticFolderImage (
  131. HBITMAP *hSmallImage,
  132. HBITMAP *hSmallImageOpen,
  133. HBITMAP *hLargeImage,
  134. COLORREF *cMask)
  135. {
  136. return S_OK;
  137. }