Old 26th November 2006, 17:52   #1
Olaf van der Spek
Junior Member
 
Join Date: Jul 2000
Posts: 34
Downloading and executing vcredist_x86.exe if necessary

Hi,

I've got a VC8/2005 app that requires certain DLLs. Those can be installed with vcredist_x86.exe, but that exe is 2.5 mbyte.
Is there a way to check whether the DLLs are already installed and only download/install them if they're not?
Olaf van der Spek is offline   Reply With Quote
Old 26th November 2006, 18:55   #2
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
ifFileExists can help you..also check nsisdl


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 26th November 2006, 19:22   #3
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 462
Olaf van der Spek - you may also need to download and install Windows Installer 3.1. I recently ran into a need to install the vcredist_x86 you mention, and it pops up an error ("1723") if the system doesn't have WI 3.1. And you'll need to set the switches to block the reboots that both of them want to do.

If you do search for the file(s), be aware that they install do different locations on different versions of the operating system. (That's why they were released as an executable instead of a simpler merge module.)

Don
demiller9 is offline   Reply With Quote
Old 26th November 2006, 20:50   #4
Olaf van der Spek
Junior Member
 
Join Date: Jul 2000
Posts: 34
I don't like to hard-code paths. Maybe just trying to load the DLLs and checking whether that succeeds is better.
Olaf van der Spek is offline   Reply With Quote
Old 30th November 2006, 11:38   #5
ranahimal
Junior Member
 
Join Date: Nov 2006
Posts: 2
Same problem!

I have same problem regarding vcredist_x86.exe.
I want to check and install it if necessary...
ranahimal is offline   Reply With Quote
Old 30th November 2006, 14:22   #6
Adion
Junior Member
 
Join Date: Feb 2002
Location: Belgium
Posts: 28
I am also looking for a solution for this.
At first I tried to see if it would be possible to install the relevant files myself, but it seems very difficult to get them to register correctly.
So the vcredist_x86.exe also seems the only solution, but I can find 4 instances of msvcr80.dll on my computer, so I also don't know how to check for it being installed correctly.

I would asume though that one version of vcredist_x86.exe only installs one version of msvcr80.dll, so chances are that the location for that specific version will always be the same and can be checked for.
Anyone has an idea how to find out which version will be in there though?

I also didn't know about Windows Installer. Which version is installed on a standard windows xp installation?
Adion is offline   Reply With Quote
Old 30th November 2006, 15:03   #7
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 462
I check the registry value HKLM Microsoft\Windows\CurrentVersion\Uninstall\{A49F249F-0C91-497F-86DF-B2585E8E76B7}\DisplayName to see if the redistributable package has been installed. If that value exists then I don't install either exe.

The switches for installing Windows Installer 3.1 would be "WindowsInstaller-KB893803-v2-x86.exe /quiet /norestart" and the switches for the redistributable "VCRedist_x86.exe /Q"

Don
demiller9 is offline   Reply With Quote
Old 30th November 2006, 17:31   #8
Olaf van der Spek
Junior Member
 
Join Date: Jul 2000
Posts: 34
Quote:
Originally posted by demiller9
I check the registry value HKLM Microsoft\Windows\CurrentVersion\Uninstall\{A49F249F-0C91-497F-86DF-B2585E8E76B7}\DisplayName to see if the redistributable package has been installed. If that value exists then I don't install either exe.
Does that work on XP x64? IA64? Vista?
Olaf van der Spek is offline   Reply With Quote
Old 30th November 2006, 17:51   #9
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 462
Quote:
Originally posted by Olaf van der Spek
Does that work on XP x64? IA64? Vista?
I don't have any of those OS so I can't answer your question.

Don
demiller9 is offline   Reply With Quote
Old 30th November 2006, 17:54   #10
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
I though that you were developers

Don't you guys need MSVCP80.DLL and MSVCR80.DLL?

Find them, if isnot present....download the redist installer...

There are tons of examples of about this tasks...


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 30th November 2006, 17:59   #11
Adion
Junior Member
 
Join Date: Feb 2002
Location: Belgium
Posts: 28
The problem is of course that you need to be sure of their location.
Just searching the complete system dir may be slow, and if the version is not correct I think it may even refuse to use that version, so I'm not sure if it is actually that simple

I would suppose that the registry check would work on other versions of windows as well, since it's always the x86 version you are installing. I'll try if I can check that tomorrow on Vista 64-bit.
Adion is offline   Reply With Quote
Old 30th November 2006, 18:20   #12
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
Quote:
Originally posted by Adion
The problem is of course that you need to be sure of their location.
Just searching the complete system dir may be slow, and if the version is not correct I think it may even refuse to use that version, so I'm not sure if it is actually that simple
Not necesary, because you'll search for a specific file...

See codeproject article.

It's so simple... I don't know wny the mambo-jumbo thingy


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 11th December 2006, 13:32   #13
Adion
Junior Member
 
Join Date: Feb 2002
Location: Belgium
Posts: 28
The codeproject article also suggests to try and load a dll to see if the runtimes are already installed.
In the NSIS documentation I did find out how to call a function from a dll, but I have found nothing about error handling.
Does anyone know how to check if calling a function failed?
Adion is offline   Reply With Quote
Old 11th December 2006, 16:44   #14
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Perhaps this code example would be helpful to detect if the runtimes are installed and check the required version.
code:
OutFile "locate_msvcp80.exe"
ShowInstDetails show

!include "FileFunc.nsh"
!include "WordFunc.nsh"

!insertmacro Locate
!insertmacro VersionCompare

!define DLL_VER "8.00.50727.42"

Section

StrCpy $1 $WINDIR 3
${Locate} "$1" "/L=F /M=MSVCP80.DLL /S=0B" "LocateCallback"

IfErrors 0 +2
MessageBox MB_OK "Error"
MessageBox MB_OK '$$R0==$R0'

SectionEnd

Function LocateCallback

MoreInfo::GetProductVersion "$R9"
Pop $0

${VersionCompare} "$0" "${DLL_VER}" $R1

StrCmp $R1 0 0 new
messagebox mb_ok 'Found file at location $R9.$\r$\n \
Installed version is $0 required version is ${DLL_VER}. Versions are equal.' idok end

new:
StrCmp $R1 1 0 old
messagebox mb_ok 'Found file at location $R9.$\r$\n \
Installed version is $0 required version is ${DLL_VER}. Installed version is newer.' idok end

old:
StrCmp $R1 2 0 end
messagebox mb_ok 'Found file at location $R9.$\r$\n \
Installed version is $0 required version is ${DLL_VER}. Installed version is older.' idok end

end:
StrCpy "$0" StopLocate
Push "$0"

FunctionEnd


Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 11th December 2006, 17:12   #15
Adion
Junior Member
 
Join Date: Feb 2002
Location: Belgium
Posts: 28
Thanks, I just found the IfErrors function though, so I'm going to test if that works as expected first.
Adion is offline   Reply With Quote
Old 14th December 2006, 20:27   #16
Adion
Junior Member
 
Join Date: Feb 2002
Location: Belgium
Posts: 28
IfErrors does not seem to catch errors when executing System::Call.
After checking the output, it seems you can check for an output by comparing the return value of the dll call.
Maybe this behaviour should be added to the documentation of the System::Call function?
This seemed to be working for me:
code:
;Install runtime
System::Call 'mydll::aTestFunction() i .r0'
StrCmp $0 "error" 0 +3
File "vcredist_x86.exe"
Exec '"$INSTDIR\vcredist_x86.exe" /q'

Adion is offline   Reply With Quote
Old 8th January 2007, 18:53   #17
azerger
Junior Member
 
Join Date: Nov 2003
Posts: 16
Thumbs up msvcr80.dll manifest stuff

Look at this example:
http://msdn2.microsoft.com/en-us/library/ms235291(VS.80).aspx

I'm trying the "Deploying Visual C++ library DLLs as private assemblies" example. So far with no luck though!

I have a win32 app and I just need these dll's, this is the correct way according to MS. Going the path of running the installer etc. is thwart with problems for the end user installations. If you can get this way to work, let me know.

Thanks,
Art
azerger is offline   Reply With Quote
Old 4th March 2010, 14:14   #18
arif.ali.syed
Junior Member
 
Join Date: Mar 2010
Posts: 5
Quote:
Originally posted by Red Wine
Perhaps this code example would be helpful to detect if the runtimes are installed and check the required version.
code:
OutFile "locate_msvcp80.exe"
ShowInstDetails show

!include "FileFunc.nsh"
!include "WordFunc.nsh"

!insertmacro Locate
!insertmacro VersionCompare

!define DLL_VER "8.00.50727.42"

Section

StrCpy $1 $WINDIR 3
${Locate} "$1" "/L=F /M=MSVCP80.DLL /S=0B" "LocateCallback"

IfErrors 0 +2
MessageBox MB_OK "Error"
MessageBox MB_OK '$$R0==$R0'

SectionEnd

Function LocateCallback

MoreInfo::GetProductVersion "$R9"
Pop $0

${VersionCompare} "$0" "${DLL_VER}" $R1

StrCmp $R1 0 0 new
messagebox mb_ok 'Found file at location $R9.$\r$\n \
Installed version is $0 required version is ${DLL_VER}. Versions are equal.' idok end

new:
StrCmp $R1 1 0 old
messagebox mb_ok 'Found file at location $R9.$\r$\n \
Installed version is $0 required version is ${DLL_VER}. Installed version is newer.' idok end

old:
StrCmp $R1 2 0 end
messagebox mb_ok 'Found file at location $R9.$\r$\n \
Installed version is $0 required version is ${DLL_VER}. Installed version is older.' idok end

end:
StrCpy "$0" StopLocate
Push "$0"

FunctionEnd

While Compiling this code with latest version of MakeNSISW 2.3

I got following compilation error

!insertmacro: macro "LocateCall" requires 3 parameter(s), passed 5!


Apart from that I have another query ....

Say Microsoft has release 3 version of CRT for CRT8.
I know that if an application need v1 of CRT and if v2 or v3 is there that would work ....

but what if there is no version of CRT8 at all and
there is CRT9 ..will my app work with that ?

Was i clear? Say i have developed an app with VS 2008 Sp1...

now suppose in future if somebody tries my app... he/she doens;t have VC++ 2008 SP1 runtime but have VC++ 2010 or VC++ 2012 runtime .... will that support my app theoritically.
arif.ali.syed is offline   Reply With Quote
Old 5th March 2010, 18:11   #19
arif.ali.syed
Junior Member
 
Join Date: Mar 2010
Posts: 5
Can anybody help me compile this code
arif.ali.syed is offline   Reply With Quote
Old 14th November 2012, 11:42   #20
kalverson
Senior Member
 
Join Date: May 2007
Location: Maple Grove, Minnesota
Posts: 134
You could roll your own. Here is a helpful link I used.
http://blogs.msdn.com/b/astebner/arc...9/9384143.aspx
kalverson is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump