mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 00:05:44 +00:00
- Make NdisGeneratePartialCancelId safe by using Interlocked functions
svn path=/trunk/; revision=41443
This commit is contained in:
parent
f6a788b116
commit
e2662e4df0
2 changed files with 10 additions and 4 deletions
|
@ -21,6 +21,8 @@ ULONG DebugTraceLevel = MIN_TRACE;
|
||||||
|
|
||||||
#endif /* DBG */
|
#endif /* DBG */
|
||||||
|
|
||||||
|
UCHAR CancelId;
|
||||||
|
|
||||||
|
|
||||||
VOID NTAPI MainUnload(
|
VOID NTAPI MainUnload(
|
||||||
PDRIVER_OBJECT DriverObject)
|
PDRIVER_OBJECT DriverObject)
|
||||||
|
@ -61,6 +63,8 @@ DriverEntry(
|
||||||
|
|
||||||
DriverObject->DriverUnload = MainUnload;
|
DriverObject->DriverUnload = MainUnload;
|
||||||
|
|
||||||
|
CancelId = 0;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include "ndissys.h"
|
#include "ndissys.h"
|
||||||
|
|
||||||
|
extern UCHAR CancelId;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
@ -518,13 +520,13 @@ UCHAR
|
||||||
EXPORT
|
EXPORT
|
||||||
NdisGeneratePartialCancelId(VOID)
|
NdisGeneratePartialCancelId(VOID)
|
||||||
{
|
{
|
||||||
static UCHAR CancelId = 0;
|
UCHAR PartialCancelId;
|
||||||
|
|
||||||
CancelId++;
|
PartialCancelId = InterlockedIncrement((PLONG)&CancelId);
|
||||||
|
|
||||||
NDIS_DbgPrint(MAX_TRACE, ("Cancel ID %u\n", CancelId));
|
NDIS_DbgPrint(MAX_TRACE, ("Cancel ID %u\n", PartialCancelId));
|
||||||
|
|
||||||
return CancelId;
|
return PartialCancelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue