Index: base/applications/cmdutils/tree/CMakeLists.txt =================================================================== --- base/applications/cmdutils/tree/CMakeLists.txt (revision 65632) +++ base/applications/cmdutils/tree/CMakeLists.txt (working copy) @@ -1,5 +1,6 @@ -add_executable(tree tree.c) +add_executable(tree tree.c tree.rc) set_module_type(tree win32cui UNICODE) +set_target_properties(tree PROPERTIES SUFFIX ".com") add_importlibs(tree msvcrt kernel32 user32) add_cd_file(TARGET tree DESTINATION reactos/system32 FOR all) Index: base/applications/cmdutils/tree/lang/en-US.rc =================================================================== --- base/applications/cmdutils/tree/lang/en-US.rc (revision 0) +++ base/applications/cmdutils/tree/lang/en-US.rc (working copy) @@ -0,0 +1,12 @@ +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +STRINGTABLE +BEGIN + IDS_USAGE "Visually displays the folder structure of a drive or path.\n\n\ +TREE [drive:][path] [/F] [/A]\n\n\ +\t/F Display the names of the files in each folder.\n\ +\t/A Use ASCII instead of extended characters.\n" + IDS_NO_SUBDIRECTORIES "No subdirectories exist" + IDS_FOLDER_PATH "Folder PATH Listing\n" + IDS_VOL_SERIAL "Volume serial number is %x:%x\n" +END Index: base/applications/cmdutils/tree/resource.h =================================================================== --- base/applications/cmdutils/tree/resource.h (revision 0) +++ base/applications/cmdutils/tree/resource.h (working copy) @@ -0,0 +1,9 @@ +#ifndef RESOURCE_H +#define RESOURCE_H + +#define IDS_USAGE 0 +#define IDS_NO_SUBDIRECTORIES 1 +#define IDS_FOLDER_PATH 2 +#define IDS_VOL_SERIAL 3 + +#endif /* RESOURCE_H */ \ No newline at end of file Index: base/applications/cmdutils/tree/tree.c =================================================================== --- base/applications/cmdutils/tree/tree.c (revision 65632) +++ base/applications/cmdutils/tree/tree.c (working copy) @@ -9,17 +9,33 @@ // #include #include +//#include +#include "resource.h" + #define STR_MAX 2048 -const wchar_t *HELP = L"\nGraphically displays the folder structure of a drive or path. \n\nTREE [drive:][path] [/F] [/A]\n\n /F Display the names of the files in each folder.\n\n\n"; -const wchar_t *INVALID = L"No subfolders exist"; - static void DrawTree(const wchar_t* strPath, const WIN32_FIND_DATA *arrFolder, const size_t szArr, UINT width, const wchar_t *prevLine, BOOL drawfolder); static void GetDirectoryStructure(wchar_t* strPath, UINT width, const wchar_t* prevLine); BOOL bShowFiles = FALSE; //if this flag is set to true, files will also be listed +BOOL bUseAscii = FALSE; //if this flag is true, ASCII characters will be used instead of UNICODE ones +/* + * This takes strings from a resource string table + * and outputs it to the console. + */ +VOID PrintResourceString(INT resID, ...) +{ + WCHAR tmpBuffer[STR_MAX]; + va_list arg_ptr; + + va_start(arg_ptr, resID); + LoadStringW(GetModuleHandle(NULL), resID, tmpBuffer, STR_MAX); + vfwprintf(stdout, tmpBuffer, arg_ptr); + va_end(arg_ptr); +} + /** * @name: HasSubFolder * @@ -101,10 +117,17 @@ for(j=0;j> 16, dwSerial & 0xffff); + PrintResourceString(IDS_VOL_SERIAL, dwSerial >> 16, dwSerial & 0xffff); sz = GetCurrentDirectory(1, &t); //get the buffer size strPath = (wchar_t*)malloc(sizeof(wchar_t) * sz); //must not return before calling delete[] Index: base/applications/cmdutils/tree/tree.rc =================================================================== --- base/applications/cmdutils/tree/tree.rc (revision 0) +++ base/applications/cmdutils/tree/tree.rc (working copy) @@ -0,0 +1,17 @@ +#include +#include + +#include "resource.h" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Tree Walk Utility" +#define REACTOS_STR_INTERNAL_NAME "tree" +#define REACTOS_STR_ORIGINAL_FILENAME "tree.exe" +#include + +/* UTF-8 */ +#pragma code_page(65001) +#ifdef LANGUAGE_EN_US + #include "lang/en-US.rc" +#endif