View Single Post
  #4  
Old 10-02-2006, 19:14
MarkusO
 
Posts: n/a
The way Microsoft describes the problem is quite complex and I don't see how to use the document to import by ordinals (since "IsOS" is not exported by name, only by ordinal). I only know a far more simple way.

Create a *.DEF file with the following content:
Code:
IMPORTS
  IsOS = SHLWAPI.437
Declare the "IsOS" function as external. Then pass the *.DEF file to your linker and use the "import by ordinal" option (every linker has it, not only the Borland linker). The problem is that the Microsoft linker says that "IMPORTS" is not supported on Win32, which makes it quite useless here (but it works with Win16 ordinals).

This will then import all functions by name, expect the one you called "IsOS", which is imported by ordinal. If you don't use the "import by ordinal" switch, your program will try to load "IsOS" from SHLWAPI.DLL and (of course) fail.

If you have to use the Microsoft linker for some reason, you should simply create yourself a program which parses your import table and replaces a given imported name with it's ordinal. Of course this will require manual input if the function isn't exported by name at all.
Reply With Quote