Skip to content
⌘ NSIS Forum Archive

NSIS-- Delete the remainings of VCRedist

7 posts

bobdos007#

NSIS-- Delete the remainings of VCRedist

Hello guys,

As you know, when you ship VCRedist_X86 with the installer and when the user install your software, VCRedist leaves 24 temporary files on C drive and sometimes on D .. Depending where the operating system is installed.

in Inno scripts, this code deletes all those file after the finish of installation:


procedure DeleteVCRedistRuntimeTemporaryFiles();
var
i : Integer;
byCounter : Byte;
byDrive : Byte;
strFile1, strFile2, strFile3 : String;
strRootDrivePath : String;
//totally there are 24 files to be deleted
arrFiles : Array [1..24] Of String;
begin


//We will check the following root drives
//C, D, E, F, G, H, I, J, K, L, M
For byCounter := 67 to 77 do
Begin
strRootDrivePath := Chr(byCounter) + ':\';
arrFiles[1] := strRootDrivePath + 'vcredist.bmp';
arrFiles[2] := strRootDrivePath + 'VC_RED.cab';
arrFiles[3] := strRootDrivePath + 'VC_RED.MSI';

//If these 3 files then we have found the right
//drive in which the VC runtime files are extracted
If (FileExists(arrFiles[1]) And
FileExists(arrFiles[2]) And
FileExists(arrFiles[3])) Then
Begin

arrFiles[4] := strRootDrivePath + 'eula.1028.txt';
arrFiles[5] := strRootDrivePath + 'eula.1031.txt';
arrFiles[6] := strRootDrivePath + 'eula.1033.txt';
arrFiles[7] := strRootDrivePath + 'eula.1036.txt';
arrFiles[8] := strRootDrivePath + 'eula.1040.txt';
arrFiles[9] := strRootDrivePath + 'eula.1041.txt';
arrFiles[10] := strRootDrivePath + 'eula.1042.txt';
arrFiles[11] := strRootDrivePath + 'eula.2052.txt';
arrFiles[12] := strRootDrivePath + 'eula.3082.txt';
arrFiles[13] := strRootDrivePath + 'globdata.ini';
arrFiles[14] := strRootDrivePath + 'install.exe';
arrFiles[15] := strRootDrivePath + 'install.ini';
arrFiles[16] := strRootDrivePath + 'install.res.1028.dll';
arrFiles[17] := strRootDrivePath + 'install.res.1031.dll';
arrFiles[18] := strRootDrivePath + 'install.res.1033.dll';
arrFiles[19] := strRootDrivePath + 'install.res.1036.dll';
arrFiles[20] := strRootDrivePath + 'install.res.1040.dll';
arrFiles[21] := strRootDrivePath + 'install.res.1041.dll';
arrFiles[22] := strRootDrivePath + 'install.res.1042.dll';
arrFiles[23] := strRootDrivePath + 'install.res.2052.dll';
arrFiles[24] := strRootDrivePath + 'install.res.3082.dll';


For i := 1 to 24 Do
Begin
DeleteFile(arrFiles[i]);
End;

//Now that we have found and deleted all the files
//we will break
Break;
End;
End;
End;

procedure DeinitializeSetup();
begin

DeleteVCRedistRuntimeTemporaryFiles();

end;
how to do this using NSIS in a certain Section?
bobdos007#
Originally Posted by Anders View Post
What have you tried so far?
well .. I didn't try anything yet. because I do not how to do this using NSIS ..

can I just use the command delete + name of files.
but how to know the directory where they are?
jpderuiter#
Its a known bug and is fixed in VS2008 SP1.
This is a problem with a VCRedist for the RTM version of VS 2008. Developers should be using a later version.
http://support.microsoft.com/kb/950683
bobdos007#
Originally Posted by jpderuiter View Post
The sotware is written in python and the compiler is py2exe. in there documentation. they say to not use the Sp1 version of vcredist.

So. I should delete the files manually.

NSIS is well advanced than Inno. how inno can do this simply while in NSIS it's a problem?
Afrow UK#
Originally Posted by bobdos007 View Post
NSIS is well advanced than Inno. how inno can do this simply while in NSIS it's a problem?
Who said it's a problem?

Use GetDrives (in the user manual), IfFileExists (or ${If} ${FileExists}) and Delete.

Stu
bobdos007#
Originally Posted by Afrow UK View Post
Who said it's a problem?

Use GetDrives (in the user manual), IfFileExists (or ${If} ${FileExists}) and Delete.

Stu
Thank you so much .. I will try this.