After this and the related MRs, MS Office 365 finally loads. We see the fancy start screen, and we need modify the options to trust the folder we have our Word documents in. This works for `WINWORD.EXE`, `EXCEL.EXE` and `POWERPNT.exe`. I am able to open an existing file and view it.
This MR is limited to showing the first page or so of the Word document. It freezes with the Wine crash dialog basically the moment right after the screen is rendered. There is no backtrace in the dialog, but winedbg points to `v8jsi.dll` and so does the console output without winedbg. Creating new documents is not achieved by this MR either.
-- v2: sppc: Add stubs for MS Office.
From: Daniel Tang danielzgtg.opensource@gmail.com
--- dlls/sppc/sppc.c | 49 +++++++++++++++++++++++++++++++++++++++++++-- dlls/sppc/sppc.spec | 4 ++-- include/slpublic.h | 4 ++++ 3 files changed, 53 insertions(+), 4 deletions(-)
diff --git a/dlls/sppc/sppc.c b/dlls/sppc/sppc.c index 8819961d7c6..4329d0c4a7d 100644 --- a/dlls/sppc/sppc.c +++ b/dlls/sppc/sppc.c @@ -31,12 +31,42 @@
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
- return SL_E_RIGHT_NOT_CONSUMED; + 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 S_OK; }
HRESULT WINAPI SLOpen(HSLC *handle) @@ -48,6 +78,12 @@ HRESULT WINAPI SLOpen(HSLC *handle)
*handle = (HSLC)0xdeadbeef;
+ if (IsMSOffice()) { + for (;;) { + Sleep(1000); + } + } + return S_OK; }
@@ -58,6 +94,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..e945b2fe841 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, @@ -63,9 +65,11 @@ typedef struct _tagSL_LICENSING_STATUS } SL_LICENSING_STATUS;
SLCAPI HRESULT WINAPI SLGetLicensingStatusInformation(HSLC, const SLID*, const SLID*, LPCWSTR, UINT*, SL_LICENSING_STATUS**); +SLCAPI HRESULT WINAPI SLGetApplicationPolicy(HSLP, const WCHAR *, UINT *, UINT *, BYTE **); SLCAPI HRESULT WINAPI SLGetWindowsInformation(LPCWSTR, SLDATATYPE*, UINT*, LPBYTE*); SLCAPI HRESULT WINAPI SLGetWindowsInformationDWORD(LPCWSTR, LPDWORD); SLCAPI HRESULT WINAPI SLOpen(HSLC*); +SLCAPI HRESULT WINAPI SLLoadApplicationPolicies(const SLID *, const SLID *, DWORD, HSLP *);
#ifdef __cplusplus }