Bug 1383501: Use HKEY_LOCAL_MACHINE\SOFTWARE\Classes for resolving COM registration instead of HKEY_CLASSES_ROOT; r=eeejay

MozReview-Commit-ID: 4kMWNKEpejh
This commit is contained in:
Aaron Klotz 2017-08-21 12:55:55 -06:00
Родитель bd05dcbb61
Коммит bbcb22aba6
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -224,11 +224,15 @@ ReadCOMRegDefaultString(const nsString& aRegPath, nsAString& aOutBuf)
{
aOutBuf.Truncate();
nsAutoString fullyQualifiedRegPath;
fullyQualifiedRegPath.AppendLiteral(u"SOFTWARE\\Classes\\");
fullyQualifiedRegPath.Append(aRegPath);
// Get the required size and type of the registry value.
// We expect either REG_SZ or REG_EXPAND_SZ.
DWORD type;
DWORD bufLen = 0;
LONG result = ::RegGetValue(HKEY_CLASSES_ROOT, aRegPath.get(),
LONG result = ::RegGetValue(HKEY_LOCAL_MACHINE, fullyQualifiedRegPath.get(),
nullptr, RRF_RT_ANY, &type, nullptr, &bufLen);
if (result != ERROR_SUCCESS || (type != REG_SZ && type != REG_EXPAND_SZ)) {
return false;
@ -239,7 +243,7 @@ ReadCOMRegDefaultString(const nsString& aRegPath, nsAString& aOutBuf)
aOutBuf.SetLength((bufLen + 1) / sizeof(char16_t));
result = ::RegGetValue(HKEY_CLASSES_ROOT, aRegPath.get(), nullptr,
result = ::RegGetValue(HKEY_LOCAL_MACHINE, fullyQualifiedRegPath.get(), nullptr,
flags, nullptr, aOutBuf.BeginWriting(), &bufLen);
if (result != ERROR_SUCCESS) {
aOutBuf.Truncate();