NSIS 판단 시스템 버전

Function "GetWinVer"
/*
;Push $R0
;Push $R1
ClearErrors
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
IfErrors 0 lbl_winnt
; we are not NT
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion"  VersionNumber
StrCpy $R1 $R0 1
StrCmp $R1 '4' 0 lbl_error
StrCpy $R1 $R0 3
StrCmp $R1 '4.0' lbl_win32_95
StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
lbl_win32_95:
StrCpy $R0 '95'
Goto lbl_done
lbl_win32_98:
StrCpy $R0 '98'
Goto lbl_done
lbl_win32_ME:
StrCpy $R0 'ME'
Goto lbl_done
lbl_winnt:
StrCpy $R1 $R0 1
StrCmp $R1 '3' lbl_winnt_x
StrCmp $R1 '4' lbl_winnt_x
StrCpy $R1 $R0 3
StrCmp $R1 '5.0' lbl_winnt_2000
StrCmp $R1 '5.1' lbl_winnt_XP
StrCmp $R1 '5.2' lbl_winnt_2003
StrCmp $R1 '6.0' lbl_winnt_vista 
StrCmp $R1 '6.1' lbl_winnt_win7 lbl_error

lbl_winnt_x:
StrCpy $R0 "NT $R0" 6
Goto lbl_done

lbl_winnt_2000:
Strcpy $R0 '2000'
Goto lbl_done

lbl_winnt_XP:
Strcpy $R0 'XP'
Goto lbl_done

lbl_winnt_2003:
Strcpy $R0 '2003'
Goto lbl_done

lbl_winnt_vista:
Strcpy $R0 'Vista'
Goto lbl_done

lbl_winnt_win7:
Strcpy $R0 'win7'
Goto lbl_done

lbl_error:
Strcpy $R0 ''
lbl_done:*/

    ${WinVerGetMajor} $R0
    ${WinVerGetMinor} $R1
    ${WinVerGetBuild} $R2
    ${WinVerGetServicePackLevel} $R3


    ; determine windows product name
    ${If} $R0 == 5 
            ${If} $R1 == 0
                    MessageBox MB_OK "Windows 2000 SP $R3"
            ${ElseIf} $R1 == 1
                    MessageBox MB_OK "Windows XP SP $R3"
            ${ElseIf} $R1 == 2
                    MessageBox MB_OK "Windows Server 2003 SP $R3"
            ${EndIf}
    ${ElseIf} $R0 == 6
            ${If} $R1 == 0
                    ${If} ${IsServerOS}
                            MessageBox MB_OK "Windows Server 2008 SP $R3"
                    ${Else}
                            MessageBox MB_OK "Windows Vista SP $R3"
                    ${EndIf}
            ${ElseIf} $R1 == 1
                    ${If} ${IsServerOS}
                            MessageBox MB_OK "Windows Server 2008 R2 SP $R3"
                    ${Else}
                            MessageBox MB_OK "Windows 7 SP $R3"
                    ${EndIf}
            ${ElseIf} $R1 == 2
                    ${If} ${IsServerOS} 
                            MessageBox MB_OK "Windows Server 2012 SP $R3"
                    ${Else}
                            MessageBox MB_OK "Windows 8 SP $R3"
                    ${EndIf}
            ${ElseIf} $R1 == 3
                    ${If} ${IsServerOS}
                            MessageBox MB_OK "Windows Server 2012 R2 SP $R3"
                    ${Else}
                            MessageBox MB_OK "Windows 8.1 SP $R3"
                    ${EndIf}
            ${EndIf}
    ${EndIf}
    ; version
    MessageBox MB_OK "Kernel $R0.$R1 build $R2"
FunctionEnd

다음 섹션에서는 X64 또는 X86 시스템을 판단합니다.
Function "IS64"
; x86 or x64:
    System::Call "kernel32::GetCurrentProcess() i .s"
    System::Call "kernel32::IsWow64Process(i s, *i .r0)"
    StrCmp $0 "0" is32bit is64bit
    is32bit:
			StrCpy $R5 "x86"
            ;MessageBox MB_OK  "32 bit"
            Goto exit
    is64bit:
		StrCpy $R5 "x64"
            ;MessageBox MB_OK  "64 bit"
    exit:
FunctionEnd

좋은 웹페이지 즐겨찾기