Skip to content

Commit

Permalink
Improved the PacketIsMonitorModeSupported() function to return more d…
Browse files Browse the repository at this point in the history
…etailed errors.
  • Loading branch information
hsluoyz committed May 25, 2016
1 parent 515f5b4 commit bf5f79b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Common/Packet32.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ extern "C"
BOOLEAN PacketGetNetType(LPADAPTER AdapterObject, NetType* type);
BOOLEAN PacketGetNetType2(PCHAR AdapterName, NetType *type);
BOOLEAN PacketIsLoopbackAdapter(LPADAPTER AdapterObject);
BOOLEAN PacketIsMonitorModeSupported(PCHAR AdapterName);
int PacketIsMonitorModeSupported(PCHAR AdapterName);
int PacketSetMonitorMode(PCHAR AdapterName, int mode);
int PacketGetMonitorMode(PCHAR AdapterName);
LPADAPTER PacketOpenAdapter(PCHAR AdapterName);
Expand Down
10 changes: 5 additions & 5 deletions packetWin7/Dll/Packet32.c
Original file line number Diff line number Diff line change
Expand Up @@ -4707,9 +4707,9 @@ BOOLEAN PacketIsLoopbackAdapter(LPADAPTER AdapterObject)
/*!
\brief Returns whether a wireless adapter supports monitor mode.
\param AdapterObject The adapter on which information is needed.
\return TRUE if yes, FALSE if no.
\return 1 if yes, 0 if no, -1 if the function fails.
*/
BOOLEAN PacketIsMonitorModeSupported(PCHAR AdapterName)
int PacketIsMonitorModeSupported(PCHAR AdapterName)
{
BOOLEAN Status;
NetType Type;
Expand All @@ -4719,17 +4719,17 @@ BOOLEAN PacketIsMonitorModeSupported(PCHAR AdapterName)
if (PacketGetNetType2(AdapterName, &Type) == FALSE)
{
TRACE_PRINT("PacketIsMonitorModeSupported failed, PacketGetNetType error");
Status = FALSE;
Status = -1;
}
else
{
if (Type.LinkType == NdisMediumBare80211 || Type.LinkType == NdisMediumRadio80211)
{
Status = TRUE;
Status = 1;
}
else
{
Status = FALSE;
Status = 0;
}
}

Expand Down
2 changes: 1 addition & 1 deletion wpcap/libpcap/pcap-win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ pcap_activate_win32(pcap_t *p)
static int
pcap_can_set_rfmon_win32(pcap_t *p)
{
return PacketIsMonitorModeSupported(p->opt.source);
return (PacketIsMonitorModeSupported(p->opt.source) == 1);
}

pcap_t *
Expand Down

0 comments on commit bf5f79b

Please sign in to comment.