mirror of
https://github.com/Neo-Desktop/WindowsXPKg
synced 2025-07-21 11:40:22 +03:00
Compare commits
1 Commits
v0.3.3-bet
...
master
Author | SHA1 | Date | |
---|---|---|---|
e45776479d |
29
src/cli.cpp
29
src/cli.cpp
@ -61,7 +61,7 @@ void CLI::showHelp(char *argv[]) {
|
|||||||
fmt::print("\t-v --verbose\tenable verbose output\n");
|
fmt::print("\t-v --verbose\tenable verbose output\n");
|
||||||
fmt::print("\t-n --number\tnumber of keys to generate (defaults to 1)\n");
|
fmt::print("\t-n --number\tnumber of keys to generate (defaults to 1)\n");
|
||||||
fmt::print("\t-f --file\tspecify which keys file to load\n");
|
fmt::print("\t-f --file\tspecify which keys file to load\n");
|
||||||
fmt::print("\t-i --instid\tinstallation ID used to generate confirmation ID\n");
|
fmt::print("\t-i --instid\tinstallation ID used to generate confirmation ID (reads from stdin if no argument provided)\n");
|
||||||
fmt::print("\t-m --mode\tproduct family to activate.\n\t\t\tvalid options are \"WINDOWS\", \"OFFICEXP\", \"OFFICE2K3\", \"OFFICE2K7\" or \"PLUSDME\"\n\t\t\t(defaults to \"WINDOWS\")\n");
|
fmt::print("\t-m --mode\tproduct family to activate.\n\t\t\tvalid options are \"WINDOWS\", \"OFFICEXP\", \"OFFICE2K3\", \"OFFICE2K7\" or \"PLUSDME\"\n\t\t\t(defaults to \"WINDOWS\")\n");
|
||||||
fmt::print("\t-p --productid\tthe product ID of the Program to activate. only required for Office 2K3 and Office 2K7 programs\n");
|
fmt::print("\t-p --productid\tthe product ID of the Program to activate. only required for Office 2K3 and Office 2K7 programs\n");
|
||||||
fmt::print("\t-b --binkid\tspecify which BINK identifier to load (defaults to 2E)\n");
|
fmt::print("\t-b --binkid\tspecify which BINK identifier to load (defaults to 2E)\n");
|
||||||
@ -168,14 +168,14 @@ int CLI::parseCommandLine(int argc, char* argv[], Options* options) {
|
|||||||
options->keysFilename = argv[i+1];
|
options->keysFilename = argv[i+1];
|
||||||
i++;
|
i++;
|
||||||
} else if (arg == "-i" || arg == "--instid") {
|
} else if (arg == "-i" || arg == "--instid") {
|
||||||
if (i == argc - 1) {
|
|
||||||
options->error = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
options->instid = argv[i+1];
|
|
||||||
options->applicationMode = MODE_CONFIRMATION_ID;
|
options->applicationMode = MODE_CONFIRMATION_ID;
|
||||||
|
if (i == argc - 1 || argv[i+1][0] == '-') {
|
||||||
|
// No argument provided, will read from stdin later
|
||||||
|
options->instid = "";
|
||||||
|
} else {
|
||||||
|
options->instid = argv[i+1];
|
||||||
i++;
|
i++;
|
||||||
|
}
|
||||||
} else if (arg == "-m" || arg == "--mode") {
|
} else if (arg == "-m" || arg == "--mode") {
|
||||||
std::string mode = argv[i+1];
|
std::string mode = argv[i+1];
|
||||||
char *p = &mode[0];
|
char *p = &mode[0];
|
||||||
@ -369,6 +369,12 @@ bool CLI::stripKey(const char *in_key, char out_key[PK_LENGTH]) {
|
|||||||
return (i == PK_LENGTH);
|
return (i == PK_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CLI::readFromStdin() {
|
||||||
|
std::string input;
|
||||||
|
std::getline(std::cin, input);
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
CLI::CLI(Options options, json keys) {
|
CLI::CLI(Options options, json keys) {
|
||||||
this->options = options;
|
this->options = options;
|
||||||
this->keys = keys;
|
this->keys = keys;
|
||||||
@ -572,7 +578,14 @@ int CLI::BINK2002Validate() {
|
|||||||
|
|
||||||
int CLI::ConfirmationID() {
|
int CLI::ConfirmationID() {
|
||||||
char confirmation_id[49];
|
char confirmation_id[49];
|
||||||
int err = ConfirmationID::Generate(this->options.instid.c_str(), confirmation_id, options.activationMode, options.productid, options.overrideVersion);
|
std::string instid = this->options.instid;
|
||||||
|
|
||||||
|
// If instid is empty, read from stdin
|
||||||
|
if (instid.empty()) {
|
||||||
|
instid = readFromStdin();
|
||||||
|
}
|
||||||
|
|
||||||
|
int err = ConfirmationID::Generate(instid.c_str(), confirmation_id, options.activationMode, options.productid, options.overrideVersion);
|
||||||
|
|
||||||
switch (err) {
|
switch (err) {
|
||||||
case ERR_TOO_SHORT:
|
case ERR_TOO_SHORT:
|
||||||
|
@ -96,6 +96,7 @@ public:
|
|||||||
static void printID(DWORD *pid);
|
static void printID(DWORD *pid);
|
||||||
void printKey(char *pk);
|
void printKey(char *pk);
|
||||||
static bool stripKey(const char *in_key, char out_key[PK_LENGTH]);
|
static bool stripKey(const char *in_key, char out_key[PK_LENGTH]);
|
||||||
|
static std::string readFromStdin();
|
||||||
|
|
||||||
int BINK1998Generate();
|
int BINK1998Generate();
|
||||||
int BINK2002Generate();
|
int BINK2002Generate();
|
||||||
|
Reference in New Issue
Block a user