Index: device/core/scoped_device_info_list.h |
diff --git a/device/core/scoped_device_info_list.h b/device/core/scoped_device_info_list.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5708e247b49ef8b5759f48ec55f174194dd2caaa |
--- /dev/null |
+++ b/device/core/scoped_device_info_list.h |
@@ -0,0 +1,38 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef DEVICE_CORE_SCOPED_DEVICE_INFO_LIST_H_ |
+#define DEVICE_CORE_SCOPED_DEVICE_INFO_LIST_H_ |
+ |
+#include <windows.h> |
+#include <setupapi.h> |
+ |
+#include "base/win/scoped_handle.h" |
+ |
+namespace base { |
+namespace win { |
+ |
+// Traits for HDEVINFO that properly destroys it. |
+struct DeviceInfoListTraits { |
+ typedef HDEVINFO Handle; |
+ |
+ static void CloseHandle(HDEVINFO handle) { |
+ SetupDiDestroyDeviceInfoList(handle); |
+ } |
+ |
+ static bool IsHandleValid(HDEVINFO handle) { |
+ return handle != INVALID_HANDLE_VALUE; |
+ } |
+ |
+ static HDEVINFO NullHandle() { return INVALID_HANDLE_VALUE; } |
+}; |
+ |
+typedef base::win::GenericScopedHandle<DeviceInfoListTraits, |
+ base::win::DummyVerifierTraits> |
+ ScopedDeviceInfoList; |
+ |
+} // namespace win |
+} // namespace base |
+ |
+#endif // DEVICE_CORE_SCOPED_DEVICE_INFO_LIST_H_ |