Installer: Added statistics reporting

This commit is contained in:
Birunthan Mohanathas 2012-06-24 15:05:09 +03:00
parent 482ab59bc2
commit 8afa0695a9

View File

@ -98,6 +98,9 @@ Var NonDefaultLanguage
Var AutoStartup
Var Install64Bit
Var InstallPortable
!ifndef BETA
Var SendStatistics
!endif
Var un.DeleteAll
; Install
@ -215,6 +218,9 @@ Function .onInit
StrCpy $NonDefaultLanguage $3
StrCpy $LANGUAGE $4
StrCpy $INSTDIR $5
!ifndef BETA
StrCpy $SendStatistics $6
!endif
${EndIf}
FunctionEnd
@ -224,6 +230,9 @@ Function ExchangeSettings
StrCpy $3 $NonDefaultLanguage
StrCpy $4 $LANGUAGE
StrCpy $5 $INSTDIR
!ifndef BETA
StrCpy $6 $SendStatistics
!endif
HideWindow
FunctionEnd
@ -361,6 +370,15 @@ Function PageOptions
${NSD_CreateGroupBox} 0 42u -1u $1 "$(ADDITIONALOPTIONS)"
${EndIf}
!ifndef BETA
${NSD_CreateCheckbox} 6u 92u 285u 12u "Send computer information"
Pop $R4
${NSD_Check} $R4
${NSD_CreateLabel} 17u 105u -20u 43u "Your computer's Windows version, language, and hardware capabilities will be reported once during installation to improve Rainmeter. No personal information will be sent."
Pop $0
!endif
; Set default directory
${If} $InstallPortable == 1
${GetRoot} "$WINDIR" $0
@ -471,6 +489,19 @@ Function PageOptionsOnLeave
${NSD_GetState} $R3 $AutoStartup
${EndIf}
!ifndef BETA
${NSD_GetState} $R4 $SendStatistics
${If} ${FileExists} "$INSTDIR\Rainmeter.exe"
MoreInfo::GetFileVersion "$INSTDIR\Rainmeter.exe"
Pop $0
${VersionCompare} "${VER}.0.${REV}" "$0" $1
${If} $1 != 1
StrCpy $SendStatistics "0"
${EndIf}
${EndIf}
!endif
${If} $InstallPortable != 1
${IfNot} ${UAC_IsAdmin}
; UAC_IsAdmin seems to return incorrect result sometimes. Recheck with UserInfo::GetAccountType to be sure.
@ -660,6 +691,49 @@ Section
Sleep 500
${Next}
!ifndef BETA
${IfNot} ${Silent}
${AndIf} $SendStatistics == 1
System::Call "advapi32::GetUserName(t .r0, *i ${NSIS_MAX_STRLEN} r1) i.r2"
${If} ${RunningX64}
SetRegView 64
${EndIf}
ReadRegStr $1 HKLM "SOFTWARE\Microsoft\Cryptography" "MachineGuid"
${If} ${RunningX64}
SetRegView 32
${EndIf}
MD5::GetMD5String "$0$1"
Pop $R0
${WinVerGetMajor} $R1
${WinVerGetMinor} $R2
${WinVerGetServicePackLevel} $R3
System::Call 'kernel32::LoadLibrary(t"d2d1.dll")i.r0'
${If} $0 <> 0
StrCpy $R4 "1"
System::Call 'kernel32::FreeLibrary(i r0)'
${Else}
StrCpy $R4 "0"
${EndIf}
System::Call 'kernel32::IsProcessorFeaturePresent(i${PF_XMMI_INSTRUCTIONS_AVAILABLE})i.r5'
${If} $5 != 0
StrCpy $R5 "1"
${EndIf}
System::Call 'kernel32::IsProcessorFeaturePresent(i${PF_XMMI64_INSTRUCTIONS_AVAILABLE})i.r6'
${If} $6 != 0
StrCpy $R6 "1"
${EndIf}
System::Call 'kernel32::GetUserDefaultUILanguage() i.R7'
NSISdl::download_quiet /TIMEOUT=30000 "http://rainmeter.net/stat/${VER}.php?id=$R0&vmj=$R1&vmi=$R2&vsp=$R3&d2d=$R4&sse=$R5&sse2=$R6&uilang=$R7&lang=$LANGUAGE" "$PLUGINSDIR\_"
Delete "$PLUGINSDIR\_"
${EndIf}
!endif
; Move Rainmeter.ini to %APPDATA% if needed
${IfNot} ${Silent}
${AndIf} ${FileExists} "$INSTDIR\Rainmeter.ini"