consistently use TEXT() macro with LoadLibrary() and GetModuleHandle()

cf. bug #5435.
main
Ozkan Sezer 2021-01-04 01:23:50 +03:00
parent 91a831e2d0
commit 01a2f27679
12 changed files with 15 additions and 15 deletions

View File

@ -251,7 +251,7 @@ WASAPI_PlatformInit(void)
return WIN_SetErrorFromHRESULT("WASAPI CoCreateInstance(MMDeviceEnumerator)", ret);
}
libavrt = LoadLibraryW(L"avrt.dll"); /* this library is available in Vista and later. No WinXP, so have to LoadLibrary to use it for now! */
libavrt = LoadLibrary(TEXT("avrt.dll")); /* this library is available in Vista and later. No WinXP, so have to LoadLibrary to use it for now! */
if (libavrt) {
pAvSetMmThreadCharacteristicsW = (pfnAvSetMmThreadCharacteristicsW) GetProcAddress(libavrt, "AvSetMmThreadCharacteristicsW");
pAvRevertMmThreadCharacteristics = (pfnAvRevertMmThreadCharacteristics) GetProcAddress(libavrt, "AvRevertMmThreadCharacteristics");

View File

@ -48,7 +48,7 @@ WIN_LoadHIDDLL(void)
return 0; /* already loaded */
}
s_pHIDDLL = LoadLibrary(L"hid.dll");
s_pHIDDLL = LoadLibrary(TEXT("hid.dll"));
if (!s_pHIDDLL) {
return -1;
}

View File

@ -86,17 +86,17 @@ WIN_LoadXInputDLL(void)
* limitations of that API (no devices at startup, no background input, etc.)
*/
version = (1 << 16) | 4;
s_pXInputDLL = LoadLibrary(L"XInput1_4.dll"); /* 1.4 Ships with Windows 8. */
s_pXInputDLL = LoadLibrary(TEXT("XInput1_4.dll")); /* 1.4 Ships with Windows 8. */
if (!s_pXInputDLL) {
version = (1 << 16) | 3;
s_pXInputDLL = LoadLibrary(L"XInput1_3.dll"); /* 1.3 can be installed as a redistributable component. */
s_pXInputDLL = LoadLibrary(TEXT("XInput1_3.dll")); /* 1.3 can be installed as a redistributable component. */
}
if (!s_pXInputDLL) {
s_pXInputDLL = LoadLibrary(L"bin\\XInput1_3.dll");
s_pXInputDLL = LoadLibrary(TEXT("bin\\XInput1_3.dll"));
}
if (!s_pXInputDLL) {
/* "9.1.0" Ships with Vista and Win7, and is more limited than 1.3+ (e.g. XInputGetStateEx is not available.) */
s_pXInputDLL = LoadLibrary(L"XInput9_1_0.dll");
s_pXInputDLL = LoadLibrary(TEXT("XInput9_1_0.dll"));
}
if (!s_pXInputDLL) {
return -1;

View File

@ -39,7 +39,7 @@ SDL_GetBasePath(void)
GetModuleFileNameExW_t pGetModuleFileNameExW;
DWORD buflen = 128;
WCHAR *path = NULL;
HANDLE psapi = LoadLibrary(L"psapi.dll");
HANDLE psapi = LoadLibrary(TEXT("psapi.dll"));
char *retval = NULL;
DWORD len = 0;
int i;

View File

@ -242,7 +242,7 @@ static void register_error(hid_device *device, const char *op)
#ifndef HIDAPI_USE_DDK
static int lookup_functions()
{
lib_handle = LoadLibraryA("hid.dll");
lib_handle = LoadLibrary(TEXT("hid.dll"));
if (lib_handle) {
#define RESOLVE(x) x = (x##_)GetProcAddress(lib_handle, #x); if (!x) return -1;
RESOLVE(HidD_GetAttributes);

View File

@ -100,7 +100,7 @@ void
SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
{
if (!kernel32) {
kernel32 = GetModuleHandleW(L"kernel32.dll");
kernel32 = GetModuleHandle(TEXT("kernel32.dll"));
if (kernel32) {
pGetUserPreferredUILanguages = (pfnGetUserPreferredUILanguages) GetProcAddress(kernel32, "GetUserPreferredUILanguages");
}

View File

@ -215,7 +215,7 @@ SDL_CreateCond(void)
/* Link statically on this platform */
impl = &SDL_cond_impl_srw;
#else
HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
HMODULE kernel32 = GetModuleHandle(TEXT("kernel32.dll"));
if (kernel32) {
pWakeConditionVariable = (pfnWakeConditionVariable) GetProcAddress(kernel32, "WakeConditionVariable");
pWakeAllConditionVariable = (pfnWakeAllConditionVariable) GetProcAddress(kernel32, "WakeAllConditionVariable");

View File

@ -275,7 +275,7 @@ SDL_CreateMutex(void)
impl = &SDL_mutex_impl_srw;
#else
/* Try faster implementation for Windows 7 and newer */
HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
HMODULE kernel32 = GetModuleHandle(TEXT("kernel32.dll"));
if (kernel32) {
/* Requires Vista: */
pReleaseSRWLockExclusive = (pfnReleaseSRWLockExclusive) GetProcAddress(kernel32, "ReleaseSRWLockExclusive");

View File

@ -415,7 +415,7 @@ SDL_CreateSemaphore(Uint32 initial_value)
* Microsoft our specific use case is legal and correct:
* https://github.com/microsoft/STL/pull/593#issuecomment-655799859
*/
HMODULE synch120 = GetModuleHandleW(L"api-ms-win-core-synch-l1-2-0.dll");
HMODULE synch120 = GetModuleHandle(TEXT("api-ms-win-core-synch-l1-2-0.dll"));
if (synch120) {
/* Try to load required functions provided by Win 8 or newer */
pWaitOnAddress = (pfnWaitOnAddress) GetProcAddress(synch120, "WaitOnAddress");

View File

@ -163,7 +163,7 @@ SDL_SYS_SetupThread(const char *name)
static HMODULE kernel32 = 0;
if (!kernel32) {
kernel32 = GetModuleHandleW(L"kernel32.dll");
kernel32 = GetModuleHandle(TEXT("kernel32.dll"));
if (kernel32) {
pSetThreadDescription = (pfnSetThreadDescription) GetProcAddress(kernel32, "SetThreadDescription");
}

View File

@ -1250,7 +1250,7 @@ struct SDL_WIN_OSVERSIONINFOW {
static SDL_bool
IsWin10FCUorNewer(void)
{
HMODULE handle = GetModuleHandleW(L"ntdll.dll");
HMODULE handle = GetModuleHandle(TEXT("ntdll.dll"));
if (handle) {
typedef LONG(WINAPI* RtlGetVersionPtr)(struct SDL_WIN_OSVERSIONINFOW*);
RtlGetVersionPtr getVersionPtr = (RtlGetVersionPtr)GetProcAddress(handle, "RtlGetVersion");

View File

@ -798,7 +798,7 @@ WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
}
/* If we cannot load comctl32.dll use the old messagebox! */
hComctl32 = LoadLibrary(TEXT("Comctl32.dll"));
hComctl32 = LoadLibrary(TEXT("comctl32.dll"));
if (hComctl32 == NULL) {
return WIN_ShowOldMessageBox(messageboxdata, buttonid);
}