Fixed: Configurator.exe was unable to install APO if device name contained special characters illegal for file names (e.g. S/PDIF)

This commit is contained in:
jthedering committed 2013-01-19 18:42:33 +00:00
1 parent cad3e0ac2a
commit 7758366b58
3 files changed
+32 -1

No files matched your search

+2 -1
View File
@@ -68,7 +68,8 @@ void DeviceAPOInfo::install()
RegistryHelper::writeValue(APP_REGPATH L"\\Child APOs", deviceGuid, originalApoGuid);
RegistryHelper::saveToFile(renderKeyPath L"\\" + deviceGuid + L"\\FxProperties", apoGuidValueName, L"backup_" + deviceName + L"_" + connectionName + L".reg");
RegistryHelper::saveToFile(renderKeyPath L"\\" + deviceGuid + L"\\FxProperties", apoGuidValueName,
L"backup_" + RegistryHelper::replaceIllegalCharacters(deviceName) + L"_" + RegistryHelper::replaceIllegalCharacters(connectionName) + L".reg");
RegistryHelper::writeValue(renderKeyPath L"\\" + deviceGuid + L"\\FxProperties", apoGuidValueName, RegistryHelper::getGuidString(__uuidof(EqualizerAPO)));
}
+29
View File
@@ -18,6 +18,7 @@
*/
#include <fstream>
#include <sstream>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ObjBase.h>
@@ -211,6 +212,34 @@ wstring RegistryHelper::getGuidString(GUID guid)
return result;
}
wstring RegistryHelper::replaceIllegalCharacters(wstring filename)
{
wstringstream stream;
for(unsigned i=0; i<filename.length(); i++)
{
wchar_t c = filename[i];
switch(c)
{
case L'<':
case L'>':
case L':':
case L'"':
case L'/':
case L'\\':
case L'|':
case L'?':
case L'*':
stream.put(L'_');
break;
default:
stream.put(c);
}
}
return stream.str();
}
wstring RegistryHelper::getSystemErrorString(long status)
{
wchar_t* buf;
+1
View File
@@ -38,6 +38,7 @@ public:
static unsigned long valueCount(std::wstring key);
static void saveToFile(std::wstring key, std::wstring valuename, std::wstring filepath);
static std::wstring getGuidString(GUID guid);
static std::wstring replaceIllegalCharacters(std::wstring filename);
private:
static std::wstring getSystemErrorString(long status);