#222 New PushFlags/PopFlags commands


These two commands allows you to push/pop the state of certain members in g_exec_flags to an internal stack (lastused with the power of a stack)

It also fixes bug #2969695 (If this patch is not accepted/wanted, that bug can be fixed by just adding some magic code detection to EW_SETFLAG)

Code used during bug fix:

Setdetailsprint both
DetailPrint "Hey yo"
Setdetailsprint none
System::Free 0
DetailPrint "You can't see me"
Setdetailsprint lastused
DetailPrint "Say hello to the bad guy"


  • Anders

    Anders - 2010-03-31

    diff to 31-Mar-2010.cvs

  • f0rt

    f0rt - 2010-04-01

    In my humble opinion the proposed script commands PushFlags and PopFlags are rather specialized. I have got doubts that many developers would actually need it.

    The offending code (internal NSIS function [un.]Initialize_____Plugins) for bug #2969695 intends to hide the output of the extract operation of a plug-in DLL. My suggestion would be to implement a "silent extract" for that case.

    PushFlags and PopFlags could be implemented with the existing script commands such as:

    !include "StrFunc.nsh"

    ; Declare string functions

    !macro pushflags param
    Push ${param}
    call pushflags

    !define pushflags `!insertmacro pushflags`
    !define popflags `call popflags`

    Var LastSavedFlags

    ; Save flags
    ; Flags could be:
    ; SetShellVarContext *current*|all
    ; SetRegView *32*|64|lastused
    ; SetDetailsPrint none|listonly|textonly|*both*|lastused
    Function pushflags
    Exch $0 Exch $0
    StrCpy $LastSavedFlags $0
    Pop $0

    ; Restore last saved flags
    Function popflags
    Push $0
    Push $1
    Push $2
    StrCpy $1 $LastSavedFlags
    StrCpy $2 0
    ${StrTok} $0 $1 "|" $2 "0"
    ${If} $0 == ""
    ${Switch} $0
    ${Case} "all"
    SetShellVarContext all
    ${Case} "current"
    SetShellVarContext current
    ${Case} "32"
    SetRegView 32
    ${Case} "64"
    SetRegView 64
    ${Case} "none"
    SetDetailsPrint none
    ${Case} "listonly"
    SetDetailsPrint listonly
    ${Case} "textonly"
    SetDetailsPrint textonly
    ${Case} "both"
    SetDetailsPrint both
    IntOp $2 $2 + 1
    ${Loop} Pop $1
    Pop $0

    ${pushflags} "current|32|both"

  • Anders

    Anders - 2010-04-01

    PushFlags/PopFlags would be very handy for people writing general helper functions that go in include files.

    As far as your example goes, it does not work at all (And implementing it in NSIS script is not possible since you cannot access the current state at all)


Log in to post a comment.