Updates for dynamic loading of DLLs, some cleanups.
This commit is contained in:
@@ -1004,6 +1004,7 @@ BEGIN
|
||||
2199 "USB is not yet supported"
|
||||
2200 "Invalid PCap device"
|
||||
2201 "English (United States)"
|
||||
2202 "Pcap Library Not Available"
|
||||
END
|
||||
|
||||
|
||||
|
||||
30
src/WIN/plat_dynld.h
Normal file
30
src/WIN/plat_dynld.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Define the Dynamic Module Loader interface.
|
||||
*
|
||||
* Version: @(#)plat_dynld.h 1.0.1 2017/05/21
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Copyright 2017 Fred N. van Kempen
|
||||
*/
|
||||
#ifndef PLAT_DYNLD_H
|
||||
# define PLAT_DYNLD_H
|
||||
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
void *func;
|
||||
} dllimp_t;
|
||||
|
||||
|
||||
extern void *dynld_module(const char *, dllimp_t *);
|
||||
extern void dynld_close(void *);
|
||||
|
||||
|
||||
#endif /*PLAT_DYNLD_H*/
|
||||
@@ -1,53 +1,72 @@
|
||||
/*
|
||||
* This should be named 'plat.h' and then include any
|
||||
* Windows-specific header files needed, to keep them
|
||||
* out of the main code.
|
||||
*/
|
||||
/* Copyright holders: Sarah Walker
|
||||
see COPYING for more details
|
||||
*/
|
||||
extern HINSTANCE hinstance;
|
||||
extern HWND ghwnd;
|
||||
extern int mousecapture;
|
||||
#ifndef BOX_WIN_H
|
||||
# define BOX_WIN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#if 0
|
||||
# define UNICODE
|
||||
# define BITMAP WINDOWS_BITMAP
|
||||
# include <windows.h>
|
||||
# undef BITMAP
|
||||
#endif
|
||||
|
||||
|
||||
#define szClassName L"86BoxMainWnd"
|
||||
#define szSubClassName L"86BoxSubWnd"
|
||||
#define szStatusBarClassName L"86BoxStatusBar"
|
||||
|
||||
void leave_fullscreen();
|
||||
|
||||
extern HINSTANCE hinstance;
|
||||
extern HWND ghwnd;
|
||||
extern HWND status_hwnd;
|
||||
extern HWND hwndStatus;
|
||||
extern int status_is_open;
|
||||
extern int mousecapture;
|
||||
|
||||
extern char openfilestring[260];
|
||||
extern WCHAR wopenfilestring[260];
|
||||
|
||||
extern int pause;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void leave_fullscreen(void);
|
||||
|
||||
extern void status_open(HWND hwnd);
|
||||
|
||||
extern void deviceconfig_open(HWND hwnd, struct device_t *device);
|
||||
extern void joystickconfig_open(HWND hwnd, int joy_nr, int type);
|
||||
|
||||
extern int getfile(HWND hwnd, char *f, char *fn);
|
||||
extern int getsfile(HWND hwnd, char *f, char *fn);
|
||||
|
||||
extern void get_executable_name(WCHAR *s, int size);
|
||||
extern void set_window_title(WCHAR *s);
|
||||
|
||||
extern void startblit(void);
|
||||
extern void endblit(void);
|
||||
|
||||
extern void win_settings_open(HWND hwnd);
|
||||
extern void win_menu_update();
|
||||
|
||||
extern void update_status_bar_panes(HWND hwnds);
|
||||
|
||||
extern int fdd_type_to_icon(int type);
|
||||
|
||||
extern void hard_disk_add_open(HWND hwnd, int is_existing);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void status_open(HWND hwnd);
|
||||
extern HWND status_hwnd;
|
||||
extern int status_is_open;
|
||||
|
||||
void deviceconfig_open(HWND hwnd, struct device_t *device);
|
||||
void joystickconfig_open(HWND hwnd, int joy_nr, int type);
|
||||
|
||||
extern char openfilestring[260];
|
||||
extern WCHAR wopenfilestring[260];
|
||||
|
||||
int getfile(HWND hwnd, char *f, char *fn);
|
||||
int getsfile(HWND hwnd, char *f, char *fn);
|
||||
|
||||
void get_executable_name(WCHAR *s, int size);
|
||||
void set_window_title(WCHAR *s);
|
||||
|
||||
void startblit();
|
||||
void endblit();
|
||||
|
||||
extern int pause;
|
||||
|
||||
void win_settings_open(HWND hwnd);
|
||||
void win_menu_update();
|
||||
|
||||
void update_status_bar_panes(HWND hwnds);
|
||||
|
||||
int fdd_type_to_icon(int type);
|
||||
|
||||
extern HWND hwndStatus;
|
||||
|
||||
void hard_disk_add_open(HWND hwnd, int is_existing);
|
||||
#endif /*BOX_WIN_H*/
|
||||
|
||||
64
src/WIN/win_dynld.c
Normal file
64
src/WIN/win_dynld.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Try to load a support DLL.
|
||||
*
|
||||
* Version: @(#)win_dynld.c 1.0.1 2017/05/21
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Copyright 2017 Fred N. van Kempen
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <pcap.h>
|
||||
#include "plat_dynld.h"
|
||||
#include "../ibm.h"
|
||||
|
||||
|
||||
void *
|
||||
dynld_module(const char *name, dllimp_t *table)
|
||||
{
|
||||
HANDLE h;
|
||||
dllimp_t *imp;
|
||||
void *func;
|
||||
char **foo;
|
||||
|
||||
/* See if we can load the desired module. */
|
||||
if ((h = LoadLibrary(name)) == NULL) {
|
||||
pclog("DynLd(\"%s\"): library not found!\n", name);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* Now load the desired function pointers. */
|
||||
for (imp=table; imp->name!=NULL; imp++) {
|
||||
func = GetProcAddress(h, imp->name);
|
||||
if (func == NULL) {
|
||||
pclog("DynLd(\"%s\"): function '%s' not found!\n",
|
||||
name, imp->name);
|
||||
CloseHandle(h);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* To overcome typing issues.. */
|
||||
*(char **)imp->func = (char *)func;
|
||||
}
|
||||
|
||||
/* All good. */
|
||||
return((void *)h);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dynld_close(void *handle)
|
||||
{
|
||||
if (handle != NULL)
|
||||
CloseHandle((HANDLE *)handle);
|
||||
}
|
||||
@@ -21,7 +21,7 @@ LCID dwLanguage;
|
||||
|
||||
uint32_t dwLangID, dwSubLangID;
|
||||
|
||||
#define STRINGS_NUM 154
|
||||
#define STRINGS_NUM 155 /* FIXME: should be in resource.h !! --FvK */
|
||||
|
||||
WCHAR lpResourceString[STRINGS_NUM][512];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user