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.

100 lines
1.9 KiB

  1. //+-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) Microsoft Corporation 1991 - 1997
  6. //
  7. // File: memmgr.c
  8. //
  9. // Contents: Fast memory manager code for KSecDD
  10. //
  11. //
  12. // History: 23 Feb 93 RichardW Created
  13. // 15 Dec 97 AdamBa Modified from private\lsa\client\ssp
  14. //
  15. //
  16. //------------------------------------------------------------------------
  17. #include <rdrssp.h>
  18. #if DBG
  19. ULONG cActiveCtxtRecs = 0;
  20. #endif
  21. //+-------------------------------------------------------------------------
  22. //
  23. // Function: AllocContextRec
  24. //
  25. // Synopsis: Allocates a KernelContext structure
  26. //
  27. // Effects:
  28. //
  29. // Arguments:
  30. //
  31. // Requires:
  32. //
  33. // Returns:
  34. //
  35. // Notes:
  36. //
  37. //--------------------------------------------------------------------------
  38. PKernelContext
  39. AllocContextRec(void)
  40. {
  41. PKernelContext pContext = NULL;
  42. pContext = (PKernelContext)
  43. ExAllocatePool(NonPagedPool, sizeof(KernelContext));
  44. if (pContext == NULL)
  45. {
  46. DebugLog((DEB_ERROR,"Could not allocate from pool!\n"));
  47. return(NULL);
  48. }
  49. pContext->pNext = NULL;
  50. pContext->pPrev = NULL;
  51. DebugStmt(cActiveCtxtRecs++);
  52. return(pContext);
  53. }
  54. //+-------------------------------------------------------------------------
  55. //
  56. // Function: FreeContextRec
  57. //
  58. // Synopsis: Returns a KernelContext record to the free list
  59. //
  60. // Effects:
  61. //
  62. // Arguments:
  63. //
  64. // Requires:
  65. //
  66. // Returns:
  67. //
  68. // Notes:
  69. //
  70. //--------------------------------------------------------------------------
  71. void
  72. FreeContextRec(PKernelContext pContext)
  73. {
  74. //
  75. // Just return the context to the pool.
  76. //
  77. ExFreePool(pContext);
  78. DebugStmt(cActiveCtxtRecs--);
  79. }