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.

87 lines
2.6 KiB

  1. #include "pch.h"
  2. INT_PTR CALLBACK ProgramsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  3. {
  4. switch (uMsg)
  5. {
  6. case WM_INITDIALOG:
  7. CheckRadioButton(hDlg, IDC_PROGNOIMPORT, IDC_PROGIMPORT, IDC_PROGNOIMPORT);
  8. EnableWindow(GetDlgItem(hDlg, IDC_MODIFYPROG), FALSE);
  9. return TRUE;
  10. case UM_SAVE:
  11. {
  12. TCHAR szProgWorkDir[MAX_PATH];
  13. BOOL fCheckDirtyOnly = (BOOL) lParam;
  14. if (IsDlgButtonChecked(hDlg, IDC_PROGIMPORT) == BST_CHECKED)
  15. {
  16. if (!fCheckDirtyOnly)
  17. {
  18. PathCombine(szProgWorkDir, g_szWorkDir, TEXT("programs.wrk"));
  19. ImportPrograms(g_szInsFile, szProgWorkDir, TRUE);
  20. CheckRadioButton(hDlg, IDC_PROGNOIMPORT, IDC_PROGIMPORT, IDC_PROGNOIMPORT);
  21. EnableWindow(GetDlgItem(hDlg, IDC_MODIFYPROG), FALSE);
  22. }
  23. g_fInsDirty = TRUE;
  24. }
  25. }
  26. *((LPBOOL)wParam) = TRUE;
  27. break;
  28. case WM_CLOSE:
  29. DestroyWindow(hDlg);
  30. return FALSE;
  31. case WM_COMMAND:
  32. switch (HIWORD(wParam))
  33. {
  34. case BN_CLICKED:
  35. switch (LOWORD(wParam))
  36. {
  37. case IDC_PROGNOIMPORT:
  38. EnableWindow(GetDlgItem(hDlg, IDC_MODIFYPROG), FALSE);
  39. break;
  40. case IDC_PROGIMPORT:
  41. EnableWindow(GetDlgItem(hDlg, IDC_MODIFYPROG), TRUE);
  42. break;
  43. case IDC_MODIFYPROG:
  44. ShowInetcpl(hDlg, INET_PAGE_PROGRAMS);
  45. SetFocus(GetDlgItem(hDlg, IDC_MODIFYPROG));
  46. break;
  47. }
  48. break;
  49. }
  50. break;
  51. default:
  52. return FALSE;
  53. }
  54. return TRUE;
  55. }
  56. HRESULT ProgramsFinalCopy(LPCTSTR pcszDestDir, DWORD dwFlags, LPDWORD pdwCabState)
  57. {
  58. TCHAR szFrom[MAX_PATH];
  59. PathCombine(szFrom, g_szWorkDir, TEXT("programs.wrk"));
  60. if ((HasFlag(dwFlags, PM_CHECK) && pdwCabState != NULL) || HasFlag(dwFlags, PM_COPY))
  61. {
  62. TCHAR szFile[MAX_PATH];
  63. PathCombine(szFile, szFrom, TEXT("programs.inf"));
  64. if (HasFlag(dwFlags, PM_CHECK) && pdwCabState != NULL && PathFileExists(szFile))
  65. SetFlag(pdwCabState, CAB_TYPE_CONFIG);
  66. if (HasFlag(dwFlags, PM_COPY))
  67. CopyFileToDir(szFile, pcszDestDir);
  68. }
  69. if (HasFlag(dwFlags, PM_CLEAR))
  70. PathRemovePath(szFrom);
  71. return S_OK;
  72. }