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.

142 lines
9.3 KiB

  1. #include <windows.h>
  2. #include "resource.h"
  3. #include "cmdlineres.h"
  4. #include "cmdline.rc"
  5. /////////////////////////////////////////////////////////////////////////////
  6. //
  7. // String Table
  8. //
  9. STRINGTABLE DISCARDABLE
  10. BEGIN
  11. IDS_USAGE_BEGINING "\nTAKEOWN [/S system [/U username [/P [password]]]]\n"
  12. IDS_USG_1 " /F filename [/A] [/R [/D prompt]]\n\n"
  13. IDS_USG_2 "Description:\n"
  14. IDS_USG_3 " This tool allows an administrator to recover access to a file that\n"
  15. IDS_USG_4 " was denied by re-assigning file ownership.\n\n"
  16. IDS_USG_5 ""
  17. IDS_USG_6 "Parameter List: \n"
  18. IDS_USG_7 " /S system Specifies the remote system to\n"
  19. IDS_USG_8 " connect to.\n\n"
  20. IDS_USG_9 ""
  21. IDS_USG_10 " /U [domain\\]user Specifies the user context under\n"
  22. IDS_USG_11 " which the command should execute.\n\n"
  23. IDS_USG_12 ""
  24. IDS_USG_13 " /P [password] Specifies the password for the\n"
  25. IDS_USG_14 " given user context.\n"
  26. IDS_USG_15 " Prompts for input if omitted.\n\n"
  27. IDS_USG_16 ""
  28. IDS_USG_17 " /F filename Specifies the filename or directory\n"
  29. IDS_USG_18 " name pattern. Wildcard ""*"" can be used\n"
  30. IDS_USG_19 " to specify the pattern. Allows\n"
  31. IDS_USG_20 " sharename\filename.\n\n"
  32. IDS_USG_21 ""
  33. IDS_USG_22 " /A Gives ownership to the administrators\n"
  34. IDS_USG_23 " group instead of the current user.\n\n"
  35. IDS_USG_24 ""
  36. IDS_USG_25 " /R Recurse: instructs tool to operate on\n"
  37. IDS_USG_26 " files in specified directory and all \n"
  38. IDS_USG_27 " subdirectories.\n\n"
  39. IDS_USG_28 ""
  40. IDS_USG_29 " /D prompt Default answer used when the current user\n"
  41. IDS_USG_30 " does not have the ""list folder"" permission\n"
  42. IDS_USG_31 " on a directory. This occurs while operating\n"
  43. IDS_USG_32 " recursively (/R) on sub-directories. Valid \n"
  44. IDS_USG_33 " values ""Y"" to take ownership or ""N"" to skip.\n\n"
  45. IDS_USG_34 ""
  46. IDS_USG_35 ""
  47. IDS_USG_36 " /? Displays this help message.\n\n"
  48. IDS_USG_37 ""
  49. IDS_USG_38 " NOTE: 1) If /A is not specified, file ownership will be given to the\n"
  50. IDS_USG_39 " current logged on user.\n\n"
  51. IDS_USG_40 " 2) Mixed patterns using ""?"" and ""*"" are not supported.\n\n"
  52. IDS_USG_41 " 3) /D is used to suppress the confirmation prompt.\n\n"
  53. IDS_USG_42 ""
  54. IDS_USG_43 ""
  55. IDS_USG_44 "Examples: \n"
  56. IDS_USG_45 " TAKEOWN /?\n"
  57. IDS_USG_46 " TAKEOWN /F lostfile\n"
  58. IDS_USG_47 " TAKEOWN /F \\\\system\share\lostfile /A\n"
  59. IDS_USG_48 " TAKEOWN /F directory /R /D N\n"
  60. IDS_USG_49 " TAKEOWN /F directory /R /A\n"
  61. IDS_USG_50 " TAKEOWN /F *\n"
  62. IDS_USG_51 " TAKEOWN /F C:\\Windows\\System32\\acme.exe\n"
  63. IDS_USG_52 " TAKEOWN /F %windir%\\*.txt\n"
  64. IDS_USG_53 " TAKEOWN /S system /F MyShare\\Acme*.doc\n"
  65. IDS_USG_54 " TAKEOWN /S system /U user /F MyShare\foo.dll\n"
  66. IDS_USG_55 " TAKEOWN /S system /U domain\\user /P password /F share\filename\n"
  67. IDS_USG_56 " TAKEOWN /S system /U user /P password /F Doc\Report.doc /A\n"
  68. IDS_USG_57 " TAKEOWN /S system /U user /P password /F Myshare\* \n"
  69. IDS_USG_58 " TAKEOWN /S system /U user /P password /F Home\Logon /R\n"
  70. IDS_USG_59 " TAKEOWN /S system /U user /P password /F Myshare\directory /R /A\n"
  71. IDS_USAGE_ENDING ""
  72. END
  73. STRINGTABLE DISCARDABLE
  74. BEGIN
  75. IDS_USER_NMACHINE "ERROR: Invalid syntax. /U can be specified only when /S is specified.\nType ""TAKEOWN /?"" for usage.\n"
  76. IDS_PASSWORD_NUSER "ERROR: Invalid syntax. /P can be specified only when /U is specified.\nType ""TAKEOWN /?"" for usage.\n"
  77. IDS_NULL_SERVER "ERROR: Invalid syntax. System name cannot be empty.\n"
  78. IDS_NULL_USER "ERROR: Invalid syntax. User name cannot be empty.\n"
  79. IDS_INVALID_WILDCARD "ERROR: For remote machine, wildcard (*) is acceptable in ""share\*"" format only.\n"
  80. IDS_SYNTAX_ERROR "ERROR: Invalid syntax.\nType ""TAKEOWN /?"" for usage.\n"
  81. IDS_NULL_FILENAME "ERROR: File name cannot be blank.\n"
  82. IDS_NOT_ADMINISTRATOR "ERROR: The current logged on user does not have administrative privileges.\n"
  83. IDS_SYSTEM_ERROR "ERROR: An unexpected error has occurred.\n"
  84. IDS_ACCESS_DENIED "ERROR: The user does not have access to the requested file (or folder).\n"
  85. IDS_ACCESS_VIOLATION "ERROR: An access violation has occurred.\n"
  86. IDS_IGNORE_LOCALCREDENTIALS "\nWARNING: User credentials cannot be used for local connections.\n"
  87. IDS_INVALID_SID "ERROR: The Security ID is invalid.\n"
  88. IDS_INVALID_DRIVE "ERROR: The specified drive is invalid.\n"
  89. IDS_NO_FILES_AVAILABLE "\nINFO: There are no files (or folders) found in the specified file path.\n"
  90. IDS_ERROR_MEMORY_ALLOC "ERROR: Memory allocation failed.\n"
  91. IDS_ERROR_STARRECURSIVE "ERROR: /R and pattern cannot be specified together.\n "
  92. IDS_NOT_OWNERSHIP "ERROR: The current logged on user does not have ownership privileges.\n"
  93. IDS_NOT_OWNERSHIP_INFO "\nINFO: The current logged on user does not have ownership privileges on\n the file (or folder): ""%s"".\n "
  94. IDS_INVALID_DIRECTORY "ERROR: The specified path is not a valid directory path.\n"
  95. IDS_ACCESS_DENIED_ERROR "ERROR: You do not have permissions to list items in the requested folder.\n"
  96. IDS_GIVE_FULL_PERMISSIONS "\nYou do not have permissions to read the contents of directory ""%s"". \n"
  97. IDS_GIVE_FULL_PERMISSIONS2 "Do you want to replace the directory permissions with permissions granting you\nfull control (""Y"" for YES, ""N"" for NO or ""C"" to CANCEL)? "
  98. IDS_LOWER_YES "y"
  99. IDS_NOT_OWNERSHIP_ERROR "ERROR: The current logged on user does not have ownership privileges on\n the file (or folder) ""%s"".\n "
  100. IDS_LOWER_NO "n"
  101. IDS_LOWER_CANCEL "c"
  102. IDS_IGNORE_CREDENTIALS "\nWARNING: Ignoring user credentials for performing the operation.\n"
  103. IDS_SHARING_VIOLATION_ERROR "ERROR: The file ""%s"" cannot be accessed because it is being used by another application.\n"
  104. IDS_SHARING_VIOLATION_INFO "\nINFO: The file ""%s"" cannot be accessed because it is being used by another application.\n"
  105. IDS_FAT_VOLUME "ERROR: File ownership cannot be applied on insecure file systems (FAT32);\n there is no support for ACLs.\n"
  106. IDS_FAT_VOLUME_INFO "\nINFO: File ownership cannot be applied to file or folder ""%s""; insecure file systems (FAT32) do not support ACLs.\n"
  107. IDS_INVALID_USERNAME "ERROR: Invalid user name.\n"
  108. IDS_NO_OWNER_REMOVABLE_MEDIA "ERROR: Ownership cannot be applied on removable media.\n"
  109. IDS_NO_PATTERN_FOUND "\nINFO: There are no files (or folders) found with the specified pattern.\n"
  110. IDS_CONFIRM_ERROR "ERROR: /D should be specified only with /R.\n"
  111. IDS_YESNO "Y|N"
  112. END
  113. STRINGTABLE DISCARDABLE
  114. BEGIN
  115. IDS_FILE_PROTECTION_SUCCESSFUL "\nSUCCESS: The file (or folder): ""%s"" now owned by the administrators group.\n"
  116. IDS_FILE_PROTECTION_SUCCESSFUL_USER "\nSUCCESS: The file (or folder): ""%s"" now owned by user ""%s"".\n"
  117. END
  118. STRINGTABLE DISCARDABLE
  119. BEGIN
  120. IDS_TYPE_REQUEST "Type ""TAKEOWN /?"" for usage.\n"
  121. IDS_NO_DEFAULT_ARG "File name or pattern must be specified.\n"
  122. IDS_ERROR_PATH_NAME "ERROR: File or Directory not found.\n"
  123. END
  124. //
  125. // Version resources
  126. //
  127. #include <ntverp.h>
  128. #define VER_FILETYPE VFT_APP
  129. #define VER_FILESUBTYPE VFT2_UNKNOWN
  130. #define VER_FILEDESCRIPTION_STR "Takes ownership of a file"
  131. #define VER_INTERNALNAME_STR "takeown.exe"
  132. #define VER_ORIGINALFILENAME_STR "takeown.exe"
  133. #include <common.ver>