Using the linkage system it's not the only way of calling an FS function. Once you find the correct prototype, you simply declare a "pointer to function " variable, assign its address with GetProcAddress(), and you call the routine normally.
assuming you found in the module "XXX.DLL", the function with ordinal 10 takes two doubles in input and returns an int, with the "standard" calling conventio, the prototype will be, in your .H
Code:
typedef int (__stdcall *MyNewfoundFunctionFunc) ( const double, const double );
in your .CPP file, you declare and init a variable of this new type:
Code:
MyNewfoundFunctionFunc MyNewfoundFunction = 0;
at start of your program, you do something like this:
Code:
HMODULE hMod = GetModuleHandleA( "XXX.DLL" );
if( hMod )
{
MyNewfoundFunction = (MyNewfoundFunctionFunc)GetProcAddress(hMod, MAKEINTRESOURCEA( 10 ) ); // assuming the ordinal it's 10, for example
}
from now on, in your program, you can call the function as if it were a regular function according to its prototype, like this:
Code:
int result = MyNewfoundFunction( 3.0, 4.3 );
Of course, to figure out the parameters types, a disassember AND some asm knowledge it's helpful, and of course the use of a debugger with breakpoints. Also, using the wrong calling convention, as well the wrong parameter types, will usually make FS crash, so yes, some care is needed.
Usually, it's much easier to figure out parameters if the function name is "decorated", you'll recognize the names with those funny "@!""3213£@##!" characters appended. In that case, the parameters are encoded in the name itself, so a good disassembler should be able to decode them and give you some basic prototype (of course, no disassembler will be able to tell you what the parameters DO, even if they are correct and not crashing FS, their actual meaning can't be figure out without following the actual assembler code to see what they are really doing ).
Yes, it's a long a tedious work, not really my idea of having fun. I think we should lobby Microsoft into convincing them to extend Simconnect to officially support these kind of things as well...