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.

205 lines
5.1 KiB

  1. // This is a part of the Microsoft Management Console.
  2. // Copyright (C) Microsoft Corporation, 1995 - 1999
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Management Console and related
  7. // electronic documentation provided with the interfaces.
  8. #include <stdafx.h>
  9. CCAPolicyAboutImpl::CCAPolicyAboutImpl()
  10. {
  11. }
  12. CCAPolicyAboutImpl::~CCAPolicyAboutImpl()
  13. {
  14. }
  15. HRESULT CCAPolicyAboutImpl::AboutHelper(UINT nID, LPOLESTR* lpPtr)
  16. {
  17. if (lpPtr == NULL)
  18. return E_POINTER;
  19. CString s;
  20. // Needed for Loadstring
  21. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  22. s.LoadString(nID);
  23. *lpPtr = reinterpret_cast<LPOLESTR>
  24. (CoTaskMemAlloc((s.GetLength() + 1)* sizeof(wchar_t)));
  25. if (*lpPtr == NULL)
  26. return E_OUTOFMEMORY;
  27. USES_CONVERSION;
  28. wcscpy(*lpPtr, T2OLE((LPTSTR)(LPCTSTR)s));
  29. return S_OK;
  30. }
  31. STDMETHODIMP CCAPolicyAboutImpl::GetSnapinDescription(LPOLESTR* lpDescription)
  32. {
  33. return AboutHelper(IDS_CAPOLICY_DESCRIPTION, lpDescription);
  34. }
  35. STDMETHODIMP CCAPolicyAboutImpl::GetProvider(LPOLESTR* lpName)
  36. {
  37. return AboutHelper(IDS_COMPANY, lpName);
  38. }
  39. STDMETHODIMP CCAPolicyAboutImpl::GetSnapinVersion(LPOLESTR* lpVersion)
  40. {
  41. return AboutHelper(IDS_CAPOLICY_VERSION, lpVersion);
  42. }
  43. STDMETHODIMP CCAPolicyAboutImpl::GetSnapinImage(HICON* hAppIcon)
  44. {
  45. if (hAppIcon == NULL)
  46. return E_POINTER;
  47. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  48. // in MMC 1.1, this will be used as root node icon!!
  49. *hAppIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_APPICON));
  50. ASSERT(*hAppIcon != NULL);
  51. return (*hAppIcon != NULL) ? S_OK : E_FAIL;
  52. }
  53. STDMETHODIMP CCAPolicyAboutImpl::GetStaticFolderImage(HBITMAP* hSmallImage,
  54. HBITMAP* hSmallImageOpen,
  55. HBITMAP* hLargeImage,
  56. COLORREF* cLargeMask)
  57. {
  58. ASSERT(hSmallImage != NULL);
  59. ASSERT(hSmallImageOpen != NULL);
  60. ASSERT(hLargeImage != NULL);
  61. ASSERT(cLargeMask != NULL);
  62. AFX_MANAGE_STATE(AfxGetStaticModuleState()); // Required for AfxGetInstanceHandle()
  63. HINSTANCE hInstance = AfxGetInstanceHandle();
  64. *hSmallImage = ::LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_FOLDER_SMALL));
  65. *hSmallImageOpen = ::LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_FOLDER_SMALL));
  66. *hLargeImage = ::LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_FOLDER_LARGE));
  67. *cLargeMask = RGB(255, 0, 255);
  68. #ifdef _DEBUG
  69. if (NULL == *hSmallImage || NULL == *hSmallImageOpen || NULL == *hLargeImage)
  70. {
  71. OutputDebugString(L"WRN: CSnapinAbout::GetStaticFolderImage() - Unable to load all the bitmaps.\n");
  72. return E_FAIL;
  73. }
  74. #endif
  75. return S_OK;
  76. }
  77. CCertTypeAboutImpl::CCertTypeAboutImpl()
  78. {
  79. }
  80. CCertTypeAboutImpl::~CCertTypeAboutImpl()
  81. {
  82. }
  83. HRESULT CCertTypeAboutImpl::AboutHelper(UINT nID, LPOLESTR* lpPtr)
  84. {
  85. if (lpPtr == NULL)
  86. return E_POINTER;
  87. CString s;
  88. // Needed for Loadstring
  89. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  90. s.LoadString(nID);
  91. *lpPtr = reinterpret_cast<LPOLESTR>
  92. (CoTaskMemAlloc((s.GetLength() + 1)* sizeof(wchar_t)));
  93. if (*lpPtr == NULL)
  94. return E_OUTOFMEMORY;
  95. USES_CONVERSION;
  96. wcscpy(*lpPtr, T2OLE((LPTSTR)(LPCTSTR)s));
  97. return S_OK;
  98. }
  99. STDMETHODIMP CCertTypeAboutImpl::GetSnapinDescription(LPOLESTR* lpDescription)
  100. {
  101. return AboutHelper(IDS_CERTTYPE_DESCRIPTION, lpDescription);
  102. }
  103. STDMETHODIMP CCertTypeAboutImpl::GetProvider(LPOLESTR* lpName)
  104. {
  105. return AboutHelper(IDS_COMPANY, lpName);
  106. }
  107. STDMETHODIMP CCertTypeAboutImpl::GetSnapinVersion(LPOLESTR* lpVersion)
  108. {
  109. return AboutHelper(IDS_CERTTYPE_VERSION, lpVersion);
  110. }
  111. STDMETHODIMP CCertTypeAboutImpl::GetSnapinImage(HICON* hAppIcon)
  112. {
  113. if (hAppIcon == NULL)
  114. return E_POINTER;
  115. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  116. // in MMC 1.1, this will be used as root node icon!!
  117. *hAppIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_APPICON));
  118. ASSERT(*hAppIcon != NULL);
  119. return (*hAppIcon != NULL) ? S_OK : E_FAIL;
  120. }
  121. STDMETHODIMP CCertTypeAboutImpl::GetStaticFolderImage(HBITMAP* hSmallImage,
  122. HBITMAP* hSmallImageOpen,
  123. HBITMAP* hLargeImage,
  124. COLORREF* cLargeMask)
  125. {
  126. ASSERT(hSmallImage != NULL);
  127. ASSERT(hSmallImageOpen != NULL);
  128. ASSERT(hLargeImage != NULL);
  129. ASSERT(cLargeMask != NULL);
  130. AFX_MANAGE_STATE(AfxGetStaticModuleState()); // Required for AfxGetInstanceHandle()
  131. HINSTANCE hInstance = AfxGetInstanceHandle();
  132. *hSmallImage = ::LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_FOLDER_SMALL));
  133. *hSmallImageOpen = ::LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_FOLDER_SMALL));
  134. *hLargeImage = ::LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_FOLDER_LARGE));
  135. *cLargeMask = RGB(255, 0, 255);
  136. #ifdef _DEBUG
  137. if (NULL == *hSmallImage || NULL == *hSmallImageOpen || NULL == *hLargeImage)
  138. {
  139. OutputDebugString(L"WRN: CSnapinAbout::GetStaticFolderImage() - Unable to load all the bitmaps.\n");
  140. return E_FAIL;
  141. }
  142. #endif
  143. return S_OK;
  144. }