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.

367 lines
6.6 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. afpadmin.h
  5. Abstract:
  6. This module contains definitions relating to the admin
  7. routines.
  8. Author:
  9. Sue Adams
  10. Revision History:
  11. 25 Jun 1992 Initial Version
  12. --*/
  13. extern
  14. VOID
  15. AfpAdminDeInit(
  16. VOID
  17. );
  18. extern
  19. AFPSTATUS
  20. AfpAdmServiceStart(
  21. IN OUT PVOID Inbuf OPTIONAL,
  22. IN LONG OutBufLen OPTIONAL,
  23. OUT PVOID Outbuf OPTIONAL
  24. );
  25. extern
  26. AFPSTATUS
  27. AfpAdmServiceStop(
  28. IN OUT PVOID Inbuf OPTIONAL,
  29. IN LONG OutBufLen OPTIONAL,
  30. OUT PVOID Outbuf OPTIONAL
  31. );
  32. extern
  33. AFPSTATUS
  34. AfpAdmServicePause(
  35. IN OUT PVOID Inbuf OPTIONAL,
  36. IN LONG OutBufLen OPTIONAL,
  37. OUT PVOID Outbuf OPTIONAL
  38. );
  39. extern
  40. AFPSTATUS
  41. AfpAdmServiceContinue(
  42. IN OUT PVOID Inbuf OPTIONAL,
  43. IN LONG OutBufLen OPTIONAL,
  44. OUT PVOID Outbuf OPTIONAL
  45. );
  46. extern
  47. AFPSTATUS
  48. AfpAdmGetStatistics(
  49. IN OUT PVOID Inbuf OPTIONAL,
  50. IN LONG OutBufLen OPTIONAL,
  51. OUT PVOID Outbuf OPTIONAL
  52. );
  53. extern
  54. AFPSTATUS
  55. AfpAdmGetStatisticsEx(
  56. IN OUT PVOID Inbuf OPTIONAL,
  57. IN LONG OutBufLen OPTIONAL,
  58. OUT PVOID Outbuf OPTIONAL
  59. );
  60. extern
  61. AFPSTATUS
  62. AfpAdmClearStatistics(
  63. IN OUT PVOID Inbuf OPTIONAL,
  64. IN LONG OutBufLen OPTIONAL,
  65. OUT PVOID Outbuf OPTIONAL
  66. );
  67. extern
  68. AFPSTATUS
  69. AfpAdmGetProfCounters(
  70. IN OUT PVOID Inbuf OPTIONAL,
  71. IN LONG OutBufLen OPTIONAL,
  72. OUT PVOID Outbuf OPTIONAL
  73. );
  74. extern
  75. AFPSTATUS
  76. AfpAdmClearProfCounters(
  77. IN OUT PVOID Inbuf OPTIONAL,
  78. IN LONG OutBufLen OPTIONAL,
  79. OUT PVOID Outbuf OPTIONAL
  80. );
  81. extern
  82. AFPSTATUS
  83. AfpAdmServerSetParms(
  84. IN OUT PVOID Inbuf OPTIONAL,
  85. IN LONG OutBufLen OPTIONAL,
  86. OUT PVOID Outbuf OPTIONAL
  87. );
  88. extern
  89. AFPSTATUS
  90. AfpAdmServerAddEtc(
  91. IN OUT PVOID Inbuf OPTIONAL,
  92. IN LONG OutBufLen OPTIONAL,
  93. OUT PVOID Outbuf OPTIONAL
  94. );
  95. extern
  96. AFPSTATUS
  97. AfpAdmServerSetEtc(
  98. IN OUT PVOID Inbuf OPTIONAL,
  99. IN LONG OutBufLen OPTIONAL,
  100. OUT PVOID Outbuf OPTIONAL
  101. );
  102. extern
  103. AFPSTATUS
  104. AfpAdmServerGetInfo(
  105. IN OUT PVOID Inbuf OPTIONAL,
  106. IN LONG OutBufLen OPTIONAL,
  107. OUT PVOID Outbuf OPTIONAL
  108. );
  109. extern
  110. AFPSTATUS
  111. AfpAdmServerDeleteEtc(
  112. IN OUT PVOID Inbuf OPTIONAL,
  113. IN LONG OutBufLen OPTIONAL,
  114. OUT PVOID Outbuf OPTIONAL
  115. );
  116. extern
  117. AFPSTATUS
  118. AfpAdmServerAddIcon(
  119. IN OUT PVOID Inbuf OPTIONAL,
  120. IN LONG OutBufLen OPTIONAL,
  121. OUT PVOID Outbuf OPTIONAL
  122. );
  123. extern
  124. AFPSTATUS
  125. AfpAdmVolumeAdd(
  126. IN OUT PVOID Inbuf OPTIONAL,
  127. IN LONG OutBufLen OPTIONAL,
  128. OUT PVOID Outbuf OPTIONAL
  129. );
  130. extern
  131. AFPSTATUS
  132. AfpAdmVolumeSetInfo(
  133. IN OUT PVOID Inbuf OPTIONAL,
  134. IN LONG OutBufLen OPTIONAL,
  135. OUT PVOID Outbuf OPTIONAL
  136. );
  137. extern
  138. AFPSTATUS
  139. AfpAdmVolumeGetInfo(
  140. IN OUT PVOID Inbuf OPTIONAL,
  141. IN LONG OutBufLen OPTIONAL,
  142. OUT PVOID Outbuf OPTIONAL
  143. );
  144. extern
  145. AFPSTATUS
  146. AfpAdmVolumeEnum(
  147. IN OUT PVOID Inbuf OPTIONAL,
  148. IN LONG OutBufLen OPTIONAL,
  149. OUT PVOID Outbuf OPTIONAL
  150. );
  151. extern
  152. AFPSTATUS
  153. AfpAdmSessionEnum(
  154. IN OUT PVOID Inbuf OPTIONAL,
  155. IN LONG OutBufLen OPTIONAL,
  156. OUT PVOID Outbuf OPTIONAL
  157. );
  158. extern
  159. AFPSTATUS
  160. AfpAdmConnectionEnum(
  161. IN OUT PVOID Inbuf OPTIONAL,
  162. IN LONG OutBufLen OPTIONAL,
  163. OUT PVOID Outbuf OPTIONAL
  164. );
  165. extern
  166. AFPSTATUS
  167. AfpAdmWDirectoryGetInfo(
  168. IN OUT PVOID Inbuf OPTIONAL,
  169. IN LONG OutBufLen OPTIONAL,
  170. OUT PVOID Outbuf OPTIONAL
  171. );
  172. extern
  173. AFPSTATUS
  174. AfpAdmWDirectorySetInfo(
  175. IN OUT PVOID Inbuf OPTIONAL,
  176. IN LONG OutBufLen OPTIONAL,
  177. OUT PVOID Outbuf OPTIONAL
  178. );
  179. extern
  180. AFPSTATUS
  181. AfpAdmWFinderSetInfo(
  182. IN OUT PVOID Inbuf OPTIONAL,
  183. IN LONG OutBufLen OPTIONAL,
  184. OUT PVOID Outbuf OPTIONAL
  185. );
  186. extern
  187. AFPSTATUS
  188. AfpAdmForkEnum(
  189. IN OUT PVOID Inbuf OPTIONAL,
  190. IN LONG OutBufLen OPTIONAL,
  191. OUT PVOID Outbuf OPTIONAL
  192. );
  193. extern
  194. AFPSTATUS
  195. AfpAdmMessageSend(
  196. IN OUT PVOID Inbuf OPTIONAL,
  197. IN LONG OutBufLen OPTIONAL,
  198. OUT PVOID Outbuf OPTIONAL
  199. );
  200. extern
  201. AFPSTATUS
  202. AfpAdmSystemShutdown(
  203. IN OUT PVOID Inbuf OPTIONAL,
  204. IN LONG OutBufLen OPTIONAL,
  205. OUT PVOID Outbuf OPTIONAL
  206. );
  207. extern
  208. PETCMAPINFO
  209. AfpLookupEtcMapEntry(
  210. PUCHAR pExt
  211. );
  212. #ifdef AFPADMIN_LOCALS
  213. // Manifests for the FieldDesc
  214. #define DESC_NONE 0 // Don't bother with the validation
  215. #define DESC_STRING 1 // Its an offset to a string
  216. #define DESC_ETC 2 // Its the count of # of etc mappings
  217. #define DESC_ICON 3 // This field specifies the size of icon
  218. #define DESC_SID 4 // This field points to a Sid
  219. #define DESC_SPECIAL 5 // This needs special handling
  220. #define MAX_FIELDS 3 // Max. number of fields to validate
  221. // Structure used for queueing admin requests to a worker thread
  222. typedef struct _AdminQRequest
  223. {
  224. PIRP aqr_pIrp;
  225. ADMINAPIWORKER aqr_AdminApiWorker;
  226. WORK_ITEM aqr_WorkItem;
  227. } ADMQREQ, *PADMQREQ;
  228. LOCAL NTSTATUS
  229. afpFsdHandleAdminRequest(
  230. IN PIRP pIrp
  231. );
  232. LOCAL NTSTATUS
  233. afpFsdHandleShutdownRequest(
  234. IN PIRP pIrp
  235. );
  236. LOCAL VOID FASTCALL
  237. afpHandleQueuedAdminRequest(
  238. IN PADMQREQ pAdmQReq
  239. );
  240. LOCAL VOID
  241. afpQueueAdminWorkItem(
  242. IN PLIST_ENTRY pAdmQListEntry
  243. );
  244. LOCAL NTSTATUS
  245. afpFsdDispatchAdminRequest(
  246. IN PDEVICE_OBJECT pDeviceObject,
  247. IN PIRP pIrp
  248. );
  249. NTSTATUS
  250. DriverEntry (
  251. IN PDRIVER_OBJECT DriverObject,
  252. IN PUNICODE_STRING RegistryPath
  253. );
  254. NTSTATUS
  255. afpInitServer (
  256. VOID
  257. );
  258. LOCAL VOID
  259. afpAdminThread(
  260. IN PVOID pContext
  261. );
  262. LOCAL VOID
  263. afpFsdUnloadServer(
  264. IN PDRIVER_OBJECT DeviceObject
  265. );
  266. LOCAL VOID
  267. afpStartStopAdminRequest(
  268. IN PIRP pIrp,
  269. IN BOOLEAN Start
  270. );
  271. #define afpStartAdminRequest(pIrp) afpStartStopAdminRequest(pIrp, True)
  272. #define afpStopAdminRequest(pIrp) afpStartStopAdminRequest(pIrp, False)
  273. // This is the dispatch table for admin apis.
  274. typedef struct
  275. {
  276. BYTE _FieldDesc; // One of the above DESC_ values
  277. BYTE _FieldOffset; // Offset of the field
  278. } DESCRIPTOR;
  279. typedef struct _AdminApiDispatchTable
  280. {
  281. SHORT _MinBufLen;
  282. BYTE _OffToStruct;
  283. BOOLEAN _CausesChange;
  284. DWORD _OpCode;
  285. ADMINAPIWORKER _AdminApiWorker;
  286. ADMINAPIWORKER _AdminApiQueuedWorker;
  287. /*
  288. * The following fields are used by the validation code. Since the
  289. * structures have variable length fields in it, we need to make sure
  290. * that
  291. * a, The offsets point within the buffer
  292. * b, The last unicode character in the buffer is a NULL
  293. * This ensures that when the worker does a wstrlen, it does not
  294. * access memory beyond the InputBuffer.
  295. *
  296. * We also deal with variable length data which is not a string.
  297. * Fortunately there are only three APIs that use such a structure.
  298. * We special-case these apis. The APIs are
  299. * a, ServerAddIcon
  300. * We need to make sure that the icon buffer and icon length are
  301. * kosher. The worker will do the rest of the validation.
  302. * b, ServerAddEtc
  303. * We need to make sure that the buffer is consistent with the
  304. * number of etc mappings specified.
  305. */
  306. DESCRIPTOR _Fields[MAX_FIELDS];
  307. } ADMIN_DISPATCH_TABLE, *PADMIN_DISPATCH_TABLE;
  308. extern ADMIN_DISPATCH_TABLE AfpAdminDispatchTable[];
  309. #endif // AFPADMIN_LOCALS
  310.