Author: hbelusca Date: Wed Feb 1 03:16:08 2017 New Revision: 73657
URL: http://svn.reactos.org/svn/reactos?rev=73657&view=rev Log: Port commit r73656 : welcome.ini configuration.
Added: branches/ReactOS-0.4.4-FOSDEM2017/reactos/boot/bootdata/welcome_config/ - copied from r73656, trunk/reactos/boot/bootdata/welcome_config/ Modified: branches/ReactOS-0.4.4-FOSDEM2017/reactos/ (props changed) branches/ReactOS-0.4.4-FOSDEM2017/reactos/base/setup/welcome/welcome.c branches/ReactOS-0.4.4-FOSDEM2017/reactos/boot/bootdata/CMakeLists.txt branches/ReactOS-0.4.4-FOSDEM2017/rosapps/ (props changed)
Propchange: branches/ReactOS-0.4.4-FOSDEM2017/reactos/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Feb 1 03:16:08 2017 @@ -23,4 +23,4 @@ /branches/usb-bringup:51335,51337,51341-51343,51348,51350,51353,51355,51365-51369,51372,51384-54388,54396-54398,54736-54737,54752-54754,54756-54760,54762,54764-54765,54767-54768,54772,54774-54777,54781,54787,54790-54792,54797-54798,54806,54808,54834-54838,54843,54850,54852,54856,54858-54859 /branches/usb-bringup-trunk:55019-55543,55548-55554,55556-55567 /branches/wlan-bringup:54809-54998 -/trunk/reactos:73522-73601,73606-73608,73610-73611,73613,73616-73618,73620-73623,73633-73636,73642-73643,73654 +/trunk/reactos:73522-73601,73606-73608,73610-73611,73613,73616-73618,73620-73623,73633-73636,73642-73643,73654,73656
Modified: branches/ReactOS-0.4.4-FOSDEM2017/reactos/base/setup/welcome/welcome.c URL: http://svn.reactos.org/svn/reactos/branches/ReactOS-0.4.4-FOSDEM2017/reactos... ============================================================================== --- branches/ReactOS-0.4.4-FOSDEM2017/reactos/base/setup/welcome/welcome.c [iso-8859-1] (original) +++ branches/ReactOS-0.4.4-FOSDEM2017/reactos/base/setup/welcome/welcome.c [iso-8859-1] Wed Feb 1 03:16:08 2017 @@ -71,8 +71,7 @@ HWND hWndCloseButton = NULL; HWND hWndCheckButton = NULL;
-/* TODO: Retrieve the preferences from a configuration file */ -BOOL bDisplayCheckBox = FALSE; // FIXME! +BOOL bDisplayCheckBox = FALSE; // FIXME: We should also repaint the OS version correctly! BOOL bDisplayExitBtn = TRUE;
#define BUFFER_SIZE 1024 @@ -121,7 +120,7 @@
/* FUNCTIONS ****************************************************************/
-INT GetLocaleName(LCID Locale, LPTSTR lpLCData, SIZE_T cchData) +INT GetLocaleName(IN LCID Locale, OUT LPTSTR lpLCData, IN SIZE_T cchData) { INT ret, ret2;
@@ -197,7 +196,8 @@ } }
-BOOL LoadTopicsFromINI(LCID Locale) +static BOOL +LoadTopicsFromINI(LCID Locale, LPTSTR lpResPath) { DWORD dwRet; DWORD dwSize; @@ -215,7 +215,7 @@ }
/* Build the INI file name */ - GetCurrentDirectory(ARRAYSIZE(szIniPath), szIniPath); + StringCchCopy(szIniPath, ARRAYSIZE(szIniPath), lpResPath); StringCchCat(szIniPath, ARRAYSIZE(szIniPath), TEXT("\")); StringCchCat(szIniPath, ARRAYSIZE(szIniPath), szBuffer); StringCchCat(szIniPath, ARRAYSIZE(szIniPath), TEXT(".ini")); @@ -225,7 +225,7 @@ { StringCchCopy(szBuffer, ARRAYSIZE(szBuffer), TEXT("en-US"));
- GetCurrentDirectory(ARRAYSIZE(szIniPath), szIniPath); + StringCchCopy(szIniPath, ARRAYSIZE(szIniPath), lpResPath); StringCchCat(szIniPath, ARRAYSIZE(szIniPath), TEXT("\")); StringCchCat(szIniPath, ARRAYSIZE(szIniPath), szBuffer); StringCchCat(szIniPath, ARRAYSIZE(szIniPath), TEXT(".ini")); @@ -324,7 +324,8 @@ return TRUE; }
-BOOL LoadTopics(VOID) +static BOOL +LoadTopics(LPTSTR lpResPath) { #define MAX_NUMBER_INTERNAL_TOPICS 3
@@ -344,7 +345,7 @@ *szDefaultDesc = 0;
/* Try to load the topics from INI file */ - if (LoadTopicsFromINI(LOCALE_USER_DEFAULT)) + if (*lpResPath && LoadTopicsFromINI(LOCALE_USER_DEFAULT, lpResPath)) return TRUE;
/* We failed, fall back to internal (localized) resource */ @@ -379,7 +380,8 @@ return TRUE; }
-VOID FreeTopics(VOID) +static VOID +FreeTopics(VOID) { if (!pTopics) return; @@ -392,6 +394,50 @@ HeapFree(GetProcessHeap(), 0, pTopics); pTopics = NULL; dwNumberTopics = 0; +} + +static BOOL +LoadConfiguration(VOID) +{ + TCHAR szAppPath[MAX_PATH]; + TCHAR szIniPath[MAX_PATH]; + TCHAR szResPath[MAX_PATH]; + + /* Retrieve the full path to this application */ + GetModuleFileName(NULL, szAppPath, ARRAYSIZE(szAppPath)); + if (*szAppPath) + { + LPTSTR lpFileName = _tcsrchr(szAppPath, _T('\')); + if (lpFileName) + *lpFileName = 0; + else + *szAppPath = 0; + } + + /* Build the full INI file path name */ + StringCchCopy(szIniPath, ARRAYSIZE(szIniPath), szAppPath); + StringCchCat(szIniPath, ARRAYSIZE(szIniPath), TEXT("\welcome.ini")); + + /* Verify that the file exists, otherwise use the default configuration */ + if (GetFileAttributes(szIniPath) == INVALID_FILE_ATTRIBUTES) + { + /* Use the default configuration and retrieve the default topics */ + return LoadTopics(TEXT("")); + } + + /* Load the settings from the INI configuration file */ + bDisplayCheckBox = !!GetPrivateProfileInt(TEXT("Welcome"), TEXT("DisplayCheckBox"), FALSE /* default */, szIniPath); + bDisplayExitBtn = !!GetPrivateProfileInt(TEXT("Welcome"), TEXT("DisplayExitButton"), TRUE /* default */, szIniPath); + + if (!GetPrivateProfileString(TEXT("Welcome"), TEXT("ResourceDir"), NULL /* default */, + szResPath, ARRAYSIZE(szResPath), szIniPath)) + { + *szResPath = 0; + } + + /* Set the current directory to the one of this application, and retrieve the topics */ + SetCurrentDirectory(szAppPath); + return LoadTopics(szResPath); }
#if 0 @@ -513,7 +559,8 @@ if (!LoadString(hInstance, IDS_APPTITLE, szAppTitle, ARRAYSIZE(szAppTitle))) StringCchCopy(szAppTitle, ARRAYSIZE(szAppTitle), TEXT("ReactOS Welcome"));
- LoadTopics(); + /* Load the configuration and the topics */ + LoadConfiguration();
/* Create main window */ hWndMain = CreateWindow(szFrameClass, @@ -544,6 +591,7 @@ DispatchMessage(&msg); }
+ /* Cleanup */ FreeTopics();
return msg.wParam;
Modified: branches/ReactOS-0.4.4-FOSDEM2017/reactos/boot/bootdata/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/branches/ReactOS-0.4.4-FOSDEM2017/reactos... ============================================================================== --- branches/ReactOS-0.4.4-FOSDEM2017/reactos/boot/bootdata/CMakeLists.txt [iso-8859-1] (original) +++ branches/ReactOS-0.4.4-FOSDEM2017/reactos/boot/bootdata/CMakeLists.txt [iso-8859-1] Wed Feb 1 03:16:08 2017 @@ -1,7 +1,7 @@
add_subdirectory(packages)
-#common hives +# Common hives
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/txtsetup.sif DESTINATION reactos NO_CAB FOR bootcd regtest)
@@ -14,31 +14,51 @@ hivebcd.inf)
-#regtest +# Regtest add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcdregtest/regtest.cmd DESTINATION reactos/bin FOR all)
-#autorun.inf +# autorun.inf add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/autorun-bootcd.inf DESTINATION root NO_CAB NOT_IN_HYBRIDCD NAME_ON_CD autorun.inf FOR bootcd) add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/autorun-livecd.inf DESTINATION root NO_CAB NOT_IN_HYBRIDCD NAME_ON_CD autorun.inf FOR livecd) add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/autorun-hybridcd.inf DESTINATION root NO_CAB NOT_IN_HYBRIDCD NAME_ON_CD autorun.inf FOR hybridcd)
-#icon.ico +# icon.ico add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/icon.ico DESTINATION root NO_CAB NOT_IN_HYBRIDCD FOR all hybridcd)
-#readme.txt +# readme.txt add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/readme.txt DESTINATION root NO_CAB NOT_IN_HYBRIDCD FOR all hybridcd) add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/readme.txt DESTINATION reactos FOR all)
-#freeldr.ini +# Welcome.exe optional custom configuration (only for HybridCD) +if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/welcome_config/) + # Copy the main configuration file + add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/welcome_config/welcome.ini DESTINATION bootcd/reactos NO_CAB FOR hybridcd) + + # Convert the translation files (name format: xx-YY.ini) into UTF-16 + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/welcome_config) + file(GLOB I18N_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/welcome_config/ ${CMAKE_CURRENT_SOURCE_DIR}/welcome_config/*-*.ini) + foreach(_file ${I18N_FILES}) + set(_converted_file ${CMAKE_CURRENT_BINARY_DIR}/welcome_config/${_file}) + set(_source_file ${CMAKE_CURRENT_SOURCE_DIR}/welcome_config/${_file}) + add_custom_command(OUTPUT "${_converted_file}" + COMMAND native-utf16le "${_source_file}" "${_converted_file}" + DEPENDS native-utf16le "${_source_file}") + add_cd_file(TARGET converted_welcome_i18n_files FILE ${_converted_file} DESTINATION bootcd/reactos/welcome NO_CAB NAME_ON_CD ${_file} FOR hybridcd) + list(APPEND _converted_welcome_i18n_files ${_converted_file}) + endforeach(_file) + add_custom_target(converted_welcome_i18n_files DEPENDS ${_converted_welcome_i18n_files}) +endif() + +# freeldr.ini add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcd.ini DESTINATION root NO_CAB NOT_IN_HYBRIDCD NAME_ON_CD freeldr.ini FOR bootcd regtest) add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/livecd.ini DESTINATION root NOT_IN_HYBRIDCD NAME_ON_CD freeldr.ini FOR livecd) add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/hybridcd.ini DESTINATION root NAME_ON_CD freeldr.ini FOR hybridcd)
-#unattend +# Unattend add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcdregtest/unattend.inf DESTINATION reactos NO_CAB FOR regtest) add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcd/unattend.inf DESTINATION reactos NO_CAB FOR bootcd)
-#LiveCD shortcuts +# LiveCD shortcuts macro(add_livecd_shortcut name app dest) add_link(NAME ${name} CMD_LINE_ARGS ${app} ICON ${app} PATH livecd_start.cmd GUID "{450D8FBA-AD25-11D0-98A8-0800361B1103}" MINIMIZE) list(APPEND LIVECD_SHORTCUTS "${CMAKE_CURRENT_BINARY_DIR}/${name}.lnk")
Propchange: branches/ReactOS-0.4.4-FOSDEM2017/rosapps/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Feb 1 03:16:08 2017 @@ -1,2 +1,2 @@ /branches/colins-printing-for-freedom/rosapps:67543-68405,68407-68414,68417-70595 -/trunk/rosapps:73522-73645 +/trunk/rosapps:73522-73654