Initial commit of Command & Conquer Generals and Command & Conquer Generals Zero Hour source code.

This commit is contained in:
LFeenanEA 2025-02-27 17:34:39 +00:00
parent 2e338c00cb
commit 3d0ee53a05
No known key found for this signature in database
GPG key ID: C6EBE8C2EA08F7E0
6072 changed files with 2283311 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,44 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CHATAPI_HEADER
#define CHATAPI_HEADER
#include "cominit.h"
#include <stdio.h>
#include <windows.h>
#include <commctrl.h>
#include <winerror.h>
#include <ocidl.h>
#include <olectl.h>
/**********************************************************************
** This macro serves as a general way to determine the number of elements
** within an array.
*/
#define ARRAY_SIZE(x) int(sizeof(x)/sizeof(x[0]))
#define size_of(typ,id) sizeof(((typ*)0)->id)
void Startup_Chat(void);
void Shutdown_Chat(void);
void Update_If_Required(void);
char const * Fetch_String(int id);
#endif

View file

@ -0,0 +1,46 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//
// If you link with this it will automatically call the COM initialization stuff
//
#include "cominit.h"
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
#include <objbase.h>
ComInit::ComInit()
{
HRESULT hRes = CoInitialize(NULL);
if (SUCCEEDED(hRes)==FALSE)
{
MessageBox(NULL,"Can't initialize COM?!?!","Error:",MB_OK);
exit(0);
}
}
ComInit::~ComInit()
{
CoUninitialize();
}
// Creating this instance will setup all COM stuff & do cleanup on program exit
ComInit Global_COM_Initializer;

View file

@ -0,0 +1,34 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COMINIT_HEADER
#define COMINIT_HEADER
//
// Link with this to automatically initialize COM at startup
// - See cominit.cpp for more info
//
class ComInit
{
public:
ComInit();
~ComInit();
};
#endif

View file

@ -0,0 +1,210 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// FILE: DownloadManager.cpp //////////////////////////////////////////////////////
// Generals download manager code
// Author: Matthew D. Campbell, July 2002
#include "debug.h"
#include "chatapi.h"
#include "DownloadManager.h"
#include "resource.h"
DownloadManager *TheDownloadManager = NULL;
DownloadManager::DownloadManager()
{
m_download = new CDownload(this);
m_wasError = m_sawEnd = false;
m_statusString = Fetch_String(FTP_StatusIdle);
// ----- Initialize Winsock -----
m_winsockInit = true;
WORD verReq = MAKEWORD(2, 2);
WSADATA wsadata;
int err = WSAStartup(verReq, &wsadata);
if (err != 0)
{
m_winsockInit = false;
}
else
{
if ((LOBYTE(wsadata.wVersion) != 2) || (HIBYTE(wsadata.wVersion) !=2))
{
WSACleanup();
m_winsockInit = false;
}
}
}
DownloadManager::~DownloadManager()
{
delete m_download;
if (m_winsockInit)
{
WSACleanup();
m_winsockInit = false;
}
}
void DownloadManager::init( void )
{
}
void DownloadManager::reset( void )
{
}
HRESULT DownloadManager::update( void )
{
return m_download->PumpMessages();
}
HRESULT DownloadManager::downloadFile( std::string server, std::string username, std::string password, std::string file, std::string localfile, std::string regkey, bool tryResume )
{
return m_download->DownloadFile( server.c_str(), username.c_str(), password.c_str(), file.c_str(), localfile.c_str(), regkey.c_str(), tryResume );
}
void DownloadManager::queueFileForDownload( std::string server, std::string username, std::string password, std::string file, std::string localfile, std::string regkey, bool tryResume )
{
QueuedDownload q;
q.file = file;
q.localFile = localfile;
q.password = password;
q.regKey = regkey;
q.server = server;
q.tryResume = tryResume;
q.userName = username;
m_queuedDownloads.push_back(q);
}
HRESULT DownloadManager::downloadNextQueuedFile( void )
{
QueuedDownload q;
std::list<QueuedDownload>::iterator it = m_queuedDownloads.begin();
if (it != m_queuedDownloads.end())
{
q = *it;
m_queuedDownloads.pop_front();
m_wasError = m_sawEnd = false;
return downloadFile( q.server, q.userName, q.password, q.file, q.localFile, q.regKey, q.tryResume );
}
else
{
DEBUG_CRASH(("Starting non-existent download!"));
return S_OK;
}
}
std::string DownloadManager::getLastLocalFile( void )
{
char buf[256] = "";
m_download->GetLastLocalFile(buf, 256);
return buf;
}
HRESULT DownloadManager::OnError( int error )
{
m_wasError = true;
std::string s = Fetch_String(FTP_UnknownError);
switch (error)
{
case DOWNLOADEVENT_NOSUCHSERVER:
s = Fetch_String(FTP_NoSuchServer);
break;
case DOWNLOADEVENT_COULDNOTCONNECT:
s = Fetch_String(FTP_CouldNotConnect);
break;
case DOWNLOADEVENT_LOGINFAILED:
s = Fetch_String(FTP_LoginFailed);
break;
case DOWNLOADEVENT_NOSUCHFILE:
s = Fetch_String(FTP_NoSuchFile);
break;
case DOWNLOADEVENT_LOCALFILEOPENFAILED:
s = Fetch_String(FTP_LocalFileOpenFailed);
break;
case DOWNLOADEVENT_TCPERROR:
s = Fetch_String(FTP_TCPError);
break;
case DOWNLOADEVENT_DISCONNECTERROR:
s = Fetch_String(FTP_DisconnectError);
break;
}
m_errorString = s;
DEBUG_LOG(("DownloadManager::OnError(): %s(%d)\n", s.c_str(), error));
return S_OK;
}
HRESULT DownloadManager::OnEnd()
{
m_sawEnd = true;
DEBUG_LOG(("DownloadManager::OnEnd()\n"));
return S_OK;
}
HRESULT DownloadManager::OnQueryResume()
{
DEBUG_LOG(("DownloadManager::OnQueryResume()\n"));
//return DOWNLOADEVENT_DONOTRESUME;
return DOWNLOADEVENT_RESUME;
}
HRESULT DownloadManager::OnProgressUpdate( int bytesread, int totalsize, int timetaken, int timeleft )
{
DEBUG_LOG(("DownloadManager::OnProgressUpdate(): %d/%d %d/%d\n", bytesread, totalsize, timetaken, timeleft));
return S_OK;
}
HRESULT DownloadManager::OnStatusUpdate( int status )
{
std::string s = Fetch_String(FTP_StatusNone);
switch (status)
{
case DOWNLOADSTATUS_CONNECTING:
s = Fetch_String(FTP_StatusConnecting);
break;
case DOWNLOADSTATUS_LOGGINGIN:
s = Fetch_String(FTP_StatusLoggingIn);
break;
case DOWNLOADSTATUS_FINDINGFILE:
s = Fetch_String(FTP_StatusFindingFile);
break;
case DOWNLOADSTATUS_QUERYINGRESUME:
s = Fetch_String(FTP_StatusQueryingResume);
break;
case DOWNLOADSTATUS_DOWNLOADING:
s = Fetch_String(FTP_StatusDownloading);
break;
case DOWNLOADSTATUS_DISCONNECTING:
s = Fetch_String(FTP_StatusDisconnecting);
break;
case DOWNLOADSTATUS_FINISHING:
s = Fetch_String(FTP_StatusFinishing);
break;
case DOWNLOADSTATUS_DONE:
s = Fetch_String(FTP_StatusDone);
break;
}
m_statusString = s;
DEBUG_LOG(("DownloadManager::OnStatusUpdate(): %s(%d)\n", s.c_str(), status));
return S_OK;
}

View file

@ -0,0 +1,94 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// FILE: DownloadManager.h //////////////////////////////////////////////////////
// Generals download class definitions
// Author: Matthew D. Campbell, July 2002
#pragma once
#ifndef __DOWNLOADMANAGER_H__
#define __DOWNLOADMANAGER_H__
#include "WWDownload/downloadDefs.h"
#include "WWDownload/download.h"
#include <string>
#include <list>
class CDownload;
class QueuedDownload
{
public:
std::string server;
std::string userName;
std::string password;
std::string file;
std::string localFile;
std::string regKey;
bool tryResume;
};
/////////////////////////////////////////////////////////////////////////////
// DownloadManager
class DownloadManager : public IDownload
{
public:
DownloadManager();
virtual ~DownloadManager();
public:
void init( void );
HRESULT update( void );
void reset( void );
virtual HRESULT OnError( int error );
virtual HRESULT OnEnd();
virtual HRESULT OnQueryResume();
virtual HRESULT OnProgressUpdate( int bytesread, int totalsize, int timetaken, int timeleft );
virtual HRESULT OnStatusUpdate( int status );
virtual HRESULT downloadFile( std::string server, std::string username, std::string password, std::string file, std::string localfile, std::string regkey, bool tryResume );
std::string getLastLocalFile( void );
bool isDone( void ) { return m_sawEnd || m_wasError; }
bool isOk( void ) { return m_sawEnd; }
bool wasError( void ) { return m_wasError; }
std::string getStatusString( void ) { return m_statusString; }
std::string getErrorString( void ) { return m_errorString; }
void queueFileForDownload( std::string server, std::string username, std::string password, std::string file, std::string localfile, std::string regkey, bool tryResume );
bool isFileQueuedForDownload( void ) { return !m_queuedDownloads.empty(); }
HRESULT downloadNextQueuedFile( void );
private:
bool m_winsockInit;
CDownload *m_download;
bool m_wasError;
bool m_sawEnd;
std::string m_errorString;
std::string m_statusString;
protected:
std::list<QueuedDownload> m_queuedDownloads;
};
extern DownloadManager *TheDownloadManager;
#endif // __DOWNLOADMANAGER_H__

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View file

@ -0,0 +1,101 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "process.h"
Process::Process()
{
directory[0]=0;
command[0]=0;
args[0]=0;
hProcess=NULL;
hThread=NULL;
}
// Create a process
bit8 Create_Process(Process &process)
{
int retval;
STARTUPINFO si;
PROCESS_INFORMATION piProcess;
ZeroMemory(&si,sizeof(si));
si.cb=sizeof(si);
char cmdargs[513];
memset(cmdargs,0,513);
strcpy(cmdargs,process.command);
strcat(cmdargs,process.args);
retval=CreateProcess(NULL,cmdargs,NULL,NULL,FALSE, 0 ,NULL, NULL/*process.directory*/,&si,&piProcess);
process.hProcess=piProcess.hProcess;
process.hThread=piProcess.hThread;
return(TRUE);
}
//
// Wait for a process to complete, and fill in the exit code
//
bit8 Wait_Process(Process &process, DWORD *exit_code)
{
DWORD retval;
retval=WaitForSingleObject(process.hProcess,INFINITE);
if (exit_code != NULL)
*exit_code=-1;
if (retval==WAIT_OBJECT_0) // process exited
{
if (exit_code != NULL)
GetExitCodeProcess(process.hProcess,exit_code);
return(TRUE);
}
else // can this happen?
return(FALSE);
}
/*******************
//
// Get the process to run from the config object
//
bit8 Read_Process_Info(ConfigFile &config,OUT Process &info)
{
Wstring procinfo;
if (config.getString("RUN",procinfo)==FALSE)
{
DBGMSG("Couldn't read the RUN line");
return(FALSE);
}
int offset=0;
Wstring dir;
Wstring executable;
Wstring args;
offset=procinfo.getToken(offset," ",dir);
offset=procinfo.getToken(offset," ",executable);
args=procinfo;
args.remove(0,offset);
///
///
DBGMSG("RUN: EXE = "<<executable.get()<<" DIR = "<<dir.get()<<
" ARGS = "<<args.get());
strcpy(info.command,executable.get());
strcpy(info.directory,dir.get());
strcpy(info.args,args.get());
return(TRUE);
}
*****************/

View file

@ -0,0 +1,42 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PROCESS_HEADER
#define PROCESS_HEADER
#include <windows.h>
#include "wstypes.h"
class Process
{
public:
Process();
char directory[256];
char command[256];
char args[256];
HANDLE hProcess;
HANDLE hThread;
};
//bit8 Read_Process_Info(ConfigFile &config,OUT Process &info);
bit8 Create_Process(Process &process);
bit8 Wait_Process(Process &process, DWORD *exit_code=NULL);
#endif

View file

@ -0,0 +1,61 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Script1.rc
//
#define TXT_ABORT_DOWNLOAD 1
#define TXT_ABORT 2
#define TXT_TIME_REMAIN 3
#define TXT_BYTES_READ 4
#define TXT_BPS 5
#define TXT_CANT_CONTACT 6
#define TXT_ERROR 7
#define TXT_AN_UPGRADE_AVAILABLE 8
#define TXT_DOWNLOAD_NOW 9
#define TXT_DOWNLOADING_FILE 10
#define TXT_NONE 11
#define TXT_UPGRADE_AVAILABLE 12
#define TXT_NO_PATCHES 13
#define TXT_AUTO_UPDATE 14
#define TXT_CONNECTING 15
#define TXT_INSTALL_PROBLEM 16
#define TXT_API_MISSING 17
#define TXT_TITLE 18
#define TXT_REGNOW 19
#define FTP_StatusIdle 20
#define FTP_UnknownError 21
#define FTP_NoSuchServer 22
#define FTP_CouldNotConnect 23
#define FTP_LoginFailed 24
#define FTP_NoSuchFile 25
#define FTP_LocalFileOpenFailed 26
#define FTP_TCPError 27
#define FTP_DisconnectError 28
#define FTP_StatusNone 29
#define FTP_StatusConnecting 30
#define FTP_StatusLoggingIn 31
#define FTP_StatusFindingFile 32
#define FTP_StatusQueryingResume 33
#define FTP_StatusDownloading 34
#define FTP_StatusFinishing 35
#define FTP_StatusDone 36
#define FTP_StatusDisconnecting 37
#define IDD_CONNECTING 101
#define IDD_DOWNLOAD_DIALOG 102
#define IDB_BITMAP1 103
#define IDB_BITMAP 103
#define IDI_ICON1 104
#define IDC_TIMEREM 1001
#define IDC_BYTESLEFT 1002
#define IDC_DLABORT 1004
#define IDC_PROGRESS 1005
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 112
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1006
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View file

@ -0,0 +1,50 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Registry.h
// Simple interface for storing/retreiving registry values
// Author: Matthew D. Campbell, December 2001
#pragma once
#ifndef __REGISTRY_H__
#define __REGISTRY_H__
#include <string>
/**
* Get a string from the registry
*/
bool GetStringFromRegistry(std::string path, std::string key, std::string& val);
/**
* Get an unsigned int from the registry
*/
bool GetUnsignedIntFromRegistry(std::string path, std::string key, unsigned int& val);
/**
* Store a string in the registry - returns true on success
*/
bool SetStringInRegistry(std::string path, std::string key, std::string val);
/**
* Store an unsigned int in the registry - returns true on success
*/
bool SetUnsignedIntInRegistry(std::string path, std::string key, unsigned int val);
#endif // __REGISTRY_H__

View file

@ -0,0 +1,669 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// German (Germany) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_CONNECTING DIALOG DISCARDABLE 0, 0, 117, 20
STYLE DS_ABSALIGN | DS_CENTER | WS_POPUP | WS_THICKFRAME
FONT 18, "MS Sans Serif"
BEGIN
CTEXT "Verbinde mit EA",IDC_STATIC,12,4,93,12,SS_CENTERIMAGE
END
IDD_DOWNLOAD_DIALOG DIALOG DISCARDABLE 0, 0, 290, 143
STYLE DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Downloading Patch"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "Cancel",IDC_DLABORT,113,122,63,14
LTEXT "",IDC_TIMEREM,158,83,125,11
LTEXT "",IDC_BYTESLEFT,7,83,119,11
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER,7,
99,276,16
CONTROL 103,IDC_STATIC,"Static",SS_BITMAP | SS_REALSIZEIMAGE |
SS_SUNKEN,30,7,229,70
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_CONNECTING, DIALOG
BEGIN
LEFTMARGIN, 5
RIGHTMARGIN, 112
TOPMARGIN, 4
BOTTOMMARGIN, 16
END
IDD_DOWNLOAD_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 283
TOPMARGIN, 7
BOTTOMMARGIN, 136
END
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040704b0"
BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Electronic Arts\0"
VALUE "FileDescription", "patchgrabber\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "patchgrabber\0"
VALUE "LegalCopyright", "Copyright © 2002\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "patchgrabber.exe\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Electronic Arts patchgrabber\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x407, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_BITMAP BITMAP DISCARDABLE "GeneralsGerman.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON DISCARDABLE "Generals.ico"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
TXT_ABORT_DOWNLOAD "Sind Sie sicher, daß Sie das Download abbrechen möchten?"
TXT_ABORT "Abbrechen"
TXT_TIME_REMAIN "Verbleibende Zeit: %d:%02d"
TXT_BYTES_READ "Gelesene Bytes: %d von %d"
TXT_BPS "Bytes pro Sekunde: %d"
TXT_CANT_CONTACT "Verbindung zum Electronic Arts-Update-Server konnte nicht hergestellt werden."
TXT_ERROR "Fehler"
TXT_AN_UPGRADE_AVAILABLE "Ein Upgrade ist verfügbar."
TXT_DOWNLOAD_NOW "Möchten Sie es jetzt herunterladen?"
TXT_DOWNLOADING_FILE "Datei %d von %d wird heruntergeladen ..."
TXT_NONE """"""
TXT_UPGRADE_AVAILABLE "Upgrade verfügbar"
TXT_NO_PATCHES "Für dieses Produkt gibt es z.Z. kein Patch."
TXT_AUTO_UPDATE "Auto-Update:"
TXT_CONNECTING "Verbinde ..."
END
STRINGTABLE DISCARDABLE
BEGIN
TXT_INSTALL_PROBLEM "Das Spiel ist nicht korrekt installiert. Möglicherweise müssen Sie erneut installieren."
TXT_TITLE "Electronic Arts Auto-Patch"
TXT_REGNOW "Möchten Sie sich bei Generals Online registrieren?"
END
#endif // German (Germany) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_CONNECTING DIALOG DISCARDABLE 0, 0, 117, 21
STYLE DS_ABSALIGN | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU |
WS_THICKFRAME
FONT 18, "MS Sans Serif"
BEGIN
CTEXT "Connecting to EA",IDC_STATIC,5,4,107,13,SS_CENTERIMAGE
END
IDD_DOWNLOAD_DIALOG DIALOG DISCARDABLE 0, 0, 290, 143
STYLE DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Downloading Patch"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "Cancel",IDC_DLABORT,113,122,63,14
LTEXT "",IDC_TIMEREM,158,83,125,11
LTEXT "",IDC_BYTESLEFT,7,83,119,11
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER,7,
99,276,16
CONTROL 103,IDC_STATIC,"Static",SS_BITMAP | SS_REALSIZEIMAGE |
SS_SUNKEN,30,7,229,70
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_CONNECTING, DIALOG
BEGIN
LEFTMARGIN, 5
RIGHTMARGIN, 112
TOPMARGIN, 4
BOTTOMMARGIN, 17
END
IDD_DOWNLOAD_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 283
TOPMARGIN, 7
BOTTOMMARGIN, 136
END
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Electronic Arts\0"
VALUE "FileDescription", "patchgrabber\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "patchgrabber\0"
VALUE "LegalCopyright", "Copyright © 2002\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "patchgrabber.exe\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Electronic Arts patchgrabber\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_BITMAP BITMAP DISCARDABLE "GeneralsEnglish.bmp"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON DISCARDABLE "Generals.ico"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
TXT_ABORT_DOWNLOAD "Are you sure you want to abort the download?"
TXT_ABORT "Abort"
TXT_TIME_REMAIN "Time Remaining: %d:%02d"
TXT_BYTES_READ "Bytes Read: %d of %d"
TXT_BPS "Bytes Per Second: %d"
TXT_CANT_CONTACT "Unable to contact the Electronic Arts update server."
TXT_ERROR "Error"
TXT_AN_UPGRADE_AVAILABLE "There is an upgrade available."
TXT_DOWNLOAD_NOW "Would you like to download it now?"
TXT_DOWNLOADING_FILE "Downloading file %d of %d..."
TXT_NONE """"""
TXT_UPGRADE_AVAILABLE "Upgrade Available"
TXT_NO_PATCHES "There aren't any patches for this product right now."
TXT_AUTO_UPDATE "Auto-Update:"
TXT_CONNECTING "Connecting..."
END
STRINGTABLE DISCARDABLE
BEGIN
TXT_INSTALL_PROBLEM "The game does not appear to be installed properly. You may need to re-install."
TXT_TITLE "Electronic Arts Auto-Patch"
TXT_REGNOW "Would you like to register with Generals Online?"
FTP_StatusIdle "Idle"
FTP_UnknownError "Unknown Error"
FTP_NoSuchServer "Server not found"
FTP_CouldNotConnect "Could not connect"
FTP_LoginFailed "Login failed"
FTP_NoSuchFile "File not found"
FTP_LocalFileOpenFailed "Could not write the file to disk"
FTP_TCPError "Network Error"
FTP_DisconnectError "Connection to server was lost."
FTP_StatusNone "Idle"
FTP_StatusConnecting "Connecting..."
FTP_StatusLoggingIn "Logging in..."
END
STRINGTABLE DISCARDABLE
BEGIN
FTP_StatusFindingFile "Finding file..."
FTP_StatusQueryingResume "Attempting to resume download..."
FTP_StatusDownloading "Downloading..."
FTP_StatusFinishing "Finishing..."
FTP_StatusDone "Done."
FTP_StatusDisconnecting "Disconnecting..."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// French (France) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#ifdef _WIN32
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_CONNECTING DIALOG DISCARDABLE 0, 0, 117, 20
STYLE DS_ABSALIGN | DS_CENTER | WS_POPUP | WS_THICKFRAME
FONT 18, "MS Sans Serif"
BEGIN
CTEXT "Connexion à EA",IDC_STATIC,12,4,93,12,SS_CENTERIMAGE
END
IDD_DOWNLOAD_DIALOG DIALOG DISCARDABLE 0, 0, 290, 143
STYLE DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Downloading Patch"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "Cancel",IDC_DLABORT,113,122,63,14
LTEXT "",IDC_TIMEREM,158,83,125,11
LTEXT "",IDC_BYTESLEFT,7,83,119,11
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER,7,
99,276,16
CONTROL 103,IDC_STATIC,"Static",SS_BITMAP | SS_REALSIZEIMAGE |
SS_SUNKEN,30,7,229,70
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_CONNECTING, DIALOG
BEGIN
LEFTMARGIN, 5
RIGHTMARGIN, 112
TOPMARGIN, 4
BOTTOMMARGIN, 16
END
IDD_DOWNLOAD_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 283
TOPMARGIN, 7
BOTTOMMARGIN, 136
END
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040c04b0"
BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Electronic Arts\0"
VALUE "FileDescription", "patchgrabber\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "patchgrabber\0"
VALUE "LegalCopyright", "Copyright © 2002\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "patchgrabber.exe\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Electronic Arts patchgrabber\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x40c, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_BITMAP BITMAP DISCARDABLE "GeneralsFrench.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON DISCARDABLE "Generals.ico"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
TXT_ABORT_DOWNLOAD "Confirmer abandon du téléchargement ?"
TXT_ABORT "Abandon"
TXT_TIME_REMAIN "Temps restant : %d:%02d"
TXT_BYTES_READ "Octets lus : %d sur %d"
TXT_BPS "Octets/seconde : %d"
TXT_CANT_CONTACT "La connexion au serveur de mise à jour de Electronic Arts a échoué."
TXT_ERROR "Erreur"
TXT_AN_UPGRADE_AVAILABLE "Une mise à jour est disponible."
TXT_DOWNLOAD_NOW "Voulez-vous la télécharger maintenant ?"
TXT_DOWNLOADING_FILE "Téléchargement du fichier %d sur %d..."
TXT_NONE """"""
TXT_UPGRADE_AVAILABLE "Mise à jour disponible"
TXT_NO_PATCHES "Aucun patch n'est disponible pour ce produit."
TXT_AUTO_UPDATE "Mise à jour automatique :"
TXT_CONNECTING "Connexion..."
END
STRINGTABLE DISCARDABLE
BEGIN
TXT_INSTALL_PROBLEM "L'installation du jeu a échoué. Il est préférable de recommencer l'opération."
TXT_TITLE "Patch automatique de Electronic Arts"
TXT_REGNOW "Voulez-vous vous inscrire à Generals Online ?"
END
#endif // French (France) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Spanish (Modern) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESN)
#ifdef _WIN32
LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_MODERN
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_CONNECTING DIALOG DISCARDABLE 0, 0, 117, 20
STYLE DS_ABSALIGN | DS_CENTER | WS_POPUP | WS_THICKFRAME
FONT 18, "MS Sans Serif"
BEGIN
CTEXT "Connectando con EA",IDD_CONNECTING,12,4,93,12,
SS_CENTERIMAGE
END
IDD_DOWNLOAD_DIALOG DIALOG DISCARDABLE 0, 0, 290, 143
STYLE DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Descargando Parche"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "Cancelar",IDC_DLABORT,113,122,63,14
LTEXT "",IDC_TIMEREM,158,83,125,11
LTEXT "",IDC_BYTESLEFT,7,83,119,11
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER,7,
99,276,16
CONTROL 103,IDC_STATIC,"Static",SS_BITMAP | SS_REALSIZEIMAGE |
SS_SUNKEN,30,7,229,70
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_CONNECTING, DIALOG
BEGIN
LEFTMARGIN, 5
RIGHTMARGIN, 112
TOPMARGIN, 4
BOTTOMMARGIN, 16
END
IDD_DOWNLOAD_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 283
TOPMARGIN, 7
BOTTOMMARGIN, 136
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_BITMAP BITMAP DISCARDABLE "GeneralsEnglish.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON DISCARDABLE "Generals.ico"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
TXT_ABORT_DOWNLOAD "¿Seguro que quieres abortar la descarga?"
TXT_ABORT "Abortar"
TXT_TIME_REMAIN "Tiempo Restante: %d:%02d"
TXT_BYTES_READ "Bytes Leídos: %d of %d"
TXT_BPS "Bytes Por Segundo: %d"
TXT_CANT_CONTACT "No se puede contactar con el servidor de actualizaciones de Electronic Arts."
TXT_ERROR "Error"
TXT_AN_UPGRADE_AVAILABLE "Hay una actualización disponible."
TXT_DOWNLOAD_NOW "¿Quieres descargarla ahora?"
TXT_DOWNLOADING_FILE "Descargando el archivo %d de %d..."
TXT_NONE """"""
TXT_UPGRADE_AVAILABLE "Actualización Disponible"
TXT_NO_PATCHES "No hay parches disponibles para este producto."
TXT_AUTO_UPDATE "Auto-Actualización:"
TXT_CONNECTING "Conectando..."
END
STRINGTABLE DISCARDABLE
BEGIN
TXT_INSTALL_PROBLEM "El juego parece no estar correctamente instalado. Puedes necesitar reinstalarlo."
TXT_TITLE "Auto-Parche Electronic Arts"
TXT_REGNOW "¿Quieres registrarte a través de Generals Online?"
END
#endif // Spanish (Modern) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View file

@ -0,0 +1,186 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include "winblows.h"
HINSTANCE Global_instance;
LPSTR Global_commandline;
int Global_commandshow;
/*
* WinMain - initialization, message loop
*/
int PASCAL WinMain( HINSTANCE instance, HINSTANCE, char *command_line, int command_show)
{
//////MSG msg;
Global_instance = instance;
Global_commandline = command_line;
Global_commandshow = command_show;
int argc;
char *argv[64];
char path_to_exe[512];
GetModuleFileName(instance,(char *)&path_to_exe,512);
argc=1;
argv[0]=path_to_exe;
int command_scan=0;
char command_char;
do
{
/*
** Scan for non-space character on command line
*/
do
{
command_char = *( command_line+command_scan++ );
} while ( command_char==' ' );
if ( command_char!=0 && command_char != 13 )
{
argv[argc++]=command_line+command_scan-1;
/*
** Scan for space character on command line
*/
do
{
command_char = *( command_line+command_scan++ );
} while ( command_char!=' ' && command_char != 0 && command_char!=13);
*( command_line+command_scan-1 ) = 0;
}
} while ( command_char != 0 && command_char != 13 && argc<20 );
return(main(argc,argv));
} /* WinMain */
int Print_WM(UINT message,char *out)
{
switch(message)
{
case WM_NULL:
sprintf(out,"WM_NULL");
break;
case WM_CREATE:
sprintf(out,"WM_CREATE");
break;
case WM_DESTROY:
sprintf(out,"WM_DESTROY");
break;
case WM_CANCELMODE:
sprintf(out,"WM_CANCELMODE");
break;
case WM_ERASEBKGND:
sprintf(out,"WM_ERASEBKGND");
break;
case WM_GETTEXT:
sprintf(out,"WM_GETTEXT");
break;
case WM_QUERYOPEN:
sprintf(out,"WM_QUERYOPEN");
break;
case WM_MOVE:
sprintf(out,"WM_MOVE");
break;
case WM_SIZE:
sprintf(out,"WM_SIZE");
break;
case WM_ACTIVATE:
sprintf(out,"WM_ACTIVATE");
break;
case WM_SETFOCUS:
sprintf(out,"WM_SETFOCUS");
break;
case WM_KILLFOCUS:
sprintf(out,"WM_KILLFOCUS");
break;
case WM_ENABLE:
sprintf(out,"WM_ENABLE");
break;
case WM_SETREDRAW:
sprintf(out,"WM_REDRAW");
break;
case WM_PAINT:
sprintf(out,"WM_PAINT");
break;
case WM_CLOSE:
sprintf(out,"WM_CLOSE");
break;
case WM_QUIT:
sprintf(out,"WM_QUIT");
break;
case WM_ACTIVATEAPP:
sprintf(out,"WM_ACTIVATEAPP");
break;
case WM_SETCURSOR:
sprintf(out,"WM_SETCURSOR");
break;
case WM_KEYDOWN:
sprintf(out,"WM_KEYDOWN");
break;
case WM_MOUSEMOVE:
sprintf(out,"WM_MOUSEMOVE");
break;
case WM_WINDOWPOSCHANGING:
sprintf(out,"WM_WINDOWPOSCHANGING");
break;
case WM_WINDOWPOSCHANGED:
sprintf(out,"WM_WINDOWPOSCHANGED");
break;
case WM_DISPLAYCHANGE:
sprintf(out,"WM_DISPLAYCHANGE");
break;
case WM_NCPAINT:
sprintf(out,"WM_NCPAINT");
break;
case WM_PALETTEISCHANGING:
sprintf(out,"WM_PALETTEISCHANGING");
break;
case WM_PALETTECHANGED:
sprintf(out,"WM_PALETTECHANGED");
break;
case WM_NCACTIVATE:
sprintf(out,"WM_NCACTIVATE");
break;
case WM_NCCALCSIZE:
sprintf(out,"WM_NCCALCSIZE");
break;
case WM_SYSCOMMAND:
sprintf(out,"WM_SYSCOMMAND");
break;
default:
sprintf(out,"? UNKNOWN ?");
return(-1);
}
return(0);
}

View file

@ -0,0 +1,37 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WINBLOWS_HEADER
#define WINBLOWS_HEADER
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include <stdlib.h>
#include"wstypes.h"
extern HINSTANCE Global_instance;
extern LPSTR Global_commandline;
extern int Global_commandshow;
extern int main(int argc, char *argv[]);
int Print_WM(UINT wm,char *out);
#endif

View file

@ -0,0 +1,74 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/****************************************************************************\
* C O N F I D E N T I A L --- W E S T W O O D S T U D I O S *
******************************************************************************
Project Name:
File Name : wstypes.h
Author : Neal Kettler
Start Date : June 3, 1997
Last Update : June 17, 1997
Standard type definitions for the sake of portability and readability.
\***************************************************************************/
#ifndef WTYPES_HEADER
#define WTYPES_HEADER
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
//These are used for readability purposes mostly, when a method takes a
// pointer or reference these help specify what will happen to the data
// that is sent in.
#define IN
#define OUT
#define INOUT
typedef char bit8;
typedef char sint8;
typedef unsigned char uint8;
typedef signed short int sint16;
typedef unsigned short int uint16;
typedef signed int sint32;
typedef unsigned int uint32;
#define MAX_BIT8 0x1
#define MAX_UINT32 0xFFFFFFFF
#define MAX_UINT16 0xFFFF
#define MAX_UINT8 0xFF
#define MAX_SINT32 0x7FFFFFFF
#define MAX_SINT16 0x7FFF
#define MAX_SINT8 0x7F
#ifdef _WIN32
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
#endif

View file

@ -0,0 +1,112 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// FILE: debug.cpp ////////////////////////////////////////////////////////
// Minmal debug info
// Author: Matthew D. Campbell, Sept 2002
#include <windows.h>
#include "debug.h"
#include <cstdio>
char* TheCurrentIgnoreCrashPtr;
#define LARGE_BUFFER 8192
static char theBuffer[ LARGE_BUFFER ]; // make it big to avoid weird overflow bugs in debug mode
static int doCrashBox(const char *buffer, bool logResult)
{
int result;
result = ::MessageBox(NULL, buffer, "Assertion Failure", MB_ABORTRETRYIGNORE|MB_APPLMODAL|MB_ICONWARNING);
switch(result)
{
case IDABORT:
#ifdef DEBUG_LOGGING
if (logResult)
DebugLog("[Abort]\n");
#endif
_exit(1);
break;
case IDRETRY:
#ifdef DEBUG_LOGGING
if (logResult)
DebugLog("[Retry]\n");
#endif
::DebugBreak();
break;
case IDIGNORE:
#ifdef DEBUG_LOGGING
// do nothing, just keep going
if (logResult)
DebugLog("[Ignore]\n");
#endif
break;
}
return result;
}
#ifdef DEBUG
void DebugLog(const char *fmt, ...)
{
va_list va;
va_start( va, fmt );
vsnprintf(theBuffer, LARGE_BUFFER, fmt, va );
theBuffer[LARGE_BUFFER-1] = 0;
va_end( va );
OutputDebugString(theBuffer);
printf( "%s", theBuffer );
}
#endif // DEBUG
#ifdef DEBUG_CRASHING
void DebugCrash(const char *format, ...)
{
theBuffer[0] = 0;
strcat(theBuffer, "ASSERTION FAILURE: ");
va_list arg;
va_start(arg, format);
vsprintf(theBuffer + strlen(theBuffer), format, arg);
va_end(arg);
if (strlen(theBuffer) >= sizeof(theBuffer))
::MessageBox(NULL, "String too long for debug buffers", "", MB_OK|MB_APPLMODAL);
OutputDebugString(theBuffer);
printf( "%s", theBuffer );
strcat(theBuffer, "\n\nAbort->exception; Retry->debugger; Ignore->continue\n");
int result = doCrashBox(theBuffer, true);
if (result == IDIGNORE && TheCurrentIgnoreCrashPtr != NULL)
{
int yn;
yn = ::MessageBox(NULL, "Ignore this crash from now on?", "", MB_YESNO|MB_APPLMODAL);
if (yn == IDYES)
*TheCurrentIgnoreCrashPtr = 1;
}
}
#endif

View file

@ -0,0 +1,73 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// FILE: debug.h //////////////////////////////////////////////////////////////
// Minimal debug info
// Author: Matthew D. Campbell, Sept 2002
#ifndef __DEBUG_H__
#define __DEBUG_H__
#ifdef DEBUG
#include <cstdarg>
void DebugLog( const char *fmt, ... );
#define DEBUG_LOG(x) DebugLog x
#else // DEBUG
#define DEBUG_LOG(x) {}
#endif // DEBUG
#ifdef DEBUG_CRASHING
extern void DebugCrash(const char *format, ...);
/*
Yeah, it's a sleazy global, since we can't reasonably add
any args to DebugCrash due to the varargs nature of it.
We'll just let it slide in this case...
*/
extern char* TheCurrentIgnoreCrashPtr;
#define DEBUG_CRASH(m) \
do { \
{ \
static char ignoreCrash = 0; \
if (!ignoreCrash) { \
TheCurrentIgnoreCrashPtr = &ignoreCrash; \
DebugCrash m ; \
TheCurrentIgnoreCrashPtr = NULL; \
} \
} \
} while (0)
#define DEBUG_ASSERTCRASH(c, m) do { { if (!(c)) DEBUG_CRASH(m); } } while (0)
#else
#define DEBUG_CRASH(m) ((void)0)
#define DEBUG_ASSERTCRASH(c, m) ((void)0)
#endif
#endif // __DEBUG_H__

View file

@ -0,0 +1,271 @@
# Microsoft Developer Studio Project File - Name="patchgrabber" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=patchgrabber - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "patchgrabber.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "patchgrabber.mak" CFG="patchgrabber - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "patchgrabber - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "patchgrabber - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "patchgrabber - Win32 German" (based on "Win32 (x86) Application")
!MESSAGE "patchgrabber - Win32 French" (based on "Win32 (x86) Application")
!MESSAGE "patchgrabber - Win32 Spanish" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""$/Patchget", QGEAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "patchgrabber - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../Libraries" /I "../../Libraries/Source/GameSpy" /I "../../Libraries/Source/WWVegas" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG" /d "AFX_RESOURCE_DLL" /d "AFX_TARG_ENU"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib comctl32.lib gamespyhttp.lib wsock32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\libraries\lib"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Making patchget.dat
PostBuild_Cmds=copy Release\PatchGrabber.exe ..\..\..\Run\patchget.dat
# End Special Build Tool
!ELSEIF "$(CFG)" == "patchgrabber - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../Libraries/Source/WWVegas" /I "../../Libraries/Source/GameSpy" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "DEBUG" /D "DEBUG_CRASHING" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib comctl32.lib gamespyhttpdebug.lib wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /libpath:"..\..\libraries\lib"
!ELSEIF "$(CFG)" == "patchgrabber - Win32 German"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "German"
# PROP BASE Intermediate_Dir "German"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "German"
# PROP Intermediate_Dir "German"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../Libraries" /I "../../Libraries/Source/GameSpy" /I "../../Libraries/Source/WWVegas" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x407 /d "NDEBUG" /d "AFX_TARG_DEU" /d "AFX_RESOURCE_DLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib comctl32.lib gamespyhttp.lib wsock32.lib wwdownload.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\libraries\lib"
!ELSEIF "$(CFG)" == "patchgrabber - Win32 French"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "French"
# PROP BASE Intermediate_Dir "French"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "French"
# PROP Intermediate_Dir "French"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../Libraries" /I "../../Libraries/Source/GameSpy" /I "../../Libraries/Source/WWVegas" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG" /d "AFX_TARG_DEU" /d "AFX_RESOURCE_DLL"
# ADD RSC /l 0x40c /d "NDEBUG" /d "AFX_TARG_FRA" /d "AFX_RESOURCE_DLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib comctl32.lib gamespyhttp.lib wsock32.lib wwdownload.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\libraries\lib"
!ELSEIF "$(CFG)" == "patchgrabber - Win32 Spanish"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Spanish"
# PROP BASE Intermediate_Dir "Spanish"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Spanish"
# PROP Intermediate_Dir "Spanish"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../Libraries" /I "../../Libraries/Source/GameSpy" /I "../../Libraries/Source/WWVegas" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG" /d "AFX_TARG_DEU" /d "AFX_RESOURCE_DLL"
# ADD RSC /l 0xc0a /d "NDEBUG" /d "AFX_TARG_ESN" /d "AFX_RESOURCE_DLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib comctl32.lib gamespyhttp.lib wsock32.lib wwdownload.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\libraries\lib"
!ENDIF
# Begin Target
# Name "patchgrabber - Win32 Release"
# Name "patchgrabber - Win32 Debug"
# Name "patchgrabber - Win32 German"
# Name "patchgrabber - Win32 French"
# Name "patchgrabber - Win32 Spanish"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\chatapi.cpp
# End Source File
# Begin Source File
SOURCE=.\cominit.cpp
# End Source File
# Begin Source File
SOURCE=.\debug.cpp
# End Source File
# Begin Source File
SOURCE=.\DownloadManager.cpp
# End Source File
# Begin Source File
SOURCE=.\process.cpp
# End Source File
# Begin Source File
SOURCE=.\winblows.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\chatapi.h
# End Source File
# Begin Source File
SOURCE=.\cominit.h
# End Source File
# Begin Source File
SOURCE=.\debug.h
# End Source File
# Begin Source File
SOURCE=.\DownloadManager.h
# End Source File
# Begin Source File
SOURCE=.\process.h
# End Source File
# Begin Source File
SOURCE=.\RESOURCE.H
# End Source File
# Begin Source File
SOURCE=.\WINBLOWS.H
# End Source File
# Begin Source File
SOURCE=.\WSTYPES.H
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\Generals.ico
# End Source File
# Begin Source File
SOURCE=.\GeneralsEnglish.BMP
# End Source File
# Begin Source File
SOURCE=.\GeneralsFrench.BMP
# End Source File
# Begin Source File
SOURCE=.\GeneralsGerman.BMP
# End Source File
# Begin Source File
SOURCE=.\Script1.rc
# End Source File
# End Group
# End Target
# End Project

View file

@ -0,0 +1,136 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Registry.cpp
// Simple interface for storing/retreiving registry values
// Author: Matthew D. Campbell, December 2001
#include <string>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "Registry.h"
bool getStringFromRegistry(HKEY root, std::string path, std::string key, std::string& val)
{
HKEY handle;
unsigned char buffer[256];
unsigned long size = 256;
unsigned long type;
int returnValue;
if ((returnValue = RegOpenKeyEx( root, path.c_str(), 0, KEY_ALL_ACCESS, &handle )) == ERROR_SUCCESS)
{
returnValue = RegQueryValueEx(handle, key.c_str(), NULL, &type, (unsigned char *) &buffer, &size);
RegCloseKey( handle );
}
if (returnValue == ERROR_SUCCESS)
{
val = (char *)buffer;
return true;
}
return false;
}
bool getUnsignedIntFromRegistry(HKEY root, std::string path, std::string key, unsigned int& val)
{
HKEY handle;
unsigned long buffer;
unsigned long size = sizeof(buffer);
unsigned long type;
int returnValue;
if ((returnValue = RegOpenKeyEx( root, path.c_str(), 0, KEY_ALL_ACCESS, &handle )) == ERROR_SUCCESS)
{
returnValue = RegQueryValueEx(handle, key.c_str(), NULL, &type, (unsigned char *) &buffer, &size);
RegCloseKey( handle );
}
if (returnValue == ERROR_SUCCESS)
{
val = buffer;
return true;
}
return false;
}
bool setStringInRegistry( HKEY root, std::string path, std::string key, std::string val)
{
HKEY handle;
unsigned long type;
unsigned long returnValue;
int size;
if ((returnValue = RegCreateKeyEx( root, path.c_str(), 0, "REG_NONE", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &handle, NULL )) == ERROR_SUCCESS)
{
type = REG_SZ;
size = val.length()+1;
returnValue = RegSetValueEx(handle, key.c_str(), 0, type, (unsigned char *)val.c_str(), size);
RegCloseKey( handle );
}
return (returnValue == ERROR_SUCCESS);
}
bool setUnsignedIntInRegistry( HKEY root, std::string path, std::string key, unsigned int val)
{
HKEY handle;
unsigned long type;
unsigned long returnValue;
int size;
if ((returnValue = RegCreateKeyEx( root, path.c_str(), 0, "REG_NONE", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &handle, NULL )) == ERROR_SUCCESS)
{
type = REG_DWORD;
size = 4;
returnValue = RegSetValueEx(handle, key.c_str(), 0, type, (unsigned char *)&val, size);
RegCloseKey( handle );
}
return (returnValue == ERROR_SUCCESS);
}
bool GetStringFromRegistry(std::string path, std::string key, std::string& val)
{
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
fullPath.append(path);
if (getStringFromRegistry(HKEY_LOCAL_MACHINE, fullPath.c_str(), key.c_str(), val))
{
return true;
}
return getStringFromRegistry(HKEY_CURRENT_USER, fullPath.c_str(), key.c_str(), val);
}
bool GetUnsignedIntFromRegistry(std::string path, std::string key, unsigned int& val)
{
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
fullPath.append(path);
if (getUnsignedIntFromRegistry(HKEY_LOCAL_MACHINE, fullPath.c_str(), key.c_str(), val))
{
return true;
}
return getUnsignedIntFromRegistry(HKEY_CURRENT_USER, fullPath.c_str(), key.c_str(), val);
}