代码之家  ›  专栏  ›  技术社区  ›  singularity

NSIS推送、pop和URLEncode

  •  1
  • singularity  · 技术社区  · 7 年前

    我正在尝试在NSIS中使用URLEncode编码字符串。我正在使用一个名为URLEncode的NSIS插件。问题是我尝试对2个变量进行编码,但在对第二个变量进行编码后,第一个编码的变量丢失了值。

    Push "${AFF_NAME}"
    Call URLEncode
    Pop $3
    ;at this point the messagebox show the result good.
    MessageBox MB_OK $3
    
    ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "ProductName"
    Push $0
    Call URLEncode
    Pop $0
    ;now after second var encoded the result of first var $3 lost the value
    MessageBox MB_OK $3
    

    请帮助我,我是一个非常新的使用NSIS的人,我不知道怎么做才好。我搜索信息但没有成功。

    非常感谢!

    1 回复  |  直到 7 年前
        1
  •  0
  •   Anders    7 年前

    我不知道有URLEncode插件,但NSIS wiki上有一个名为URLEncode的助手函数,它无法保留寄存器。

    您可以通过修改函数的开始和结束来修复它,使其如下所示:

    ; Start
    Function URLEncode
        System::Store S ; Save registers
        Pop $0 ;param
    
        ...
    
    Done:
        Push $9
        System::Store L ; Restore registers
    FunctionEnd
    ; End