diff --git a/Makefile b/Makefile index e4d6f06..891111d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ OPT=-Os -Wall -CFLAGS=-fno-ident -fno-stack-check -fno-stack-protector -LDFLAGS=-L. -nostartfiles -nostdlib -lucrt -luser32 -lkernel32 -Wl,--exclude-all-symbols,--enable-stdcall-fixup,--dynamicbase,--nxcompat,--subsystem,windows:6.0 +CFLAGS=-fno-ident +LDFLAGS=-L. -nostartfiles -nostdlib -lkernel32 -lshlwapi -Wl,--exclude-all-symbols,--enable-stdcall-fixup,--dynamicbase,--nxcompat,--subsystem,windows:6.0 PREFIX32=C:/mingw32/bin/ PREFIX64=C:/mingw64/bin/ diff --git a/sppc.c b/sppc.c index 8fa2af3..6548de3 100644 --- a/sppc.c +++ b/sppc.c @@ -1,5 +1,6 @@ #define _WIN32_WINNT _WIN32_WINNT_WIN10 #include +#include typedef GUID SLID; typedef void *HSLC; @@ -49,27 +50,20 @@ BOOL APIENTRY WINAPI dll_main( } BOOL check_for_grace(HSLC hSLC, SLID *pProductSkuId) { - PBYTE *pBuffer = malloc(4096); - UINT cbSize = 4096; + PBYTE pBuffer = 0; + UINT cbSize = 0; - if(SLGetProductSkuInformation( - hSLC, - pProductSkuId, - L"Name", - NULL, - &cbSize, - pBuffer - ) != S_OK) { - free(pBuffer); + if(SLGetProductSkuInformation(hSLC, pProductSkuId, L"Name", NULL, &cbSize, &pBuffer) != S_OK) { + LocalFree(pBuffer); return FALSE; } - if(wcsstr((PWSTR)*pBuffer, L"Grace") != NULL) { - free(pBuffer); + if(StrStrNIW((PWSTR)pBuffer, L"Grace", cbSize) != NULL) { + LocalFree(pBuffer); return TRUE; } - free(pBuffer); + LocalFree(pBuffer); return FALSE; } diff --git a/sppc.rc b/sppc.rc index 7279407..e157fed 100644 --- a/sppc.rc +++ b/sppc.rc @@ -1,6 +1,6 @@ 1 VERSIONINFO -FILEVERSION 0,2,0,0 -PRODUCTVERSION 0,2,0,0 +FILEVERSION 0,3,0,0 +PRODUCTVERSION 0,3,0,0 FILEOS 0x40004L FILETYPE 0x2L BEGIN @@ -10,12 +10,12 @@ BEGIN BEGIN VALUE "CompanyName", "Anomalous Software Deterioration Corporation" VALUE "FileDescription", "ohook SPPC" - VALUE "FileVersion", "0.2.0.0" + VALUE "FileVersion", "0.3.0.0" VALUE "InternalName", "sppc" VALUE "LegalCopyright", "© 2023 Anomalous Software Deterioration Corporation" VALUE "OriginalFilename", "sppc.dll" VALUE "ProductName", "ohook" - VALUE "ProductVersion", "0.2.0.0" + VALUE "ProductVersion", "0.3.0.0" END END diff --git a/sppcs32.def b/sppcs32.def index 742b8c2..cb32134 100644 --- a/sppcs32.def +++ b/sppcs32.def @@ -1,4 +1,4 @@ LIBRARY sppcs.dll EXPORTS SLGetLicensingStatusInformation@24 -SLGetProductSkuInformation@24 \ No newline at end of file +SLGetProductSkuInformation@24