Archive: SectionSetFlags bits


SectionSetFlags bits
  I read the documentation and tried playing around with it.. but i am failing to grasps how to actually modify the bits to Select/Deselect make Read-only / Non-read only. Could anyone explain to me how these work exactly? thanks..


This will set the second section as currently enabled:


  SectionGetFlags 1 $R0

IntOp $R0 $R0| 0x80000000
SectionSetFlags 1 $R0
>
This will set the second section as always disabled:

  SectionSetFlags 1 0x40000000 

>
This will set the second section as always enabled:

  SectionSetFlags 1 0xC0000000 

>
This will set the second section as enabled in the first 2 install types, and currently enabled:

  SectionSetFlags 1 0x80000003 

>

Etc...

-Justin

Ok now i am not sure about how to test and see if a section is enabled or not.. would you use the AND operade like
SectionGetFlags 1 $R0
IntOp $R1 $R0 & 0x80000000
and then do a test like this to see if its valid or not..? or am i way off bases and totaly failing to understand how it works..


Yep you got it ...
IntOp $R1 $R0 & 0x80000000
IntCmp $R1 0 SectionNotEnabled
DetailPrint "Section is enabled"
SectionNotEnabled:

-Justin


Justin,
I think i am getting it.. I am using this as a test script.. would this be the best way to work with it.? I am using 0x00000000 to make a Selection Disabled correct method right? here is the script


Name "test"

>OutFile "test.exe"
>Caption "NSIS Testing Script"
>ShowInstDetails show
ComponentText "Testing"

>Section "crap"
GetDLLVersion $SYSDIRDVobSub.ax $3 $4
GetDLLVersion"C:\Windows\System\DVobSub.ax" $1 $2
DetailPrint "$3 $4, $1 $2"
IntOp $0 $3 & $4
IntOp$5 $3 | $4
DetailPrint "$0, $5"
IntOp $0 $1 & $2
IntOp$5 $1 | $2
DetailPrint "$0, $5"
SectionEnd

Section "VobSub for DirectShow"
>DetailPrint "Blah Blah"
>SectionEnd

Section "Section 3"
DetailPrint "Blah Blah 2"
>SectionEnd

Section "SubMux"
DetailPrint "Blah Blah 3"
>SectionEnd

>Function .onSelChange
;This does the check to see if the user (de)selected the SubMux and skips rest if not enabled
SectionGetFlags 3 $R1
IntOp $R2 $R1& 0x80000000
IntCmp $R2 0 Done

SectionGetFlags 1 $R1
IntOp $R2 $R1& 0x80000000
IntCmp $R2 0 NotEnabled
Goto Done
NotEnabled:
MessageBox MB_YESNO "Submux needs VobSub for DirectShow installed to function properly would you like to also install VobSub for DirectShow?" IDNO DontInstall
SectionSetFlags 1 0x80000000
Goto Done
DontInstall:
SectionSetFlags 3 0x0000000
Done:
>FunctionEnd
>
thanks for all this added stuff in this release.. Love it now you can make dependances and change stuff at runtime.. ;o) Keep up the great work.