Skip to content

Commit

Permalink
Do not assert timing intervals that API does not guarantee
Browse files Browse the repository at this point in the history
  • Loading branch information
dmiller-nmap committed Mar 29, 2023
1 parent d20cd9b commit 7e6fa86
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packetWin7/npf/npf/Write.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,8 @@ NTSTATUS NPF_BufferedWrite(
// Explicit cast ok since condition above ensures this will be at most 1000000us.
i = (UINT)(((TargetTicks.QuadPart - CurTicks.QuadPart) * 1000000) / TimeFreq.QuadPart);
NT_ASSERT(i < 1000000);
// These are the NDIS-recommended routines for delaying execution.
// Note that both can fire up to 1 system clock tick (e.g. 15ms) later than requested.
if (i >= 50)
{
NdisMSleep(i);
Expand All @@ -774,12 +776,6 @@ NTSTATUS NPF_BufferedWrite(
{
NdisStallExecution(i);
}
#if DBG
// We want to be as accurate as possible.
// In debug mode, treat an error of more than 1ms as a catastrophic failure.
CurTicks = KeQueryPerformanceCounter(NULL);
NT_ASSERT(CurTicks.QuadPart - TargetTicks.QuadPart < TimeFreq.QuadPart / 1000);
#endif
}
}
}
Expand Down

0 comments on commit 7e6fa86

Please sign in to comment.