WinStd
Windows Win32 API using Standard C++
Loading...
Searching...
No Matches
SetupAPI.h
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
8
9#pragma once
10
11#include "Common.h"
12#include <SetupAPI.h>
13
14namespace winstd
15{
18
25 class setup_device_info_list : public handle<HDEVINFO, INVALID_HANDLE_VALUE>
26 {
27 WINSTD_HANDLE_IMPL(setup_device_info_list, HDEVINFO, INVALID_HANDLE_VALUE)
28
29 public:
36 {
37 if (m_h != invalid)
39 }
40
41 protected:
47 void free_internal() noexcept override
48 {
49 SetupDiDestroyDeviceInfoList(m_h);
50 }
51 };
52
57 {
60
61 public:
68 _In_ HDEVINFO DeviceInfoSet,
69 _Inout_opt_ PSP_DEVINFO_DATA DeviceInfoData,
70 _In_ DWORD DriverType) noexcept :
71 m_DeviceInfoSet (DeviceInfoSet),
72 m_DeviceInfoData(DeviceInfoData),
73 m_DriverType (DriverType)
74 {
75 m_result = SetupDiBuildDriverInfoList(m_DeviceInfoSet, m_DeviceInfoData, m_DriverType);
76 }
77
84 {
85 if (m_result)
86 SetupDiDestroyDriverInfoList(m_DeviceInfoSet, m_DeviceInfoData, m_DriverType);
87 }
88
94 BOOL status() const noexcept
95 {
96 return m_result;
97 }
98
99 protected:
101 HDEVINFO m_DeviceInfoSet;
102 PSP_DEVINFO_DATA m_DeviceInfoData;
103 DWORD m_DriverType;
104 BOOL m_result;
106 };
107
109}
Base abstract template class to support generic object handle keeping.
Definition Common.h:1024
handle_type m_h
Definition Common.h:1276
HDEVINFO wrapper class.
Definition SetupAPI.h:26
virtual ~setup_device_info_list()
Frees the device information set.
Definition SetupAPI.h:35
void free_internal() noexcept override
Frees the device information set.
Definition SetupAPI.h:47
Builds a list of drivers in constructor and deletes it in destructor.
Definition SetupAPI.h:57
setup_driver_info_list_builder(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD DriverType) noexcept
Construct the builder and builds a list of drivers that is associated with a specific device or with ...
Definition SetupAPI.h:67
virtual ~setup_driver_info_list_builder()
Deletes a driver list and destructs the builder.
Definition SetupAPI.h:83
BOOL status() const noexcept
Return result of SetupDiBuildDriverInfoList() call.
Definition SetupAPI.h:94
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition Common.h:67
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition Common.h:75
#define WINSTD_HANDLE_IMPL(C, T, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition Common.h:164
static const HDEVINFO invalid
Definition Common.h:1034