From 4bf38002815ea8932952c4b58dd6f026188c65bc Mon Sep 17 00:00:00 2001 From: TheTank20 Date: Sat, 13 Apr 2024 18:00:07 +0000 Subject: [PATCH 01/11] Comment out ERR_UNKNOWN_VERSION checks Temporary fix for Office 2007 not generating confid's. --- src/libumskt/confid/confid.cpp | 48 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/libumskt/confid/confid.cpp b/src/libumskt/confid/confid.cpp index 2eb6b42..b4ac0fc 100644 --- a/src/libumskt/confid/confid.cpp +++ b/src/libumskt/confid/confid.cpp @@ -870,8 +870,8 @@ int ConfirmationID::Generate(const char* installation_id_str, char confirmation_ iid_key[3] = 0xF3; } Unmix(installation_id, totalCount == 41 ? 17 : 19, iid_key, 4); - if (installation_id[18] >= 0x10) - return ERR_UNKNOWN_VERSION; + //if (installation_id[18] >= 0x10) + // return ERR_UNKNOWN_VERSION; #pragma pack(push, 1) struct { @@ -891,32 +891,32 @@ int ConfirmationID::Generate(const char* installation_id_str, char confirmation_ productID[2] = (parsed.ProductIDLow >> 27) & ((1 << 24) - 1); version = (parsed.ProductIDLow >> 51) & 15; productID[3] = (parsed.ProductIDLow >> 55) | (parsed.ProductIDHigh << 9); - switch (activationMode) { - case 0: - if (version != (totalCount == 41 ? 9 : 10)) - return ERR_UNKNOWN_VERSION; - break; - case 1: - if (version != 1) - return ERR_UNKNOWN_VERSION; - break; - case 3: - if (version != 4) - return ERR_UNKNOWN_VERSION; - } + //switch (activationMode) { + // case 0: + // if (version != (totalCount == 41 ? 9 : 10)) + // return ERR_UNKNOWN_VERSION; + // break; + // case 1: + // if (version != 1) + // return ERR_UNKNOWN_VERSION; + // break; + // case 3: + // if (version != 4) + // return ERR_UNKNOWN_VERSION; + //} break; case 2: case 3: decode_iid_new_version(installation_id, hardwareID, &version); - switch (activationMode) { - case 2: - if (version != 3) - return ERR_UNKNOWN_VERSION; - break; - case 3: - if (version != 4) - return ERR_UNKNOWN_VERSION; - } + //switch (activationMode) { + // case 2: + // if (version != 3) + // return ERR_UNKNOWN_VERSION; + // break; + // case 3: + // if (version != 4) + // return ERR_UNKNOWN_VERSION; + //} memcpy(&parsed, hardwareID, 8); productID[0] = stoi(productid.substr(0,5)); std::string channelid = productid.substr(6,3); From 3fbd1cffeaee1b603a34b5681767796d5dbbeca6 Mon Sep 17 00:00:00 2001 From: TheTank20 Date: Sat, 13 Apr 2024 18:39:58 +0000 Subject: [PATCH 02/11] Update cli.cpp --- src/cli.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cli.cpp b/src/cli.cpp index df1ccf0..94ae5ed 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -71,6 +71,7 @@ void CLI::showHelp(char *argv[]) { fmt::print("\t-u --upgrade\tspecifies the Product Key will be an \"Upgrade\" version\n"); fmt::print("\t-V --validate\tproduct key to validate signature\n"); fmt::print("\t-N --nonewlines\tdisables newlines (for easier embedding in other apps)\n"); + fmt::print("\t-o --override\tDisables version check for confirmation ID's, if you need this send a pull request"); fmt::print("\n"); } @@ -92,6 +93,7 @@ int CLI::parseCommandLine(int argc, char* argv[], Options* options) { false, false, false, + false, MODE_BINK1998_GENERATE, WINDOWS }; @@ -210,6 +212,9 @@ int CLI::parseCommandLine(int argc, char* argv[], Options* options) { } else if (arg == "-N" || arg == "--nonewlines") { options->nonewlines = true; + } else if (arg == "-o" || arg == "--override") { + options->override = true; + } } else { options->error = true; } From 2bc3503fd8e44794d28b297255eef21e00d2ba23 Mon Sep 17 00:00:00 2001 From: TheTank20 Date: Sat, 13 Apr 2024 18:40:03 +0000 Subject: [PATCH 03/11] Update cli.h --- src/cli.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cli.h b/src/cli.h index c73104a..9ffdecb 100644 --- a/src/cli.h +++ b/src/cli.h @@ -68,6 +68,7 @@ struct Options { bool error; bool list; bool nonewlines; + bool override; MODE applicationMode; ACTIVATION_ALGORITHM activationMode; From c965b88113c39e527d827ca9d4fd3657d2835f51 Mon Sep 17 00:00:00 2001 From: TheTank20 Date: Sat, 13 Apr 2024 18:43:32 +0000 Subject: [PATCH 04/11] Update confid.cpp --- src/libumskt/confid/confid.cpp | 56 +++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/src/libumskt/confid/confid.cpp b/src/libumskt/confid/confid.cpp index b4ac0fc..0b7a4d2 100644 --- a/src/libumskt/confid/confid.cpp +++ b/src/libumskt/confid/confid.cpp @@ -773,7 +773,7 @@ void ConfirmationID::Unmix(unsigned char* buffer, size_t bufSize, const unsigned } } -int ConfirmationID::Generate(const char* installation_id_str, char confirmation_id[49], int mode, std::string productid) +int ConfirmationID::Generate(const char* installation_id_str, char confirmation_id[49], int mode, std::string productid, bool overrideVersion) { int version; unsigned char hardwareID[8]; @@ -870,8 +870,8 @@ int ConfirmationID::Generate(const char* installation_id_str, char confirmation_ iid_key[3] = 0xF3; } Unmix(installation_id, totalCount == 41 ? 17 : 19, iid_key, 4); - //if (installation_id[18] >= 0x10) - // return ERR_UNKNOWN_VERSION; + if (installation_id[18] >= 0x10 && overrideVersion == false) + return ERR_UNKNOWN_VERSION; #pragma pack(push, 1) struct { @@ -891,32 +891,38 @@ int ConfirmationID::Generate(const char* installation_id_str, char confirmation_ productID[2] = (parsed.ProductIDLow >> 27) & ((1 << 24) - 1); version = (parsed.ProductIDLow >> 51) & 15; productID[3] = (parsed.ProductIDLow >> 55) | (parsed.ProductIDHigh << 9); - //switch (activationMode) { - // case 0: - // if (version != (totalCount == 41 ? 9 : 10)) - // return ERR_UNKNOWN_VERSION; - // break; - // case 1: - // if (version != 1) - // return ERR_UNKNOWN_VERSION; - // break; - // case 3: - // if (version != 4) - // return ERR_UNKNOWN_VERSION; - //} + if (overrideVersion == false) { + switch (activationMode) { + case 0: + if (version != (totalCount == 41 ? 9 : 10)) + return ERR_UNKNOWN_VERSION; + break; + case 1: + if (version != 1) + return ERR_UNKNOWN_VERSION; + break; + case 3: + if (version != 4) + return ERR_UNKNOWN_VERSION; + } + } + break; case 2: case 3: decode_iid_new_version(installation_id, hardwareID, &version); - //switch (activationMode) { - // case 2: - // if (version != 3) - // return ERR_UNKNOWN_VERSION; - // break; - // case 3: - // if (version != 4) - // return ERR_UNKNOWN_VERSION; - //} + if (overrideVersion == false) { + switch (activationMode) { + case 2: + if (version != 3) + return ERR_UNKNOWN_VERSION; + break; + case 3: + if (version != 4) + return ERR_UNKNOWN_VERSION; + break; + } + } memcpy(&parsed, hardwareID, 8); productID[0] = stoi(productid.substr(0,5)); std::string channelid = productid.substr(6,3); From 2b408913c434e81c6744bf46d153059b6c720fbb Mon Sep 17 00:00:00 2001 From: TheTank20 Date: Sat, 13 Apr 2024 18:43:50 +0000 Subject: [PATCH 05/11] Update cli.cpp --- src/cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.cpp b/src/cli.cpp index 94ae5ed..3d4df23 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -213,7 +213,7 @@ int CLI::parseCommandLine(int argc, char* argv[], Options* options) { } else if (arg == "-N" || arg == "--nonewlines") { options->nonewlines = true; } else if (arg == "-o" || arg == "--override") { - options->override = true; + options->overrideVersion = true; } } else { options->error = true; From 74ff4bf14410f9425406965e337db308e3029010 Mon Sep 17 00:00:00 2001 From: TheTank20 Date: Sat, 13 Apr 2024 18:43:59 +0000 Subject: [PATCH 06/11] Update cli.h --- src/cli.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.h b/src/cli.h index 9ffdecb..19a4a1f 100644 --- a/src/cli.h +++ b/src/cli.h @@ -68,7 +68,7 @@ struct Options { bool error; bool list; bool nonewlines; - bool override; + bool overrideVersion; MODE applicationMode; ACTIVATION_ALGORITHM activationMode; From c7a555abe45de605d521ceaa43dfecdf84e6aa19 Mon Sep 17 00:00:00 2001 From: TheTank20 Date: Sat, 13 Apr 2024 18:44:41 +0000 Subject: [PATCH 07/11] Update cli.cpp --- src/cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.cpp b/src/cli.cpp index 3d4df23..e3efff6 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -564,7 +564,7 @@ int CLI::BINK2002Validate() { int CLI::ConfirmationID() { char confirmation_id[49]; - int err = ConfirmationID::Generate(this->options.instid.c_str(), confirmation_id, options.activationMode, options.productid); + int err = ConfirmationID::Generate(this->options.instid.c_str(), confirmation_id, options.activationMode, options.productid, options.overrideVersion); switch (err) { case ERR_TOO_SHORT: From a12afcd60178c60afc094b09761261dbc7f9dcb3 Mon Sep 17 00:00:00 2001 From: TheTank20 Date: Sat, 13 Apr 2024 18:46:31 +0000 Subject: [PATCH 08/11] Update confid.h --- src/libumskt/confid/confid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libumskt/confid/confid.h b/src/libumskt/confid/confid.h index ae2489f..aef1577 100644 --- a/src/libumskt/confid/confid.h +++ b/src/libumskt/confid/confid.h @@ -66,7 +66,7 @@ EXPORT class ConfirmationID { static void Unmix(unsigned char* buffer, size_t bufSize, const unsigned char* key, size_t keySize); public: - static int Generate(const char* installation_id_str, char confirmation_id[49], int mode, std::string productid); + static int Generate(const char* installation_id_str, char confirmation_id[49], int mode, std::string productid, bool overrideVersion); //EXPORT static int CLIRun(); }; From 0251546d0da54e274f13ad08f7d435414afd000e Mon Sep 17 00:00:00 2001 From: TheTank20 Date: Sat, 13 Apr 2024 18:59:34 +0000 Subject: [PATCH 09/11] Update libumskt.cpp --- src/libumskt/libumskt.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libumskt/libumskt.cpp b/src/libumskt/libumskt.cpp index 6293c14..a41244c 100644 --- a/src/libumskt/libumskt.cpp +++ b/src/libumskt/libumskt.cpp @@ -27,8 +27,8 @@ #include "pidgen3/BINK2002.h" #include "pidgen2/PIDGEN2.h" -FNEXPORT int ConfirmationID_Generate(const char* installation_id_str, char confirmation_id[49], int mode, std::string productid) { - return ConfirmationID::Generate(installation_id_str, confirmation_id, mode, productid); +FNEXPORT int ConfirmationID_Generate(const char* installation_id_str, char confirmation_id[49], int mode, std::string productid, bool bypassVersion) { + return ConfirmationID::Generate(installation_id_str, confirmation_id, mode, productid, bypassVersion); } FNEXPORT EC_GROUP* PIDGEN3_initializeEllipticCurve(char* pSel, char* aSel, char* bSel, char* generatorXSel, char* generatorYSel, char* publicKeyXSel, char* publicKeyYSel, EC_POINT *&genPoint, EC_POINT *&pubPoint) { From e830f97e7ed6fed11d7f1e095c93fe54faf18151 Mon Sep 17 00:00:00 2001 From: TheTank20 Date: Sat, 13 Apr 2024 19:01:34 +0000 Subject: [PATCH 10/11] Update cli.cpp --- src/cli.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cli.cpp b/src/cli.cpp index e3efff6..cc80f36 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -214,7 +214,6 @@ int CLI::parseCommandLine(int argc, char* argv[], Options* options) { options->nonewlines = true; } else if (arg == "-o" || arg == "--override") { options->overrideVersion = true; - } } else { options->error = true; } From be99f6b8e97e7cc893caa5a219745b4d12cc3b3b Mon Sep 17 00:00:00 2001 From: TheTank20 Date: Sat, 13 Apr 2024 19:12:57 +0000 Subject: [PATCH 11/11] Update cli.cpp --- src/cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.cpp b/src/cli.cpp index cc80f36..d4ba941 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -71,7 +71,7 @@ void CLI::showHelp(char *argv[]) { fmt::print("\t-u --upgrade\tspecifies the Product Key will be an \"Upgrade\" version\n"); fmt::print("\t-V --validate\tproduct key to validate signature\n"); fmt::print("\t-N --nonewlines\tdisables newlines (for easier embedding in other apps)\n"); - fmt::print("\t-o --override\tDisables version check for confirmation ID's, if you need this send a pull request"); + fmt::print("\t-o --override\tDisables version check for confirmation ID's, if you need this send an issue on GitHub"); fmt::print("\n"); }