Search code examples
winapifileapiloadlibrary

How can I use LoadLibrary to get the address of a function defined in fileapi.h?


I want to know the name of the DLL/LIB in which functions declared in fileapi.h are kept.

So that I can use LoadLibrary(dllname) (if it is inside DLL).


Solution

  • The fileapi.h header documentation lists the functions, and their individual documentations all say the same thing - the functions are implemented in kernel32.dll. Which you don't need to use LoadLibrary() for, you can use GetModuleHandle() instead, since kernel32.dll is loaded by default in all processes.

    To get the address of a function in a loaded DLL module, you need to use GetProcAddress(), giving it an HMODULE from LoadLibrary/Ex() or GetModuleHandle().