From 2460c54ea6b60bdbcfb16c53746dfb9528a82702 Mon Sep 17 00:00:00 2001 From: Alexander Frick Date: Sat, 22 Nov 2025 03:29:01 -0800 Subject: [PATCH] move more stuff to header file, add function to get version string. Log version and exit code --- src/constants.h | 5 +++++ src/version.h | 4 ++-- src/xp_activate32.cc | 22 ++++++++++++---------- src/xp_activate32.h | 2 ++ 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/constants.h b/src/constants.h index a4d8a0b..ab3bdd3 100644 --- a/src/constants.h +++ b/src/constants.h @@ -15,4 +15,9 @@ typedef uint64_t ui64; static const ui64 f[6] = {0, 0x21840136C85381ULL, 0x44197B83892AD0ULL, 0x1400606322B3B04ULL, 0x1400606322B3B04ULL, 1}; +static const CLSID licdllCLSID = {0xACADF079, 0xCBCD, 0x4032, {0x83, 0xF2, 0xFA, 0x47, 0xC4, 0xDB, 0x09, 0x6F}}; +static const IID licenseAgentIID = {0xB8CBAD79, 0x3F1F, 0x481A, {0xBB, 0x0C, 0xE7, 0xBB, 0xD7, 0x7B, 0xDD, 0xD1}}; +//IID for ICOMLicenseAgent2, with three extra functions +//static IID licenseAgentIID2 = {0x6A07C5A3, 0x9C67, 0x4BB6, {0xB0, 0x20, 0xEC, 0xBE, 0x7F, 0xDF, 0xD3, 0x26}}; + #endif // XP_ACTIVATE32_CONSTANTS_H_ diff --git a/src/version.h b/src/version.h index c55024a..5b733ad 100644 --- a/src/version.h +++ b/src/version.h @@ -32,14 +32,14 @@ // Adhere to semver > semver.org #define MAJOR_VERSION 1 #define MINOR_VERSION 0 -#define BUILD_VERSION 1 +#define BUILD_VERSION 2 #define MAIN_TITLE L"XP_Activate32" #ifndef VERSION_STRING #define VERSION_STRING _VERSION(MAJOR_VERSION, MINOR_VERSION, BUILD_VERSION) #define ABOUT_TITLE L"About XP_Activate32" - #define ABOUT_VERSION L"xp_activate32 ver. 1.0.1" + #define ABOUT_VERSION L"xp_activate32 ver. 1.0.2" #define ABOUT_COPYRIGHT L"Copyright © 2025 Alex313031" #define LEGAL_COPYRIGHT L"© 2025" #endif // VERSION_STRING diff --git a/src/xp_activate32.cc b/src/xp_activate32.cc index c57cc8a..3203ada 100644 --- a/src/xp_activate32.cc +++ b/src/xp_activate32.cc @@ -1,9 +1,12 @@ #include "xp_activate32.h" #include +#include static HICON hIcon[2]; +#define divisor_double(src, dst) divisor_add(src, src, dst) + static ui64 residue_add(ui64 x, ui64 y) { ui64 z = x + y; //z = z - (z >= MOD ? MOD : 0); @@ -111,8 +114,6 @@ static ui64 residue_inv(ui64 x) { //{ return residue_pow(x, MOD - 2); } } -#define BAD 0xFFFFFFFFFFFFFFFFull - static ui64 residue_sqrt(ui64 what) { if (!what) return 0; @@ -427,7 +428,6 @@ static void divisor_add(const TDivisor* src1, const TDivisor* src2, TDivisor* ds dst->v[1] = BAD; } } -#define divisor_double(src, dst) divisor_add(src, src, dst) static void divisor_mul(const TDivisor* src, ui64 mult, TDivisor* dst) { if (mult == 0) { @@ -767,11 +767,6 @@ static int generate(const CHARTYPE* installation_id_str, CHARTYPE confirmation_i static wchar_t strings[14][256]; -static CLSID licdllCLSID = {0xACADF079, 0xCBCD, 0x4032, {0x83, 0xF2, 0xFA, 0x47, 0xC4, 0xDB, 0x09, 0x6F}}; -static IID licenseAgentIID = {0xB8CBAD79, 0x3F1F, 0x481A, {0xBB, 0x0C, 0xE7, 0xBB, 0xD7, 0x7B, 0xDD, 0xD1}}; -//IID for ICOMLicenseAgent2, with three extra functions -//static IID licenseAgentIID2 = {0x6A07C5A3, 0x9C67, 0x4BB6, {0xB0, 0x20, 0xEC, 0xBE, 0x7F, 0xDF, 0xD3, 0x26}}; - #undef INTERFACE #define INTERFACE ICOMLicenseAgent DECLARE_INTERFACE_(ICOMLicenseAgent, IDispatch) { @@ -977,9 +972,15 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) return FALSE; } +std::wstring getVersionW() { + std::wostringstream ostr; + ostr << MAJOR_VERSION << L"." << MINOR_VERSION << L"." << BUILD_VERSION; + return ostr.str(); +} + int main() { - std::wstring welcome = ABOUT_VERSION; - std::wcout << welcome << std::endl; + std::wstring welcome_str = L"Welcome to XP_Activate32 ver. " + getVersionW(); + std::wcout << welcome_str << std::endl; INITCOMMONCONTROLSEX cc = {sizeof(INITCOMMONCONTROLSEX), ICC_STANDARD_CLASSES}; InitCommonControlsEx(&cc); int i; @@ -1000,5 +1001,6 @@ int main() { LicenseAgent->Release(); if (ComInitialized) CoUninitialize(); + std::cout << "status = " << status << std::endl; ExitProcess(status); } diff --git a/src/xp_activate32.h b/src/xp_activate32.h index d2da7af..8ad9e85 100644 --- a/src/xp_activate32.h +++ b/src/xp_activate32.h @@ -33,6 +33,8 @@ typedef struct { #define ERR_UNKNOWN_VERSION 5 #define ERR_UNLUCKY 6 +#define BAD 0xFFFFFFFFFFFFFFFFull + #define CHARTYPE wchar_t static ui64 residue_add(ui64 x, ui64 y);