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

[core] Fix for Get/SetThreadUILanguage() not being available on XP

* This addresses the issue reported in #274:
  Unable to access kernel32 DLL: [0x0000007F] The specified procedure could not be found.
* Problem was introduced in 897becd290 which was added for #189.
This commit is contained in:
Pete Batard 2014-01-21 10:45:49 +00:00
parent 52076d974d
commit d887978192
2 changed files with 18 additions and 24 deletions

View file

@ -67,8 +67,6 @@ static void OutputUTF8Message(const char* src)
int len;
char *dst = NULL;
wchar_t* wdst = NULL;
PF_DECL(GetThreadUILanguage);
PF_INIT_OR_OUT(GetThreadUILanguage, kernel32);
if (src == NULL)
goto out;
@ -78,20 +76,16 @@ static void OutputUTF8Message(const char* src)
if (len == 0)
goto out;
if (PRIMARYLANGID(pfGetThreadUILanguage()) != LANG_ENGLISH) {
len = MultiByteToWideChar(CP_OEMCP, 0, src, len, NULL, 0);
if (len == 0)
goto out;
wdst = (wchar_t*)calloc(len+1, sizeof(wchar_t));
if ((wdst == NULL) || (MultiByteToWideChar(CP_OEMCP, 0, src, len, wdst, len+1) == 0))
goto out;
dst = wchar_to_utf8(wdst);
if (dst == NULL)
goto out;
uprintf("%s", dst);
} else {
uprintf("%s", src);
}
len = MultiByteToWideChar(CP_OEMCP, 0, src, len, NULL, 0);
if (len == 0)
goto out;
wdst = (wchar_t*)calloc(len+1, sizeof(wchar_t));
if ((wdst == NULL) || (MultiByteToWideChar(CP_OEMCP, 0, src, len, wdst, len+1) == 0))
goto out;
dst = wchar_to_utf8(wdst);
if (dst == NULL)
goto out;
uprintf("%s", dst);
out:
safe_free(dst);
@ -1178,8 +1172,8 @@ DWORD WINAPI FormatThread(LPVOID param)
FILE* log_fd;
PF_DECL(GetThreadUILanguage);
PF_DECL(SetThreadUILanguage);
PF_INIT_OR_OUT(GetThreadUILanguage, kernel32);
PF_INIT_OR_OUT(SetThreadUILanguage, kernel32);
PF_INIT(GetThreadUILanguage, kernel32);
PF_INIT(SetThreadUILanguage, kernel32);
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
@ -1471,7 +1465,7 @@ DWORD WINAPI FormatThread(LPVOID param)
// NTFS fixup (WinPE/AIK images don't seem to boot without an extra checkdisk)
if ((dt == DT_ISO) && (fs == FS_NTFS)) {
// Try to ensure that all messages from Checkdisk will be in English
if (PRIMARYLANGID(pfGetThreadUILanguage()) != LANG_ENGLISH) {
if ((pfGetThreadUILanguage != NULL) && (PRIMARYLANGID(pfGetThreadUILanguage()) != LANG_ENGLISH)) {
pfSetThreadUILanguage(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
if (PRIMARYLANGID(pfGetThreadUILanguage()) != LANG_ENGLISH)
uprintf("Note: CheckDisk messages may be localized");

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.2.383"
CAPTION "Rufus v1.4.2.384"
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,2,383
PRODUCTVERSION 1,4,2,383
FILEVERSION 1,4,2,384
PRODUCTVERSION 1,4,2,384
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.2.383"
VALUE "FileVersion", "1.4.2.384"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.4.2.383"
VALUE "ProductVersion", "1.4.2.384"
END
END
BLOCK "VarFileInfo"