Skip to content

Commit

Permalink
Improve error messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinFinck committed May 25, 2021
1 parent c9819ad commit 8bec978
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/tool/monitoring.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,16 @@ HandleMonitorParameter(
&cbReturned,
NULL))
{
fprintf(stderr, "DeviceIoControl failed for PORTSNIFFER_IOCTL_CONTROL_RESET_PORT_MONITORING, last error is %lu.\n", GetLastError());
if (GetLastError() == ERROR_FILE_NOT_FOUND)
{
fprintf(stderr, "The PortSniffer Driver is not attached to %S!\n", pwszPort);
fprintf(stderr, "Please run this tool using the /attach option.\n");
}
else
{
fprintf(stderr, "DeviceIoControl failed for PORTSNIFFER_IOCTL_CONTROL_RESET_PORT_MONITORING, last error is %lu.\n", GetLastError());
}

goto Cleanup;
}

Expand Down Expand Up @@ -170,8 +179,9 @@ HandleMonitorParameter(
}
else if (GetLastError() == ERROR_FILE_NOT_FOUND)
{
fprintf(stderr, "The PortSniffer Driver is not attached to %S!\n", pwszPort);
fprintf(stderr, "The PortSniffer Driver is no longer attached to %S!\n", pwszPort);
fprintf(stderr, "Please run this tool using the /attach option.\n");
goto Cleanup;
}
else
{
Expand Down

0 comments on commit 8bec978

Please sign in to comment.