move floating globals into a namespace
This commit is contained in:
@@ -91,24 +91,24 @@ static void GetDriveDebugInfo9x()
|
||||
* DeviceDesc "GENERIC IDE DISK TYPE01"
|
||||
*/
|
||||
vector<CString> 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<CString> 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<CString> 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<CString> 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<CString> 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<CString> 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" );
|
||||
|
||||
@@ -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<CString> &lst, const CString ®ex, bool bReturnPathToo )
|
||||
bool RegistryAccess::GetRegSubKeys( const CString &sKey, vector<CString> &lst, const CString ®ex, bool bReturnPathToo )
|
||||
{
|
||||
HKEY hKey = OpenRegKey( sKey );
|
||||
if( hKey == NULL )
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
#define REGISTRY_ACCESS_H
|
||||
|
||||
#include <windows.h>
|
||||
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<CString> &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<CString> &lst, const CString ®ex = ".*", bool bReturnPathToo = true );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user