#include "resource.h"
#include "windows.h"
#include "cmdlineres.h"

#include "cmdline.rc"
 

/////////////////////////////////////////////////////////////////////////////
// String Table
//


STRINGTABLE DISCARDABLE 
BEGIN
    IDS_FAILURE             "FAILURE: "
    IDS_ERROR_DISCONNECT    "ERROR: Could not disconnect the open file ""%s"".\n"
    IDS_INVALID_SYNTAX      "Invalid syntax.\nType ""%s /?"" for usage.\n"
    IDS_AUTHENTICATION_FAILURE 
                            "ERROR: The current or specified user name and password were not valid or authorized to make the connection.\n"
    IDS_INVALID_SERVER_NAME "Invalid server name.\n"
    IDS_HEADER_NOT_ALLOWED  "ERROR: Invalid Syntax. /NH option is allowed only for TABLE and CSV formats.\n"
    IDS_ERROR_USERNAME_BUT_NOMACHINE 
                            "ERROR: Invalid Syntax. /U option can be specified only when /S option is specified.\n"
    IDS_ERROR_PASSWORD_BUT_NOUSERNAME 
                            "ERROR: Invalid Syntax. /P option can be specified only when /U option is specified.\n"
    IDS_NO_ID_ACC_OF        "ERROR: Invalid Syntax. No /ID or /A or /O parameter present.\n"
    IDS_ERROR_ID            "ERROR: Invalid ID.\n"
    IDS_ID_SHOW_ERROR       "ERROR: "
    IDS_INTERNAL_FAILURE    "ERROR: Unable to retrive data.\n"
    IDS_ACCESS_DENIED       "ERROR: Access is denied.\n"
    IDS_INVALID_CREDENTIALS "ERROR: Could not connect to the specified system with the given credentials or Invalid credentials specified\n"
  	IDS_SERVER_EMPTY        "ERROR: Invalid syntax. System name cannot be empty.\n"
	IDS_USERNAME_EMPTY      "ERROR: Invalid syntax. User name cannot be empty.\n"
	IDS_INVALID_OS          "ERROR: The Target system must be running Windows XP or above.\n"
    IDS_ACCESSBY_EMPTY      "ERROR: Invalid syntax. Accessed by cannot be empty.\n"
    IDS_OPEN_FILE_EMPTY     "ERROR: Invalid syntax. File name cannot be empty.\n"
	IDS_ERROR_SYSTEM_INFO   "ERROR: Unable to get system type Information.\n"
    IDS_ERROR_VERSION_MISMATCH  "ERROR: The target system must be running a 32 bit OS.\n"
	IDS_REMOTE_NOT_SUPPORTED    "ERROR: Remote Open files is not supported for 64 bit machines.\n"
	IDS_ERROR_VERSION_MISMATCH1  "ERROR: The target system must be running a 64 bit OS.\n"
	IDS_REMOTE_NOT_SUPPORTED1    "ERROR: Remote Open files is not supported for 32 bit machines.\n"
END
STRINGTABLE DISCARDABLE 
BEGIN
    IDS_SUCCESS             "SUCCESS: "
    IDS_NO_OPENFILES        "INFO: No shared open files found.\n"
    IDS_NO_D_OPENFILES      "INFO: There are no shared open files found with the specified criteria.\n"
END
STRINGTABLE DISCARDABLE 
BEGIN
	IDS_FILE_ARCHIVE        " Archive"
	IDS_FILE_COMPRESSED     " Compressed"
	IDS_FILE_ENCRYPTED      " Encrypted"
	IDS_FILE_HIDDEN         " Hidden"
	IDS_FILE_NORMAL         " Normal"
	IDS_FILE_OFFLINE        " Offline"
	IDS_FILE_READONLY       " Readonly"
	IDS_FILE_DIRECTORY      " Directory"
END

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_UTILITY_NAME        "OPENFILES" 
    IDS_OPENMODE_OPTION     "read|write|read/write|*"
    IDS_STRING_HOSTNAME     "Hostname"
    IDS_STRING_ID           "ID"
    IDS_STRING_ACCESSED_BY  "Accessed By"
    IDS_STRING_TYPE         "Type"
    IDS_STRING_LOCK         "#Locks"
    IDS_STRING_OPEN_MODE    "Open Mode"
    IDS_STRING_OPEN_FILE    "Open File (Path\\executable)"
    IDS_STRING_WINDOWS      "Windows"
    IDS_STRING_UNKNOWN      "Unknown"
    IDS_READ                "Read"
    IDS_WRITE               "Write"
    IDS_READ_WRITE          "Write + Read"
    IDS_FORMAT_OPTIONS      "list|csv|table"
    IDS_LIST                "LIST"
    IDS_CSV                 "CSV"
    IDS_READ_SLASH_WRITE    "Read/Write"
    IDS_WRITE_SLASH_READ    "Write/Read"
    IDS_MAC_OS              "Macintosh" 
	IDS_LOCAL_OPEN_FILES    "\nFiles Opened Locally:\n"
	IDS_LOCAL_OPEN_FILES_SP1 "---------------------\n\n"
	IDS_SHARED_OPEN_FILES   "\n\nFiles Opened Remotely via local share points:\n"
	IDS_LOCAL_OPEN_FILES_SP2 "---------------------------------------------\n" 
	IDS_WAIT                "Please wait. Getting data ..." 
	IDS_STRING_PROCESS_ID   "ProcessID" 
	IDS_STRING_PROCESS_NAME "Process Name"
	IDS_FILE_TYPE            "Type"
    IDS_LOCAL_OPTION         "on|off"
    IDS_LOCAL_ON             "ON"
    IDS_LOCAL_OFF            "OFF"
END 
STRINGTABLE DISCARDABLE 
BEGIN
	IDS_ID_SHOW_WARNING     "WARNING: "
    IDS_LOCAL_SYSTEM        "WARNING: Ignoring the user credentials for the local connection.\n" 
    IDS_LOCAL_NEEDS_TO_SET  "\nINFO: The system global flag 'maintain objects list' needs to be enabled to see local opened files. See Openfiles /? for more information.\n"
    IDS_LOCAL_FLG_SET       "\nSUCCESS: The system global flag 'maintain objects list' is enabled.\n         This will take effect after the system is restarted.\n"  
    IDS_LOCAL_FLG_RESET     "\nSUCCESS: The system global flag 'maintain objects list' is disabled..\n         This will take effect after the system is restarted.\n"
    IDS_LOCAL_FLG_ALREADY_SET   "\nINFO: The system global flag 'maintain objects list' is currently enabled.\n"
    IDS_LOCAL_FLG_ALREADY_RESET "\nINFO: The system global flag 'maintain objects list' is currently disabled.\n"
END 
STRINGTABLE DISCARDABLE 
BEGIN
    IDS_HELP_LINE1          "\nOPENFILES /Disconnect [/S system [/U username [/P [password]]]]\n"
    IDS_HELP_LINE2          "                      {[/ID id] [/A accessedby] [/O openmode]}\n"
    IDS_HELP_LINE3          "                      [/OP openfile]\n\n"
    IDS_HELP_LINE5          "Description:\n"
    IDS_HELP_LINE6          "    Enables an administrator to disconnect files and folders that have\n"
    IDS_HELP_LINE7          "    been opened remotely through a shared folder.\n\n"
    IDS_HELP_LINE8          "Parameter List:\n"
    IDS_HELP_LINE9          "    /S     system         Specifies the remote system to connect to.\n\n"
    IDS_HELP_LINE10         "    /U     [domain\]user  Specifies the user context under which the\n"
    IDS_HELP_LINE11         "                          command should execute.\n\n"
    IDS_HELP_LINE12         "    /P     [password]     Specifies the password for the given user\n"
    IDS_HELP_LINE13         "                          context. Prompts for input if omitted.\n\n"
END

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_HELP_LINE14         "    /ID    open file ID   Specifies to disconnect open files by file ID.\n"
    IDS_HELP_LINE15         "                          The ""*"" wildcard may be used.\n\n"
    IDS_HELP_LINE16         "    /A     username       Specifies to disconnect all open files by\n"
    IDS_HELP_LINE17         "                          ""accessed by"" value. The ""*"" wildcard\n"
    IDS_HELP_LINE18         "                          may be used.\n\n"
    IDS_HELP_LINE19         "    /O     open mode      Specifies to disconnect all open files by\n"
    IDS_HELP_LINE20         "                          ""openmode"" value. Valid values are Read,\n"
    IDS_HELP_LINE21         "                          Write or Read/Write. The ""*"" wildcard\n"
    IDS_HELP_LINE22         "                          may be used."
    IDS_HELP_LINE23         " "
    IDS_HELP_LINE24         " "
END

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_HELP_LINE25         "\n\n"
    IDS_HELP_LINE26         "    /OP    open file      Specifies to disconnect all open file\n"
    IDS_HELP_LINE27         "                          connections created by a specific ""open\n"
    IDS_HELP_LINE28         "                          file"" name. The ""*"" wildcard may be used.\n\n"
    IDS_HELP_LINE29    		"    /?                    Displays this help/usage.\n\n"
    IDS_HELP_LINE30         "Examples:\n"
    IDS_HELP_LINE31         "    OPENFILES /Disconnect /?\n"
    IDS_HELP_LINE32         "    OPENFILES /Disconnect /ID 1\n"
    IDS_HELP_LINE33         "    OPENFILES /Disconnect /A  username\n"
    IDS_HELP_LINE34         "    OPENFILES /Disconnect /O Read/Write\n"
    IDS_HELP_LINE35         "    OPENFILES /Disconnect /OP ""c:\\My Documents\\somedoc.doc"" /ID 234\n"
    IDS_HELP_LINE36         "    OPENFILES /Disconnect /S system  /U username /ID 5\n"
    IDS_HELP_LINE_END       "    OPENFILES /Disconnect /S system  /U username /P password /ID *\n"
END

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_SUCCESS_DISCONNECT "SUCCESS: The connection to the open file ""%s"" has successfully been terminated.\n"
END

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_HELP_MAIN1         "\nOPENFILES /parameter [arguments]\n\n"
    IDS_HELP_MAIN2         "Description:\n"
    IDS_HELP_MAIN3         "    Enables an administrator to list or disconnect files and folders\n"
    IDS_HELP_MAIN4         "    that have been opened on a system.\n\n"
    IDS_HELP_MAIN5         "Parameter List:\n"
    IDS_HELP_MAIN6         "    /Disconnect      Disconnects one or more open files.\n\n"
    IDS_HELP_MAIN7         "    /Query           Displays files opened locally or from shared folders.\n\n"
    IDS_HELP_MAIN8         "    /Local           Enables / Disables the display of local open files.\n"
    IDS_HELP_MAIN9         "                     Note: Enabling this flag adds performance overhead.\n\n" 
    IDS_HELP_MAIN10         "Examples:\n"
    IDS_HELP_MAIN11        "    OPENFILES /Disconnect /?\n"
    IDS_HELP_MAIN12        "    OPENFILES /Query /?\n"
    IDS_HELP_MAIN_END      "    OPENFILES /Local /?\n"
END

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_HELP_QUERY1         "\nOPENFILES /Query  [/S system [/U username [/P [password]]]]\n"
    IDS_HELP_QUERY2         "                  [/FO format] [/NH] [/V]\n\n"
    IDS_HELP_QUERY3         "Description:\n"
    IDS_HELP_QUERY4         "    Enables an administrator to display a list of files and folders that\n"
    IDS_HELP_QUERY5	    "    have been opened on a system.\n\n"
    IDS_HELP_QUERY6         "Parameter List:\n"
    IDS_HELP_QUERY7         "    /S      system         Specifies the remote system to connect to.\n\n"
    IDS_HELP_QUERY8         "    /U      [domain\]user  Specifies the user context under which\n"
    IDS_HELP_QUERY9         "                           the command should execute.\n\n"
END

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_HELP_QUERY10        "    /P      [password]     Specifies the password for the given user\n"
    IDS_HELP_QUERY11        "                           context. Prompts for input if omitted.\n\n"
    IDS_HELP_QUERY12        "    /FO     format         Specifies the format in which the output is\n"
    IDS_HELP_QUERY13        "                           to be displayed.\n"
    IDS_HELP_QUERY14        "                           Valid values: ""TABLE"",""LIST"",""CSV"".\n\n"
    IDS_HELP_QUERY15        "    /NH                    Specifies that the ""Column Header"" should\n"
    IDS_HELP_QUERY16        "                           not be displayed in the output.\n"
    IDS_HELP_QUERY17        "                           Valid only for ""TABLE"" and ""CSV"" formats.\n\n"
    IDS_HELP_QUERY18        "    /V                     Specifies that the detailed information\n"
    IDS_HELP_QUERY19        "                           should be displayed in the output.\n\n"
  	IDS_HELP_QUERY20   		"    /?                     Displays this help/usage.\n\n"    
    IDS_HELP_QUERY21        "Examples:\n"
    IDS_HELP_QUERY22        "   OPENFILES /?\n"
    IDS_HELP_QUERY23        "   OPENFILES /Query\n"
    IDS_HELP_QUERY24        "   OPENFILES /Query /FO csv /NH\n"
    IDS_HELP_QUERY25        "   OPENFILES /Query /FO LIST /V\n"
    IDS_HELP_QUERY_END      "   OPENFILES /Query /S system /U username /P password /NH \n"
END

STRINGTABLE DISCARDABLE 
BEGIN

    IDS_NOACCESS            "No Access."
    IDS_GIVEN_CREDENTIAL    " with the given credentials.\n"
    IDS_NA                  "N/A"
    IDS_DOT_EOL             ".\n" 
    IDS_TYPE_Q_HELP         "Type ""%s /Query /?"" for usage.\n"
    IDS_TYPE_D_HELP         "Type ""%s /Disconnect /?"" for usage.\n"
    IDS_CANNOT_READ_REGISTRY  "cannot read registry value ""SYSTEM\\CurrentControlSet\\Control\\Session Manager\\GlobalFlag""" 	
    IDS_CANNOT_WRITE_REGISTRY  "cannot write registry value ""SYSTEM\\CurrentControlSet\\Control\\Session Manager\\GlobalFlag""" 		
END
STRINGTABLE DISCARDABLE 
BEGIN
    IDS_HELP_LOCAL1           "\nOPENFILES /Local [ ON | OFF ]\n\n"
    IDS_HELP_LOCAL2           "Description:\n"
    IDS_HELP_LOCAL3           "    Enables an administrator to enable or disable the system global flag\n"
    IDS_HELP_LOCAL4           "    'maintain objects list' which tracks local file handles. Changes made\n"
    IDS_HELP_LOCAL5           "    by this switch will take effect only after restarting the system.\n"
    IDS_HELP_LOCAL6           "    Note: Enabling this flag adds performance overhead.\n\n"
    IDS_HELP_LOCAL7           "Examples:\n"
	IDS_HELP_LOCAL8			  "    OPENFILES /Local\n"
    IDS_HELP_LOCAL9           "    OPENFILES /Local ON\n"
    IDS_HELP_LOCAL_END        "    OPENFILES /Local OFF\n"
END

//
// Version resources
//
#include <ntverp.h>
#define VER_FILETYPE                VFT_APP
#define VER_FILESUBTYPE             VFT2_UNKNOWN
#define VER_FILEDESCRIPTION_STR     "Open Files"
#define VER_INTERNALNAME_STR        "OpenFiles.exe"
#define VER_ORIGINALFILENAME_STR    "OpnFiles.exe"
#include <common.ver>


