Removing Install
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19749 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
fa7e240226
commit
8c9a1303d8
File diff suppressed because it is too large
Load Diff
@ -1,116 +0,0 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define I_DialogBeta 329
|
||||
#define I_Dialog1 330
|
||||
#define I_Dialog2 331
|
||||
#define I_Dialog3 332
|
||||
#define I_Dialog4 333
|
||||
#define I_Dialog5 334
|
||||
#define I_Dialog6 335
|
||||
#define I_Dialog7 336
|
||||
#define I_Dialog8 337
|
||||
#define I_Dialog9 338
|
||||
#define I_Dialog10 339
|
||||
#define I_Dialog11 340
|
||||
#define I_Dialog12 341
|
||||
|
||||
#define I_Cancel 258
|
||||
#define I_Icon 261
|
||||
#define I_Logo 262
|
||||
#define I_Ja 265
|
||||
#define I_Nein 266
|
||||
#define I_Halt 267
|
||||
#define I_Alle 268
|
||||
#define I_Karte 269
|
||||
#define I_Confirm 270
|
||||
#define I_BMPWin 271
|
||||
#define I_Dest 300
|
||||
#define I_Text 301
|
||||
#define I_OK 304
|
||||
#define I_Cancel2 305
|
||||
#define I_Logo16 306
|
||||
|
||||
#define NONE 0
|
||||
#define INSTALLING 1
|
||||
#define ABORTED 2
|
||||
#define COMPLETED 3
|
||||
|
||||
#define UPDATE_ALWAYS 1
|
||||
#define UPDATE_NONEXIST 2
|
||||
|
||||
#define DLG_PACKAGESTOINSTALL 305
|
||||
#define PACKAGES 306
|
||||
#define PB_SELECTALL 308
|
||||
#define PB_DESELECTALL 309
|
||||
#define DLG_SELECTINSTALLATIONDRIVE 311
|
||||
#define PB_OK 313
|
||||
#define PB_CANCEL 314
|
||||
#define DRIVELIST 312
|
||||
#define I_LOGO1 316
|
||||
#define I_LOGO2 317
|
||||
#define I_LOGO3 318
|
||||
#define I_LOGO4 319
|
||||
#define I_LOGO5 320
|
||||
#define I_LOGO6 321
|
||||
#define I_LOGO7 322
|
||||
#define I_LOGO8 323
|
||||
#define I_LOGOBETA 324
|
||||
|
||||
/* These are static */
|
||||
#define I_Status 348
|
||||
#define I_Welcome 349
|
||||
|
||||
/* Keep these in order... so we can loop */
|
||||
#define I_INFOBOX 355
|
||||
#define I_Info1 356
|
||||
#define I_Info2 357
|
||||
#define I_Info3 358
|
||||
#define I_README 359
|
||||
#define I_Licence 360
|
||||
#define I_Agree 361
|
||||
#define I_Updates1 362
|
||||
#define I_Updates2 363
|
||||
#define I_Updates4 364
|
||||
#define I_Updates3 365
|
||||
#define I_Dirs 366
|
||||
#define I_InstallDir 367
|
||||
#define I_Drives 368
|
||||
#define I_Percent 369
|
||||
#define I_Back 370
|
||||
#define I_Next 371
|
||||
#define I_Progress 372
|
||||
#define I_Grid 373
|
||||
#define I_MAX 374
|
||||
|
||||
#define FILEICON 3800
|
||||
#define FOLDERICON 3810
|
||||
|
||||
#define THREAD_STACK_SIZE 32768
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 1024
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
/* #define ENABLE_LOGGING */
|
||||
|
||||
|
||||
void grabfile(char *filename);
|
||||
void readme(void *param);
|
||||
void install_thread(void *param);
|
||||
void install_init(char *installername);
|
||||
int getparseline(FILE *f, char comment, char delimiter, char quotes, char *raw, char *entry, char *entrydata, char *entrydata2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,717 +0,0 @@
|
||||
/*
|
||||
* instsup.c (c) 1999,2000 Brian Smith
|
||||
*/
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#if defined(__OS2__) || defined(__EMX__) || defined(WIN32) || defined(WINNT)
|
||||
#include <process.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#ifdef WIN32
|
||||
#include <shlobj.h>
|
||||
#endif
|
||||
#include "install.h"
|
||||
#include "instsup.h"
|
||||
|
||||
extern char *INSTALLER_TITLE;
|
||||
extern char *INSTALLER_PROGRAM;
|
||||
extern char *INSTALLER_FOLDER;
|
||||
extern char *INSTALLER_SHADOW;
|
||||
extern char *INSTALLER_OBJECT;
|
||||
extern char tempPath[], installdir[], csfile[], bufile[], bootdrive[], instlog[], installdir2[];
|
||||
extern int installstate, success;
|
||||
|
||||
extern FILE *self;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
char *replaceem(char *orig);
|
||||
|
||||
int sendmessage(int destination, int messid)
|
||||
{
|
||||
#if 0
|
||||
/* Update percentage bar */
|
||||
if(messid == 1)
|
||||
{
|
||||
wxMutexGuiEnter();
|
||||
|
||||
updatepercent();
|
||||
|
||||
wxMutexGuiLeave();
|
||||
}
|
||||
if(messid == 2)
|
||||
{
|
||||
extern wxCondition *InstCond;
|
||||
|
||||
InstCond->Broadcast();
|
||||
}
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DoGUI(void)
|
||||
{
|
||||
updatepercent();
|
||||
wxYield();
|
||||
}
|
||||
/* This should return the current color depth */
|
||||
unsigned long color_depth(void)
|
||||
{
|
||||
#if __OS2__
|
||||
HDC hdc = WinOpenWindowDC(HWND_DESKTOP);
|
||||
LONG colors;
|
||||
|
||||
DevQueryCaps(hdc, CAPS_COLORS, 1, &colors);
|
||||
DevCloseDC(hdc);
|
||||
return colors;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Call the reboot vector.
|
||||
*/
|
||||
void sysreboot(void)
|
||||
{
|
||||
#if __OS2__
|
||||
#define SYSFUNC 0xD5
|
||||
#define REBOOT 0xAB
|
||||
#define REBOOTDEV "\\DEV\\DOS$"
|
||||
|
||||
APIRET rc;
|
||||
HFILE hREBOOT;
|
||||
ULONG ulAction;
|
||||
|
||||
rc = DosOpen(REBOOTDEV,
|
||||
&hREBOOT,
|
||||
&ulAction,
|
||||
0L,
|
||||
FILE_NORMAL,
|
||||
FILE_OPEN,
|
||||
OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
|
||||
0L);
|
||||
if (rc == 0)
|
||||
{
|
||||
DosDevIOCtl(hREBOOT,
|
||||
SYSFUNC,
|
||||
REBOOT,
|
||||
NULL,
|
||||
0L,
|
||||
NULL,
|
||||
NULL,
|
||||
0L,
|
||||
NULL);
|
||||
DosClose(hREBOOT);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Display an informational dialog box to the user with the given text.
|
||||
*/
|
||||
int mesg(char *format, ...) {
|
||||
va_list args;
|
||||
char outbuf[4096];
|
||||
|
||||
va_start(args, format);
|
||||
vsprintf(outbuf, format, args);
|
||||
va_end(args);
|
||||
|
||||
wxMessageBox(outbuf, INSTALLER_TITLE,
|
||||
wxOK | wxICON_EXCLAMATION, NULL);
|
||||
|
||||
return strlen(outbuf);
|
||||
}
|
||||
|
||||
int checktext(char *text, char *buffer, int buflen)
|
||||
{
|
||||
int z, len = strlen(text);
|
||||
|
||||
for(z=0;z<(buflen-len);z++)
|
||||
{
|
||||
if(memcmp(text, &buffer[z], len) == 0)
|
||||
return z;
|
||||
}
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the offset withing the executable to the specified text.
|
||||
*/
|
||||
long findtext(char *text)
|
||||
{
|
||||
char buffer[512];
|
||||
int offset;
|
||||
unsigned long curpos = 0;
|
||||
|
||||
fseek(self, 0, SEEK_SET);
|
||||
fread(buffer, 1, 512, self);
|
||||
if((offset = checktext(text, buffer, 512)) > -1)
|
||||
return offset;
|
||||
while(!feof(self))
|
||||
{
|
||||
memcpy(buffer, &buffer[256], 256);
|
||||
fread(&buffer[256], 1, 256, self);
|
||||
curpos += 256;
|
||||
if((offset = checktext(text, buffer, 512)) > -1)
|
||||
return offset+curpos;
|
||||
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* We encode archive search text so we don't get confused
|
||||
* by the string table - I was using LXLite to take care
|
||||
* of this problem on OS/2 but in portable code this may
|
||||
* not be an option. */
|
||||
char *decode(char *input)
|
||||
{
|
||||
char *result;
|
||||
int i = 0;
|
||||
|
||||
result = (char *)malloc(strlen(input) / 2 + 1);
|
||||
|
||||
while (input[0] && input[1])
|
||||
{
|
||||
result[i] = ((input[0] - 0x41) << 4) | (input[1] - 0x41);
|
||||
input += 2;
|
||||
i++;
|
||||
}
|
||||
result[i] = '\0';
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Removes any carriage returns or line feeds from the buffer.
|
||||
*/
|
||||
void stripcrlf(char *buffer)
|
||||
{
|
||||
int z, len = strlen(buffer);
|
||||
|
||||
for(z=0;z<len;z++)
|
||||
{
|
||||
if(buffer[z] == '\r' || buffer[z] == '\n')
|
||||
{
|
||||
buffer[z] = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the space free on a given drive... where 0 is A: in MB
|
||||
*/
|
||||
unsigned long drivefree(int drive)
|
||||
{
|
||||
#if __OS2__
|
||||
ULONG aulFSInfoBuf[40] = {0};
|
||||
APIRET rc = NO_ERROR;
|
||||
double bytesFree;
|
||||
|
||||
DosError(FERR_DISABLEHARDERR);
|
||||
rc = DosQueryFSInfo(drive,
|
||||
FSIL_ALLOC,
|
||||
(PVOID)aulFSInfoBuf,
|
||||
sizeof(aulFSInfoBuf));
|
||||
|
||||
DosError(FERR_ENABLEHARDERR);
|
||||
if (rc != NO_ERROR)
|
||||
return 0;
|
||||
|
||||
bytesFree = (double)aulFSInfoBuf[3] * (double)aulFSInfoBuf[1] * (USHORT)aulFSInfoBuf[4];
|
||||
return (unsigned long)(bytesFree / (1024.0 * 1024.0));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Display a fatal error message and set the abort flag in case we are in a secondary thread.
|
||||
*/
|
||||
void error(char *format, ...) {
|
||||
va_list args;
|
||||
char errstring[1024];
|
||||
|
||||
va_start(args, format);
|
||||
vsprintf(errstring, format, args);
|
||||
va_end(args);
|
||||
|
||||
if(installstate != ABORTED)
|
||||
{
|
||||
success=1;
|
||||
installstate=ABORTED;
|
||||
}
|
||||
wxMessageBox(errstring, INSTALLER_TITLE,
|
||||
wxOK | wxICON_EXCLAMATION, NULL);
|
||||
}
|
||||
|
||||
void setdrivedir(char *drivedir)
|
||||
{
|
||||
wxSetWorkingDirectory(drivedir);
|
||||
}
|
||||
|
||||
/*
|
||||
* Make the TEMP directory the current directory, or the root directory of the boot drive.
|
||||
*/
|
||||
void settempdir(void)
|
||||
{
|
||||
#if defined(__EMX__) || defined(__OS2__) || defined(WIN32) || defined(WINNT)
|
||||
/* Windows or OS/2 */
|
||||
char *envdir = getenv("TMP");
|
||||
int len;
|
||||
|
||||
if (!envdir)
|
||||
envdir = getenv("TEMP");
|
||||
if (!envdir)
|
||||
envdir = replaceem("%BOOTDRIVE%:\\");
|
||||
strcpy(tempPath,envdir);
|
||||
len = strlen(tempPath);
|
||||
if (len > 3 && tempPath[len-1] == '\\')
|
||||
tempPath[len-1] = 0;
|
||||
strupr(tempPath);
|
||||
setdrivedir(tempPath);
|
||||
#else
|
||||
/* Unix */
|
||||
setdrivedir("/tmp");
|
||||
#endif
|
||||
}
|
||||
|
||||
void getbootdrive(void)
|
||||
{
|
||||
/* On windows I don't think you can boot from anything
|
||||
except C: drive. So I am not going to do anything here. */
|
||||
}
|
||||
|
||||
void PM_backslash(char *s)
|
||||
{
|
||||
unsigned int pos = strlen(s);
|
||||
if (s[pos-1] != '\\') {
|
||||
s[pos] = '\\';
|
||||
s[pos+1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Makes a folder on the desktop.
|
||||
*/
|
||||
void MakeFolder(char Title[], char Icon[], char dest[], char id[], char setup[])
|
||||
{
|
||||
#ifdef __OS2__
|
||||
char szArg[200];
|
||||
|
||||
memset(szArg,0,sizeof(szArg));
|
||||
|
||||
if ((Icon != NULL) && (strlen(Icon) != 0))
|
||||
{
|
||||
strcat(szArg,"ICONFILE=");
|
||||
strcat(szArg,Icon);
|
||||
}
|
||||
|
||||
if ((id != NULL) && (strlen(id) != 0))
|
||||
{
|
||||
strcat(szArg,";OBJECTID=");
|
||||
strcat(szArg,id);
|
||||
}
|
||||
|
||||
if ((setup != NULL) && (strlen(setup) != 0))
|
||||
{
|
||||
strcat(szArg,";");
|
||||
strcat(szArg,setup);
|
||||
}
|
||||
|
||||
WinCreateObject("WPFolder",Title,szArg,dest,CO_REPLACEIFEXISTS);
|
||||
#elif defined(WIN32)
|
||||
char startpath[MAX_PATH];
|
||||
LPITEMIDLIST pidl;
|
||||
|
||||
if(!SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAMS, &pidl))
|
||||
{
|
||||
SHGetPathFromIDList(pidl, startpath);
|
||||
|
||||
if(startpath[strlen(startpath)-1] != '\\')
|
||||
strcat(startpath, "\\");
|
||||
strcat(startpath, Title);
|
||||
CreateDirectory(startpath, NULL);
|
||||
}
|
||||
#else
|
||||
/* Unix? */
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
HRESULT CreateLink(LPCSTR lpszPathObj,
|
||||
LPSTR lpszPathLink, LPSTR lpszDesc)
|
||||
{
|
||||
HRESULT hres;
|
||||
IShellLink* psl;
|
||||
|
||||
// Get a pointer to the IShellLink interface.
|
||||
hres = CoCreateInstance(CLSID_ShellLink, NULL,
|
||||
CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl);
|
||||
if (SUCCEEDED(hres)) {
|
||||
IPersistFile* ppf;
|
||||
|
||||
// Set the path to the shortcut target, and add the
|
||||
// description.
|
||||
psl->SetPath(lpszPathObj);
|
||||
|
||||
psl->SetDescription(lpszDesc);
|
||||
|
||||
// Query IShellLink for the IPersistFile interface for saving the
|
||||
// shortcut in persistent storage.
|
||||
hres = psl->QueryInterface(IID_IPersistFile,
|
||||
(void **)&ppf);
|
||||
|
||||
if (SUCCEEDED(hres)) {
|
||||
WCHAR wsz[MAX_PATH];
|
||||
|
||||
// Ensure that the string is ANSI.
|
||||
MultiByteToWideChar(CP_ACP, 0, lpszPathLink, -1,
|
||||
wsz, MAX_PATH);
|
||||
|
||||
|
||||
// Save the link by calling IPersistFile::Save.
|
||||
hres = ppf->Save(wsz, TRUE);
|
||||
ppf->Release();
|
||||
}
|
||||
psl->Release();
|
||||
}
|
||||
return hres;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Makes a Program object on the desktop.
|
||||
*/
|
||||
void MakeProgram(char Title[], char Program[], char Icon[], char dest[], char id[], char setup[])
|
||||
{
|
||||
#ifdef __OS2__
|
||||
char szArg[200];
|
||||
|
||||
memset(szArg,0,sizeof(szArg));
|
||||
|
||||
strcat(szArg,"EXENAME=");
|
||||
strcat(szArg,Program);
|
||||
|
||||
if ((Icon != NULL) && (strlen(Icon) != 0))
|
||||
{
|
||||
strcat(szArg,";ICONFILE=");
|
||||
strcat(szArg,Icon);
|
||||
}
|
||||
|
||||
if ((id != NULL) && (strlen(id) != 0))
|
||||
{
|
||||
strcat(szArg,";OBJECTID=");
|
||||
strcat(szArg,id);
|
||||
}
|
||||
|
||||
if ((setup != NULL) && (strlen(setup) != 0))
|
||||
{
|
||||
strcat(szArg,";");
|
||||
strcat(szArg,setup);
|
||||
}
|
||||
|
||||
WinCreateObject("WPProgram",Title,szArg,dest,CO_REPLACEIFEXISTS);
|
||||
#elif defined(WIN32)
|
||||
char startpath[MAX_PATH];
|
||||
LPITEMIDLIST pidl;
|
||||
|
||||
if(!SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAMS, &pidl))
|
||||
{
|
||||
SHGetPathFromIDList(pidl, startpath);
|
||||
|
||||
if(startpath[strlen(startpath)-1] != '\\')
|
||||
strcat(startpath, "\\");
|
||||
strcat(startpath, dest);
|
||||
strcat(startpath, "\\");
|
||||
strcat(startpath, Title);
|
||||
strcat(startpath, ".lnk");
|
||||
|
||||
CoInitialize(NULL);
|
||||
CreateLink(Program, startpath, Title);
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
/* Unix? */
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* Makes a user defined object on the desktop.
|
||||
*/
|
||||
void MakeObject(char Title[], char oclass[], char dest[], char id[], char setup[])
|
||||
{
|
||||
#ifdef __OS2__
|
||||
char szArg[200];
|
||||
|
||||
memset(szArg,0,sizeof(szArg));
|
||||
|
||||
if ((oclass == NULL) || (strlen(oclass) == 0))
|
||||
return;
|
||||
|
||||
if ((id != NULL) && (strlen(id) != 0))
|
||||
{
|
||||
strcat(szArg,"OBJECTID=");
|
||||
strcat(szArg,id);
|
||||
}
|
||||
|
||||
if ((setup != NULL) && (strlen(setup) != 0))
|
||||
{
|
||||
if ((id != NULL) && (strlen(id) != 0))
|
||||
strcat(szArg,";");
|
||||
strcat(szArg,setup);
|
||||
}
|
||||
|
||||
WinCreateObject(oclass,Title,szArg,dest,CO_REPLACEIFEXISTS);
|
||||
#elif defined(WIN32)
|
||||
/* Not sure if there is an equivilent on Windows */
|
||||
#else
|
||||
/* Unix? */
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* Makes a shadow on the desktop.
|
||||
*/
|
||||
void MakeShadow(char Title[], char reference[], char dest[], char id[])
|
||||
{
|
||||
#ifdef __OS2__
|
||||
char szArg[400];
|
||||
|
||||
memset(szArg,0,sizeof(szArg));
|
||||
|
||||
strcpy(szArg,"SHADOWID=");
|
||||
strcat(szArg,reference);
|
||||
if ((id != NULL) && (strlen(id) != 0))
|
||||
{
|
||||
strcat(szArg,";OBJECTID=");
|
||||
strcat(szArg,id);
|
||||
}
|
||||
strcat(szArg,";");
|
||||
WinCreateObject("WPShadow",Title,szArg,dest,CO_REPLACEIFEXISTS);
|
||||
#elif defined(WIN32)
|
||||
/* Nothing like this on Windows9x anyway */
|
||||
#else
|
||||
/* Unix? */
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This creates program objects on the desktop, it was originally designed
|
||||
* for the OS/2 Workplace Shell so it may be somewhat different in use on
|
||||
* other platforms.
|
||||
*/
|
||||
void create_wps_objects(void)
|
||||
{
|
||||
char *arg1, *arg2, *arg3, *arg4, *arg5, *arg6;
|
||||
char temp[5000];
|
||||
char zerotext[2] = "";
|
||||
int z, argn, len;
|
||||
|
||||
/* No distinction for the moment... this may change.. */
|
||||
strcpy(installdir2, installdir);
|
||||
|
||||
/* Create Folder Objects */
|
||||
if(strlen(INSTALLER_FOLDER)>0)
|
||||
{
|
||||
strcpy(temp, replaceem(INSTALLER_FOLDER));
|
||||
argn=0;
|
||||
arg1=&temp[0];
|
||||
arg2=arg3=arg4=arg5=&zerotext[0];
|
||||
len = strlen(temp);
|
||||
for(z=0;z<len;z++)
|
||||
{
|
||||
if(temp[z]==',')
|
||||
{
|
||||
argn++;
|
||||
temp[z]=0;
|
||||
switch(argn)
|
||||
{
|
||||
case 1:
|
||||
arg2=&temp[z+1];
|
||||
break;
|
||||
case 2:
|
||||
arg3=&temp[z+1];
|
||||
break;
|
||||
case 3:
|
||||
arg4=&temp[z+1];
|
||||
break;
|
||||
case 4:
|
||||
arg5=&temp[z+1];
|
||||
break;
|
||||
case 5:
|
||||
argn=0;
|
||||
MakeFolder(arg1, arg2, arg3, arg4, arg5);
|
||||
#ifdef ENABLE_LOGGING
|
||||
fprintf(logfile, "<WPSFolderAdd>,%s,%s,%s,%s,%s\r\n", arg1, arg2,arg3,arg4,arg5);
|
||||
#endif
|
||||
arg1=&temp[z+1];
|
||||
arg2=arg3=arg4=arg5=&zerotext[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
MakeFolder(arg1, arg2, arg3, arg4, arg5);
|
||||
#ifdef ENABLE_LOGGING
|
||||
fprintf(logfile, "<WPSFolderAdd>,%s,%s,%s,%s,%s\r\n", arg1, arg2,arg3,arg4,arg5);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Create Program Objects */
|
||||
if(strlen(INSTALLER_PROGRAM)>0)
|
||||
{
|
||||
strcpy(temp, replaceem(INSTALLER_PROGRAM));
|
||||
argn=0;
|
||||
arg1=&temp[0];
|
||||
arg2=arg3=arg4=arg5=arg6=&zerotext[0];
|
||||
len = strlen(temp);
|
||||
for(z=0;z<len;z++)
|
||||
{
|
||||
if(temp[z]==',')
|
||||
{
|
||||
argn++;
|
||||
temp[z]=0;
|
||||
switch(argn)
|
||||
{
|
||||
case 1:
|
||||
arg2=&temp[z+1];
|
||||
break;
|
||||
case 2:
|
||||
arg3=&temp[z+1];
|
||||
break;
|
||||
case 3:
|
||||
arg4=&temp[z+1];
|
||||
break;
|
||||
case 4:
|
||||
arg5=&temp[z+1];
|
||||
break;
|
||||
case 5:
|
||||
arg6=&temp[z+1];
|
||||
break;
|
||||
case 6:
|
||||
argn=0;
|
||||
MakeProgram(arg1, arg2, arg3, arg4, arg5, arg6);
|
||||
#ifdef ENABLE_LOGGING
|
||||
fprintf(logfile, "<WPSProgramAdd>,%s,%s,%s,%s,%s,%s\r\n", arg1,arg2,arg3,arg4,arg5,arg6);
|
||||
#endif
|
||||
arg1=&temp[z+1];
|
||||
arg2=arg3=arg4=arg5=arg6=&zerotext[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
MakeProgram(arg1, arg2, arg3, arg4, arg5, arg6);
|
||||
#ifdef ENABLE_LOGGING
|
||||
fprintf(logfile, "<WPSProgramAdd>,%s,%s,%s,%s,%s,%s\r\n", arg1, arg2,arg3,arg4,arg5,arg6);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Create Shadow Objects */
|
||||
if(strlen(INSTALLER_SHADOW)>0)
|
||||
{
|
||||
strcpy(temp, replaceem(INSTALLER_SHADOW));
|
||||
argn=0;
|
||||
arg1=&temp[0];
|
||||
arg2=arg3=arg4=&zerotext[0];
|
||||
len = strlen(temp);
|
||||
for(z=0;z<len;z++)
|
||||
{
|
||||
if(temp[z]==',')
|
||||
{
|
||||
argn++;
|
||||
temp[z]=0;
|
||||
switch(argn)
|
||||
{
|
||||
case 1:
|
||||
arg2=&temp[z+1];
|
||||
break;
|
||||
case 2:
|
||||
arg3=&temp[z+1];
|
||||
break;
|
||||
case 3:
|
||||
arg4=&temp[z+1];
|
||||
break;
|
||||
case 4:
|
||||
argn=0;
|
||||
MakeShadow(arg1, arg2, arg3, arg4);
|
||||
#ifdef ENABLE_LOGGING
|
||||
fprintf(logfile, "<WPSShadowAdd>,%s,%s,%s,%s\r\n", arg1,arg2,arg3,arg4);
|
||||
#endif
|
||||
arg1=&temp[z+1];
|
||||
arg2=arg3=arg4=&zerotext[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
MakeShadow(arg1, arg2, arg3, arg4);
|
||||
#ifdef ENABLE_LOGGING
|
||||
fprintf(logfile, "<WPSShadowAdd>,%s,%s,%s,%s\r\n", arg1,arg2,arg3,arg4);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Create Generic Objects */
|
||||
if(strlen(INSTALLER_OBJECT)>0)
|
||||
{
|
||||
strcpy(temp, replaceem(INSTALLER_OBJECT));
|
||||
argn=0;
|
||||
arg1=&temp[0];
|
||||
arg2=arg3=arg4=arg5=&zerotext[0];
|
||||
len = strlen(temp);
|
||||
for(z=0;z<len;z++)
|
||||
{
|
||||
if(temp[z]==',')
|
||||
{
|
||||
argn++;
|
||||
temp[z]=0;
|
||||
switch(argn)
|
||||
{
|
||||
case 1:
|
||||
arg2=&temp[z+1];
|
||||
break;
|
||||
case 2:
|
||||
arg3=&temp[z+1];
|
||||
break;
|
||||
case 3:
|
||||
arg4=&temp[z+1];
|
||||
break;
|
||||
case 4:
|
||||
arg5=&temp[z+1];
|
||||
break;
|
||||
case 5:
|
||||
argn=0;
|
||||
MakeObject(arg1, arg2, arg3, arg4, arg5);
|
||||
#ifdef ENABLE_LOGGING
|
||||
fprintf(logfile, "<WPSObjectAdd>,%s,%s,%s,%s,%s\r\n", arg1,arg2,arg3,arg4,arg5);
|
||||
#endif
|
||||
arg1=&temp[z+1];
|
||||
arg2=arg3=arg4=arg5=&zerotext[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
MakeObject(arg1, arg2, arg3, arg4, arg5);
|
||||
#ifdef ENABLE_LOGGING
|
||||
fprintf(logfile, "<WPSObjectAdd>,%s,%s,%s,%s,%s\r\n", arg1, arg2,arg3,arg4,arg5);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -1,26 +0,0 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void create_wps_objects(void);
|
||||
unsigned long color_depth(void);
|
||||
void sysreboot(void);
|
||||
int mesg(char *format, ...);
|
||||
int checktext(char *text, char *buffer, int buflen);
|
||||
long findtext(char *text);
|
||||
char *decode(char *input);
|
||||
void viewfile(char *filename);
|
||||
void stripcrlf(char *buffer);
|
||||
unsigned long drivefree(int drive);
|
||||
void error(char *format, ...);
|
||||
void setdrivedir(char *drivedir);
|
||||
void settempdir(void);
|
||||
void getbootdrive(void);
|
||||
int cmdrun(char *progname);
|
||||
void PM_backslash(char *s);
|
||||
int sendmessage(int destination, int messid);
|
||||
void DoGUI(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
int parse_ini(char *filename);
|
||||
void updatepercent(void);
|
@ -1,316 +0,0 @@
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include "wx/resource.h"
|
||||
#include "install.h"
|
||||
#include "instsup.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#if !defined(__EMX__) && !defined(__OS2__) && !defined(WIN32) && !defined(WINNT)
|
||||
#define stricmp strcasecmp
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern char installdir[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef struct _wxCommands {
|
||||
int id;
|
||||
char file[50];
|
||||
} wxCommands;
|
||||
|
||||
#define COMMANDMAX 20
|
||||
|
||||
wxCommands wxcommands[COMMANDMAX];
|
||||
char finishedscript[256] = "";
|
||||
char percentname[256] = "";
|
||||
|
||||
class MyApp: public wxApp
|
||||
{
|
||||
public:
|
||||
MyApp();
|
||||
|
||||
virtual bool OnInit();
|
||||
|
||||
virtual ~MyApp();
|
||||
};
|
||||
|
||||
class MyDialog : public wxDialog
|
||||
{
|
||||
public:
|
||||
void handle_button(wxCommandEvent& event);
|
||||
};
|
||||
|
||||
class MyThread : public wxThread
|
||||
{
|
||||
public:
|
||||
virtual void *Entry();
|
||||
};
|
||||
|
||||
void *MyThread::Entry()
|
||||
{
|
||||
install_thread(NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MyDialog *dialog = NULL;
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
MyApp::MyApp()
|
||||
{
|
||||
}
|
||||
|
||||
wxCondition *InstCond = NULL;
|
||||
|
||||
void updatepercent(void)
|
||||
{
|
||||
wxGauge *tmp = (wxGauge *)wxFindWindowByName(percentname, dialog);
|
||||
|
||||
if(tmp)
|
||||
{
|
||||
unsigned long sliderpos;
|
||||
int pixels = 100;
|
||||
extern int current_file, files;
|
||||
|
||||
sliderpos = (unsigned long)(((float)(current_file)/(float)files)*pixels);
|
||||
tmp->SetValue(sliderpos);
|
||||
}
|
||||
}
|
||||
|
||||
int parse_ini(char *filename)
|
||||
{
|
||||
FILE *f;
|
||||
int b;
|
||||
|
||||
for(b=0;b<COMMANDMAX;b++)
|
||||
{
|
||||
wxcommands[b].id = 0;
|
||||
wxcommands[b].file[0] = 0;
|
||||
}
|
||||
|
||||
grabfile(filename);
|
||||
if((f=fopen(filename, "r")) != NULL)
|
||||
{
|
||||
int bytesread = 1;
|
||||
char raw[256], entry[256], entrydata[256], entrydata2[256];
|
||||
|
||||
/* figure out why we are not getting an EOF on windows...
|
||||
bytesread is a hack to make sure it doesn't loop forever. */
|
||||
while(!feof(f) && bytesread)
|
||||
{
|
||||
bytesread = getparseline(f, '#', ',', '\"', raw, entry, entrydata, entrydata2);
|
||||
if(stricmp(entry, "loadwxr") == 0)
|
||||
{
|
||||
grabfile(entrydata);
|
||||
if(!wxResourceParseFile(entrydata))
|
||||
{
|
||||
error("Error loading resources!");
|
||||
remove(entrydata);
|
||||
remove(filename);
|
||||
return FALSE;
|
||||
}
|
||||
remove(entrydata);
|
||||
|
||||
dialog = new MyDialog;
|
||||
|
||||
dialog->LoadFromResource(NULL, "dialog1");
|
||||
dialog->Show(TRUE);
|
||||
|
||||
/*MyApp::SetTopWindow(dialog);*/
|
||||
}
|
||||
else if(stricmp(entry, "closeold") == 0)
|
||||
{
|
||||
if(dialog)
|
||||
dialog->Destroy();
|
||||
dialog = NULL;
|
||||
}
|
||||
else if(stricmp(entry, "getcheck") == 0)
|
||||
{
|
||||
wxCheckBox *tmp = (wxCheckBox *)wxFindWindowByName(entrydata, dialog);
|
||||
|
||||
if(tmp)
|
||||
{
|
||||
if(!tmp->GetValue())
|
||||
{
|
||||
parse_ini(entrydata2);
|
||||
bytesread = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(stricmp(entry, "gettext") == 0)
|
||||
{
|
||||
wxTextCtrl *tmp = (wxTextCtrl *)wxFindWindowByName(entrydata, dialog);
|
||||
wxString bleah;
|
||||
|
||||
if(tmp)
|
||||
{
|
||||
if((bleah = tmp->GetValue()))
|
||||
strcpy(installdir, bleah);
|
||||
}
|
||||
}
|
||||
else if(stricmp(entry, "settext") == 0)
|
||||
{
|
||||
wxTextCtrl *tmp = (wxTextCtrl *)wxFindWindowByName(entrydata, dialog);
|
||||
|
||||
if(tmp)
|
||||
tmp->SetValue(installdir);
|
||||
}
|
||||
else if(stricmp(entry, "message") == 0)
|
||||
mesg(entrydata);
|
||||
else if(stricmp(entry, "disable") == 0)
|
||||
{
|
||||
wxButton *tmp = (wxButton *)wxFindWindowByName(entrydata, dialog);
|
||||
if(tmp)
|
||||
tmp->Disable();
|
||||
}
|
||||
else if(stricmp(entry, "grabfile") == 0)
|
||||
grabfile(entrydata);
|
||||
else if(stricmp(entry, "remove") == 0)
|
||||
remove(entrydata);
|
||||
else if(stricmp(entry, "system") == 0)
|
||||
wxExecute(entrydata);
|
||||
else if(stricmp(entry, "startinst") == 0)
|
||||
{
|
||||
strcpy(percentname, entrydata);
|
||||
strcpy(finishedscript, entrydata2);
|
||||
|
||||
/* I couldn't get it working with threads, even when
|
||||
using conditions it blocked the message loop making
|
||||
it unreadable, so I am going with wxYield for the
|
||||
moment. */
|
||||
#if 0
|
||||
MyThread *thread = new MyThread();
|
||||
|
||||
if ( thread->Create() != wxTHREAD_NO_ERROR )
|
||||
{
|
||||
error("Can't create thread!");
|
||||
}
|
||||
strcpy(finishedscript, entrydata);
|
||||
|
||||
InstCond = new wxCondition();
|
||||
|
||||
thread->Run();
|
||||
|
||||
wxMutex *test = new wxMutex();
|
||||
|
||||
InstCond->Wait(*test);
|
||||
#endif
|
||||
install_thread(NULL);
|
||||
create_wps_objects();
|
||||
parse_ini(finishedscript);
|
||||
}
|
||||
else if(stricmp(entry, "mleview") == 0)
|
||||
{
|
||||
FILE *f;
|
||||
unsigned long bytes;
|
||||
char buffer[1025];
|
||||
wxTextCtrl *tmp = (wxTextCtrl *)wxFindWindowByName(entrydata, dialog);
|
||||
|
||||
if(tmp)
|
||||
{
|
||||
grabfile(entrydata2);
|
||||
|
||||
if((f = fopen(entrydata2, "rb"))!= NULL)
|
||||
{
|
||||
while(!feof(f))
|
||||
{
|
||||
memset(buffer, 0, 1025);
|
||||
bytes = fread(buffer, 1, 1024, f);
|
||||
*tmp << buffer;
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
remove(entrydata2);
|
||||
tmp->ShowPosition(0);
|
||||
}
|
||||
|
||||
}
|
||||
else if(stricmp(entry, "setbutton") == 0)
|
||||
{
|
||||
for(b=0;b<COMMANDMAX;b++)
|
||||
{
|
||||
if(!wxcommands[b].id)
|
||||
{
|
||||
wxcommands[b].id = atoi(entrydata);
|
||||
strcpy(wxcommands[b].file, entrydata2);
|
||||
b = COMMANDMAX;
|
||||
}
|
||||
}
|
||||
dialog->Connect( atol(entrydata), -1, wxEVT_COMMAND_BUTTON_CLICKED,
|
||||
(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction)
|
||||
&MyDialog::handle_button);
|
||||
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
remove(filename);
|
||||
return TRUE;
|
||||
}
|
||||
remove(filename);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void MyDialog::handle_button(wxCommandEvent& event )
|
||||
{
|
||||
int b;
|
||||
|
||||
for(b=0;b<COMMANDMAX;b++)
|
||||
{
|
||||
if(wxcommands[b].id &&
|
||||
wxcommands[b].id == event.GetId())
|
||||
{
|
||||
char tempbuf[50];
|
||||
|
||||
strcpy(tempbuf, wxcommands[b].file);
|
||||
if(stricmp(tempbuf, "exit") == 0)
|
||||
exit(0);
|
||||
grabfile(tempbuf);
|
||||
if(!parse_ini(tempbuf))
|
||||
{
|
||||
error("Error loading script \"%s\"", tempbuf);
|
||||
exit(1);
|
||||
}
|
||||
remove(tempbuf);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool MyApp::OnInit(void)
|
||||
{
|
||||
#if 1
|
||||
install_init(argv[0]);
|
||||
#else
|
||||
install_init("install.exe");
|
||||
#endif
|
||||
|
||||
if(!parse_ini("page1.ini"))
|
||||
{
|
||||
error("Could not load startup script!");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
MyApp::~MyApp()
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user