mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
pcap: don't crash on exit when wpcap.dll is unloaded before pcap_close is called. (nw)
i386: fix bug (nw)
This commit is contained in:
parent
b3e608e957
commit
7175f0ae1b
@ -586,7 +586,7 @@ INLINE int translate_address(i386_state *cpustate, int pl, int type, UINT32 *add
|
||||
return TRUE;
|
||||
|
||||
const vtlb_entry *table = vtlb_table(cpustate->vtlb);
|
||||
int index = *address >> 12;
|
||||
UINT32 index = *address >> 12;
|
||||
vtlb_entry entry = table[index];
|
||||
if(type == TRANSLATE_FETCH)
|
||||
type = TRANSLATE_READ;
|
||||
|
@ -229,7 +229,7 @@ void vtlb_load(vtlb_state *vtlb, int entrynum, int numpages, offs_t address, vtl
|
||||
vtlb_dynload - load a dynamic VTLB entry
|
||||
-------------------------------------------------*/
|
||||
|
||||
void vtlb_dynload(vtlb_state *vtlb, int index, offs_t address, vtlb_entry value)
|
||||
void vtlb_dynload(vtlb_state *vtlb, UINT32 index, offs_t address, vtlb_entry value)
|
||||
{
|
||||
vtlb_entry entry = vtlb->table[index];
|
||||
|
||||
|
@ -70,7 +70,7 @@ int vtlb_fill(vtlb_state *vtlb, offs_t address, int intention);
|
||||
void vtlb_load(vtlb_state *vtlb, int entrynum, int numpages, offs_t address, vtlb_entry value);
|
||||
|
||||
/* load a dynamic VTLB entry */
|
||||
void vtlb_dynload(vtlb_state *vtlb, int index, offs_t address, vtlb_entry value);
|
||||
void vtlb_dynload(vtlb_state *vtlb, UINT32 index, offs_t address, vtlb_entry value);
|
||||
|
||||
/* ----- flushing ----- */
|
||||
|
||||
|
@ -10,6 +10,7 @@ static void (*pcap_close_dl)(pcap_t *) = NULL;
|
||||
static int (*pcap_setfilter_dl)(pcap_t *, struct bpf_program *) = NULL;
|
||||
static int (*pcap_sendpacket_dl)(pcap_t *, u_char *, int) = NULL;
|
||||
static int (*pcap_set_datalink_dl)(pcap_t *, int) = NULL;
|
||||
static HMODULE handle = NULL;
|
||||
|
||||
#include "emu.h"
|
||||
#include "osdnet.h"
|
||||
@ -73,7 +74,7 @@ int netdev_pcap::recv_dev(UINT8 **buf)
|
||||
|
||||
netdev_pcap::~netdev_pcap()
|
||||
{
|
||||
if(m_p) pcap_close_dl(m_p);
|
||||
if(m_p && handle) pcap_close_dl(m_p);
|
||||
}
|
||||
|
||||
static CREATE_NETDEV(create_pcap)
|
||||
@ -82,8 +83,6 @@ static CREATE_NETDEV(create_pcap)
|
||||
return dynamic_cast<netdev *>(dev);
|
||||
}
|
||||
|
||||
static HMODULE handle = NULL;
|
||||
|
||||
void init_pcap()
|
||||
{
|
||||
pcap_if_t *devs;
|
||||
@ -134,4 +133,5 @@ void deinit_pcap()
|
||||
{
|
||||
clear_netdev();
|
||||
FreeLibrary(handle);
|
||||
handle = NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user