RISOLTO
codice:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main(int argc, char *argv[])
{
LONG result = ERROR_SUCCESS;
HKEY hKey = NULL;
DWORD nome_buffer_dime = 1024;
DWORD dati_buffer_dime = 1024;
TCHAR nome_buffer[1024];
char dati_buffer[1024];
int indice = 0;
TCHAR key_nome[]= "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Ran";
result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, key_nome, 0, KEY_QUERY_VALUE, &hKey);
if (result != ERROR_SUCCESS)
{//Errore nella chiave
printf("Impossibile aprire il registro...\n\n");
return 0;
}
while(ERROR_NO_MORE_ITEMS != (result=RegEnumValueA(hKey, indice,nome_buffer,&nome_buffer_dime, NULL,NULL,(LPBYTE)dati_buffer, &dati_buffer_dime)))
{
printf("%s\n", dati_buffer);
++index;
}
system("PAUSE");
return 0;
}