-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathusbdump.cpp
More file actions
41 lines (34 loc) · 1.19 KB
/
usbdump.cpp
File metadata and controls
41 lines (34 loc) · 1.19 KB
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
// usbdump.cpp : Defines the entry point for the application.
//
#include "usbdump.h"
using namespace std;
using json = nlohmann::json;
void initGlobals() {
gHubList.DeviceInfo = INVALID_HANDLE_VALUE;
InitializeListHead(&gHubList.ListHead);
gDeviceList.DeviceInfo = INVALID_HANDLE_VALUE;
InitializeListHead(&gDeviceList.ListHead);
}
int main(int argc, char* argv[]) {
if (argc >= 2) {
if (std::string(argv[1]) == "--version" || std::string(argv[1]) == "-v") {
std::cout << "usbdump " TOOL_VERSION << std::endl;
std::cout << "Built on " __DATE__ " " __TIME__ << std::endl;
return 0;
} else {
return 1;
}
}
initGlobals();
ULONG devicesConnected;
std::vector<USBHOSTCONTROLLERINFO*> hostControllers = EnumerateHostControllers((HTREEITEM)1, &devicesConnected);
json ree = hostControllers;
std::cout << ree.dump(4) << std::endl;
/* for (const auto& hostController : hostControllers) {
// std::cout << hostController->DriverKey << std::endl;
json ree = hostController;
std::cout << ree.dump(4) << std::endl;
} */
// std::cout << "Done" << std::endl;
return 0;
}