Fixes to both versions of win_dynld.c.

This commit is contained in:
OBattler
2022-11-02 06:28:27 +01:00
parent e2391ca6ef
commit 4fb3228628
2 changed files with 32 additions and 22 deletions

View File

@@ -23,6 +23,7 @@
#include <windows.h> #include <windows.h>
#define HAVE_STDARG_H #define HAVE_STDARG_H
#include <86box/86box.h> #include <86box/86box.h>
#include <86box/plat.h>
#include <86box/plat_dynld.h> #include <86box/plat_dynld.h>
@@ -52,9 +53,11 @@ dynld_module(const char *name, dllimp_t *table)
HMODULE h; HMODULE h;
dllimp_t *imp; dllimp_t *imp;
void *func; void *func;
WCHAR uname[512];
/* See if we can load the desired module. */ /* See if we can load the desired module. */
if ((h = LoadLibrary(name)) == NULL) { mbstoc16s(uname, name, strlen(name) + 1);
if ((h = LoadLibrary(uname)) == NULL) {
dynld_log("DynLd(\"%s\"): library not found! (%08X)\n", name, GetLastError()); dynld_log("DynLd(\"%s\"): library not found! (%08X)\n", name, GetLastError());
return(NULL); return(NULL);
} }

View File

@@ -23,11 +23,14 @@
#include <windows.h> #include <windows.h>
#define HAVE_STDARG_H #define HAVE_STDARG_H
#include <86box/86box.h> #include <86box/86box.h>
#include <86box/plat.h>
#include <86box/plat_dynld.h> #include <86box/plat_dynld.h>
#ifdef ENABLE_DYNLD_LOG #ifdef ENABLE_DYNLD_LOG
int dynld_do_log = ENABLE_DYNLD_LOG; int dynld_do_log = ENABLE_DYNLD_LOG;
static void static void
dynld_log(const char *fmt, ...) dynld_log(const char *fmt, ...)
{ {
@@ -43,15 +46,18 @@ dynld_log(const char *fmt, ...)
#define dynld_log(fmt, ...) #define dynld_log(fmt, ...)
#endif #endif
void * void *
dynld_module(const char *name, dllimp_t *table) dynld_module(const char *name, dllimp_t *table)
{ {
HMODULE h; HMODULE h;
dllimp_t *imp; dllimp_t *imp;
void *func; void *func;
WCHAR uname[512];
/* See if we can load the desired module. */ /* See if we can load the desired module. */
if ((h = LoadLibrary(name)) == NULL) { mbstoc16s(uname, name, strlen(name) + 1);
if ((h = LoadLibrary(uname)) == NULL) {
dynld_log("DynLd(\"%s\"): library not found! (%08X)\n", name, GetLastError()); dynld_log("DynLd(\"%s\"): library not found! (%08X)\n", name, GetLastError());
return(NULL); return(NULL);
} }
@@ -75,6 +81,7 @@ dynld_module(const char *name, dllimp_t *table)
return((void *)h); return((void *)h);
} }
void void
dynld_close(void *handle) dynld_close(void *handle)
{ {