1 // Copyright 2020 The Chromium Authors 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 BASE_WIN_SCOPED_DEVINFO_H_ 6 #define BASE_WIN_SCOPED_DEVINFO_H_ 7 8 #include <setupapi.h> 9 10 #include "base/scoped_generic.h" 11 12 namespace base { 13 namespace win { 14 15 struct DevInfoScopedTraits { InvalidValueDevInfoScopedTraits16 static HDEVINFO InvalidValue() { return INVALID_HANDLE_VALUE; } FreeDevInfoScopedTraits17 static void Free(HDEVINFO h) { SetupDiDestroyDeviceInfoList(h); } 18 }; 19 using ScopedDevInfo = base::ScopedGeneric<HDEVINFO, DevInfoScopedTraits>; 20 21 } // namespace win 22 } // namespace base 23 24 #endif // BASE_WIN_SCOPED_DEVINFO_H_ 25