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.

1359 lines
31 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. w9xtool.c
  5. Abstract:
  6. Implements a stub tool that is designed to run with Win9x-side
  7. upgrade code.
  8. Author:
  9. <full name> (<alias>) <date>
  10. Revision History:
  11. <alias> <date> <comments>
  12. --*/
  13. #include "pch.h"
  14. #include "shellapi.h"
  15. typedef enum {
  16. HW_INCOMPATIBLE,
  17. HW_REINSTALL,
  18. HW_UNSUPPORTED
  19. } HWTYPES;
  20. #define REPORTLEVEL_NONE 0
  21. #define REPORTLEVEL_BLOCKING 1
  22. #define REPORTLEVEL_ERROR 2
  23. #define REPORTLEVEL_WARNING 3
  24. #define REPORTLEVEL_INFORMATION 4
  25. #define REPORTLEVEL_VERBOSE 5
  26. BOOL
  27. SaveReport (
  28. IN HWND Parent, OPTIONAL
  29. IN PCTSTR Path OPTIONAL
  30. );
  31. BOOL
  32. InitCompatTable (
  33. VOID
  34. );
  35. VOID
  36. pExcludeDrive (
  37. IN PTSTR Drive,
  38. IN DWORD MsgId OPTIONAL
  39. );
  40. VOID
  41. pAddIncompatibilityAlert (
  42. DWORD MessageId,
  43. PCTSTR Share,
  44. PCTSTR Path
  45. );
  46. VOID
  47. MsgSettingsIncomplete (
  48. IN PCTSTR UserDatPath,
  49. IN PCTSTR UserName, OPTIONAL
  50. IN BOOL CompletelyBusted
  51. );
  52. BOOL
  53. Init (
  54. VOID
  55. )
  56. {
  57. HINSTANCE hInstance;
  58. hInstance = GetModuleHandle (NULL);
  59. return InitToolMode (hInstance);
  60. }
  61. VOID
  62. Terminate (
  63. VOID
  64. )
  65. {
  66. HINSTANCE hInstance;
  67. hInstance = GetModuleHandle (NULL);
  68. TerminateToolMode (hInstance);
  69. }
  70. VOID RegisterTextViewer (VOID);
  71. WNDPROC g_Proc;
  72. LRESULT
  73. pWrapperProc (
  74. IN HWND Hwnd,
  75. IN UINT Msg,
  76. IN WPARAM wParam,
  77. IN LPARAM lParam
  78. )
  79. {
  80. if (Msg == WM_CLOSE) {
  81. PostQuitMessage (0);
  82. }
  83. return g_Proc (Hwnd, Msg, wParam, lParam);
  84. }
  85. VOID
  86. pAddChangedUserName (
  87. PCTSTR DisplayGroupName,
  88. PCTSTR OriginalName,
  89. PCTSTR NewName
  90. )
  91. {
  92. PCTSTR argArray[3];
  93. PCTSTR blank;
  94. PCTSTR rootGroup;
  95. PCTSTR nameSubGroup;
  96. PCTSTR baseGroup;
  97. PCTSTR fullGroupName;
  98. TCHAR encodedName[256];
  99. argArray[0] = DisplayGroupName;
  100. argArray[1] = OriginalName;
  101. argArray[2] = NewName;
  102. blank = GetStringResource (MSG_BLANK_NAME);
  103. if (argArray[1][0] == 0) {
  104. argArray[1] = blank;
  105. }
  106. if (argArray[2][0] == 0) {
  107. argArray[2] = blank;
  108. }
  109. rootGroup = GetStringResource (MSG_INSTALL_NOTES_ROOT);
  110. nameSubGroup = ParseMessageID (MSG_NAMECHANGE_WARNING_GROUP, argArray);
  111. baseGroup = JoinPaths (rootGroup, nameSubGroup);
  112. FreeStringResource (rootGroup);
  113. FreeStringResource (nameSubGroup);
  114. nameSubGroup = ParseMessageID (MSG_NAMECHANGE_WARNING_SUBCOMPONENT, argArray);
  115. fullGroupName = JoinPaths (baseGroup, nameSubGroup);
  116. FreePathString (baseGroup);
  117. FreeStringResource (nameSubGroup);
  118. encodedName[0] = TEXT('|');
  119. StringCopy (encodedName + 1, OriginalName);
  120. MsgMgr_ObjectMsg_Add(
  121. encodedName, // Object name, prefixed with a pipe symbol
  122. fullGroupName, // Message title
  123. S_EMPTY // Message text
  124. );
  125. FreePathString (fullGroupName);
  126. FreeStringResource (blank);
  127. }
  128. VOID
  129. pAddDevice (
  130. PCTSTR RegistryKey,
  131. HWTYPES SupportedType,
  132. PCTSTR DeviceDesc,
  133. BOOL Online,
  134. PCTSTR Class,
  135. PCTSTR Mfg,
  136. PCTSTR HardwareID,
  137. PCTSTR FriendlyClass
  138. )
  139. {
  140. PCTSTR argArray[6];
  141. PCTSTR classAndName;
  142. PCTSTR group;
  143. UINT subGroup;
  144. PCTSTR message;
  145. BOOL unknownClass = FALSE;
  146. PCTSTR modifiedDescription = NULL;
  147. if (!Class) {
  148. Class = GetStringResource (MSG_UNKNOWN_DEVICE_CLASS);
  149. unknownClass = TRUE;
  150. }
  151. if (!Online) {
  152. argArray[0] = DeviceDesc;
  153. modifiedDescription = ParseMessageID (MSG_OFFLINE_DEVICE, argArray);
  154. }
  155. if (SupportedType == HW_INCOMPATIBLE) {
  156. subGroup = MSG_INCOMPATIBLE_HARDWARE_PNP_SUBGROUP;
  157. } else if (SupportedType == HW_REINSTALL) {
  158. subGroup = MSG_REINSTALL_HARDWARE_PNP_SUBGROUP;
  159. } else {
  160. subGroup = MSG_UNSUPPORTED_HARDWARE_PNP_SUBGROUP;
  161. }
  162. argArray[0] = modifiedDescription ? modifiedDescription : DeviceDesc;
  163. argArray[1] = S_EMPTY; // formerly Enumerator Text
  164. argArray[2] = Class;
  165. argArray[3] = Mfg;
  166. argArray[4] = HardwareID;
  167. argArray[5] = FriendlyClass;
  168. classAndName = JoinPaths (argArray[5], argArray[0]);
  169. group = BuildMessageGroup (
  170. MSG_INCOMPATIBLE_HARDWARE_ROOT,
  171. subGroup,
  172. classAndName
  173. );
  174. FreePathString (classAndName);
  175. message = ParseMessageID (MSG_HARDWARE_MESSAGE, argArray);
  176. MsgMgr_ObjectMsg_Add (RegistryKey, group, message);
  177. FreeStringResource (modifiedDescription);
  178. FreeText (group);
  179. FreeStringResource (message);
  180. if (unknownClass) {
  181. FreeStringResource (Class);
  182. }
  183. }
  184. VOID
  185. pBadOsVersion (
  186. VOID
  187. )
  188. {
  189. PCTSTR group = NULL;
  190. PCTSTR message = NULL;
  191. //
  192. // Add a message to the Incompatibility Report.
  193. //
  194. group = BuildMessageGroup (MSG_BLOCKING_ITEMS_ROOT, MSG_UNKNOWN_OS_WARNING_SUBGROUP, NULL);
  195. message = GetStringResource (MSG_UNKNOWN_OS);
  196. MsgMgr_ObjectMsg_Add (TEXT("*UnknownOs"), group, message);
  197. FreeText (group);
  198. FreeStringResource (message);
  199. }
  200. VOID
  201. pBlockingFile (
  202. PCTSTR FileName,
  203. PCTSTR SectNameForDisplay,
  204. PCTSTR Message
  205. )
  206. {
  207. PCTSTR group;
  208. group = BuildMessageGroup (MSG_BLOCKING_ITEMS_ROOT, MSG_MUST_UNINSTALL_ROOT, SectNameForDisplay);
  209. MsgMgr_ObjectMsg_Add (FileName, group, Message);
  210. FreeText (group);
  211. }
  212. VOID
  213. pBlockingHardware (
  214. PCTSTR FileName,
  215. PCTSTR SectNameForDisplay,
  216. PCTSTR Message
  217. )
  218. {
  219. PCTSTR group;
  220. group = BuildMessageGroup (MSG_BLOCKING_ITEMS_ROOT, MSG_BLOCKING_HARDWARE_SUBGROUP, SectNameForDisplay);
  221. MsgMgr_ObjectMsg_Add (FileName, group, Message);
  222. FreeText (group);
  223. }
  224. VOID
  225. pBackupDirs (
  226. PCTSTR DirPath
  227. )
  228. {
  229. PCTSTR backupDirsGroup;
  230. backupDirsGroup = BuildMessageGroup (
  231. MSG_INSTALL_NOTES_ROOT,
  232. MSG_BACKUP_DETECTED_LIST_SUBGROUP,
  233. DirPath
  234. );
  235. MsgMgr_ObjectMsg_Add(
  236. DirPath,
  237. backupDirsGroup,
  238. S_EMPTY
  239. );
  240. FreeText (backupDirsGroup);
  241. }
  242. VOID
  243. pManyBackupDirs (
  244. UINT DirCount
  245. )
  246. {
  247. PCTSTR backupDirsGroup;
  248. PCTSTR argArray[2];
  249. TCHAR buffer[32];
  250. PCTSTR msg;
  251. backupDirsGroup = BuildMessageGroup (
  252. MSG_INSTALL_NOTES_ROOT,
  253. MSG_BACKUP_DETECTED_SUBGROUP,
  254. NULL
  255. );
  256. argArray[0] = "Windows 9X";
  257. wsprintf (buffer, "%lu", DirCount);
  258. argArray[1] = buffer;
  259. msg = ParseMessageID (MSG_BACKUP_DETECTED, argArray);
  260. MsgMgr_ObjectMsg_Add (
  261. TEXT("*BackupDetected"),
  262. backupDirsGroup,
  263. msg
  264. );
  265. FreeStringResource (msg);
  266. }
  267. VOID
  268. pHlpFile (
  269. PCTSTR ModuleName,
  270. PCTSTR HlpName,
  271. PCTSTR FriendlyName,
  272. PCTSTR Text
  273. )
  274. {
  275. PCTSTR argList[3];
  276. PCTSTR comp;
  277. argList[0] = ModuleName;
  278. argList[1] = HlpName;
  279. argList[2] = FriendlyName;
  280. comp = BuildMessageGroup (MSG_MINOR_PROBLEM_ROOT, MSG_HELPFILES_SUBGROUP, argList[2]);
  281. MsgMgr_ObjectMsg_Add (HlpName, comp, Text);
  282. FreeText (comp);
  283. }
  284. VOID
  285. pProfileDir (
  286. PCTSTR DirPath,
  287. PCTSTR NewName
  288. )
  289. {
  290. PCTSTR argArray[3];
  291. PCTSTR message;
  292. PCTSTR group;
  293. argArray[0] = DirPath;
  294. argArray[1] = NewName;
  295. message = ParseMessageID (MSG_DIRECTORY_COLLISION_SUBCOMPONENT, argArray);
  296. group = BuildMessageGroup (
  297. MSG_INSTALL_NOTES_ROOT,
  298. MSG_DIRECTORY_COLLISION_SUBGROUP,
  299. message
  300. );
  301. MsgMgr_ObjectMsg_Add (TEXT("*RenameFolders"), group, S_EMPTY);
  302. FreeText (group);
  303. FreeStringResource (message);
  304. }
  305. VOID
  306. pBadShell (
  307. VOID
  308. )
  309. {
  310. PCTSTR object;
  311. PCTSTR message;
  312. object = BuildMessageGroup (MSG_INSTALL_NOTES_ROOT, MSG_REPORT_SHELL_SUBGROUP, NULL);
  313. message = GetStringResource (MSG_REPORT_SHELL_INCOMPATIBLE);
  314. MsgMgr_ObjectMsg_Add (TEXT("*BadShell"), object, message);
  315. FreeText (object);
  316. FreeStringResource (message);
  317. }
  318. VOID
  319. pBadScr (
  320. PCTSTR FilePath,
  321. PCTSTR SectLocalizedName, OPTIONAL
  322. WORD ActType,
  323. PCTSTR Message OPTIONAL
  324. )
  325. {
  326. PTSTR friendlyName = NULL;
  327. PTSTR extPtr = NULL;
  328. PTSTR displayName = NULL;
  329. PCTSTR reportEntry = NULL;
  330. PTSTR component = NULL;
  331. PCTSTR temp1, temp2;
  332. BOOL reportEntryIsResource = TRUE;
  333. if (SectLocalizedName) {
  334. friendlyName = DuplicatePathString (SectLocalizedName, 0);
  335. } else {
  336. friendlyName = DuplicatePathString (GetFileNameFromPath (FilePath), 0);
  337. extPtr = (PTSTR) GetFileExtensionFromPath (friendlyName);
  338. if (extPtr != NULL) {
  339. extPtr = _tcsdec (friendlyName, extPtr);
  340. if (extPtr != NULL) {
  341. *extPtr = 0;
  342. }
  343. }
  344. displayName = (PTSTR)ParseMessageID (MSG_NICE_PATH_SCREEN_SAVER, &friendlyName);
  345. FreePathString (friendlyName);
  346. friendlyName = NULL;
  347. }
  348. switch (ActType) {
  349. case ACT_REINSTALL:
  350. temp1 = GetStringResource (MSG_REINSTALL_ROOT);
  351. temp2 = GetStringResource (Message ? MSG_REINSTALL_DETAIL_SUBGROUP : MSG_REINSTALL_LIST_SUBGROUP);
  352. reportEntry = JoinPaths (temp1, temp2);
  353. reportEntryIsResource = FALSE;
  354. FreeStringResource (temp1);
  355. FreeStringResource (temp2);
  356. break;
  357. case ACT_REINSTALL_BLOCK:
  358. temp1 = GetStringResource (MSG_BLOCKING_ITEMS_ROOT);
  359. temp2 = GetStringResource (MSG_REINSTALL_BLOCK_ROOT);
  360. reportEntry = JoinPaths (temp1, temp2);
  361. reportEntryIsResource = FALSE;
  362. FreeStringResource (temp1);
  363. FreeStringResource (temp2);
  364. break;
  365. case ACT_MINORPROBLEMS:
  366. reportEntry = GetStringResource (MSG_MINOR_PROBLEM_ROOT);
  367. break;
  368. case ACT_INCOMPATIBLE:
  369. case ACT_INC_NOBADAPPS:
  370. temp1 = GetStringResource (MSG_INCOMPATIBLE_ROOT);
  371. temp2 = GetStringResource (Message ? MSG_INCOMPATIBLE_DETAIL_SUBGROUP : MSG_TOTALLY_INCOMPATIBLE_SUBGROUP);
  372. reportEntry = JoinPaths (temp1, temp2);
  373. reportEntryIsResource = FALSE;
  374. FreeStringResource (temp1);
  375. FreeStringResource (temp2);
  376. break;
  377. }
  378. component = JoinPaths (reportEntry, displayName?displayName:friendlyName);
  379. MsgMgr_ObjectMsg_Add (FilePath, component, Message);
  380. FreePathString (component);
  381. if (reportEntryIsResource) {
  382. FreeStringResource (reportEntry);
  383. } else {
  384. FreePathString (reportEntry);
  385. }
  386. if (displayName) {
  387. FreeStringResourcePtrA (&displayName);
  388. }
  389. FreePathString (friendlyName);
  390. }
  391. VOID
  392. pBadCpl (
  393. PCTSTR FilePath,
  394. PCTSTR FriendlyNameMultiSz,
  395. PCTSTR SectLocalizedName, OPTIONAL
  396. WORD ActType,
  397. PCTSTR Message OPTIONAL
  398. )
  399. {
  400. GROWBUFFER friendlyName = GROWBUF_INIT;
  401. MULTISZ_ENUM namesEnum;
  402. PTSTR displayName = NULL;
  403. PCTSTR reportEntry = NULL;
  404. PTSTR component = NULL;
  405. BOOL reportEntryIsResource = TRUE;
  406. BOOL padName = FALSE;
  407. PCTSTR temp1, temp2;
  408. if (SectLocalizedName) {
  409. MultiSzAppend (&friendlyName, SectLocalizedName);
  410. }
  411. if (friendlyName.Buf == NULL) {
  412. while (*FriendlyNameMultiSz) {
  413. MultiSzAppend (&friendlyName, FriendlyNameMultiSz);
  414. FriendlyNameMultiSz = GetEndOfString (FriendlyNameMultiSz) + 1;
  415. }
  416. padName = TRUE;
  417. }
  418. if (EnumFirstMultiSz (&namesEnum, friendlyName.Buf)) {
  419. do {
  420. if (padName) {
  421. displayName = (PTSTR)ParseMessageID (MSG_NICE_PATH_CONTROL_PANEL, &namesEnum.CurrentString);
  422. } else {
  423. displayName = DuplicatePathString (namesEnum.CurrentString, 0);
  424. }
  425. switch (ActType) {
  426. case ACT_MINORPROBLEMS:
  427. reportEntry = GetStringResource (MSG_MINOR_PROBLEM_ROOT);
  428. break;
  429. case ACT_INCOMPATIBLE:
  430. case ACT_INC_NOBADAPPS:
  431. case ACT_INC_IHVUTIL:
  432. case ACT_INC_PREINSTUTIL:
  433. case ACT_INC_SIMILAROSFUNC:
  434. temp1 = GetStringResource (MSG_INCOMPATIBLE_ROOT);
  435. if (!temp1) {
  436. break;
  437. }
  438. switch (ActType) {
  439. case ACT_INC_SIMILAROSFUNC:
  440. temp2 = GetStringResource (MSG_INCOMPATIBLE_UTIL_SIMILAR_FEATURE_SUBGROUP);
  441. break;
  442. case ACT_INC_PREINSTUTIL:
  443. temp2 = GetStringResource (MSG_INCOMPATIBLE_PREINSTALLED_UTIL_SUBGROUP);
  444. break;
  445. case ACT_INC_IHVUTIL:
  446. temp2 = GetStringResource (MSG_INCOMPATIBLE_HW_UTIL_SUBGROUP);
  447. break;
  448. default:
  449. temp2 = GetStringResource (Message ? MSG_INCOMPATIBLE_DETAIL_SUBGROUP : MSG_TOTALLY_INCOMPATIBLE_SUBGROUP);
  450. break;
  451. }
  452. if (!temp2) {
  453. break;
  454. }
  455. reportEntry = JoinPaths (temp1, temp2);
  456. reportEntryIsResource = FALSE;
  457. FreeStringResource (temp1);
  458. FreeStringResource (temp2);
  459. break;
  460. case ACT_INC_SAFETY:
  461. temp1 = GetStringResource (MSG_INCOMPATIBLE_ROOT);
  462. if (!temp1) {
  463. break;
  464. }
  465. temp2 = GetStringResource (MSG_REMOVED_FOR_SAFETY_SUBGROUP);
  466. if (!temp2) {
  467. break;
  468. }
  469. reportEntry = JoinPaths (temp1, temp2);
  470. reportEntryIsResource = FALSE;
  471. FreeStringResource (temp1);
  472. FreeStringResource (temp2);
  473. break;
  474. case ACT_REINSTALL:
  475. temp1 = GetStringResource (MSG_REINSTALL_ROOT);
  476. if (!temp1) {
  477. break;
  478. }
  479. temp2 = GetStringResource (Message ? MSG_REINSTALL_DETAIL_SUBGROUP : MSG_REINSTALL_LIST_SUBGROUP);
  480. if (!temp2) {
  481. break;
  482. }
  483. reportEntry = JoinPaths (temp1, temp2);
  484. reportEntryIsResource = FALSE;
  485. FreeStringResource (temp1);
  486. FreeStringResource (temp2);
  487. break;
  488. case ACT_REINSTALL_BLOCK:
  489. temp1 = GetStringResource (MSG_BLOCKING_ITEMS_ROOT);
  490. if (!temp1) {
  491. break;
  492. }
  493. temp2 = GetStringResource (MSG_REINSTALL_BLOCK_ROOT);
  494. if (!temp2) {
  495. break;
  496. }
  497. reportEntry = JoinPaths (temp1, temp2);
  498. reportEntryIsResource = FALSE;
  499. FreeStringResource (temp1);
  500. FreeStringResource (temp2);
  501. break;
  502. }
  503. component = JoinPaths (reportEntry, displayName);
  504. MsgMgr_ObjectMsg_Add (FilePath, component, Message);
  505. FreePathString (component);
  506. if (reportEntryIsResource) {
  507. FreeStringResource (reportEntry);
  508. } else {
  509. FreePathString (reportEntry);
  510. reportEntryIsResource = TRUE;
  511. }
  512. if (padName) {
  513. FreeStringResourcePtrA (&displayName);
  514. } else {
  515. FreePathString (displayName);
  516. }
  517. } while (EnumNextMultiSz (&namesEnum));
  518. }
  519. FreeGrowBuffer (&friendlyName);
  520. }
  521. VOID
  522. pShowPacks (
  523. PCTSTR UpgradePackName
  524. )
  525. {
  526. PCTSTR group;
  527. group = BuildMessageGroup (
  528. MSG_INSTALL_NOTES_ROOT,
  529. MSG_RUNNING_MIGRATION_DLLS_SUBGROUP,
  530. UpgradePackName
  531. );
  532. MsgMgr_ObjectMsg_Add (
  533. UpgradePackName,
  534. group,
  535. S_EMPTY
  536. );
  537. }
  538. VOID
  539. pOutOfDiskSpace (
  540. VOID
  541. )
  542. {
  543. PCTSTR group;
  544. PCTSTR args[5];
  545. PCTSTR msg;
  546. args[0] = TEXT("C:\\");
  547. args[1] = TEXT("300");
  548. args[2] = TEXT("220");
  549. args[3] = TEXT("120");
  550. args[4] = TEXT("250");
  551. msg = ParseMessageID (MSG_NOT_ENOUGH_DISK_SPACE_WITH_LOCALSOURCE_AND_BACKUP, args);
  552. group = BuildMessageGroup (MSG_BLOCKING_ITEMS_ROOT, MSG_NOT_ENOUGH_DISKSPACE_SUBGROUP, NULL);
  553. MsgMgr_ObjectMsg_Add (TEXT("*DiskSpace"), group, msg);
  554. FreeText (group);
  555. FreeStringResource (msg);
  556. }
  557. VOID
  558. pOutOfRam (
  559. VOID
  560. )
  561. {
  562. PCTSTR args[3];
  563. PCTSTR group;
  564. PCTSTR message;
  565. args[0] = TEXT("64");
  566. args[1] = TEXT("48");
  567. args[2] = TEXT("16");
  568. group = BuildMessageGroup (MSG_BLOCKING_ITEMS_ROOT, MSG_NOT_ENOUGH_RAM_SUBGROUP, NULL);
  569. message = ParseMessageID (MSG_NOT_ENOUGH_RAM, args);
  570. MsgMgr_ObjectMsg_Add (TEXT("*Ram"), group, message);
  571. FreeText (group);
  572. FreeStringResource (message);
  573. }
  574. VOID
  575. pMapi (
  576. VOID
  577. )
  578. {
  579. PCTSTR group;
  580. PCTSTR message;
  581. group = BuildMessageGroup (MSG_INSTALL_NOTES_ROOT, MSG_MAPI_NOT_HANDLED_SUBGROUP, NULL);
  582. message = GetStringResource (MSG_MAPI_NOT_HANDLED);
  583. MsgMgr_ObjectMsg_Add (TEXT("*MapiNotHandled"), group, message);
  584. FreeText (group);
  585. FreeStringResource (message);
  586. }
  587. VOID
  588. pDarwin (
  589. VOID
  590. )
  591. {
  592. PCTSTR group;
  593. PCTSTR message;
  594. group = BuildMessageGroup (MSG_INSTALL_NOTES_ROOT, MSG_DARWIN_NOT_HANDLED_SUBGROUP, NULL);
  595. message = GetStringResource (MSG_DARWIN_NOT_HANDLED);
  596. MsgMgr_ObjectMsg_Add (TEXT("*DarwinNotHandled"), group, message);
  597. FreeText (group);
  598. FreeStringResource (message);
  599. }
  600. VOID
  601. pRas (
  602. PCTSTR EntryName
  603. )
  604. {
  605. PCTSTR group;
  606. group = BuildMessageGroup (
  607. MSG_INSTALL_NOTES_ROOT,
  608. MSG_CONNECTION_PASSWORD_SUBGROUP,
  609. EntryName
  610. );
  611. MsgMgr_ObjectMsg_Add ( EntryName, group, S_EMPTY);
  612. FreeText (group);
  613. group = BuildMessageGroup (
  614. MSG_LOSTSETTINGS_ROOT,
  615. MSG_CONNECTION_BADPROTOCOL_SUBGROUP,
  616. EntryName
  617. );
  618. MsgMgr_ObjectMsg_Add (
  619. EntryName,
  620. group,
  621. S_EMPTY
  622. );
  623. FreeText (group);
  624. }
  625. VOID
  626. pMultiMon (
  627. BOOL Per
  628. )
  629. {
  630. PCTSTR group;
  631. PCTSTR message;
  632. group = BuildMessageGroup (MSG_INSTALL_NOTES_ROOT, MSG_MULTI_MONITOR_UNSUPPORTED_SUBGROUP, NULL);
  633. message = GetStringResource (Per?
  634. MSG_MULTI_MONITOR_UNSUPPORTED_PER:
  635. MSG_MULTI_MONITOR_UNSUPPORTED);
  636. MsgMgr_ObjectMsg_Add (TEXT("*MultiMonitor"), group, message);
  637. FreeText (group);
  638. FreeStringResource (message);
  639. }
  640. VOID
  641. pJoysticks (
  642. PCTSTR FullPath,
  643. PCTSTR JoystickName
  644. )
  645. {
  646. PCTSTR group;
  647. group = BuildMessageGroup (
  648. MSG_INCOMPATIBLE_HARDWARE_ROOT,
  649. MSG_JOYSTICK_SUBGROUP,
  650. JoystickName
  651. );
  652. MsgMgr_ObjectMsg_Add (
  653. FullPath,
  654. group,
  655. NULL
  656. );
  657. FreeText (group);
  658. }
  659. VOID
  660. pTwain (
  661. PCTSTR DataSourceModule,
  662. PCTSTR DisplayName
  663. )
  664. {
  665. PCTSTR group;
  666. group = BuildMessageGroup (
  667. MSG_INCOMPATIBLE_HARDWARE_ROOT,
  668. MSG_TWAIN_SUBGROUP,
  669. DisplayName
  670. );
  671. MsgMgr_ObjectMsg_Add (
  672. DataSourceModule,
  673. group,
  674. NULL
  675. );
  676. FreeText (group);
  677. }
  678. VOID
  679. pRecycleBin (
  680. PCTSTR Recycled
  681. )
  682. {
  683. PCTSTR args[1];
  684. PCTSTR group;
  685. PCTSTR message;
  686. args[0] = Recycled;
  687. group = BuildMessageGroup (MSG_INSTALL_NOTES_ROOT, MSG_RECYCLE_BIN_SUBGROUP, NULL);
  688. message = ParseMessageID (MSG_RECYCLED_FILES_WILL_BE_DELETED, args);
  689. MsgMgr_ObjectMsg_Add (TEXT("*RECYCLEBIN"), group, message);
  690. FreeText (group);
  691. FreeStringResource (message);
  692. }
  693. VOID
  694. pTimeZone (
  695. PCTSTR CurTimeZone // can be empty string
  696. )
  697. {
  698. PCTSTR args[1];
  699. PCTSTR component;
  700. PCTSTR warning;
  701. args[0] = CurTimeZone;
  702. component = GetStringResource (MSG_TIMEZONE_COMPONENT);
  703. if (*CurTimeZone) {
  704. warning = ParseMessageID (MSG_TIMEZONE_WARNING, args);
  705. }
  706. else {
  707. warning = GetStringResource (MSG_TIMEZONE_WARNING_UNKNOWN);
  708. }
  709. MYASSERT (component);
  710. MYASSERT (warning);
  711. MsgMgr_ObjectMsg_Add (TEXT("*TIMEZONE"), component, warning);
  712. FreeStringResource (component);
  713. FreeStringResource (warning);
  714. }
  715. VOID
  716. pLostRasPassword (
  717. PCTSTR EntryName
  718. )
  719. {
  720. PCTSTR group;
  721. group = BuildMessageGroup (
  722. MSG_MISC_WARNINGS_ROOT,
  723. MSG_CONNECTION_PASSWORD_SUBGROUP,
  724. EntryName
  725. );
  726. MsgMgr_ObjectMsg_Add (EntryName, group, S_EMPTY);
  727. FreeText (group);
  728. }
  729. VOID
  730. pGenReport (
  731. VOID
  732. )
  733. {
  734. //
  735. // Changed names
  736. //
  737. pAddChangedUserName ("User Name", "Guest", "Guest-1");
  738. pAddChangedUserName ("Computer Name", "My Bad Computer Name", "MyBadComputerNa");
  739. //
  740. // Hardware
  741. //
  742. pAddDevice (
  743. "HKLM\\Enum\\Key1",
  744. HW_INCOMPATIBLE,
  745. "PCMCIA Interrupt Sequencer",
  746. TRUE,
  747. "SysDevs",
  748. "Texas Instruments",
  749. "PCMCIA\\TI004000&DEV_1234",
  750. "System Devices"
  751. );
  752. pAddDevice (
  753. "HKLM\\Enum\\Key2",
  754. HW_INCOMPATIBLE,
  755. "PCMCIA Mass Storage Device",
  756. FALSE,
  757. "DiskDrives",
  758. "Texas Instruments",
  759. "PCMCIA\\TI005000&DEV_2000",
  760. "Hard Disk Drives"
  761. );
  762. pAddDevice (
  763. "HKLM\\Enum\\Key1A",
  764. HW_INCOMPATIBLE,
  765. "Matrox Century 1",
  766. TRUE,
  767. "Video",
  768. "Matrox Inc.",
  769. "PCI\\VEN_0010&DEV_0020",
  770. "Display Devices"
  771. );
  772. pAddDevice (
  773. "HKLM\\Enum\\Key2B",
  774. HW_INCOMPATIBLE,
  775. "Microsoft Enhanced Keyboard",
  776. TRUE,
  777. "Input",
  778. "Microsoft Corporation",
  779. "*PNP091C",
  780. "Input Devices"
  781. );
  782. pAddDevice (
  783. "HKLM\\Enum\\Key3",
  784. HW_REINSTALL,
  785. "Cannon Digital Camera",
  786. FALSE,
  787. "MF",
  788. "Cannon",
  789. "USB\\CANNON_DC_VID_0100&PID_0105&RID_6500",
  790. "Multi Function Devices"
  791. );
  792. pAddDevice (
  793. "HKLM\\Enum\\Key4",
  794. HW_REINSTALL,
  795. "Cannon Digital Camera Docking Station",
  796. TRUE,
  797. "MF",
  798. "Cannon",
  799. "USB\\CANNON_DC_VID_0100&PID_0105&RID_6501",
  800. "Multi Function Devices"
  801. );
  802. pAddDevice (
  803. "HKLM\\Enum\\Key5",
  804. HW_UNSUPPORTED,
  805. "Adaptec XX00",
  806. FALSE,
  807. "SCSI",
  808. "Texas Instruments",
  809. "PCMCIA\\TI004000&DEV_1234",
  810. "SCSI Controllers"
  811. );
  812. //
  813. // Bad OS version (Win95?)
  814. //
  815. pBadOsVersion();
  816. //
  817. // Blocking file
  818. //
  819. pBlockingFile (
  820. "c:\\program files\\nueo\\DLAPP.EXE",
  821. "Norton Your Eyes Only",
  822. "Norton Your Eyes Only can cause serious problems during the upgrade to "
  823. "Windows XP. Because of these incompatibilities, "
  824. "you must uninstall this program from your system before continuing."
  825. );
  826. pBlockingFile (
  827. "c:\\program files\\Sysmon32.exe",
  828. "V3Pro 98",
  829. "This virus scanner can cause serious problems during the upgrade to Windows XP. You must "
  830. "uninstall V3 Professional 98 before continuing."
  831. );
  832. //
  833. // Blocking hardware
  834. //
  835. pBlockingHardware (
  836. "c:\\windows\\system\\NVARCH32.DLL",
  837. "ALi AGP Controller",
  838. "Setup has detected an incompatibility between your video card & computer's mainboard. "
  839. "Because of this, your computer may not start up after the upgrade. Contact the "
  840. "manufacturer of your hardware for technical assistance."
  841. );
  842. //
  843. // Backup dirs
  844. //
  845. pBackupDirs ("c:\\myfiles");
  846. pManyBackupDirs (55);
  847. //
  848. // HLP files
  849. //
  850. pHlpFile ("c:\\my app\\foo.hlp", "foo.hlp", "Foo Help File", NULL);
  851. pHlpFile ("c:\\my app\\foo.hlp2", "foo.hlp2", "Foo Help File 2", "Test text");
  852. //
  853. // Dir collisions
  854. //
  855. pProfileDir ("c:\\Documents and Settings", "c:\\Documents and Settings.001");
  856. //
  857. // Replacement shell
  858. //
  859. pBadShell();
  860. //
  861. // Bad SCR
  862. //
  863. pBadScr ("c:\\windows\\system\\disney.scr", NULL, ACT_REINSTALL, NULL);
  864. pBadScr ("c:\\windows\\system\\Clifford.scr", NULL, ACT_REINSTALL_BLOCK, NULL);
  865. pBadScr ("c:\\windows\\system\\Stars and Stripes.scr", NULL, ACT_MINORPROBLEMS, "The animation mode will not work on Windows XP");
  866. pBadScr ("c:\\windows\\system\\Light Tracer.scr", NULL, ACT_INCOMPATIBLE, NULL);
  867. pBadScr ("c:\\windows\\system\\Big Fish.scr", NULL, ACT_INC_NOBADAPPS, NULL);
  868. pBadScr ("c:\\windows\\system\\disney gfy.scr", "Disney's Goofy", ACT_REINSTALL, NULL);
  869. //
  870. // Bad CPL
  871. //
  872. pBadCpl (
  873. "c:\\windows\\system\\chipcontrol.cpl",
  874. "Chip Control\0Cache\0",
  875. NULL,
  876. ACT_REINSTALL,
  877. NULL
  878. );
  879. pBadCpl (
  880. "c:\\windows\\system\\antivirus.cpl",
  881. "AntiVirus",
  882. NULL,
  883. ACT_REINSTALL_BLOCK,
  884. NULL
  885. );
  886. pBadCpl (
  887. "c:\\windows\\system\\antivirus2.cpl",
  888. "Symantec AntiVirus",
  889. NULL,
  890. ACT_REINSTALL_BLOCK,
  891. NULL
  892. );
  893. pBadCpl (
  894. "c:\\windows\\system\\crash.cpl",
  895. "Crash Applet",
  896. NULL,
  897. ACT_INC_SAFETY,
  898. NULL
  899. );
  900. pBadCpl (
  901. "c:\\windows\\system\\findfast.cpl",
  902. "FindFast",
  903. NULL,
  904. ACT_INC_SIMILAROSFUNC,
  905. NULL
  906. );
  907. pBadCpl (
  908. "c:\\windows\\system\\easyaccess.cpl",
  909. "Compaq EasyAccess",
  910. NULL,
  911. ACT_INC_PREINSTUTIL,
  912. NULL
  913. );
  914. pBadCpl (
  915. "c:\\windows\\system\\vdesk.cpl",
  916. "Matrox Virtual Desktop",
  917. NULL,
  918. ACT_INC_IHVUTIL,
  919. NULL
  920. );
  921. pBadCpl (
  922. "c:\\windows\\system\\quicktime.cpl",
  923. "Apple QuickTime 1.0",
  924. NULL,
  925. ACT_INC_NOBADAPPS,
  926. NULL
  927. );
  928. pBadCpl (
  929. "c:\\windows\\system\\celldialer.cpl",
  930. "Motorola Cell Phone Dialer",
  931. NULL,
  932. ACT_MINORPROBLEMS,
  933. "After upgrading, the Motorola Cell Phone Dialer won't redial if a busy signal is detected"
  934. );
  935. //
  936. // Mig Dll IDs
  937. //
  938. pShowPacks ("Microsoft Upgrade Pack 2");
  939. pShowPacks ("Front Page Server Extensions");
  940. //
  941. // Excluded drives
  942. //
  943. pExcludeDrive (TEXT("C:\\"), MSG_DRIVE_EXCLUDED_SUBGROUP);
  944. pExcludeDrive (TEXT("D:\\"), MSG_DRIVE_INACCESSIBLE_SUBGROUP);
  945. pExcludeDrive (TEXT("E:\\"), MSG_DRIVE_RAM_SUBGROUP);
  946. pExcludeDrive (TEXT("F:\\"), MSG_DRIVE_NETWORK_SUBGROUP);
  947. pExcludeDrive (TEXT("G:\\"), MSG_DRIVE_SUBST_SUBGROUP);
  948. //
  949. // Out of disk space or RAM
  950. //
  951. pOutOfDiskSpace();
  952. pOutOfRam();
  953. //
  954. // MAPI and Darwin
  955. //
  956. pMapi();
  957. pDarwin ();
  958. //
  959. // RAS
  960. //
  961. pRas(TEXT("My ISP"));
  962. //
  963. // Shares
  964. //
  965. pAddIncompatibilityAlert (MSG_INVALID_ACL_LIST, TEXT("MyShare"), TEXT("c:\\my share"));
  966. pAddIncompatibilityAlert (MSG_LOST_SHARE_PASSWORDS, TEXT("MyShare2"), TEXT("c:\\my share2"));
  967. pAddIncompatibilityAlert (MSG_LOST_ACCESS_FLAGS, TEXT("MyShare3"), TEXT("c:\\my share3"));
  968. //
  969. // Multiple monitors
  970. //
  971. pMultiMon (TRUE); // per
  972. pMultiMon (FALSE); // pro
  973. //
  974. // Joysticks
  975. //
  976. pJoysticks ("c:\\windows\\system\\joy.vxd", "Microsoft Sidewinder");
  977. //
  978. // TWAIN
  979. //
  980. pTwain ("c:\\windows\\twain_32\\xeotec.ds", "Xeotec Digital Camera");
  981. //
  982. // Recycle Bin
  983. //
  984. pRecycleBin ("30");
  985. //
  986. // Bad user accounts
  987. //
  988. MsgSettingsIncomplete ("c:\\windows\\profiles\\joeuser", "joeuser", FALSE);
  989. MsgSettingsIncomplete ("c:\\windows\\profiles\\maryuser", "maryuser", TRUE);
  990. MsgSettingsIncomplete ("c:\\windows\\profiles\\a?b", NULL, TRUE);
  991. //
  992. // Time zone
  993. //
  994. pTimeZone ("");
  995. pTimeZone ("Pacific Time (GMT -08:00)");
  996. //
  997. // Lost RAS password
  998. //
  999. pLostRasPassword ("AOL");
  1000. }
  1001. BOOL
  1002. pFillListControl (
  1003. IN HWND ListHandle
  1004. );
  1005. INT
  1006. __cdecl
  1007. main (
  1008. INT argc,
  1009. CHAR *argv[]
  1010. )
  1011. {
  1012. HWND hwnd;
  1013. UINT rc;
  1014. SuppressAllLogPopups (TRUE);
  1015. if (!Init()) {
  1016. printf ("Unable to initialize!\n");
  1017. return 255;
  1018. }
  1019. //
  1020. // TODO: Put your code here
  1021. //
  1022. RegisterTextViewer();
  1023. {
  1024. MSG msg;
  1025. PCTSTR text;
  1026. HANDLE file;
  1027. HANDLE map;
  1028. UINT size;
  1029. PTSTR textBuf;
  1030. MsgMgr_Init();
  1031. InitCompatTable();
  1032. pGenReport();
  1033. MsgMgr_Resolve();
  1034. SaveReport (NULL, TEXT("C:\\test.htm"));
  1035. SaveReport (NULL, TEXT("C:\\test.txt"));
  1036. pFillListControl (NULL);
  1037. text = (PCTSTR) MapFileIntoMemory (TEXT("C:\\test.htm"), &file, &map);
  1038. size = GetFileSize (file, NULL);
  1039. textBuf = AllocText (size + 1);
  1040. CopyMemory (textBuf, text, size);
  1041. textBuf[size] = 0;
  1042. hwnd = CreateWindowEx (
  1043. WS_EX_APPWINDOW|WS_EX_PALETTEWINDOW,
  1044. S_TEXTVIEW_CLASS,
  1045. textBuf,
  1046. WS_OVERLAPPED|WS_BORDER|WS_SYSMENU|WS_VISIBLE|WS_VSCROLL,
  1047. 100, 100,
  1048. 418, 215,
  1049. NULL,
  1050. NULL,
  1051. GetModuleHandle (NULL),
  1052. NULL
  1053. );
  1054. g_Proc = (WNDPROC) GetWindowLong (hwnd, GWL_WNDPROC);
  1055. SetWindowLong (hwnd, GWL_WNDPROC, (LONG) pWrapperProc);
  1056. while (GetMessage (&msg, NULL, 0, 0)) {
  1057. TranslateMessage (&msg);
  1058. DispatchMessage (&msg);
  1059. }
  1060. }
  1061. Terminate();
  1062. return 0;
  1063. }