Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 14th October 2020, 09:52   #1
meoit
Senior Member
 
Join Date: Oct 2014
Location: $DESKTOP
Posts: 100
Smile Detect and show all VC ++ versions installed in a RichEdit/Label control

I am trying to do an installer that includes the VC ++ versions.
In it, there is a button to remove an existing or old VC ++ version.
And I want to check which versions of VC ++ are installed, then show it to RichEdit / Label.

I was told, to access the registry with a loop $ {FOR}:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{xxxxxx-uuuu-ddddd-zzzzzz-yyyyyyyyyyyy}

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{xxxxxx-uuuu-ddddd-zzzzzz-yyyyyyyyyyyy}

How can I query for string GUID(s) of VC ++ {xxxxxx-uuuu-ddddd-zzzzzz-yyyyyyyyyyyy} ?

Thanks.
meoit is offline   Reply With Quote
Old 14th October 2020, 11:17   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,355
EnumRegKey

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 21st October 2020, 16:15   #3
stass
Senior Member
 
Join Date: Nov 2012
Posts: 155
PHP Code:
OutFile "MSIFuncTest.exe"
!include "MUI2.nsh" 
!include "Sections.nsh"

!define MsiGetProductInfo '!insertmacro MsiGetProductInfo'
!define redists "{08D44BDE-2EB1-11E8-AF3D-001B2160B4E0}"   ;  corresponding GUID

!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

RequestExecutionLevel admin

Var /GLOBAL err
!macro MSI_ERROR
${If} $err == "1602"
DetailPrint "Installation aborted"
${ElseIf} $err == "1638"
DetailPrint "Another version of VC ++ is already installed. Installation continues ..."
${ElseIf} $err == "0"
DetailPrint "VC ++ installed successfully"
${EndIf}
!
macroend

Var MSI_PRODUCT
!macro MsiGetProductInfo PRODUCTCODE PROPERTY
 Push 
${PRODUCTCODE}
 
Push ${PROPERTY}
 
Exch $0
 Exch
 Exch 
$1
 Push 
$2
 Push 
$3
 Push 
$4
 Push 
$5
 System
::Alloc 2
 Pop 
$3
 System
::Call 'msi::MsiGetProductInfo(t r1,t r0,n,i $3)i .r2'
 
System::Call '*$3(&i2 .r5)'
 
InTop $$1
 System
::Call '*$3(&i2 r5)'
 
System::Alloc $5
 Pop 
$4
 System
::Call 'msi::MsiGetProductInfo(t r1,t r0,i $4,i $3)i .r2'
 
System::Call '*$3(&i2 .r5)'
 
System::Call '*$4(&t$5 .r0)'
 
System::Free $3              
 System
::Free $4
 Pop 
$5
 Pop 
$4
 Pop 
$3
 Pop 
$1
 Exch 
$0
 Pop $MSI_PRODUCT
!macroend

Section 
/"vc++" vc
SetDetailsPrint textonly
DetailPrint 
"Installing MSVCRT Redists {08D44BDE-2EB1-11E8-AF3D-001B2160B4E0}..."
SetDetailsPrint listonly

SetShellVarContext all
SetOverwrite on

SetDetailsPrint none
SetOutPath 
"$TEMP"
File /"redist"

SetDetailsPrint none
ExecWait 
'msiexec /i "$TEMP\redist\redists.msi" /quiet' $err 
SetDetailsPrint textonly
!insertmacro MSI_ERROR

Sleep 1000
RmDir 
/"$TEMP\redist"
SectionEnd

Function .onInit
${MsiGetProductInfo"${redists}" "ProductName"
;MessageBox MB_OK "Code Error $2"
${If} $== 1605
MessageBox MB_OK 
"MSVCRT Redists Not installed !"
SectionSetFlags ${vc} ${SF_SELECTED}
${EndIf}
${If} $
== 0
MessageBox MB_OK 
"MSVCRT Redists already installed"
ExecWait "MsiExec.exe /X{08D44BDE-2EB1-11E8-AF3D-001B2160B4E0}"
${EndIf}
FunctionEnd 
stass is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
vcplusplus

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