Home | History | Annotate | Download | only in include
      1 /**
      2  * This file is part of the mingw-w64 runtime package.
      3  * No warranty is given; refer to the file DISCLAIMER within this package.
      4  */
      5 #ifndef _APISETLIBLOADER_
      6 #define _APISETLIBLOADER_
      7 
      8 #include <apiset.h>
      9 #include <apisetcconv.h>
     10 #include <minwindef.h>
     11 #include <minwinbase.h>
     12 
     13 #ifdef __cplusplus
     14 extern "C" {
     15 #endif
     16 
     17 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
     18   typedef struct tagENUMUILANG {
     19     ULONG NumOfEnumUILang;
     20     ULONG SizeOfEnumUIBuffer;
     21     LANGID *pEnumUIBuffer;
     22   } ENUMUILANG, *PENUMUILANG;
     23 
     24 #ifdef STRICT
     25   typedef WINBOOL (CALLBACK *ENUMRESLANGPROCA) (HMODULE hModule, LPCSTR lpType, LPCSTR lpName, WORD wLanguage, LONG_PTR lParam);
     26   typedef WINBOOL (CALLBACK *ENUMRESLANGPROCW) (HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, WORD wLanguage, LONG_PTR lParam);
     27   typedef WINBOOL (CALLBACK *ENUMRESNAMEPROCA) (HMODULE hModule, LPCSTR lpType, LPSTR lpName, LONG_PTR lParam);
     28   typedef WINBOOL (CALLBACK *ENUMRESNAMEPROCW) (HMODULE hModule, LPCWSTR lpType, LPWSTR lpName, LONG_PTR lParam);
     29   typedef WINBOOL (CALLBACK *ENUMRESTYPEPROCA) (HMODULE hModule, LPSTR lpType, LONG_PTR lParam);
     30   typedef WINBOOL (CALLBACK *ENUMRESTYPEPROCW) (HMODULE hModule, LPWSTR lpType, LONG_PTR lParam);
     31 #else
     32   typedef FARPROC ENUMRESTYPEPROCA;
     33   typedef FARPROC ENUMRESTYPEPROCW;
     34   typedef FARPROC ENUMRESNAMEPROCA;
     35   typedef FARPROC ENUMRESNAMEPROCW;
     36   typedef FARPROC ENUMRESLANGPROCA;
     37   typedef FARPROC ENUMRESLANGPROCW;
     38 #endif
     39 
     40 #ifndef RC_INVOKED
     41   typedef WINBOOL (WINAPI *PGET_MODULE_HANDLE_EXA) (DWORD dwFlags, LPCSTR lpModuleName, HMODULE *phModule);
     42   typedef WINBOOL (WINAPI *PGET_MODULE_HANDLE_EXW) (DWORD dwFlags, LPCWSTR lpModuleName, HMODULE *phModule);
     43 #endif
     44 
     45   typedef PVOID DLL_DIRECTORY_COOKIE, *PDLL_DIRECTORY_COOKIE;
     46 
     47 #define FIND_RESOURCE_DIRECTORY_TYPES (0x0100)
     48 #define FIND_RESOURCE_DIRECTORY_NAMES (0x0200)
     49 #define FIND_RESOURCE_DIRECTORY_LANGUAGES (0x0400)
     50 
     51 #define RESOURCE_ENUM_LN (0x0001)
     52 #define RESOURCE_ENUM_MUI (0x0002)
     53 #define RESOURCE_ENUM_MUI_SYSTEM (0x0004)
     54 #define RESOURCE_ENUM_VALIDATE (0x0008)
     55 #define RESOURCE_ENUM_MODULE_EXACT (0x0010)
     56 
     57 #define SUPPORT_LANG_NUMBER 32
     58 
     59 #define DONT_RESOLVE_DLL_REFERENCES 0x1
     60 #define LOAD_LIBRARY_AS_DATAFILE 0x2
     61 #define LOAD_WITH_ALTERED_SEARCH_PATH 0x8
     62 #define LOAD_IGNORE_CODE_AUTHZ_LEVEL 0x10
     63 #define LOAD_LIBRARY_AS_IMAGE_RESOURCE 0x20
     64 #define LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE 0x40
     65 #define LOAD_LIBRARY_REQUIRE_SIGNED_TARGET 0x80
     66 #define LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR 0x100
     67 #define LOAD_LIBRARY_SEARCH_APPLICATION_DIR 0x200
     68 #define LOAD_LIBRARY_SEARCH_USER_DIRS 0x400
     69 #define LOAD_LIBRARY_SEARCH_SYSTEM32 0x800
     70 #define LOAD_LIBRARY_SEARCH_DEFAULT_DIRS 0x1000
     71 
     72 #define GET_MODULE_HANDLE_EX_FLAG_PIN (0x1)
     73 #define GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT (0x2)
     74 #define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS (0x4)
     75 
     76 #define ENUMRESLANGPROC __MINGW_NAME_AW(ENUMRESLANGPROC)
     77 #define ENUMRESNAMEPROC __MINGW_NAME_AW(ENUMRESNAMEPROC)
     78 #define ENUMRESTYPEPROC __MINGW_NAME_AW(ENUMRESTYPEPROC)
     79 
     80   WINBASEAPI HRSRC WINAPI FindResourceExW (HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, WORD wLanguage);
     81   WINBASEAPI DECLSPEC_NORETURN VOID WINAPI FreeLibraryAndExitThread (HMODULE hLibModule, DWORD dwExitCode);
     82   WINBASEAPI WINBOOL WINAPI FreeResource (HGLOBAL hResData);
     83   WINBASEAPI DWORD WINAPI GetModuleFileNameA (HMODULE hModule, LPSTR lpFilename, DWORD nSize);
     84   WINBASEAPI DWORD WINAPI GetModuleFileNameW (HMODULE hModule, LPWSTR lpFilename, DWORD nSize);
     85   WINBASEAPI HMODULE WINAPI GetModuleHandleA (LPCSTR lpModuleName);
     86   WINBASEAPI HMODULE WINAPI GetModuleHandleW (LPCWSTR lpModuleName);
     87   WINBASEAPI HMODULE WINAPI LoadLibraryExA (LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
     88   WINBASEAPI HMODULE WINAPI LoadLibraryExW (LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
     89   WINBASEAPI HGLOBAL WINAPI LoadResource (HMODULE hModule, HRSRC hResInfo);
     90   WINUSERAPI int WINAPI LoadStringA (HINSTANCE hInstance, UINT uID, LPSTR lpBuffer, int cchBufferMax);
     91   WINUSERAPI int WINAPI LoadStringW (HINSTANCE hInstance, UINT uID, LPWSTR lpBuffer, int cchBufferMax);
     92   WINBASEAPI LPVOID WINAPI LockResource (HGLOBAL hResData);
     93   WINBASEAPI DWORD WINAPI SizeofResource (HMODULE hModule, HRSRC hResInfo);
     94   WINBASEAPI DLL_DIRECTORY_COOKIE WINAPI AddDllDirectory (PCWSTR NewDirectory);
     95   WINBASEAPI WINBOOL WINAPI RemoveDllDirectory (DLL_DIRECTORY_COOKIE Cookie);
     96   WINBASEAPI WINBOOL WINAPI SetDefaultDllDirectories (DWORD DirectoryFlags);
     97   WINBASEAPI WINBOOL WINAPI GetModuleHandleExA (DWORD dwFlags, LPCSTR lpModuleName, HMODULE *phModule);
     98   WINBASEAPI WINBOOL WINAPI GetModuleHandleExW (DWORD dwFlags, LPCWSTR lpModuleName, HMODULE *phModule);
     99 
    100 #define PGET_MODULE_HANDLE_EX __MINGW_NAME_AW(PGET_MODULE_HANDLE_EX)
    101 #define GetModuleHandleEx __MINGW_NAME_AW(GetModuleHandleEx)
    102 
    103 #ifdef UNICODE
    104 #define FindResourceEx FindResourceExW
    105 #endif
    106 
    107 #define LoadString __MINGW_NAME_AW(LoadString)
    108 #define GetModuleFileName __MINGW_NAME_AW(GetModuleFileName)
    109 #define GetModuleHandle __MINGW_NAME_AW(GetModuleHandle)
    110 #define LoadLibraryEx __MINGW_NAME_AW(LoadLibraryEx)
    111 
    112 #define EnumResourceLanguages __MINGW_NAME_AW(EnumResourceLanguages)
    113   WINBASEAPI WINBOOL WINAPI EnumResourceLanguagesA(HMODULE hModule,LPCSTR lpType,LPCSTR lpName,ENUMRESLANGPROCA lpEnumFunc,LONG_PTR lParam);
    114   WINBASEAPI WINBOOL WINAPI EnumResourceLanguagesW(HMODULE hModule,LPCWSTR lpType,LPCWSTR lpName,ENUMRESLANGPROCW lpEnumFunc,LONG_PTR lParam);
    115 
    116 
    117 #if _WIN32_WINNT >= 0x0600
    118   WINBASEAPI WINBOOL APIENTRY EnumResourceLanguagesExA (HMODULE hModule, LPCSTR lpType, LPCSTR lpName, ENUMRESLANGPROCA lpEnumFunc, LONG_PTR lParam, DWORD dwFlags, LANGID LangId);
    119   WINBASEAPI WINBOOL APIENTRY EnumResourceLanguagesExW (HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, ENUMRESLANGPROCW lpEnumFunc, LONG_PTR lParam, DWORD dwFlags, LANGID LangId);
    120   WINBASEAPI WINBOOL WINAPI EnumResourceNamesExA (HMODULE hModule, LPCSTR lpType, ENUMRESNAMEPROCA lpEnumFunc, LONG_PTR lParam, DWORD dwFlags, LANGID LangId);
    121   WINBASEAPI WINBOOL WINAPI EnumResourceNamesExW (HMODULE hModule, LPCWSTR lpType, ENUMRESNAMEPROCW lpEnumFunc, LONG_PTR lParam, DWORD dwFlags, LANGID LangId);
    122   WINBASEAPI WINBOOL WINAPI EnumResourceTypesExA (HMODULE hModule, ENUMRESTYPEPROCA lpEnumFunc, LONG_PTR lParam, DWORD dwFlags, LANGID LangId);
    123   WINBASEAPI WINBOOL WINAPI EnumResourceTypesExW (HMODULE hModule, ENUMRESTYPEPROCW lpEnumFunc, LONG_PTR lParam, DWORD dwFlags, LANGID LangId);
    124   WINBASEAPI WINBOOL WINAPI QueryOptionalDelayLoadedAPI (HMODULE CallerModule, LPCSTR lpDllName, LPCSTR lpProcName, DWORD Reserved);
    125 
    126 #define EnumResourceLanguagesEx __MINGW_NAME_AW(EnumResourceLanguagesEx)
    127 #define EnumResourceNamesEx __MINGW_NAME_AW(EnumResourceNamesEx)
    128 #define EnumResourceTypesEx __MINGW_NAME_AW(EnumResourceTypesEx)
    129 #endif
    130 #endif
    131 
    132 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
    133   WINBASEAPI WINBOOL WINAPI DisableThreadLibraryCalls (HMODULE hLibModule);
    134   WINBASEAPI WINBOOL WINAPI FreeLibrary (HMODULE hLibModule);
    135   WINBASEAPI FARPROC WINAPI GetProcAddress (HMODULE hModule, LPCSTR lpProcName);
    136 #if WINVER >= 0x0601
    137   WINBASEAPI int WINAPI FindStringOrdinal (DWORD dwFindStringOrdinalFlags, LPCWSTR lpStringSource, int cchSource, LPCWSTR lpStringValue, int cchValue, WINBOOL bIgnoreCase);
    138 #endif
    139 #endif
    140 
    141 #ifdef __cplusplus
    142 }
    143 #endif
    144 #endif
    145