Skip to content

Commit

Permalink
Rolled back the change of "Now Packet.dll tries to open the WiFi vers…
Browse files Browse the repository at this point in the history
…ion adapters too". (nmap@0956bf8)
  • Loading branch information
hsluoyz committed Oct 7, 2016
1 parent b17530f commit 6131ceb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 29 deletions.
1 change: 0 additions & 1 deletion Common/WpcapNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@

// Used in packetWin7\Dll
#define NPF_DRIVER_COMPLETE_DEVICE_PREFIX "\\Device\\" NPF_DEVICE_NAMES_PREFIX ///< (III) packet.dll
#define NPF_DRIVER_COMPLETE_DEVICE_PREFIX_WIFI NPF_DRIVER_COMPLETE_DEVICE_PREFIX "WIFI_" ///< (III) packet.dll
// Used in packetWin7\Dll
#define NPF_DRIVER_COMPLETE_PATH "system32\\drivers\\" NPF_DRIVER_NAME ".sys" ///< (LLL) packet.dll

Expand Down
31 changes: 3 additions & 28 deletions packetWin7/Dll/AdInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ BOOLEAN IsFireWire(TCHAR *AdapterDesc)
\return If the function succeeds, the return value is TRUE.
\note we suppose that we are called after having acquired the g_AdaptersInfoMutex mutex
*/
static BOOLEAN PacketAddAdapterIPH(PIP_ADAPTER_INFO IphAd, BOOLEAN bDot11)
static BOOLEAN PacketAddAdapterIPH(PIP_ADAPTER_INFO IphAd)
{
PADAPTER_INFO TmpAdInfo, SAdInfo;
PIP_ADDR_STRING TmpAddrStr;
Expand All @@ -824,7 +824,6 @@ static BOOLEAN PacketAddAdapterIPH(PIP_ADAPTER_INFO IphAd, BOOLEAN bDot11)
// UINT RegQueryLen;
// CHAR npfCompleteDriverPrefix[MAX_WINPCAP_KEY_CHARS];
CHAR npfCompleteDriverPrefix[MAX_WINPCAP_KEY_CHARS] = NPF_DRIVER_COMPLETE_DEVICE_PREFIX;
CHAR npfCompleteDriverPrefix_WiFi[MAX_WINPCAP_KEY_CHARS] = NPF_DRIVER_COMPLETE_DEVICE_PREFIX_WIFI;

TRACE_ENTER();

Expand All @@ -849,7 +848,7 @@ static BOOLEAN PacketAddAdapterIPH(PIP_ADAPTER_INFO IphAd, BOOLEAN bDot11)
StringCchPrintfA(TName,
256,
"%s%s",
bDot11 ? npfCompleteDriverPrefix_WiFi : npfCompleteDriverPrefix,
npfCompleteDriverPrefix,
IphAd->AdapterName);

// Scan the adapters list to see if this one is already present
Expand Down Expand Up @@ -1041,8 +1040,7 @@ static BOOLEAN PacketGetAdaptersIPH()
// structure for every new adapter and put it in our global list
for(TmpAd = AdList; TmpAd != NULL; TmpAd = TmpAd->Next)
{
PacketAddAdapterIPH(TmpAd, FALSE);
PacketAddAdapterIPH(TmpAd, TRUE);
PacketAddAdapterIPH(TmpAd);
}

GlobalFreePtr(AdList);
Expand Down Expand Up @@ -1319,7 +1317,6 @@ static BOOLEAN PacketGetAdaptersNPF()
// UINT RegQueryLen;

CHAR npfCompleteDriverPrefix[MAX_WINPCAP_KEY_CHARS] = NPF_DRIVER_COMPLETE_DEVICE_PREFIX;
CHAR npfCompleteDriverPrefix_WiFi[MAX_WINPCAP_KEY_CHARS] = NPF_DRIVER_COMPLETE_DEVICE_PREFIX_WIFI;
CHAR DeviceGuidName[256];

TRACE_ENTER();
Expand Down Expand Up @@ -1431,20 +1428,6 @@ static BOOLEAN PacketGetAdaptersNPF()
// If the adapter is valid, add it to the list.
PacketAddAdapterNPF(TAName, FireWireFlag);



// Put the \Device\NPF_WIFI_ string at the beginning of the name
StringCchPrintfA(TAName, sizeof(TAName), "%s%s",
npfCompleteDriverPrefix_WiFi,
DeviceGuidName + strlen("\\Device\\"));

//terminate the string, just in case
TAName[sizeof(TAName) - 1] = '\0';

TRACE_PRINT2("%d) Successfully retrieved info for adapter %hs, trying to add it to the global list...", i, TAName);
// If the adapter is valid, add it to the list.
PacketAddAdapterNPF(TAName, FireWireFlag);

RegCloseKey(OneAdapKey);
RegCloseKey(LinkageKey);

Expand Down Expand Up @@ -1512,14 +1495,6 @@ static BOOLEAN PacketGetAdaptersNPF()
// If the adapter is valid, add it to the list.
PacketAddAdapterNPF(TAName, 0);


StringCchPrintfA(TAName, sizeof(TAName), "%s%s",
npfCompleteDriverPrefix_WiFi,
TcpBindingsMultiString + i + strlen("\\Device\\"));
TRACE_PRINT1("Successfully retrieved info for adapter %hs, trying to add it to the global list...", TAName);
// If the adapter is valid, add it to the list.
PacketAddAdapterNPF(TAName, 0);

//
// TODO GV: this cast to avoid a compilation warning is
// actually stupid. We should check not to go over the buffer boundary!
Expand Down

0 comments on commit 6131ceb

Please sign in to comment.