Using RAD Studio 10.2.3, I have suddenly started getting and error when loading 5 of the FireDAC-related packages at IDE startup, and when loading a project:
%1 is not a valid Win32 application
I know that this error means that some package that these failing packages depend on is having the 64-bit version being found before the 32-bit version, and that usually this means that the PATH environment variable has gotten screwed up so that the 64-bit path is before the 32-bit path.
I've made sure that the PATH is set up correctly. I then wrote a program to recursively walk the list of dependencies in a package and each of those sub-dependencies to find and validate those all necessary packages for 32-bit-ness and path, and have confirmed that for each failing package, all dependencies exist on the right paths and are 32-bit. But I still get the errors.
Am I missing something here? Is there a better way to sniff out this kind of error?
Turns out that
LoadLibrary()fails in the same way thatLoadPackage()does, which was hiding the error from me in my search program. The solution to that problem is to read the imports list directly from the file rather than usingLoadLibrary()andGetPackageInfo(). Doing this required me to get a lot more familiar with the PE file structure than I was before. Here's code to get the imports list from a BPL directly rather than throughLoadLibrary():