哪个DLL是[的DllImport]加载? [英] Which DLL is [DllImport] loading?

查看:265
本文介绍了哪个DLL是[的DllImport]加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了 [的DllImport] 属性导入本机DLL到我的应用程序,但该DLL它加载不在本地bin文件夹。它被从系统上的其他地方装,但我不能工作在哪里。

I'm using the [DllImport] attribute to import a native DLL into my application but the DLL it's loading isn't in the local bin folder. It's being loaded from elsewhere on the system, but I can't work out where.

它工作在我开发的机器,但不能在一个干净的。

It works on my dev machine but not on a clean one.

我已经启用融合的日志,并且只显示我的管理组件。

I've enabled Fusion logging and that only shows me managed assemblies.

我甩了使用Sysinternals的进程资源管理器的进程,在告诉我这是在 C:\ Windows \ System32下,但我看不到的文件中,有在Windows资源管理器

I've dumped the process using Sysinternals Process Explorer and that's telling me it's in C:\Windows\System32 but I can't see the file there in Windows Explorer.

这可能是值得指出的是,我运行64位的Windows 7,但该DLL只支持x86所以我不得不强迫我的应用程序确实是x86。是否有某种形式的重定向的改变,其中的x86文件是从装?

It might be worth noting that I'm running 64 bit Windows 7 but the DLL only supports x86 so I've had to force my app do be x86. Is there some sort of redirect that changes where x86 files are loaded from?

本的DllImport是一个自定义Silicon Labs的USB驱动程序。 [的DllImport(SiUSBXp.dll)]

The DllImport is a custom Silicon Labs USB driver. [DllImport("SiUSBXp.dll")]

我还使用命令提示符下做了 DIR SI * 在System32文件夹中,该文件是不存在的。

I've also used the command prompt to do a dir si* in the System32 folder and the file isn't there.

推荐答案

的的文件系统重定向器将踢:

在%WINDIR%\ System32目录中的64位应用程序保留的。当创建64位版本的DLL的大多数DLL文件的名称没有改变,因此32位版本的DLL文件都存储在不同的目录中。 WOW64使用文件系统重定向器隐藏这一差异。

The %windir%\System32 directory is reserved for 64-bit applications. Most DLL file names were not changed when 64-bit versions of the DLLs were created, so 32-bit versions of the DLLs are stored in a different directory. WOW64 hides this difference by using a file system redirector.

在大多数情况下,当一个32位应用程序试图访问%WINDIR%\ System32下,访问被重定向到%WINDIR%\ Syswow64资料。

In most cases, whenever a 32-bit application attempts to access %windir%\System32, the access is redirected to %windir%\SysWOW64.

因此​​,即使过程中认为它加载从 System32下的DLL ,它可能是由 Syswow64资料加载是的,数字是围绕着错误的方式从你所期望的东西。

So even though the process thinks it loaded the DLL from System32, it probably loaded from SysWOW64 And yes, the numbers are the wrong way around from what you'd expect.

这篇关于哪个DLL是[的DllImport]加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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