[misc] improve GetLibraryHandle() fallback

* This is a follow up to 1c2884ceba where the error code returned by Windows 7 platforms
  that don't have KB2533623 is expected to be ERROR_INVALID_PARAMETER rather than ERROR_PROC_NOT_FOUND.
* Also update the Windows 11 'Extended' installation mode translations.
This commit is contained in:
Pete Batard 2021-10-23 13:08:13 +01:00
parent b30e3b387a
commit b39e2f8615
No known key found for this signature in database
GPG Key ID: 38E0CF5E69EDD671
5 changed files with 33 additions and 32 deletions

View File

@ -11,7 +11,7 @@
<Identity
Name="19453.net.Rufus"
Publisher="CN=7AC86D13-3E5A-491A-ADD5-80095C212740"
Version="3.17.1842.0" />
Version="3.17.1843.0" />
<Properties>
<DisplayName>Rufus</DisplayName>

View File

@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: 3.14\n"
"Report-Msgid-Bugs-To: pete@akeo.ie\n"
"POT-Creation-Date: 2021-10-15 12:59+0100\n"
"PO-Revision-Date: 2021-10-15 13:07+0100\n"
"POT-Creation-Date: 2021-10-23 12:51+0100\n"
"PO-Revision-Date: 2021-10-23 13:00+0100\n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -1711,8 +1711,10 @@ msgstr "Crée une image disque à partir du périphérique sélectionné"
#. • MSG_305
msgid ""
"Use this option to indicate if you plan to install Windows to a different disk, or if you want to run Windows directly from this drive (Windows To Go).\r\n"
"In 'Extended Windows 11 Installation' mode, Rufus will patch the media so that Windows 11 can be installed on platforms that don't meet the TPM 2.0, Secure Boot or minimum RAM requirements."
msgstr "Utilisez cette option pour indiquer si vous voulez utiliser ce périphérique pour installer Windows sur un autre disque, ou bien exécuter Windows directement depuis votre périphérique (Windows To Go)."
"In 'Extended Windows 11 Installation' mode, Rufus will patch the media so that Windows 11 can be installed on platforms that don't meet the TPM 2.0 or Secure Boot requirements."
msgstr ""
"Utilisez cette option pour indiquer si vous voulez installer Windows sur un autre disque, ou bien exécuter Windows directement depuis ce périphérique (Windows To Go).\r\n"
"En mode 'Installation Windows 11 étendue', Rufus modifiera le périphérique de manière à ce que Windows 11 puisse être installé sur les plateformes qui ne sont pas compatibles avec les exigences matérielles TPM 2.0 ou Secure Boot."
#. • MSG_306
#.

View File

@ -561,8 +561,7 @@ t MSG_303 "Show the log"
t MSG_304 "Create a disk image of the selected device"
t MSG_305 "Use this option to indicate if you plan to install Windows to a different disk, or if you want to run Windows "
"directly from this drive (Windows To Go).\r\nIn 'Extended Windows 11 Installation' mode, Rufus will patch the "
"media so that Windows 11 can be installed on platforms that don't meet the TPM 2.0, Secure Boot or minimum RAM "
"requirements."
"media so that Windows 11 can be installed on platforms that don't meet the TPM 2.0 or Secure Boot requirements."
# You can see this status message by pressing <Ctrl>-<Alt>-<Z> and then selecting START.
# It's the same as MSG_286 but with a process that *may* be faster, hence the name.
t MSG_306 "Fast-zeroing drive: %s"
@ -4277,7 +4276,7 @@ t MSG_301 "Affiche les paramètres de l'application"
t MSG_302 "Affiche des informations à propos de cette application"
t MSG_303 "Affiche le log"
t MSG_304 "Crée une image disque à partir du périphérique sélectionné"
t MSG_305 "Utilisez cette option pour indiquer si vous voulez utiliser ce périphérique pour installer Windows sur un autre disque, ou bien exécuter Windows directement depuis votre périphérique (Windows To Go)."
t MSG_305 "Utilisez cette option pour indiquer si vous voulez installer Windows sur un autre disque, ou bien exécuter Windows directement depuis ce périphérique (Windows To Go).\r\nEn mode 'Installation Windows 11 étendue', Rufus modifiera le périphérique de manière à ce que Windows 11 puisse être installé sur les plateformes qui ne sont pas compatibles avec les exigences matérielles TPM 2.0 ou Secure Boot."
t MSG_306 "Effacement 'rapide' à zéro : %s"
t MSG_307 "peut prendre du temps"
t MSG_308 "Détection VHD"

View File

@ -689,27 +689,27 @@ static __inline HMODULE GetLibraryHandle(char* szLibraryName) {
if (szLibraryName == NULL || szLibraryName[0] == 0)
goto out;
size = MultiByteToWideChar(CP_UTF8, 0, szLibraryName, -1, NULL, 0);
if (size <= 1) // An empty string would be size 1
goto out;
if ((wszLibraryName = (wchar_t*)calloc(size, sizeof(wchar_t))) == NULL)
goto out;
if (MultiByteToWideChar(CP_UTF8, 0, szLibraryName, -1, wszLibraryName, size) != size)
if ((size <= 1) || ((wszLibraryName = (wchar_t*)calloc(size, sizeof(wchar_t))) == NULL) ||
(MultiByteToWideChar(CP_UTF8, 0, szLibraryName, -1, wszLibraryName, size) != size))
goto out;
// If the library is already opened, just return a handle (that doesn't need to be freed)
if ((h = GetModuleHandleW(wszLibraryName)) == NULL) {
if (OpenedLibrariesHandleSize >= MAX_LIBRARY_HANDLES) {
uprintf("Error: MAX_LIBRARY_HANDLES is too small\n");
} else {
h = LoadLibraryExW(wszLibraryName, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
// Some Windows 7 platforms (most likely the ones missing KB2533623 per
// the official LoadLibraryEx doc) return "[0x####007F] The specified
// procedure could not be found" when using the Ex version.
if ((h == NULL) && (SCODE_CODE(GetLastError()) == ERROR_PROC_NOT_FOUND))
h = LoadLibraryW(wszLibraryName);
if (h != NULL)
OpenedLibrariesHandle[OpenedLibrariesHandleSize++] = h;
}
if ((h = GetModuleHandleW(wszLibraryName)) != NULL)
goto out;
// Sanity check
if (OpenedLibrariesHandleSize >= MAX_LIBRARY_HANDLES) {
uprintf("Error: MAX_LIBRARY_HANDLES is too small\n");
goto out;
}
h = LoadLibraryExW(wszLibraryName, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
// Some Windows 7 platforms (most likely the ones missing KB2533623 per the
// official LoadLibraryEx doc) can return ERROR_INVALID_PARAMETER when using
// the Ex() version. If that's the case, fallback to using LoadLibraryW().
if ((h == NULL) && (SCODE_CODE(GetLastError()) == ERROR_INVALID_PARAMETER))
h = LoadLibraryW(wszLibraryName);
if (h != NULL)
OpenedLibrariesHandle[OpenedLibrariesHandleSize++] = h;
else
uprintf("Unable to load '%S.dll': %s", wszLibraryName, WindowsErrorString());
out:
free(wszLibraryName);
return h;
@ -720,7 +720,7 @@ out:
#define PF_INIT(proc, name) if (pf##proc == NULL) pf##proc = \
(proc##_t) GetProcAddress(GetLibraryHandle(#name), #proc)
#define PF_INIT_OR_OUT(proc, name) do {PF_INIT(proc, name); \
if (pf##proc == NULL) {uprintf("Unable to locate %s() in %s.dll: %s\n", \
if (pf##proc == NULL) {uprintf("Unable to locate %s() in '%s.dll': %s", \
#proc, #name, WindowsErrorString()); goto out;} } while(0)
#define PF_INIT_OR_SET_STATUS(proc, name) do {PF_INIT(proc, name); \
if ((pf##proc == NULL) && (NT_SUCCESS(status))) status = STATUS_NOT_IMPLEMENTED; } while(0)

View File

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.17.1842"
CAPTION "Rufus 3.17.1843"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -395,8 +395,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,17,1842,0
PRODUCTVERSION 3,17,1842,0
FILEVERSION 3,17,1843,0
PRODUCTVERSION 3,17,1843,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -414,13 +414,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.17.1842"
VALUE "FileVersion", "3.17.1843"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.17.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.17.1842"
VALUE "ProductVersion", "3.17.1843"
END
END
BLOCK "VarFileInfo"