|
|
|
@@ -64,9 +64,9 @@ struct RegistryKeyWrapper |
|
|
|
}
|
|
|
|
|
|
|
|
static bool setValue (const String& regValuePath, const DWORD type,
|
|
|
|
const void* data, size_t dataSize)
|
|
|
|
const void* data, size_t dataSize, const DWORD wow64Flags)
|
|
|
|
{
|
|
|
|
const RegistryKeyWrapper key (regValuePath, true, 0);
|
|
|
|
const RegistryKeyWrapper key (regValuePath, true, wow64Flags);
|
|
|
|
|
|
|
|
return key.key != 0
|
|
|
|
&& RegSetValueEx (key.key, key.wideCharValueName, 0, type,
|
|
|
|
@@ -144,73 +144,58 @@ struct RegistryKeyWrapper |
|
|
|
JUCE_DECLARE_NON_COPYABLE (RegistryKeyWrapper)
|
|
|
|
};
|
|
|
|
|
|
|
|
uint32 WindowsRegistry::getBinaryValue (const String& regValuePath, MemoryBlock& result)
|
|
|
|
uint32 WindowsRegistry::getBinaryValue (const String& regValuePath, MemoryBlock& result, WoW64Mode mode)
|
|
|
|
{
|
|
|
|
return RegistryKeyWrapper::getBinaryValue (regValuePath, result, 0);
|
|
|
|
return RegistryKeyWrapper::getBinaryValue (regValuePath, result, (DWORD) mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
String WindowsRegistry::getValue (const String& regValuePath, const String& defaultValue)
|
|
|
|
String WindowsRegistry::getValue (const String& regValuePath, const String& defaultValue, WoW64Mode mode)
|
|
|
|
{
|
|
|
|
return RegistryKeyWrapper::getValue (regValuePath, defaultValue, 0);
|
|
|
|
return RegistryKeyWrapper::getValue (regValuePath, defaultValue, (DWORD) mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
String WindowsRegistry::getValueWow64 (const String& regValuePath, const String& defaultValue)
|
|
|
|
{
|
|
|
|
return RegistryKeyWrapper::getValue (regValuePath, defaultValue, 0x100 /*KEY_WOW64_64KEY*/);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WindowsRegistry::valueExistsWow64 (const String& regValuePath)
|
|
|
|
{
|
|
|
|
return RegistryKeyWrapper::valueExists (regValuePath, 0x100 /*KEY_WOW64_64KEY*/);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WindowsRegistry::keyExistsWow64 (const String& regValuePath)
|
|
|
|
{
|
|
|
|
return RegistryKeyWrapper::keyExists (regValuePath, 0x100 /*KEY_WOW64_64KEY*/);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WindowsRegistry::setValue (const String& regValuePath, const String& value)
|
|
|
|
bool WindowsRegistry::setValue (const String& regValuePath, const String& value, WoW64Mode mode)
|
|
|
|
{
|
|
|
|
return RegistryKeyWrapper::setValue (regValuePath, REG_SZ, value.toWideCharPointer(),
|
|
|
|
CharPointer_UTF16::getBytesRequiredFor (value.getCharPointer()));
|
|
|
|
CharPointer_UTF16::getBytesRequiredFor (value.getCharPointer()), mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WindowsRegistry::setValue (const String& regValuePath, const uint32 value)
|
|
|
|
bool WindowsRegistry::setValue (const String& regValuePath, const uint32 value, WoW64Mode mode)
|
|
|
|
{
|
|
|
|
return RegistryKeyWrapper::setValue (regValuePath, REG_DWORD, &value, sizeof (value));
|
|
|
|
return RegistryKeyWrapper::setValue (regValuePath, REG_DWORD, &value, sizeof (value), (DWORD) mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WindowsRegistry::setValue (const String& regValuePath, const uint64 value)
|
|
|
|
bool WindowsRegistry::setValue (const String& regValuePath, const uint64 value, WoW64Mode mode)
|
|
|
|
{
|
|
|
|
return RegistryKeyWrapper::setValue (regValuePath, REG_QWORD, &value, sizeof (value));
|
|
|
|
return RegistryKeyWrapper::setValue (regValuePath, REG_QWORD, &value, sizeof (value), (DWORD) mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WindowsRegistry::setValue (const String& regValuePath, const MemoryBlock& value)
|
|
|
|
bool WindowsRegistry::setValue (const String& regValuePath, const MemoryBlock& value, WoW64Mode mode)
|
|
|
|
{
|
|
|
|
return RegistryKeyWrapper::setValue (regValuePath, REG_BINARY, value.getData(), value.getSize());
|
|
|
|
return RegistryKeyWrapper::setValue (regValuePath, REG_BINARY, value.getData(), value.getSize(), (DWORD) mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WindowsRegistry::valueExists (const String& regValuePath)
|
|
|
|
bool WindowsRegistry::valueExists (const String& regValuePath, WoW64Mode mode)
|
|
|
|
{
|
|
|
|
return RegistryKeyWrapper::valueExists (regValuePath, 0);
|
|
|
|
return RegistryKeyWrapper::valueExists (regValuePath, (DWORD) mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WindowsRegistry::keyExists (const String& regValuePath)
|
|
|
|
bool WindowsRegistry::keyExists (const String& regValuePath, WoW64Mode mode)
|
|
|
|
{
|
|
|
|
return RegistryKeyWrapper::keyExists (regValuePath, 0);
|
|
|
|
return RegistryKeyWrapper::keyExists (regValuePath, (DWORD) mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
void WindowsRegistry::deleteValue (const String& regValuePath)
|
|
|
|
void WindowsRegistry::deleteValue (const String& regValuePath, WoW64Mode mode)
|
|
|
|
{
|
|
|
|
const RegistryKeyWrapper key (regValuePath, true, 0);
|
|
|
|
const RegistryKeyWrapper key (regValuePath, true, (DWORD) mode);
|
|
|
|
|
|
|
|
if (key.key != 0)
|
|
|
|
RegDeleteValue (key.key, key.wideCharValueName);
|
|
|
|
}
|
|
|
|
|
|
|
|
void WindowsRegistry::deleteKey (const String& regKeyPath)
|
|
|
|
void WindowsRegistry::deleteKey (const String& regKeyPath, WoW64Mode mode)
|
|
|
|
{
|
|
|
|
const RegistryKeyWrapper key (regKeyPath, true, 0);
|
|
|
|
const RegistryKeyWrapper key (regKeyPath, true, (DWORD) mode);
|
|
|
|
|
|
|
|
if (key.key != 0)
|
|
|
|
RegDeleteKey (key.key, key.wideCharValueName);
|
|
|
|
@@ -221,16 +206,22 @@ bool WindowsRegistry::registerFileAssociation (const String& fileExtension, |
|
|
|
const String& fullDescription,
|
|
|
|
const File& targetExecutable,
|
|
|
|
const int iconResourceNumber,
|
|
|
|
const bool registerForCurrentUserOnly)
|
|
|
|
const bool registerForCurrentUserOnly,
|
|
|
|
WoW64Mode mode)
|
|
|
|
{
|
|
|
|
const char* const root = registerForCurrentUserOnly ? "HKEY_CURRENT_USER\\Software\\Classes\\"
|
|
|
|
: "HKEY_CLASSES_ROOT\\";
|
|
|
|
const String key (root + symbolicDescription);
|
|
|
|
|
|
|
|
return setValue (root + fileExtension + "\\", symbolicDescription)
|
|
|
|
&& setValue (key + "\\", fullDescription)
|
|
|
|
&& setValue (key + "\\shell\\open\\command\\", targetExecutable.getFullPathName() + " \"%1\"")
|
|
|
|
return setValue (root + fileExtension + "\\", symbolicDescription, mode)
|
|
|
|
&& setValue (key + "\\", fullDescription, mode)
|
|
|
|
&& setValue (key + "\\shell\\open\\command\\", targetExecutable.getFullPathName() + " \"%1\"", mode)
|
|
|
|
&& (iconResourceNumber == 0
|
|
|
|
|| setValue (key + "\\DefaultIcon\\",
|
|
|
|
targetExecutable.getFullPathName() + "," + String (-iconResourceNumber)));
|
|
|
|
}
|
|
|
|
|
|
|
|
// These methods are deprecated:
|
|
|
|
String WindowsRegistry::getValueWow64 (const String& p, const String& defVal) { return getValue (p, defVal, WoW64_64bit); }
|
|
|
|
bool WindowsRegistry::valueExistsWow64 (const String& p) { return valueExists (p, WoW64_64bit); }
|
|
|
|
bool WindowsRegistry::keyExistsWow64 (const String& p) { return keyExists (p, WoW64_64bit); }
|