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.

157 lines
3.5 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. csrpro.c
  5. Abstract:
  6. This module implements functions that are used by the Win32 Process Object APIs
  7. to communicate with csrss.
  8. Author:
  9. Michael Zoran (mzoran) 21-Jun-1998
  10. Revision History:
  11. --*/
  12. #include "basedll.h"
  13. NTSTATUS
  14. CsrBasepCreateProcess(
  15. PBASE_CREATEPROCESS_MSG a
  16. )
  17. {
  18. #if defined(BUILD_WOW6432)
  19. return NtWow64CsrBasepCreateProcess(a);
  20. #else
  21. NTSTATUS Status;
  22. BASE_API_MSG m;
  23. PCSR_CAPTURE_HEADER CaptureBuffer = NULL;
  24. m.u.CreateProcess = *a;
  25. if (m.u.CreateProcess.Sxs.Flags != 0)
  26. {
  27. const PUNICODE_STRING StringsToCapture[] =
  28. {
  29. &m.u.CreateProcess.Sxs.Manifest.Path,
  30. &m.u.CreateProcess.Sxs.Policy.Path,
  31. &m.u.CreateProcess.Sxs.AssemblyDirectory
  32. };
  33. Status =
  34. CsrCaptureMessageMultiUnicodeStringsInPlace(
  35. &CaptureBuffer,
  36. RTL_NUMBER_OF(StringsToCapture),
  37. StringsToCapture
  38. );
  39. if (!NT_SUCCESS(Status)) {
  40. goto Exit;
  41. }
  42. }
  43. CsrClientCallServer( (PCSR_API_MSG)&m,
  44. CaptureBuffer,
  45. CSR_MAKE_API_NUMBER( BASESRV_SERVERDLL_INDEX,
  46. BasepCreateProcess
  47. ),
  48. sizeof( m.u.CreateProcess )
  49. );
  50. if ( CaptureBuffer )
  51. CsrFreeCaptureBuffer( CaptureBuffer );
  52. Status = (NTSTATUS)m.ReturnValue;
  53. Exit:
  54. return Status;
  55. #endif
  56. }
  57. VOID
  58. CsrBasepExitProcess(
  59. UINT uExitCode
  60. )
  61. {
  62. #if defined(BUILD_WOW6432)
  63. NtWow64CsrBasepExitProcess(uExitCode);
  64. return;
  65. #else
  66. BASE_API_MSG m;
  67. PBASE_EXITPROCESS_MSG a = &m.u.ExitProcess;
  68. a->uExitCode = uExitCode;
  69. CsrClientCallServer( (PCSR_API_MSG)&m,
  70. NULL,
  71. CSR_MAKE_API_NUMBER( BASESRV_SERVERDLL_INDEX,
  72. BasepExitProcess
  73. ),
  74. sizeof( *a )
  75. );
  76. #endif
  77. }
  78. NTSTATUS
  79. CsrBasepSetProcessShutdownParam(
  80. DWORD dwLevel,
  81. DWORD dwFlags
  82. )
  83. {
  84. #if defined(BUILD_WOW6432)
  85. return NtWow64CsrBasepSetProcessShutdownParam(dwLevel,
  86. dwFlags);
  87. #else
  88. BASE_API_MSG m;
  89. PBASE_SHUTDOWNPARAM_MSG a = &m.u.ShutdownParam;
  90. a->ShutdownLevel = dwLevel;
  91. a->ShutdownFlags = dwFlags;
  92. CsrClientCallServer((PCSR_API_MSG)&m, NULL,
  93. CSR_MAKE_API_NUMBER(BASESRV_SERVERDLL_INDEX,
  94. BasepSetProcessShutdownParam),
  95. sizeof(*a));
  96. return m.ReturnValue;
  97. #endif
  98. }
  99. NTSTATUS
  100. CsrBasepGetProcessShutdownParam(
  101. LPDWORD lpdwLevel,
  102. LPDWORD lpdwFlags
  103. )
  104. {
  105. #if defined(BUILD_WOW6432)
  106. return NtWow64CsrBasepGetProcessShutdownParam(lpdwLevel,
  107. lpdwFlags);
  108. #else
  109. BASE_API_MSG m;
  110. PBASE_SHUTDOWNPARAM_MSG a = &m.u.ShutdownParam;
  111. CsrClientCallServer((PCSR_API_MSG)&m, NULL,
  112. CSR_MAKE_API_NUMBER(BASESRV_SERVERDLL_INDEX,
  113. BasepSetProcessShutdownParam),
  114. sizeof(*a));
  115. *lpdwLevel = a->ShutdownLevel;
  116. *lpdwFlags = a->ShutdownFlags;
  117. return m.ReturnValue;
  118. #endif
  119. }