1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[loc] add support for Locale registry setting

* Closes #246
* Also bump version
This commit is contained in:
Pete Batard 2013-12-15 21:27:25 +00:00
parent 1f5fc8ab33
commit 7c35343da7
5 changed files with 29 additions and 18 deletions

View file

@ -38,6 +38,7 @@ extern "C" {
#define REGKEY_UPDATE_INTERVAL "UpdateCheckInterval"
#define REGKEY_INCLUDE_BETAS "CheckForBetas"
#define REGKEY_COMM_CHECK "CommCheck"
#define REGKEY_LOCALE "Locale"
/* Delete a registry key from <key_root>\Software and all its values
If the key has subkeys, this call will fail. */
@ -168,6 +169,7 @@ static __inline BOOL WriteRegistryKey32(HKEY root, const char* key, int32_t val)
// Use a static buffer - don't allocate
static __inline char* ReadRegistryKeyStr(HKEY root, const char* key) {
static char str[512];
str[0] = 0;
_GetRegistryKey(root, key, REG_SZ, (LPBYTE)str, (DWORD)sizeof(str)-1);
return str;
}

View file

@ -2001,7 +2001,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
BOOL attached_console = FALSE, external_loc_file = FALSE;
BYTE* loc_data;
DWORD loc_size, Size;
char tmp_path[MAX_PATH], loc_file[MAX_PATH] = "", *locale_name = NULL;
char tmp_path[MAX_PATH], loc_file[MAX_PATH] = "", *tmp, *locale_name = NULL;
char** argv = NULL;
wchar_t **wenv, **wargv;
PF_DECL(__wgetmainargs);
@ -2028,6 +2028,13 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
printf("\n");
}
// Use the Locale specified in the registry, if any
tmp = ReadRegistryKeyStr(REGKEY_HKCU, REGKEY_LOCALE);
if (tmp[0] != 0) {
locale_name = safe_strdup(tmp);
uprintf("found registry locale '%s'", locale_name);
}
// We have to process the arguments before we acquire the lock and process the locale
PF_INIT(__wgetmainargs, msvcrt);
if (pf__wgetmainargs != NULL) {
@ -2057,7 +2064,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
if (isdigitU(optarg[0])) {
lcid = (int)strtol(optarg, NULL, 0);
} else {
locale_name = optarg;
safe_free(locale_name);
locale_name =safe_strdup(optarg);
}
break;
case 'w':
@ -2252,6 +2260,7 @@ out:
DestroyAllTooltips();
exit_localization();
safe_free(iso_path);
safe_free(locale_name);
safe_free(update.download_url);
safe_free(update.release_notes);
if (argv != NULL) {

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 329
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Rufus v1.4.1.354"
CAPTION "Rufus v1.4.2.355"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -288,8 +288,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,1,354
PRODUCTVERSION 1,4,1,354
FILEVERSION 1,4,2,355
PRODUCTVERSION 1,4,2,355
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -306,13 +306,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.4.1.354"
VALUE "FileVersion", "1.4.2.355"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.4.1.354"
VALUE "ProductVersion", "1.4.2.355"
END
END
BLOCK "VarFileInfo"