From: Julian Smart Date: Mon, 24 Mar 2003 14:15:19 +0000 (+0000) Subject: Removing Install X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/8c9a1303d830a7acbe579d1ee1d0f2cd23b3a240?ds=inline Removing Install git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19749 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/utils/Install/install.c b/utils/Install/install.c deleted file mode 100644 index 1c29ce6a36..0000000000 --- a/utils/Install/install.c +++ /dev/null @@ -1,1081 +0,0 @@ -/* - * install.c (c) 1998,1999 Brian Smith - * parts by Daniele Vistalli - */ - -#include -#include -#include -#include -#include -#include -#if defined(__OS2__) || defined(__EMX__) || defined(WINNT) || defined(WIN32) -#include -#endif -#include -#include "install.h" -#include "instsup.h" - -#if !defined(__EMX__) && !defined(__OS2__) && !defined(WIN32) && !defined(WINNT) -#define stricmp strcasecmp -#endif - -/* My Global variables ;) unusually many due to multiple dialogs */ -char tempPath[MAX_PATH]; -int installstate = NONE; -int installstage = 0; -int current_file=0, success=0; -unsigned long int acepos=0, aceoffset=0; -int pixels=0; -char confirmstring[1024]; -/* I know I am being excessive but... better safe than sorry ;) */ -char *configsys[8196]; -int configfilecount=-1; -int files = 0, files_deleted=0, packagesize=0, packagesselected[20]; -/* Global flags often set by the user */ -int driveselected, packagechosen, express = 1, driverstatus = -1, no_update = 0; -int licensechecked = 0, custom = 0, checkforupdate = 1, downloadsite = 0; -int usescitech = 1, usecurrent = 0, checking = 0, checkerror = 0, newerver = 0; -char sddfilename[256] = "", sddversion[256] = "", sdddate[256] = ""; -char sddurl[4][256] = { "", "", "", "" }; - -/* So these are accessible to REXX */ -int drivelist[26]; -FILE *self; - -/* These get loaded in loadheader */ -char *INSTALLER_APPLICATION; -char *INSTALLER_VERSION; -char *INSTALLER_TITLE; -char *INSTALLER_PATH; -char *INSTALLER_FOLDER; -char *INSTALLER_PROGRAM; -char *INSTALLER_SHADOW; -char *INSTALLER_OBJECT; -char *INSTALLER_SETS; -char *INSTALLER_SYSVAR; -char *INSTALLER_SYSLINE; -char *INSTALLER_PACKAGES[20]; -char *INSTALLER_CONFIRM_WPS; -char *INSTALLER_CONFIRM_CONFIGSYS; -char *INSTALLER_CONFIRM_OVERWRITE; -int INSTALLER_PACKAGE_COUNT; - -/* Will have to seperate this stuff to platform specifics... */ - -/* Config.Sys -- Note the drive letter gets replaced with the boot drive letter - It is just a place holder. (For the next 3 entries) */ -char csfile[] = "C:\\CONFIG.SYS"; -/* Backup Config.Sys filename */ -char bufile[] = "C:\\CONFIG.SDD"; -/* Installation Log Database -- Used for uninstallation and aborting */ -#if defined(__OS2__) || defined(__EMX__) || defined(WINNT) || defined(WIN32) -char instlog[] = "C:\\DBINST.LOG"; -#else -char instlog[] = "~/dbinst.log"; -#endif -char installdir[400]; - -char bootdrive[2] = "C"; -char winpath[400] = "C:\\OS2\\MDOS\\WINOS2"; -char winjpath[400] = "C:\\OS2\\MDOS\\WINJOS2"; -char wintpath[400] = "C:\\OS2\\MDOS\\WINTOS2"; -char winhpath[400] = "C:\\OS2\\MDOS\\WINHOS2"; -char browsedir[400] = "C:\\"; -char installdir2[400] = ""; -char empty_string[] = ""; -char currentcf[400] = ""; - -#ifdef ENABLE_LOGGING -FILE *logfile; -#endif - -/* Function prototypes */ -int installer_unpack(char *filename, int operation); -void resetglobals(void); - -typedef struct _replacements { - char *replacestring, *replacevar; -} Replacements; - -/* The variables in this array must be static buffers */ -Replacements InstRep[] = { - { "%INSTALLPATH%", installdir }, - { "%BOOTDRIVE%", bootdrive }, - { "%ANYSTRING%", empty_string }, - { "%WINPATH%", winpath }, - { "%WINJPATH%", winjpath }, - { "%WINTPATH%", wintpath }, - { "%WINHPATH%", winhpath }, - { "%USERPATH%", installdir2 }, - { "%VERSION%", "1.0" }, /* This may be depricated */ - { "%WEB_VER%", sddversion }, - { "%WEB_DATE%", sdddate }, - { "%WEB_LOCATION1%", sddurl[0] }, - { "%WEB_LOCATION2%", sddurl[1] }, - { "%WEB_LOCATION3%", sddurl[2] }, - { "%WEB_LOCATION4%", sddurl[3] }, - { "%PRI%", "SVGA" } -}; -int replacemax = 16; - -/* In str1, str2 gets replaced by str3 */ -char *replacestr(char *str1, char *str2, char *str3) -{ - char bigbuffer[4096]; - int z, x=0, len1 = strlen(str1), len2 = strlen(str2), len3 = strlen(str3); - - for(z=0;z 0 && strncmp(&str1[z], str2, len2)==0) - { - int i; - for(i=0;i (packagesize-(curpos-aceoffset))) - readit = (packagesize-(curpos-aceoffset)); - else - readit = count; - - return fread(buf, 1, readit, self); -} - -off_t acelseek(off_t offset, int whence) -{ - switch(whence) - { - case SEEK_SET: - fseek(self, aceoffset+offset, SEEK_SET); - break; - case SEEK_CUR: - fseek(self, offset, SEEK_CUR); - break; - } - acepos = ftell(self); - return acepos-aceoffset; -} - -int aceopen(const char *path, int flags) -{ - fseek(self, aceoffset, SEEK_SET); - return 1; -} - -int aceclose(int fd) -{ - fseek(self, aceoffset, SEEK_SET); - return 0; -} - -int acesize(void) -{ - return packagesize; -} - -int acetell(int fd) -{ - return ftell(self)-aceoffset; -} - -/* - * Read the generated log file and remove any files installed. - */ -void delete_files(void) -{ - char tmpbuf[8196], *fileptr; - FILE *tmplf; - int linenum=0, found=-1, z; - - files_deleted=1; - - if((tmplf=fopen(instlog, "rb"))==NULL) - return; - - while(!feof(tmplf)) - { - fgets(tmpbuf, 8196, tmplf); - linenum++; - if(tmpbuf[0]=='[' && (char *)strstr(tmpbuf, INSTALLER_APPLICATION) != NULL && !feof(tmplf)) - { - fgets(tmpbuf, 8196, tmplf); - linenum++; - if((char *)strstr(tmpbuf, "") != NULL && (char *)strstr(tmpbuf, INSTALLER_VERSION) != NULL) - found=linenum; - } - } - if(found != -1) - { - rewind(tmplf); - for (z=0;z") != NULL) - { - fileptr = (char *)strchr(tmpbuf, ',')+1; - /* Remove trailing CRLFs */ - if(fileptr[strlen(fileptr)-1] == '\r' || fileptr[strlen(fileptr)-1] == '\n') - fileptr[strlen(fileptr)-1]=0; - if(fileptr[strlen(fileptr)-1] == '\r' || fileptr[strlen(fileptr)-1] == '\n') - fileptr[strlen(fileptr)-1]=0; - remove(fileptr); - current_file--; -#if 0 - sendmessage(0, 1); -#endif - } - if((char *)strstr(tmpbuf, "") != NULL) - { - fclose(tmplf); - return; - } - } - } - fclose(tmplf); - return; -} - -/* - * Reads a config file into memory for editing with updatesys, updateset, etc. - */ -int readconfigfile(char *filename) -{ - char tmpbuf[8196]; - FILE *tmpcs; - - /* Reset this value when restarting */ - configfilecount = -1; - - if((tmpcs=fopen(filename, "rb"))==NULL) - { - strcpy(currentcf, empty_string); - return 1; - } - else - strcpy(currentcf, filename); - - while(!feof(tmpcs)) - { - configfilecount++; - fgets(tmpbuf, 8196, tmpcs); - configsys[configfilecount] = malloc(strlen(tmpbuf)+1); - strcpy(configsys[configfilecount], tmpbuf); - stripcrlf(configsys[configfilecount]); - } - - fclose(tmpcs); - return 0; -} - -/* - * Write the updated config file to disk and backup the original. - */ -int writeconfigfile(char *filename, char *backup) -{ - FILE *tmpcs; - int i; - - if(backup) - { - remove(backup); - rename(filename, backup); - } - else - remove(filename); - - if((tmpcs=fopen(filename, "wb"))==NULL) - return 1; - - for(i=0;i,%s,%s\r\n", currentcf, configsys[i]); -#endif - free(configsys[i]); - configsys[i] = malloc(strlen(setname)+strlen(nv)+6); - strcpy(configsys[i], "SET "); - strcat(configsys[i], setname); - strcat(configsys[i], "="); - strcat(configsys[i], nv); -#ifdef ENABLE_LOGGING - fprintf(logfile, ",%s,%s\r\n", currentcf, configsys[i]); -#endif - free(cmpbuf1);free(cmpbuf2);free(tmpptr); - } - return; - } - free(cmpbuf2); - } - free(tmpptr); - } - } - /* Couldn't find the line so we'll add it */ - configsys[configfilecount]=malloc(strlen(cmpbuf1)+strlen(nv)+6); - strcpy(configsys[configfilecount], "SET "); - strcat(configsys[configfilecount], setname); - strcat(configsys[configfilecount], "="); - strcat(configsys[configfilecount], nv); -#ifdef ENABLE_LOGGING - fprintf(logfile, ",%s,%s\r\n", currentcf, configsys[configfilecount]); -#endif - configfilecount++; - free(cmpbuf1); -} - -/* - * Adds an entry to a system variable (CONFIG.SYS) - */ -void updatesys(char *sysname, char *newvalue) -{ - char *cmpbuf1, *cmpbuf2, *tmpptr, *tmpptr2, *capbuf1, *capbuf2, *nv, *brian; - int i, z, t; - - nv=replaceem(newvalue); - - cmpbuf1=malloc(strlen(sysname)+2); - strcpy(cmpbuf1, sysname); - strcat(cmpbuf1, "="); - for(i=0;i,%s,%s\r\n", currentcf, configsys[i]); -#endif - brian = configsys[i]; - configsys[i] = malloc(strlen(configsys[i])+strlen(nv)+4); - strcpy(configsys[i], brian); - free(brian); - /* Remove any trailing CRLFs */ - if(configsys[i][strlen(configsys[i])-1]!=';') - strcat(configsys[i], ";"); - strcat(configsys[i], nv); - strcat(configsys[i], ";"); -#ifdef ENABLE_LOGGING - fprintf(logfile, ",%s,%s\r\n", currentcf, configsys[i]); -#endif - } - free(cmpbuf1);free(cmpbuf2);free(capbuf1);free(capbuf2); - return; - } - free(cmpbuf2); - } - } - /* Couldn't find the line so we'll add it */ - configsys[configfilecount]=malloc(strlen(cmpbuf1)+strlen(nv)+3); - strcpy(configsys[configfilecount], cmpbuf1); - strcat(configsys[configfilecount], nv); - strcat(configsys[configfilecount], ";"); -#ifdef ENABLE_LOGGING - fprintf(logfile, ",%s,%s", currentcf, configsys[configfilecount]); -#endif - configfilecount++; - free(cmpbuf1); - if(nv) - free(nv); -} - -/* - * Removes a line from a config file. - */ -void removeline(char *text) -{ - int z; - for(z=0;z,%s,%s\r\n", currentcf, configsys[z]); -#endif - free(configsys[z]); - for(t=z;t<(configfilecount-1);t++) - configsys[t] = configsys[t+1]; - configfilecount--; - } - } -} - - -/* - * The Window peocedure for the confirmation dialog. - */ -#if 0 -MRESULT EXPENTRY ConfirmDlgProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) -{ - SWP winpos; - - switch (msg) - { - case WM_INITDLG: - WinSetWindowText(hWnd, INSTALLER_TITLE); - WinEnableWindow(WinWindowFromID(mainhwnd, I_Cancel), FALSE); - WinSetDlgItemText(hWnd, I_Confirm, confirmstring); - WinQueryWindowPos(mainhwnd, &winpos); - WinSetWindowPos(hWnd, HWND_TOP, winpos.x+30, winpos.y+30, 0, 0, SWP_MOVE | SWP_ZORDER); - break; - case WM_COMMAND: - WinEnableWindow(WinWindowFromID(mainhwnd, I_Cancel), TRUE); - switch ( SHORT1FROMMP(mp1) ) - { - case I_Ja: - WinDismissDlg(hWnd, 0); - break; - case I_Alle: - WinDismissDlg(hWnd, 1); - break; - case I_Nein: - WinDismissDlg(hWnd, 2); - break; - case I_Halt: - success=2; - installstate=ABORTED; - WinDismissDlg(hWnd, 3); - break; - } - break; - default : - return(WinDefDlgProc(hWnd, msg, mp1, mp2)); - } - return(0L); -} -#endif -/* - * Display a confirmation dialog with the options: YES NO ALL CANCEL - * Returns: 0 for YES, 1 for ALL, 2 for NO and 3 for CANCEL - */ -int confirm(char *format, ...) { - va_list args; - - /* if no confirmation, return 1, meaning overwrite all */ - if (stricmp(INSTALLER_CONFIRM_OVERWRITE, "no") == 0) - return 1; - - va_start(args, format); - vsprintf(confirmstring, format, args); - va_end(args); - - /* Do something here in wxwindows */ - return 1; -} - -/* - * A function to grab a file from an embedded archive and extract it to the TEMP directory. - */ -void grabfile(char *filename) -{ - no_update = 1; - settempdir(); - remove(filename); - aceseek_entry(0); - resetglobals(); - installer_unpack(filename, 2); - no_update = 0; -} - -/* - * This thread runs along side the main thread allowing the user to cancel the process. - */ -void install_thread(void *param) -{ - char tmpinstallpath[1024]; - int k, j, installcount=0, installed=0; - - if(INSTALLER_PACKAGE_COUNT == 2) - packagesselected[1] = TRUE; - - installstate = INSTALLING; - -#ifdef ENABLE_LOGGING - if((logfile=fopen(instlog, "ab"))==NULL) - { - error("Log file \"%s\" open failed! Installation aborted!", instlog); - exit(1); - } - - fprintf(logfile, "[%s]\r\n,%s\r\n\r\n", INSTALLER_APPLICATION, INSTALLER_VERSION); -#endif - - /* Create nested subdirectories if necessary. */ - strcpy(tmpinstallpath, installdir); - for(k=3;k,%s\r\n", tmpinstallpath); -#else - ; -#endif - tmpinstallpath[k] = '\\'; - } - } - -#if defined(__EMX__) || defined(__CYGWIN__) || defined(UNIX) - if (!mkdir(installdir, 0)) -#else - if (!mkdir(installdir)) -#endif -#ifdef ENABLE_LOGGING - fprintf(logfile, ",%s\r\n", installdir); -#else - ; -#endif - - /*if(strlen(installdir) > 0 && installdir[0] > 'a'-1 && installdir[0] < 'z'+1) - installdir[0]=installdir[0] - ('a'-'A'); - if(strlen(installdir)>2 && installdir[1]==':' && installdir[2]=='\\') - DosSetDefaultDisk((int)(installdir[0]-'A'+1));*/ - - setdrivedir(installdir); - - /* Unpack files to destination directory */ - for(j=1;j0) - { - char *tmpptr = &temp[0]; - int len; - - strcpy(temp, INSTALLER_SYSLINE); - temp[4999] = 0; - len = strlen(temp); - - for(z=0;z,%s,%s\r\n", currentcf, tmpptr2); -#endif - configfilecount++; - } - } - if(tmpptr && *tmpptr) - { - char *tmpptr2; - - tmpptr2 = replaceem(tmpptr); - removeline(tmpptr2); - configsys[configfilecount] = tmpptr2; -#ifdef ENABLE_LOGGING - fprintf(logfile, ",%s,%s\r\n", currentcf, tmpptr2); -#endif - configfilecount++; - } - - } - /* Update SET variables */ - if(strlen(INSTALLER_SETS)>0) - { - strcpy(temp, INSTALLER_SETS); - argn=0; - arg1=&temp[0]; - arg2=arg3=NULL; - for(z=0;z0) - { - strcpy(temp, INSTALLER_SYSVAR); - argn=0; - arg1=&temp[0]; - arg2=NULL; - for(z=0;z -#include -#include -#include -#include -#include -#if defined(__OS2__) || defined(__EMX__) || defined(WIN32) || defined(WINNT) -#include -#endif -#include -#ifdef WIN32 -#include -#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 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,%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, ",%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,%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, ",%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,%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, ",%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,%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, ",%s,%s,%s,%s,%s\r\n", arg1, arg2,arg3,arg4,arg5); -#endif - } -} - - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/utils/Install/instsup.h b/utils/Install/instsup.h deleted file mode 100644 index b2e1c1d27d..0000000000 --- a/utils/Install/instsup.h +++ /dev/null @@ -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); \ No newline at end of file diff --git a/utils/Install/wxmain.cpp b/utils/Install/wxmain.cpp deleted file mode 100644 index 39cbad18ce..0000000000 --- a/utils/Install/wxmain.cpp +++ /dev/null @@ -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 - -#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;bLoadFromResource(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;bConnect( 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