move more stuff to header file, add function to get version string. Log version and exit code

This commit is contained in:
Alexander Frick
2025-11-22 03:29:01 -08:00
parent d53d220e13
commit 2460c54ea6
4 changed files with 21 additions and 12 deletions
+5
View File
@@ -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_
+2 -2
View File
@@ -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
+12 -10
View File
@@ -1,9 +1,12 @@
#include "xp_activate32.h"
#include <commctrl.h>
#include <sstream>
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);
}
+2
View File
@@ -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);