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.

151 lines
2.8 KiB

  1. /*************************************************************************
  2. *
  3. * musspl.c
  4. *
  5. * (previously called ctxspl.c)
  6. *
  7. * copyright notice: Copyright 1997, Microsoft
  8. *
  9. * Author:
  10. *************************************************************************/
  11. #include "precomp.h"
  12. #pragma hdrstop
  13. /*
  14. * Global data
  15. */
  16. CRITICAL_SECTION ThreadCriticalSection;
  17. /*
  18. * External references
  19. */
  20. extern DWORD GetSpoolMessages();
  21. /*****************************************************************************
  22. *
  23. * MultiUserSpoolerInit
  24. *
  25. * Init the spooler data upcall thread for WIN32K.SYS
  26. *
  27. * ENTRY:
  28. * Param1 (input/output)
  29. * Comments
  30. *
  31. * EXIT:
  32. * STATUS_SUCCESS - no error
  33. *
  34. ****************************************************************************/
  35. NTSTATUS
  36. MultiUserSpoolerInit()
  37. {
  38. DWORD Win32status;
  39. NTSTATUS Status;
  40. Status = RtlInitializeCriticalSection(&ThreadCriticalSection);
  41. if (NT_SUCCESS(Status))
  42. {
  43. //
  44. // Create Kernel Spooler Message Thread
  45. //
  46. Win32status = GetSpoolMessages();
  47. if (Win32status != ERROR_SUCCESS)
  48. {
  49. Status = STATUS_UNSUCCESSFUL;
  50. }
  51. else
  52. {
  53. Status = STATUS_SUCCESS;
  54. }
  55. }
  56. return Status;
  57. }
  58. /*****************************************************************************
  59. *
  60. * AllocSplMem
  61. *
  62. * Comment
  63. *
  64. * ENTRY:
  65. * Param1 (input/output)
  66. * Comments
  67. *
  68. * EXIT:
  69. * STATUS_SUCCESS - no error
  70. *
  71. ****************************************************************************/
  72. LPVOID
  73. AllocSplMem(
  74. DWORD cb)
  75. {
  76. LPDWORD pMem;
  77. pMem=(LPDWORD)LocalAlloc(LPTR, cb);
  78. if (!pMem)
  79. {
  80. return NULL;
  81. }
  82. return (LPVOID)pMem;
  83. }
  84. /*****************************************************************************
  85. *
  86. * FreeSplMem
  87. *
  88. * Comment
  89. *
  90. * ENTRY:
  91. * Param1 (input/output)
  92. * Comments
  93. *
  94. * EXIT:
  95. * STATUS_SUCCESS - no error
  96. *
  97. ****************************************************************************/
  98. BOOL
  99. FreeSplMem(
  100. LPVOID pMem)
  101. {
  102. return LocalFree((HLOCAL)pMem) == NULL;
  103. }
  104. /*****************************************************************************
  105. *
  106. * ReallocSplMem
  107. *
  108. * Comment
  109. *
  110. * ENTRY:
  111. * Param1 (input/output)
  112. * Comments
  113. *
  114. * EXIT:
  115. * STATUS_SUCCESS - no error
  116. *
  117. ****************************************************************************/
  118. LPVOID
  119. ReallocSplMem(
  120. LPVOID lpOldMem,
  121. DWORD cbOld,
  122. DWORD cbNew)
  123. {
  124. if (lpOldMem)
  125. return LocalReAlloc(lpOldMem, cbNew, LMEM_MOVEABLE);
  126. else
  127. return AllocSplMem(cbNew);
  128. UNREFERENCED_PARAMETER(cbOld);
  129. }