Code: Select all
Software
Microsoft
Current version
Security
etc
Sam
Sofware
Security
Sam
+values
Can anybody help me make this function, which will fast read registry as DIR in cmd?
Code: Select all
Software
Microsoft
Current version
Security
etc
Sam
Code: Select all
#include <windows.h>
#include <stdio.h>
void main()
{
char lszValue[100];
LONG lRet, lEnumRet;
HKEY hKey;
DWORD dwLength=100;
int i=0;
lRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\ADOBE", 0, KEY_READ , &hKey);
printf("HKEY_LOCAL_MACHINE\\SOFTWARE\\ADOBE\n\n");
if(lRet == ERROR_SUCCESS)
{
lEnumRet = RegEnumKey(hKey, i,lszValue,dwLength);
while(lEnumRet == ERROR_SUCCESS)
{
i++;
printf ("[%s]\n",lszValue);
lEnumRet = RegEnumKey(hKey, i,lszValue,dwLength);
}
}
}
Code: Select all
#include <iostream>
#include <windows.h>
int main()
{
const int KeyNameBufferSize = 256;
LONG result = ERROR_SUCCESS;
TCHAR keyName[KeyNameBufferSize];
DWORD index = 0;
DWORD nameLength = KeyNameBufferSize;
FILETIME lastWriteTime;
std::cout << "Enumerating HKEY_LOCAL_MACHINE" << std::endl;
while (result == ERROR_SUCCESS)
{
nameLength = KeyNameBufferSize;
result = ::RegEnumKeyEx(HKEY_LOCAL_MACHINE, index, keyName,
&nameLength, 0, NULL, NULL, &lastWriteTime);
if (result == ERROR_SUCCESS)
{
std::cout << keyName << std::endl;
}
index++;
}
std::cout << "Done enumerating keys" << std::endl;
return 0;
}