# Wednesday, November 21, 2007
« Deploy to Test From CCTray | Main | MonoRail Validation and Overriding onSub... »

I was banging my head against the wall today trying to figure out a compatible way between Windows XP and Vista to detect if MSVCRT 8 runtime was installed using NSIS.  I wanted to do this because I want to avoid downloading that component if the user's PC already has that version installed; this is especially important for update scenarios.  Finally I figured out a very simple way to do it, just wildcard check for the existence of a specific versioned directory in the WinSxS folder:

; IsMsvcrt8Installed
;
; Checks target machine for MSVCRT 8.0.50727.762 runtime installed in Windows
; SxS DLL cache.
;
; Returns 1 if found, otherwise 0
Function IsMsvcrt8Installed

  ; we can assume version because SxS directory is version specific
  FindFirst $R1 $R0 "$WINDIR\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.762*"
  
  ${If} $R0 != ""
    DetailPrint "MSVCRT 8.0 is installed."
    StrCpy $R0 1
  ${Else}
    DetailPrint "MSVCRT 8.0 is not installed."
    StrCpy $R0 0
  ${EndIf}
  
  Push $R0
  
FunctionEnd

Wednesday, November 21, 2007 1:04:40 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  |  Related posts:

Comments are closed.