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.

683 lines
23 KiB

  1. #include "stdafx.h"
  2. #include "reginfo.h"
  3. int CRegInfo::Valid()
  4. {
  5. DWORD dwRes;
  6. DWORD dwType;
  7. if (ERROR_SUCCESS != RegCreateKeyEx(HKEY_CURRENT_USER,
  8. TEXT("Software\\Microsoft\\Handwriting\\Collection"),
  9. 0, TEXT("REG_SZ"), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &m_hkRoot, &dwRes))
  10. {
  11. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  12. return REGINFO_FATAL_ERROR;
  13. }
  14. dwRes = sizeof(m_szLang);
  15. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Language"), NULL, &dwType, (BYTE *) &m_szLang, &dwRes)) || (dwType != REG_SZ))
  16. return REGINFO_FAILURE;
  17. return REGINFO_SUCCESS;
  18. }
  19. void CRegInfo::Clean()
  20. {
  21. if (m_pusers != (USERNAME *) NULL)
  22. {
  23. free(m_pusers);
  24. m_pusers = (USERNAME *) NULL;
  25. }
  26. if (m_pquest != (QUESTION *) NULL)
  27. {
  28. int iQuest = 0;
  29. while (m_pquest[iQuest].pszQuestion)
  30. {
  31. free(m_pquest[iQuest].pszQuestion);
  32. iQuest++;
  33. }
  34. free(m_pquest);
  35. m_pquest = (QUESTION *) NULL;
  36. }
  37. RegCloseKey(m_hkRoot);
  38. }
  39. int CountLines(FILE *fp)
  40. {
  41. int cLines = 0;
  42. char ach[256];
  43. while (!feof(fp))
  44. {
  45. fgets(ach, 256, fp);
  46. cLines++;
  47. }
  48. fseek(fp, 0, SEEK_SET);
  49. return cLines;
  50. }
  51. void CRegInfo::ReadUserList()
  52. {
  53. // Open the file and count the lines
  54. FILE *fp = _tfopen(m_szUser, TEXT("r"));
  55. if (fp == (FILE *) NULL)
  56. return;
  57. int cUser = CountLines(fp);
  58. if ((m_pusers = (USERNAME *) malloc(sizeof(USERNAME) * cUser)) == (USERNAME *) NULL)
  59. return;
  60. cUser--;
  61. // Note: the USERS.TXT file is stored in ANSI, convert to UNICODE while reading it into memory
  62. char ach[256];
  63. int iUser;
  64. int cch;
  65. int ich;
  66. for (iUser = 0; iUser < cUser; iUser++)
  67. {
  68. fgets(ach, 256, fp);
  69. cch = strlen(ach) - 1; // Trim the NEWLINE
  70. for (ich = 0; ich < cch; ich++)
  71. m_pusers[iUser][ich] = (TCHAR) ach[ich];
  72. m_pusers[iUser][cch] = (TCHAR) 0;
  73. }
  74. m_pusers[cUser][0] = 0; // Terminates the list
  75. fclose(fp);
  76. }
  77. void CRegInfo::ReadQuestionList()
  78. {
  79. // Open the file and count the lines
  80. FILE *fp = _tfopen(m_szQuest, TEXT("r"));
  81. if (fp == (FILE *) NULL)
  82. return;
  83. int cQuest = CountLines(fp);
  84. if ((m_pquest = (QUESTION *) malloc(sizeof(QUESTION) * cQuest)) == (QUESTION *) NULL)
  85. return ;
  86. cQuest--;
  87. // Note: the QUEST.TXT file is stored in ANSI, convert to UNICODE while reading it into memory
  88. char ach[256];
  89. char *pch;
  90. int iQuest;
  91. int cch;
  92. int ich;
  93. int jch;
  94. for (iQuest = 0; iQuest < cQuest; iQuest++)
  95. {
  96. // Set the index
  97. m_pquest[iQuest].nIndex = iQuest;
  98. // Read the question from the file
  99. fgets(ach, 256, fp);
  100. cch = strlen(ach) - 1;
  101. ach[cch] = '\0'; // Trim the NEWLINE
  102. // The question is stored in the form LONG FORM OF QUESTION TEXT%SHORT FORM%BOOLEAN
  103. // Find the first % character
  104. pch = strchr(ach, '%');
  105. // Added 11/17/97 by JCG a-jglen
  106. // added code to catch a corrupt or invalid question file
  107. if(pch == NULL) {
  108. //this question file is corrupt or invalid
  109. m_pquest = NULL;
  110. fclose(fp);
  111. return;
  112. }
  113. jch = pch - &ach[0];
  114. m_pquest[iQuest].pszQuestion = (TCHAR *) malloc(sizeof(TCHAR) * (jch + 2));
  115. for (ich = 0; ich < jch; ich++)
  116. m_pquest[iQuest].pszQuestion[ich] = (TCHAR) ach[ich];
  117. m_pquest[iQuest].pszQuestion[jch] = (TCHAR) 0;
  118. // Now, point to the beginning of the short form of the question and copy it into the question array
  119. jch++;
  120. for (ich = 0; ich < 5; ich++)
  121. m_pquest[iQuest].szShort[ich] = (TCHAR) ach[jch++];
  122. m_pquest[iQuest].szShort[5] = (TCHAR) 0;
  123. // Finally, point to the boolean and look at the first character
  124. jch++;
  125. m_pquest[iQuest].bYesDefault = ach[jch] == 'T';
  126. }
  127. m_pquest[cQuest].pszQuestion = (TCHAR *) NULL;
  128. fclose(fp);
  129. return;
  130. }
  131. BOOL CRegInfo::Fetch()
  132. {
  133. if (m_hkRoot == (HKEY) NULL)
  134. {
  135. MessageBox((HWND) NULL, TEXT("Unable to fetch registry"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  136. return FALSE;
  137. }
  138. DWORD dwRes;
  139. DWORD dwType;
  140. dwRes = sizeof(m_szInstall);
  141. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Install Root"), NULL, &dwType, (BYTE *) &m_szInstall, &dwRes)) || (dwType != REG_SZ))
  142. _tcscpy(m_szInstall, TEXT("c:\\unitools\\"));
  143. dwRes = sizeof(m_szLang);
  144. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Language"), NULL, &dwType, (BYTE *) &m_szLang, &dwRes)) || (dwType != REG_SZ))
  145. _tcscpy(m_szLang, TEXT("English (USA)"));
  146. dwRes = sizeof(m_szRecog);
  147. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Recognizer"), NULL, &dwType, (BYTE *) &m_szRecog, &dwRes)) || (dwType != REG_SZ))
  148. _tcscpy(m_szRecog, TEXT("HWXUSA.DLL"));
  149. dwRes = sizeof(m_szFont);
  150. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Font"), NULL, &dwType, (BYTE *) &m_szFont, &dwRes)) || (dwType != REG_SZ))
  151. _tcscpy(m_szFont, TEXT("Arial"));
  152. dwRes = sizeof(DWORD);
  153. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Character Set"), NULL, &dwType, (BYTE *) &m_cset, &dwRes)) || (dwType != REG_DWORD))
  154. m_cset = 0;
  155. dwRes = sizeof(DWORD);
  156. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("HWX Codepage"), NULL, &dwType, (BYTE *) &m_cpRecog, &dwRes)) || (dwType != REG_DWORD))
  157. m_cpRecog = 0;
  158. dwRes = sizeof(DWORD);
  159. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("FFF Input"), NULL, &dwType, (BYTE *) &m_cpIn, &dwRes)) || (dwType != REG_DWORD))
  160. m_cpIn = 0;
  161. dwRes = sizeof(DWORD);
  162. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("FFF Output"), NULL, &dwType, (BYTE *) &m_cpOut, &dwRes)) || (dwType != REG_DWORD))
  163. m_cpOut = m_cpIn;
  164. dwRes = sizeof(DWORD);
  165. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Keyboard"), NULL, &dwType, (BYTE *) &m_cpKbd, &dwRes)) || (dwType != REG_DWORD))
  166. m_cpKbd = 0;
  167. dwRes = sizeof(DWORD);
  168. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Display"), NULL, &dwType, (BYTE *) &m_cpScr, &dwRes)) || (dwType != REG_DWORD))
  169. m_cpScr = 0;
  170. dwRes = sizeof(m_szUser);
  171. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("User File"), NULL, &dwType, (BYTE *) &m_szUser, &dwRes)) || (dwType != REG_SZ))
  172. _tcscpy(m_szUser, TEXT("users.txt"));
  173. dwRes = sizeof(m_szQuest);
  174. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Question File"), NULL, &dwType, (BYTE *) &m_szQuest, &dwRes)) || (dwType != REG_SZ))
  175. _tcscpy(m_szQuest, TEXT("quest.txt"));
  176. dwRes = sizeof(m_szLocal);
  177. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Local Root"), NULL, &dwType, (BYTE *) &m_szLocal, &dwRes)) || (dwType != REG_SZ))
  178. _tcscpy(m_szLocal, TEXT("\\"));
  179. dwRes = sizeof(m_szNetwork);
  180. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Network Root"), NULL, &dwType, (BYTE *) &m_szNetwork, &dwRes)) || (dwType != REG_SZ))
  181. _tcscpy(m_szNetwork, TEXT("\\\\"));
  182. dwRes = sizeof(m_szScript);
  183. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Current Script"), NULL, &dwType, (BYTE *) &m_szScript, &dwRes)) || (dwType != REG_SZ))
  184. _tcscpy(m_szScript, TEXT("scrip000.sct"));
  185. dwRes = sizeof(m_szStation);
  186. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Station"), NULL, &dwType, (BYTE *) &m_szStation, &dwRes)) || (dwType != REG_SZ))
  187. _tcscpy(m_szStation, TEXT("RD"));
  188. dwRes = sizeof(DWORD);
  189. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Remove Spaces"), NULL, &dwType, (BYTE *) &m_bRemove, &dwRes)) || (dwType != REG_DWORD))
  190. m_bRemove = FALSE;
  191. dwRes = sizeof(DWORD);
  192. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Use Context"), NULL, &dwType, (BYTE *) &m_bContext, &dwRes)) || (dwType != REG_DWORD))
  193. m_bContext = FALSE;
  194. dwRes = sizeof(DWORD);
  195. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("ALC"), NULL, &dwType, (BYTE *) &m_dwALC, &dwRes)) || (dwType != REG_DWORD))
  196. m_dwALC = 0;
  197. dwRes = sizeof(DWORD);
  198. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Verify (safe)"), NULL, &dwType, (BYTE *) &m_bVerifySafe, &dwRes)) || (dwType != REG_DWORD))
  199. m_bVerifySafe = FALSE;
  200. dwRes = sizeof(DWORD);
  201. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Verify (unsafe)"), NULL, &dwType, (BYTE *) &m_bVerifyUnsafe, &dwRes)) || (dwType != REG_DWORD))
  202. m_bVerifyUnsafe = FALSE;
  203. dwRes = sizeof(DWORD);
  204. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Verify 2"), NULL, &dwType, (BYTE *) &m_bVerify2, &dwRes)) || (dwType != REG_DWORD))
  205. m_bVerify2 = FALSE;
  206. dwRes = sizeof(DWORD);
  207. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Reconcile"), NULL, &dwType, (BYTE *) &m_bReconcile, &dwRes)) || (dwType != REG_DWORD))
  208. m_bReconcile = FALSE;
  209. dwRes = sizeof(DWORD);
  210. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Special"), NULL, &dwType, (BYTE *) &m_bSpecial, &dwRes)) || (dwType != REG_DWORD))
  211. m_bSpecial = FALSE;
  212. dwRes = sizeof(DWORD);
  213. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Batch"), NULL, &dwType, (BYTE *) &m_bBatch, &dwRes)) || (dwType != REG_DWORD))
  214. m_bBatch = FALSE;
  215. dwRes = sizeof(DWORD);
  216. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Vertical Margin"), NULL, &dwType, (BYTE *) &m_cyMargin, &dwRes)) || (dwType != REG_DWORD))
  217. m_cyMargin = 1;
  218. dwRes = sizeof(DWORD);
  219. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Horizontal Margin"), NULL, &dwType, (BYTE *) &m_cxMargin, &dwRes)) || (dwType != REG_DWORD))
  220. m_cxMargin = 4;
  221. dwRes = sizeof(DWORD);
  222. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Vertical Guides"), NULL, &dwType, (BYTE *) &m_cyGuides, &dwRes)) || (dwType != REG_DWORD))
  223. m_cyGuides = 3;
  224. dwRes = sizeof(DWORD);
  225. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Horizontal Guides"), NULL, &dwType, (BYTE *) &m_cxGuides, &dwRes)) || (dwType != REG_DWORD))
  226. m_cxGuides = 8;
  227. dwRes = sizeof(DWORD);
  228. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Vertical Gap"), NULL, &dwType, (BYTE *) &m_cyGap, &dwRes)) || (dwType != REG_DWORD))
  229. m_cyGap = 1;
  230. dwRes = sizeof(DWORD);
  231. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Horizontal Gap"), NULL, &dwType, (BYTE *) &m_cxGap, &dwRes)) || (dwType != REG_DWORD))
  232. m_cxGap = 1;
  233. dwRes = sizeof(DWORD);
  234. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Interval"), NULL, &dwType, (BYTE *) &m_cInterval, &dwRes)) || (dwType != REG_DWORD))
  235. m_cInterval = 10;
  236. dwRes = sizeof(DWORD);
  237. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Allowance"), NULL, &dwType, (BYTE *) &m_cAllow, &dwRes)) || (dwType != REG_DWORD))
  238. m_cAllow = 0;
  239. dwRes = sizeof(DWORD);
  240. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Alternate"), NULL, &dwType, (BYTE *) &m_cAlts, &dwRes)) || (dwType != REG_DWORD))
  241. m_cAlts = 1;
  242. dwRes = sizeof(DWORD);
  243. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Retry Limit"), NULL, &dwType, (BYTE *) &m_cRetry, &dwRes)) || (dwType != REG_DWORD))
  244. m_cRetry = 1;
  245. dwRes = sizeof(DWORD);
  246. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Midline"), NULL, &dwType, (BYTE *) &m_bMidline, &dwRes)) || (dwType != REG_DWORD))
  247. m_bMidline = FALSE;
  248. dwRes = sizeof(DWORD);
  249. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Baseline"), NULL, &dwType, (BYTE *) &m_bBaseline, &dwRes)) || (dwType != REG_DWORD))
  250. m_bBaseline = FALSE;
  251. dwRes = sizeof(DWORD);
  252. if ((ERROR_SUCCESS != RegQueryValueEx(m_hkRoot, TEXT("Word Wrap"), NULL, &dwType, (BYTE *) &m_bWrap, &dwRes)) || (dwType != REG_DWORD))
  253. m_bWrap = FALSE;
  254. // Now, load the user and questions lists into memory
  255. ReadUserList();
  256. ReadQuestionList();
  257. // Added 12/09.97 JCG a-jglen
  258. // Make sure all the codepages are installed in the system
  259. TCHAR szWarningString[256];
  260. if(m_cpIn)
  261. {
  262. if(!IsValidCodePage(m_cpIn))
  263. {
  264. wsprintf(szWarningString, TEXT("CodePage %d is not installed on your system."), m_cpIn);
  265. MessageBox(NULL, szWarningString, TEXT("Warning..."), MB_ICONEXCLAMATION | MB_OK);
  266. return TRUE;
  267. }
  268. }
  269. if(m_cpOut)
  270. {
  271. if(!IsValidCodePage(m_cpOut))
  272. {
  273. wsprintf(szWarningString, TEXT("CodePage %d is not installed on your system."), m_cpOut);
  274. MessageBox(NULL, szWarningString, TEXT("Warning..."), MB_ICONEXCLAMATION | MB_OK);
  275. return TRUE;
  276. }
  277. }
  278. if(m_cpRecog)
  279. {
  280. if(!IsValidCodePage(m_cpRecog))
  281. {
  282. wsprintf(szWarningString, TEXT("CodePage %d is not installed on your system."), m_cpRecog);
  283. MessageBox(NULL, szWarningString, TEXT("Warning..."), MB_ICONEXCLAMATION | MB_OK);
  284. return TRUE;
  285. }
  286. }
  287. if(m_cpKbd)
  288. {
  289. if(!IsValidCodePage(m_cpKbd))
  290. {
  291. wsprintf(szWarningString, TEXT("CodePage %d is not installed on your system."), m_cpKbd);
  292. MessageBox(NULL, szWarningString, TEXT("Warning..."), MB_ICONEXCLAMATION | MB_OK);
  293. return TRUE;
  294. }
  295. }
  296. if(m_cpScr)
  297. {
  298. if(!IsValidCodePage(m_cpScr))
  299. {
  300. wsprintf(szWarningString, TEXT("CodePage %d is not installed on your system."), m_cpScr);
  301. MessageBox(NULL, szWarningString, TEXT("Warning..."), MB_ICONEXCLAMATION | MB_OK);
  302. return TRUE;
  303. }
  304. }
  305. return TRUE;
  306. }
  307. BOOL CRegInfo::Store(int nMask)
  308. {
  309. DWORD dwRes;
  310. if (nMask & REGINFO_STORE_INSTALL)
  311. {
  312. dwRes = sizeof(TCHAR) * (_tcslen(m_szInstall) + 1);
  313. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Install Root"), NULL, REG_SZ, (BYTE *) m_szInstall, dwRes))
  314. {
  315. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  316. return FALSE;
  317. }
  318. }
  319. if (nMask & REGINFO_STORE_COMMON)
  320. {
  321. dwRes = sizeof(TCHAR) * (_tcslen(m_szLocal) + 1);
  322. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Local Root"), NULL, REG_SZ, (BYTE *) m_szLocal, dwRes))
  323. {
  324. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  325. return FALSE;
  326. }
  327. dwRes = sizeof(TCHAR) * (_tcslen(m_szNetwork) + 1);
  328. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Network Root"), NULL, REG_SZ, (BYTE *) m_szNetwork, dwRes))
  329. {
  330. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  331. return FALSE;
  332. }
  333. dwRes = sizeof(TCHAR) * (_tcslen(m_szLang) + 1);
  334. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Language"), NULL, REG_SZ, (BYTE *) m_szLang, dwRes))
  335. {
  336. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  337. return FALSE;
  338. }
  339. dwRes = sizeof(TCHAR) * (_tcslen(m_szRecog) + 1);
  340. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Recognizer"), NULL, REG_SZ, (BYTE *) m_szRecog, dwRes))
  341. {
  342. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  343. return FALSE;
  344. }
  345. dwRes = sizeof(TCHAR) * (_tcslen(m_szFont) + 1);
  346. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Font"), NULL, REG_SZ, (BYTE *) m_szFont, dwRes))
  347. {
  348. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  349. return FALSE;
  350. }
  351. dwRes = m_cset;
  352. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Character Set"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  353. {
  354. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  355. return FALSE;
  356. }
  357. dwRes = m_cpRecog;
  358. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("HWX Codepage"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  359. {
  360. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  361. return FALSE;
  362. }
  363. dwRes = m_cpIn;
  364. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("FFF Input"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  365. {
  366. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  367. return FALSE;
  368. }
  369. dwRes = m_cpOut;
  370. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("FFF Output"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  371. {
  372. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  373. return FALSE;
  374. }
  375. dwRes = m_cpKbd;
  376. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Keyboard"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  377. {
  378. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  379. return FALSE;
  380. }
  381. dwRes = m_cpScr;
  382. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Display"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  383. {
  384. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  385. return FALSE;
  386. }
  387. }
  388. if (nMask & REGINFO_STORE_SEPARATOR)
  389. {
  390. dwRes = sizeof(TCHAR) * (_tcslen(m_szUser) + 1);
  391. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("User File"), NULL, REG_SZ, (BYTE *) m_szUser, dwRes))
  392. {
  393. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  394. return FALSE;
  395. }
  396. dwRes = sizeof(TCHAR) * (_tcslen(m_szQuest) + 1);
  397. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Question File"), NULL, REG_SZ, (BYTE *) m_szQuest, dwRes))
  398. {
  399. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  400. return FALSE;
  401. }
  402. dwRes = m_bVerifySafe;
  403. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Verify (safe)"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  404. {
  405. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  406. return FALSE;
  407. }
  408. dwRes = m_bVerifyUnsafe;
  409. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Verify (unsafe)"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  410. {
  411. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  412. return FALSE;
  413. }
  414. dwRes = m_bVerify2;
  415. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Verify 2"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  416. {
  417. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  418. return FALSE;
  419. }
  420. dwRes = m_bReconcile;
  421. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Reconcile"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  422. {
  423. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  424. return FALSE;
  425. }
  426. dwRes = m_bBatch;
  427. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Batch"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  428. {
  429. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  430. return FALSE;
  431. }
  432. dwRes = m_bSpecial;
  433. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Special"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  434. {
  435. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  436. return FALSE;
  437. }
  438. dwRes = m_bRemove;
  439. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Remove Spaces"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  440. {
  441. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  442. return FALSE;
  443. }
  444. }
  445. if (nMask & REGINFO_STORE_COLLECTOR)
  446. {
  447. dwRes = sizeof(TCHAR) * (_tcslen(m_szScript) + 1);
  448. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Current Script"), NULL, REG_SZ, (BYTE *) m_szScript, dwRes))
  449. {
  450. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  451. return FALSE;
  452. }
  453. dwRes = sizeof(TCHAR) * (_tcslen(m_szStation) + 1);
  454. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Station"), NULL, REG_SZ, (BYTE *) m_szStation, dwRes))
  455. {
  456. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  457. return FALSE;
  458. }
  459. dwRes = m_cxMargin;
  460. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Horizontal Margin"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  461. {
  462. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  463. return FALSE;
  464. }
  465. dwRes = m_cyMargin;
  466. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Vertical Margin"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  467. {
  468. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  469. return FALSE;
  470. }
  471. dwRes = m_cxGuides;
  472. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Horizontal Guides"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  473. {
  474. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  475. return FALSE;
  476. }
  477. dwRes = m_cyGuides;
  478. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Vertical Guides"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  479. {
  480. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  481. return FALSE;
  482. }
  483. dwRes = m_cxGap;
  484. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Horizontal Gap"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  485. {
  486. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  487. return FALSE;
  488. }
  489. dwRes = m_cyGap;
  490. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Vertical Gap"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  491. {
  492. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  493. return FALSE;
  494. }
  495. dwRes = m_cInterval;
  496. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Interval"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  497. {
  498. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  499. return FALSE;
  500. }
  501. dwRes = m_cAllow;
  502. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Allowance"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  503. {
  504. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  505. return FALSE;
  506. }
  507. dwRes = m_cAlts;
  508. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Alternate"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  509. {
  510. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  511. return FALSE;
  512. }
  513. dwRes = m_cRetry;
  514. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Retry Limit"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  515. {
  516. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  517. return FALSE;
  518. }
  519. dwRes = m_bMidline;
  520. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Midline"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  521. {
  522. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  523. return FALSE;
  524. }
  525. dwRes = m_bBaseline;
  526. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Baseline"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  527. {
  528. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  529. return FALSE;
  530. }
  531. dwRes = m_bWrap;
  532. if (ERROR_SUCCESS != RegSetValueEx(m_hkRoot, TEXT("Word Wrap"), NULL, REG_DWORD, (BYTE *) &dwRes, sizeof(DWORD)))
  533. {
  534. MessageBox((HWND) NULL, TEXT("Unable to create registry key"), TEXT("Fatal Application Error"), MB_ICONSTOP | MB_OK);
  535. return FALSE;
  536. }
  537. }
  538. return TRUE;
  539. }