-
Notifications
You must be signed in to change notification settings - Fork 2
/
usbdump.h
50 lines (37 loc) · 1.06 KB
/
usbdump.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// usbdump.h : Include file for standard system include files,
// or project specific include files.
#pragma once
#include <iostream>
#include <windows.h>
#include <SetupAPI.h>
#include <winioctl.h>
#include <initguid.h>
#include <usbiodef.h>
#include <usbioctl.h>
#include <strsafe.h>
#include <memory>
#include <usbdi.h>
#include <usbuser.h>
#include <vector>
#include "uvcview.h"
#include "specializations.hpp"
#include "nlohmann/json.hpp"
#define TOOL_VERSION "0.2"
#define QUICKCOUT(...) std::cout << __VA_ARGS__ << std::endl
extern DEVICE_GUID_LIST gHubList;
extern DEVICE_GUID_LIST gDeviceList;
struct HandleDeleter
{
// By defining the pointer type, we can delete a type other than T*.
// In other words, we can declare unique_ptr<HANDLE, Deleter> instead of
// unique_ptr<void, Deleter> which leaks the HANDLE abstraction.
typedef HANDLE pointer;
void operator()(HANDLE h)
{
if(h != INVALID_HANDLE_VALUE)
{
CloseHandle(h);
}
}
};
typedef std::unique_ptr<HANDLE, HandleDeleter> handle_unique_ptr;