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.

182 lines
4.6 KiB

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