autorun.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /************************************************************************************************
  19. * C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S *
  20. *************************************************************************************************
  21. *
  22. * FILE
  23. * $Archive: /Renegade Setup/Autorun/autorun.h $
  24. *
  25. * DESCRIPTION
  26. *
  27. * PROGRAMMER
  28. * $Author: Maria_l $
  29. *
  30. * VERSION INFO
  31. * $Modtime: 1/28/02 11:11a $
  32. * $Revision: 10 $
  33. *
  34. *************************************************************************************************/
  35. #ifndef AUTORUN_H
  36. #define AUTORUN_H
  37. #include <tchar.h>
  38. #include <string.h>
  39. #include <stdio.h>
  40. #include <stdlib.h>
  41. #include "ttfont.h"
  42. //--------------------------------------------------------------------
  43. // Externs
  44. //--------------------------------------------------------------------
  45. extern int Language;
  46. //--------------------------------------------------------------------
  47. // Structs that everyone can use.
  48. //--------------------------------------------------------------------
  49. typedef enum {
  50. LANG_USA, //0
  51. LANG_UK, //1
  52. LANG_GER, //2
  53. LANG_FRE, //3
  54. LANG_DUT, //4
  55. LANG_ITA, //5
  56. LANG_JAP, //6
  57. LANG_SPA, //7
  58. LANG_SCA, //8
  59. LANG_KOR, //9
  60. LANG_CHI, //10
  61. LANG_NUM,
  62. } LanguageType;
  63. #define IS_LANGUAGE_DBCS(l) (((l)==LANG_CHI)||((l)==LANG_JAP)||((l)==LANG_KOR)) // [OYO]
  64. #define IS_CODEPAGE_DBCS(C) ((C==949)||(C==950)||(C==932)) // [OYO]
  65. //----------------------------------------------------------------------------
  66. // DEFINES
  67. //----------------------------------------------------------------------------
  68. #define MAX_COMMAND_LINE_ARGUMENTS 10
  69. #define MAX_ARGUMENT_LENGTH 80
  70. #define MIN(a,b) (((a) < (b)) ? (a) : (b))
  71. #define MAX(a,b) (((a) > (b)) ? (a) : (b))
  72. #define WM_GO (WM_USER)+1
  73. #define WM_USERSTAT (WM_USER + 100)
  74. #define EXPLORER_NAME "EXPLORER.EXE"
  75. #define INSTALL_PATH_KEY "InstallPath"
  76. #define INTERNET_PATH_KEY "InternetPath"
  77. #define SETUP_NAME "Setup.exe"
  78. #define UNINSTALL_NAME "Uninst.exe"
  79. //#define SHELL_FOLDERS_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
  80. #define SHELL_UNINSTALL_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\InstallShield_{F3E9C243-122E-4D6B-ACC1-E1FEC02F6CA1}"
  81. #define SHELL_APP_PATHS_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths"
  82. #define PROGRAMS_SUBKEY "Programs"
  83. #define COMMON_PROGRAMS_SUBKEY "Common Programs"
  84. #define SOFTWARE_SUBKEY "Software"
  85. /*
  86. #define WESTWOOD_SUBKEY "Westwood"
  87. #define SOFTWARE_WESTWOOD_KEY "Software\\Westwood\\"
  88. #define WESTWOOD_WOLAPI_KEY "Software\\Westwood\\WOLAPI"
  89. #define WESTWOOD_REGISTER_KEY "Software\\Westwood\\Register"
  90. */
  91. #define ELECTRONICARTS_SUBKEY "Electronic Arts"
  92. #define EAGAMES_SUBKEY "EA Games"
  93. #define GENERALS_SUBKEY "Command and Conquer Generals Zero Hour"
  94. #define SOFTWARE_EAGAMES_KEY "Software\\Electronic Arts\\EA Games\\"
  95. #define EAGAMES_GENERALS_KEY "Software\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour"
  96. #define EAGAMES_ERGC_KEY "Software\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour\\ergc"
  97. #define LAUNCHER_FILENAME "Generals.exe"
  98. #define WORLDBUILDER_FILENAME "WorldBuilder.exe"
  99. #define PATCHGET_FILENAME "patchget.dat"
  100. #define UNINSTALL_STRING_SUBKEY "UninstallString"
  101. #define INSTALLPATH_SUBKEY "InstallPath"
  102. #define VERSION_SUBKEY "Version"
  103. #define LANGUAGE_SUBKEY "Language"
  104. #define MAPPACKVERSION_SUBKEY "MapPackVersion"
  105. #define DDRAW "DDRAW.DLL"
  106. #define DSOUND "DSOUND.DLL"
  107. #define DDHELP "DDHELP.EXE"
  108. #define NORMAL "Normal"
  109. #define FOCUSED "Focused"
  110. #define PRESSED "Pressed"
  111. /*
  112. #define BUTTON1NORMAL "Button1Normal"
  113. #define BUTTON2NORMAL "Button2Normal"
  114. #define BUTTON3NORMAL "Button3Normal"
  115. #define BUTTON4NORMAL "Button4Normal"
  116. #define BUTTON5NORMAL "Button5Normal"
  117. #define BUTTON6NORMAL "Button6Normal"
  118. #define BUTTON7NORMAL "Button7Normal"
  119. #define BUTTON8NORMAL "Button8Normal"
  120. #define BUTTON9NORMAL "Button8Normal"
  121. #define BUTTON10NORMAL "Button8Normal"
  122. #define BUTTON1FOCUSED "Button1Focused"
  123. #define BUTTON2FOCUSED "Button2Focused"
  124. #define BUTTON3FOCUSED "Button3Focused"
  125. #define BUTTON4FOCUSED "Button4Focused"
  126. #define BUTTON5FOCUSED "Button5Focused"
  127. #define BUTTON6FOCUSED "Button6Focused"
  128. #define BUTTON7FOCUSED "Button7Focused"
  129. #define BUTTON8FOCUSED "Button8Focused"
  130. #define BUTTON9FOCUSED "Button8Focused"
  131. #define BUTTON10FOCUSED "Button8Focused"
  132. */
  133. #define BUTTON_REG "BUTTON_REG"
  134. #define BUTTON_SEL "BUTTON_SEL"
  135. //-------------------------------------------------------------------------
  136. // LaunchObject Class
  137. //-------------------------------------------------------------------------
  138. class LaunchObjectClass
  139. {
  140. public:
  141. LaunchObjectClass ( char *path=NULL, char *args=NULL );
  142. void SetPath ( char *path );
  143. void SetArgs ( char *args );
  144. unsigned int Launch ( void );
  145. bool Launch_A_Program ( void ) { return( LaunchSomething ); };
  146. void Set_Launch ( bool value ) { LaunchSomething = value; };
  147. public:
  148. char szPath[ _MAX_PATH ];
  149. char szArgs[ _MAX_PATH ];
  150. bool LaunchSomething;
  151. };
  152. extern LaunchObjectClass LaunchObject;
  153. //-------------------------------------------------------------------------
  154. // Main Class
  155. //-------------------------------------------------------------------------
  156. class Main
  157. {
  158. public:
  159. static HINSTANCE hInstance;
  160. static HINSTANCE hPrevInstance;
  161. static HMODULE hModule;
  162. static int nCmdShow;
  163. static int MessageLoop( void );
  164. };
  165. //-------------------------------------------------------------------------
  166. // (Base)Window Class
  167. //
  168. // Note that Window_Proc is a "pure virtual" function making this an
  169. // abstract class.
  170. //-------------------------------------------------------------------------
  171. class Window
  172. {
  173. protected:
  174. HWND hWnd;
  175. public:
  176. HWND GetHandle( void ) { return hWnd; }
  177. BOOL Show( int nCmdShow ) { return ShowWindow( hWnd, nCmdShow ); }
  178. void Update( void ) { UpdateWindow( hWnd ); }
  179. virtual LRESULT Window_Proc( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam ) = 0;
  180. };
  181. //-------------------------------------------------------------------------
  182. // MainWindow Class
  183. //-------------------------------------------------------------------------
  184. class MainWindow : public Window
  185. {
  186. protected:
  187. static char szClassName[ 100 ];
  188. public:
  189. MainWindow( void );
  190. static void Register ( void );
  191. static void Reset_Class_Name ( char *string )
  192. {
  193. if ( string != NULL && string[0] != '\0' ) {
  194. strcpy( szClassName, string );
  195. }
  196. };
  197. BOOL Is_Product_Registered ( void );
  198. void Create_Buttons ( HWND hWnd, RECT *dlg_rect );
  199. unsigned int Run_Auto_Update ( HWND hWnd, RECT *rect );
  200. unsigned int Run_Demo ( HWND hWnd, RECT *rect, int cd_drive );
  201. BOOL Run_Explorer ( char *, HWND hWnd, RECT *rect );
  202. unsigned int Run_Game ( HWND hWnd, RECT *rect );
  203. unsigned int Run_WorldBuilder ( HWND hWnd, RECT *rect );
  204. unsigned int Run_PatchGet ( HWND hWnd, RECT *rect );
  205. unsigned int Run_New_Account ( HWND hWnd, RECT *rect );
  206. unsigned int Run_Register ( HWND hWnd, RECT *rect );
  207. unsigned int Run_Setup ( HWND hWnd, RECT *rect, int cd_drive );
  208. unsigned int Run_Uninstall ( HWND hWnd, RECT *rect );
  209. unsigned int Run_OpenFile (int cd_drive, const char *filename, bool wait = false);
  210. LRESULT Window_Proc ( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam );
  211. };
  212. #endif