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.

204 lines
6.1 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // MAIN.H
  4. //
  5. // Microsoft Confidential
  6. // Copyright (c) Microsoft Corporation 1998
  7. // All rights reserved
  8. //
  9. // Includes all internal and external include files, defined values, macros,
  10. // data structures, and fucntion prototypes for the corisponding CXX file.
  11. //
  12. // Original engineer: WillisC
  13. // Updated: Jason Cohen (JCOHEN)
  14. //
  15. //////////////////////////////////////////////////////////////////////////////
  16. // Only include this file once.
  17. //
  18. #ifndef _MAIN_H_
  19. #define _MAIN_H_
  20. //
  21. // Include definition(s).
  22. //
  23. //#define STRICT
  24. //#define OEMRESOURCE 1
  25. //#define _INC_OLE
  26. //#define INC_OLE2
  27. //
  28. // Include file(s).
  29. //
  30. #include <windows.h>
  31. #include <tchar.h>
  32. #include <mstask.h>
  33. #include "resource.h"
  34. #include "jcohen.h"
  35. #include "registry.h"
  36. #include "miscfunc.h"
  37. //
  38. // External defined value(s).
  39. //
  40. #define WM_PROGRESS (WM_USER + 1000)
  41. // Tuneup flags.
  42. //
  43. #define TUNEUP_CUSTOM 0x00000001 // Set if the user choose custom instead of express.
  44. #define TUNEUP_FINISHED 0x00000002 // Set when the user presses finish instead of cancel so we know to save settings.
  45. #define TUNEUP_OLDADMIN 0x00000004 // Set to use old admin UI for the startup group.
  46. #define TUNEUP_AUTORUN 0x00000008 // Set if we are just going to run all the tasks.
  47. #define TUNEUP_RUNBACKUP 0x00000010 // Set if we need to run the backup wizard at the end.
  48. #define TUNEUP_NOSCHEDULE 0x00000020 // Set if there is no current schedule.
  49. #define TUNEUP_QUIT 0x00000040 // Set when proccessing command line options if we don't want to run the wizard.
  50. // Task flags (options).
  51. //
  52. #define TASK_SCHEDULED 0x00000001 // The job is scheduled.
  53. #define TASK_NEW 0x00000002 // The job is newly created by this sessioin of Tune-up.
  54. #define TASK_NOIDLE 0x00000004 // The job doesn't wait for the computer to be idle.
  55. // Schedule settings.
  56. //
  57. #define TASK_ONCE 1
  58. #define TASK_DAILY 2
  59. #define TASK_WEEKLY 3
  60. #define TASK_MONTHLY 4
  61. #define TASK_BIMONTHLY 5
  62. #define TASK_QUARTLY 6
  63. #define TASK_YEARLY 7
  64. // Default job flags.
  65. //
  66. #define DEFAULT_TASK_FLAG TASK_FLAG_RESTART_ON_IDLE_RESUME | \
  67. TASK_FLAG_START_ONLY_IF_IDLE | \
  68. TASK_FLAG_KILL_ON_IDLE_END | \
  69. TASK_FLAG_DONT_START_IF_ON_BATTERIES | \
  70. TASK_FLAG_KILL_IF_GOING_ON_BATTERIES | \
  71. TASK_FLAG_SYSTEM_REQUIRED
  72. #define DEFAULT_TASK_FLAG2 TASK_FLAG_DONT_START_IF_ON_BATTERIES | \
  73. TASK_FLAG_KILL_IF_GOING_ON_BATTERIES | \
  74. TASK_FLAG_SYSTEM_REQUIRED
  75. // Default time scheme.
  76. //
  77. #define DEFAULT_TIMESCHEME IDC_NIGHT
  78. // Registry keys.
  79. //
  80. #define g_szTuneupKey _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Applets\\TuneUp")
  81. #define g_szRegKeyAddOns _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Applets\\TuneUp\\AddOns")
  82. #define g_szCleanUpKey _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\explorer\\VolumeCaches")
  83. #define g_szCmpAgentKey _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\CmpAgent.exe")
  84. #define g_szRegKeyProfiles _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList")
  85. // Registry values.
  86. //
  87. #define g_szRegValProfileDir _T("ProfilesDirectory")
  88. #define g_szRegValProfilePath _T("ProfileImagePath")
  89. #define g_szRegValTime _T("Time")
  90. #define g_szRegValCustom _T("Custom")
  91. #define g_szRegValChange _T("Change")
  92. #define g_szRegValFirstTime _T("@")
  93. // For the third-party addon pages.
  94. //
  95. #define g_szRegValProgram _T("Program")
  96. #define g_szRegValProgParam _T("ProgParam")
  97. #define g_szRegValSettings _T("Settings")
  98. #define g_szRegValSetParam _T("SetParam")
  99. #define g_szRegValJobName _T("JobName")
  100. #define g_szRegValComment _T("Comment")
  101. #define g_szRegValSchedule _T("Schedule")
  102. #define g_szRegValTitle _T("Title")
  103. #define g_szRegValSubtitle _T("Subtitle")
  104. #define g_szRegValDescription _T("Description")
  105. #define REG_VAL_ACTION _T("Action")
  106. #define g_szRegValYesAction _T("YesOpt")
  107. #define g_szRegValNoAction _T("NoOpt")
  108. #define g_szRegValSummary _T("Summary")
  109. // Other strings.
  110. //
  111. #define g_szBackupExe _T("NTBACKUP.EXE")
  112. //
  113. // External defined macro(s).
  114. //
  115. #ifdef _UNICODE
  116. #define ANSIWCHAR(lpw, lpa, cb) lpw = lpa
  117. #define WCHARANSI(lpa, lpw, cb) lpa = lpw
  118. #else // _UNICODE
  119. #define ANSIWCHAR(lpw, lpa, cb) MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, lpa, -1, lpw, cb / 2)
  120. #define WCHARANSI(lpa, lpw, cb) WideCharToMultiByte(CP_ACP, 0, lpw, -1, lpa, cb, NULL, NULL)
  121. #endif // _UNICODE
  122. //
  123. // External structure(s).
  124. //
  125. typedef struct _TASKDATA
  126. {
  127. // Task scheduler job settings.
  128. //
  129. LPTSTR lpFullPathName; // Full path and file name of the app.
  130. LPTSTR lpParameters; // Parameters to use when running the task.
  131. LPTSTR lpSetName; // Full path and file name of the settings command (if NULL, lpFullPathName is used).
  132. LPTSTR lpSetParam; // Parameters to use with the settings command.
  133. LPTSTR lpJobName; // Name of the job file (.JOB).
  134. LPTSTR lpComment; // Comment string for the task scheduler job.
  135. DWORD dwFlags; // Original flag in ITask.
  136. ITask *pTask; // Pointer to the ITask object for the task scheduler job.
  137. TASK_TRIGGER Trigger; // Trigger structure.
  138. // Tuneup settings.
  139. //
  140. DWORD dwOptions; // Flags used by tuneup.
  141. INT nSchedule; // Whether task is once, daily, weekly, monthly, bimonthly, quarterly, or yearly.
  142. // Wizard page settings.
  143. //
  144. INT nPageID; // Resource ID for the dialog used in the wizard page.
  145. LPTSTR lpTitle; // Title of the wizard page usually in the form of MAKEINTRESOURCE(ID_STRING).
  146. LPTSTR lpSubTitle; // Subtitle of the wizard (same form as above).
  147. LPTSTR lpDescription; // Description of the task used on the wizard page (same form as above).
  148. LPTSTR lpYesAction; // String used in the Yes text.
  149. LPTSTR lpNoAction; // String used in the No text.
  150. LPTSTR lpSummary; // String used in on the summary page.
  151. // Pointers for the doubly linked list.
  152. //
  153. struct _TASKDATA *lpNext;
  154. struct _TASKDATA *lpBack;
  155. }
  156. TASKDATA, *PTASKDATA, *LPTASKDATA;
  157. //
  158. // External global variable(s).
  159. //
  160. extern HWND g_hWnd;
  161. extern HINSTANCE g_hInst;
  162. extern DWORD g_dwFlags;
  163. extern LPTASKDATA g_Tasks;
  164. extern LPTASKDATA g_CurrentTask;
  165. extern INT g_nTimeScheme;
  166. extern TCHAR g_szAppName[64];
  167. #endif // _MAIN_H_