Use LoadLibraryW ()

This commit is contained in:
Luca Bacci 2022-12-30 13:32:10 +01:00 committed by Jehan
parent c98ffb7e0e
commit f7be0cf68e
8 changed files with 20 additions and 8 deletions

View File

@ -285,7 +285,7 @@ gimp_backtrace_start (void)
HMODULE hModule;
DWORD options;
hModule = LoadLibraryA ("mgwhelp.dll");
hModule = LoadLibraryW (L"mgwhelp.dll");
#define INIT_PROC(name) \
G_STMT_START \

View File

@ -216,7 +216,7 @@ gimp_input_device_store_init (GimpInputDeviceStore *store)
return;
}
if ((dinput8 = LoadLibrary ("dinput8.dll")) == NULL)
if ((dinput8 = LoadLibraryW (L"dinput8.dll")) == NULL)
{
g_set_error_literal (&store->error, GIMP_MODULE_ERROR, GIMP_MODULE_FAILED,
"Could not load dinput8.dll");

View File

@ -61,7 +61,7 @@ LoadRequiredDwmFunctions (void)
{
if (dwmApi) return TRUE;
dwmApi = LoadLibrary ("dwmapi");
dwmApi = LoadLibraryW (L"dwmapi");
if (! dwmApi) return FALSE;
DwmGetWindowAttribute = (DWMGETWINDOWATTRIBUTE) GetProcAddress (dwmApi, "DwmGetWindowAttribute");

View File

@ -112,7 +112,7 @@ BOOL LoadMagnificationLibrary(void)
{
if (magnificationLibrary) return TRUE;
magnificationLibrary = LoadLibrary("Magnification");
magnificationLibrary = LoadLibraryW(L"Magnification");
if (!magnificationLibrary) return FALSE;
MagInitialize = (MAGINITIALIZE)GetProcAddress(magnificationLibrary,"MagInitialize");

View File

@ -1207,7 +1207,7 @@ BOOL
InitInstance (HINSTANCE hInstance,
int nCmdShow)
{
HINSTANCE User32Library = LoadLibrary ("user32.dll");
HINSTANCE User32Library = LoadLibraryW (L"user32.dll");
if (User32Library)
{

View File

@ -9,6 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <glib/glib.h>
#ifndef MAXPATHLEN
# define MAXPATHLEN 1024
#endif
@ -44,8 +46,17 @@ typedef void (*FARPROC)();
}
static HMODULE dl_attach(const char *module) {
HMODULE dll = LoadLibrary(module);
if (!dll) display_w32_error_msg(module);
wchar_t *module_utf16 = g_utf8_to_utf16 (module, -1, NULL, NULL, NULL);
HMODULE dll = NULL;
if (!module_utf16)
return NULL;
dll = LoadLibraryW (module_utf16);
if (!dll)
display_w32_error_msg (module);
free (module_utf16);
return dll;
}

View File

@ -25,6 +25,7 @@
#include "twain.h"
/* The DLL to be loaded for TWAIN support */
#define TWAIN_DLL_NAME_W L"TWAIN_32.DLL"
#define TWAIN_DLL_NAME "TWAIN_32.DLL"
#define DEBUG_LOGFILE "c:\\twain.log"
#define DUMP_FILE "C:\\TWAINCAP.BIN"

View File

@ -92,7 +92,7 @@ twainIsAvailable(void)
}
/* Attempt to load the library */
hDLL = LoadLibrary(TWAIN_DLL_NAME);
hDLL = LoadLibraryW (TWAIN_DLL_NAME_W);
if (hDLL == NULL)
return FALSE;