Skip to content

Commit 8ab64d7

Browse files
authored
Ignore Grace licenses
1 parent 76f55c5 commit 8ab64d7

File tree

6 files changed

+52
-6
lines changed

6 files changed

+52
-6
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
OPT=-Os -Wall
22
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
3+
LDFLAGS=-L. -nostartfiles -nostdlib -lucrt -luser32 -lkernel32 -Wl,--exclude-all-symbols,--enable-stdcall-fixup,--dynamicbase,--nxcompat,--subsystem,windows:6.0
44

55
PREFIX32=C:/mingw32/bin/
66
PREFIX64=C:/mingw64/bin/

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ copy /y sppc64.dll "%programfiles%\Microsoft Office\root\vfs\System\sppc.dll"
2323
0.0.0.0 ols.officeapps.live.com
2424
```
2525

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`.
26+
4. Install a blank key for the edition you want to use.
2727

2828
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.
2929

sppc.c

+44
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ typedef struct {
1313
UINT64 qwValidityExpiration;
1414
} SL_LICENSING_STATUS;
1515

16+
typedef enum {
17+
SL_DATA_NONE = REG_NONE,
18+
SL_DATA_SZ = REG_SZ,
19+
SL_DATA_DWORD = REG_DWORD,
20+
SL_DATA_BINARY = REG_BINARY,
21+
SL_DATA_MULTI_SZ,
22+
SL_DATA_SUM = 100
23+
} SLDATATYPE;
24+
1625
HRESULT WINAPI SLGetLicensingStatusInformation(
1726
HSLC hSLC,
1827
SLID *pAppID,
@@ -22,6 +31,15 @@ HRESULT WINAPI SLGetLicensingStatusInformation(
2231
SL_LICENSING_STATUS **ppLicensingStatus
2332
);
2433

34+
HRESULT WINAPI SLGetProductSkuInformation(
35+
HSLC hSLC,
36+
const SLID *pProductSkuId,
37+
PCWSTR pwszValueName,
38+
SLDATATYPE *peDataType,
39+
UINT *pcbValue,
40+
PBYTE *ppbValue
41+
);
42+
2543
BOOL APIENTRY WINAPI dll_main(
2644
HINSTANCE hinstDLL,
2745
DWORD fdwReason,
@@ -30,6 +48,31 @@ BOOL APIENTRY WINAPI dll_main(
3048
return TRUE;
3149
}
3250

51+
BOOL check_for_grace(HSLC hSLC, SLID *pProductSkuId) {
52+
PBYTE *pBuffer = malloc(4096);
53+
UINT cbSize = 4096;
54+
55+
if(SLGetProductSkuInformation(
56+
hSLC,
57+
pProductSkuId,
58+
L"Name",
59+
NULL,
60+
&cbSize,
61+
pBuffer
62+
) != S_OK) {
63+
free(pBuffer);
64+
return FALSE;
65+
}
66+
67+
if(wcsstr((PWSTR)*pBuffer, L"Grace") != NULL) {
68+
free(pBuffer);
69+
return TRUE;
70+
}
71+
72+
free(pBuffer);
73+
return FALSE;
74+
}
75+
3376
HRESULT WINAPI SLGetLicensingStatusInformationHook(
3477
HSLC hSLC,
3578
SLID *pAppID,
@@ -52,6 +95,7 @@ HRESULT WINAPI SLGetLicensingStatusInformationHook(
5295

5396
for(int i = 0; i < *pnStatusCount; i++) {
5497
if((*ppLicensingStatus+i)->eStatus == 0) continue;
98+
if(check_for_grace(hSLC, &((*ppLicensingStatus+i)->SkuId))) continue;
5599

56100
(*ppLicensingStatus+i)->eStatus = 1;
57101
(*ppLicensingStatus+i)->dwGraceTime = 0;

sppc.rc

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
1 VERSIONINFO
2-
FILEVERSION 0,1,0,0
3-
PRODUCTVERSION 0,1,0,0
2+
FILEVERSION 0,2,0,0
3+
PRODUCTVERSION 0,2,0,0
44
FILEOS 0x40004L
55
FILETYPE 0x2L
66
BEGIN
@@ -10,12 +10,12 @@ BEGIN
1010
BEGIN
1111
VALUE "CompanyName", "Anomalous Software Deterioration Corporation"
1212
VALUE "FileDescription", "ohook SPPC"
13-
VALUE "FileVersion", "0.1.0.0"
13+
VALUE "FileVersion", "0.2.0.0"
1414
VALUE "InternalName", "sppc"
1515
VALUE "LegalCopyright", "© 2023 Anomalous Software Deterioration Corporation"
1616
VALUE "OriginalFilename", "sppc.dll"
1717
VALUE "ProductName", "ohook"
18-
VALUE "ProductVersion", "0.1.0.0"
18+
VALUE "ProductVersion", "0.2.0.0"
1919
END
2020
END
2121

sppcs32.def

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
LIBRARY sppcs.dll
22
EXPORTS
33
SLGetLicensingStatusInformation@24
4+
SLGetProductSkuInformation@24

sppcs64.def

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
LIBRARY sppcs.dll
22
EXPORTS
33
SLGetLicensingStatusInformation
4+
SLGetProductSkuInformation

0 commit comments

Comments
 (0)