Skip to content

Commit 76f55c5

Browse files
authored
Initial commit
0 parents  commit 76f55c5

8 files changed

+288
-0
lines changed

LICENSE

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Copyright 2023 asdcorp
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
this software and associated documentation files (the “Software”), to deal in
5+
the Software without restriction, including without limitation the rights to
6+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7+
the Software, and to permit persons to whom the Software is furnished to do so,
8+
subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Makefile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
OPT=-Os -Wall
2+
CFLAGS=-fno-ident -fno-stack-check -fno-stack-protector
3+
LDFLAGS=-L. -nostartfiles -nostdlib -lucrt -Wl,--exclude-all-symbols,--enable-stdcall-fixup,--dynamicbase,--nxcompat,--subsystem,windows:6.0
4+
5+
PREFIX32=C:/mingw32/bin/
6+
PREFIX64=C:/mingw64/bin/
7+
8+
CC32=gcc -Wl,-e_dll_main -municode
9+
CC64=gcc -Wl,-edll_main -municode
10+
11+
all: sppc32.dll sppc64.dll
12+
13+
sppc32.dll: sppc.c sppc32.res.o libsppcs32.a
14+
$(PREFIX32)$(CC32) $(OPT) $< sppc.def sppc32.res.o -shared -o $@ $(CFLAGS) $(LDFLAGS) -lsppcs32
15+
strip -s $@
16+
17+
sppc64.dll: sppc.c sppc64.res.o libsppcs64.a
18+
$(PREFIX64)$(CC64) $(OPT) $< sppc.def sppc64.res.o -shared -o $@ $(CFLAGS) $(LDFLAGS) -lsppcs64
19+
strip -s $@
20+
21+
sppc32.res.o: sppc.rc
22+
$(PREFIX32)windres --codepage=65001 $< $@
23+
24+
sppc64.res.o: sppc.rc
25+
$(PREFIX64)windres --codepage=65001 $< $@
26+
27+
libsppcs32.a:
28+
$(PREFIX32)dlltool -k -dsppcs32.def -llibsppcs32.a
29+
30+
libsppcs64.a:
31+
$(PREFIX64)dlltool -k -dsppcs64.def -llibsppcs64.a
32+
33+
clean:
34+
rm -f *.dll *.res.o *.a

readme.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
ohook
2+
=====
3+
An universal Office "activation" hook with main focus of enabling full functionality of subscription editions.
4+
5+
This project is released mainly for our partners. We won't be directly providing any kind support for users.
6+
7+
Installation
8+
------------
9+
Example steps for 64-bit C2R Office running on a 64-bit version of Windows:
10+
11+
1. Create a symlink of the system `sppc.dll` in the Office C2R `System` directory as `sppcs.dll`:
12+
```
13+
mklink "%programfiles%\Microsoft Office\root\vfs\System\sppcs.dll" "%windir%\System32\sppc.dll"
14+
```
15+
16+
2. Copy the hook library as `sppc.dll` to the Office C2R `System` directory
17+
```
18+
copy /y sppc64.dll "%programfiles%\Microsoft Office\root\vfs\System\sppc.dll"
19+
```
20+
21+
3. (optional) In case of some Office editions which show "There was a problem checking this device's license status" banner, you may need to add the following to the `hosts` file:
22+
```
23+
0.0.0.0 ols.officeapps.live.com
24+
```
25+
26+
4. Install a blank key for the edition you want to use. Make sure to check using `slmgr.vbs -dlv all` that the `Grace` license for Office has `Unlicensed` status, otherwise it may interfere. You may fix this with `slmgr.vbs -upk ACTIVATION_ID`.
27+
28+
Please note these steps are an example. As stated before, no direct support will be provided for usage of this method. You should use one of the solutions provided by our **authorized** partners and direct your support queries to them.
29+
30+
Blank keys
31+
----------
32+
The table contains keys for probably the most needed editions.
33+
34+
|Edition|Marketing Name|Key|
35+
|-------|--------------|---|
36+
|O365HomePrem|Microsoft 365|`NBBBB-BBBBB-BBBBB-BBBBG-234RY`|
37+
|O365ProPlus|Microsoft 365 Apps for enterprise|`NBBBB-BBBBB-BBBBB-BBBCF-PPK9C`|
38+
39+
How does this even work?
40+
------------------------
41+
As some would say, "It's trivial."
42+
43+
* The `sppc.dll` copied to the `System` directory in the Office is used instead of the system library.
44+
45+
* The only real license check is done during the startup of the Office applications using the `SLGetLicensingStatusInformation` function.
46+
47+
* The `SLGetLicensingStatusInformation` function can be easily hooked to lie about the activation status.
48+
49+
FAQ
50+
---
51+
### Why not just use a subscription edition with Mondo licenses?
52+
This will be probably the most frequently asked question.
53+
54+
While Mondo 2016 licenses allow all the Office applications to work and support KMS activation, these are only partially updated for newer versions of Office. Thus, the product policy provided by these licenses lack some of the policies found in licenses for newer versions. Since Office product policy mainly consist of entries like `office-UUID`, there is no way to verify which features may not work.
55+
56+
With this method, a correct license for the installed edition is used, meaning every feature should work as intended.
57+
58+
There are also other issues with installing license files from other editions but we won't be bothering with them.
59+
60+
### Why do some editions require the hosts file modification?
61+
After the license check, these editions make a request to the `ols.officeapps.live.com` service to retrieve an expiration date of user's subscription. This is done in order to evaluate should the local license be renewed. Since the service replies there is no subscription associated with the device, a notification is shown. Blocking access to the service prevents Office from being told the truth.
62+
63+
### Does this enable 1TB of storage on OneDrive?
64+
No.
65+
66+
License
67+
-------
68+
The project is licensed under the terms of the MIT License.

sppc.c

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#define _WIN32_WINNT _WIN32_WINNT_WIN10
2+
#include <windows.h>
3+
4+
typedef GUID SLID;
5+
typedef void *HSLC;
6+
7+
typedef struct {
8+
SLID SkuId;
9+
DWORD eStatus;
10+
DWORD dwGraceTime;
11+
DWORD dwTotalGraceDays;
12+
HRESULT hrReason;
13+
UINT64 qwValidityExpiration;
14+
} SL_LICENSING_STATUS;
15+
16+
HRESULT WINAPI SLGetLicensingStatusInformation(
17+
HSLC hSLC,
18+
SLID *pAppID,
19+
SLID *pProductSkuId,
20+
PWSTR pwszRightName,
21+
UINT *pnStatusCount,
22+
SL_LICENSING_STATUS **ppLicensingStatus
23+
);
24+
25+
BOOL APIENTRY WINAPI dll_main(
26+
HINSTANCE hinstDLL,
27+
DWORD fdwReason,
28+
LPVOID lpvReserved
29+
) {
30+
return TRUE;
31+
}
32+
33+
HRESULT WINAPI SLGetLicensingStatusInformationHook(
34+
HSLC hSLC,
35+
SLID *pAppID,
36+
SLID *pProductSkuId,
37+
PWSTR pwszRightName,
38+
UINT *pnStatusCount,
39+
SL_LICENSING_STATUS **ppLicensingStatus
40+
) {
41+
HRESULT hResult = SLGetLicensingStatusInformation(
42+
hSLC,
43+
pAppID,
44+
pProductSkuId,
45+
pwszRightName,
46+
pnStatusCount,
47+
ppLicensingStatus
48+
);
49+
50+
if(hResult != S_OK)
51+
return hResult;
52+
53+
for(int i = 0; i < *pnStatusCount; i++) {
54+
if((*ppLicensingStatus+i)->eStatus == 0) continue;
55+
56+
(*ppLicensingStatus+i)->eStatus = 1;
57+
(*ppLicensingStatus+i)->dwGraceTime = 0;
58+
(*ppLicensingStatus+i)->dwTotalGraceDays = 0;
59+
(*ppLicensingStatus+i)->hrReason = 0;
60+
(*ppLicensingStatus+i)->qwValidityExpiration = 0;
61+
}
62+
63+
return hResult;
64+
}

sppc.def

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
LIBRARY sppc.dll
2+
EXPORTS
3+
;hooked function
4+
SLGetLicensingStatusInformation = SLGetLicensingStatusInformationHook
5+
6+
;everything else
7+
SLCallServer = SPPCS.SLCallServer
8+
SLpAuthenticateGenuineTicketResponse = SPPCS.SLpAuthenticateGenuineTicketResponse
9+
SLpBeginGenuineTicketTransaction = SPPCS.SLpBeginGenuineTicketTransaction
10+
SLpClearActivationInProgress = SPPCS.SLpClearActivationInProgress
11+
SLpDepositDownlevelGenuineTicket = SPPCS.SLpDepositDownlevelGenuineTicket
12+
SLpDepositTokenActivationResponse = SPPCS.SLpDepositTokenActivationResponse
13+
SLpGenerateTokenActivationChallenge = SPPCS.SLpGenerateTokenActivationChallenge
14+
SLpGetGenuineBlob = SPPCS.SLpGetGenuineBlob
15+
SLpGetGenuineLocal = SPPCS.SLpGetGenuineLocal
16+
SLpGetLicenseAcquisitionInfo = SPPCS.SLpGetLicenseAcquisitionInfo
17+
SLpGetMSPidInformation = SPPCS.SLpGetMSPidInformation
18+
SLpGetMachineUGUID = SPPCS.SLpGetMachineUGUID
19+
SLpGetTokenActivationGrantInfo = SPPCS.SLpGetTokenActivationGrantInfo
20+
SLpIAActivateProduct = SPPCS.SLpIAActivateProduct
21+
SLpIsCurrentInstalledProductKeyDefaultKey = SPPCS.SLpIsCurrentInstalledProductKeyDefaultKey
22+
SLpProcessVMPipeMessage = SPPCS.SLpProcessVMPipeMessage
23+
SLpSetActivationInProgress = SPPCS.SLpSetActivationInProgress
24+
SLpTriggerServiceWorker = SPPCS.SLpTriggerServiceWorker
25+
SLpVLActivateProduct = SPPCS.SLpVLActivateProduct
26+
SLClose = SPPCS.SLClose
27+
SLConsumeRight = SPPCS.SLConsumeRight
28+
SLDepositMigrationBlob = SPPCS.SLDepositMigrationBlob
29+
SLDepositOfflineConfirmationId = SPPCS.SLDepositOfflineConfirmationId
30+
SLDepositOfflineConfirmationIdEx = SPPCS.SLDepositOfflineConfirmationIdEx
31+
SLDepositStoreToken = SPPCS.SLDepositStoreToken
32+
SLFireEvent = SPPCS.SLFireEvent
33+
SLGatherMigrationBlob = SPPCS.SLGatherMigrationBlob
34+
SLGatherMigrationBlobEx = SPPCS.SLGatherMigrationBlobEx
35+
SLGenerateOfflineInstallationId = SPPCS.SLGenerateOfflineInstallationId
36+
SLGenerateOfflineInstallationIdEx = SPPCS.SLGenerateOfflineInstallationIdEx
37+
SLGetActiveLicenseInfo = SPPCS.SLGetActiveLicenseInfo
38+
SLGetApplicationInformation = SPPCS.SLGetApplicationInformation
39+
SLGetApplicationPolicy = SPPCS.SLGetApplicationPolicy
40+
SLGetAuthenticationResult = SPPCS.SLGetAuthenticationResult
41+
SLGetEncryptedPIDEx = SPPCS.SLGetEncryptedPIDEx
42+
SLGetGenuineInformation = SPPCS.SLGetGenuineInformation
43+
SLGetInstalledProductKeyIds = SPPCS.SLGetInstalledProductKeyIds
44+
SLGetLicense = SPPCS.SLGetLicense
45+
SLGetLicenseFileId = SPPCS.SLGetLicenseFileId
46+
SLGetLicenseInformation = SPPCS.SLGetLicenseInformation
47+
SLGetPKeyId = SPPCS.SLGetPKeyId
48+
SLGetPKeyInformation = SPPCS.SLGetPKeyInformation
49+
SLGetPolicyInformation = SPPCS.SLGetPolicyInformation
50+
SLGetPolicyInformationDWORD = SPPCS.SLGetPolicyInformationDWORD
51+
SLGetProductSkuInformation = SPPCS.SLGetProductSkuInformation
52+
SLGetSLIDList = SPPCS.SLGetSLIDList
53+
SLGetServiceInformation = SPPCS.SLGetServiceInformation
54+
SLInstallLicense = SPPCS.SLInstallLicense
55+
SLInstallProofOfPurchase = SPPCS.SLInstallProofOfPurchase
56+
SLInstallProofOfPurchaseEx = SPPCS.SLInstallProofOfPurchaseEx
57+
SLIsGenuineLocalEx = SPPCS.SLIsGenuineLocalEx
58+
SLLoadApplicationPolicies = SPPCS.SLLoadApplicationPolicies
59+
SLOpen = SPPCS.SLOpen
60+
SLPersistApplicationPolicies = SPPCS.SLPersistApplicationPolicies
61+
SLPersistRTSPayloadOverride = SPPCS.SLPersistRTSPayloadOverride
62+
SLReArm = SPPCS.SLReArm
63+
SLRegisterEvent = SPPCS.SLRegisterEvent
64+
SLRegisterPlugin = SPPCS.SLRegisterPlugin
65+
SLSetAuthenticationData = SPPCS.SLSetAuthenticationData
66+
SLSetCurrentProductKey = SPPCS.SLSetCurrentProductKey
67+
SLSetGenuineInformation = SPPCS.SLSetGenuineInformation
68+
SLUninstallLicense = SPPCS.SLUninstallLicense
69+
SLUninstallProofOfPurchase = SPPCS.SLUninstallProofOfPurchase
70+
SLUnloadApplicationPolicies = SPPCS.SLUnloadApplicationPolicies
71+
SLUnregisterEvent = SPPCS.SLUnregisterEvent
72+
SLUnregisterPlugin = SPPCS.SLUnregisterPlugin

sppc.rc

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
1 VERSIONINFO
2+
FILEVERSION 0,1,0,0
3+
PRODUCTVERSION 0,1,0,0
4+
FILEOS 0x40004L
5+
FILETYPE 0x2L
6+
BEGIN
7+
BLOCK "StringFileInfo"
8+
BEGIN
9+
BLOCK "040904E4"
10+
BEGIN
11+
VALUE "CompanyName", "Anomalous Software Deterioration Corporation"
12+
VALUE "FileDescription", "ohook SPPC"
13+
VALUE "FileVersion", "0.1.0.0"
14+
VALUE "InternalName", "sppc"
15+
VALUE "LegalCopyright", "© 2023 Anomalous Software Deterioration Corporation"
16+
VALUE "OriginalFilename", "sppc.dll"
17+
VALUE "ProductName", "ohook"
18+
VALUE "ProductVersion", "0.1.0.0"
19+
END
20+
END
21+
22+
BLOCK "VarFileInfo"
23+
BEGIN
24+
VALUE "Translation", 0x409, 1252
25+
END
26+
END

sppcs32.def

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
LIBRARY sppcs.dll
2+
EXPORTS
3+
SLGetLicensingStatusInformation@24

sppcs64.def

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
LIBRARY sppcs.dll
2+
EXPORTS
3+
SLGetLicensingStatusInformation

0 commit comments

Comments
 (0)