Is there a way to compare two .exes to see what di

2019-09-09 23:47发布

问题:

Is there a tool / process by which I can decompile two .exes (one of which runs on a handheld device, the other which doesn't) so that I can get a glimpse into what differs/what the problem may be?

Of course, seeing that one has "00xA" where the other has "00xB" won't help me. I mean a way to see code that differs, or more likely, a compiled resource or config file difference, or some build option or so?

I'm almost positive the problem has nothing to do with code per se (if/while/switch statements, etc.) but with the project setup.

I cannot compare the working source, as it does not exist - I only have the .exe from which it came. The source I have available is a "reasonable facsimile" of it, but not exactly the same, at least not in project settings and configurations, etc.

UPDATE

Re: this page, I'm not familiar with some of the terminology; specifically, where it talks about a "FLATRELEASEDIR" - WTH?

Will this work to test my CE-bound* .exe on my PC:

Run depends.exe*
Open my CE-bound** .exe
Stare in wonder at the amazing plethora of errata and data

?

*Supposedly not to be confused with "adult diapers"

** "bound" as in, "that's where it's headed"

UPDATE 2

Here's what I see when running Dependency Walker on my app:

...but note my dilemma here.

UPDATE 3

Here's what I did to try to replicate my handheld environment on my PC as best as possible:

I wanted to just copy over the whole dad-burned thing (the entire handheld device representation from Windows Explorer), but it won't let me do that - it's not copyable, so I copied over just the "Program Files" folder (which contains the subfolder of my app and a couple of other folders which I don't know are standard or custom/peculiar to us).

This is from the handheld device where the .exe in question does run properly, so obviously (theoretically?) there should be no missing modules - Dependency Walker should run it and say all is well.

However, it doesn't; I get the same results as the one p[a,o]sted above.

Note: This is true even after selecting "Options > Configure Module Search Order... > The Application Directory > Move Up in Dependency Walker.

So since even an .exe that runs fine tests out as being "not ready for CE-time", how can I use this to accurately test which, if any, necessary files are missing?

Do I need to copy over other folders, too, or what?

UPDATE 4

So, the (supposedly?) missing modules are:

API-MS-WIN-APPMODEL-RUNTIME-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
API-MS-WIN-SHCORE-SCALING-L1-1-1.DLL
DCOMP.DLL
GPSVC.DLL
IESHIMS.DLL

If true, then why does the .exe run on the handheld?

Note: Other folders on the handheld are:

Application Data => only contains "desktop.ini"
BTExplorer
My Documents => contains a "desktop.ini" and several SQLCE databases (*.SDF)
profiles => contains an empty "default" folder
Recycled => contains a single ".lnk" file
Temp => contains a handful of ".tmp" files
Windows => contains a slew of folders and files, including several .DLLs, but none of those listed above

The "Program Files" folder has a ".NET Compact Framework" subfolder, but it is empty.

In the \Windows\AppMgr folder, there are some interesting files, such as:

Microsoft .NET Compact Framework.DAT
Microsoft .NET Compact Framework.DLL
...several other DAT/DLL pairs, including:
Symbol Managed Class Libraries.DAT (no corresponding DLL)
...and even a pair:
SSCS HHS.[DAT,DLL]

-- which is our company acronym (SSCS) and name of the project (HHS)

What generates these? From where are they referenced??

Another possible piece of the puzzle is that the handheld device on which the .exe does not work does not have a \Windows\AppMgr folder, and thus does not have those .DAT/.DLL files listed above...

UPDATE 5

Another oddity:

After reading this: "Files that install in the GAC go in the\Windows directory" in the book "Microsoft .NET Compact Framework" by Andy Wiggly, et al, I tried copying the Windows folder from the handheld device to the spot on my PC below the folder named "3910ProgramFilesFolderCopy" which looks like this in Explorer:

C:
    3910ProgramFilesFolderCopy
        Program Files
        Windows <= tried to copy the "Windows" folder from the handeld on top of "3910ProgramFilesFolderCopy" so it would end up here

...but it only copies a few files before borborygmas occurs (electronic borborygmas, that is) and it tells me, "the system cannot find the file specified"

Heavens to Murgratroid!?! Why does it find some but not all? Looking at the Windows folder on the handheld in Windows Explorer, I see that many of the precious DLLs are greyed out:

Arggh, double-arg, and (&c)

回答1:

For PC you could try .NET Reflector.
http://www.red-gate.com/products/dotnet-development/reflector/



回答2:

You may try to use dependency walker to undestand wich DLL/APIs they need and check if those are supported on your device. http://geekswithblogs.net/WindowsEmbeddedCookbook/archive/2011/02/02/using-dependency-walker.aspx