From 265f1f8923f7e6040e8811f6aece23540c2576bb Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 30 Jul 2003 00:13:58 +0000 Subject: [PATCH] don't die if GetPrimaryVideoDriverName() fails --- stepmania/src/archutils/Win32/VideoDriverInfo.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/stepmania/src/archutils/Win32/VideoDriverInfo.cpp b/stepmania/src/archutils/Win32/VideoDriverInfo.cpp index a03a72be0c..696ac9298a 100644 --- a/stepmania/src/archutils/Win32/VideoDriverInfo.cpp +++ b/stepmania/src/archutils/Win32/VideoDriverInfo.cpp @@ -17,8 +17,13 @@ bool GetVideoDriverInfo9x( int iIndex, VideoDriverInfo& infoOut ) { HKEY hkey; CString sKey = ssprintf("SYSTEM\\CurrentControlSet\\Services\\Class\\Display\\%04d",iIndex); - if (RegOpenKey(HKEY_LOCAL_MACHINE, sKey, &hkey) != ERROR_SUCCESS) + if (RegOpenKey(HKEY_LOCAL_MACHINE, sKey, &hkey) != ERROR_SUCCESS) + { + /* The first card should always exist. */ + if( iIndex == 0 ) + LOG->Warn("GetVideoDriverInfo9x error: index 0 doesn't exist!"); return false; + } infoOut.sDate = GetRegValue( hkey, "DriverDate"); infoOut.sDescription = GetRegValue( hkey, "DriverDesc"); @@ -36,7 +41,11 @@ bool GetVideoDriverInfo2k( int iIndex, VideoDriverInfo& infoOut ) HKEY hkey; CString sKey = ssprintf("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E968-E325-11CE-BFC1-08002BE10318}\\%04d",iIndex); if (RegOpenKey(HKEY_LOCAL_MACHINE, sKey, &hkey) != ERROR_SUCCESS) + { + if( iIndex == 0 ) + LOG->Warn("GetVideoDriverInfo2k error: index 0 doesn't exist!"); return false; + } infoOut.sDate = GetRegValue( hkey, "DriverDate"); infoOut.sDescription = GetRegValue( hkey, "DriverDesc"); @@ -98,7 +107,7 @@ CString GetPrimaryVideoDriverName() VideoDriverInfo info; if( !GetVideoDriverInfo(0, info) ) - RageException::Throw( "GetVideoDriverInfo(0) failed"); + return "(ERROR DETECTING VIDEO DRIVER)"; return info.sDescription; }