summaryrefslogtreecommitdiff
path: root/sal/systools/win32/uwinapi/ResolveThunk.cpp
blob: c26f68f8f4884c16ed189ff36583c4e75e331f8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "macros.h"


EXTERN_C void WINAPI ResolveThunk_WINDOWS( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName, FARPROC lpfnEmulate, FARPROC lpfnFailure )
{
    FARPROC	lpfnResult = (LONG)GetVersion() < 0 ? lpfnEmulate : GetProcAddress( LoadLibraryA( lpLibFileName ), lpFuncName );

    if ( !lpfnResult )
        lpfnResult = lpfnEmulate;

    if ( !lpfnResult )
        lpfnResult = lpfnFailure;

    *lppfn = lpfnResult;
}


EXTERN_C void WINAPI ResolveThunk_TRYLOAD( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName, FARPROC lpfnEmulate, FARPROC lpfnFailure )
{
    FARPROC	lpfnResult = GetProcAddress( LoadLibraryA( lpLibFileName ), lpFuncName );

    if ( !lpfnResult )
        lpfnResult = lpfnEmulate;

    if ( !lpfnResult )
        lpfnResult = lpfnFailure;

    *lppfn = lpfnResult;
}


EXTERN_C void WINAPI ResolveThunk_ALLWAYS( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName, FARPROC lpfnEmulate, FARPROC lpfnFailure )
{
    *lppfn = lpfnEmulate ? lpfnEmulate : lpfnFailure;
}