Merge branch 'master' into pe-resource-desc

This commit is contained in:
Wes 2021-04-09 07:36:13 -04:00 committed by GitHub
commit 05fbd44293
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 6 deletions

View File

@ -311,7 +311,7 @@ static BOOL ExtractMSDOS(const char* path)
goto out;
}
static_strcat(dllname, "\\diskcopy.dll");
hDLL = LoadLibraryA(dllname);
hDLL = LoadLibraryExA(dllname, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
if (hDLL == NULL) {
uprintf("Unable to open %s: %s\n", dllname, WindowsErrorString());
goto out;

View File

@ -317,6 +317,18 @@ static __inline HMODULE LoadLibraryU(LPCSTR lpFileName)
return ret;
}
static __inline HMODULE LoadLibraryExU(LPCSTR lpFileName, HANDLE hFile, DWORD dwFlags)
{
HMODULE ret;
DWORD err = ERROR_INVALID_DATA;
wconvert(lpFileName);
ret = LoadLibraryExW(wlpFileName, hFile, dwFlags);
err = GetLastError();
wfree(lpFileName);
SetLastError(err);
return ret;
}
static __inline int DrawTextU(HDC hDC, LPCSTR lpText, int nCount, LPRECT lpRect, UINT uFormat)
{
int ret;

View File

@ -3148,7 +3148,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// nail... Also, no, Coverity, we never need to care about freeing kernel32 as a library.
// coverity[leaked_storage]
pfSetDefaultDllDirectories = (SetDefaultDllDirectories_t)
GetProcAddress(LoadLibraryW(kernel32_path), "SetDefaultDllDirectories");
GetProcAddress(LoadLibraryExW(kernel32_path, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32),
"SetDefaultDllDirectories");
if (pfSetDefaultDllDirectories != NULL)
pfSetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32);

View File

@ -658,7 +658,7 @@ static __inline HMODULE GetLibraryHandle(char* szLibraryName) {
if (OpenedLibrariesHandleSize >= MAX_LIBRARY_HANDLES) {
uprintf("Error: MAX_LIBRARY_HANDLES is too small\n");
} else {
h = LoadLibraryA(szLibraryName);
h = LoadLibraryExA(szLibraryName, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
if (h != NULL)
OpenedLibrariesHandle[OpenedLibrariesHandleSize++] = h;
}

View File

@ -414,6 +414,7 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "The Reliable USB Formatting Utility"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.14.1769"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)"

View File

@ -2047,7 +2047,7 @@ void SetAlertPromptMessages(void)
// Fetch the localized strings in the relevant MUI
// Must use sysnative_dir rather than system_dir as we may not find the MUI's otherwise
static_sprintf(mui_path, "%s\\%s\\shell32.dll.mui", sysnative_dir, GetCurrentMUI());
mui_lib = LoadLibraryU(mui_path);
mui_lib = LoadLibraryExU(mui_path, NULL, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
if (mui_lib != NULL) {
// 4097 = "You need to format the disk in drive %c: before you can use it." (dialog text)
// 4125 = "Microsoft Windows" (dialog title)
@ -2063,7 +2063,7 @@ void SetAlertPromptMessages(void)
FreeLibrary(mui_lib);
}
static_sprintf(mui_path, "%s\\%s\\urlmon.dll.mui", sysnative_dir, GetCurrentMUI());
mui_lib = LoadLibraryU(mui_path);
mui_lib = LoadLibraryExU(mui_path, NULL, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
if (mui_lib != NULL) {
// 2070 = "Windows Security Warning" (yes, that's what MS uses for a stupid cookie!)
if (LoadStringU(mui_lib, 2070, title_str[1], sizeof(title_str[1])) <= 0) {

View File

@ -307,7 +307,7 @@ DWORD M_NTFSSECT_API NtfsSectLoadXpFuncs(S_NTFSSECT_XPFUNCS * XpFuncs) {
XpFuncs->Size = sizeof *XpFuncs;
XpFuncs->Kernel32 = LoadLibraryA("kernel32.dll");
XpFuncs->Kernel32 = LoadLibraryExA("kernel32.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
rc = GetLastError();
if (!XpFuncs->Kernel32) {
M_ERR("KERNEL32.DLL not found!");