简体   繁体   English

注册表访问 - Win7“任何CPU”vs x86

[英]Registry access - Win7 “Any CPU” vs x86

We had one of our programmers make some changes that really don't make sense to anyone and i'm hoping someone can provide some insight.Unfortunately we are unable to contact him until next week but it would be nice to know this info sooner. 我们让我们的程序员做了一些对任何人都没有意义的改变,我希望有人可以提供一些见解。很遗憾,我们无法在下周联系他,但很快就会知道这些信息。

We have a custom application loader (built in .net) that downloads all appropriate source files and registers/unregisters dlls that are COM and runs RegASM for some assemblies. 我们有一个自定义应用程序加载器(内置.net),可以下载所有适当的源文件,注册/取消注册COM,这些dll是COM,并为某些程序集运行RegASM。 We had problems with the loader under windows 7 (x64) which he was assigned to correct. 我们在Windows 7(x64)下遇到了装载机问题,他被指派纠正。

The only thing that the individual assigned to fix this problem did was to request the loader be built as x86 rather than "Any CPU". 为解决这个问题而分配的唯一一件事就是请求将加载器构建为x86而不是“Any CPU”。 We having trouble seeing how this could have fixed anything. 我们很难看到这可能有什么问题。

Previously we had COM registration errors and "Requested registry access is not allowed" errors when trying to create TLB files with RegASM. 以前我们遇到COM注册错误,并且在尝试使用RegASM创建TLB文件时“不允许请求注册表访问”错误。 Does anyone have any idea how his change could have affected this at all? 有没有人知道他的改变会如何影响这一点?

Your co-workers fix was correct. 你的同事修复是正确的。 Here is why: 原因如下:

In Windows x64 a process may be started as 32bit or 64bit process. 在Windows x64中,进程可以以32位或64位进程启动。 A 64bit process can only load 64bit dlls and a 32bit process only 32bit dlls. 64位进程只能加载64位dll,而32位进程只能加载32位dll。

If your platform target (eg specified in the project properties) of your .NET application is set to "Any CPU", the intermediate code will be compiled to 32bit or 64bit code depending on the target platform, ie on a x64 system 64bit code will be generated. 如果您的.NET应用程序的平台目标(例如,在项目属性中指定)设置为“任何CPU”,则中间代码将根据目标平台编译为32位或64位代码,即在x64系统上64位代码将生成。 As a consequence, any 32-bit library such as native 32-bit COM components cannot be loaded into the64-bit process. 因此,任何32位库(如本机32位COM组件)都无法加载到64位进程中。

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

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