[PATCH 2/2] shlwapi: Make SHCreateWorkerWindowA() and SHCreateWorkerWindowW() x64-compatible.
Hermès BÉLUSCA-MAÏTO <[email protected]> Mon, 12 Feb 2018 23:50:38 +0100
| Newsgroups | gmane.comp.emulators.wine.patches |
|---|---|
| Message-ID | <[email protected]> |
This is a multipart message in MIME format. ------=_NextPart_000_000B_01D3A45C.48C56980 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable [PATCH 2/2] shlwapi: Make SHCreateWorkerWindowA() and SHCreateWorkerWindowW() x64-compatible. The first parameter of these functions is a pointer to a window = procedure, having a definite prototype, so employ a correct typedef WNDPROC, which ensures both correct pointer size and parameter type enforcement. This also ensures that we use instead a correct pointer size, since otherwise LONG remains 32-bits for Windows compatibility on x64 = platforms. The wndProc parameter is thus casted to LONG_PTR to comply with the SetWindowLongPtrA/W calls. In SHCreateWorkerWindowW(), the last "wnd_extra" parameter should also = be LONG_PTR to be able to pass 64-bit data pointer on x64 platforms. Therefore fix also setting the wc.cbWndExtra size. One should note that = the ANSI SHCreateWorkerWindowA() function had everything OK already. Best regards, Herm=E8s B=E9lusca-Ma=EFto ------=_NextPart_000_000B_01D3A45C.48C56980 Content-Type: application/octet-stream; name="0002-shlwapi-Make-SHCreateWorkerWindowA-and-SHCreateWorke.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0002-shlwapi-Make-SHCreateWorkerWindowA-and-SHCreateWorke.patch" From c777ea45f323ab8a11b01e04f1782ab616436052 Mon Sep 17 00:00:00 2001=0A= From: Hermes Belusca-Maito <[email protected]>=0A= Date: Mon, 12 Feb 2018 23:42:32 +0100=0A= Subject: [PATCH 2/2] shlwapi: Make SHCreateWorkerWindowA() and=0A= SHCreateWorkerWindowW() x64-compatible.=0A= =0A= The first parameter of these functions is a pointer to a window = procedure, having a definite prototype, so employ a correct typedef = WNDPROC,=0A= which ensures both correct pointer size and parameter type enforcement.=0A= This also ensures that we use instead a correct pointer size, since = otherwise LONG remains 32-bits for Windows compatibility on x64 = platforms.=0A= The wndProc parameter is thus casted to LONG_PTR to comply with the = SetWindowLongPtrA/W calls.=0A= =0A= In SHCreateWorkerWindowW(), the last "wnd_extra" parameter should also = be LONG_PTR to be able to pass 64-bit data pointer on x64 platforms.=0A= Therefore fix also setting the wc.cbWndExtra size. One should note that = the ANSI SHCreateWorkerWindowA() function had everything OK already.=0A= =0A= Signed-off-by: Hermes Belusca-Maito <[email protected]>=0A= ---=0A= dlls/shlwapi/ordinal.c | 14 ++++++--------=0A= dlls/shlwapi/shlwapi.spec | 4 ++--=0A= 2 files changed, 8 insertions(+), 10 deletions(-)=0A= =0A= diff --git a/dlls/shlwapi/ordinal.c b/dlls/shlwapi/ordinal.c=0A= index 3d9c4f71a5..682c913e6f 100644=0A= --- a/dlls/shlwapi/ordinal.c=0A= +++ b/dlls/shlwapi/ordinal.c=0A= @@ -2575,7 +2575,7 @@ HRESULT WINAPI IUnknown_GetSite(LPUNKNOWN = lpUnknown, REFIID iid, PVOID *lppSite)=0A= * Success: The window handle of the newly created window.=0A= * Failure: 0.=0A= */=0A= -HWND WINAPI SHCreateWorkerWindowA(LONG wndProc, HWND hWndParent, DWORD = dwExStyle,=0A= +HWND WINAPI SHCreateWorkerWindowA(WNDPROC wndProc, HWND hWndParent, = DWORD dwExStyle,=0A= DWORD dwStyle, HMENU hMenu, LONG_PTR = wnd_extra)=0A= {=0A= static const char szClass[] =3D "WorkerA";=0A= @@ -2604,8 +2604,7 @@ HWND WINAPI SHCreateWorkerWindowA(LONG wndProc, = HWND hWndParent, DWORD dwExStyle=0A= if (hWnd)=0A= {=0A= SetWindowLongPtrW(hWnd, 0, wnd_extra);=0A= -=0A= - if (wndProc) SetWindowLongPtrA(hWnd, GWLP_WNDPROC, wndProc);=0A= + if (wndProc) SetWindowLongPtrA(hWnd, GWLP_WNDPROC, = (LONG_PTR)wndProc);=0A= }=0A= =0A= return hWnd;=0A= @@ -2864,8 +2863,8 @@ DWORD WINAPI WhichPlatform(void)=0A= *=0A= * Unicode version of SHCreateWorkerWindowA.=0A= */=0A= -HWND WINAPI SHCreateWorkerWindowW(LONG wndProc, HWND hWndParent, DWORD = dwExStyle,=0A= - DWORD dwStyle, HMENU hMenu, LONG = wnd_extra)=0A= +HWND WINAPI SHCreateWorkerWindowW(WNDPROC wndProc, HWND hWndParent, = DWORD dwExStyle,=0A= + DWORD dwStyle, HMENU hMenu, LONG_PTR = wnd_extra)=0A= {=0A= static const WCHAR szClass[] =3D { 'W', 'o', 'r', 'k', 'e', 'r', 'W', = 0 };=0A= WNDCLASSW wc;=0A= @@ -2885,7 +2884,7 @@ HWND WINAPI SHCreateWorkerWindowW(LONG wndProc, = HWND hWndParent, DWORD dwExStyle=0A= wc.style =3D 0;=0A= wc.lpfnWndProc =3D DefWindowProcW;=0A= wc.cbClsExtra =3D 0;=0A= - wc.cbWndExtra =3D 4;=0A= + wc.cbWndExtra =3D sizeof(LONG_PTR);=0A= wc.hInstance =3D shlwapi_hInstance;=0A= wc.hIcon =3D NULL;=0A= wc.hCursor =3D LoadCursorW(NULL, (LPWSTR)IDC_ARROW);=0A= @@ -2900,8 +2899,7 @@ HWND WINAPI SHCreateWorkerWindowW(LONG wndProc, = HWND hWndParent, DWORD dwExStyle=0A= if (hWnd)=0A= {=0A= SetWindowLongPtrW(hWnd, 0, wnd_extra);=0A= -=0A= - if (wndProc) SetWindowLongPtrW(hWnd, GWLP_WNDPROC, wndProc);=0A= + if (wndProc) SetWindowLongPtrW(hWnd, GWLP_WNDPROC, = (LONG_PTR)wndProc);=0A= }=0A= =0A= return hWnd;=0A= diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec=0A= index 6b6ead2696..134bb47177 100644=0A= --- a/dlls/shlwapi/shlwapi.spec=0A= +++ b/dlls/shlwapi/shlwapi.spec=0A= @@ -254,7 +254,7 @@=0A= 254 stub -noname StopWatchExW=0A= 255 stub -noname EventTraceHandler=0A= 256 stdcall -ordinal IUnknown_GetSite(ptr ptr ptr)=0A= -257 stdcall -noname SHCreateWorkerWindowA(long ptr long long ptr long)=0A= +257 stdcall -noname SHCreateWorkerWindowA(ptr ptr long long ptr long)=0A= 258 stub -noname SHRegisterWaitForSingleObject=0A= 259 stub -noname SHUnregisterWait=0A= 260 stdcall -noname SHQueueUserWorkItem(long long long long long long = long)=0A= @@ -275,7 +275,7 @@=0A= 275 stub -noname RegisterGlobalHotkeyA=0A= 276 stdcall -ordinal WhichPlatform()=0A= 277 stub -noname SHDialogBox=0A= -278 stdcall -noname SHCreateWorkerWindowW(long long long long long long)=0A= +278 stdcall -noname SHCreateWorkerWindowW(ptr ptr long long ptr long)=0A= 279 stdcall -noname SHInvokeDefaultCommand(ptr ptr ptr)=0A= 280 stdcall -ordinal SHRegGetIntW(ptr wstr long)=0A= 281 stdcall -noname SHPackDispParamsV(ptr ptr long ptr)=0A= -- =0A= 2.15.1.windows.2=0A= =0A= ------=_NextPart_000_000B_01D3A45C.48C56980 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline Cg== ------=_NextPart_000_000B_01D3A45C.48C56980--