Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2 KiB

  1. #include "wdmmem.h"
  2. #pragma PAGEDCODE
  3. CMemory* CWDMMemory::create(VOID)
  4. { return new (NonPagedPool) CWDMMemory; }
  5. #pragma PAGEDCODE
  6. VOID* CWDMMemory::allocate(IN POOL_TYPE PoolType,IN SIZE_T NumberOfBytes)
  7. {
  8. if(!NumberOfBytes) return NULL;
  9. //return ::ExAllocatePool(PoolType,NumberOfBytes);
  10. return ::ExAllocatePoolWithTag(PoolType,NumberOfBytes,'_GRU');
  11. }
  12. #pragma PAGEDCODE
  13. VOID CWDMMemory::zero(IN PVOID pMem,IN SIZE_T size)
  14. {
  15. ::RtlZeroMemory(pMem,size);
  16. }
  17. #pragma PAGEDCODE
  18. VOID CWDMMemory::free(IN PVOID pMem)
  19. {
  20. ::ExFreePool((PVOID)pMem);
  21. }
  22. #pragma PAGEDCODE
  23. VOID CWDMMemory::copy(IN VOID UNALIGNED *Destination,IN CONST VOID UNALIGNED *Source, IN SIZE_T Length)
  24. {
  25. ::RtlCopyMemory(Destination,Source,Length);
  26. }
  27. #pragma PAGEDCODE
  28. PVOID CWDMMemory::mapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress,IN SIZE_T NumberOfBytes,IN MEMORY_CACHING_TYPE CacheType)
  29. {
  30. return ::MmMapIoSpace(PhysicalAddress,NumberOfBytes,CacheType);
  31. }
  32. #pragma PAGEDCODE
  33. VOID CWDMMemory::unmapIoSpace(IN PVOID BaseAddress,IN SIZE_T NumberOfBytes)
  34. {
  35. ::MmUnmapIoSpace (BaseAddress,NumberOfBytes);
  36. }
  37. #pragma PAGEDCODE
  38. VOID CWDMMemory::set(IN VOID UNALIGNED *Destination,IN SIZE_T Length,LONG Fill)
  39. {
  40. ::RtlFillMemory(Destination,Length,(UCHAR)Fill);
  41. }