简体   繁体   English

32位NSIS是否可以启动64位程序?

[英]Is it possible for 32 bit NSIS to launch a 64 bit program?

I'm porting a windows program from 32 -> 64 bit. 我正在移植一个32位 - > 64位的Windows程序。 It has a 32 bit installer which is written using NSIS. 它有一个32位安装程序,使用NSIS编写。 Can I launch one of my new 64 bit exes using the 32 bit NSIS installer? 我可以使用32位NSIS安装程序启动一个新的64位exes吗? I don't think there is a 64 bit version of NSIS... 我不认为有64位版本的NSIS ......

Sure you can, NSIS doesn't impose any restrictions and what's really nifty about NSIS is if you have both 32 and 64 bit versions of your app, you can do a combined installer, and install the required files on a per-architecture basis. 当然可以,NSIS不会施加任何限制,对于NSIS而言,如果您同时拥有32位和64位版本的应用程序,您可以执行组合安装程序,并在每个架构的基础上安装所需的文件。 eg 例如

!include "x64.nsh"

${If} ${RunningX64}
    File ..\x64\blah.exe
${Else}
    File ..\x86\blah.exe
${EndIf}

NSIS使用两个Win32 API来执行ShellExecute (通过ExecShell )和CreateProcess (通过ExecExecWait )进程,它们都可以从NSIS 32位进程运行64位进程(x64)(只要你在64位操作系统上运行) )。

For executing processes needing 64-bit operation I found the default NSIS execution would not automatically run in 64-bit mode. 为了执行需要64位操作的进程,我发现默认的NSIS执行不会自动以64位模式运行。 I encountered this when trying to run DISM to install .NET Framework 3.5. 我在尝试运行DISM以安装.NET Framework 3.5时遇到过这种情况。 DISM would error out stating: DISM会错误地说明:

"You cannot service a running 64-bit operating system with a 32-bit version of DISM." “无法使用32位版本的DISM为正在运行的64位操作系统提供服务。”

To resolve I added needed to add DisableX64FSRedirection before the call that needs 64-bit operation. 要解决我需要在需要64位操作的调用之前添加DisableX64FSRedirection See below for example: 见下面的例子:

${If} ${RunningX64}
   ${DisableX64FSRedirection}
   DetailPrint "Disabling Windows 64-bit file system redirection"
${EndIf}

nsExec::ExecToStack 'Dism.exe /Online /Enable-Feature /FeatureName:NetFx3'

${If} ${RunningX64}
   ${EnableX64FSRedirection}
   DetailPrint "Re-enabling Windows 64-bit file system redirection"
${EndIf}

just to add more descriptive 只是为了增加更多的描述性

have a look, http://www.autoitscript.com/forum/index.php?showtopic=44048 看看, http://www.autoitscript.com/forum/index.php?showtopic = 44048

Well.. there are some restrictions here.. for instance, try run odbcconf.exe to install a driver. 嗯..这里有一些限制..例如,尝试运行odbcconf.exe来安装驱动程序。 I have not been able to figure out a way to make that come in as a 64bit entry. 我无法找到一种方法来让它作为64位条目进入。 Same way I think as if you (in a 64bit system) start "powershell x86" as admin, then run cmd and odbcconf from there - no easy way to get around it that I can find, making odbcconf do x64 同样的方式我认为好像你(在一个64位系统中)作为管理员启动“powershell x86”,然后从那里运行cmd和odbcconf - 没有简单的方法可以找到我能找到的,使odbcconf做x64

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM