mirror of
https://github.com/nmap/nmap.git
synced 2026-05-13 08:46:45 +00:00
Add mutex protection to a couple more WinPcap calls
This commit is contained in:
parent
b595a28ecb
commit
857a62ba8f
2 changed files with 16 additions and 0 deletions
|
|
@ -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")))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue