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.

213 lines
8.7 KiB

  1. // telnetd.h : This file contains the
  2. // Created: Jan '98
  3. // Author : a-rakeba
  4. // History:
  5. // Copyright (C) 1998 Microsoft Corporation
  6. // All rights reserved.
  7. // Microsoft Confidential
  8. #ifndef _TELNETD_H_
  9. #define _TELNETD_H_
  10. #include <Telnet.h>
  11. //FOR XPSP1. If the message ids are not defined, hardcode them using the range specified by
  12. //xpsp1msg.mc
  13. #ifndef TELNET_MSG_ERROR_CREATE_DESKTOP_FAILURE
  14. #define TELNET_MSG_ERROR_CREATE_DESKTOP_FAILURE 6001
  15. #endif
  16. #ifndef TELNET_MSG_REVERTSELFFAIL
  17. #define TELNET_MSG_REVERTSELFFAIL 6002
  18. #endif
  19. #define SERVICE_DISPLAY_NAME _T("Telnet")
  20. #define APPID _T("{FE9E4896-A014-11D1-855C-00A0C944138C}")
  21. #define REG_SERVER_KEY L"Software\\Microsoft\\TelnetServer"
  22. #define REG_PARAMS_KEY L"Software\\Microsoft\\TelnetServer\\1.0"
  23. #define READ_CONFIG_KEY L"Software\\Microsoft\\TelnetServer\\1.0\\ReadConfig"
  24. #define REG_DEFAULTS_KEY L"Software\\Microsoft\\TelnetServer\\Defaults"
  25. #define REG_SERVICE_KEY L"System\\CurrentControlSet\\Services\\TlntSvr"
  26. #define REG_WINNT_VERSION L"Software\\Microsoft\\Windows NT\\CurrentVersion"
  27. #define REG_PRODUCT_OPTION L"System\\CurrentControlSet\\Control\\ProductOptions"
  28. #define REG_CONSOLE_KEY L".DEFAULT\\Console"
  29. #define REG_LOCALSERVICE_CONSOLE_KEY L"Console"
  30. #define SWITCH_TO_KEEP_SHELL_RUNNING L"SwitchToKeepShellRunning"
  31. #define SWITCH_FOR_ONE_TIME_USE_OF_SHELL L"SwitchForOneTimeUseOfShell"
  32. #define WINDOW_STATION_NAME L"MicrosoftTelnetSrvWinSta"
  33. #define PRE_SESSION_STATE_TIMEOUT 100000
  34. #define NO_NTLM 4 //Old Val 0
  35. #define NTLM_ELSE_OR_LOGIN 6 //Old val 1
  36. #define NTLM_ONLY 2 //Old val 2
  37. #define LATEST_TELNET_VERSION 5
  38. #define DEFAULT_ALLOW_TRUSTED_DOMAIN 1
  39. #define DEFAULT_DOMAIN L"."
  40. #define DEFAULT_TELNET_PORT 23
  41. #define DEFAULT_SHELL L"%SYSTEMROOT%\\System32\\cmd.exe"
  42. #define DEFAULT_SWITCH_TO_KEEP_SHELL_RUNNING L"/q /k"
  43. #define DEFAULT_SWITCH_FOR_ONE_TIME_USE_OF_SHELL L"/q /c"
  44. #define DEFAULT_LOGIN_SCRIPT L"login.cmd"
  45. #define DEFAULT_SCRAPER_PATH L"tlntsess.exe"
  46. #ifdef WHISTLER_BUILD
  47. #define DEFAULT_MAX_CONNECTIONS 2
  48. #else
  49. #define DEFAULT_MAX_CONNECTIONS 63
  50. #endif
  51. #define DEFAULT_MAX_FAILED_LOGINS 3
  52. #define DEFAULT_LICENSES_FOR_NTWKSTA 10
  53. #define DEFAULT_SYSAUDITING 1
  54. #define DEFAULT_LOGFILE L""
  55. #define DEFAULT_LOGTOFILE 0
  56. #define DEFAULT_LOGEVENTS 0
  57. #define DEFAULT_LOGADMIN 1
  58. #define DEFAULT_LOGFAILURES 0
  59. #define DEFAULT_ALT_KEY_MAPPING 0x01
  60. #define ALT_KEY_MAPPING_ON 1
  61. #define ALT_KEY_MAPPING_OFF 0
  62. #define DEFAULT_IDLE_SESSION_TIME_OUT 60*60 // One hour
  63. #define DEFAULT_DISCONNECT_KILLALL_APPS 1
  64. #define DEFAULT_SECURITY_MECHANISM 6 //old value 1
  65. #define DEFAULT_IP_ADDR _T("INADDR_ANY")
  66. #define DEFAULT_SERVICE_DEPENDENCY _T("RPCSS\000TCPIP\000NTLMSSP\000")
  67. #define CONSOLE_MODE 1
  68. #define STREAM_MODE 2
  69. #define IPV4_FAMILY 0
  70. #define IPV6_FAMILY 1
  71. #define DEFAULT_MODE_OF_OPERATION CONSOLE_MODE
  72. #define DEFAULT_LOGFILESIZE 5 // MB
  73. #define LOGFILESIZE L"LogFileSize"
  74. #define PIPE_NAME_FORMAT_STRING L"\\\\.\\pipe\\telnetd\\%08x"
  75. //The following messages are present in a .h file and should not be moved to .rc file.
  76. //These messages should not be localized since they are passed from server to a client machine
  77. //and both these machines can be in different locales which would create problems for displaying
  78. //the localized messages. The messages should be in English.
  79. #define LOGIN_BANNER "Welcome to Microsoft Telnet Service \r\n"
  80. #define LOGIN_REQUEST "\n\rlogin: "
  81. #define PASS_REQUEST "\n\rpassword: "
  82. #define LOGIN_FAIL "\r\nLogin Failed\r\n"
  83. #define LOGIN_SUCC "\r\nLogin Successful\r\n"
  84. #define TERMINATE "\r\nTelnet Server has closed the connection\r\n"
  85. #define LONG_SESSION_DATA "\r\nThe Input line is too long.\r\n"
  86. #define NTWKSTA_LICENSE_LIMIT "\r\nWorkstation allows only 10 simultaneous telnet connections.\r\n"
  87. #define NTSVR_LICENSE_LIMIT "\r\nNo server licenses are available for connecting to the telnet server."
  88. #define TELNETCLIENTS_GROUP_NAME L"TelnetClients"
  89. #define NOT_MEMBER_OF_TELNETCLIENTS_GROUP_STR "\r\nAccess Denied: Specified user is not a member of TelnetClients group.\r\nServer administrator must add this user to the above group.\r\n"
  90. #define NTLM_ONLY_STR "\r\nTelnet Server is configured to use NTLM authentication only.\r\nContact your administrator to enable username/password authentication.\r\n"
  91. #define TIMEOUT_STR "Session timed out."
  92. #define NTLM_REJECT_STR "\r\nNTLM Authentication failed due to insufficient credentials."
  93. #define USE_PASSWD "\r\nLogin using username and password\r\n\r\n"
  94. #define NO_GUEST_STR "\r\nTelnet connection not allowed to the Guest account\r\n"
  95. #define BAD_USERNAME_STR "\r\nBad format for username. Use 'username' or 'domain\\username' format to login.\r\n"
  96. #define CREATE_TLNTSESS_FAIL_MSG "\r\nTelnet Server failed to initialize a Telnet Session.Please contact your system administrator for assistance.\r\n"
  97. #define BUGGY_SESSION_DATA "\r\nSession data from client is not as expected\r\n"
  98. #if BETA
  99. #define LICENSE_EXPIRED_STR "\r\nThe Microsoft Telnet Service License has expired.\r\n"
  100. #endif //BETA
  101. //The following bunch of msgs are for session only. Move them to its rc
  102. #define LICENSE_LIMIT_REACHED L"Denying new connections. Maximum number of allowed connections are currently in use."
  103. #define SERVER_SHUTDOWN_MSG L"Telnet server is shutting down......\r\n"
  104. #define GO_DOWN_MSG L"Administrator on the server has terminated this session......\r\n"
  105. #define SYSTEM_SHUTDOWN_MSG L"\r\nThe computer is shutting down......\r\n"
  106. #define SESSION_INIT_FAIL "\r\nFailure in initializing the telnet session. Shell process may not have been launched.\r\n"
  107. #define NTLM_LOGON_FAIL "\r\nTelnet server could not log you in using NTLM authentication."
  108. #define NO_AUTHENTICATING_AUTHORITY "\r\nServer was unable to contact your domain controller"
  109. #define INVALID_TOKEN_OR_HANDLE "\\r\nIf this error persists, contact your system administrator."
  110. #define LOGON_DENIED "\r\nYour password may have expired."
  111. // Ascii/ANSI Codes
  112. #define ASCII_BACKSPACE 8
  113. #define ASCII_LINEFEED 10
  114. #define ASCII_CARRIAGE 13
  115. #define ASCII_SPACE 32
  116. #define ASCII_DELETE 127
  117. #define WILL_OPTION(p, c) { p[0] = TC_IAC; p[1] = TC_WILL; p[2] = c; p[3] = NULL; }
  118. #define WONT_OPTION(p, c) { p[0] = TC_IAC; p[1] = TC_WONT; p[2] = c; p[3] = NULL ; }
  119. #define DO_OPTION(p, c) { p[0] = TC_IAC; p[1] = TC_DO; p[2] = c; p[3] = NULL;}
  120. #define DONT_OPTION(p, c) { p[0] = TC_IAC; p[1] = TC_DONT; p[2] = c; p[3] = NULL;}
  121. #define AUTH_WHO_MASK 1
  122. #define AUTH_CLIENT_TO_SERVER 0
  123. #define AUTH_SERVER_TO_CLIENT 1
  124. #define AUTH_HOW_MASK 2
  125. #define AUTH_HOW_ONE_WAY 0
  126. #define AUTH_HOW_MUTUAL 2
  127. #define DO_AUTH_SUB_NE_NTLM(p) {\
  128. p[0] = TC_IAC;\
  129. p[1] = TC_SB;\
  130. p[2] = TO_AUTH;\
  131. p[3] = AU_SEND;\
  132. p[4] = AUTH_TYPE_NTLM;\
  133. p[5] = AUTH_CLIENT_TO_SERVER | AUTH_HOW_ONE_WAY; \
  134. p[6] = TC_IAC;\
  135. p[7] = TC_SE; }
  136. #define DO_TERMTYPE_SUB_NE(p) {\
  137. p[0] = TC_IAC;\
  138. p[1] = TC_SB;\
  139. p[2] = TO_TERMTYPE;\
  140. p[3] = TT_SEND;\
  141. p[4] = TC_IAC;\
  142. p[5] = TC_SE; }
  143. #define USER "USER"
  144. #define SFUTLNTVER "SFUTLNTVER"
  145. #define SFUTLNTMODE "SFUTLNTMODE"
  146. #define DO_NEW_ENVIRON_SUB_NE_MY_VARS( p, TelnetOption, Index ) {\
  147. p[ Index++ ] = TC_IAC;\
  148. p[ Index++ ] = TC_SB;\
  149. p[ Index++ ] = TelnetOption;\
  150. p[ Index++ ] = SEND;\
  151. p[ Index++ ] = USERVAR;\
  152. /* NO issue, Baskar */strcpy( ( char *)p+Index, SFUTLNTVER );\
  153. Index += strlen( SFUTLNTVER );\
  154. p[ Index++ ] = USERVAR;\
  155. /* No Issue, Baskar */strcpy( ( char *)p+Index, SFUTLNTMODE );\
  156. Index += strlen( SFUTLNTMODE );\
  157. p[ Index++ ] = TC_IAC;\
  158. p[ Index++ ] = TC_SE; }
  159. #define DO_NEW_ENVIRON_SUB_NE( p, TelnetOption, Index ) {\
  160. p[ Index++ ] = TC_IAC;\
  161. p[ Index++ ] = TC_SB;\
  162. p[ Index++ ] = TelnetOption;\
  163. p[ Index++ ] = SEND;\
  164. p[ Index++ ] = TC_IAC;\
  165. p[ Index++ ] = TC_SE; }
  166. #define DISABLED 0
  167. #define ENABLED 1
  168. //Add other FAREAST languages
  169. #define JAP_CODEPAGE 932
  170. #define CHS_CODEPAGE 936
  171. #define KOR_CODEPAGE 949
  172. #define CHT_CODEPAGE 950
  173. #define JAP_FONTSIZE 786432
  174. #define CHT_FONTSIZE 917504
  175. #define KOR_FONTSIZE 917504
  176. #define CHS_FONTSIZE 917504
  177. #define NEW_LINE "\r\n"
  178. #define MAX_POLL_INTERVAL 2000 //Milli Secs
  179. #define ONE_MB 1024*1024
  180. #endif _TELNETD_H_