[0.4.7][PROGMAN][USER32][SHELL32] Do not use LoadLibraryEx() NT6+ flags (#3152) CORE...
authorJoachim Henze <Joachim.Henze@reactos.org>
Sat, 15 Jan 2022 11:55:46 +0000 (12:55 +0100)
committerJoachim Henze <Joachim.Henze@reactos.org>
Sat, 15 Jan 2022 11:55:46 +0000 (12:55 +0100)
LOAD_LIBRARY_AS_IMAGE_RESOURCE and LOAD_LIBRARY_SEARCH_SYSTEM32 are Vista+

This fixes some blurry icons in systray when 2k3sp2 kernel32.dll is used in ros CORE-12004
That part in user32 was a regression of SVN r71609 == git a44dfe6c76a897d9cebaf5177306ad6983bdce55
While we are at it we do fix some other modules as well, that used those NT6+flags.

The fix was picked from 0.4.15-dev-788-g a04831677eaaf62a7d7a99583f6f5e788687d9d2
--------
That second part in SHELL32 regressed even earlier by
SVN r51768 == git 6ced137ce2f6f415c2106ce8b57d936002cf5941
and was fixed on master by chance when the PickIconDlg() was overhauled entirely via
git 0.4.10-dev-106-g 222534a5a22cf12ed667382c7425bd77bd4242ec . But that is not the solution I ported back today.

base/shell/progman/dialog.c
dll/win32/shell32/dialogs/dialogs.cpp
win32ss/user/user32/windows/cursoricon.c

index 3aebd71..452b1bc 100644 (file)
@@ -586,7 +586,7 @@ DIALOG_SYMBOL_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
             SetDlgItemTextW(hDlg, PM_ICON_FILE, pIconContext->szName);
             SendMessageA(pIconContext->hDlgCtrl, LB_SETITEMHEIGHT, 0, 32);
 
-            pIconContext->hLibrary = LoadLibraryExW(pIconContext->szName, NULL, LOAD_LIBRARY_AS_IMAGE_RESOURCE | LOAD_LIBRARY_AS_DATAFILE);
+            pIconContext->hLibrary = LoadLibraryExW(pIconContext->szName, NULL, /* NT6+: LOAD_LIBRARY_AS_IMAGE_RESOURCE | */ LOAD_LIBRARY_AS_DATAFILE);
             if (pIconContext->hLibrary)
             {
                 EnumResourceNamesW(pIconContext->hLibrary,
@@ -635,7 +635,7 @@ DIALOG_SYMBOL_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
                     SetDlgItemTextW(hDlg, PM_ICON_FILE, filename);
                     DestroyIconList(pIconContext->hDlgCtrl);
-                    pIconContext->hLibrary = LoadLibraryExW(filename, NULL, LOAD_LIBRARY_AS_IMAGE_RESOURCE | LOAD_LIBRARY_AS_DATAFILE);
+                    pIconContext->hLibrary = LoadLibraryExW(filename, NULL, /* NT6+: LOAD_LIBRARY_AS_IMAGE_RESOURCE | */ LOAD_LIBRARY_AS_DATAFILE);
                     if (pIconContext->hLibrary)
                     {
                         EnumResourceNamesW(pIconContext->hLibrary,
index 3d66374..20fc413 100644 (file)
@@ -113,7 +113,7 @@ INT_PTR CALLBACK PickIconProc(HWND hwndDlg,
     {
     case WM_INITDIALOG:
         pIconContext = (PPICK_ICON_CONTEXT)lParam;
-        SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG)pIconContext);
+        SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pIconContext);
         pIconContext->hDlgCtrl = GetDlgItem(hwndDlg, IDC_PICKICON_LIST);
         SendMessageW(pIconContext->hDlgCtrl, LB_SETCOLUMNWIDTH, 32, 0);
         EnumResourceNamesW(pIconContext->hLibrary, RT_ICON, EnumPickIconResourceProc, (LPARAM)pIconContext->hDlgCtrl);
@@ -170,7 +170,7 @@ INT_PTR CALLBACK PickIconProc(HWND hwndDlg,
 
                 DestroyIconList(pIconContext->hDlgCtrl);
 
-                hLibrary = LoadLibraryExW(szText, NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE);
+                hLibrary = LoadLibraryExW(szText, NULL, LOAD_LIBRARY_AS_DATAFILE);
                 if (hLibrary == NULL)
                     break;
                 FreeLibrary(pIconContext->hLibrary);
@@ -230,7 +230,7 @@ BOOL WINAPI PickIconDlg(
     int res;
     PICK_ICON_CONTEXT IconContext;
 
-    hLibrary = LoadLibraryExW(lpstrFile, NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE);
+    hLibrary = LoadLibraryExW(lpstrFile, NULL, LOAD_LIBRARY_AS_DATAFILE);
     IconContext.hLibrary = hLibrary;
     IconContext.Index = *lpdwIconIndex;
     StringCchCopyNW(IconContext.szName, _countof(IconContext.szName), lpstrFile, nMaxFile);
index 97ce68b..0707a11 100644 (file)
@@ -1868,7 +1868,7 @@ CURSORICON_CopyImage(
             ustrRsrc.Buffer, IS_INTRESOURCE(ustrRsrc.Buffer) ? L"" : ustrRsrc.Buffer);
 
         /* Get the module handle or load the module */
-        hModule = LoadLibraryExW(ustrModule.Buffer, NULL, LOAD_LIBRARY_AS_IMAGE_RESOURCE | LOAD_LIBRARY_AS_DATAFILE);
+        hModule = LoadLibraryExW(ustrModule.Buffer, NULL, /* NT6+: LOAD_LIBRARY_AS_IMAGE_RESOURCE | */ LOAD_LIBRARY_AS_DATAFILE);
         if (!hModule)
         {
             DWORD err = GetLastError();