1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-18 20:29:02 +00:00

Add mutex protection to a couple more WinPcap calls

This commit is contained in:
dmiller
2015-11-10 16:47:33 +00:00
parent b595a28ecb
commit 857a62ba8f
2 changed files with 16 additions and 0 deletions

View File

@@ -278,11 +278,19 @@ void win_init()
__try
#endif
{
HANDLE pcapMutex;
DWORD wait;
ULONG len = sizeof(pcaplist);
o.have_pcap = true;
if(o.debugging > 2) printf("Trying to initialize WinPcap\n");
pcapMutex = CreateMutex(NULL, 0, "Global\\DnetPcapHangAvoidanceMutex");
wait = WaitForSingleObject(pcapMutex, INFINITE);
PacketGetAdapterNames(pcaplist, &len);
if (wait == WAIT_ABANDONED || wait == WAIT_OBJECT_0) {
ReleaseMutex(pcapMutex);
}
CloseHandle(pcapMutex);
#ifdef _MSC_VER
if(FAILED(__HrLoadAllImportsForDll("wpcap.dll")))

View File

@@ -278,10 +278,18 @@ void win_init()
__try
#endif
{
HANDLE pcapMutex;
DWORD wait;
ULONG len = sizeof(pcaplist);
if(o.getDebugging() >= DBG_2) printf("Trying to initialize WinPcap\n");
pcapMutex = CreateMutex(NULL, 0, "Global\\DnetPcapHangAvoidanceMutex");
wait = WaitForSingleObject(pcapMutex, INFINITE);
PacketGetAdapterNames(pcaplist, &len);
if (wait == WAIT_ABANDONED || wait == WAIT_OBJECT_0) {
ReleaseMutex(pcapMutex);
}
CloseHandle(pcapMutex);
#ifdef _MSC_VER
if(FAILED(__HrLoadAllImportsForDll("wpcap.dll")))