mirror of
https://github.com/Neo-Desktop/WindowsXPKg
synced 2024-11-17 19:31:00 +02:00
commit
72c42f66c9
@ -32,10 +32,7 @@
|
||||
QWORD MOD = 0;
|
||||
QWORD NON_RESIDUE = 0;
|
||||
QWORD f[6] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
|
||||
int productID1;
|
||||
int productID2;
|
||||
int productID3;
|
||||
int productID4;
|
||||
int productID[4];
|
||||
int activationMode;
|
||||
|
||||
int ConfirmationID::calculateCheckDigit(int pid)
|
||||
@ -889,11 +886,11 @@ int ConfirmationID::Generate(const char* installation_id_str, char confirmation_
|
||||
case 1:
|
||||
case 4:
|
||||
memcpy(&parsed, installation_id, sizeof(parsed));
|
||||
productID1 = parsed.ProductIDLow & ((1 << 17) - 1);
|
||||
productID2 = (parsed.ProductIDLow >> 17) & ((1 << 10) - 1);
|
||||
productID3 = (parsed.ProductIDLow >> 27) & ((1 << 24) - 1);
|
||||
productID[0] = parsed.ProductIDLow & ((1 << 17) - 1);
|
||||
productID[1] = (parsed.ProductIDLow >> 17) & ((1 << 10) - 1);
|
||||
productID[2] = (parsed.ProductIDLow >> 27) & ((1 << 24) - 1);
|
||||
version = (parsed.ProductIDLow >> 51) & 15;
|
||||
productID4 = (parsed.ProductIDLow >> 55) | (parsed.ProductIDHigh << 9);
|
||||
productID[3] = (parsed.ProductIDLow >> 55) | (parsed.ProductIDHigh << 9);
|
||||
switch (activationMode) {
|
||||
case 0:
|
||||
if (version != (totalCount == 41 ? 9 : 10))
|
||||
@ -911,21 +908,6 @@ int ConfirmationID::Generate(const char* installation_id_str, char confirmation_
|
||||
case 2:
|
||||
case 3:
|
||||
decode_iid_new_version(installation_id, hardwareID, &version);
|
||||
productID1 = stoi(productid.substr(0,5));
|
||||
std::string channelid = productid.substr(6,3);
|
||||
char *p = &channelid[0];
|
||||
for (; *p; p++) {
|
||||
*p = toupper((unsigned char)*p);
|
||||
}
|
||||
if (strcmp(&channelid[0], "OEM") == 0) {
|
||||
productID2 = stoi(productid.substr(12,3));
|
||||
productID3 = calculateCheckDigit((stoi(productid.substr(15,1)) * 100000) + (stoi(productid.substr(18,5))));
|
||||
productID4 = (stoi((productid.substr(10,2))) / 100000) * 1000;
|
||||
} else {
|
||||
productID2 = stoi(productid.substr(6,3));
|
||||
productID3 = stoi(productid.substr(10,7));
|
||||
productID4 = stoi(productid.substr(18,5));
|
||||
}
|
||||
switch (activationMode) {
|
||||
case 2:
|
||||
if (version != 3)
|
||||
@ -936,13 +918,28 @@ int ConfirmationID::Generate(const char* installation_id_str, char confirmation_
|
||||
return ERR_UNKNOWN_VERSION;
|
||||
}
|
||||
memcpy(&parsed, hardwareID, 8);
|
||||
break;
|
||||
productID[0] = stoi(productid.substr(0,5));
|
||||
std::string channelid = productid.substr(6,3);
|
||||
char *p = &channelid[0];
|
||||
for (; *p; p++) {
|
||||
*p = toupper((unsigned char)*p);
|
||||
}
|
||||
if (strcmp(&channelid[0], "OEM") == 0) {
|
||||
productID[1] = stoi(productid.substr(12,3));
|
||||
productID[2] = (stoi(productid.substr(15,1)) * 100000) + stoi(productid.substr(18,5));
|
||||
productID[2] = calculateCheckDigit(productID[2]);
|
||||
productID[3] = ((stoi(productid.substr(10,2))) * 1000) + productID[3];
|
||||
} else {
|
||||
productID[1] = stoi(productid.substr(6,3));
|
||||
productID[2] = stoi(productid.substr(10,7));
|
||||
productID[3] = stoi(productid.substr(18,5));
|
||||
}
|
||||
//fmt::print("ProductID: {}-{}-{}-{} \n", productID[0], productID[1], productID[2], productID[3]);
|
||||
}
|
||||
//printf("Product ID: %05u-%03u-%07u-%05u\n", productId1, productId2, productId3, productId4);
|
||||
|
||||
|
||||
unsigned char keybuf[16];
|
||||
memcpy(keybuf, &parsed.HardwareID, 8);
|
||||
QWORD productIdMixed = (QWORD)productID1 << 41 | (QWORD)productID2 << 58 | (QWORD)productID3 << 17 | productID4;
|
||||
QWORD productIdMixed = (QWORD)productID[0] << 41 | (QWORD)productID[1] << 58 | (QWORD)productID[2] << 17 | productID[3];
|
||||
memcpy(keybuf + 8, &productIdMixed, 8);
|
||||
|
||||
TDivisor d;
|
||||
|
Loading…
Reference in New Issue
Block a user