Needed for Minecraft Legends.
-- v3: apisetschema: Add api-ms-win-core-psm-appnotify-l1-1-0. twinapi.appcore: Add UnregisterAppStateChangeNotification stub. twinapi.appcore: Add RegisterAppStateChangeNotification stub. twinapi.appcore: Add stub DLL. include: Add appnotify.h file.
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- include/Makefile.in | 1 + include/appnotify.h | 49 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 include/appnotify.h
diff --git a/include/Makefile.in b/include/Makefile.in index 7a6e5d62763..c957fed884c 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -19,6 +19,7 @@ SOURCES = \ appcompatapi.h \ appmgmt.h \ appmodel.h \ + appnotify.h \ asferr.h \ asptlb.idl \ asyncinfo.idl \ diff --git a/include/appnotify.h b/include/appnotify.h new file mode 100644 index 00000000000..882b0342afb --- /dev/null +++ b/include/appnotify.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2023 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 + */ + +#ifndef _WINE_APISET_PSMAPPNOTIFY_H_ +#define _WINE_APISET_PSMAPPNOTIFY_H_ + +#include <windows.h> + +#ifdef _CONTRACT_GEN +#define PSM_APP_API_HOST +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(PSM_APP_API_HOST) +#define APICONTRACT +#else +#define APICONTRACT DECLSPEC_IMPORT +#endif + +typedef void (__cdecl *PAPPSTATE_CHANGE_ROUTINE)(BOOLEAN quiesced, void *context); + +typedef struct _APPSTATE_REGISTRATION *PAPPSTATE_REGISTRATION; + +APICONTRACT ULONG NTAPI RegisterAppStateChangeNotification(PAPPSTATE_CHANGE_ROUTINE,void *,PAPPSTATE_REGISTRATION *); +APICONTRACT void NTAPI UnregisterAppStateChangeNotification(PAPPSTATE_REGISTRATION); + +#ifdef __cplusplus +} +#endif + +#endif /* _WINE_APISET_PSMAPPNOTIFY_H_ */
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- configure.ac | 1 + dlls/twinapi.appcore/Makefile.in | 1 + dlls/twinapi.appcore/twinapi.appcore.spec | 127 ++++++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 dlls/twinapi.appcore/Makefile.in create mode 100644 dlls/twinapi.appcore/twinapi.appcore.spec
diff --git a/configure.ac b/configure.ac index fde3f29c770..479bf5d06af 100644 --- a/configure.ac +++ b/configure.ac @@ -3038,6 +3038,7 @@ WINE_CONFIG_MAKEFILE(dlls/traffic) WINE_CONFIG_MAKEFILE(dlls/twain.dll16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/twain_32) WINE_CONFIG_MAKEFILE(dlls/twain_32/tests) +WINE_CONFIG_MAKEFILE(dlls/twinapi.appcore) WINE_CONFIG_MAKEFILE(dlls/typelib.dll16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/tzres) WINE_CONFIG_MAKEFILE(dlls/ucrtbase) diff --git a/dlls/twinapi.appcore/Makefile.in b/dlls/twinapi.appcore/Makefile.in new file mode 100644 index 00000000000..b8bb385c024 --- /dev/null +++ b/dlls/twinapi.appcore/Makefile.in @@ -0,0 +1 @@ +MODULE = twinapi.appcore.dll diff --git a/dlls/twinapi.appcore/twinapi.appcore.spec b/dlls/twinapi.appcore/twinapi.appcore.spec new file mode 100644 index 00000000000..cda1c38103f --- /dev/null +++ b/dlls/twinapi.appcore/twinapi.appcore.spec @@ -0,0 +1,127 @@ +@ stub ValidateSystemShutdown +@ stub BiActivateWorkItemForUser +@ stub BiChangeApplicationStateForPackageName +@ stub BiChangeApplicationStateForPackageNameForUser +@ stub BiChangeApplicationStateForPsmKey +@ stub BiChangeApplicationStateForPsmKeyForUser +@ stub BiChangeSessionState +@ stub BiChangeUserState +@ stub BiEnumerateWorkItemsForPackageNameAndUser +@ stub BiGetActiveBackgroundTasksEvent +@ stub BiGetActiveBackgroundTasksEventForUser +@ stub BiGetCancellationTimeoutInMs +@ stub BiIsApplicationTerminateSensitive +@ stub BiIsApplicationTerminateSensitiveForUser +@ stub BiNotifyNewSession +@ stub BiNotifyNewSessionComplete +@ stub BiNotifyNewUser +@ stub BiPlmFreeMemory +@ stub BiPtActivateDeferredWorkItem +@ stub BiPtActivateInBackground +@ stub BiPtActivateInBackgroundEx +@ stub BiPtActivateWorkItem +@ stub BiPtAssociateActivationProxy +@ stub BiPtAssociateApplicationEntryPoint +@ stub BiPtAssociateApplicationExtensionClass +@ stub BiPtCancelWorkItem +@ stub BiPtCancelWorkItemEx +@ stub BiPtCreateEvent +@ stub BiPtCreateEventForApp +@ stub BiPtCreateEventForPackageName +@ stub BiPtDeleteEvent +@ stub BiPtDisableWorkItem +@ stub BiPtDisassociateWorkItem +@ stub BiPtDisassociateWorkItemEx +@ stub BiPtEnableWorkItem +@ stub BiPtEnumerateBrokeredEvents +@ stub BiPtEnumerateBrokeredEventsEx +@ stub BiPtEnumerateWorkItemsForPackageName +@ stub BiPtEnumerateWorkItemsForPackageNameEx +@ stub BiPtFreeMemory +@ stub BiPtGetStatusStateNameFromBrokerEventId +@ stub BiPtQueryBrokerEventId +@ stub BiPtQueryBrokeredEvent +@ stub BiPtQuerySystemStateBroadcastChannels +@ stub BiPtQueryWorkItem +@ stub BiPtQueryWorkItemEx +@ stub BiPtQueryWorkItemStatusStateName +@ stub BiPtSignalEvent +@ stub BiPtSignalEventEx +@ stub BiPtSignalMultipleEvents +@ stub BiPtSignalTriggerEvent +@ stub BiPtSignalTriggerEventEx +@ stub BiQueryWorkItemForUser +@ stub BiResetActiveSessionForPackage +@ stub BiResetActiveUserForPackage +@ stub BiSetActiveSessionForPackage +@ stub BiSetActiveUserForPackage +@ stub BiTerminateApplicationHost +@ stub BiTerminateApplicationHost2 +@ stub BiTerminateApplicationHostForUser +@ stub BiUpdateBackgroundAccessApplicationsForUser +@ stub BiUpdateLockScreenApplications +@ stdcall -private DllCanUnloadNow() +@ stub DllGetActivationFactory +@ stub DllGetClassObject +@ stub PsmApplyTaskCompletion +@ stub PsmBlockAppStateChangeCompletion +@ stub PsmDisconnect +@ stub PsmGetSessionInfo +@ stub PsmInitializeExtension +@ stub PsmIsProcessInApplication +@ stub PsmIsProcessInApplication2 +@ stub PsmQueryApplicationInformation +@ stub PsmQueryApplicationInformation2 +@ stub PsmQueryApplicationInterferenceCount +@ stub PsmQueryApplicationInterferenceCount2 +@ stub PsmQueryApplicationList +@ stub PsmQueryApplicationList2 +@ stub PsmQueryApplicationProperties +@ stub PsmQueryApplicationProperties2 +@ stub PsmQueryApplicationProperties3 +@ stub PsmQueryApplicationPropertiesByUser +@ stub PsmQueryApplicationResourceUsage +@ stub PsmQueryApplicationResourceUsage2 +@ stub PsmQueryApplicationResourceUsageForTimer +@ stub PsmQueryCurrentAppState +@ stub PsmQueryMaxMemoryUsage +@ stub PsmQueryMaxMemoryUsage2 +@ stub PsmQueryMemoryUsage +@ stub PsmQueryMemoryUsage2 +@ stub PsmQueryMemoryUsageByUser +@ stub PsmQueryProcessList +@ stub PsmQueryProcessList2 +@ stub PsmQuerySharedCommitByUser +@ stub PsmQueryTaskCompletionInformation +@ stub PsmQueryTaskCompletionInformation2 +@ stub PsmRegisterAppPriorityNotification +@ stub PsmRegisterAppStateChangeNotification +@ stub PsmRegisterApplicationNotification +@ stub PsmRegisterApplicationNotification2 +@ stub PsmRegisterDynamicProcess +@ stub PsmRegisterKeyNotification +@ stub PsmRegisterManagerType +@ stub PsmResetMaxMemoryUsage +@ stub PsmResetMaxMemoryUsage2 +@ stub PsmResetMaxMemoryUsageByUser +@ stub PsmSetApplicationPriority +@ stub PsmSetApplicationPriority2 +@ stub PsmSetApplicationProperties +@ stub PsmSetApplicationProperties2 +@ stub PsmSetApplicationProperties3 +@ stub PsmSetApplicationPropertiesByUser +@ stub PsmSetApplicationState +@ stub PsmSetApplicationState2 +@ stub PsmShutdownApplication +@ stub PsmTimerCleanup +@ stub PsmTimerElapsedResourceTimeGet +@ stub PsmTimerInitialize +@ stub PsmTimerRemainingResourceTimeGet +@ stub PsmTimerStart +@ stub PsmUnblockAppStateChangeCompletion +@ stub PsmUnregisterAppStateChangeNotification +@ stub PsmWaitForAppResume +@ stub RegisterAppConstrainedChangeNotification +@ stub RegisterAppStateChangeNotification +@ stub UnregisterAppConstrainedChangeNotification +@ stub UnregisterAppStateChangeNotification
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed for Minecraft Legends. --- dlls/twinapi.appcore/Makefile.in | 3 +++ dlls/twinapi.appcore/main.c | 31 +++++++++++++++++++++++ dlls/twinapi.appcore/twinapi.appcore.spec | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 dlls/twinapi.appcore/main.c
diff --git a/dlls/twinapi.appcore/Makefile.in b/dlls/twinapi.appcore/Makefile.in index b8bb385c024..4aa120b96d4 100644 --- a/dlls/twinapi.appcore/Makefile.in +++ b/dlls/twinapi.appcore/Makefile.in @@ -1 +1,4 @@ MODULE = twinapi.appcore.dll + +C_SRCS = \ + main.c diff --git a/dlls/twinapi.appcore/main.c b/dlls/twinapi.appcore/main.c new file mode 100644 index 00000000000..5914cbd8d10 --- /dev/null +++ b/dlls/twinapi.appcore/main.c @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2023 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 "appnotify.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(twinapi); + +/*********************************************************************** + * RegisterAppStateChangeNotification (twinapi.appcore.@) + */ +APICONTRACT ULONG WINAPI RegisterAppStateChangeNotification( PAPPSTATE_CHANGE_ROUTINE routine, void *context, PAPPSTATE_REGISTRATION *reg ) +{ + FIXME( "routine %p, context %p, reg %p - stub.\n", routine, context, reg ); + return ERROR_CALL_NOT_IMPLEMENTED; +} diff --git a/dlls/twinapi.appcore/twinapi.appcore.spec b/dlls/twinapi.appcore/twinapi.appcore.spec index cda1c38103f..9052c4e7cf5 100644 --- a/dlls/twinapi.appcore/twinapi.appcore.spec +++ b/dlls/twinapi.appcore/twinapi.appcore.spec @@ -122,6 +122,6 @@ @ stub PsmUnregisterAppStateChangeNotification @ stub PsmWaitForAppResume @ stub RegisterAppConstrainedChangeNotification -@ stub RegisterAppStateChangeNotification +@ stdcall RegisterAppStateChangeNotification(ptr ptr ptr) @ stub UnregisterAppConstrainedChangeNotification @ stub UnregisterAppStateChangeNotification
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/twinapi.appcore/main.c | 8 ++++++++ dlls/twinapi.appcore/twinapi.appcore.spec | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/twinapi.appcore/main.c b/dlls/twinapi.appcore/main.c index 5914cbd8d10..23c1dfa0392 100644 --- a/dlls/twinapi.appcore/main.c +++ b/dlls/twinapi.appcore/main.c @@ -29,3 +29,11 @@ APICONTRACT ULONG WINAPI RegisterAppStateChangeNotification( PAPPSTATE_CHANGE_RO FIXME( "routine %p, context %p, reg %p - stub.\n", routine, context, reg ); return ERROR_CALL_NOT_IMPLEMENTED; } + +/*********************************************************************** + * UnregisterAppStateChangeNotification (twinapi.appcore.@) + */ +APICONTRACT void WINAPI UnregisterAppStateChangeNotification( PAPPSTATE_REGISTRATION reg ) +{ + FIXME( "reg %p - stub.\n", reg ); +} diff --git a/dlls/twinapi.appcore/twinapi.appcore.spec b/dlls/twinapi.appcore/twinapi.appcore.spec index 9052c4e7cf5..0b2d8d2055e 100644 --- a/dlls/twinapi.appcore/twinapi.appcore.spec +++ b/dlls/twinapi.appcore/twinapi.appcore.spec @@ -124,4 +124,4 @@ @ stub RegisterAppConstrainedChangeNotification @ stdcall RegisterAppStateChangeNotification(ptr ptr ptr) @ stub UnregisterAppConstrainedChangeNotification -@ stub UnregisterAppStateChangeNotification +@ stdcall UnregisterAppStateChangeNotification(ptr)
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed for Minecraft Legends. --- dlls/apisetschema/apisetschema.spec | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/apisetschema/apisetschema.spec b/dlls/apisetschema/apisetschema.spec index 981b80c6976..122cd1209ba 100644 --- a/dlls/apisetschema/apisetschema.spec +++ b/dlls/apisetschema/apisetschema.spec @@ -99,6 +99,7 @@ apiset api-ms-win-core-psapi-ansi-l1-1-0 = kernelbase.dll apiset api-ms-win-core-psapi-l1-1-0 = kernelbase.dll apiset api-ms-win-core-psapi-obsolete-l1-1-0 = kernelbase.dll apiset api-ms-win-core-psapiansi-l1-1-0 = kernelbase.dll +apiset api-ms-win-core-psm-appnotify-l1-1-0 = twinapi.appcore.dll apiset api-ms-win-core-psm-key-l1-1-1 = kernelbase.dll apiset api-ms-win-core-quirks-l1-1-0 = kernelbase.dll apiset api-ms-win-core-realtime-l1-1-0 = kernelbase.dll
**v3** - Use cdecl instead of stdcall in PAPPSTATE_CHANGE_ROUTINE - Add parameter names to FIXME message
Rémi Bernon (@rbernon) commented about include/appnotify.h:
+#include <windows.h>
+#ifdef _CONTRACT_GEN +#define PSM_APP_API_HOST +#endif
+#ifdef __cplusplus +extern "C" { +#endif
+#if defined(PSM_APP_API_HOST) +#define APICONTRACT +#else +#define APICONTRACT DECLSPEC_IMPORT +#endif
As you're never defining _CONTRACT_GEN, this will always expand to DECLSPEC_IMPORT, which I think is wrong within the twinapi.appcore module.
You should add `EXTRADEFS = -D_CONTRACT_GEN` in its Makefile.in.
Rémi Bernon (@rbernon) commented about include/appnotify.h:
+#ifdef _CONTRACT_GEN +#define PSM_APP_API_HOST +#endif
+#ifdef __cplusplus +extern "C" { +#endif
+#if defined(PSM_APP_API_HOST) +#define APICONTRACT +#else +#define APICONTRACT DECLSPEC_IMPORT +#endif
+typedef void (__cdecl *PAPPSTATE_CHANGE_ROUTINE)(BOOLEAN quiesced, void *context);
I think `__stdcall` was right but maybe you should use `CALLBACK` instead, which expands to the same thing but seems more appropriate for a callback.
On Mon Apr 24 09:08:08 2023 +0000, Rémi Bernon wrote:
I think `__stdcall` was right but maybe you should use `CALLBACK` instead, which expands to the same thing but seems more appropriate for a callback.
Ahem. (/me points at [the earlier discussion](#note_30513))
On Mon Apr 24 10:12:27 2023 +0000, Chip Davis wrote:
Ahem. (/me points at [the earlier discussion](#note_30513))
Yes, but it's not clear to me what the conclusion is, as some part said that cdecl is specific to i386, and as it was mentioned that other callbacks did not have a calling convention and has been included with `CALLBACK`.
Yes, but it's not clear to me what the conclusion is, as some part said that cdecl is specific to i386, and as it was mentioned that other callbacks did not have a calling convention and has been included with `CALLBACK`.
Without any other evidence, I'd honestly just assume they're wrong. I've probably incorrectly added stdcall to some callbacks like that myself, so I wouldn't be surprised if others have as well.
I don't know how stdcall can be correct; if Windows programs are written that use those callbacks they'll be cdecl.
And yes, the stdcall/cdecl distinction is specific to i386, though I'm not sure how that's relevant?