简体   繁体   中英

How to determine if the application is an MFC program?

I have a compiled GUI application. I need to learn whether it is programmed using MFC libraries. Depends.exe does not return any dependency to MFC42*.dll. Is there any tool to get additional information about executables? (If possible not just the libraries, but the compiler being used, etc..)

还要注意,MFC应用程序可能已经静态链接到MFC库,而不是使用共享库-静态链接的MFC应用程序不会将MFCXXX.dll的依赖关系显示为Depends中的直接依赖关系。

If the application you are concerned with was dynamically linked to MFC it will have a dependancy on MFCXX.dll where XX is the version number. For instance, our application is dependant on MFC80.dll.

However, if the application was statically linked, all the source for MFC will be compiled straight into the app.

If you can run the application, get it running and then use the Sysinternals tool ProcessExplorer to view the loaded DLL's.

Or do you need a programatic way of determining if the app is using MFC? Also, I'm a bit suprised that Depends is not showing what you expect. Compare the Depends output with ProcessExplorer and see what you can learn.

您可能会检查可执行文件中是否有任何标准MFC资源

dumpbin is the tool you want, if it's statically linked. MFC symbols tend to be named '...Afx...' or '...MFC...', so if you see those, it's probably using MFC. This utility can also tell you the linker version, OS it's compiled for, etc.

If the applicartion is written using MFC it will generally be made up of windows that have class names that are prefixed with the Afx: string.

And if you have access to the Spy++ utility it is very easy to query the class names details of any executable.

You could try running the dumpbin utility on the file (part of the SDK or a VS install).

If you run "dumpbin /exports" you could look for any telltale MFC-isms. I'm not sure if there would be any though, so the test would only confirm MFC is statically linked, not refute it.

Babak Farrokhi once wrote a very handy little program named "Language 2000" that scans exes looking for libraries and frameworks binary signatures. It used to detect statically linked MFC programs two fingers up the nose. The program was already old when I used it a few years ago though. You'd have to check the web is a newer version is available or if the signature still work. Who knows!

SysInternals (recently purchased by Microsoft) published depends. Regardless of whether it's dynamically linking to DLLs or statically linked, you'll see the import/export symbols referenced (might be mangled for C++ entry point signatures).

This tool is also extremely beneficial for detecting circular references (using dependency tree). And in those rare instances when you're absolutely certain you exported the entry point but the linker still fails, you can examine the DLL for the "missing" entry point.

Also aids in discovering hidden secrets of a DLL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM