forked from wyrover/book-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
54 lines (43 loc) · 1.79 KB
/
Copy pathmain.cpp
File metadata and controls
54 lines (43 loc) · 1.79 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
42
43
44
45
46
47
48
49
50
51
52
53
54
// console_template.cpp : Defines the entry point for the console application.
//
#include "targetver.h"
#include <cactus/cactus_registry.h>
#include <stdio.h>
#include <tchar.h>
#include <locale.h>
#include <iostream>
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
_tsetlocale(LC_ALL, _T(""));
std::wcout.imbue(std::locale(""));
_tprintf_s(_T("%s\n"), _T("hello world. ÖÐÎIJâÊÔ"));
std::wcout << L"ÖÐÎIJâÊÔ" << std::endl;
std::vector<string16> subkeys;
std::wstring rootkey = L"SYSTEM\\CurrentControlSet\\Control\\CriticalDeviceDatabase";
LONG lRes = cactus::CRegKey::get_subkey_names(HKEY_LOCAL_MACHINE, rootkey, subkeys);
if (lRes == ERROR_SUCCESS) {
std::vector<string16>::iterator it = subkeys.begin();
for (; it != subkeys.end(); ++it) {
//std::wcout << (*it) << std::endl;
std::vector<string16> values;
std::wstring subkey = rootkey + L"\\" + (*it);
//std::wcout << subkey.c_str() << std::endl;
lRes = cactus::CRegKey::get_value_names(HKEY_LOCAL_MACHINE, subkey, values);
if (lRes == ERROR_SUCCESS) {
std::vector<string16>::iterator it2 = values.begin();
for (; it2 != values.end(); ++it2) {
if (wcsicmp((*it2).c_str(), L"DriverPackageId") == 0) {
//std::wcout << (*it2) << std::endl;
string16 orgine_inf_dir_name;
LONG lRes2 = cactus::CRegKey::ReadStringValue(HKEY_LOCAL_MACHINE, subkey, L"DriverPackageId", orgine_inf_dir_name);
if (lRes2 == ERROR_SUCCESS) {
std::wcout << orgine_inf_dir_name.c_str() << std::endl;
}
}
}
}
}
}
_tsystem(_T("pause"));
return 0;
}