From: Daniel Tang <danielzgtg.opensource(a)gmail.com> --- dlls/sppc/sppc.c | 50 +++++++++++++++++++++++++++++++++++++++++++-- dlls/sppc/sppc.spec | 4 ++-- include/slpublic.h | 2 ++ 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/dlls/sppc/sppc.c b/dlls/sppc/sppc.c index 8819961d7c6..3d0a5987b83 100644 --- a/dlls/sppc/sppc.c +++ b/dlls/sppc/sppc.c @@ -31,14 +31,45 @@ WINE_DEFAULT_DEBUG_CHANNEL(slc); +static BOOL IsMSOffice(void) +{ + char filename[255]; + return GetModuleFileNameA(NULL, filename, sizeof(filename)) && strstr(filename, "Microsoft Office"); +} + HRESULT WINAPI SLGetLicensingStatusInformation(HSLC handle, const SLID *app, const SLID *product, LPCWSTR name, UINT *count, SL_LICENSING_STATUS **status) { - FIXME("(%p %p %p %s %p %p) stub\n", handle, app, product, debugstr_w(name), count, status ); + if (IsMSOffice()) { + FIXME("(%p %p %p %s %p %p) stub\n", handle, app, product, debugstr_w(name), count, status ); + return SL_E_RIGHT_NOT_CONSUMED; + } + // name is NULL in MS Office, so can't log it + + if (count) *count = 1; + if (status) { + *status = LocalAlloc(LHND, sizeof(SL_LICENSING_STATUS)); + memset(*status, 0, sizeof(SL_LICENSING_STATUS)); + } + for (;;) { + // Microsoft office stops crashing and just says adds to the title a suffix of + // "(Non-Commercial Use) (Unlicensed Product)" if we make the thread sleep forever + Sleep(1000); + } + return S_OK; +} + +HRESULT WINAPI SLGetApplicationPolicy(HSLP handle, const WCHAR *name, UINT *type, UINT *count, BYTE **data) +{ + FIXME("(%p %s %p %p %p) stub\n", handle, debugstr_w(name), type, count, data ); + + *count = 0; + *data = (BYTE *)0xdeadbeef; - return SL_E_RIGHT_NOT_CONSUMED; + return S_OK; } + HRESULT WINAPI SLOpen(HSLC *handle) { FIXME("(%p) stub\n", handle ); @@ -48,6 +79,12 @@ HRESULT WINAPI SLOpen(HSLC *handle) *handle = (HSLC)0xdeadbeef; + if (IsMSOffice()) { + for (;;) { + Sleep(1000); + } + } + return S_OK; } @@ -58,6 +95,15 @@ HRESULT WINAPI SLClose(HSLC handle) return S_OK; } +HRESULT WINAPI SLLoadApplicationPolicies(const SLID *app, const SLID *product, DWORD flags, HSLP *result) +{ + FIXME("(%s,%s,%lx,%p) stub\n", wine_dbgstr_guid(app), wine_dbgstr_guid(product), flags, result); + + *result = (HSLP)0xdeadbeef; + + return S_OK; +} + HRESULT WINAPI SLPersistApplicationPolicies(const SLID *app, const SLID *product, DWORD flags) { FIXME("(%s,%s,%lx) stub\n", wine_dbgstr_guid(app), wine_dbgstr_guid(product), flags); diff --git a/dlls/sppc/sppc.spec b/dlls/sppc/sppc.spec index 6926d4d8b6d..e31dc2a9786 100644 --- a/dlls/sppc/sppc.spec +++ b/dlls/sppc/sppc.spec @@ -30,7 +30,7 @@ @ stub SLGenerateOfflineInstallationIdEx @ stub SLGetActiveLicenseInfo @ stub SLGetApplicationInformation -@ stub SLGetApplicationPolicy +@ stdcall SLGetApplicationPolicy(ptr wstr ptr ptr ptr) @ stub SLGetAuthenticationResult @ stub SLGetEncryptedPIDEx @ stub SLGetGenuineInformation @@ -50,7 +50,7 @@ @ stub SLInstallProofOfPurchase @ stub SLInstallProofOfPurchaseEx @ stub SLIsGenuineLocalEx -@ stub SLLoadApplicationPolicies +@ stdcall SLLoadApplicationPolicies(ptr ptr long ptr) @ stdcall SLOpen(ptr) @ stdcall SLPersistApplicationPolicies(ptr ptr long) @ stub SLPersistRTSPayloadOverride diff --git a/include/slpublic.h b/include/slpublic.h index 3f3a39274d1..c6c608d30ba 100644 --- a/include/slpublic.h +++ b/include/slpublic.h @@ -33,6 +33,8 @@ typedef GUID SLID; typedef PVOID HSLC; +typedef PVOID HSLP; + typedef enum _tagSLDATATYPE { SL_DATA_NONE = REG_NONE, -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2377