PDA

View Full Version : Backing up a restoring a .exe on uninstall


benz
02-23-2002, 01:09 PM
Ok guys this is what I want to do.
Im making a installer that modifies a .exe file. Now before it modifies the .exe how do I make it create a backup copy of that .exe.? Then when you uninstall my program I want it to restore the backup copy of the .exe file and delete the .exe my file modified. How can this be dun? Plz respond asap I need this info real fast.

I have Setup Factory 6.0 trial version.

dan37_123
02-24-2002, 09:44 AM
Ok in my opinion this is what u have to do;

1. You have an exe file, lets says orignal.exe.

2. Before you can do anything u have to know where it is installed, so you can read an installpath key from the registry if it exists. It can be done as follows;

--> use the read from registry function:
variable name= %MyOldInstallPath%
Main key=HKEY_LOCAL_MACHINE
Sub key= software\???????(you have to know this)

with this what you are doing is basically reading your install path from the registry and storing it in the variable name %MyOldInstallPath%

SO NOW WE KNOW WHERE THE EXE FILE IS

---------------<<------------------
THEN USE THE BUILT IN SEARCH FOR FILE FUNCTION

It may be some thing like this.

Store result variable in= %MyOriginalExeFile%
default value= FALSE
Search for file= original.exe (replace with the name of your exe file that you want to make a back up copy).
Custom directories=%MyOldInstallPath%\etc.\etc.,\
please check only the box "search for specific directories/drives".

SO NOW WE KNOW THAT IF;

%MyOriginalExeFile%<>False, then we know for sure we have the correct file.

NOW WE KNOW IF THE ORIGINAL.EXE FILE IS THERE AT THE TARGET DIRECTORY OR NOT
-------------><---------------
Now comes the final and important step. Becareful here.

If (%MyOriginalExeFile%<>False)


use the Rename file funciton here:
source=%MyOriginalExeFile%\orginal.exe
destination=%MyOriginalExeFile%\Bakcup_orginal.exe

THIS IS IT.

if you need any more info let me know.