在Windows CE上使用为X86编译的DLL是绝对不可能的吗



我正在研究在Windows CE7上编程安全加密狗的可能性。生产加密狗的公司没有明确表示支持Windows CE,但根据其销售人员的说法,应该支持Windows CE6。加密狗使用一个导入库(.lib(,该库引用了一个具有我想要使用的函数的.dll。通过查看带有dumpbin /headers的.dll的头信息,我可以看到.dll是为x86(14c(编译的,并且子系统是Windows GUI。作为参考,我在Windows CE设备上使用的.dlls是为Thumb(1c2,ARM afaik(编译的,并且具有子系统Windows CE GUI

以下是dumpbin命令的缩短输出。

Microsoft (R) COFF/PE Dumper Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

Dump of file <name removed>.dll
PE signature found
File Type: DLL
FILE HEADER VALUES
14C machine (x86)
5 number of sections
502875ED time date stamp Mon Aug 13 12:35:09 2012
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
210E characteristics
Executable
Line numbers stripped
Symbols stripped
32 bit word machine
DLL
OPTIONAL HEADER VALUES
10B magic # (PE32)
6.00 linker version
A000 size of code
C000 size of initialized data
0 size of uninitialized data
4EA2 entry point (10004EA2)
1000 base of code
B000 base of data
10000000 image base (10000000 to 10016FFF)
1000 section alignment
1000 file alignment
4.00 operating system version
0.00 image version
4.00 subsystem version
0 Win32 version
17000 size of image
1000 size of headers
1A38F checksum
2 subsystem (Windows GUI)
0 DLL characteristics
100000 size of stack reserve
1000 size of stack commit
100000 size of heap reserve
1000 size of heap commit
0 loader flags
10 number of directories
BED0 [      D9] RVA [size] of Export Directory
B770 [      50] RVA [size] of Import Directory
14000 [     7C8] RVA [size] of Resource Directory
0 [       0] RVA [size] of Exception Directory
12000 [    17D0] RVA [size] of Certificates Directory
15000 [     990] RVA [size] of Base Relocation Directory
0 [       0] RVA [size] of Debug Directory
0 [       0] RVA [size] of Architecture Directory
0 [       0] RVA [size] of Global Pointer Directory
0 [       0] RVA [size] of Thread Storage Directory
0 [       0] RVA [size] of Load Configuration Directory
0 [       0] RVA [size] of Bound Import Directory
B000 [     144] RVA [size] of Import Address Table Directory
0 [       0] RVA [size] of Delay Import Directory
0 [       0] RVA [size] of COM Descriptor Directory
0 [       0] RVA [size] of Reserved Directory

这是我第一次这样分析dll和lib,所以我对它们不太熟悉。

  1. 如果dll是为x86编译的,那么它只能在x86机器上使用,而不能在其他体系结构上使用。这确实有意义,但考虑到dll使用PE格式(可移植可执行文件(,不同的体系结构之间难道不应该至少有一些兼容性吗?也许我误解了";便携式;部分
  2. 如果以上观点成立,除了要求供应商为Windows CE重新编译dll之外,还有机会让dll在Windows CE上运行吗

我联系了供应商,看起来销售人员给我转发了一组错误的DLL。他们实际上有一组为WindowsCE6编译的DLL。我测试了一下,它似乎起作用了。对于我问题的直接答案,我是根据@Peter Cordes的评论得出的。您不能在Windows CE上使用x86 DLL,因为Windows CE不理解x86机器代码。反之亦然。理论上,您可以实现某种进行转换的模拟层,但最简单的选择仍然是要求供应商为Windows CE重新编译。

最新更新