Author: cgutman
Date: Thu Jun 18 06:24:19 2009
New Revision: 41443
URL:
http://svn.reactos.org/svn/reactos?rev=41443&view=rev
Log:
- Make NdisGeneratePartialCancelId safe by using Interlocked functions
Modified:
trunk/reactos/drivers/network/ndis/ndis/main.c
trunk/reactos/drivers/network/ndis/ndis/misc.c
Modified: trunk/reactos/drivers/network/ndis/ndis/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/main.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/main.c [iso-8859-1] Thu Jun 18 06:24:19 2009
@@ -20,6 +20,8 @@
ULONG DebugTraceLevel = MIN_TRACE;
#endif /* DBG */
+
+UCHAR CancelId;
VOID NTAPI MainUnload(
@@ -60,6 +62,8 @@
KeInitializeSpinLock(&AdapterListLock);
DriverObject->DriverUnload = MainUnload;
+
+ CancelId = 0;
return STATUS_SUCCESS;
}
Modified: trunk/reactos/drivers/network/ndis/ndis/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/misc.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/misc.c [iso-8859-1] Thu Jun 18 06:24:19 2009
@@ -5,6 +5,8 @@
*/
#include "ndissys.h"
+
+extern UCHAR CancelId;
/*
* @implemented
@@ -518,13 +520,13 @@
EXPORT
NdisGeneratePartialCancelId(VOID)
{
- static UCHAR CancelId = 0;
-
- CancelId++;
-
- NDIS_DbgPrint(MAX_TRACE, ("Cancel ID %u\n", CancelId));
-
- return CancelId;
+ UCHAR PartialCancelId;
+
+ PartialCancelId = InterlockedIncrement((PLONG)&CancelId);
+
+ NDIS_DbgPrint(MAX_TRACE, ("Cancel ID %u\n", PartialCancelId));
+
+ return PartialCancelId;
}
/* EOF */