mirror of
https://github.com/yuanyuanxiang/SimpleRemoter.git
synced 2026-01-23 07:43:13 +08:00
Improve: Ask for running master with administrator
This commit is contained in:
@@ -89,13 +89,16 @@ std::string execCommand(const char* cmd)
|
||||
}
|
||||
|
||||
// <20><>ȡӲ<C8A1><D3B2> ID<49><44>CPU + <20><><EFBFBD><EFBFBD> + Ӳ<>̣<EFBFBD>
|
||||
std::string getHardwareID()
|
||||
std::string getHardwareID(fallback fb)
|
||||
{
|
||||
std::string cpuID = execCommand("wmic cpu get processorid");
|
||||
std::string boardID = execCommand("wmic baseboard get serialnumber");
|
||||
std::string diskID = execCommand("wmic diskdrive get serialnumber");
|
||||
|
||||
std::string combinedID = cpuID + "|" + boardID + "|" + diskID;
|
||||
if (fb && combinedID.find("ERROR") != std::string::npos) {
|
||||
return fb();
|
||||
}
|
||||
return combinedID;
|
||||
}
|
||||
|
||||
@@ -144,9 +147,9 @@ std::string deriveKey(const std::string& password, const std::string& hardwareID
|
||||
return hashSHA256(password + " + " + hardwareID);
|
||||
}
|
||||
|
||||
std::string getDeviceID()
|
||||
std::string getDeviceID(fallback fb)
|
||||
{
|
||||
static std::string hardwareID = getHardwareID();
|
||||
static std::string hardwareID = getHardwareID(fb);
|
||||
static std::string hashedID = hashSHA256(hardwareID);
|
||||
static std::string deviceID = getFixedLengthID(hashedID);
|
||||
return deviceID;
|
||||
|
||||
Reference in New Issue
Block a user