Author: cgutman
Date: Sun May 3 18:38:13 2009
New Revision: 40777
URL:
http://svn.reactos.org/svn/reactos?rev=40777&view=rev
Log:
- Implement NdisCopyBuffer and NdisGetCurrentProcessorCpuUsage
- Patch by Dmitry Chapyshev
Modified:
trunk/reactos/drivers/network/ndis/include/ndissys.h
trunk/reactos/drivers/network/ndis/ndis/50stubs.c
trunk/reactos/drivers/network/ndis/ndis/buffer.c
trunk/reactos/drivers/network/ndis/ndis/misc.c
Modified: trunk/reactos/drivers/network/ndis/include/ndissys.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/inclu…
==============================================================================
--- trunk/reactos/drivers/network/ndis/include/ndissys.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/include/ndissys.h [iso-8859-1] Sun May 3 18:38:13
2009
@@ -511,10 +511,15 @@
VOID
NTAPI
ExGetCurrentProcessorCounts(
- PULONG ThreadKernelTime,
+ PULONG ThreadKernelTime,
PULONG TotalCpuTime,
PULONG ProcessorNumber);
+VOID
+NTAPI
+ExGetCurrentProcessorCpuUsage(
+ PULONG CpuUsage);
+
#endif /* __NDISSYS_H */
/* EOF */
Modified: trunk/reactos/drivers/network/ndis/ndis/50stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/50stubs.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/50stubs.c [iso-8859-1] Sun May 3 18:38:13
2009
@@ -551,48 +551,3 @@
{
UNIMPLEMENTED
}
-
-/*
- * @unimplemented
- */
-VOID
-EXPORT
-NdisCopyBuffer(
- OUT PNDIS_STATUS Status,
- OUT PNDIS_BUFFER *Buffer,
- IN NDIS_HANDLE PoolHandle,
- IN PVOID MemoryDescriptor,
- IN UINT Offset,
- IN UINT Length)
-/*
- * FUNCTION: Returns a new buffer descriptor for a (partial) buffer
- * ARGUMENTS:
- * Status = Address of a buffer to place status of operation
- * Buffer = Address of a buffer to place new buffer descriptor
- * PoolHandle = Handle returned by NdisAllocateBufferPool
- * MemoryDescriptor = Pointer to a memory descriptor (possibly NDIS_BUFFER)
- * Offset = Offset in buffer to start copying
- * Length = Number of bytes to copy
- */
-{
- UNIMPLEMENTED
-
- *Status = NDIS_STATUS_FAILURE;
-}
-
-
-/*
- * @unimplemented
- */
-VOID
-EXPORT
-NdisGetCurrentProcessorCpuUsage(
- PULONG pCpuUsage)
-/*
- * FUNCTION: Returns how busy the current processor is as a percentage
- * ARGUMENTS:
- * pCpuUsage = Pointer to a buffer to place CPU usage
- */
-{
- UNIMPLEMENTED
-}
Modified: trunk/reactos/drivers/network/ndis/ndis/buffer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/buffer.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/buffer.c [iso-8859-1] Sun May 3 18:38:13
2009
@@ -1111,4 +1111,47 @@
*Buffer = NdisBuffer;
}
+/*
+ * @implemented
+ */
+VOID
+EXPORT
+NdisCopyBuffer(
+ OUT PNDIS_STATUS Status,
+ OUT PNDIS_BUFFER *Buffer,
+ IN NDIS_HANDLE PoolHandle,
+ IN PVOID MemoryDescriptor,
+ IN UINT Offset,
+ IN UINT Length)
+/*
+ * FUNCTION: Returns a new buffer descriptor for a (partial) buffer
+ * ARGUMENTS:
+ * Status = Address of a buffer to place status of operation
+ * Buffer = Address of a buffer to place new buffer descriptor
+ * PoolHandle = Handle returned by NdisAllocateBufferPool
+ * MemoryDescriptor = Pointer to a memory descriptor (possibly NDIS_BUFFER)
+ * Offset = Offset in buffer to start copying
+ * Length = Number of bytes to copy
+ */
+{
+ PVOID CurrentVa = (PUCHAR)(MmGetMdlVirtualAddress((PNDIS_BUFFER)MemoryDescriptor)) +
Offset;
+
+ NDIS_DbgPrint(MAX_TRACE, ("Called\n"));
+
+ *Buffer = IoAllocateMdl(CurrentVa, Length, FALSE, FALSE, NULL);
+ if (!*Buffer)
+ {
+ *Status = NDIS_STATUS_FAILURE;
+ return;
+ }
+
+ IoBuildPartialMdl((PNDIS_BUFFER)MemoryDescriptor,
+ *Buffer,
+ CurrentVa,
+ Length);
+
+ (*Buffer)->Next = NULL;
+ *Status = NDIS_STATUS_SUCCESS;
+}
+
/* EOF */
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] Sun May 3 18:38:13 2009
@@ -402,4 +402,20 @@
return NDIS_STATUS_SUCCESS;
}
+/*
+ * @implemented
+ */
+VOID
+EXPORT
+NdisGetCurrentProcessorCpuUsage(
+ PULONG pCpuUsage)
+/*
+ * FUNCTION: Returns how busy the current processor is as a percentage
+ * ARGUMENTS:
+ * pCpuUsage = Pointer to a buffer to place CPU usage
+ */
+{
+ ExGetCurrentProcessorCpuUsage(pCpuUsage);
+}
+
/* EOF */