Commit 55cf2711 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4: force registry functions to ANSI mode

parent d56c90bb
...@@ -42,7 +42,7 @@ QVLCRegistry::~QVLCRegistry( void ) ...@@ -42,7 +42,7 @@ QVLCRegistry::~QVLCRegistry( void )
bool QVLCRegistry::RegistryKeyExists( const char *path ) bool QVLCRegistry::RegistryKeyExists( const char *path )
{ {
HKEY keyHandle; HKEY keyHandle;
if( RegOpenKeyEx( m_RootKey, path, 0, KEY_READ, &keyHandle ) == ERROR_SUCCESS ) if( RegOpenKeyExA( m_RootKey, path, 0, KEY_READ, &keyHandle ) == ERROR_SUCCESS )
{ {
RegCloseKey( keyHandle ); RegCloseKey( keyHandle );
return true; return true;
...@@ -57,9 +57,9 @@ bool QVLCRegistry::RegistryValueExists( const char *path, const char *valueName ...@@ -57,9 +57,9 @@ bool QVLCRegistry::RegistryValueExists( const char *path, const char *valueName
DWORD size1; DWORD size1;
DWORD valueType; DWORD valueType;
if( RegOpenKeyEx( m_RootKey, path, 0, KEY_READ, &keyHandle ) == ERROR_SUCCESS ) if( RegOpenKeyExA( m_RootKey, path, 0, KEY_READ, &keyHandle ) == ERROR_SUCCESS )
{ {
if( RegQueryValueEx( keyHandle, valueName, NULL, if( RegQueryValueExA( keyHandle, valueName, NULL,
&valueType, NULL, &size1 ) == ERROR_SUCCESS ) &valueType, NULL, &size1 ) == ERROR_SUCCESS )
{ {
temp = true; temp = true;
...@@ -73,10 +73,10 @@ void QVLCRegistry::WriteRegistryInt( const char *path, const char *valueName, in ...@@ -73,10 +73,10 @@ void QVLCRegistry::WriteRegistryInt( const char *path, const char *valueName, in
{ {
HKEY keyHandle; HKEY keyHandle;
if( RegCreateKeyEx( m_RootKey, path, 0, NULL, REG_OPTION_NON_VOLATILE, if( RegCreateKeyExA( m_RootKey, path, 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_WRITE, NULL, &keyHandle, NULL ) == ERROR_SUCCESS ) KEY_WRITE, NULL, &keyHandle, NULL ) == ERROR_SUCCESS )
{ {
RegSetValueEx( keyHandle, valueName, 0, REG_DWORD, RegSetValueExA( keyHandle, valueName, 0, REG_DWORD,
(LPBYTE)&value, sizeof( int ) ); (LPBYTE)&value, sizeof( int ) );
RegCloseKey( keyHandle ); RegCloseKey( keyHandle );
} }
...@@ -86,10 +86,10 @@ void QVLCRegistry::WriteRegistryString( const char *path, const char *valueName, ...@@ -86,10 +86,10 @@ void QVLCRegistry::WriteRegistryString( const char *path, const char *valueName,
{ {
HKEY keyHandle; HKEY keyHandle;
if( RegCreateKeyEx( m_RootKey, path, 0, NULL, REG_OPTION_NON_VOLATILE, if( RegCreateKeyExA( m_RootKey, path, 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_WRITE, NULL, &keyHandle, NULL ) == ERROR_SUCCESS ) KEY_WRITE, NULL, &keyHandle, NULL ) == ERROR_SUCCESS )
{ {
RegSetValueEx( keyHandle, valueName, 0, REG_SZ, (LPBYTE)value, RegSetValueExA( keyHandle, valueName, 0, REG_SZ, (LPBYTE)value,
(DWORD)( strlen( value ) + 1 ) ); (DWORD)( strlen( value ) + 1 ) );
RegCloseKey( keyHandle ); RegCloseKey( keyHandle );
} }
...@@ -98,10 +98,10 @@ void QVLCRegistry::WriteRegistryString( const char *path, const char *valueName, ...@@ -98,10 +98,10 @@ void QVLCRegistry::WriteRegistryString( const char *path, const char *valueName,
void QVLCRegistry::WriteRegistryDouble( const char *path, const char *valueName, double value ) void QVLCRegistry::WriteRegistryDouble( const char *path, const char *valueName, double value )
{ {
HKEY keyHandle; HKEY keyHandle;
if( RegCreateKeyEx( m_RootKey, path, 0, NULL, REG_OPTION_NON_VOLATILE, if( RegCreateKeyExA( m_RootKey, path, 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_WRITE, NULL, &keyHandle, NULL ) == ERROR_SUCCESS ) KEY_WRITE, NULL, &keyHandle, NULL ) == ERROR_SUCCESS )
{ {
RegSetValueEx( keyHandle, valueName, 0, REG_BINARY, (LPBYTE)&value, sizeof( double ) ); RegSetValueExA( keyHandle, valueName, 0, REG_BINARY, (LPBYTE)&value, sizeof( double ) );
RegCloseKey( keyHandle ); RegCloseKey( keyHandle );
} }
} }
...@@ -112,13 +112,13 @@ int QVLCRegistry::ReadRegistryInt( const char *path, const char *valueName, int ...@@ -112,13 +112,13 @@ int QVLCRegistry::ReadRegistryInt( const char *path, const char *valueName, int
DWORD size1; DWORD size1;
DWORD valueType; DWORD valueType;
if( RegOpenKeyEx( m_RootKey, path, 0, KEY_READ, &keyHandle ) == ERROR_SUCCESS ) if( RegOpenKeyExA( m_RootKey, path, 0, KEY_READ, &keyHandle ) == ERROR_SUCCESS )
{ {
if( RegQueryValueEx( keyHandle, valueName, NULL, &valueType, NULL, &size1 ) == ERROR_SUCCESS ) if( RegQueryValueExA( keyHandle, valueName, NULL, &valueType, NULL, &size1 ) == ERROR_SUCCESS )
{ {
if( valueType == REG_DWORD ) if( valueType == REG_DWORD )
{ {
if( RegQueryValueEx( keyHandle, valueName, NULL, &valueType, (LPBYTE)&tempValue, &size1 ) == ERROR_SUCCESS ) if( RegQueryValueExA( keyHandle, valueName, NULL, &valueType, (LPBYTE)&tempValue, &size1 ) == ERROR_SUCCESS )
{ {
default_value = tempValue; default_value = tempValue;
}; };
...@@ -138,15 +138,15 @@ char * QVLCRegistry::ReadRegistryString( const char *path, const char *valueName ...@@ -138,15 +138,15 @@ char * QVLCRegistry::ReadRegistryString( const char *path, const char *valueName
DWORD size1; DWORD size1;
DWORD valueType; DWORD valueType;
if( RegOpenKeyEx( m_RootKey, path, 0, KEY_READ, &keyHandle ) == ERROR_SUCCESS ) if( RegOpenKeyExA( m_RootKey, path, 0, KEY_READ, &keyHandle ) == ERROR_SUCCESS )
{ {
if( RegQueryValueEx( keyHandle, valueName, NULL, &valueType, NULL, &size1 ) == ERROR_SUCCESS ) if( RegQueryValueExA( keyHandle, valueName, NULL, &valueType, NULL, &size1 ) == ERROR_SUCCESS )
{ {
if( valueType == REG_SZ ) if( valueType == REG_SZ )
{ {
// free // 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 ) if( RegQueryValueExA( keyHandle, valueName, NULL, &valueType, (LPBYTE)tempValue, &size1 ) == ERROR_SUCCESS )
{ {
tempValue2 = tempValue; tempValue2 = tempValue;
}; };
...@@ -165,14 +165,14 @@ double QVLCRegistry::ReadRegistryDouble( const char *path, const char *valueName ...@@ -165,14 +165,14 @@ double QVLCRegistry::ReadRegistryDouble( const char *path, const char *valueName
DWORD size1; DWORD size1;
DWORD valueType; DWORD valueType;
if( RegOpenKeyEx( m_RootKey, path, 0, KEY_READ, &keyHandle ) == ERROR_SUCCESS ) if( RegOpenKeyExA( m_RootKey, path, 0, KEY_READ, &keyHandle ) == ERROR_SUCCESS )
{ {
if( RegQueryValueEx( keyHandle, valueName, NULL, &valueType, if( RegQueryValueExA( keyHandle, valueName, NULL, &valueType,
NULL, &size1 ) == ERROR_SUCCESS ) NULL, &size1 ) == ERROR_SUCCESS )
{ {
if( ( valueType == REG_BINARY ) && ( size1 == sizeof( double ) ) ) if( ( valueType == REG_BINARY ) && ( size1 == sizeof( double ) ) )
{ {
if( RegQueryValueEx( keyHandle, valueName, NULL, &valueType, if( RegQueryValueExA( keyHandle, valueName, NULL, &valueType,
(LPBYTE)&tempValue, &size1 ) == ERROR_SUCCESS ) (LPBYTE)&tempValue, &size1 ) == ERROR_SUCCESS )
{ {
default_value = tempValue; default_value = tempValue;
...@@ -188,9 +188,9 @@ int QVLCRegistry::DeleteValue( const char *path, const char *valueName ) ...@@ -188,9 +188,9 @@ int QVLCRegistry::DeleteValue( const char *path, const char *valueName )
{ {
HKEY keyHandle; HKEY keyHandle;
long result; long result;
if( (result = RegOpenKeyEx(m_RootKey, path, 0, KEY_WRITE, &keyHandle)) == ERROR_SUCCESS) if( (result = RegOpenKeyExA(m_RootKey, path, 0, KEY_WRITE, &keyHandle)) == ERROR_SUCCESS)
{ {
result = RegDeleteValue(keyHandle, valueName); result = RegDeleteValueA(keyHandle, valueName);
RegCloseKey(keyHandle); RegCloseKey(keyHandle);
} }
//ERROR_SUCCESS = ok everything else you have a problem*g*, //ERROR_SUCCESS = ok everything else you have a problem*g*,
...@@ -201,12 +201,12 @@ long QVLCRegistry::DeleteKey( const char *path, const char *keyName ) ...@@ -201,12 +201,12 @@ long QVLCRegistry::DeleteKey( const char *path, const char *keyName )
{ {
HKEY keyHandle; HKEY keyHandle;
long result; long result;
if( (result = RegOpenKeyEx(m_RootKey, path, 0, KEY_WRITE, &keyHandle)) == ERROR_SUCCESS) if( (result = RegOpenKeyExA(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 // 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... // I think are ok and will be recusively deleted, but not keys...
// for this case we have to do a little bit more work! // for this case we have to do a little bit more work!
result = RegDeleteKey(keyHandle, keyName); result = RegDeleteKeyA(keyHandle, keyName);
RegCloseKey(keyHandle); RegCloseKey(keyHandle);
} }
//ERROR_SUCCESS = ok everything else you have a problem*g*, //ERROR_SUCCESS = ok everything else you have a problem*g*,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment