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.

544 lines
18 KiB

  1. // Created 04-Jan-1993 1:10pm by Jeff Parsons
  2. #include "shellprv.h"
  3. #pragma hdrstop
  4. #ifdef _X86_
  5. BINF abinfPrg[] = {
  6. {IDC_CLOSEONEXIT, BITNUM(PRG_CLOSEONEXIT)},
  7. };
  8. // Per-Dialog data
  9. typedef struct PRGINFO { /* pi */
  10. PPROPLINK ppl;
  11. HICON hIcon;
  12. TCHAR atchIconFile[PIFDEFFILESIZE];
  13. WORD wIconIndex;
  14. LPVOID hConfig;
  15. LPVOID hAutoexec;
  16. WORD flPrgInitPrev;
  17. BOOL fCfgSetByWiz;
  18. } PRGINFO;
  19. typedef PRGINFO * PPRGINFO; /* ppi */
  20. // Private function prototypes
  21. void InitPrgDlg(HWND hDlg, PPRGINFO ppi);
  22. void AdjustMSDOSModeControls(PPROPLINK ppl, HWND hDlg);
  23. void ApplyPrgDlg(HWND hDlg, PPRGINFO ppi);
  24. void BrowseIcons(HWND hDlg, PPRGINFO ppi);
  25. BOOL_PTR CALLBACK DlgPifNtProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  26. WORD InitNtPifDlg(HWND hDlg, register PPRGINFO ppi);
  27. void ApplyNtPifDlg( HWND hDlg, PPRGINFO ppi );
  28. // Context-sensitive help ids
  29. const static DWORD rgdwHelp[] = {
  30. IDC_ICONBMP, IDH_DOS_PROGRAM_ICON,
  31. IDC_TITLE, IDH_DOS_PROGRAM_DESCRIPTION,
  32. IDC_CMDLINE, IDH_DOS_PROGRAM_CMD_LINE,
  33. IDC_CMDLINELBL, IDH_DOS_PROGRAM_CMD_LINE,
  34. IDC_WORKDIR, IDH_DOS_PROGRAM_WORKDIR,
  35. IDC_WORKDIRLBL, IDH_DOS_PROGRAM_WORKDIR,
  36. IDC_HOTKEY, IDH_DOS_PROGRAM_SHORTCUT,
  37. IDC_HOTKEYLBL, IDH_DOS_PROGRAM_SHORTCUT,
  38. IDC_BATCHFILE, IDH_DOS_PROGRAM_BATCH,
  39. IDC_BATCHFILELBL, IDH_DOS_PROGRAM_BATCH,
  40. IDC_WINDOWSTATE, IDH_DOS_PROGRAM_RUN,
  41. IDC_WINDOWSTATELBL, IDH_DOS_PROGRAM_RUN,
  42. IDC_CLOSEONEXIT, IDH_DOS_WINDOWS_QUIT_CLOSE,
  43. IDC_CHANGEICON, IDH_DOS_PROGRAM_CHANGEICON,
  44. IDC_ADVPROG, IDH_DOS_PROGRAM_ADV_BUTTON,
  45. 0, 0
  46. };
  47. const static DWORD rgdwNTHelp[] = {
  48. IDC_DOS, IDH_COMM_GROUPBOX,
  49. 10, IDH_DOS_ADV_AUTOEXEC,
  50. 11, IDH_DOS_ADV_CONFIG,
  51. IDC_NTTIMER, IDH_DOS_PROGRAM_PIF_TIMER_EMULATE,
  52. 0, 0
  53. };
  54. BOOL_PTR CALLBACK DlgPrgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  55. {
  56. PPRGINFO ppi = (PPRGINFO)GetWindowLongPtr(hDlg, DWLP_USER);
  57. switch (uMsg) {
  58. case WM_INITDIALOG:
  59. // allocate dialog instance data
  60. if (NULL != (ppi = (PPRGINFO)LocalAlloc(LPTR, SIZEOF(PRGINFO)))) {
  61. ppi->ppl = (PPROPLINK)((LPPROPSHEETPAGE)lParam)->lParam;
  62. SetWindowLongPtr(hDlg, DWLP_USER, (LPARAM)ppi);
  63. SHAutoComplete(GetDlgItem(hDlg, IDC_CMDLINE), 0);
  64. SHAutoComplete(GetDlgItem(hDlg, IDC_WORKDIR), 0);
  65. SHAutoComplete(GetDlgItem(hDlg, IDC_BATCHFILE), 0);
  66. InitPrgDlg(hDlg, ppi);
  67. } else {
  68. EndDialog(hDlg, FALSE); // fail the dialog create
  69. }
  70. break;
  71. case WM_DESTROY:
  72. // free the ppi
  73. if (ppi) {
  74. EVAL(LocalFree(ppi) == NULL);
  75. SetWindowLongPtr(hDlg, DWLP_USER, 0);
  76. }
  77. break;
  78. HELP_CASES(rgdwHelp) // handle help messages
  79. case WM_COMMAND:
  80. if (LOWORD(lParam) == 0)
  81. break; // message not from a control
  82. switch (LOWORD(wParam)) {
  83. case IDC_TITLE:
  84. case IDC_CMDLINE:
  85. case IDC_WORKDIR:
  86. case IDC_BATCHFILE:
  87. case IDC_HOTKEY:
  88. if (HIWORD(wParam) == EN_CHANGE)
  89. SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)hDlg, 0L);
  90. break;
  91. case IDC_WINDOWSTATE:
  92. if (HIWORD(wParam) == CBN_SELCHANGE)
  93. SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)hDlg, 0L);
  94. break;
  95. case IDC_CLOSEONEXIT:
  96. if (HIWORD(wParam) == BN_CLICKED)
  97. SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)hDlg, 0L);
  98. break;
  99. case IDC_ADVPROG:
  100. if (HIWORD(wParam) == BN_CLICKED) {
  101. DialogBoxParam(HINST_THISDLL,
  102. MAKEINTRESOURCE(IDD_PIFNTTEMPLT),
  103. hDlg,
  104. DlgPifNtProc,
  105. (LPARAM)ppi);
  106. }
  107. return FALSE; // return 0 if we process WM_COMMAND
  108. case IDC_CHANGEICON:
  109. if (HIWORD(wParam) == BN_CLICKED)
  110. BrowseIcons(hDlg, ppi);
  111. return FALSE; // return 0 if we process WM_COMMAND
  112. }
  113. break;
  114. case WM_NOTIFY:
  115. switch (((NMHDR *)lParam)->code) {
  116. case PSN_KILLACTIVE:
  117. // This gives the current page a chance to validate itself
  118. break;
  119. case PSN_APPLY:
  120. // This happens on OK....
  121. ApplyPrgDlg(hDlg, ppi);
  122. break;
  123. case PSN_RESET:
  124. // This happens on Cancel....
  125. break;
  126. }
  127. break;
  128. default:
  129. return FALSE; // return 0 when not processing
  130. }
  131. return TRUE;
  132. }
  133. void InitPrgDlg(HWND hDlg, register PPRGINFO ppi)
  134. {
  135. int i;
  136. PROPPRG prg;
  137. PROPENV env;
  138. PROPNT40 nt40;
  139. PPROPLINK ppl = ppi->ppl;
  140. TCHAR szBuf[MAX_STRING_SIZE];
  141. FunctionName(InitPrgDlg);
  142. ASSERTTRUE(ppl->iSig == PROP_SIG);
  143. if (!PifMgr_GetProperties(ppl, MAKELP(0,GROUP_PRG),
  144. &prg, SIZEOF(prg), GETPROPS_NONE
  145. ) ||
  146. !PifMgr_GetProperties(ppl, MAKELP(0,GROUP_ENV),
  147. &env, SIZEOF(env), GETPROPS_NONE
  148. )
  149. ||
  150. !PifMgr_GetProperties(ppl, MAKELP(0,GROUP_NT40),
  151. &nt40, SIZEOF(nt40), GETPROPS_NONE
  152. )
  153. ) {
  154. Warning(hDlg, IDS_QUERY_ERROR, MB_ICONEXCLAMATION | MB_OK);
  155. return;
  156. }
  157. /*
  158. * Initialize Icon and IconFile information
  159. *
  160. */
  161. ppi->wIconIndex = prg.wIconIndex;
  162. StringCchCopyW(ppi->atchIconFile, ARRAYSIZE(ppi->atchIconFile), nt40.awchIconFile);
  163. if (NULL != (ppi->hIcon = LoadPIFIcon(&prg, &nt40))) {
  164. VERIFYFALSE(SendDlgItemMessage(hDlg, IDC_ICONBMP, STM_SETICON, (WPARAM)ppi->hIcon, 0));
  165. }
  166. /*
  167. * Initialize window Title information
  168. *
  169. */
  170. LimitDlgItemText(hDlg, IDC_TITLE, ARRAYSIZE(prg.achTitle)-1);
  171. SetDlgItemTextW(hDlg, IDC_TITLE, nt40.awchTitle);
  172. /*
  173. * Initialize command line information
  174. *
  175. */
  176. LimitDlgItemText(hDlg, IDC_CMDLINE, ARRAYSIZE(prg.achCmdLine)-1);
  177. SetDlgItemTextW(hDlg, IDC_CMDLINE, nt40.awchCmdLine);
  178. /*
  179. * Initialize command line information
  180. *
  181. */
  182. LimitDlgItemText(hDlg, IDC_WORKDIR, ARRAYSIZE(prg.achWorkDir)-1);
  183. SetDlgItemTextW(hDlg, IDC_WORKDIR, nt40.awchWorkDir);
  184. /*
  185. * Require at least one of Ctrl, Alt or Shift to be pressed.
  186. * The hotkey control does not enforce the rule on function keys
  187. * and other specials, which is good.
  188. */
  189. SendDlgItemMessage(hDlg, IDC_HOTKEY, HKM_SETRULES, HKCOMB_NONE, HOTKEYF_CONTROL | HOTKEYF_ALT);
  190. SendDlgItemMessage(hDlg, IDC_HOTKEY, HKM_SETHOTKEY, prg.wHotKey, 0);
  191. /*
  192. * Initialize batch file information
  193. *
  194. */
  195. LimitDlgItemText(hDlg, IDC_BATCHFILE, ARRAYSIZE(env.achBatchFile)-1);
  196. SetDlgItemTextW(hDlg, IDC_BATCHFILE, nt40.awchBatchFile);
  197. /*
  198. * Fill in the "Run" combo box.
  199. */
  200. for (i=0; i < 3; i++) {
  201. VERIFYTRUE(LoadString(HINST_THISDLL, IDS_NORMALWINDOW+i, szBuf, ARRAYSIZE(szBuf)));
  202. VERIFYTRUE((int)SendDlgItemMessage(hDlg, IDC_WINDOWSTATE, CB_ADDSTRING, 0, (LPARAM)(LPTSTR)szBuf) == i);
  203. }
  204. i = 0;
  205. if (prg.flPrgInit & PRGINIT_MINIMIZED)
  206. i = 1;
  207. if (prg.flPrgInit & PRGINIT_MAXIMIZED)
  208. i = 2;
  209. SendDlgItemMessage(hDlg, IDC_WINDOWSTATE, CB_SETCURSEL, i, 0);
  210. SetDlgBits(hDlg, &abinfPrg[0], ARRAYSIZE(abinfPrg), prg.flPrg);
  211. AdjustMSDOSModeControls(ppl, hDlg);
  212. }
  213. void AdjustMSDOSModeControls(PPROPLINK ppl, HWND hDlg)
  214. {
  215. int i;
  216. BOOL f = TRUE;
  217. AdjustRealModeControls(ppl, hDlg);
  218. /*
  219. * The working directory and startup batch file controls are only
  220. * supported in real-mode if there is a private configuration (only
  221. * because it's more work). So, disable the controls appropriately.
  222. */
  223. if (ppl->flProp & PROP_REALMODE) {
  224. f = (PifMgr_GetProperties(ppl, szCONFIGHDRSIG40, NULL, 0, GETPROPS_NONE) != 0 ||
  225. PifMgr_GetProperties(ppl, szAUTOEXECHDRSIG40, NULL, 0, GETPROPS_NONE) != 0);
  226. }
  227. #if (IDC_WORKDIRLBL != IDC_WORKDIR-1)
  228. #error Error in IDC constants: IDC_WORKDIRLBL != IDC_WORKDIR-1
  229. #endif
  230. #if (IDC_WORKDIR != IDC_BATCHFILELBL-1)
  231. #error Error in IDC constants: IDC_WORKDIR != IDC_BATCHFILELBL-1
  232. #endif
  233. #if (IDC_BATCHFILELBL != IDC_BATCHFILE-1)
  234. #error Error in IDC constants: IDC_BATCHFILELBL != IDC_BATCHFILE-1
  235. #endif
  236. for (i=IDC_WORKDIRLBL; i<=IDC_BATCHFILE; i++)
  237. EnableWindow(GetDlgItem(hDlg, i), f);
  238. }
  239. void ApplyPrgDlg(HWND hDlg, PPRGINFO ppi)
  240. {
  241. int i;
  242. PROPPRG prg;
  243. PROPENV env;
  244. PROPNT40 nt40;
  245. PPROPLINK ppl = ppi->ppl;
  246. FunctionName(ApplyPrgDlg);
  247. ASSERTTRUE(ppl->iSig == PROP_SIG);
  248. // Get the current set of properties, then overlay the new settings
  249. if (!PifMgr_GetProperties(ppl, MAKELP(0,GROUP_PRG),
  250. &prg, SIZEOF(prg), GETPROPS_NONE
  251. ) ||
  252. !PifMgr_GetProperties(ppl, MAKELP(0,GROUP_ENV),
  253. &env, SIZEOF(env), GETPROPS_NONE
  254. )
  255. ||
  256. !PifMgr_GetProperties(ppl, MAKELP(0,GROUP_NT40),
  257. &nt40, SIZEOF(nt40), GETPROPS_NONE
  258. )
  259. ) {
  260. Warning(hDlg, IDS_UPDATE_ERROR, MB_ICONEXCLAMATION | MB_OK);
  261. return;
  262. }
  263. // Retrieve Icon information
  264. StringCchCopyW(nt40.awchIconFile, ARRAYSIZE(nt40.awchIconFile), ppi->atchIconFile );
  265. PifMgr_WCtoMBPath( nt40.awchIconFile, nt40.achSaveIconFile, ARRAYSIZE(nt40.achSaveIconFile) );
  266. StringCchCopyA( prg.achIconFile, ARRAYSIZE(prg.achIconFile), nt40.achSaveIconFile );
  267. prg.wIconIndex = ppi->wIconIndex;
  268. // Retrieve strings for Title, Command Line,
  269. // Working Directory and Batch File
  270. // Title
  271. GetDlgItemTextW(hDlg, IDC_TITLE, nt40.awchTitle, ARRAYSIZE(nt40.awchTitle));
  272. GetDlgItemTextA(hDlg, IDC_TITLE, nt40.achSaveTitle, ARRAYSIZE(nt40.achSaveTitle));
  273. nt40.awchTitle[ ARRAYSIZE(nt40.awchTitle)-1 ] = TEXT('\0');
  274. nt40.achSaveTitle[ ARRAYSIZE(nt40.achSaveTitle)-1 ] = '\0';
  275. StringCchCopyA( prg.achTitle, ARRAYSIZE(prg.achTitle), nt40.achSaveTitle );
  276. // Command Line
  277. GetDlgItemTextW(hDlg, IDC_CMDLINE, nt40.awchCmdLine, ARRAYSIZE(nt40.awchCmdLine));
  278. GetDlgItemTextA(hDlg, IDC_CMDLINE, nt40.achSaveCmdLine, ARRAYSIZE(nt40.achSaveCmdLine));
  279. nt40.awchCmdLine[ ARRAYSIZE(nt40.awchCmdLine)-1 ] = TEXT('\0');
  280. nt40.achSaveCmdLine[ ARRAYSIZE(nt40.achSaveCmdLine)-1 ] = '\0';
  281. StringCchCopyA( prg.achCmdLine, ARRAYSIZE(prg.achCmdLine), nt40.achSaveCmdLine );
  282. // Working Directory
  283. GetDlgItemTextW(hDlg, IDC_WORKDIR, nt40.awchWorkDir, ARRAYSIZE(nt40.awchWorkDir));
  284. nt40.awchWorkDir[ ARRAYSIZE(nt40.awchWorkDir)-1 ] = TEXT('\0');
  285. PifMgr_WCtoMBPath(nt40.awchWorkDir, nt40.achSaveWorkDir, ARRAYSIZE(nt40.achSaveWorkDir));
  286. StringCchCopyA(prg.achWorkDir, ARRAYSIZE(prg.achWorkDir), nt40.achSaveWorkDir);
  287. // Batch File
  288. GetDlgItemTextW(hDlg, IDC_BATCHFILE, nt40.awchBatchFile, ARRAYSIZE(nt40.awchBatchFile));
  289. nt40.awchBatchFile[ ARRAYSIZE(nt40.awchBatchFile)-1 ] = TEXT('\0');
  290. PifMgr_WCtoMBPath(nt40.awchBatchFile, nt40.achSaveBatchFile, ARRAYSIZE(nt40.achSaveBatchFile));
  291. StringCchCopyA(env.achBatchFile, ARRAYSIZE(env.achBatchFile), nt40.achSaveBatchFile);
  292. prg.wHotKey = (WORD)SendDlgItemMessage(hDlg, IDC_HOTKEY, HKM_GETHOTKEY, 0, 0);
  293. i = (int)SendDlgItemMessage(hDlg, IDC_WINDOWSTATE, CB_GETCURSEL, 0, 0);
  294. prg.flPrgInit &= ~(PRGINIT_MINIMIZED | PRGINIT_MAXIMIZED);
  295. if (i == 1)
  296. prg.flPrgInit |= PRGINIT_MINIMIZED;
  297. if (i == 2)
  298. prg.flPrgInit |= PRGINIT_MAXIMIZED;
  299. GetDlgBits(hDlg, &abinfPrg[0], ARRAYSIZE(abinfPrg), &prg.flPrg);
  300. if (!PifMgr_SetProperties(ppl, MAKELP(0,GROUP_PRG),
  301. &prg, SIZEOF(prg), SETPROPS_NONE) ||
  302. !PifMgr_SetProperties(ppl, MAKELP(0,GROUP_ENV),
  303. &env, SIZEOF(env), SETPROPS_NONE)
  304. ||
  305. !PifMgr_SetProperties(ppl, MAKELP(0,GROUP_NT40),
  306. &nt40, SIZEOF(nt40), SETPROPS_NONE)
  307. )
  308. Warning(hDlg, IDS_UPDATE_ERROR, MB_ICONEXCLAMATION | MB_OK);
  309. else
  310. if (ppl->hwndNotify) {
  311. ppl->flProp |= PROP_NOTIFY;
  312. PostMessage(ppl->hwndNotify, ppl->uMsgNotify, SIZEOF(prg), (LPARAM)MAKELP(0,GROUP_PRG));
  313. PostMessage(ppl->hwndNotify, ppl->uMsgNotify, SIZEOF(env), (LPARAM)MAKELP(0,GROUP_ENV));
  314. PostMessage(ppl->hwndNotify, ppl->uMsgNotify, SIZEOF(nt40), (LPARAM)MAKELP(0,GROUP_NT40));
  315. }
  316. }
  317. void BrowseIcons(HWND hDlg, PPRGINFO ppi)
  318. {
  319. HICON hIcon;
  320. int wIconIndex = (int)ppi->wIconIndex;
  321. if (PickIconDlg(hDlg, ppi->atchIconFile, ARRAYSIZE(ppi->atchIconFile), (int *)&wIconIndex)) {
  322. hIcon = ExtractIcon(HINST_THISDLL, ppi->atchIconFile, wIconIndex);
  323. if ((UINT_PTR)hIcon <= 1)
  324. Warning(hDlg, IDS_NO_ICONS, MB_ICONINFORMATION | MB_OK);
  325. else {
  326. ppi->hIcon = hIcon;
  327. ppi->wIconIndex = (WORD)wIconIndex;
  328. hIcon = (HICON)SendDlgItemMessage(hDlg, IDC_ICONBMP, STM_SETICON, (WPARAM)ppi->hIcon, 0);
  329. if (hIcon)
  330. VERIFYTRUE(DestroyIcon(hIcon));
  331. }
  332. }
  333. }
  334. BOOL_PTR CALLBACK DlgPifNtProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  335. {
  336. PPRGINFO ppi = (PPRGINFO)GetWindowLongPtr( hDlg, DWLP_USER );
  337. switch (uMsg)
  338. {
  339. case WM_INITDIALOG:
  340. ppi = (PPRGINFO)lParam;
  341. SetWindowLongPtr(hDlg, DWLP_USER, lParam);
  342. InitNtPifDlg(hDlg, ppi);
  343. break;
  344. case WM_DESTROY:
  345. SetWindowLongPtr(hDlg, DWLP_USER, 0);
  346. break;
  347. HELP_CASES(rgdwNTHelp) // handle help messages
  348. case WM_COMMAND:
  349. switch (LOWORD(wParam)) {
  350. case IDOK:
  351. case IDC_OK:
  352. ApplyNtPifDlg(hDlg, ppi);
  353. // fall through
  354. case IDCANCEL:
  355. case IDC_CANCEL :
  356. EndDialog(hDlg, 0);
  357. return FALSE; // return 0 if we process WM_COMMAND
  358. case IDC_NTTIMER:
  359. CheckDlgButton(hDlg, IDC_NTTIMER, !IsDlgButtonChecked(hDlg, IDC_NTTIMER));
  360. break;
  361. }
  362. break;
  363. default:
  364. return(FALSE);
  365. }
  366. return(TRUE);
  367. }
  368. WORD InitNtPifDlg(HWND hDlg, register PPRGINFO ppi)
  369. {
  370. PROPNT31 nt31;
  371. PPROPLINK ppl = ppi->ppl;
  372. FunctionName(InitAdvPrgDlg);
  373. ASSERTTRUE(ppl->iSig == PROP_SIG);
  374. if (!PifMgr_GetProperties(ppl, MAKELP(0,GROUP_NT31),
  375. &nt31, SIZEOF(nt31), GETPROPS_NONE)
  376. ) {
  377. Warning(hDlg, IDS_QUERY_ERROR, MB_ICONEXCLAMATION | MB_OK);
  378. return 0;
  379. }
  380. // initialize the DLG controls
  381. SetDlgItemTextA( hDlg, IDC_CONFIGNT, nt31.achConfigFile );
  382. SetDlgItemTextA( hDlg, IDC_AUTOEXECNT, nt31.achAutoexecFile );
  383. if (nt31.dwWNTFlags & COMPAT_TIMERTIC)
  384. CheckDlgButton( hDlg, IDC_NTTIMER, 1 );
  385. else
  386. CheckDlgButton( hDlg, IDC_NTTIMER, 0 );
  387. SHAutoComplete(GetDlgItem(hDlg, IDC_AUTOEXECNT), 0);
  388. SHAutoComplete(GetDlgItem(hDlg, IDC_CONFIGNT), 0);
  389. return 0;
  390. }
  391. void ApplyNtPifDlg( HWND hDlg, PPRGINFO ppi )
  392. {
  393. PROPNT31 nt31;
  394. PPROPLINK ppl = ppi->ppl;
  395. ASSERTTRUE(ppl->iSig == PROP_SIG);
  396. // Get current set of properties, then overlay new settings
  397. if (!PifMgr_GetProperties(ppl, MAKELP(0,GROUP_NT31),
  398. &nt31, SIZEOF(nt31), GETPROPS_NONE)
  399. ) {
  400. Warning(hDlg, IDS_UPDATE_ERROR, MB_ICONEXCLAMATION | MB_OK);
  401. return;
  402. }
  403. GetDlgItemTextA( hDlg,
  404. IDC_CONFIGNT,
  405. nt31.achConfigFile,
  406. ARRAYSIZE( nt31.achConfigFile )
  407. );
  408. GetDlgItemTextA( hDlg,
  409. IDC_AUTOEXECNT,
  410. nt31.achAutoexecFile,
  411. ARRAYSIZE( nt31.achAutoexecFile )
  412. );
  413. nt31.dwWNTFlags &= (~COMPAT_TIMERTIC);
  414. if (IsDlgButtonChecked( hDlg, IDC_NTTIMER ))
  415. nt31.dwWNTFlags |= COMPAT_TIMERTIC;
  416. if (!PifMgr_SetProperties(ppl, MAKELP(0,GROUP_NT31),
  417. &nt31, SIZEOF(nt31), SETPROPS_NONE)) {
  418. Warning(hDlg, IDS_UPDATE_ERROR, MB_ICONEXCLAMATION | MB_OK);
  419. }
  420. if (ppl->hwndNotify) {
  421. PostMessage(ppl->hwndNotify, ppl->uMsgNotify, SIZEOF(nt31), (LPARAM)MAKELP(0,GROUP_NT31));
  422. }
  423. }
  424. HICON LoadPIFIcon(LPPROPPRG lpprg, LPPROPNT40 lpnt40)
  425. {
  426. HICON hIcon = NULL;
  427. WCHAR awchTmp[ MAX_PATH ];
  428. StringCchCopy(awchTmp, ARRAYSIZE(awchTmp), lpnt40->awchIconFile );
  429. PifMgr_WCtoMBPath( awchTmp, lpprg->achIconFile, ARRAYSIZE(lpprg->achIconFile) );
  430. hIcon = ExtractIcon(HINST_THISDLL, awchTmp, lpprg->wIconIndex);
  431. if ((DWORD_PTR)hIcon <= 1) { // 0 means none, 1 means bad file
  432. hIcon = NULL;
  433. }
  434. return hIcon;
  435. }
  436. #endif // X86