diff --git a/stepmania/src/archutils/Win32/DebugInfoHunt.cpp b/stepmania/src/archutils/Win32/DebugInfoHunt.cpp index 6641904d2a..8e5fcad314 100644 --- a/stepmania/src/archutils/Win32/DebugInfoHunt.cpp +++ b/stepmania/src/archutils/Win32/DebugInfoHunt.cpp @@ -91,24 +91,24 @@ static void GetDriveDebugInfo9x() * DeviceDesc "GENERIC IDE DISK TYPE01" */ vector Drives; - if( !GetRegSubKeys( "HKEY_LOCAL_MACHINE\\Enum\\ESDI", Drives ) ) + if( !RegistryAccess::GetRegSubKeys( "HKEY_LOCAL_MACHINE\\Enum\\ESDI", Drives ) ) return; for( unsigned drive = 0; drive < Drives.size(); ++drive ) { vector IDs; - if( !GetRegSubKeys( Drives[drive], IDs ) ) + if( !RegistryAccess::GetRegSubKeys( Drives[drive], IDs ) ) continue; for( unsigned id = 0; id < IDs.size(); ++id ) { CString DeviceDesc; - GetRegValue( IDs[id], "DeviceDesc", DeviceDesc ); + RegistryAccess::GetRegValue( IDs[id], "DeviceDesc", DeviceDesc ); TrimRight( DeviceDesc ); int DMACurrentlyUsed = -1; - GetRegValue( IDs[id], "DMACurrentlyUsed", DMACurrentlyUsed ); + RegistryAccess::GetRegValue( IDs[id], "DMACurrentlyUsed", DMACurrentlyUsed ); LOG->Info( "Drive: \"%s\" DMA: %s", DeviceDesc.c_str(), DMACurrentlyUsed? "yes":"NO" ); @@ -130,37 +130,37 @@ static void GetDriveDebugInfoNT() * Type "DiskPeripheral" */ vector Ports; - if( !GetRegSubKeys( "HKEY_LOCAL_MACHINE\\HARDWARE\\DEVICEMAP\\Scsi", Ports ) ) + if( !RegistryAccess::GetRegSubKeys( "HKEY_LOCAL_MACHINE\\HARDWARE\\DEVICEMAP\\Scsi", Ports ) ) return; for( unsigned i = 0; i < Ports.size(); ++i ) { int DMAEnabled = -1; - GetRegValue( Ports[i], "DMAEnabled", DMAEnabled ); + RegistryAccess::GetRegValue( Ports[i], "DMAEnabled", DMAEnabled ); CString Driver; - GetRegValue( Ports[i], "Driver", Driver ); + RegistryAccess::GetRegValue( Ports[i], "Driver", Driver ); vector Busses; - if( !GetRegSubKeys( Ports[i], Busses, "Scsi Bus .*" ) ) + if( !RegistryAccess::GetRegSubKeys( Ports[i], Busses, "Scsi Bus .*" ) ) continue; for( unsigned bus = 0; bus < Busses.size(); ++bus ) { vector TargetIDs; - if( !GetRegSubKeys( Busses[bus], TargetIDs, "Target Id .*" ) ) + if( !RegistryAccess::GetRegSubKeys( Busses[bus], TargetIDs, "Target Id .*" ) ) continue; for( unsigned tid = 0; tid < TargetIDs.size(); ++tid ) { vector LUIDs; - if( !GetRegSubKeys( TargetIDs[tid], LUIDs, "Logical Unit Id .*" ) ) + if( !RegistryAccess::GetRegSubKeys( TargetIDs[tid], LUIDs, "Logical Unit Id .*" ) ) continue; for( unsigned luid = 0; luid < LUIDs.size(); ++luid ) { CString Identifier; - GetRegValue( LUIDs[luid], "Identifier", Identifier ); + RegistryAccess::GetRegValue( LUIDs[luid], "Identifier", Identifier ); TrimRight( Identifier ); LOG->Info( "Drive: \"%s\" Driver: %s DMA: %s", Identifier.c_str(), Driver.c_str(), DMAEnabled == 1? "yes":DMAEnabled == -1? "N/A":"NO" ); diff --git a/stepmania/src/archutils/Win32/RegistryAccess.cpp b/stepmania/src/archutils/Win32/RegistryAccess.cpp index 710d02339b..7fc64effc9 100644 --- a/stepmania/src/archutils/Win32/RegistryAccess.cpp +++ b/stepmania/src/archutils/Win32/RegistryAccess.cpp @@ -52,7 +52,7 @@ static HKEY OpenRegKey( const CString &sKey ) return hRetKey; } -bool GetRegValue( const CString &sKey, const CString &sName, CString &sVal ) +bool RegistryAccess::GetRegValue( const CString &sKey, const CString &sName, CString &sVal ) { HKEY hKey = OpenRegKey( sKey ); if( hKey == NULL ) @@ -78,7 +78,7 @@ bool GetRegValue( const CString &sKey, const CString &sName, CString &sVal ) return true; } -bool GetRegValue( const CString &sKey, CString sName, int &iVal ) +bool RegistryAccess::GetRegValue( const CString &sKey, CString sName, int &iVal ) { HKEY hKey = OpenRegKey( sKey ); if( hKey == NULL ) @@ -99,7 +99,7 @@ bool GetRegValue( const CString &sKey, CString sName, int &iVal ) return true; } -bool GetRegSubKeys( const CString &sKey, vector &lst, const CString ®ex, bool bReturnPathToo ) +bool RegistryAccess::GetRegSubKeys( const CString &sKey, vector &lst, const CString ®ex, bool bReturnPathToo ) { HKEY hKey = OpenRegKey( sKey ); if( hKey == NULL ) diff --git a/stepmania/src/archutils/Win32/RegistryAccess.h b/stepmania/src/archutils/Win32/RegistryAccess.h index 7522bd3af5..27b37ed0a9 100644 --- a/stepmania/src/archutils/Win32/RegistryAccess.h +++ b/stepmania/src/archutils/Win32/RegistryAccess.h @@ -3,9 +3,13 @@ #define REGISTRY_ACCESS_H #include -bool GetRegValue( const CString &key, const CString &sName, CString &val ); -bool GetRegValue( const CString &key, CString sName, int &val ); -bool GetRegSubKeys( const CString &key, vector &lst, const CString ®ex = ".*", bool bReturnPathToo = true ); + +namespace RegistryAccess +{ + bool GetRegValue( const CString &key, const CString &sName, CString &val ); + bool GetRegValue( const CString &key, CString sName, int &val ); + bool GetRegSubKeys( const CString &key, vector &lst, const CString ®ex = ".*", bool bReturnPathToo = true ); +} #endif diff --git a/stepmania/src/archutils/Win32/VideoDriverInfo.cpp b/stepmania/src/archutils/Win32/VideoDriverInfo.cpp index ca4e7a7386..2e1410f1e7 100644 --- a/stepmania/src/archutils/Win32/VideoDriverInfo.cpp +++ b/stepmania/src/archutils/Win32/VideoDriverInfo.cpp @@ -76,7 +76,7 @@ bool GetVideoDriverInfo( int iCardno, VideoDriverInfo &info ) "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Class\\Display": "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E968-E325-11CE-BFC1-08002BE10318}"; - GetRegSubKeys( sTopKey, lst, ".*", false ); + RegistryAccess::GetRegSubKeys( sTopKey, lst, ".*", false ); for( int i=lst.size()-1; i >= 0; --i ) { @@ -101,17 +101,17 @@ bool GetVideoDriverInfo( int iCardno, VideoDriverInfo &info ) { const CString sKey = lst[iCardno]; - if( !GetRegValue( sKey, "DriverDesc", info.sDescription ) ) + if( !RegistryAccess::GetRegValue( sKey, "DriverDesc", info.sDescription ) ) { /* Remove this one from the list and ignore it, */ lst.erase( lst.begin()+iCardno ); continue; } - GetRegValue( sKey, "DriverDate", info.sDate ); - GetRegValue( sKey, "MatchingDeviceId", info.sDeviceID ); - GetRegValue( sKey, "ProviderName", info.sProvider ); - GetRegValue( sKey, bIsWin9x? "Ver":"DriverVersion", info.sVersion ); + RegistryAccess::GetRegValue( sKey, "DriverDate", info.sDate ); + RegistryAccess::GetRegValue( sKey, "MatchingDeviceId", info.sDeviceID ); + RegistryAccess::GetRegValue( sKey, "ProviderName", info.sProvider ); + RegistryAccess::GetRegValue( sKey, bIsWin9x? "Ver":"DriverVersion", info.sVersion ); return true; }