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.

325 lines
6.1 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. srvsvc.h
  5. Abstract:
  6. This module defines prototypes for the API processors. These
  7. routines are called in response to an FSCTL from the server
  8. service.
  9. Author:
  10. David Treadwell (davidtr) 20-Jan-1991
  11. Revision History:
  12. --*/
  13. #ifndef _SRVSVC_
  14. #define _SRVSVC_
  15. //
  16. // Standard prototype for all API processors.
  17. //
  18. typedef
  19. NTSTATUS
  20. (*PAPI_PROCESSOR) (
  21. IN PSERVER_REQUEST_PACKET Srp,
  22. IN PVOID Buffer,
  23. IN ULONG BufferLength
  24. );
  25. //
  26. // Prototypes for filter, size, and buffer filling routines used by Enum
  27. // APIs. SrvEnumApiHandler calls these routines when it has found a
  28. // block to determine whether the block should actually be put in the
  29. // output buffer.
  30. //
  31. typedef
  32. BOOLEAN
  33. (*PENUM_FILTER_ROUTINE) (
  34. IN PSERVER_REQUEST_PACKET Srp,
  35. IN PVOID Block
  36. );
  37. typedef
  38. ULONG
  39. (*PENUM_SIZE_ROUTINE) (
  40. IN PSERVER_REQUEST_PACKET Srp,
  41. IN PVOID Block
  42. );
  43. typedef
  44. VOID
  45. (*PENUM_FILL_ROUTINE) (
  46. IN PSERVER_REQUEST_PACKET Srp,
  47. IN PVOID Block,
  48. IN OUT PVOID *FixedStructurePointer,
  49. IN OUT LPWSTR *EndOfVariableData
  50. );
  51. //
  52. // Prototype for filter routine for SrvMatchEntryInOrderedList.
  53. //
  54. typedef
  55. BOOLEAN
  56. (*PFILTER_ROUTINE) (
  57. IN PVOID Context,
  58. IN PVOID Block
  59. );
  60. //
  61. // Connection APIs.
  62. //
  63. NTSTATUS
  64. SrvNetConnectionEnum (
  65. IN PSERVER_REQUEST_PACKET Srp,
  66. IN PVOID Buffer,
  67. IN ULONG BufferLength
  68. );
  69. //
  70. // File APIs.
  71. //
  72. NTSTATUS
  73. SrvNetFileClose (
  74. IN PSERVER_REQUEST_PACKET Srp,
  75. IN PVOID Buffer,
  76. IN ULONG BufferLength
  77. );
  78. NTSTATUS
  79. SrvNetFileEnum (
  80. IN PSERVER_REQUEST_PACKET Srp,
  81. IN PVOID Buffer,
  82. IN ULONG BufferLength
  83. );
  84. //
  85. // Server APIs.
  86. //
  87. NTSTATUS
  88. SrvNetServerDiskEnum (
  89. IN PSERVER_REQUEST_PACKET Srp,
  90. IN PVOID Buffer,
  91. IN ULONG BufferLength
  92. );
  93. NTSTATUS
  94. SrvNetServerSetInfo (
  95. IN PSERVER_REQUEST_PACKET Srp,
  96. IN PVOID Buffer,
  97. IN ULONG BufferLength
  98. );
  99. //
  100. // Transport routines.
  101. //
  102. NTSTATUS
  103. SrvNetServerTransportAdd (
  104. IN PSERVER_REQUEST_PACKET Srp,
  105. IN PVOID Buffer,
  106. IN ULONG BufferLength
  107. );
  108. NTSTATUS
  109. SrvNetServerTransportDel (
  110. IN PSERVER_REQUEST_PACKET Srp,
  111. IN PVOID Buffer,
  112. IN ULONG BufferLength
  113. );
  114. NTSTATUS
  115. SrvNetServerTransportEnum (
  116. IN PSERVER_REQUEST_PACKET Srp,
  117. IN PVOID Buffer,
  118. IN ULONG BufferLength
  119. );
  120. //
  121. // Session APIs.
  122. //
  123. NTSTATUS
  124. SrvNetSessionDel (
  125. IN PSERVER_REQUEST_PACKET Srp,
  126. IN PVOID Buffer,
  127. IN ULONG BufferLength
  128. );
  129. NTSTATUS
  130. SrvNetSessionEnum (
  131. IN PSERVER_REQUEST_PACKET Srp,
  132. IN PVOID Buffer,
  133. IN ULONG BufferLength
  134. );
  135. //
  136. // Share APIs.
  137. //
  138. NTSTATUS
  139. SrvNetShareAdd (
  140. IN PSERVER_REQUEST_PACKET Srp,
  141. IN PVOID Buffer,
  142. IN ULONG BufferLength
  143. );
  144. NTSTATUS
  145. SrvNetShareDel (
  146. IN PSERVER_REQUEST_PACKET Srp,
  147. IN PVOID Buffer,
  148. IN ULONG BufferLength
  149. );
  150. NTSTATUS
  151. SrvNetShareEnum (
  152. IN PSERVER_REQUEST_PACKET Srp,
  153. IN PVOID Buffer,
  154. IN ULONG BufferLength
  155. );
  156. NTSTATUS
  157. SrvNetShareSetInfo (
  158. IN PSERVER_REQUEST_PACKET Srp,
  159. IN PVOID Buffer,
  160. IN ULONG BufferLength
  161. );
  162. //
  163. // Statistics routine.
  164. //
  165. NTSTATUS
  166. SrvNetStatisticsGet (
  167. IN PSERVER_REQUEST_PACKET Srp,
  168. IN PVOID Buffer,
  169. IN ULONG BufferLength
  170. );
  171. //
  172. // API support routines.
  173. //
  174. VOID
  175. SrvCopyUnicodeStringToBuffer (
  176. IN PUNICODE_STRING String,
  177. IN PCHAR FixedStructure,
  178. IN OUT LPWSTR *EndOfVariableData,
  179. OUT LPWSTR *VariableDataPointer
  180. );
  181. VOID
  182. SrvDeleteOrderedList (
  183. IN PORDERED_LIST_HEAD ListHead
  184. );
  185. NTSTATUS
  186. SrvEnumApiHandler (
  187. IN PSERVER_REQUEST_PACKET Srp,
  188. IN PVOID OutputBuffer,
  189. IN ULONG BufferLength,
  190. IN PORDERED_LIST_HEAD ListHead,
  191. IN PENUM_FILTER_ROUTINE FilterRoutine,
  192. IN PENUM_SIZE_ROUTINE SizeRoutine,
  193. IN PENUM_FILL_ROUTINE FillRoutine
  194. );
  195. PVOID
  196. SrvFindEntryInOrderedList (
  197. IN PORDERED_LIST_HEAD ListHead,
  198. IN PFILTER_ROUTINE FilterRoutine OPTIONAL,
  199. IN PVOID Context OPTIONAL,
  200. IN ULONG ResumeHandle,
  201. IN BOOLEAN ExactHandleMatch,
  202. IN PLIST_ENTRY StartLocation OPTIONAL
  203. );
  204. PVOID
  205. SrvFindNextEntryInOrderedList (
  206. IN PORDERED_LIST_HEAD ListHead,
  207. IN PVOID Block
  208. );
  209. PSESSION
  210. SrvFindUserOnConnection (
  211. IN PCONNECTION Connection
  212. );
  213. ULONG
  214. SrvGetResumeHandle (
  215. IN PORDERED_LIST_HEAD ListHead,
  216. IN PVOID Block
  217. );
  218. VOID
  219. SrvInitializeOrderedList (
  220. IN PORDERED_LIST_HEAD ListHead,
  221. IN ULONG ListEntryOffset,
  222. IN PREFERENCE_ROUTINE ReferenceRoutine,
  223. IN PDEREFERENCE_ROUTINE DereferenceRoutine,
  224. IN PSRV_LOCK Lock
  225. );
  226. VOID
  227. SrvInsertEntryOrderedList (
  228. IN PORDERED_LIST_HEAD ListHead,
  229. IN PVOID Block
  230. );
  231. VOID
  232. SrvRemoveEntryOrderedList (
  233. IN PORDERED_LIST_HEAD ListHead,
  234. IN PVOID Block
  235. );
  236. NTSTATUS
  237. SrvSendDatagram (
  238. IN PANSI_STRING Domain,
  239. IN PUNICODE_STRING Transport OPTIONAL,
  240. IN PVOID Buffer,
  241. IN ULONG BufferLength
  242. );
  243. //
  244. // Macro to convert an offset in an API data structure to a pointer
  245. // meaningful to the server.
  246. //
  247. #define OFFSET_TO_POINTER(val,start) \
  248. { \
  249. if ( (val) != NULL ) { \
  250. (val) = (PVOID)( (PCHAR)(start) + (ULONG_PTR)(val) ); \
  251. } \
  252. }
  253. //
  254. // Macro to determine whether a pointer is within a certain range.
  255. //
  256. #define POINTER_IS_VALID(val,start,len) \
  257. ( (val) == NULL || \
  258. ( (ULONG_PTR)(val) > (ULONG_PTR)(start) && \
  259. (ULONG_PTR)(val) < ((ULONG_PTR)(start) + (len)) ) )
  260. #endif // _SRVSVC_
  261. //
  262. // Ensure that the system will not go into a power-down idle standby mode
  263. //
  264. VOID SrvInhibitIdlePowerDown();
  265. //
  266. // Allow the system to go into a power-down idle standby mode
  267. //
  268. VOID SrvAllowIdlePowerDown();