!include LogicLib.nsh
!include StrFunc.nsh
${StrLoc}
Section
ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems" "Windows"
${StrLoc} $7 $0 "SharedSection=" ">" ; Find "SharedSection="
StrCpy $R1 $0 $7 ; Save the stuff before "SharedSection="
StrCpy $R2 $0 "" $7
${StrLoc} $8 $R2 " " ">" ; Find the end of "SharedSection=#,#,#" by looking for a space
${IfThen} $8 = 0 ${|} StrLen $8 $R2 ${|}
StrCpy $R3 $R2 "" $8 ; Save the stuff after "SharedSection=#,#,#"
StrCpy $R2 $0 $8 $7 ; Save "SharedSection=#,#,#"
; We can now parse "SharedSection=#,#,#":
StrLen $8 $R2
findcomma:
IntOp $8 $8 - 1
StrCpy $1 $R2 1 $8
StrCmp $1 "," findcomma_end
StrCmp $1 "" findcomma_end findcomma
findcomma_end:
IntOp $9 $8 + 1
StrCpy $2 $R2 "" $9
${If} $1 != "" ; Only edit if we found the comma..
${AndIf} $2 != "" ; ..And there was something after the comma
StrCpy $R2 $R2 $8 ; Copy the first part of the string
StrCpy $R2 "$R2,1536" ; Append the final comma and number
${EndIf}
StrCpy $0 "$R1$R2$R3" ; Build the final string
DetailPrint Result=$0
# TODO: WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems" "Windows" $0
SectionEnd
此代码中l的值返回True。这怎么可能?按照评估顺序,比较优先于“或不,和”运算符。
答案 0 :(得分:0)
它们确实具有更高的优先级,但or
operator works by:
表达式
x or y
首先评估x
;如果x
为真,则返回其值;否则,将评估y
并返回结果值。
由于k
为3.3333333333333335
,表达式k <= 3
为False
,True
将被评估(自身)并返回制作{{1} }}