0

我发现很难更改 nsis 组件页面中的选择。要求是在安装过程中我得到一个许可协议页面,如果用户同意,那么他/她将点击我同意,在用户点击我同意后,我想知道安装程序安装在哪个操作系统上是可以的在 Windows Embedded OS 或 WinXp/Win7 上。因此,如果是 Windows Embedded OS,我想更改安装包,如果不是 Windows Embedded OS,则安装包会有所不同。

我在我的项目中使用 MUI ver1 而不是 MUI2。请让我知道如何实现这一目标。

4

2 回答 2

1

要测试运行设置的操作系统,您可以使用Winver.nsh随提供的宏定义的宏LogicLib.nsh来进行这样的优雅测试

;Dont't forget to include
!include "LogicLib.nsh"                 # use of various logic statements
!include "WinVer.nsh"                   # LogicLib extension for OS tests

一个平台测试示例:

${if} ${AtLeastWin95}
${AndIf} ${AtMostWinME}
    ;here we are on a pre-win2k
    ;do something        
${elseIf} ${isWin2008}
${orIf} ${AtLeastWin2008R2}
    ;this is post-win7
    ;do other thing
${endif}

要在运行时更改要安装的组件,您可以使用以下宏Sections.nsh

;if you have
Section "Sample Database" SecApplicationDB
;...
SectionEnd

;you can select or un select by code:
!insertmacro SelectSection ${SecApplicationDB}
;or
!insertmacro UnselectSection ${SecApplicationDB}
于 2012-12-04T09:52:22.553 回答
1

WinVer.nsh 不支持检查 Embedded NT,但您可以自己执行检查:

!include Sections.nsh
!include MUI.nsh

!ifndef VER_SUITE_EMBEDDEDNT
!define VER_SUITE_EMBEDDEDNT 0x00000040
!endif

!insertmacro MUI_PAGE_LICENSE "${__FILE__}"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English


Section "Embedded" SID_EMBED
SectionIn RO
SectionEnd

Section "Normal" SID_NORMAL
SectionIn RO
SectionEnd

Function .onInit
System::Call '*(i156,&i152)i.r1'
System::Call 'KERNEL32::GetVersionExA(ir1)'
System::Call '*$1(&i152,&i2.r2)'
System::Free $1
IntOp $2 $2 & ${VER_SUITE_EMBEDDEDNT}
${If} $2 <> 0
    !insertmacro SelectSection ${SID_EMBED}
    !insertmacro UnselectSection ${SID_NORMAL}
${Else}
    !insertmacro UnselectSection ${SID_EMBED}
    !insertmacro SelectSection ${SID_NORMAL}
${EndIf}
FunctionEnd
于 2012-12-04T12:20:50.323 回答