thz
thz

Reputation: 217

Is it absolutely impossible to use DLLs compiled for X86 on Windows CE?

I am researching the possibility to program a security dongle on Windows CE7. The company producing the dongle doesn't explicitly state that Windows CE is supported but according to their sales person Windows CE6 should be supported. The dongle uses an import library (.lib) which references a .dll that has the functions I want to use. Looking at the header information of the .dll with dumpbin /headers I can see that the .dll was compiled for x86 (14c) and that the subsystem is Windows GUI. For reference, the .dlls I use on the Windows CE device are compiled for Thumb (1c2, ARM afaik) and have subsystem Windows CE GUI.

Here is a shortened output of the dumpbin command.

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

This is the first time for me analysing dlls and libs like this, hence I am not familiar with them too much.

  1. If a dll was compiled for x86, then it can be only used on x86 machines, and no other architectures. This does make sense, but given that a dll is using the PE format (PORTABLE executable) shouldn't there be at least some compatibility between the different architectures? Maybe I'm misunderstanding the "portable" part of it.
  2. If above point holds true, is there any chance of getting the dll to run on Windows CE besides asking the vendor to recompile the dll for Windows CE?

Upvotes: 0

Views: 306

Answers (1)

thz
thz

Reputation: 217

I contacted the vendor and it looks like the sales person forwarded me the wrong set of DLLs. They actually had a set of DLLs compiled for Windows CE6. I tested it and it seems to be working. For the direct answer to my question, I'm basing it off of @Peter Cordes' comment. You can't use a x86-DLL on Windows CE since Windows CE doesn't understand x86-machine code. Same for the other way around. You could theoretically implement some kind of emulation layer that does the translation, but the easiest option is still asking the vendor to recompile for Windows CE.

Upvotes: 0

Related Questions