char regString[4096]; char *ReadRegistryString(char *valeur, char *defaut) { HKEY hKey=NULL; DWORD dwStatus; unsigned long taille, type; dwStatus = RegCreateKey(HKEY_CURRENT_USER,"Software\\Text Walker",&hKey); if (dwStatus) return defaut; dwStatus = RegQueryValueEx(hKey,valeur,NULL,&type,(unsigned char*)regString,&taille); if (dwStatus || type!=REG_SZ) { dwStatus = RegSetValueEx(hKey,valeur,0,REG_SZ,(unsigned char*)defaut,strlen(defaut)); strcpy(regString,defaut); } return regString; } DWORD ReadRegistryDWORD(char *valeur, DWORD defaut) { HKEY hKey=NULL; DWORD dwStatus; unsigned long taille, type, val; dwStatus = RegCreateKey(HKEY_CURRENT_USER,"Software\\Text Walker",&hKey); if (dwStatus) return defaut; dwStatus = RegQueryValueEx(hKey,valeur,NULL,&type,(unsigned char*)&val,&taille); if (dwStatus || type!=REG_DWORD) { dwStatus = RegSetValueEx(hKey,valeur,0,REG_DWORD,(unsigned char*)&defaut,sizeof(defaut)); val=defaut; } return val; } void WriteRegistryString(char *valeur, char *string) { HKEY hKey=NULL; DWORD dwStatus; dwStatus = RegCreateKey(HKEY_CURRENT_USER,"Software\\Text Walker",&hKey); if (dwStatus) return; dwStatus = RegSetValueEx(hKey,valeur,0,REG_SZ,(unsigned char*)string,strlen(string)); } void WriteRegistryDWORD(char *valeur, DWORD val) { HKEY hKey=NULL; DWORD dwStatus; dwStatus = RegCreateKey(HKEY_CURRENT_USER,"Software\\Text Walker",&hKey); if (dwStatus) return; dwStatus = RegSetValueEx(hKey,valeur,0,REG_DWORD,(unsigned char*)&val,sizeof(val)); }