开发者

Tool for determining version of Win32 APIs used by C++ code?

开发者 https://www.devze.com 2023-03-18 13:38 出处:网络
I\'m modifying a large C++ project whose first release was Windows 7-only to work on Vista and XP. The main work will be to change the W7 API calls to use GetProcAddress at runtime (to avoid static

I'm modifying a large C++ project whose first release was Windows 7-only to work on Vista and XP.

The main work will be to change the W7 API calls to use GetProcAddress at runtime (to avoid static linking with methods that are not available on the other platforms), and so I'm wondering if there are any tools that can help identify which calls need to be changed -- hopefully by examining the C++ code itself.

Failing that, would it be best to try building the pr开发者_如何学编程oject against an older Windows SDK? -- for example: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=6510


#define WINVER 0x501

Now everything that is newer than Windows XP will cause a compilation error.

Replace everything that causes an error until none remain.

If you have some sed-fu, you can probably write a filter that directly finds all #if WINVER > 0x501 blocks in the windows headers, but for me, this is a bit out of my scope :-)


I would open your binaries using the depends.exe tool (either from your VS install or from here) under WinXP and Vista to see which functions can't be statically linked under these OSes. These would be the functions which your binary is using, but which are missing in older releases of the OS. You'll have to deal with them somehow: either implement them by yourself, replace them with something else or disable some of the functionality of your app.

0

精彩评论

暂无评论...
验证码 换一张
取 消