summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
authorsr55 <[email protected]>2014-11-25 19:28:36 +0000
committersr55 <[email protected]>2014-11-25 19:28:36 +0000
commit500935bcc687742682b5934c01437facdf5f0b16 (patch)
tree08172e0b7e912f597ca4538c147ef7977deb91b3 /win/CS
parent4b0973e8e7c4ec271a6a6ce708adee11c541f7b3 (diff)
WinGui: It seems some systems don't allow access to the System management info without admin rights. So the app now tries, and fails gracefully rather than crashing.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6556 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs5
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs32
2 files changed, 25 insertions, 12 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
index 301145975..19c465fb0 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
@@ -123,6 +123,11 @@ namespace HandBrake.ApplicationServices.Utilities
gpuBuilder.AppendLine(string.Format(" {0}", item));
}
+ if (string.IsNullOrEmpty(gpuBuilder.ToString().Trim()))
+ {
+ gpuBuilder.Append("GPU Information is unavailable");
+ }
+
logHeader.AppendLine(String.Format("HandBrake {0} - {1}", VersionHelper.GetVersion(), VersionHelper.GetPlatformBitnessVersion()));
logHeader.AppendLine(String.Format("OS: {0} - {1}", Environment.OSVersion, Environment.Is64BitOperatingSystem ? "64bit" : "32bit"));
logHeader.AppendLine(String.Format("CPU: {0}", SystemInfo.GetCpuCount));
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs b/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs
index 2ea664f1a..f7e0ae0ed 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs
@@ -127,27 +127,35 @@ namespace HandBrake.ApplicationServices.Utilities
get
{
List<string> gpuInfo = new List<string>();
- ManagementObjectSearcher searcher = new ManagementObjectSearcher(
- "select * from " + "Win32_VideoController");
- foreach (ManagementObject share in searcher.Get())
+ try
{
- string gpu = string.Empty, version = string.Empty;
+ ManagementObjectSearcher searcher =
+ new ManagementObjectSearcher("select * from " + "Win32_VideoController");
- foreach (PropertyData PC in share.Properties)
+ foreach (ManagementObject share in searcher.Get())
{
- if (!string.IsNullOrEmpty(PC.Name) && PC.Value != null)
+ string gpu = string.Empty, version = string.Empty;
+
+ foreach (PropertyData PC in share.Properties)
{
- if (PC.Name.Equals("DriverVersion")) version = PC.Value.ToString();
- if (PC.Name.Equals("Name")) gpu = PC.Value.ToString();
+ if (!string.IsNullOrEmpty(PC.Name) && PC.Value != null)
+ {
+ if (PC.Name.Equals("DriverVersion")) version = PC.Value.ToString();
+ if (PC.Name.Equals("Name")) gpu = PC.Value.ToString();
+ }
}
- }
- if (!string.IsNullOrEmpty(gpu) && !string.IsNullOrEmpty(version))
- {
- gpuInfo.Add(string.Format("{0} - {1}", gpu, version));
+ if (!string.IsNullOrEmpty(gpu) && !string.IsNullOrEmpty(version))
+ {
+ gpuInfo.Add(string.Format("{0} - {1}", gpu, version));
+ }
}
}
+ catch (Exception)
+ {
+ // Do Nothing. We couldn't get GPU Information.
+ }
return gpuInfo;
}