c++windowskernel32

How to compile for multiple versions of windows where Kernel32 entry point may not exist for some functions


The title may not be the most descriptive at first:

I have a program that utilizes a call to "Wow64EnableWow64FsRedirection" function which is required when the software runs on a Windows 7 and Windows 10 64-bit platform.

However, the same application must also be able to run on a 32-bit Windows XP platform. The problem is, kernel32.dll for the Windows XP platform doesn't have the entry point for the Wow64 Redirect function and my application fails to execute at all.

Within the application, I have a check for the OS version and I handle the method calls separately based on the version; in other words, if the application is running on the 32-bit system I never attempt to call the WoW64 Redirect function.

I am unable to compile a platform-specific version for the 32-bit and 64-bit OSes.

Is there anything I can do to support the application on both platforms?


Solution

  • Try hModule = LoadLibrary("kernel32.dll") and func = GetProcAddress(hModule, "Wow64DisableWow64FsRedirection") if header file is not available for specific platforms.