OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef DEVICE_CORE_SCOPED_DEVICE_INFO_LIST_H_ |
| 6 #define DEVICE_CORE_SCOPED_DEVICE_INFO_LIST_H_ |
| 7 |
| 8 #include <windows.h> |
| 9 #include <setupapi.h> |
| 10 |
| 11 #include "base/win/scoped_handle.h" |
| 12 |
| 13 namespace base { |
| 14 namespace win { |
| 15 |
| 16 // Traits for HDEVINFO that properly destroys it. |
| 17 struct DeviceInfoListTraits { |
| 18 typedef HDEVINFO Handle; |
| 19 |
| 20 static void CloseHandle(HDEVINFO handle) { |
| 21 SetupDiDestroyDeviceInfoList(handle); |
| 22 } |
| 23 |
| 24 static bool IsHandleValid(HDEVINFO handle) { |
| 25 return handle != INVALID_HANDLE_VALUE; |
| 26 } |
| 27 |
| 28 static HDEVINFO NullHandle() { return INVALID_HANDLE_VALUE; } |
| 29 }; |
| 30 |
| 31 typedef base::win::GenericScopedHandle<DeviceInfoListTraits, |
| 32 base::win::DummyVerifierTraits> |
| 33 ScopedDeviceInfoList; |
| 34 |
| 35 } // namespace win |
| 36 } // namespace base |
| 37 |
| 38 #endif // DEVICE_CORE_SCOPED_DEVICE_INFO_LIST_H_ |
OLD | NEW |