- Implement NdisCopyBuffer and NdisGetCurrentProcessorCpuUsage

- Patch by Dmitry Chapyshev

svn path=/trunk/; revision=40777
This commit is contained in:
Cameron Gutman 2009-05-03 14:38:13 +00:00
parent 1d7714cac8
commit d3452a30c0
4 changed files with 65 additions and 46 deletions

View file

@ -511,10 +511,15 @@ typedef struct _NDIS40_MINIPORT_CHARACTERISTICS {
VOID VOID
NTAPI NTAPI
ExGetCurrentProcessorCounts( ExGetCurrentProcessorCounts(
PULONG ThreadKernelTime, PULONG ThreadKernelTime,
PULONG TotalCpuTime, PULONG TotalCpuTime,
PULONG ProcessorNumber); PULONG ProcessorNumber);
VOID
NTAPI
ExGetCurrentProcessorCpuUsage(
PULONG CpuUsage);
#endif /* __NDISSYS_H */ #endif /* __NDISSYS_H */
/* EOF */ /* EOF */

View file

@ -551,48 +551,3 @@ NdisMDeregisterIoPortRange(
{ {
UNIMPLEMENTED 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
}

View file

@ -1111,4 +1111,47 @@ NdisUnchainBufferAtFront(
*Buffer = NdisBuffer; *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 */ /* EOF */

View file

@ -402,4 +402,20 @@ NdisScheduleWorkItem(
return NDIS_STATUS_SUCCESS; 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 */ /* EOF */