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.

95 lines
2.0 KiB

  1. /*******************************************************************************
  2. *
  3. * MEMORY.C
  4. *
  5. * Memory allocation routines
  6. *
  7. *
  8. * Copyright Microsoft. 1998
  9. *
  10. *
  11. ******************************************************************************/
  12. /*
  13. * Includes
  14. */
  15. #include <ntddk.h>
  16. #include <ntddvdeo.h>
  17. #include <ntddkbd.h>
  18. #include <ntddmou.h>
  19. #include <ntddbeep.h>
  20. #include <winstaw.h>
  21. #include <icadd.h>
  22. #include <sdapi.h>
  23. #include <td.h>
  24. /*=============================================================================
  25. == External Functions Defined
  26. =============================================================================*/
  27. NTSTATUS MemoryAllocate( ULONG, PVOID * );
  28. VOID MemoryFree( PVOID );
  29. /*=============================================================================
  30. == Internal Functions Defined
  31. =============================================================================*/
  32. /*******************************************************************************
  33. *
  34. * MemoryAllocate
  35. *
  36. * This routine allocate a block of memory
  37. *
  38. * ENTRY:
  39. * Length (input)
  40. * length of memory to allocate
  41. * ppMemory (output)
  42. * address to return pointer to memory
  43. *
  44. * EXIT:
  45. * STATUS_SUCCESS - no error
  46. *
  47. ******************************************************************************/
  48. NTSTATUS
  49. MemoryAllocate( ULONG Length, PVOID * ppMemory )
  50. {
  51. ASSERT( Length > 0 );
  52. *ppMemory = IcaStackAllocatePoolWithTag( NonPagedPool, Length, ' DT' );
  53. if ( *ppMemory == NULL )
  54. return( STATUS_NO_MEMORY );
  55. return( STATUS_SUCCESS );
  56. }
  57. /*******************************************************************************
  58. *
  59. * MemoryFree
  60. *
  61. * This routine frees a block of memory allocated by "MemoryAllocate"
  62. *
  63. * ENTRY:
  64. * pMemory (output)
  65. * pointer to memory to free
  66. *
  67. * EXIT:
  68. * nothing
  69. *
  70. ******************************************************************************/
  71. VOID
  72. MemoryFree( PVOID pMemory )
  73. {
  74. IcaStackFreePool( pMemory );
  75. }