Update confid.cpp

This commit is contained in:
TheTank20 2024-04-13 18:43:32 +00:00 committed by GitHub
parent 2bc3503fd8
commit c965b88113
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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; int version;
unsigned char hardwareID[8]; unsigned char hardwareID[8];
@ -870,8 +870,8 @@ int ConfirmationID::Generate(const char* installation_id_str, char confirmation_
iid_key[3] = 0xF3; iid_key[3] = 0xF3;
} }
Unmix(installation_id, totalCount == 41 ? 17 : 19, iid_key, 4); Unmix(installation_id, totalCount == 41 ? 17 : 19, iid_key, 4);
//if (installation_id[18] >= 0x10) if (installation_id[18] >= 0x10 && overrideVersion == false)
// return ERR_UNKNOWN_VERSION; return ERR_UNKNOWN_VERSION;
#pragma pack(push, 1) #pragma pack(push, 1)
struct { struct {
@ -891,32 +891,38 @@ int ConfirmationID::Generate(const char* installation_id_str, char confirmation_
productID[2] = (parsed.ProductIDLow >> 27) & ((1 << 24) - 1); productID[2] = (parsed.ProductIDLow >> 27) & ((1 << 24) - 1);
version = (parsed.ProductIDLow >> 51) & 15; version = (parsed.ProductIDLow >> 51) & 15;
productID[3] = (parsed.ProductIDLow >> 55) | (parsed.ProductIDHigh << 9); productID[3] = (parsed.ProductIDLow >> 55) | (parsed.ProductIDHigh << 9);
//switch (activationMode) { if (overrideVersion == false) {
// case 0: switch (activationMode) {
// if (version != (totalCount == 41 ? 9 : 10)) case 0:
// return ERR_UNKNOWN_VERSION; if (version != (totalCount == 41 ? 9 : 10))
// break; return ERR_UNKNOWN_VERSION;
// case 1: break;
// if (version != 1) case 1:
// return ERR_UNKNOWN_VERSION; if (version != 1)
// break; return ERR_UNKNOWN_VERSION;
// case 3: break;
// if (version != 4) case 3:
// return ERR_UNKNOWN_VERSION; if (version != 4)
//} return ERR_UNKNOWN_VERSION;
}
}
break; break;
case 2: case 2:
case 3: case 3:
decode_iid_new_version(installation_id, hardwareID, &version); decode_iid_new_version(installation_id, hardwareID, &version);
//switch (activationMode) { if (overrideVersion == false) {
// case 2: switch (activationMode) {
// if (version != 3) case 2:
// return ERR_UNKNOWN_VERSION; if (version != 3)
// break; return ERR_UNKNOWN_VERSION;
// case 3: break;
// if (version != 4) case 3:
// return ERR_UNKNOWN_VERSION; if (version != 4)
//} return ERR_UNKNOWN_VERSION;
break;
}
}
memcpy(&parsed, hardwareID, 8); memcpy(&parsed, hardwareID, 8);
productID[0] = stoi(productid.substr(0,5)); productID[0] = stoi(productid.substr(0,5));
std::string channelid = productid.substr(6,3); std::string channelid = productid.substr(6,3);