1
0

Fix build

This commit is contained in:
Scott E. Graves
2017-05-03 21:35:46 -05:00
parent 304acc81e8
commit a985f1823e
2 changed files with 13 additions and 5 deletions

View File

@@ -219,9 +219,17 @@ BOOL SIADRIVE_EXPORTABLE RecurDeleteFilesByExtentsion(const SString& folder, con
#ifdef _WIN32
std::vector<SString> SIADRIVE_EXPORTABLE GetAvailableDrives();
std::int32_t SIADRIVE_EXPORTABLE GetRegistry(const SString& name, const std::int32_t& defaultValue);
std::int32_t SIADRIVE_EXPORTABLE GetRegistry(const SString& name, const std::int32_t& defaultValue, const bool& user = false);
SString SIADRIVE_EXPORTABLE GetRegistry(const SString& name, const SString& defaultValue, const bool& user = false);
void SIADRIVE_EXPORTABLE SetRegistry(const SString& name, const SString& value);
HRESULT SIADRIVE_EXPORTABLE CreateShortcut(const SString& execPath, const SString& description, const SString& shortcutPath, const bool& minimized);
SString SIADRIVE_EXPORTABLE SecureEncryptString(const SString& name, const SString& data);
SString SIADRIVE_EXPORTABLE SecureDecryptString(const SString& name, const SString& data);
#endif
bool SIADRIVE_EXPORTABLE ExecuteProcess(CSiaDriveConfig* siaDriveConfig, FilePath process, FilePath workingDir, const bool& waitForExit);

View File

@@ -192,16 +192,16 @@ std::vector<SString> GetAvailableDrives()
return std::move(avail);
}
std::int32_t GetRegistry(const SString& name, const std::int32_t& defaultValue)
std::int32_t GetRegistry(const SString& name, const std::int32_t& defaultValue, const bool& user)
{
std::int32_t ret = defaultValue;
DWORD dataLen = 0;
if (::RegGetValue(HKEY_LOCAL_MACHINE, L"Software\\SiaExtensions\\SiaDrive", &name[0], RRF_RT_REG_SZ, nullptr, nullptr, &dataLen) == ERROR_SUCCESS)
if (::RegGetValue((user ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE), L"Software\\SiaExtensions\\SiaDrive", &name[0], RRF_RT_REG_SZ, nullptr, nullptr, &dataLen) == ERROR_SUCCESS)
{
SString data;
data.Resize(dataLen + 1);
if (::RegGetValue(HKEY_LOCAL_MACHINE, L"Software\\SiaExtensions\\SiaDrive", &name[0], RRF_RT_REG_SZ, nullptr, &data[0], &dataLen) == ERROR_SUCCESS)
if (::RegGetValue((user ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE), L"Software\\SiaExtensions\\SiaDrive", &name[0], RRF_RT_REG_SZ, nullptr, &data[0], &dataLen) == ERROR_SUCCESS)
{
ret = SString::ToInt32(data);
}
@@ -228,7 +228,7 @@ SString GetRegistry(const SString& name, const SString& defaultValue, const bool
return ret;
}
void SIADRIVE_EXPORTABLE SetRegistry(const SString& name, const SString& value)
void SetRegistry(const SString& name, const SString& value)
{
::RegSetKeyValue(HKEY_CURRENT_USER, L"Software\\SiaExtensions\\SiaDrive", &name[0], REG_SZ, &value[0], value.ByteLength() + sizeof(SString::SChar));
}