Scolinks wrote: But I have difficulties using the RegQueryValue functions. I found some examples on the net but they all use CString and I cant use it because I dont write in MFC... There are plenty of MSDN examples that do not use MFC. Here's but one:
#define RTN_UNKNOWN 0
#define RTN_SERVER 1
#define RTN_WORKSTATION 2
#define RTN_NTAS 3
#define RTN_ERROR 13
DWORD GetWindowsVariant(void)
{
#define MY_BUFSIZE 32 // Arbitrary initial value.
// Dynamic allocation will be used.
HKEY hKey;
TCHAR szProductType[MY_BUFSIZE];
DWORD dwBufLen = MY_BUFSIZE;
LONG lRet;
if(RegOpenKeyEx(HKEY\_LOCAL\_MACHINE,
TEXT("SYSTEM\\\\CurrentControlSet\\\\Control\\\\ProductOptions"),
0,
KEY\_QUERY\_VALUE,
&hKey) != ERROR\_SUCCESS) return RTN\_ERROR;
lRet = RegQueryValueEx(hKey,
TEXT("ProductType"),
NULL,
NULL,
(LPBYTE)szProductType,
&dwBufLen);
RegCloseKey(hKey);
if(lRet != ERROR\_SUCCESS) return RTN\_ERROR;
// check product options, in order of likelihood
if(lstrcmpi(TEXT("WINNT"), szProductType) == 0)
return RTN\_WORKSTATION;
if(lstrcmpi(TEXT("SERVERNT"), szProductType) == 0)
return RTN\_SERVER;
if(lstrcmpi(TEXT("LANMANNT"), szProductType) == 0)
return RTN\_NTAS;
// else return "unknown variant" code
else return RTN\_UNKNOWN;
}
Here are some searches returned from Google: http://www.windowsitlibrary.com/Content/69/07/1.html http://www.geocities.com/merijn\_bellekom/new/win9xcpu.html http://www.pc-magazin.de/common/forum/forum.php?id=30000624&forum=30&dsp\_start=120&expand=1&suchwort=
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen