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.

392 lines
15 KiB

  1. /****************************************************************************\
  2. MAIN.H / OPK Wizard (OPKWIZ.EXE)
  3. Microsoft Confidential
  4. Copyright (c) Microsoft Corporation 1999
  5. All rights reserved
  6. Main header file for the OPK Wizard.
  7. 3/99 - Jason Cohen (JCOHEN)
  8. Added this new main header file for the OPK Wizard as part of the
  9. Millennium rewrite.
  10. 09/2000 - Stephen Lodwick (STELO)
  11. Ported OPK Wizard to Whistler
  12. \****************************************************************************/
  13. #ifndef _MAIN_H_
  14. #define _MAIN_H_
  15. //
  16. // Include File(s):
  17. //
  18. #include "debugapi.h"
  19. #include "miscapi.h"
  20. #include "comres.h"
  21. #include <winbom.h>
  22. #include <strsafe.h>
  23. //
  24. // Defined Value(s):
  25. //
  26. // Do not display the license for the system builders
  27. //
  28. #define NO_LICENSE // Comment this value if you want the license to appear during the wizard
  29. //#define BRANDTITLE // Comment this value if you do not want the Browswer Title wizard page to be displayed
  30. //#define HELPCENTER // Comment this value if you do not want the help center wizard page to be displayed
  31. //#define USEHELP // Comment the value if you do not want to use help throughout the wizard
  32. // App defined flags.
  33. //
  34. #define OPK_OEM 0x00000008 // Set if the OEM tag file exists on startup.
  35. #define OPK_DBCS 0x00000010 // Set if DBCS is defined when built.
  36. #define OPK_MAINTMODE 0x00000020 // Set if the user chooses an existing config to open.
  37. #define OPK_EXIT 0x00000040
  38. #define OPK_CMDMM 0x00000080 // Set if the user chooses an existing config via the command line.
  39. #define OPK_CREATED 0x00000100 // Set once the temp directory is created.
  40. #define OPK_BATCHMODE 0x00000200 // Set if the user chooses to run the wizard in batch mode.
  41. #define OPK_INSMODE 0x00000400 // Set if user wants to provide IE install file with batch mode
  42. #define OPK_AUTORUN 0x00000800 // Set if user is running autorun mode
  43. #define OPK_WELCOME 0x00002000 // Set if the user has already seen the welcome dialog
  44. #define OPK_OPENCONFIG 0x00004000 // Set if the user has selected to open a config set
  45. #define OPK_ACTIVEWIZ 0x00008000 // Set if the wizard is currently running
  46. // OS version defines used when checking dwOsVer in the golbal data structure.
  47. //
  48. #define OS_NT4 0x00040000
  49. #define OS_NT4_SP1 0x00040001
  50. #define OS_NT4_SP2 0x00040002
  51. #define OS_NT4_SP3 0x00040003
  52. #define OS_NT4_SP4 0x00040004
  53. #define OS_NT4_SP5 0x00040005
  54. #define OS_W2K 0x00050000
  55. #define OS_W2K_SP1 0x00050001
  56. #define OS_W2K_SP2 0x00050002
  57. #define OS_XP 0x00050100
  58. // Custom messages.
  59. //
  60. #define WM_SUBWNDPROC WM_APP + 1
  61. #define WM_SETSEL WM_APP + 2
  62. #define WM_FINISHED WM_APP + 3
  63. #define WM_APP_STARTCOPY WM_APP + 4
  64. // Used by IDD_SKU's dialog proc (SkuDlgProc) to tell when the progress
  65. // is finished. WPARAM contains the error code (1 for success or 0 for failure).
  66. // LPARAM is always 0.
  67. //
  68. #define WM_COPYFINISHED WM_APP + 5
  69. #define KEY_ESC 27
  70. // Bufer sizes.
  71. //
  72. #define MAX_URL 2048
  73. #define MAX_ICON MAX_PATH
  74. #define MAX_STRING 512
  75. #define MAX_SECTION 32767
  76. #define INF_BUF_SIZE 16768
  77. #define MAX_INFOLEN 82
  78. #define MAX_KEY 48
  79. #define MAX_BTOOLBAR_TEXT 10
  80. // Macros for getting/setting the flags.
  81. //
  82. #ifdef GET_FLAG
  83. #undef GET_FLAG
  84. #endif // GET_FLAG
  85. #define GET_FLAG(b) ( g_App.dwFlags & b )
  86. #ifdef SET_FLAG
  87. #undef SET_FLAG
  88. #endif // SET_FLAG
  89. #define SET_FLAG(b, f) ( (f) ? (g_App.dwFlags |= b) : (g_App.dwFlags &= ~b) )
  90. // Help ids.
  91. //
  92. #define IDH_DEFAULT 101
  93. #define IDH_DETHELP 102
  94. #define IDH_DISKDUP 103
  95. #define IDH_SCREENS 104
  96. #define IDH_MEDIA 105
  97. #define IDH_WELCOME 106
  98. #define IDH_LOGO 107
  99. #define IDH_FINISH 108
  100. #define IDH_OEMINFO 109
  101. #define IDH_APPINSTALL 110
  102. #define IDH_DEVCLASS 111
  103. #define IDH_CDNETW 112
  104. #define IDH_DISABLENET 113
  105. #define IDH_MODESEL 114
  106. #define IDH_REALMODE_INFO 115
  107. #define IDH_REALMODE 116
  108. #define IDH_LICENSE 117
  109. #define IDH_FIRSTRUN 118
  110. #define IDH_FAVORITES 119
  111. #define IDH_IECUST 120
  112. #define IDH_ISP 121
  113. #define IDH_USERREG 122
  114. #define IDH_OEMCUST 123
  115. #define IDH_SANDBOX 124
  116. #define IDH_ACTIVEDESK 125
  117. #define IDH_OEMCHAN 126
  118. #define IDH_OOBEUSB 127
  119. #define IDH_CONFIG 128
  120. #define IDH_SCREENSTWO 129
  121. #define IDH_BTITLE 130
  122. #define IDH_BTOOLBAR 131
  123. #define IDH_CHANNELS 132
  124. #define IDH_COMPLETED 133
  125. #define IDH_HELPCENT 134
  126. #define IDH_STARTMENU_MFU 135
  127. #define IDH_OEMFOLDER 136
  128. #define IDH_TARGETLANG 137
  129. #define IDH_TARGET 150
  130. #define IDH_ANSW_FILE 400 //New or Existing Answer File
  131. #define IDH_PROD_INST 401 //Product to Install
  132. #define IDH_CHZ_PLAT 402 //Platform
  133. #define IDH_USER_INTER 403 //User Interaction Level
  134. #define IDH_DIST_FLDR 404 //Distribution Folder
  135. #define IDH_LOC_SETUP 405 //Location of Setup Files
  136. #define IDH_CUST_SOFT 406 //Customize the Software, General Settings
  137. #define IDH_DSIP_SETG 407 //Display Settings, General Settings
  138. #define IDH_TIME_ZONE 408 //Time Zone, General Settings
  139. #define IDH_LICE_MODE 409 //Licensing Mode, Network Settings
  140. #define IDH_COMP_NAME 410 //Computer Name, Network Settings
  141. #define IDH_COMP_NAMZ 411 //Computer Names, Network Settings
  142. #define IDH_ADMN_PASS 412 //Administrator Password, Network Settings
  143. #define IDH_NET_COMPS 413 //Networking Components, Network Settings
  144. #define IDH_WKGP_DOMN 414 //Workgroup or Domain, Network Settings
  145. #define IDH_TELE_PHNY 415 //Telephony, Advanced Settings
  146. #define IDH_REGN_STGS 416 //Regional Settings, Advanced Settings
  147. #define IDH_LANGS 417 //Languages, Advanced Settings
  148. #define IDH_BROW_SHELL 418 //Browser and Shell Settings, Advanced Settings
  149. #define IDH_INST_FLDR 419 //Installation Folder, Advanced Settings
  150. #define IDH_INST_PRTR 420 //Install Printers, Advanced Settings
  151. #define IDH_RUN_ONCE 421 //Run Once, Advanced Settings
  152. #define IDH_ADDL_CMND 422 //Additional Commands, Advanced Settings
  153. #define IDH_OEM_DUPE 423 //OEM Duplicator String, Advanced Settings
  154. #define IDH_SIF_RIS 424 //Setup Information File Text, Advanced Settings
  155. #define IDH_PROD_KEY 425 // Product Key
  156. #define IDH_LIC_AGR 426 //License Agreement
  157. //
  158. // INI strings
  159. //
  160. // INI Sections
  161. //
  162. #define INI_SEC_CONFIGSET _T("ConfigSet")
  163. #define INI_SEC_OPTIONS _T("Options")
  164. #define INI_SEC_ADVANCED _T("Advanced")
  165. #define INI_SEC_TOOLBAR _T("BrowserToolbars")
  166. #define INI_SEC_STARTUP _T("StartupOptions")
  167. #define INI_SEC_SIGNUP _T("Signup")
  168. #define INI_SEC_ISPFOLDER _T("ISPFolder")
  169. #define INI_SEC_OEMCUST _T("OemCust")
  170. #define INI_SEC_GENERAL _T("General")
  171. #define INI_SEC_URL _T("URL")
  172. #define INI_SEC_CONFIG _T("ConfigName")
  173. #define INI_SEC_BRANDING _T("Branding")
  174. #define INI_SEC_VERSION _T("Version")
  175. #define INI_SEC_WINPE _T("WinPE")
  176. #define INI_SEC_MFULIST _T("StartMenuMFUlist")
  177. #define INI_SEC_OEMLINK _T("OemLink")
  178. #define INF_SEC_COPYFILES _T("CopyFiles")
  179. // INI Keys
  180. //
  181. #define INI_KEY_MANUFACT _T("Manufacturer")
  182. #define INI_KEY_FINISHED _T("Finished")
  183. #define INI_KEY_MOUSE _T("MouseTutorial")
  184. #define INI_KEY_HARDWARE _T("OEMHWTutorial")
  185. #define INI_KEY_ISPRET _T("IspRetail")
  186. #define INI_KEY_PRECONFIG _T("IspPreconfigDir")
  187. #define INI_KEY_STARTURL _T("DesktopStartUrl")
  188. #define INI_KEY_ISPSIGNUP _T("ISPSignup")
  189. #define INI_KEY_ISPPATH _T("ISPPath")
  190. #define INI_KEY_LOGO1 _T("Logo1")
  191. #define INI_KEY_LOGO2 _T("Logo2")
  192. #define INI_KEY_OEMCUST _T("OEMCust")
  193. #define INI_KEY_FILELINE _T("Line%d")
  194. #define INI_KEY_USBERRORFILES _T("USBErrorFiles")
  195. #define INI_KEY_IMETUT _T("IMETutorial")
  196. #define INI_KEY_IMECUSTDIR _T("IMECustDir")
  197. #define INI_KEY_CUSTMOUSE _T("CustomMouse")
  198. #define INI_KEY_HELP_CENTER _T("HelpCenterDir")
  199. #define INI_KEY_SUPPORT_CENTER _T("HelpSupportDir")
  200. #define INI_KEY_HELP_BRANDING _T("HelpBrandingDir")
  201. #define INI_KEY_WINPE_LANG _T("Lang")
  202. #define INI_KEY_WINPE_CFGSET _T("ConfigSet")
  203. #define INI_KEY_WINPE_SRCROOT _T("SourceRoot")
  204. #define INI_KEY_WINPE_USERNAME _T("Username")
  205. #define INI_KEY_WINPE_PASSWORD _T("Password")
  206. #define INI_KEY_MFULINK _T("Link%d")
  207. #define INI_KEY_WELCOME _T("Welcome")
  208. #define INI_KEY_APPCREDENTIALS _T("FactoryCredentials")
  209. #define INI_KEY_OEMLINK_LINKTEXT _T("OemBrandLinkText")
  210. #define INI_KEY_OEMLINK_INFOTIP _T("OemBrandLinkInfotip")
  211. #define INI_KEY_OEMLINK_ICON_ORIGINAL _T("OriginalOemLinkIcon")
  212. #define INI_KEY_OEMLINK_PATH_ORIGINAL _T("OriginalLink")
  213. #define INI_KEY_OEMLINK_ICON_LOCAL _T("OemBrandIcon")
  214. #define INI_KEY_OEMLINK_PATH_LOCAL _T("OemBrandLink")
  215. #define INI_KEY_DESKFLDR_ENABLE _T("DesktopShortcutsCleanupEnabled")
  216. // INI Values
  217. //
  218. #define INI_VAL_OFFLINE _T("Offline")
  219. #define INI_VAL_PRECONFIG _T("Preconfig")
  220. #define INI_VAL_DISABLE _T("disable")
  221. #define INI_VAL_DUMMY _T("OPKWIZDUMMYLINE")
  222. #define INI_VAL_WINPE_COMPNAME _T("<SERVER_NAME>")
  223. #define INI_VAL_WINPE_SHARENAME _T("<SHARE_NAME>")
  224. // INI Other
  225. //
  226. #define GRAY _T("_Gray")
  227. // Config files.
  228. //
  229. #define FILE_SETUPMGR_INI _T("setupmgr.ini")
  230. #define FILE_OPKWIZ_HLP _T("setupmgr.chm")
  231. #define FILE_OPKINPUT_INF _T("opkinput.inf")
  232. #define FILE_INSTALL_INS _T("install.ins")
  233. #define FILE_OPKWIZ_INI _T("cfgbatch.txt")
  234. #define FILE_OOBEINFO_INI _T("oobeinfo.ini")
  235. #define FILE_OEMAUDIT_INF _T("oemaudit.inf")
  236. #define FILE_OEMINFO_INI _T("oeminfo.ini")
  237. #define FILE_UNATTEND_TXT _T("unattend.txt")
  238. #define FILE_OEM_TAG _T("oem.tag")
  239. #define DIR_WIZARDFILES _T("wizfiles")
  240. #define DIR_OEM _T("$OEM$")
  241. #define DIR_OEM_WINDOWS DIR_OEM _T("\\$$")
  242. #define DIR_OEM_SYSTEM32 DIR_OEM_WINDOWS _T("\\system32")
  243. #define DIR_OEM_OOBE DIR_OEM_SYSTEM32 _T("\\oobe")
  244. #define DIR_IESIGNUP DIR_OEM _T("\\$PROGS\\Internet Explorer\\Custom")
  245. // Other strings.
  246. //
  247. #define STR_0 _T("0")
  248. #define STR_1 _T("1")
  249. #define STR_2 _T("2")
  250. #define STR_ZERO STR_0
  251. #define STR_ONE STR_1
  252. #define STR_CRLF _T("\r\n")
  253. #define STR_SPACE _T(" ")
  254. #define CHR_BACKSLASH _T('\\')
  255. #define CHR_SPACE _T(' ')
  256. #define CHR_EQUAL _T('=')
  257. #define CHR_LINEFEED _T('\n')
  258. #define CHR_QUOTE _T('\"')
  259. #define CHR_STAR _T('*')
  260. #define STR_EQUAL _T("=")
  261. #define STR_CAB _T(".cab")
  262. #define STR_OPEN _T("open")
  263. //
  264. // Type Definition(s):
  265. //
  266. // Global app data.
  267. //
  268. typedef struct _GAPP
  269. {
  270. HINSTANCE hInstance;
  271. DWORD dwFlags;
  272. TCHAR szOpkDir[MAX_PATH]; // Full path to the root of the OPK directory where all the tools are installed.
  273. TCHAR szWizardDir[MAX_PATH]; // Full path to the directory where the default configuration files are located.
  274. TCHAR szConfigSetsDir[MAX_PATH]; // Full path to the directory where all the configuration sets are located.
  275. TCHAR szLangDir[MAX_PATH]; // Full path to the root of language folder where all the specific lang directories are.
  276. TCHAR szTempDir[MAX_PATH]; // Full path to the current location for all the configuration files.
  277. TCHAR szLangName[MAX_PATH]; // Name of the language directory we are deploying (not a full path).
  278. TCHAR szSkuName[MAX_PATH]; // Name of the sku directory we are deploying (not a full path).
  279. TCHAR szConfigName[MAX_PATH]; // Name of the directory to use for the configuration set (not a full path).
  280. TCHAR szBrowseFolder[MAX_PATH]; // Full path to the last folder browsed to.
  281. TCHAR szOpkInputInfFile[MAX_PATH];
  282. TCHAR szSetupMgrIniFile[MAX_PATH]; // Full path to the file were we store global SetupMgr settings (we don't use the registry).
  283. TCHAR szHelpFile[MAX_PATH];
  284. TCHAR szHelpContentFile[MAX_PATH];
  285. TCHAR szInstallInsFile[MAX_PATH];
  286. TCHAR szOpkWizIniFile[MAX_PATH];
  287. TCHAR szOobeInfoIniFile[MAX_PATH];
  288. TCHAR szOemInfoIniFile[MAX_PATH];
  289. TCHAR szWinBomIniFile[MAX_PATH];
  290. TCHAR szUnattendTxtFile[MAX_PATH];
  291. DWORD dwCurrentHelp;
  292. HWND hwndHelp;
  293. DWORD dwOsVer;
  294. TCHAR szManufacturer[MAX_PATH];
  295. TCHAR szLastKnownBrowseFolder[MAX_PATH];
  296. } GAPP, *PGAPP, *LPGAPP;
  297. #undef LSTRCMPI
  298. #define LSTRCMPI(x, y) ( ( CompareString( MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT), NORM_IGNORECASE, x, -1, y, -1 ) - CSTR_EQUAL ) )
  299. //
  300. // External Global Variable(s):
  301. //
  302. // Don't want to declare these again.
  303. //
  304. #ifndef _MAIN_C_
  305. #define _MAIN_C_
  306. extern GAPP g_App;
  307. #endif // _MAIN_C_
  308. //
  309. // External Function Prototype(s);
  310. //
  311. // From MAIN.C
  312. //
  313. void SetConfigPath(LPCTSTR);
  314. // From LANG.C
  315. //
  316. void SetupLangListBox(HWND hwndLB);
  317. LPTSTR AllocateLangStr(HINSTANCE hInst, LPTSTR lpLangDir, LPTSTR * lplpLangDir);
  318. // From LANGSKU.C
  319. //
  320. void ManageLangSku(HWND hwndParent);
  321. // From SHARE.C
  322. //
  323. BOOL DistributionShareDialog(HWND hwndParent);
  324. BOOL GetShareSettings(LPTSTR lpszPath, DWORD cbszPath, LPTSTR lpszUsername, DWORD cbszUserName, LPTSTR lpszPassword, DWORD cbszPassword);
  325. // From SKU.C
  326. //
  327. void SetupSkuListBox(HWND hwndLB, LPTSTR lpLangDir);
  328. void AddSku(HWND hwnd, HWND hwndLB, LPTSTR lpLangName);
  329. void DelSku(HWND hwnd, HWND hwndLB, LPTSTR lpLangName);
  330. // From WINPE.C
  331. //
  332. BOOL MakeWinpeFloppy(HWND hwndParent, LPTSTR lpConfigName, LPTSTR lpWinBom);
  333. // Checks for batch mode
  334. //
  335. BOOL OpkWritePrivateProfileSection(LPCTSTR, LPCTSTR, LPCTSTR);
  336. BOOL OpkGetPrivateProfileSection(LPCTSTR, LPTSTR, INT, LPCTSTR);
  337. BOOL OpkWritePrivateProfileString(LPCTSTR, LPCTSTR, LPCTSTR, LPCTSTR);
  338. BOOL OpkGetPrivateProfileString(LPCTSTR, LPCTSTR, LPCTSTR, LPTSTR, INT, LPCTSTR);
  339. #endif // _MAIN_H_