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
/* 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;
}
}
-BOOL LoadTopicsFromINI(LCID Locale)
+static BOOL
+LoadTopicsFromINI(LCID Locale, LPTSTR lpResPath)
{
DWORD dwRet;
DWORD dwSize;
}
/* 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"));
{
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"));
return TRUE;
}
-BOOL LoadTopics(VOID)
+static BOOL
+LoadTopics(LPTSTR lpResPath)
{
#define MAX_NUMBER_INTERNAL_TOPICS 3
*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 */
return TRUE;
}
-VOID FreeTopics(VOID)
+static VOID
+FreeTopics(VOID)
{
if (!pTopics)
return;
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
static VOID
ShowLastWin32Error(HWND hWnd)
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,
DispatchMessage(&msg);
}
+ /* Cleanup */
FreeTopics();
return msg.wParam;
add_subdirectory(packages)
-#common hives
+# Common hives
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/txtsetup.sif DESTINATION reactos NO_CAB FOR bootcd regtest)
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")