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.

725 lines
21 KiB

  1. //Copyright (c) 1998 - 1999 Microsoft Corporation
  2. //
  3. // SubToggle.cpp
  4. // subcomponent enable terminal server implementation.
  5. //
  6. #include "stdafx.h"
  7. #include "SubToggle.h"
  8. #include "hydraoc.h"
  9. #include "pages.h"
  10. #include "secupgrd.h"
  11. #include "gpedit.h"
  12. // {0F6B957D-509E-11d1-A7CC-0000F87571E3}
  13. DEFINE_GUID(CLSID_PolicySnapInMachine,0xf6b957d, 0x509e, 0x11d1, 0xa7, 0xcc, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3);
  14. // #define REGISTRY_EXTENSION_GUID { 0x35378EAC, 0x683F, 0x11D2, 0xA8, 0x9A, 0x00, 0xC0, 0x4F, 0xBB, 0xCF, 0xA2 }
  15. DEFINE_GUID(CLSID_RegistryEntensionGuid, 0x35378EAC, 0x683F, 0x11D2, 0xA8, 0x9A, 0x00, 0xC0, 0x4F, 0xBB, 0xCF, 0xA2);
  16. GUID guidRegistryEntension = REGISTRY_EXTENSION_GUID;
  17. GUID guidPolicyMachineSnapin = CLSID_PolicySnapInMachine;
  18. //
  19. // Globals
  20. //
  21. extern DefSecPageData *gpSecPageData;
  22. DWORD SubCompToggle::GetStepCount () const
  23. {
  24. return 4;
  25. }
  26. DWORD SubCompToggle::OnQueryState ( UINT uiWhichState ) const
  27. {
  28. DWORD dwReturn = SubcompUseOcManagerDefault;
  29. switch(uiWhichState)
  30. {
  31. case OCSELSTATETYPE_FINAL:
  32. dwReturn = StateObject.IsItAppServer() ? SubcompOn : SubcompOff;
  33. break;
  34. case OCSELSTATETYPE_ORIGINAL:
  35. //
  36. // thought originally the comp was on, we want to unselect it for server sku.
  37. //
  38. if (StateObject.CanInstallAppServer())
  39. {
  40. dwReturn = StateObject.WasItAppServer() ? SubcompOn : SubcompOff;
  41. }
  42. else
  43. {
  44. if (StateObject.WasItAppServer())
  45. {
  46. LogErrorToSetupLog(OcErrLevWarning, IDS_STRING_TERMINAL_SERVER_UNINSTALLED);
  47. }
  48. dwReturn = SubcompOff;
  49. }
  50. break;
  51. case OCSELSTATETYPE_CURRENT:
  52. //
  53. // our state object knows best about the current state for unattended and fresh install cases.
  54. //
  55. if (StateObject.IsTSFreshInstall() || StateObject.IsUnattended())
  56. {
  57. if (StateObject.CurrentTSMode() == eAppServer)
  58. {
  59. dwReturn = SubcompOn;
  60. }
  61. else
  62. {
  63. dwReturn = SubcompOff;
  64. }
  65. }
  66. else
  67. {
  68. dwReturn = SubcompUseOcManagerDefault;
  69. }
  70. break;
  71. default:
  72. AssertFalse();
  73. break;
  74. }
  75. return dwReturn;
  76. }
  77. DWORD SubCompToggle::OnQuerySelStateChange (BOOL bNewState, BOOL bDirectSelection) const
  78. {
  79. if (bNewState)
  80. {
  81. //
  82. // this component is available only for adv server or highter. so dont let it be selected for
  83. // any other sku.
  84. //
  85. return StateObject.CanInstallAppServer();
  86. }
  87. return TRUE;
  88. }
  89. LPCTSTR SubCompToggle::GetSectionToBeProcessed (ESections eSection) const
  90. {
  91. //
  92. // If the state hasn't changed in stand alone setup, don't do anything.
  93. // Note that an permission settings will be handled later.
  94. //
  95. if ((StateObject.CurrentTSMode() == StateObject.OriginalTSMode()) &&
  96. StateObject.IsStandAlone())
  97. {
  98. return(NULL);
  99. }
  100. //
  101. // There are no files to install.
  102. //
  103. if ((eSection == kFileSection) || (eSection == kDiskSpaceAddSection))
  104. {
  105. return(NULL);
  106. }
  107. ETSMode eMode = StateObject.CurrentTSMode();
  108. if (StateObject.IsX86())
  109. {
  110. switch (eMode)
  111. {
  112. case eRemoteAdmin:
  113. return StateObject.IsWorkstation() ? REMOTE_ADMIN_PRO_X86 : REMOTE_ADMIN_SERVER_X86;
  114. break;
  115. case eAppServer:
  116. return StateObject.IsWorkstation() ? APPSERVER_PRO_X86 : APPSERVER_SERVER_X86;
  117. break;
  118. case ePersonalTS:
  119. return StateObject.IsWorkstation() ? PERSONALTS_PRO_X86 : PERSONALTS_SERVER_X86;
  120. break;
  121. case eTSDisabled:
  122. default:
  123. ASSERT(FALSE);
  124. return NULL;
  125. }
  126. }
  127. else
  128. {
  129. switch (eMode)
  130. {
  131. case eRemoteAdmin:
  132. return StateObject.IsWorkstation() ? REMOTE_ADMIN_PRO_IA64 : REMOTE_ADMIN_SERVER_IA64;
  133. break;
  134. case eAppServer:
  135. return StateObject.IsWorkstation() ? APPSERVER_PRO_IA64 : APPSERVER_SERVER_IA64;
  136. break;
  137. case ePersonalTS:
  138. return StateObject.IsWorkstation() ? PERSONALTS_PRO_IA64 : PERSONALTS_SERVER_IA64;
  139. break;
  140. case eTSDisabled:
  141. default:
  142. ASSERT(FALSE);
  143. return NULL;
  144. }
  145. }
  146. }
  147. BOOL SubCompToggle::BeforeCompleteInstall ()
  148. {
  149. if (StateObject.IsItAppServer() != StateObject.WasItAppServer())
  150. {
  151. SetProgressText(StateObject.IsItAppServer() ? IDS_STRING_PROGRESS_ENABLING : IDS_STRING_PROGRESS_DISABLING);
  152. }
  153. return TRUE;
  154. }
  155. LPCTSTR SubCompToggle::GetSubCompID () const
  156. {
  157. return (APPSRV_COMPONENT_NAME);
  158. }
  159. BOOL SubCompToggle::AfterCompleteInstall ()
  160. {
  161. LOGMESSAGE0(_T("Entering AfterCompleteInstall"));
  162. ASSERT(StateObject.Assert());
  163. StateObject.LogState();
  164. WriteLicensingMode();
  165. Tick();
  166. SetPermissionsMode ();
  167. Tick();
  168. //
  169. // this need to be done even if there is no state change, as we want to do this on upgrades as well.
  170. //
  171. if (StateObject.IsStandAlone() && !StateObject.IsAppSrvModeSwitch())
  172. {
  173. //
  174. // nothing has changed. dont bother to do any of the next steps.
  175. //
  176. return TRUE;
  177. }
  178. // UpdateMMDefaults();
  179. ResetWinstationSecurity ();
  180. Tick();
  181. ModifyWallPaperPolicy();
  182. Tick();
  183. ModifyAppPriority();
  184. // this really belongs in subcore, but since we want to it after ResetWinstationSecurity is called we are calling it here.
  185. //
  186. // we have modified winstation security mechanism for whistler.
  187. // Call this routine, which takes care of upgrades as well as clean installs.
  188. //
  189. LOGMESSAGE0(_T("Will Call SetupWorker now."));
  190. DWORD dwError = SetupWorker(StateObject);
  191. LOGMESSAGE0(_T("Done with SetupWorker."));
  192. if (dwError != ERROR_SUCCESS)
  193. {
  194. LOGMESSAGE1(_T("ERROR :SetupWorker failed. ErrorCode = %d"), dwError);
  195. }
  196. if( StateObject.IsGuiModeSetup() )
  197. {
  198. // WARNING : this must be done after SetupWorker()
  199. SetupRunOnce( GetComponentInfHandle(), RUNONCE_SECTION_KEYWORD );
  200. }
  201. //
  202. // We need a reboot if we toggled TS through AR/P.
  203. //
  204. if ( StateObject.IsStandAlone() && StateObject.IsAppSrvModeSwitch())
  205. {
  206. SetReboot();
  207. //
  208. // If we're changing into or out of app-compatibility mode, inform
  209. // the licensing system, because we're about to reboot
  210. //
  211. InformLicensingOfModeChange();
  212. Tick();
  213. }
  214. ASSERT(StateObject.Assert());
  215. StateObject.LogState();
  216. return(TRUE);
  217. }
  218. BOOL SubCompToggle::WriteLicensingMode ()
  219. {
  220. //
  221. // we need to write this value only if it's set in answer file
  222. //
  223. if (StateObject.IsItAppServer() && (StateObject.NewLicMode() != eLicUnset))
  224. {
  225. DWORD dwError;
  226. CRegistry oRegTermsrv;
  227. dwError = oRegTermsrv.OpenKey(HKEY_LOCAL_MACHINE, REG_CONTROL_TS_KEY);
  228. if (ERROR_SUCCESS == dwError)
  229. {
  230. DWORD dwMode = StateObject.NewLicMode();
  231. TCHAR *tszValueName = StateObject.IsItAppServer() ? REG_LICENSING_MODE_AC_ON : REG_LICENSING_MODE_AC_OFF;
  232. LOGMESSAGE2(_T("Writing %s = %d"), tszValueName, dwMode);
  233. dwError = oRegTermsrv.WriteRegDWord(tszValueName, dwMode);
  234. if (ERROR_SUCCESS == dwError)
  235. {
  236. return TRUE;
  237. }
  238. else
  239. {
  240. LOGMESSAGE2(_T("Error (%d), Writing, %s Value"), dwError, tszValueName);
  241. return FALSE;
  242. }
  243. }
  244. else
  245. {
  246. LOGMESSAGE2(_T("Error (%d), Opening , %s key"), dwError, REG_CONTROL_TS_LICENSING_KEY);
  247. return FALSE;
  248. }
  249. }
  250. else
  251. {
  252. return TRUE;
  253. }
  254. }
  255. BOOL SubCompToggle::ApplySection (LPCTSTR szSection)
  256. {
  257. DWORD dwError;
  258. LOGMESSAGE1(_T("Setting up Registry from section = %s"), szSection);
  259. dwError = SetupInstallFromInfSection(
  260. NULL, // hwndOwner
  261. GetComponentInfHandle(), // inf handle
  262. szSection, //
  263. SPINST_REGISTRY, // operation flags
  264. NULL, // relative key root
  265. NULL, // source root path
  266. 0, // copy flags
  267. NULL, // callback routine
  268. NULL, // callback routine context
  269. NULL, // device info set
  270. NULL // device info struct
  271. );
  272. if (dwError == 0)
  273. {
  274. LOGMESSAGE1(_T("ERROR:while installating section <%lu>"), GetLastError());
  275. }
  276. return (dwError != 0);
  277. }
  278. BOOL SubCompToggle::ResetWinstationSecurity ()
  279. {
  280. //
  281. // If the TS mode is changing, reset winstation securities.
  282. //
  283. DWORD dwError;
  284. if (StateObject.IsAppSrvModeSwitch() && gpSecPageData->GetWinStationCount() > 0)
  285. {
  286. CRegistry pReg;
  287. CRegistry pSubKey;
  288. LPTSTR* pWinStationArray = gpSecPageData->GetWinStationArray();
  289. UINT cArray = gpSecPageData->GetWinStationCount();
  290. LOGMESSAGE1(_T("%d WinStations to reset."), cArray);
  291. //
  292. // Open the WinStations key. At this point, this key must exist.
  293. //
  294. VERIFY(pReg.OpenKey(HKEY_LOCAL_MACHINE, REG_WINSTATION_KEY) == ERROR_SUCCESS);
  295. if (cArray != 0)
  296. {
  297. ASSERT(pWinStationArray != NULL);
  298. for (UINT i = 0; i < cArray; i++)
  299. {
  300. LOGMESSAGE1(_T("Resetting %s."), pWinStationArray[i]);
  301. dwError = pSubKey.OpenKey(pReg, pWinStationArray[i]);
  302. if (dwError == ERROR_SUCCESS)
  303. {
  304. LOGMESSAGE2(_T("Delete registry value %s\\%s"), pWinStationArray[i], REG_SECURITY_VALUE);
  305. dwError = pSubKey.DeleteValue(REG_SECURITY_VALUE);
  306. if (dwError == ERROR_SUCCESS)
  307. {
  308. LOGMESSAGE0(_T("Registry value deleted."));
  309. }
  310. else
  311. {
  312. LOGMESSAGE1(_T("Error deleting value: %ld"), dwError);
  313. }
  314. }
  315. else
  316. {
  317. LOGMESSAGE2(_T("Couldn't open key %s: %ld"), pWinStationArray[i], dwError);
  318. }
  319. }
  320. }
  321. }
  322. return TRUE;
  323. }
  324. BOOL SubCompToggle::InformLicensingOfModeChange ()
  325. {
  326. BOOL fRet;
  327. ASSERT(StateObject.IsTSModeChanging());
  328. //
  329. // RPC into licensing to tell it we're going to reboot
  330. //
  331. HANDLE hServer = ServerLicensingOpen(NULL);
  332. if (NULL == hServer)
  333. {
  334. LOGMESSAGE1(_T("ERROR: InformLicensingOfModeChange calling ServerLicensingOpen <%lu>"), GetLastError());
  335. return FALSE;
  336. }
  337. fRet = ServerLicensingDeactivateCurrentPolicy(
  338. hServer
  339. );
  340. if (!fRet)
  341. {
  342. LOGMESSAGE1(_T("ERROR: InformLicensingOfModeChange calling ServerLicensingDeactivateCurrentPolicy <%lu>"), GetLastError());
  343. }
  344. ServerLicensingClose(hServer);
  345. return fRet;
  346. }
  347. BOOL SubCompToggle::SetPermissionsMode ()
  348. {
  349. //
  350. // If TS is toggling on, set the security key based on the choices
  351. // made through the wizard page. This must be done even if TS was
  352. // already enabled, as the permissions mode can be changed by the
  353. // unattended file.
  354. //
  355. CRegistry reg;
  356. EPermMode ePermMode = StateObject.CurrentPermMode();
  357. VERIFY(reg.OpenKey(HKEY_LOCAL_MACHINE, REG_CONTROL_TS_KEY) == ERROR_SUCCESS);
  358. // BUGBUG should be
  359. // return (ERROR_SUCCESS == reg.WriteRegDWord( _T("TSUserEnabled"), StateObject.IsItAppServer() ? (DWORD)ePermMode : (DWORD)PERM_WIN2K));
  360. return (ERROR_SUCCESS == reg.WriteRegDWord( _T("TSUserEnabled"), StateObject.IsTSEnableSelected() ? (DWORD)ePermMode : (DWORD)PERM_TS4));
  361. }
  362. BOOL RegisterDll(LPCTSTR szDll)
  363. {
  364. USES_CONVERSION;
  365. HMODULE hMod = LoadLibrary(szDll);
  366. HRESULT hResult = E_FAIL;
  367. if (hMod)
  368. {
  369. FARPROC pfRegSrv = GetProcAddress(hMod, "DllRegisterServer");
  370. if (pfRegSrv)
  371. {
  372. __try
  373. {
  374. hResult = (HRESULT)pfRegSrv();
  375. if (hResult != S_OK)
  376. {
  377. LOGMESSAGE2(_T("ERROR, DllRegister Server in %s failed, hResult = %x"), szDll, hResult);
  378. }
  379. }
  380. __except( 1 )
  381. {
  382. hResult = E_FAIL;
  383. LOGMESSAGE2(_T("ERROR, Exception hit Registrering of %s failed, Exception = %x"), szDll, GetExceptionCode());
  384. }
  385. }
  386. else
  387. {
  388. LOGMESSAGE1(_T("ERROR, Failed to Get proc for DllregisterServer for %s"), szDll);
  389. }
  390. FreeLibrary(hMod);
  391. }
  392. else
  393. {
  394. LOGMESSAGE2(_T("ERROR, Failed to Load library %s, lastError = %d"), szDll, GetLastError());
  395. }
  396. return hResult == S_OK;
  397. }
  398. BOOL SubCompToggle::ModifyWallPaperPolicy ()
  399. {
  400. USES_CONVERSION;
  401. BOOL bRet = FALSE;
  402. //
  403. // policy must be applied when we change modes.
  404. // also for fresh installs/upgrades of app server.
  405. //
  406. if (StateObject.IsAppSrvModeSwitch() || (StateObject.IsGuiModeSetup() && StateObject.IsItAppServer()))
  407. {
  408. LOGMESSAGE0(_T("Will apply/change policies now..."));
  409. if (StateObject.IsGuiModeSetup())
  410. {
  411. //
  412. // in case of Gui mode setup
  413. // the group policy object may not be registered yet.
  414. // so lets register it ourselves.
  415. //
  416. TCHAR szGPEditFile[MAX_PATH];
  417. GetSystemDirectory(szGPEditFile, MAX_PATH);
  418. _tcscat(szGPEditFile, _T("\\gpedit.dll"));
  419. if (!RegisterDll(szGPEditFile))
  420. {
  421. LOGMESSAGE1(_T("Error, failed to register dll - %s."), szGPEditFile);
  422. }
  423. }
  424. OleInitialize(NULL);
  425. IGroupPolicyObject *pIGroupPolicyObject = NULL;
  426. HRESULT hResult = CoCreateInstance(
  427. CLSID_GroupPolicyObject, //Class identifier (CLSID) of the object
  428. NULL, //Pointer to controlling IUnknown
  429. CLSCTX_ALL, //Context for running executable code
  430. IID_IGroupPolicyObject, //Reference to the identifier of the interface
  431. (void **)&pIGroupPolicyObject //Address of output variable that receives the interface pointer requested in riid
  432. );
  433. if (SUCCEEDED(hResult))
  434. {
  435. ASSERT(pIGroupPolicyObject);
  436. hResult = pIGroupPolicyObject->OpenLocalMachineGPO(GPO_OPEN_LOAD_REGISTRY);
  437. if (SUCCEEDED(hResult))
  438. {
  439. HKEY hMachinePolicyKey = NULL;
  440. hResult = pIGroupPolicyObject->GetRegistryKey(GPO_SECTION_MACHINE, &hMachinePolicyKey);
  441. if (SUCCEEDED(hResult))
  442. {
  443. ASSERT(hMachinePolicyKey);
  444. const LPCTSTR szNoActiveDesktop_key = _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer");
  445. const LPCTSTR szNoActiveDesktop_val = _T("NoActiveDesktop");
  446. const DWORD szNoActiveDesktop_dat = 1;
  447. const LPCTSTR szNoFileAssoc_key = _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer");
  448. const LPCTSTR szNoFileAssoc_val = _T("NoFileAssociate");
  449. const DWORD szNoFileAssoc_dat = 1;
  450. CRegistry regMachinePolicy;
  451. if (ERROR_SUCCESS == regMachinePolicy.CreateKey(hMachinePolicyKey, szNoActiveDesktop_key))
  452. {
  453. if (StateObject.IsItAppServer())
  454. {
  455. if (ERROR_SUCCESS != regMachinePolicy.WriteRegDWord(szNoActiveDesktop_val, szNoActiveDesktop_dat))
  456. {
  457. LOGMESSAGE1(_T("ERROR, Failed to Write %s policy"), szNoActiveDesktop_val);
  458. }
  459. }
  460. else
  461. {
  462. if (ERROR_SUCCESS != regMachinePolicy.DeleteValue(szNoActiveDesktop_val))
  463. {
  464. LOGMESSAGE1(_T("Failed to delete %s policy"), szNoActiveDesktop_val);
  465. }
  466. }
  467. }
  468. if (ERROR_SUCCESS == regMachinePolicy.CreateKey(hMachinePolicyKey, szNoFileAssoc_key))
  469. {
  470. if (StateObject.IsItAppServer())
  471. {
  472. if (ERROR_SUCCESS != regMachinePolicy.WriteRegDWord(szNoFileAssoc_val, szNoFileAssoc_dat))
  473. {
  474. LOGMESSAGE1(_T("ERROR, Failed to Write %s policy"), szNoFileAssoc_val);
  475. }
  476. }
  477. else
  478. {
  479. if (ERROR_SUCCESS != regMachinePolicy.DeleteValue(szNoFileAssoc_val))
  480. {
  481. LOGMESSAGE1(_T("Failed to delete %s policy"), szNoFileAssoc_val);
  482. }
  483. }
  484. }
  485. pIGroupPolicyObject->Save(TRUE, TRUE, &guidRegistryEntension, &guidPolicyMachineSnapin);
  486. RegCloseKey(hMachinePolicyKey);
  487. bRet = TRUE;
  488. }
  489. else
  490. {
  491. LOGMESSAGE1(_T("ERROR, Failed to GetRegistryKey...hResult = %x"), hResult);
  492. }
  493. }
  494. else
  495. {
  496. LOGMESSAGE1(_T("ERROR, Failed to OpenLocalMachineGPO...hResult = %x"), hResult);
  497. }
  498. pIGroupPolicyObject->Release();
  499. }
  500. else
  501. {
  502. LOGMESSAGE1(_T("ERROR, Failed to get the interface IID_IGroupPolicyObject...hResult = %x"), hResult);
  503. }
  504. LOGMESSAGE0(_T("Done with Policy changes!"));
  505. }
  506. return bRet;
  507. }
  508. BOOL SubCompToggle::ModifyAppPriority()
  509. {
  510. if (StateObject.IsAppSrvModeSwitch())
  511. {
  512. DWORD dwSrvPrioity = StateObject.IsItAppServer() ? 0x26 : 0x18;
  513. LPCTSTR PRIORITY_KEY = _T("SYSTEM\\CurrentControlSet\\Control\\PriorityControl");
  514. CRegistry oReg;
  515. if (ERROR_SUCCESS == oReg.OpenKey(HKEY_LOCAL_MACHINE, PRIORITY_KEY))
  516. {
  517. if (ERROR_SUCCESS != oReg.WriteRegDWord(_T("Win32PrioritySeparation"), dwSrvPrioity))
  518. {
  519. LOGMESSAGE0(_T("Error, Failed to update Win32PrioritySeparation"));
  520. return FALSE;
  521. }
  522. return TRUE;
  523. }
  524. else
  525. {
  526. LOGMESSAGE1(_T("Errror, Failed to open %s key"), PRIORITY_KEY);
  527. return FALSE;
  528. }
  529. }
  530. return TRUE;
  531. }
  532. /*
  533. BOOL SubCompToggle::UpdateMMDefaults ()
  534. {
  535. LPCTSTR MM_REG_KEY = _T("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management");
  536. LPCTSTR SESSION_VIEW_SIZE_VALUE = _T("SessionViewSize");
  537. LPCTSTR SESSION_POOL_SIZE_VALUE = _T("SessionPoolSize");
  538. const DWORD dwViewSizeforPTS = 48;
  539. const DWORD dwPoolSizeforPTS = 4;
  540. const DWORD dwPoolSizeforRA = 48;
  541. // const DWORD dwPoolSizeforAS = 16;
  542. ASSERT(StateObject.IsTSEnableSelected());
  543. if (!StateObject.IsX86())
  544. {
  545. // these setting apply only for x86
  546. return TRUE;
  547. }
  548. CRegistry regMM;
  549. if (ERROR_SUCCESS != regMM.OpenKey(HKEY_LOCAL_MACHINE, MM_REG_KEY))
  550. {
  551. LOGMESSAGE0(_T("ERROR, Failed to open mm Key"));
  552. return FALSE;
  553. }
  554. if (StateObject.IsWorkstation())
  555. {
  556. if ((ERROR_SUCCESS != regMM.WriteRegDWord(SESSION_VIEW_SIZE_VALUE, dwViewSizeforPTS)) ||
  557. (ERROR_SUCCESS != regMM.WriteRegDWord(SESSION_POOL_SIZE_VALUE, dwPoolSizeforPTS)))
  558. {
  559. LOGMESSAGE0(_T("ERROR, Failed to write MM Defaults for PTS"));
  560. return FALSE;
  561. }
  562. else
  563. {
  564. LOGMESSAGE0(_T("Wrote MM Defaults for PTS"));
  565. }
  566. }
  567. else
  568. {
  569. if (StateObject.IsItAppServer())
  570. {
  571. // for app server mode, mm sets the right defaults.
  572. // so just delete these value.
  573. regMM.DeleteValue(SESSION_VIEW_SIZE_VALUE);
  574. regMM.DeleteValue(SESSION_POOL_SIZE_VALUE);
  575. LOGMESSAGE0(_T("deleted MM defaults for AS"));
  576. }
  577. else
  578. {
  579. if (ERROR_SUCCESS != regMM.WriteRegDWord(SESSION_POOL_SIZE_VALUE, dwPoolSizeforRA))
  580. {
  581. LOGMESSAGE0(_T("ERROR, Failed to write MM Defaults for RA"));
  582. return FALSE;
  583. }
  584. else
  585. {
  586. LOGMESSAGE0(_T("Wrote MM Defaults for RA"));
  587. }
  588. }
  589. }
  590. return TRUE;
  591. }
  592. */