[PATCH 0/3] MR5746: coremessaging: Add CreateDispatcherQueueController() stub.
Needed by Photoshop 2024. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5746
From: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com> Needed by Photoshop 2024. --- configure.ac | 1 + dlls/coremessaging/Makefile.in | 1 + dlls/coremessaging/coremessaging.spec | 31 +++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 dlls/coremessaging/Makefile.in create mode 100644 dlls/coremessaging/coremessaging.spec diff --git a/configure.ac b/configure.ac index 3f54230b46b..231ec7f17d6 100644 --- a/configure.ac +++ b/configure.ac @@ -2494,6 +2494,7 @@ WINE_CONFIG_MAKEFILE(dlls/comsvcs/tests) WINE_CONFIG_MAKEFILE(dlls/concrt140) WINE_CONFIG_MAKEFILE(dlls/concrt140/tests) WINE_CONFIG_MAKEFILE(dlls/connect) +WINE_CONFIG_MAKEFILE(dlls/coremessaging) WINE_CONFIG_MAKEFILE(dlls/credui) WINE_CONFIG_MAKEFILE(dlls/credui/tests) WINE_CONFIG_MAKEFILE(dlls/crtdll) diff --git a/dlls/coremessaging/Makefile.in b/dlls/coremessaging/Makefile.in new file mode 100644 index 00000000000..2d43a9077cd --- /dev/null +++ b/dlls/coremessaging/Makefile.in @@ -0,0 +1 @@ +MODULE = coremessaging.dll diff --git a/dlls/coremessaging/coremessaging.spec b/dlls/coremessaging/coremessaging.spec new file mode 100644 index 00000000000..f8c31e6fbdb --- /dev/null +++ b/dlls/coremessaging/coremessaging.spec @@ -0,0 +1,31 @@ +@ stub CoreUICallComputeMaximumMessageSize +@ stub CoreUICallCreateConversationHost +@ stub CoreUICallCreateEndpointHost +@ stub CoreUICallCreateEndpointHostWithSendPriority +@ stub CoreUICallGetAddressOfParameterInBuffer +@ stub CoreUICallReceive +@ stub CoreUICallSend +@ stub CoreUICallSendVaList +@ stub CoreUIConfigureTestHost +@ stub CoreUIConfigureUserIntegration +@ stub CoreUICreate +@ stub CoreUICreateAnonymousStream +@ stub CoreUICreateEx +@ stub CoreUIInitializeTestService +@ stub CoreUIOpenExisting +@ stub CoreUIRouteToTestRegistrar +@ stub CoreUIUninitializeTestService +@ stub CreateDispatcherQueueController +@ stub CreateDispatcherQueueForCurrentThread +@ stdcall -private DllCanUnloadNow() +@ stub DllGetActivationFactory +@ stub DllGetClassObject +@ stub GetDispatcherQueueForCurrentThread +@ stub MsgBlobCreateShared +@ stub MsgBlobCreateStack +@ stub MsgBufferShare +@ stub MsgRelease +@ stub MsgStringCreateShared +@ stub MsgStringCreateStack +@ stub ServiceMain +@ stub SvchostPushServiceGlobals -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5746
From: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com> --- include/Makefile.in | 1 + include/dispatcherqueue.idl | 55 +++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 include/dispatcherqueue.idl diff --git a/include/Makefile.in b/include/Makefile.in index fa8c096eabd..81ff6cfa634 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -239,6 +239,7 @@ SOURCES = \ dinput.h \ dinputd.h \ directmanipulation.idl \ + dispatcherqueue.idl \ dispdib.h \ dispex.idl \ dlgs.h \ diff --git a/include/dispatcherqueue.idl b/include/dispatcherqueue.idl new file mode 100644 index 00000000000..3b3826ddb2f --- /dev/null +++ b/include/dispatcherqueue.idl @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2024 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifdef __WIDL__ +#pragma winrt ns_prefix +#endif + +import "windows.system.idl"; + +cpp_quote("#ifdef __cplusplus") +cpp_quote("typedef ABI::Windows::System::IDispatcherQueue *PDISPATCHERQUEUE;") +cpp_quote("typedef ABI::Windows::System::IDispatcherQueueController *PDISPATCHERQUEUECONTROLLER;") +cpp_quote("#else") +namespace Windows.System { + cpp_quote("typedef interface IDispatcherQueue *PDISPATCHERQUEUE;") + cpp_quote("typedef interface IDispatcherQueueController *PDISPATCHERQUEUECONTROLLER;") +} +cpp_quote("#endif") + +typedef enum DISPATCHERQUEUE_THREAD_APARTMENTTYPE +{ + DQTAT_COM_NONE = 0, + DQTAT_COM_ASTA = 1, + DQTAT_COM_STA = 2, +} DISPATCHERQUEUE_THREAD_APARTMENTTYPE; + +typedef enum DISPATCHERQUEUE_THREAD_TYPE +{ + DQTYPE_THREAD_DEDICATED = 1, + DQTYPE_THREAD_CURRENT = 2, +} DISPATCHERQUEUE_THREAD_TYPE; + +typedef struct DispatcherQueueOptions +{ + DWORD dwSize; + DISPATCHERQUEUE_THREAD_TYPE threadType; + DISPATCHERQUEUE_THREAD_APARTMENTTYPE apartmentType; +} DispatcherQueueOptions; + +cpp_quote("STDAPI CreateDispatcherQueueController(DispatcherQueueOptions options, PDISPATCHERQUEUECONTROLLER *queue_controller);") -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5746
From: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com> Needed by Photoshop 2024. --- dlls/coremessaging/Makefile.in | 3 +++ dlls/coremessaging/coremessaging.spec | 2 +- dlls/coremessaging/main.c | 30 +++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 dlls/coremessaging/main.c diff --git a/dlls/coremessaging/Makefile.in b/dlls/coremessaging/Makefile.in index 2d43a9077cd..0aa0fc43a9b 100644 --- a/dlls/coremessaging/Makefile.in +++ b/dlls/coremessaging/Makefile.in @@ -1 +1,4 @@ MODULE = coremessaging.dll + +SOURCES = \ + main.c diff --git a/dlls/coremessaging/coremessaging.spec b/dlls/coremessaging/coremessaging.spec index f8c31e6fbdb..6eba837984d 100644 --- a/dlls/coremessaging/coremessaging.spec +++ b/dlls/coremessaging/coremessaging.spec @@ -15,7 +15,7 @@ @ stub CoreUIOpenExisting @ stub CoreUIRouteToTestRegistrar @ stub CoreUIUninitializeTestService -@ stub CreateDispatcherQueueController +@ stdcall CreateDispatcherQueueController(long ptr) @ stub CreateDispatcherQueueForCurrentThread @ stdcall -private DllCanUnloadNow() @ stub DllGetActivationFactory diff --git a/dlls/coremessaging/main.c b/dlls/coremessaging/main.c new file mode 100644 index 00000000000..4944f28a49a --- /dev/null +++ b/dlls/coremessaging/main.c @@ -0,0 +1,30 @@ +/* WinRT CoreMessaging Implementation + * + * Copyright (C) 2024 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "dispatcherqueue.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(messaging); + +HRESULT WINAPI CreateDispatcherQueueController( DispatcherQueueOptions options, PDISPATCHERQUEUECONTROLLER *queue_controller ) +{ + FIXME( "options.dwSize = %lu, options.threadType = %d, options.apartmentType = %d, queue_controller %p stub!\n", + options.dwSize, options.threadType, options.apartmentType, queue_controller ); + return E_NOTIMPL; +} -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5746
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=145906 Your paranoid android. === debian11 (build log) === /usr/bin/i686-w64-mingw32-ld: tmp667bb090/coremessaging-00000000.spec.o:fake:(.edata+0x6c): undefined reference to `CreateDispatcherQueueController(a)8' collect2: error: ld returned 1 exit status Task: The win32 Wine build failed === debian11b (build log) === /usr/bin/i686-w64-mingw32-ld: tmp6664201e/coremessaging-00000000.spec.o:fake:(.edata+0x6c): undefined reference to `CreateDispatcherQueueController(a)8' collect2: error: ld returned 1 exit status Task: The wow32 Wine build failed
Rémi Bernon (@rbernon) commented about include/dispatcherqueue.idl:
+#ifdef __WIDL__ +#pragma winrt ns_prefix +#endif + +import "windows.system.idl"; + +cpp_quote("#ifdef __cplusplus") +cpp_quote("typedef ABI::Windows::System::IDispatcherQueue *PDISPATCHERQUEUE;") +cpp_quote("typedef ABI::Windows::System::IDispatcherQueueController *PDISPATCHERQUEUECONTROLLER;") +cpp_quote("#else") +namespace Windows.System { + cpp_quote("typedef interface IDispatcherQueue *PDISPATCHERQUEUE;") + cpp_quote("typedef interface IDispatcherQueueController *PDISPATCHERQUEUECONTROLLER;") +} +cpp_quote("#endif") + I don't think this will work, the C typedefs are not written with the namespace-mangled interface but a different forward declared interface.
With this widl fix https://gitlab.winehq.org/rbernon/wine/-/commit/73d264e61081c4e81bce43dde4e8... you should then instead be able to do this, which will be correct: ``` typedef Windows.System.IDispatcherQueue *PDISPATCHERQUEUE; typedef Windows.System.IDispatcherQueueController *PDISPATCHERQUEUECONTROLLER; ``` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5746#note_71726
Rémi Bernon (@rbernon) commented about include/dispatcherqueue.idl:
+} DISPATCHERQUEUE_THREAD_APARTMENTTYPE; + +typedef enum DISPATCHERQUEUE_THREAD_TYPE +{ + DQTYPE_THREAD_DEDICATED = 1, + DQTYPE_THREAD_CURRENT = 2, +} DISPATCHERQUEUE_THREAD_TYPE; + +typedef struct DispatcherQueueOptions +{ + DWORD dwSize; + DISPATCHERQUEUE_THREAD_TYPE threadType; + DISPATCHERQUEUE_THREAD_APARTMENTTYPE apartmentType; +} DispatcherQueueOptions; + +cpp_quote("STDAPI CreateDispatcherQueueController(DispatcherQueueOptions options, PDISPATCHERQUEUECONTROLLER *queue_controller);") Then this could be changed to:
```suggestion:-0+0 [local] HRESULT __stdcall CreateDispatcherQueueController(DispatcherQueueOptions options, PDISPATCHERQUEUECONTROLLER *queue_controller); ``` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5746#note_71727
The build failure comes from `CreateDispatcherQueueController` taking a 12 byte struct as its first parameter by value. This needs 16 bytes on the stack, and the i386 stdcall export is supposed to be `CreateDispatcherQueueController(a)16` but with `(long ptr)` it ends up being `CreateDispatcherQueueController(a)8`. I don't know the proper fix for this, there are multiple options: 1) Not build the module for win32, assuming it's not available on Windows, (something like `enable_coremessaging=${enable_coremessaging:-aarch64,x86_64}` in `configure.ac` near `dnl *** Check for modules to disable by default`) 2) Use `@ stdcall CreateDispatcherQueueController(int128)` in the .spec, it's not exactly correct but it matches the stack size. I think the arguments are only needed for relay so that's maybe fine? 3) Keep it stub on 32bit, something like: ``` @ stdcall -arch=win64 CreateDispatcherQueueController(int128 ptr) @ stub -arch=win32 CreateDispatcherQueueController() ``` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5746#note_71729
You can use `long long long ptr`. It won't display the right thing in +relay on 64-bit but that shouldn't matter. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5746#note_71756
On Fri May 31 06:00:32 2024 +0000, Rémi Bernon wrote:
The build failure comes from `CreateDispatcherQueueController` taking a 12 byte struct as its first parameter by value. This needs 16 bytes on the stack, and the i386 stdcall export is supposed to be `CreateDispatcherQueueController(a)16` but with `(long ptr)` it ends up being `CreateDispatcherQueueController(a)8`. I don't know the proper fix for this, there are multiple options: 1) Not build the module for win32, assuming it's not available on Windows, (something like `enable_coremessaging=${enable_coremessaging:-aarch64,x86_64}` in `configure.ac` near `dnl *** Check for modules to disable by default`) 2) Use `@ stdcall CreateDispatcherQueueController(int128)` in the .spec, it's not exactly correct but it matches the stack size. I think the arguments are only needed for relay so that's maybe fine? 3) Keep it stub on 32bit, something like: ``` @ stdcall -arch=win64 CreateDispatcherQueueController(int128 ptr) @ stub -arch=win32 CreateDispatcherQueueController() ``` Looking at my Windows 10 installation I can see CoreMessaging.dll is present in both System32 and SysWOW64 (so not building it doesn't match Windows behavior) :frog:
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/5746#note_71880
participants (6)
-
Aida Jonikienė -
Alexandre Julliard (@julliard) -
Marvin -
Mohamad Al-Jaf -
Mohamad Al-Jaf (@maljaf) -
Rémi Bernon