0

can someone help me ,i am trying to enumarate some registry keys,i doesnt get me any error,just the output is wrong:

```
void Registry::open_key(HKEY Key , char* subkey)
{
RegOpenKeyEx(Key , subkey , 0 , KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE , &hkey);
}
void Registry::querry_info_key()
{
RegQueryInfoKey(hkey , 0 , 0 , 0 , &sub_keys , 0 , 0 , 0 , 0 , 0 , 0 , &filetime);
if(sub_keys)
{
cout << "There are " << sub_keys << " keys" << endl;
}
}
void Registry::enum_key()
{
for(DWORD i = 0; i < sub_keys; i++)
{
RegEnumKeyEx(hkey , i , name , &size , 0 , 0 , 0 , &filetime);
cout << i << ":" << name << endl;
}
}
void Registry::run()
{
HKEY keys[] = { HKEY_CLASSES_ROOT , HKEY_CURRENT_USER , HKEY_LOCAL_MACHINE , HKEY_USERS , HKEY_CURRENT_CONFIG };
//for(int i = 0 < 5; i++)
//{
open_key(keys[1] , "Software");
querry_info_key();
enum_key();
//}
}
int main()
{
Registry x;
x.run();
}
```

OUTPUT :

```
There are 70 keys
0:7-Zip
1:7-Zip
2:Adob
3:Adob
4:Adob
5:Adob
6:Awar
7:Awar
8:BST
9:BST
10:BST
11:BST
12:BST
13:BST
14:BST
15:BST
16:BST
17:BST
18:BST
19:BST
20:BST
21:BST
22:BST
23:BST
24:BST
25:BST
26:BST
27:BST
28:BST
29:BST
30:BST
31:BST
32:BST
33:BST
34:BST
35:BST
36:BST
37:BST
38:BST
39:BST
40:BST
41:BST
42:BST
43:BST
44:BST
45:BST
46:BST
47:BST
48:BST
49:BST
50:BST
51:BST
52:BST
53:BST
54:BST
55:BST
56:BST
57:BST
58:BST
59:BST
60:vB
61:vB
62:vB
63:vB
64:vB
65:vB
66:vB
67:vB
68:vB
69:vB
```