From: Shaun Ren sren@codeweavers.com
Also introduce a unixlib stub. --- dlls/msttsengine/Makefile.in | 4 ++- dlls/msttsengine/main.c | 6 ++++ dlls/msttsengine/tts.c | 19 ++++++++++ dlls/msttsengine/ttseng_private.h | 10 ++++++ dlls/msttsengine/unixlib.c | 59 +++++++++++++++++++++++++++++++ 5 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 dlls/msttsengine/unixlib.c
diff --git a/dlls/msttsengine/Makefile.in b/dlls/msttsengine/Makefile.in index 9a1fc965f2c..b6c9b9d27c2 100644 --- a/dlls/msttsengine/Makefile.in +++ b/dlls/msttsengine/Makefile.in @@ -1,7 +1,9 @@ MODULE = msttsengine.dll +UNIXLIB = msttsengine.so IMPORTS = ole32
SOURCES = \ main.c \ tts.c \ - ttseng_classes.idl + ttseng_classes.idl \ + unixlib.c diff --git a/dlls/msttsengine/main.c b/dlls/msttsengine/main.c index bb8ddae3e0f..735a3c53305 100644 --- a/dlls/msttsengine/main.c +++ b/dlls/msttsengine/main.c @@ -39,7 +39,13 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) if (reason == DLL_PROCESS_ATTACH) { DisableThreadLibraryCalls(instance); + __wine_init_unix_call(); } + else if (reason == DLL_PROCESS_DETACH) + { + free_tts(); + } + return TRUE; }
diff --git a/dlls/msttsengine/tts.c b/dlls/msttsengine/tts.c index f895b35e216..fac8fb05743 100644 --- a/dlls/msttsengine/tts.c +++ b/dlls/msttsengine/tts.c @@ -31,6 +31,8 @@
#include "wine/debug.h"
+#include "ttseng_private.h" + WINE_DEFAULT_DEBUG_CHANNEL(msttsengine);
struct ttsengine @@ -42,6 +44,9 @@ struct ttsengine ISpObjectToken *token; };
+static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT; +static tts_t tts = 0; + static inline struct ttsengine *impl_from_ISpTTSEngine(ISpTTSEngine *iface) { return CONTAINING_RECORD(iface, struct ttsengine, ISpTTSEngine_iface); @@ -52,6 +57,17 @@ static inline struct ttsengine *impl_from_ISpObjectWithToken(ISpObjectWithToken return CONTAINING_RECORD(iface, struct ttsengine, ISpObjectWithToken_iface); }
+static BOOL WINAPI init_tts(INIT_ONCE *once, void *param, void **ctx) +{ + WINE_UNIX_CALL(unix_tts_create, &tts); + return tts != 0; +} + +void free_tts(void) +{ + if (tts) WINE_UNIX_CALL(unix_tts_destroy, &tts); +} + static HRESULT WINAPI ttsengine_QueryInterface(ISpTTSEngine *iface, REFIID iid, void **obj) { struct ttsengine *This = impl_from_ISpTTSEngine(iface); @@ -204,6 +220,9 @@ HRESULT ttsengine_create(REFIID iid, void **obj) struct ttsengine *This; HRESULT hr;
+ if (!InitOnceExecuteOnce(&init_once, init_tts, NULL, NULL) || !tts) + return E_FAIL; + if (!(This = malloc(sizeof(*This)))) return E_OUTOFMEMORY;
diff --git a/dlls/msttsengine/ttseng_private.h b/dlls/msttsengine/ttseng_private.h index 0c55b660bf1..04c0807dc25 100644 --- a/dlls/msttsengine/ttseng_private.h +++ b/dlls/msttsengine/ttseng_private.h @@ -26,6 +26,16 @@ #include "windef.h" #include "winternl.h"
+#include "wine/unixlib.h" + +void free_tts(void); HRESULT ttsengine_create(REFIID iid, void **obj);
+typedef UINT64 tts_t; +enum unix_funcs +{ + unix_tts_create, + unix_tts_destroy, +}; + #endif /* __WINE_TTSENG_PRIVATE_H */ diff --git a/dlls/msttsengine/unixlib.c b/dlls/msttsengine/unixlib.c new file mode 100644 index 00000000000..fc2cc23f836 --- /dev/null +++ b/dlls/msttsengine/unixlib.c @@ -0,0 +1,59 @@ +/* + * MSTTSEngine unixlib. + * + * Copyright 2023 Shaun Ren for CodeWeavers + * + * 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 + */ + +#if 0 +#pragma makedep unix +#endif + +#include <stdarg.h> +#include <stdlib.h> +#include <unistd.h> + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "winternl.h" + +#include "ttseng_private.h" + +static NTSTATUS tts_create(void *args) +{ + return STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS tts_destroy(void *args) +{ + return STATUS_NOT_IMPLEMENTED; +} + +const unixlib_entry_t __wine_unix_call_funcs[] = +{ + tts_create, + tts_destroy, +}; + +#ifdef _WIN64 + +const unixlib_entry_t __wine_unix_call_wow64_funcs[] = +{ + tts_create, + tts_destroy, +}; + +#endif /* _WIN64 */