除了在调试器中,x86 控制台应用程序不能在 64 位机器上运行 [英] x86 console application doesn't run on 64bit machines except in debugger

查看:38
本文介绍了除了在调试器中,x86 控制台应用程序不能在 64 位机器上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了更好地解决我的问题NUnit:无法加载文件或程序集some.dll"或其依赖项之一.找不到指定的模块 我试图通过摆脱 NUnit 来降低复杂性.现在我编写了一个普通的控制台应用程序 (C#),它与一个 c++/cli 包装器交互,后者调用公司框架 c++ dll.

In order to get a better hold on my question NUnit: Could not load file or assembly 'some.dll' or one of its dependencies. The specified module could not be found I tried to reduce complexity by getting rid of NUnit. Now I wrote a plain console application (C#) which interacts with a c++/cli wrapper which does calls on company framework c++ dlls.

Dumpbin 说所有程序集都是 32 位的.Visual Studio 将控制台应用程序和包装器设置为 x86.在 x86 机器上,控制台应用程序就像一个魅力,在 x64 上它不是,除非从我的 Visual Studio 2013 调用并附加调试器(在没有调试器的情况下从 Visual Studio 运行时不起作用).程序集设置为Systemeigenes Codedebugging aktivieren"(激活本机?代码调试)并且停用 Visual Studio 托管进程.它不起作用"用这样的表示:

Dumpbin says that all assemblies are 32bit. Visual Studio has console application and wrapper set to x86. On x86 machines console application works like a charm, on x64 it doesn't, except when being called from my Visual Studio 2013 with debugger attached (doesn't work when run from Visual Studio without debugger). The assembly is set to "Systemeigenes Codedebugging aktivieren" (activate native? code debugging) and Visual Studio hosting process is deactivated. "It doesn't work" is represented by something like this:

 SetUp : System.IO.FileLoadException : Could not load file or assembly 'The_Wrapper.DLL' or one of its dependencies. A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)

我尝试在 64 位机器上使用dependency walker(x86 版本)进行分析,但在加载 IMM32.DLL 后它就死了.x86 机器上的输出是这样的:

I tried profiling with dependency walker (x86 version) on the 64 bit machines, but it dies after loading IMM32.DLL. The output on a x86 machine is like this:

 Operating System: Microsoft Windows NT/2000/XP/2003/Vista based Media Center (32-bit), version 6.01.7601 Service Pack 1
 Program Executable: d:	mpinplaininPLAINCONSOLEAPPLICATION.EXE
 Program Arguments: 
 Starting Directory: D:	mpinplainin
 Search Path: C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0

 Options Selected:
      Simulate ShellExecute by inserting any App Paths directories into the PATH environment variable.
      Log thread information.
      Use simple thread numbers instead of actual thread IDs.
      Log first chance exceptions.
      Log debug output messages.
      Use full paths when logging file names.
      Log a time stamp with each line of log.
      Automatically open and profile child processes.
 --------------------------------------------------------------------------------

 00:00:00.000: Started "d:	mpinplaininPLAINCONSOLEAPPLICATION.EXE" (process 0x9F0) at address 0x01360000 by thread 1.
 00:00:00.000: Loaded "c:windowssystem32NTDLL.DLL" at address 0x76F20000 by thread 1.
 00:00:00.000: Loaded "c:windowssystem32MSCOREE.DLL" at address 0x6CB30000 by thread 1.
 00:00:00.015: Loaded "c:windowssystem32KERNEL32.DLL" at address 0x75E00000 by thread 1.
 00:00:00.015: Loaded "c:windowssystem32KERNELBASE.DLL" at address 0x75320000 by thread 1.
 00:00:00.046: Entrypoint reached. All implicit modules have been loaded.
 00:00:00.046: Loaded "c:windowssystem32ADVAPI32.DLL" at address 0x77060000 by thread 1.
 00:00:00.046: Loaded "c:windowssystem32MSVCRT.DLL" at address 0x76E70000 by thread 1.
 00:00:00.046: Loaded "c:windowssystem32SECHOST.DLL" at address 0x76CA0000 by thread 1.
 00:00:00.062: Loaded "c:windowssystem32RPCRT4.DLL" at address 0x75B30000 by thread 1.
 00:00:00.062: Loaded "c:windowsmicrosoft.netframeworkv4.0.30319MSCOREEI.DLL" at address 0x6C9E0000 by thread 1.
 00:00:00.062: Loaded "c:windowssystem32SHLWAPI.DLL" at address 0x75DA0000 by thread 1.
 00:00:00.062: Loaded "c:windowssystem32GDI32.DLL" at address 0x77100000 by thread 1.
 00:00:00.062: Loaded "c:windowssystem32USER32.DLL" at address 0x75F70000 by thread 1.
 00:00:00.078: Loaded "c:windowssystem32LPK.DLL" at address 0x76040000 by thread 1.
 00:00:00.078: Loaded "c:windowssystem32USP10.DLL" at address 0x75A90000 by thread 1.
 00:00:00.078: Loaded "c:windowssystem32IMM32.DLL" at address 0x75BE0000 by thread 1.
 00:00:00.078: Loaded "c:windowssystem32MSCTF.DLL" at address 0x75CA0000 by thread 1.
 00:00:00.093: Loaded "c:windowsmicrosoft.netframeworkv4.0.30319CLR.DLL" at address 0x6B660000 by thread 1.
 00:00:00.093: Loaded "c:windowssystem32MSVCR100_CLR0400.DLL" at address 0x6BCD0000 by thread 1.
 00:00:00.093: First chance exception 0x04242420 (Unknown) occurred in "c:windowssystem32KERNELBASE.DLL" at address 0x7532B760 by thread 1.
 00:00:00.093: Thread 2 started in "c:windowsmicrosoft.netframeworkv4.0.30319CLR.DLL" at address 0x6B7C741C.
 00:00:00.093: Thread 3 started in "c:windowsmicrosoft.netframeworkv4.0.30319CLR.DLL" at address 0x6B7159C0.
 00:00:00.093: Thread 4 started in "c:windowssystem32NTDLL.DLL" at address 0x76F4FD0F.
 00:00:00.093: Loaded "c:windowsassembly
ativeimages_v4.0.30319_32mscorlibcece9d0256e18427b64587ba690605d4MSCORLIB.NI.DLL" at address 0x6A890000 by thread 1.
 00:00:00.109: Loaded "c:windowsmicrosoft.netframeworkv4.0.30319NLSSORTING.DLL" at address 0x6BF70000 by thread 1.
 00:00:00.109: Loaded "c:windowssystem32OLE32.DLL" at address 0x75930000 by thread 1.
 00:00:00.109: Loaded "c:windowssystem32CRYPTBASE.DLL" at address 0x74FF0000 by thread 1.
 00:00:00.109: Loaded "c:windowsmicrosoft.netframeworkv4.0.30319CLRJIT.DLL" at address 0x6BF10000 by thread 1.
 00:00:00.124: Loaded "" at address 0x6BEB0000 by thread 1.
 00:00:00.124: Loaded "" at address 0x00640000 by thread 1.
 00:00:00.124: Unloaded "" at address 0x6BEB0000 by thread 1.
 00:00:00.124: Loaded "d:	mpinplaininTHE_WRAPPER.DLL" at address 0x6BEB0000 by thread 1.
 00:00:00.124: Loaded "d:	mpinplaininCORE_QUANTITY_1_0.DLL" at address 0x6BE30000 by thread 1.
 00:00:00.140: Loaded "d:	mpinplaininCORE_DATATYPES_1_0.DLL" at address 0x6BD90000 by thread 1.
 00:00:00.140: Loaded "d:	mpinplaininCORE_MEMORY_1_0.DLL" at address 0x6A880000 by thread 1.
 00:00:00.140: Loaded "d:	mpinplaininCORE_EXCEPTION_1_0.DLL" at address 0x6A870000 by thread 1.
 00:00:00.140: Loaded "c:windowssystem32MSVCP120.DLL" at address 0x6A7F0000 by thread 1.
 00:00:00.140: Loaded "c:windowssystem32MSVCR120.DLL" at address 0x6A700000 by thread 1.
 00:00:00.156: Loaded "d:	mpinplaininOPENCV_CORE248.DLL" at address 0x6A4F0000 by thread 1.
 00:00:00.156: Loaded "d:	mpinplaininDEVICECOM_CAMERA_IRSOFT_1_0.DLL" at address 0x6A4C0000 by thread 1.
 00:00:00.156: Loaded "d:	mpinplaininDEVICECOM_STACK_1_0.DLL" at address 0x6A4B0000 by thread 1.
 00:00:00.156: Loaded "d:	mpinplaininDEVICECOM_DEVICEHANDLER_CAMERA_1_0.DLL" at address 0x6A490000 by thread 1.
 00:00:00.156: Loaded "d:	mpinplaininDEVICECOM_CAMERA_1_0.DLL" at address 0x6A3F0000 by thread 1.
 00:00:00.171: Loaded "d:	mpinplaininDEVICECOM_CORE_1_0.DLL" at address 0x6A3B0000 by thread 1.
 00:00:00.171: Loaded "d:	mpinplaininCORE_ACTION_1_0.DLL" at address 0x6A380000 by thread 1.
 00:00:00.171: Loaded "d:	mpinplaininCORE_PROTOCOL_1_0.DLL" at address 0x6A360000 by thread 1.
 00:00:00.171: Loaded "d:	mpinplaininCORE_SOCKET_1_0.DLL" at address 0x69DB0000 by thread 1.
 00:00:00.187: Loaded "c:windowssystem32WS2_32.DLL" at address 0x75F30000 by thread 1.
 00:00:00.187: Loaded "c:windowssystem32NSI.DLL" at address 0x76E60000 by thread 1.
 00:00:00.187: Loaded "c:windowssystem32WINMM.DLL" at address 0x737A0000 by thread 1.
 00:00:00.187: Loaded "d:	mpinplaininWDAPI1020.DLL" at address 0x10000000 by thread 1.
 00:00:00.187: Loaded "c:windowssystem32OLEAUT32.DLL" at address 0x75C00000 by thread 1.
 00:00:00.202: Loaded "d:	mpinplaininCORE_UTILS_1_0.DLL" at address 0x69D90000 by thread 1.
 00:00:00.202: Loaded "d:	mpinplaininCORE_CODECS_1_0.DLL" at address 0x69D60000 by thread 1.
 00:00:00.202: Loaded "d:	mpinplaininMEASUREMENTS_RADIOMETRY_1_0.DLL" at address 0x69DE0000 by thread 1.
 00:00:00.202: Loaded "d:	mpinplaininVISION_IMGPROC_1_0.DLL" at address 0x69D30000 by thread 1.
 00:00:00.202: Loaded "d:	mpinplaininCORE_IMGIO_1_0.DLL" at address 0x69860000 by thread 1.
 00:00:00.218: Loaded "d:	mpinplaininOPENCV_HIGHGUI248.DLL" at address 0x697D0000 by thread 1.
 00:00:00.218: Loaded "c:windowswinsxsx86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.17514_none_ec83dffa859149afCOMCTL32.DLL" at address 0x6C5D0000 by thread 1.
 00:00:00.218: Loaded "c:windowssystem32MSVFW32.DLL" at address 0x69D00000 by thread 1.
 00:00:00.218: Loaded "c:windowssystem32SHELL32.DLL" at address 0x76050000 by thread 1.
 00:00:00.234: Loaded "c:windowssystem32AVIFIL32.DLL" at address 0x697B0000 by thread 1.
 00:00:00.234: Loaded "c:windowssystem32MSACM32.DLL" at address 0x72F70000 by thread 1.
 00:00:00.234: Loaded "c:windowssystem32AVICAP32.DLL" at address 0x69790000 by thread 1.
 00:00:00.234: Loaded "c:windowssystem32VERSION.DLL" at address 0x743B0000 by thread 1.
 00:00:00.234: Loaded "c:windowssystem32VCOMP120.DLL" at address 0x69770000 by thread 1.
 00:00:00.249: Loaded "d:	mpinplaininVISION_KEYDEFINITIONS_1_0.DLL" at address 0x69750000 by thread 1.
 00:00:00.249: Loaded "d:	mpinplaininOPENCV_IMGPROC248.DLL" at address 0x694E0000 by thread 1.
 00:00:00.249: Loaded "d:	mpinplaininVISION_RADIOMETRY_1_0.DLL" at address 0x69480000 by thread 1.
 00:00:00.249: Loaded "c:windowssystem32IPHLPAPI.DLL" at address 0x732B0000 by thread 1.
 00:00:00.265: Loaded "c:windowssystem32WINNSI.DLL" at address 0x73460000 by thread 1.
 00:00:00.265: Loaded "d:	mpinplaininVISION_IMGIO_1_0.DLL" at address 0x69420000 by thread 1.
 00:00:00.265: Thread 5 started in "d:	mpinplaininWDAPI1020.DLL" at address 0x10009168.
 00:00:00.265: Thread 6 started in "d:	mpinplaininWDAPI1020.DLL" at address 0x10009168.
 00:00:00.265: Thread 7 started in "d:	mpinplaininWDAPI1020.DLL" at address 0x10009168.
 00:00:00.280: Loaded "c:windowsmicrosoft.netframeworkv4.0.30319DIASYMREADER.DLL" at address 0x69370000 by thread 1.
 00:00:00.327: Loaded "c:windowssystem32CRYPTSP.DLL" at address 0x74AF0000 by thread 1.
 00:00:00.343: Loaded "c:windowssystem32RSAENH.DLL" at address 0x74890000 by thread 1.
 00:00:08.876: Thread 3 exited with code 0 (0x0).
 00:00:08.892: Thread 6 exited with code 0 (0x0).
 00:00:08.892: Thread 7 exited with code 0 (0x0).
 00:00:08.892: Thread 5 exited with code 0 (0x0).
 00:00:08.892: Thread 4 exited with code 0 (0x0).
 00:00:08.892: Thread 2 exited with code 0 (0x0).
 00:00:08.892: Exited "d:	mpinplaininPLAINCONSOLEAPPLICATION.EXE" (process 0x9F0) with code 0 (0x0) by thread 1.

当我实际开发的软件产品(x86、C# WinForms)使用包装器时,即使没有调试器,它也可以在 x64 上运行,但只能在我的开发 PC 上运行.

When the wrapper is used by the software product I am actually developing (x86, C# WinForms) it works on x64 even without debugger, but only on my development PC.

我忽略了什么?哪些工具可以帮助我?

What am I overlooking? Which tools might help me?

推荐答案

有点尴尬,但还是分享一下:

Am a little embarassed, but will share anyway:

我添加到这个现有项目的公司框架库使用 Jungo USB 驱动程序.由于未知原因,文件 wdapi1020.dll 被检入并复制到我的 bin 目录中.不幸的是,这是该文件的 x86 版本.当我最终确定必须删除它时,PlainConsoleApplication 使用了 SysWOW64 中的一个,一切顺利.现在我必须说服我们的管理员在 buildserver 上安装驱动程序或框架开发人员改变他们使用 Jungo 驱动程序的一些事情......它会保持有趣.

The company framework library which I added to this existing project uses Jungo USB Driver. For unknown reasons the file wdapi1020.dll was checked in and copied to my bin directory. Unfortunately it was the x86 version of the file. When I finally figured out that I have to remove it, the PlainConsoleApplication used the one from SysWOW64 and everything went well. Now I have to convince either our admins to install the driver on the buildserver or the framework developers to change something about their usage of Jungo driver .... it will remain interesting.

对于感兴趣的人,我是这样发现的:我拿了问题末尾提到的软件产品并安装了它(而不是从 bin 文件夹中复制它).当我将控制台应用程序放入它的文件夹时,它突然起作用了.我开始比较这些文件并发现实际上有一个太多了.删除它有我脸上的笑容.

For the ones interested, here's how I found out: I took the software product mentioned at the end of the question and installed it (instead of copying it from bin folder). When I put the console application into it's folder it suddenly worked. I started comparing the files and figured out that there is actually one too much. Removed it had a biiig smile on my face.

这篇关于除了在调试器中,x86 控制台应用程序不能在 64 位机器上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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