Ciao io ho un prog che a seconda del sistema operativo, deve fare 2 cose diverse ( nt based o 9x ).....quindi vorrei chiedervi cosa mi conviene utilizzare come discriminante... io avevo intenzioen di fare qualcosa del genere :
codice:
#include <windows.h>
#include <stdio.h>
BOOL readRegStringValue(HKEY hfather,const char* pathToKey,const char* valueName,char* buf,size_t size)
{
HKEY hKey;
BOOL b=FALSE;
if(RegOpenKeyEx(hfather,pathToKey,0,KEY_READ,&hKey)==ERROR_SUCCESS)
{
DWORD dwType;
if(RegQueryValueEx(hKey,valueName,NULL,&dwType,(LPBYTE)buf,&size)==ERROR_SUCCESS)
b=TRUE;
RegCloseKey(hKey);
}
return b;
}
int main()
{
char buf[MAX_PATH];
if(readRegStringValue(HKEY_CURRENT_USER,"CHIAVE CON QUALCOSA DI DISCRIMINANTE ","",buf,MAX_PATH))
if (buf != VALORE9x || VALOREXP )
printf("errore");
else if (buf = VALORE9x)
printf("9x\n");
else printf("XP\n");
return 0;
system ("pause");
}
dovrebbe funzionare no ?
consocete qualcosa di significativo come discriminante ?