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.

269 lines
8.3 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1993 **/
  4. /**********************************************************************/
  5. /*
  6. ftpd.h
  7. This file contains constants & type definitions shared between the
  8. FTPD Service, Installer, and Administration UI.
  9. FILE HISTORY:
  10. KeithMo 10-Mar-1993 Created.
  11. MuraliK 23-Oct-1995 Imported for new ftp server
  12. MuraliK 14-Dec-1995 service name imported from inetinfo.h
  13. */
  14. #ifndef _FTPD_H_
  15. #define _FTPD_H_
  16. #ifdef __cplusplus
  17. extern "C"
  18. {
  19. #endif // _cplusplus
  20. #if !defined(MIDL_PASS)
  21. #include <winsock.h>
  22. #endif
  23. # include <inetinfo.h>
  24. //
  25. // Name of directory annotation file. If this file exists
  26. // in the target directory of a CWD command, its contents
  27. // will be sent to the user as part of the CWD reply.
  28. //
  29. #define FTPD_ANNOTATION_FILE_A "~FTPSVC~.CKM"
  30. #define FTPD_ANNOTATION_FILE_W L"~FTPSVC~.CKM"
  31. //
  32. // Configuration parameters registry key.
  33. //
  34. # define FTPD_SERVICE_KEY_A \
  35. "System\\CurrentControlSet\\Services\\" ## FTPD_SERVICE_NAME_A
  36. # define FTPD_SERVICE_KEY_W \
  37. L"System\\CurrentControlSet\\Services\\" ## FTPD_SERVICE_NAME_W
  38. #define FTPD_PARAMETERS_KEY_A FTPD_SERVICE_KEY_A ## "\\Parameters"
  39. #define FTPD_PARAMETERS_KEY_W FTPD_SERVICE_KEY_W ## L"\\Parameters"
  40. //
  41. // Performance key.
  42. //
  43. #define FTPD_PERFORMANCE_KEY_A FTPD_SERVICE_KEY_A ## "\\Performance"
  44. #define FTPD_PERFORMANCE_KEY_W FTPD_SERVICE_KEY_W ## L"\\Performance"
  45. //
  46. // If this registry key exists under the Parameters key,
  47. // it is used to validate FTPSVC access. Basically, all new users
  48. // must have sufficient privilege to open this key before they
  49. // may access the FTP Server.
  50. //
  51. #define FTPD_ACCESS_KEY_A "AccessCheck"
  52. #define FTPD_ACCESS_KEY_W L"AccessCheck"
  53. //
  54. // Configuration value names.
  55. //
  56. #define FTPD_ALLOW_ANONYMOUS_A "AllowAnonymous"
  57. #define FTPD_ALLOW_ANONYMOUS_W L"AllowAnonymous"
  58. #define FTPD_ALLOW_GUEST_ACCESS_A "AllowGuestAccess"
  59. #define FTPD_ALLOW_GUEST_ACCESS_W L"AllowGuestAccess"
  60. #define FTPD_ANONYMOUS_ONLY_A "AnonymousOnly"
  61. #define FTPD_ANONYMOUS_ONLY_W L"AnonymousOnly"
  62. #define FTPD_MSDOS_DIR_OUTPUT_A "MsdosDirOutput"
  63. #define FTPD_MSDOS_DIR_OUTPUT_W L"MsdosDirOutput"
  64. #define FTPD_GREETING_MESSAGE_A "GreetingMessage"
  65. #define FTPD_GREETING_MESSAGE_W L"GreetingMessage"
  66. #define FTPD_EXIT_MESSAGE_A "ExitMessage"
  67. #define FTPD_EXIT_MESSAGE_W L"ExitMessage"
  68. #define FTPD_MAX_CLIENTS_MSG_A "MaxClientsMessage"
  69. #define FTPD_MAX_CLIENTS_MSG_W L"MaxClientsMessage"
  70. #define FTPD_DEBUG_FLAGS_A "DebugFlags"
  71. #define FTPD_DEBUG_FLAGS_W L"DebugFlags"
  72. #define FTPD_ANNOTATE_DIRS_A "AnnotateDirectories"
  73. #define FTPD_ANNOTATE_DIRS_W L"AnnotateDirectories"
  74. #define FTPD_LOWERCASE_FILES_A "LowercaseFiles"
  75. #define FTPD_LOWERCASE_FILES_W L"LowercaseFiles"
  76. #define FTPD_LISTEN_BACKLOG_A "ListenBacklog"
  77. #define FTPD_LISTEN_BACKLOG_W L"ListenBacklog"
  78. #define FTPD_ENABLE_LICENSING_A "EnableLicensing"
  79. #define FTPD_ENABLE_LICENSING_W L"EnableLicensing"
  80. #define FTPD_DEFAULT_LOGON_DOMAIN_A "DefaultLogonDomain"
  81. #define FTPD_DEFAULT_LOGON_DOMAIN_W L"DefaultLogonDomain"
  82. //
  83. // Name of the LSA Secret Object containing the password for
  84. // anonymous logon and virtual UNC roots
  85. //
  86. #define FTPD_ANONYMOUS_SECRET_A "FTPD_ANONYMOUS_DATA"
  87. #define FTPD_ANONYMOUS_SECRET_W L"FTPD_ANONYMOUS_DATA"
  88. #define FTPD_ROOT_SECRET_A "FTPD_ROOT_DATA"
  89. #define FTPD_ROOT_SECRET_W L"FTPD_ROOT_DATA"
  90. //
  91. // Handle ANSI/UNICODE sensitivity.
  92. //
  93. #ifdef UNICODE
  94. #define FTPD_ANNOTATION_FILE FTPD_ANNOTATION_FILE_W
  95. #define FTPD_PARAMETERS_KEY FTPD_PARAMETERS_KEY_W
  96. #define FTPD_PERFORMANCE_KEY FTPD_PERFORMANCE_KEY_W
  97. #define FTPD_ACCESS_KEY FTPD_ACCESS_KEY_W
  98. #define FTPD_ALLOW_ANONYMOUS FTPD_ALLOW_ANONYMOUS_W
  99. #define FTPD_ALLOW_GUEST_ACCESS FTPD_ALLOW_GUEST_ACCESS_W
  100. #define FTPD_ANONYMOUS_ONLY FTPD_ANONYMOUS_ONLY_W
  101. #define FTPD_MSDOS_DIR_OUTPUT FTPD_MSDOS_DIR_OUTPUT_W
  102. #define FTPD_GREETING_MESSAGE FTPD_GREETING_MESSAGE_W
  103. #define FTPD_EXIT_MESSAGE FTPD_EXIT_MESSAGE_W
  104. #define FTPD_MAX_CLIENTS_MSG FTPD_MAX_CLIENTS_MSG_W
  105. #define FTPD_DEBUG_FLAGS FTPD_DEBUG_FLAGS_W
  106. #define FTPD_ANNOTATE_DIRS FTPD_ANNOTATE_DIRS_W
  107. #define FTPD_ANONYMOUS_SECRET FTPD_ANONYMOUS_SECRET_W
  108. #define FTPD_LOWERCASE_FILES FTPD_LOWERCASE_FILES_W
  109. #define FTPD_LISTEN_BACKLOG FTPD_LISTEN_BACKLOG_W
  110. #define FTPD_ENABLE_LICENSING FTPD_ENABLE_LICENSING_W
  111. #define FTPD_DEFAULT_LOGON_DOMAIN FTPD_DEFAULT_LOGON_DOMAIN_W
  112. #else // !UNICODE
  113. #define FTPD_ANNOTATION_FILE FTPD_ANNOTATION_FILE_A
  114. #define FTPD_PARAMETERS_KEY FTPD_PARAMETERS_KEY_A
  115. #define FTPD_PERFORMANCE_KEY FTPD_PERFORMANCE_KEY_A
  116. #define FTPD_ACCESS_KEY FTPD_ACCESS_KEY_A
  117. #define FTPD_ANONYMOUS_ONLY FTPD_ANONYMOUS_ONLY_A
  118. #define FTPD_ALLOW_ANONYMOUS FTPD_ALLOW_ANONYMOUS_A
  119. #define FTPD_ALLOW_GUEST_ACCESS FTPD_ALLOW_GUEST_ACCESS_A
  120. #define FTPD_MSDOS_DIR_OUTPUT FTPD_MSDOS_DIR_OUTPUT_A
  121. #define FTPD_GREETING_MESSAGE FTPD_GREETING_MESSAGE_A
  122. #define FTPD_EXIT_MESSAGE FTPD_EXIT_MESSAGE_A
  123. #define FTPD_MAX_CLIENTS_MSG FTPD_MAX_CLIENTS_MSG_A
  124. #define FTPD_DEBUG_FLAGS FTPD_DEBUG_FLAGS_A
  125. #define FTPD_ANNOTATE_DIRS FTPD_ANNOTATE_DIRS_A
  126. #define FTPD_ANONYMOUS_SECRET FTPD_ANONYMOUS_SECRET_A
  127. #define FTPD_LOWERCASE_FILES FTPD_LOWERCASE_FILES_A
  128. #define FTPD_LISTEN_BACKLOG FTPD_LISTEN_BACKLOG_A
  129. #define FTPD_ENABLE_LICENSING FTPD_ENABLE_LICENSING_A
  130. #define FTPD_DEFAULT_LOGON_DOMAIN FTPD_DEFAULT_LOGON_DOMAIN_A
  131. #endif // UNICODE
  132. //
  133. // Structures for APIs
  134. //
  135. typedef struct _FTP_USER_INFO
  136. {
  137. DWORD idUser; // User id
  138. LPWSTR pszUser; // User name
  139. BOOL fAnonymous; // TRUE if the user is logged on as
  140. // Anonymous, FALSE otherwise
  141. DWORD inetHost; // Host Address
  142. DWORD tConnect; // User Connection Time (elapsed seconds)
  143. } FTP_USER_INFO, * LPFTP_USER_INFO;
  144. typedef struct _FTP_STATISTICS_0
  145. {
  146. LARGE_INTEGER TotalBytesSent;
  147. LARGE_INTEGER TotalBytesReceived;
  148. DWORD TotalFilesSent;
  149. DWORD TotalFilesReceived;
  150. DWORD CurrentAnonymousUsers;
  151. DWORD CurrentNonAnonymousUsers;
  152. DWORD TotalAnonymousUsers;
  153. DWORD TotalNonAnonymousUsers;
  154. DWORD MaxAnonymousUsers;
  155. DWORD MaxNonAnonymousUsers;
  156. DWORD CurrentConnections;
  157. DWORD MaxConnections;
  158. DWORD ConnectionAttempts;
  159. DWORD LogonAttempts;
  160. DWORD TimeOfLastClear;
  161. } FTP_STATISTICS_0, * LPFTP_STATISTICS_0;
  162. //
  163. // API Prototypes
  164. //
  165. NET_API_STATUS
  166. I_FtpEnumerateUsers(
  167. IN LPWSTR pszServer OPTIONAL,
  168. OUT LPDWORD lpdwEntriesRead,
  169. OUT LPFTP_USER_INFO * Buffer
  170. );
  171. NET_API_STATUS
  172. I_FtpDisconnectUser(
  173. IN LPWSTR pszServer OPTIONAL,
  174. IN DWORD idUser
  175. );
  176. NET_API_STATUS
  177. I_FtpQueryVolumeSecurity(
  178. IN LPWSTR pszServer OPTIONAL,
  179. OUT LPDWORD lpdwReadAccess,
  180. OUT LPDWORD lpdwWriteAccess
  181. );
  182. NET_API_STATUS
  183. I_FtpSetVolumeSecurity(
  184. IN LPWSTR pszServer OPTIONAL,
  185. IN DWORD dwReadAccess,
  186. IN DWORD dwWriteAccess
  187. );
  188. NET_API_STATUS
  189. I_FtpQueryStatistics(
  190. IN LPWSTR pszServer OPTIONAL,
  191. IN DWORD Level,
  192. OUT LPBYTE * Buffer
  193. );
  194. NET_API_STATUS
  195. I_FtpClearStatistics(
  196. IN LPWSTR pszServer OPTIONAL
  197. );
  198. #ifdef __cplusplus
  199. }
  200. #endif // _cplusplus
  201. #endif // _FTPD_H_