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

查看:144
本文介绍了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).

在Windows Server 2003 32位中,此行为正常。但是,在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文件并自己运行(运行它)

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位版本的OS中,注册表访问权限是否已被进一步锁定?我该如何确保我的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压缩文件是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环境,然后可以返回本机​​64运行在 c:\windows\sysnative 中找到的 cmd.exe 副本的高级环境。

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:\windows\sysnative.

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

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

if defined PROCESSOR_ARCHITEW6432 c:\windows\sysnative\cmd.exe /c %~pf0 %*
if defined PROCESSOR_ARCHITEW6432 goto :eof

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

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