Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find which Dlls contain specific W32 functions?

Tags:

c#

dll

winapi

My app is a WPF application and it already has code for the older type of System DPI awareness that works well in every version of windows except 8.1. It turns out that Microsoft added a number of functions to Windows 8.1 as part of their implementation of per-monitor DPI awareness. I need to implement code in my program to support this type of DPI awareness.

I have documentation that lists the per-monitor DPI awareness functions and what their parameters are. I need to import those into C# and call them from my window class. But I don't know which DLLs contain those functions! The documentation for the GetProcessDpiAwareness function, for example, does not indicate which DLL it's in.

How do I find what the exports in the DLLs are?

like image 312
Tony Vitabile Avatar asked Feb 04 '14 23:02

Tony Vitabile


1 Answers

Right out of head, a dumb method: a binary search in C:\Windows\System32 for GetProcessDpiAwareness, then studying each occurrence with Dependency Walker for exports.

This produces the result: GetProcessDpiAwareness is exported by SHCore.dll.

One may also search the Windows SDK headers and libs, but in my case I haven't found GetProcessDpiAwareness, to my surprise.

Another idea, run the following from the command line prompt:

for %f in (%windir%\system32\*.dll) do dumpbin.exe /exports %f >>%temp%\__exports

Then search %temp%\__exports for the API.

like image 144
noseratio Avatar answered Oct 02 '22 22:10

noseratio