• R/O
  • SSH
  • HTTPS

hamigaki: 提交


Commit MetaInfo

修訂1769 (tree)
時間2010-04-11 21:25:51
作者hamigaki

Log Message

avoided exceptions about failing to open the registry

Change Summary

差異

--- hamigaki/trunk/libs/audio/src/asio_drivers.cpp (revision 1768)
+++ hamigaki/trunk/libs/audio/src/asio_drivers.cpp (revision 1769)
@@ -1,6 +1,6 @@
11 // asio_drivers.cpp: ASIO devices
22
3-// Copyright Takeshi Mouri 2006, 2007.
3+// Copyright Takeshi Mouri 2006-2010.
44 // Distributed under the Boost Software License, Version 1.0.
55 // (See accompanying file LICENSE_1_0.txt or copy at
66 // http://www.boost.org/LICENSE_1_0.txt)
@@ -20,21 +20,27 @@
2020 using namespace hamigaki::detail::windows;
2121
2222 std::string asio_key_name("SOFTWARE\\ASIO");
23- registry_key asio_key(HKEY_LOCAL_MACHINE, asio_key_name, KEY_READ);
24-
2523 std::vector<driver_info> drivers;
26- for (registry_key_iterator i(asio_key), end; i != end; ++i)
24+ try
2725 {
28- std::string sub_key_name(asio_key_name);
29- sub_key_name += '\\';
30- sub_key_name += *i;
26+ registry_key asio_key(HKEY_LOCAL_MACHINE, asio_key_name, KEY_READ);
3127
32- registry_key key(HKEY_LOCAL_MACHINE, sub_key_name, KEY_READ);
33- driver_info info;
34- info.clsid = uuid(key.get_value("CLSID").c_str());
35- info.name = key.get_value("Description");
36- drivers.push_back(info);
28+ for (registry_key_iterator i(asio_key), end; i != end; ++i)
29+ {
30+ std::string sub_key_name(asio_key_name);
31+ sub_key_name += '\\';
32+ sub_key_name += *i;
33+
34+ registry_key key(HKEY_LOCAL_MACHINE, sub_key_name, KEY_READ);
35+ driver_info info;
36+ info.clsid = uuid(key.get_value("CLSID").c_str());
37+ info.name = key.get_value("Description");
38+ drivers.push_back(info);
39+ }
3740 }
41+ catch (const std::exception&)
42+ {
43+ }
3844 return drivers;
3945 }
4046
Show on old repository browser