Lucky the code machine wrote: char* text; //unsigned long* buffer; DWORD* buffer; unsigned long PerServer; unsigned long Per1_0Server; CRegKey reg; You don't initialize your variables. do this instead:
TCHAR text[1024]; //May be any length suitable for the value
//unsigned long* buffer;
DWORD buffer = 1024;
unsigned long PerServer;
unsigned long Per1_0Server;
CRegKey reg;
reg.Open(HKEY_LOCAL_MACHINE,_T("Software\\Microsoft\\Windows\\CurrentVersion"));
reg.QueryValue(text,_T("ProductName"),&buffer);
Often, when a method asks for a pointer to value, it asks for a placeholder to return something to you. but the this pointer must point to valid memory area. Also, note use of TCHAR and _T(""). Michel It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard