Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
autorun.h
Go to the documentation of this file.
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/************************************************************************************************
20* 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 *
21*************************************************************************************************
22*
23* FILE
24* $Archive: /Renegade Setup/Autorun/autorun.h $
25*
26* DESCRIPTION
27*
28* PROGRAMMER
29* $Author: Maria_l $
30*
31* VERSION INFO
32* $Modtime: 1/28/02 11:11a $
33* $Revision: 10 $
34*
35*************************************************************************************************/
36
37
38#ifndef AUTORUN_H
39#define AUTORUN_H
40
41#include <tchar.h>
42#include <string.h>
43#include <stdio.h>
44#include <stdlib.h>
45#include "ttfont.h"
46
47
48//--------------------------------------------------------------------
49// Externs
50//--------------------------------------------------------------------
51extern int Language;
52
53//--------------------------------------------------------------------
54// Structs that everyone can use.
55//--------------------------------------------------------------------
70
71#define IS_LANGUAGE_DBCS(l) (((l)==LANG_CHI)||((l)==LANG_JAP)||((l)==LANG_KOR)) // [OYO]
72#define IS_CODEPAGE_DBCS(C) ((C==949)||(C==950)||(C==932)) // [OYO]
73
74//----------------------------------------------------------------------------
75// DEFINES
76//----------------------------------------------------------------------------
77#define MAX_COMMAND_LINE_ARGUMENTS 10
78#define MAX_ARGUMENT_LENGTH 80
79
80#define MIN(a,b) (((a) < (b)) ? (a) : (b))
81#define MAX(a,b) (((a) > (b)) ? (a) : (b))
82
83#define WM_GO (WM_USER)+1
84#define WM_USERSTAT (WM_USER + 100)
85
86#define EXPLORER_NAME "EXPLORER.EXE"
87#define INSTALL_PATH_KEY "InstallPath"
88#define INTERNET_PATH_KEY "InternetPath"
89#define SETUP_NAME "Setup.exe"
90#define UNINSTALL_NAME "Uninst.exe"
91
92//#define SHELL_FOLDERS_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
93#define SHELL_UNINSTALL_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\InstallShield_{F3E9C243-122E-4D6B-ACC1-E1FEC02F6CA1}"
94#define SHELL_APP_PATHS_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths"
95#define PROGRAMS_SUBKEY "Programs"
96#define COMMON_PROGRAMS_SUBKEY "Common Programs"
97#define SOFTWARE_SUBKEY "Software"
98/*
99#define WESTWOOD_SUBKEY "Westwood"
100#define SOFTWARE_WESTWOOD_KEY "Software\\Westwood\\"
101#define WESTWOOD_WOLAPI_KEY "Software\\Westwood\\WOLAPI"
102#define WESTWOOD_REGISTER_KEY "Software\\Westwood\\Register"
103*/
104#define ELECTRONICARTS_SUBKEY "Electronic Arts"
105#define EAGAMES_SUBKEY "EA Games"
106#define GENERALS_SUBKEY "Command and Conquer Generals Zero Hour"
107#define SOFTWARE_EAGAMES_KEY "Software\\Electronic Arts\\EA Games\\"
108#define EAGAMES_GENERALS_KEY "Software\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour"
109#define EAGAMES_ERGC_KEY "Software\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour\\ergc"
110#define LAUNCHER_FILENAME "Generals.exe"
111#define WORLDBUILDER_FILENAME "WorldBuilder.exe"
112#define PATCHGET_FILENAME "patchget.dat"
113
114#define UNINSTALL_STRING_SUBKEY "UninstallString"
115#define INSTALLPATH_SUBKEY "InstallPath"
116#define VERSION_SUBKEY "Version"
117#define LANGUAGE_SUBKEY "Language"
118#define MAPPACKVERSION_SUBKEY "MapPackVersion"
119
120#define DDRAW "DDRAW.DLL"
121#define DSOUND "DSOUND.DLL"
122#define DDHELP "DDHELP.EXE"
123
124#define NORMAL "Normal"
125#define FOCUSED "Focused"
126#define PRESSED "Pressed"
127/*
128#define BUTTON1NORMAL "Button1Normal"
129#define BUTTON2NORMAL "Button2Normal"
130#define BUTTON3NORMAL "Button3Normal"
131#define BUTTON4NORMAL "Button4Normal"
132#define BUTTON5NORMAL "Button5Normal"
133#define BUTTON6NORMAL "Button6Normal"
134#define BUTTON7NORMAL "Button7Normal"
135#define BUTTON8NORMAL "Button8Normal"
136#define BUTTON9NORMAL "Button8Normal"
137#define BUTTON10NORMAL "Button8Normal"
138
139#define BUTTON1FOCUSED "Button1Focused"
140#define BUTTON2FOCUSED "Button2Focused"
141#define BUTTON3FOCUSED "Button3Focused"
142#define BUTTON4FOCUSED "Button4Focused"
143#define BUTTON5FOCUSED "Button5Focused"
144#define BUTTON6FOCUSED "Button6Focused"
145#define BUTTON7FOCUSED "Button7Focused"
146#define BUTTON8FOCUSED "Button8Focused"
147#define BUTTON9FOCUSED "Button8Focused"
148#define BUTTON10FOCUSED "Button8Focused"
149*/
150
151#define BUTTON_REG "BUTTON_REG"
152#define BUTTON_SEL "BUTTON_SEL"
153
154//-------------------------------------------------------------------------
155// LaunchObject Class
156//-------------------------------------------------------------------------
158{
159 public:
160 LaunchObjectClass ( char *path=NULL, char *args=NULL );
161
162 void SetPath ( char *path );
163 void SetArgs ( char *args );
164 unsigned int Launch ( void );
165 bool Launch_A_Program ( void ) { return( LaunchSomething ); };
166 void Set_Launch ( bool value ) { LaunchSomething = value; };
167
168 public:
169 char szPath[ _MAX_PATH ];
170 char szArgs[ _MAX_PATH ];
172};
173
175
176//-------------------------------------------------------------------------
177// Main Class
178//-------------------------------------------------------------------------
179class Main
180{
181 public:
182 static HINSTANCE hInstance;
183 static HINSTANCE hPrevInstance;
184 static HMODULE hModule;
185 static int nCmdShow;
186 static int MessageLoop( void );
187};
188
189//-------------------------------------------------------------------------
190// (Base)Window Class
191//
192// Note that Window_Proc is a "pure virtual" function making this an
193// abstract class.
194//-------------------------------------------------------------------------
196{
197 protected:
198 HWND hWnd;
199
200 public:
201 HWND GetHandle( void ) { return hWnd; }
202 BOOL Show( int nCmdShow ) { return ShowWindow( hWnd, nCmdShow ); }
203 void Update( void ) { UpdateWindow( hWnd ); }
204 virtual LRESULT Window_Proc( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam ) = 0;
205};
206
207//-------------------------------------------------------------------------
208// MainWindow Class
209//-------------------------------------------------------------------------
210class MainWindow : public Window
211{
212 protected:
213
214 static char szClassName[ 100 ];
215
216 public:
217
218 MainWindow( void );
219
220 static void Register ( void );
221 static void Reset_Class_Name ( char *string )
222 {
223 if ( string != NULL && string[0] != '\0' ) {
224 strcpy( szClassName, string );
225 }
226 };
227
229 void Create_Buttons ( HWND hWnd, RECT *dlg_rect );
230 unsigned int Run_Auto_Update ( HWND hWnd, RECT *rect );
231 unsigned int Run_Demo ( HWND hWnd, RECT *rect, int cd_drive );
232 BOOL Run_Explorer ( char *, HWND hWnd, RECT *rect );
233 unsigned int Run_Game ( HWND hWnd, RECT *rect );
234 unsigned int Run_WorldBuilder ( HWND hWnd, RECT *rect );
235 unsigned int Run_PatchGet ( HWND hWnd, RECT *rect );
236 unsigned int Run_New_Account ( HWND hWnd, RECT *rect );
237 unsigned int Run_Register ( HWND hWnd, RECT *rect );
238 unsigned int Run_Setup ( HWND hWnd, RECT *rect, int cd_drive );
239 unsigned int Run_Uninstall ( HWND hWnd, RECT *rect );
240 unsigned int Run_OpenFile (int cd_drive, const char *filename, bool wait = false);
241 LRESULT Window_Proc ( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam );
242};
243
244
245#endif
246
#define NULL
Definition BaseType.h:92
void const char * value
unsigned int UINT
Definition bittype.h:63
#define BOOL
Definition Wnd_File.h:57
LaunchObjectClass LaunchObject
Definition autorun.cpp:187
int Language
Definition autorun.cpp:189
LanguageType
Definition autorun.h:56
@ LANG_UK
Definition autorun.h:58
@ LANG_USA
Definition autorun.h:57
@ LANG_SCA
Definition autorun.h:65
@ LANG_NUM
Definition autorun.h:68
@ LANG_SPA
Definition autorun.h:64
@ LANG_FRE
Definition autorun.h:60
@ LANG_GER
Definition autorun.h:59
@ LANG_ITA
Definition autorun.h:62
@ LANG_KOR
Definition autorun.h:66
@ LANG_DUT
Definition autorun.h:61
@ LANG_CHI
Definition autorun.h:67
@ LANG_JAP
Definition autorun.h:63
void Set_Launch(bool value)
Definition autorun.h:166
char szPath[_MAX_PATH]
Definition autorun.h:169
void SetPath(char *path)
Definition autorun.cpp:5186
void SetArgs(char *args)
Definition autorun.cpp:5194
bool Launch_A_Program(void)
Definition autorun.h:165
LaunchObjectClass(char *path=NULL, char *args=NULL)
Definition autorun.cpp:5173
unsigned int Launch(void)
Definition autorun.cpp:5202
char szArgs[_MAX_PATH]
Definition autorun.h:170
static HINSTANCE hInstance
Definition autorun.h:182
static int MessageLoop(void)
Definition autorun.cpp:931
static HINSTANCE hPrevInstance
Definition autorun.h:183
static HMODULE hModule
Definition autorun.h:184
static int nCmdShow
Definition autorun.h:185
unsigned int Run_OpenFile(int cd_drive, const char *filename, bool wait=false)
Definition autorun.cpp:1715
unsigned int Run_New_Account(HWND hWnd, RECT *rect)
Definition autorun.cpp:1868
unsigned int Run_Game(HWND hWnd, RECT *rect)
Definition autorun.cpp:1531
unsigned int Run_Demo(HWND hWnd, RECT *rect, int cd_drive)
Definition autorun.cpp:1667
static void Reset_Class_Name(char *string)
Definition autorun.h:221
unsigned int Run_Register(HWND hWnd, RECT *rect)
Definition autorun.cpp:1942
BOOL Is_Product_Registered(void)
Definition autorun.cpp:1232
static void Register(void)
Definition autorun.cpp:979
unsigned int Run_Uninstall(HWND hWnd, RECT *rect)
Definition autorun.cpp:2037
unsigned int Run_PatchGet(HWND hWnd, RECT *rect)
Definition autorun.cpp:1629
static char szClassName[100]
Definition autorun.h:214
unsigned int Run_Setup(HWND hWnd, RECT *rect, int cd_drive)
Definition autorun.cpp:1793
unsigned int Run_Auto_Update(HWND hWnd, RECT *rect)
Definition autorun.cpp:1992
LRESULT Window_Proc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)
Definition autorun.cpp:1115
void Create_Buttons(HWND hWnd, RECT *dlg_rect)
Definition autorun.cpp:2169
BOOL Run_Explorer(char *, HWND hWnd, RECT *rect)
Definition autorun.cpp:1448
MainWindow(void)
Definition autorun.cpp:1047
unsigned int Run_WorldBuilder(HWND hWnd, RECT *rect)
Definition autorun.cpp:1591
HWND GetHandle(void)
Definition autorun.h:201
virtual LRESULT Window_Proc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)=0
void Update(void)
Definition autorun.h:203
HWND hWnd
Definition autorun.h:198
BOOL Show(int nCmdShow)
Definition autorun.h:202