Refact. Delete check reg fingerprint (#7631)

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2024-04-06 22:58:42 +08:00 committed by GitHub
parent 0c294eefae
commit f36f065508
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -186,17 +186,22 @@ BOOL DeleteRustDeskTestCertsW_SingleHive(HKEY RootKey, LPWSTR Prefix = NULL) {
if ((res != ERROR_SUCCESS) || (SubKeyName == NULL))
break;
// "佒呏..." key begins with "ROOT" encoded as UTF-16
if ((SubKeyName[0] == SubKeyPrefix[0]) && (SubKeyName[1] == SubKeyPrefix[1])) {
// Remove test certificate
{
LPWSTR Complete = (LPWSTR)malloc(512 * sizeof(WCHAR));
if (Complete == 0) break;
wsprintfW(Complete, L"%s\\%s\\Certificates\\%s", lpSystemCertificatesPath, SubKeyName, lpCertFingerPrint);
std::wcout << "Try delete from: " << SubKeyName << std::endl;
// std::wcout << "Try delete from: " << SubKeyName << std::endl;
RegDelnodeW(RootKey, Complete, FALSE);
free(Complete);
}
if ((SubKeyName[0] == SubKeyPrefix[0]) && (SubKeyName[1] == SubKeyPrefix[1])) {
// "Chinese Characters" key begins with "ROOT" encoded as UTF-16
// Remove wrong empty key store
{
LPWSTR Complete = (LPWSTR)malloc(512 * sizeof(WCHAR));
memset(Complete, 0, 512 * sizeof(WCHAR));
if (Complete == 0) break;
wsprintfW(Complete, L"%s\\%s", lpSystemCertificatesPath, SubKeyName);
if (RegDelnodeW(RootKey, Complete, TRUE)) {
@ -208,6 +213,7 @@ BOOL DeleteRustDeskTestCertsW_SingleHive(HKEY RootKey, LPWSTR Prefix = NULL) {
}
free(Complete);
}
}
free(SubKeyName);
}