Leaked source code of windows server 2003
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.

119 lines
2.8 KiB

  1. /*
  2. * Adobe Graphics Manager
  3. *
  4. * Copyright (c) 1996 Adobe Systems Inc.
  5. * All Rights Reserved
  6. *
  7. * UFLMem -- UFL Memory APIs.
  8. *
  9. *
  10. * $Header:
  11. */
  12. #ifndef _H_UFLMem
  13. #define _H_UFLMem
  14. /*===============================================================================*
  15. * Include files used by this interface *
  16. *===============================================================================*/
  17. #include "UFLCnfig.h"
  18. #include "UFLTypes.h"
  19. #include "UFLClien.h"
  20. /*===============================================================================*
  21. * Theory of Operation *
  22. *===============================================================================*/
  23. /*
  24. * These are the memory allocation, deletion, etc... routines used by UFL.
  25. * All memory blocks are allocated at the given size plus the size of 1
  26. * unsigned long. The current size of the block is then stored in the first
  27. * unsigned long in the block. The address of the block plus the first unsigned long
  28. * is returned to the caller.
  29. */
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /* The Metrowerks 68k Mac compiler expects functions to return
  34. pointers in A0 instead of D0. This pragma tells it they are in D0.
  35. */
  36. #if defined(MAC_ENV) && defined(__MWERKS__) && !defined(powerc)
  37. #pragma pointers_in_D0
  38. #endif
  39. //
  40. // NOTE: Memory allocated by UFLNewPtr is zero-initialized.
  41. //
  42. #ifdef KERNEL_MODE
  43. #include "lib.h"
  44. PVOID UFLEXPORT
  45. KMNewPtr(
  46. PVOID p,
  47. ULONG ulSize
  48. );
  49. VOID UFLEXPORT
  50. KMDeletePtr(
  51. PVOID p
  52. );
  53. #define UFLNewPtr(mem, size) KMNewPtr(MemAllocZ(sizeof(ULONG_PTR) + (size)), (size))
  54. #define UFLDeletePtr(mem, ptr) KMDeletePtr(ptr)
  55. #define UFLmemcpy(mem, dest, source, size) CopyMemory(dest, source, size)
  56. #else // !KERNEL_MODE
  57. void *UFLEXPORT UFLNewPtr(
  58. const UFLMemObj *mem,
  59. unsigned long size
  60. );
  61. void UFLEXPORT UFLDeletePtr(
  62. const UFLMemObj *mem,
  63. void *ptr
  64. );
  65. void UFLEXPORT UFLmemcpy(
  66. const UFLMemObj *mem,
  67. void *destination,
  68. void *source,
  69. unsigned long size
  70. );
  71. #endif // !KERNEL_MODE
  72. void UFLEXPORT UFLmemset(
  73. const UFLMemObj *mem,
  74. void *destination,
  75. unsigned int value,
  76. unsigned long size
  77. );
  78. unsigned long UFLMemSize(
  79. void *ptr
  80. );
  81. UFLBool UFLEnlargePtr(
  82. const UFLMemObj *mem,
  83. void **ptrAddr,
  84. unsigned long newSize,
  85. UFLBool bCopy
  86. );
  87. /* undo the Metrowerks pragma. */
  88. #if defined(MAC_ENV) && defined(__MWERKS__) && !defined(powerc)
  89. #pragma pointers_in_A0
  90. #endif
  91. #ifdef __cplusplus
  92. }
  93. #endif
  94. #endif