我正在研究在 Windows CE7 上对安全加密狗进行编程的可能性。生产加密狗的公司没有明确声明支持 Windows CE,但据其销售人员称,应该支持 Windows CE6。 加密狗使用导入库 (.lib),该库引用具有我想要使用的功能的 .dll。使用
dumpbin /headers
查看 .dll 的标头信息,我可以看到 .dll 是为 x86 (14c) 编译的,并且子系统是 Windows GUI
。作为参考,我在 Windows CE 设备上使用的 .dll 是针对 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,因此我对它们不是太熟悉。
我联系了供应商,看起来销售人员向我转发了错误的 DLL 集。他们实际上有一组为 Windows CE6 编译的 DLL。我测试了它,它似乎有效。 对于我的问题的直接回答,我基于 @Peter Cordes 的评论。您不能在 Windows CE 上使用 x86-DLL,因为 Windows CE 不理解 x86 机器代码。反之亦然。理论上,您可以实现某种执行转换的模拟层,但最简单的选择仍然是要求供应商针对 Windows CE 重新编译。