* registry.cpp: Windows Registry Manipulation
****************************************************************************
* Copyright (C) 2008 the VideoLAN team
- * $Id: input_slider.cpp 24525 2008-01-23 21:50:58Z courmisch $
+ * $Id$
*
* Authors: Andre Weber <WeberAndre # gmx - de>
*
{
}
-bool QVLCRegistry::RegistryKeyExists( char *path )
+bool QVLCRegistry::RegistryKeyExists( const char *path )
{
HKEY keyHandle;
if( RegOpenKeyEx( m_RootKey, path, 0, KEY_READ, &keyHandle ) == ERROR_SUCCESS )
return false;
}
-bool QVLCRegistry::RegistryValueExists( char *path, char *valueName )
+bool QVLCRegistry::RegistryValueExists( const char *path, const char *valueName )
{
HKEY keyHandle;
bool temp = false;
return temp;
}
-void QVLCRegistry::WriteRegistryInt( char *path, char *valueName, int value )
+void QVLCRegistry::WriteRegistryInt( const char *path, const char *valueName, int value )
{
HKEY keyHandle;
}
}
-void QVLCRegistry::WriteRegistryString( char *path, char *valueName, char *value )
+void QVLCRegistry::WriteRegistryString( const char *path, const char *valueName, const char *value )
{
HKEY keyHandle;
}
}
-void QVLCRegistry::WriteRegistryDouble( char *path, char *valueName, double value )
+void QVLCRegistry::WriteRegistryDouble( const char *path, const char *valueName, double value )
{
HKEY keyHandle;
if( RegCreateKeyEx( m_RootKey, path, 0, NULL, REG_OPTION_NON_VOLATILE,
}
}
-int QVLCRegistry::ReadRegistryInt( char *path, char *valueName, int default_value ) {
+int QVLCRegistry::ReadRegistryInt( const char *path, const char *valueName, int default_value ) {
HKEY keyHandle;
int tempValue;
DWORD size1;
return default_value;
}
-char * QVLCRegistry::ReadRegistryString( char *path, char *valueName, char *default_value )
+char * QVLCRegistry::ReadRegistryString( const char *path, const char *valueName, char *default_value )
{
HKEY keyHandle;
char *tempValue = NULL;
if( valueType == REG_SZ )
{
// free
- tempValue = ( char * )malloc( size1+1 ); // +1 für NullByte`?
+ tempValue = ( char * )malloc( size1+1 ); // +1 für NullByte`?
if( RegQueryValueEx( keyHandle, valueName, NULL, &valueType, (LPBYTE)tempValue, &size1 ) == ERROR_SUCCESS )
{
default_value = tempValue;
}
if( tempValue == NULL )
{
- // wenn tempValue nicht aus registry gelesen wurde dafür sorgen das ein neuer String mit der Kopie von DefaultValue
- // geliefert wird - das macht das Handling des Rückgabewertes der Funktion einfacher - immer schön mit free freigeben!
+ // wenn tempValue nicht aus registry gelesen wurde dafür sorgen das ein neuer String mit der Kopie von DefaultValue
+ // geliefert wird - das macht das Handling des Rückgabewertes der Funktion einfacher - immer schön mit free freigeben!
default_value = strdup( default_value );
}
return default_value;
}
-double QVLCRegistry::ReadRegistryDouble( char *path, char *valueName, double default_value )
+double QVLCRegistry::ReadRegistryDouble( const char *path, const char *valueName, double default_value )
{
HKEY keyHandle;
double tempValue;
return default_value;
}
+int QVLCRegistry::DeleteValue( const char *path, const char *valueName )
+{
+ HKEY keyHandle;
+ long result;
+ if( (result = RegOpenKeyEx(m_RootKey, path, 0, KEY_WRITE, &keyHandle)) == ERROR_SUCCESS)
+ {
+ result = RegDeleteValue(keyHandle, valueName);
+ RegCloseKey(keyHandle);
+ }
+ //ERROR_SUCCESS = ok everything else you have a problem*g*,
+ return result;
+}
+
+long QVLCRegistry::DeleteKey( const char *path, const char *keyName )
+{
+ HKEY keyHandle;
+ long result;
+ if( (result = RegOpenKeyEx(m_RootKey, path, 0, KEY_WRITE, &keyHandle)) == ERROR_SUCCESS)
+ {
+ // be warned the key "keyName" will not be deleted if there are subkeys below him, values
+ // I think are ok and will be recusively deleted, but not keys...
+ // for this case we have to do a little bit more work!
+ result = RegDeleteKey(keyHandle, keyName);
+ RegCloseKey(keyHandle);
+ }
+ //ERROR_SUCCESS = ok everything else you have a problem*g*,
+ return result;
+}
+
#endif /* WIN32 */