Windows Server 2008 64 位上的 7-Zip 执行权限 [英] 7-Zip execution permissions on Windows Server 2008 64-bit

查看:23
本文介绍了Windows Server 2008 64 位上的 7-Zip 执行权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个自解压 7-Zip 文件.其中包含一个 CMD 文件,7-Zip 在提取时运行该文件.此 cmd 读取注册表并执行一些进一步的活动(对于此特定问题不重要).

I've created a self-extracting 7-Zip file. There is one CMD file contained in it which 7-Zip runs on extract. This cmd reads the registry and performs some further activities (unimportant to this specific question).

在 32 位 Windows Server 2003 中,此行为工作正常.但是,在 Windows Server 2008 机器上的测试表明 7-Zip 启动的 cmd 没有读取注册表的权限.更具体地说,它可以读取某些区域(Windows 当前版本),但不能读取其他区域(其他软件密钥).

In Windows Server 2003 32-bit this behavior works just fine. However, testing on a Windows Server 2008 box shows that the cmd kicked off by 7-Zip doesn't have permissions to read the registry. More specifically it can read some areas (Windows current version), but not others (other software keys).

如果我使用该 cmd 文件并自己运行它(从 7-Zip 将其解压缩到的临时文件夹中运行它),一切运行正常.

If I take that cmd file and run it myself (running it from the temporary folder that 7-Zip extracts it to) everything runs fine.

使用 UAC以管理员身份运行"会产生同样的问题,禁用 UAC 似乎没有帮助.

Using UAC "Run as Administrator" produces the same issue, and disabling UAC doesn't seem to help.

我不知道配置文件的任何 7-Zip 选项告诉它提升权限,或类似的东西.有什么我在这里想念的吗?注册表访问在 Windows Server 2008 或 64 位版本的操作系统中是否更加锁定?如何确保我的 EXE 文件可以将正确的权限传递给它启动的命令?

I'm not aware of any 7-Zip options for the configuration file that tells it to escalate privileges, or anything like that. Is there something I'm missing here? Has registry access gotten more locked down in Windows Server 2008, or on a 64 bit version of the OS? How can I ensure that my EXE file can pass the right permissions to the command it kicks off?

推荐答案

因为 7-Zip 文件是 32 位可执行文件,所以您的命令脚本在 32 位上下文中运行.后果之一是某些注册表位置被重定向.有关详细信息,请参阅 MSDN.

Because the 7-Zip file is a 32-bit executable, your command script is running in a 32-bit context. One of the consequences is that certain registry locations are redirected. See MSDN for more details.

您可以通过查找环境变量PROCESSOR_ARCHITEW6432来检测WOW64环境,并且您可以通过运行cmd.exe的副本返回到本机64位环境在 c:windowssysnative 中找到.

You can detect a WOW64 environment by looking for an environment variable, PROCESSOR_ARCHITEW6432 and you can return to the native 64-bit environment by running the copy of cmd.exe found in c:windowssysnative.

命令文件顶部的这两行应该可以解决问题:

These two lines at the top of your command file should do the trick:

if defined PROCESSOR_ARCHITEW6432 c:windowssysnativecmd.exe /c %~pf0 %*
if defined PROCESSOR_ARCHITEW6432 goto :eof

这篇关于Windows Server 2008 64 位上的 7-Zip 执行权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆