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.

203 lines
4.3 KiB

  1. /*++
  2. Copyright (c) 2002 Microsoft Corporation
  3. Module Name :
  4. wwwcmpts.cxx
  5. Abstract:
  6. Classes that are used to Install and Uninstall the
  7. WWW IIS Components. These include ASP, IDC, WebDav,
  8. and SSINC
  9. Author:
  10. Christopher Achille (cachille)
  11. Project:
  12. Internet Services Setup
  13. Revision History:
  14. May 2002: Created
  15. --*/
  16. #include "stdafx.h"
  17. #include "wwwcmpts.hxx"
  18. #include "restrlst.hxx"
  19. // GetSmallIcon
  20. //
  21. // Retrieve the small icon for a WWW Extension
  22. //
  23. BOOL
  24. CWWWExtensionInstallComponent::GetSmallIcon( HBITMAP *phIcon )
  25. {
  26. *phIcon = LoadBitmap( (HINSTANCE) g_MyModuleHandle,
  27. MAKEINTRESOURCE( IDB_ICON_WWW_EXTENSION ));
  28. return ( *phIcon != NULL );
  29. }
  30. // GetName
  31. //
  32. // Return the component name for ASP
  33. //
  34. LPTSTR
  35. CWWWExtensionInstallComponent::GetName()
  36. {
  37. // Return name for this component
  38. return g_OurExtensions[ GetComponentIndex() ].szUnattendName;
  39. }
  40. // GetFriendlyName
  41. //
  42. // Get the FriendlyName for the extension component
  43. //
  44. BOOL
  45. CWWWExtensionInstallComponent::GetFriendlyName( TSTR *pstrFriendlyName )
  46. {
  47. return pstrFriendlyName->LoadString( g_OurExtensions[ GetComponentIndex() ].dwProductName );
  48. }
  49. // UpdateEntry
  50. //
  51. // Update the componet to enable or disable it
  52. //
  53. BOOL
  54. CWWWExtensionInstallComponent::UpdateEntry( BOOL bEnable )
  55. {
  56. CRestrictionList RestrictionList;
  57. TSTR_PATH strPhysicalPath;
  58. TSTR strProductName;
  59. if ( !RestrictionList.InitMetabase() ||
  60. !RestrictionList.LoadCurrentSettings() )
  61. {
  62. if ( !bEnable )
  63. {
  64. // If this is uninstall, then we might not be able to load the metabase
  65. // because it has uninstalled, so this is okay
  66. return TRUE;
  67. }
  68. // We failed to load the list, so we could not update it
  69. return FALSE;
  70. }
  71. if ( !strPhysicalPath.Copy( g_pTheApp->m_csPathInetsrv.GetBuffer(0) ) ||
  72. !strPhysicalPath.PathAppend( g_OurExtensions[ GetComponentIndex() ].szFileName ) )
  73. {
  74. // Could not create Path, so exit
  75. return FALSE;
  76. }
  77. if ( !strProductName.LoadString( g_OurExtensions[ GetComponentIndex() ].dwProductName ) )
  78. {
  79. return FALSE;
  80. }
  81. if ( !RestrictionList.UpdateItem(
  82. strPhysicalPath.QueryStr(),
  83. g_OurExtensions[ GetComponentIndex() ].szNotLocalizedGroupName,
  84. strProductName.QueryStr(),
  85. bEnable,
  86. g_OurExtensions[ GetComponentIndex() ].bUIDeletable ) )
  87. {
  88. // Failed to update entry
  89. return FALSE;
  90. }
  91. if ( !RestrictionList.SaveSettings() )
  92. {
  93. // Failed to save settings
  94. return FALSE;
  95. }
  96. return TRUE;
  97. }
  98. // Install
  99. //
  100. // Install the specific componet
  101. //
  102. BOOL
  103. CWWWExtensionInstallComponent::Install()
  104. {
  105. return UpdateEntry( TRUE );
  106. }
  107. // UnInstall
  108. //
  109. // UnInstall the specific componet
  110. //
  111. BOOL
  112. CWWWExtensionInstallComponent::UnInstall()
  113. {
  114. return UpdateEntry( FALSE );
  115. }
  116. BOOL
  117. CWWWExtensionInstallComponent::IsInstalled( LPBOOL pbIsInstalled )
  118. {
  119. CRestrictionList RestrictionList;
  120. if ( !RestrictionList.InitMetabase() ||
  121. !RestrictionList.LoadCurrentSettings() )
  122. {
  123. // We failed to load the list, so we could not update it
  124. return FALSE;
  125. }
  126. return RestrictionList.IsEnabled( g_OurExtensions[ GetComponentIndex() ].szNotLocalizedGroupName,
  127. pbIsInstalled );
  128. }
  129. // GetComponentIndex
  130. //
  131. // Return the component Index for the particular component
  132. // in g_OurExtensions
  133. //
  134. DWORD
  135. CWWWASPInstallComponent::GetComponentIndex()
  136. {
  137. return EXTENSION_ASP;
  138. }
  139. // GetComponentIndex
  140. //
  141. // Return the component Index for the particular component
  142. // in g_OurExtensions
  143. //
  144. DWORD
  145. CWWWIDCInstallComponent::GetComponentIndex()
  146. {
  147. return EXTENSION_HTTPODBC;
  148. }
  149. // GetComponentIndex
  150. //
  151. // Return the component Index for the particular component
  152. // in g_OurExtensions
  153. //
  154. DWORD
  155. CWWWSSIInstallComponent::GetComponentIndex()
  156. {
  157. return EXTENSION_SSINC;
  158. }
  159. // GetComponentIndex
  160. //
  161. // Return the component Index for the particular component
  162. // in g_OurExtensions
  163. //
  164. DWORD
  165. CWWWWebDavInstallComponent::GetComponentIndex()
  166. {
  167. return EXTENSION_WEBDAV;
  168. }