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>
#define HAVE_STDARG_H
#include <86box/86box.h>
#include <86box/plat.h>
#include <86box/plat_dynld.h>
@@ -52,9 +53,11 @@ dynld_module(const char *name, dllimp_t *table)
HMODULE h;
dllimp_t *imp;
void *func;
WCHAR uname[512];
/* 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());
return(NULL);
}

View File

@@ -23,11 +23,14 @@
#include <windows.h>
#define HAVE_STDARG_H
#include <86box/86box.h>
#include <86box/plat.h>
#include <86box/plat_dynld.h>
#ifdef ENABLE_DYNLD_LOG
int dynld_do_log = ENABLE_DYNLD_LOG;
static void
dynld_log(const char *fmt, ...)
{
@@ -43,15 +46,18 @@ dynld_log(const char *fmt, ...)
#define dynld_log(fmt, ...)
#endif
void *
dynld_module(const char *name, dllimp_t *table)
{
HMODULE h;
dllimp_t *imp;
void *func;
WCHAR uname[512];
/* 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());
return(NULL);
}
@@ -75,6 +81,7 @@ dynld_module(const char *name, dllimp_t *table)
return((void *)h);
}
void
dynld_close(void *handle)
{