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.

204 lines
4.8 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. csrdll.h
  5. Abstract:
  6. Main include file for Client side of the Client Server Runtime (CSR)
  7. Author:
  8. Steve Wood (stevewo) 8-Oct-1990
  9. Revision History:
  10. --*/
  11. //
  12. // Include definitions common between the Client and Server portions.
  13. //
  14. #include "csr.h"
  15. //
  16. // Include definitions specific to the Client portion.
  17. //
  18. #include "ntcsrdll.h"
  19. #include "ntcsrsrv.h"
  20. #if DBG
  21. #define CSR_DEBUG_INIT 0x00000001
  22. #define CSR_DEBUG_LPC 0x00000002
  23. #define CSR_DEBUG_FLAG3 0x00000004
  24. #define CSR_DEBUG_FLAG4 0x00000008
  25. #define CSR_DEBUG_FLAG5 0x00000010
  26. #define CSR_DEBUG_FLAG6 0x00000020
  27. #define CSR_DEBUG_FLAG7 0x00000040
  28. #define CSR_DEBUG_FLAG8 0x00000080
  29. #define CSR_DEBUG_FLAG9 0x00000100
  30. #define CSR_DEBUG_FLAG10 0x00000200
  31. #define CSR_DEBUG_FLAG11 0x00000400
  32. #define CSR_DEBUG_FLAG12 0x00000800
  33. #define CSR_DEBUG_FLAG13 0x00001000
  34. #define CSR_DEBUG_FLAG14 0x00002000
  35. #define CSR_DEBUG_FLAG15 0x00004000
  36. #define CSR_DEBUG_FLAG16 0x00008000
  37. #define CSR_DEBUG_FLAG17 0x00010000
  38. #define CSR_DEBUG_FLAG18 0x00020000
  39. #define CSR_DEBUG_FLAG19 0x00040000
  40. #define CSR_DEBUG_FLAG20 0x00080000
  41. #define CSR_DEBUG_FLAG21 0x00100000
  42. #define CSR_DEBUG_FLAG22 0x00200000
  43. #define CSR_DEBUG_FLAG23 0x00400000
  44. #define CSR_DEBUG_FLAG24 0x00800000
  45. #define CSR_DEBUG_FLAG25 0x01000000
  46. #define CSR_DEBUG_FLAG26 0x02000000
  47. #define CSR_DEBUG_FLAG27 0x04000000
  48. #define CSR_DEBUG_FLAG28 0x08000000
  49. #define CSR_DEBUG_FLAG29 0x10000000
  50. #define CSR_DEBUG_FLAG30 0x20000000
  51. #define CSR_DEBUG_FLAG31 0x40000000
  52. #define CSR_DEBUG_FLAG32 0x80000000
  53. ULONG CsrDebug;
  54. #define IF_CSR_DEBUG( ComponentFlag ) \
  55. if (CsrDebug & (CSR_DEBUG_ ## ComponentFlag))
  56. #else
  57. #define IF_CSR_DEBUG( ComponentFlag ) if (FALSE)
  58. #endif
  59. //
  60. // Common Types and Definitions
  61. //
  62. //
  63. // CSR_HEAP_MEMORY_SIZE defines how much address space should be
  64. // reserved for the Client heap. This heap is used to store all
  65. // data structures maintained by the Client DLL.
  66. //
  67. #define CSR_HEAP_MEMORY_SIZE (64*1024)
  68. //
  69. // CSR_PORT_MEMORY_SIZE defines how much address space should be
  70. // reserved for passing data to the Server. The memory is visible
  71. // to both the client and server processes.
  72. //
  73. #define CSR_PORT_MEMORY_SIZE 0x10000
  74. //
  75. // Global data accessed by Client DLL
  76. //
  77. BOOLEAN CsrInitOnceDone;
  78. //
  79. // This boolean is TRUE if the dll is attached to a server process.
  80. //
  81. BOOLEAN CsrServerProcess;
  82. //
  83. // This points to the server routine that dispatches APIs, if the dll is
  84. // being called by a server process.
  85. //
  86. NTSTATUS (*CsrServerApiRoutine)(PCSR_API_MSG,PCSR_API_MSG);
  87. //
  88. // The CsrNtSysInfo global variable contains NT specific constants of
  89. // interest, such as page size, allocation granularity, etc. It is filled
  90. // in once during process initialization.
  91. //
  92. SYSTEM_BASIC_INFORMATION CsrNtSysInfo;
  93. #define ROUND_UP_TO_PAGES(SIZE) (((ULONG)(SIZE) + CsrNtSysInfo.PageSize - 1) & ~(CsrNtSysInfo.PageSize - 1))
  94. #define ROUND_DOWN_TO_PAGES(SIZE) (((ULONG)(SIZE)) & ~(CsrNtSysInfo.PageSize - 1))
  95. //
  96. // The CsrDebugFlag is non-zero if the Client Application was
  97. // invoked with the Debug option.
  98. //
  99. ULONG CsrDebugFlag;
  100. //
  101. // The CsrHeap global variable describes a single heap used by the Client
  102. // DLL for process wide storage management. Process private data maintained
  103. // by the Client DLL is allocated out of this heap.
  104. //
  105. PVOID CsrHeap;
  106. //
  107. // The connection to the Server is described by the CsrPortHandle global
  108. // variable. The connection is established when the CsrConnectToServer
  109. // function is called.
  110. //
  111. UNICODE_STRING CsrPortName;
  112. HANDLE CsrPortHandle;
  113. HANDLE CsrProcessId;
  114. //
  115. // In order to pass large arguments to the Server (e.g. path name
  116. // arguments) the CsrPortHeap global variable describes a heap that
  117. // is visible to both the Windows Client process and the Server
  118. // process.
  119. //
  120. PVOID CsrPortHeap;
  121. ULONG_PTR CsrPortMemoryRemoteDelta;
  122. ULONG CsrPortBaseTag;
  123. #define MAKE_CSRPORT_TAG( t ) (RTL_HEAP_MAKE_TAG( CsrPortBaseTag, t ))
  124. #define CAPTURE_TAG 0
  125. //
  126. // The CsrDllHandle global variable contains the DLL handle for the WINDLL
  127. // client stubs executable.
  128. //
  129. HANDLE CsrDllHandle;
  130. //
  131. // The CsrObjectDirecotory global variable contains the handle to the
  132. // object directory that is the name of the server.
  133. //
  134. HANDLE CsrObjectDirectory;
  135. //
  136. // Routines defined in dllinit.c
  137. //
  138. BOOLEAN
  139. CsrDllInitialize(
  140. IN PVOID DllHandle,
  141. IN ULONG Reason,
  142. IN PCONTEXT Context OPTIONAL
  143. );
  144. NTSTATUS
  145. CsrpConnectToServer(
  146. IN PWSTR ObjectDirectory
  147. );
  148. //
  149. // Routines defined in dllutil.c
  150. //