xref: /aosp_15_r20/external/cronet/base/win/scoped_devinfo.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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