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:
@@ -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")))
|
||||
|
||||
@@ -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")))
|
||||
|
||||
Reference in New Issue
Block a user