diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..b2e6c4a --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,23 @@ +nvidiaProfileInspector is licensed under MIT license. + +---------------- + +Copyright (c) 2016 Orbmu2k + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/nspector/Common/Cache/CachedSettingValue.cs b/nspector/Common/Cache/CachedSettingValue.cs new file mode 100644 index 0000000..226fa17 --- /dev/null +++ b/nspector/Common/Cache/CachedSettingValue.cs @@ -0,0 +1,40 @@ +using System; +using System.Text; + +namespace nspector.Common +{ + internal class CachedSettingValue : IComparable + { + + public int CompareTo(CachedSettingValue other) + { + if (IsStringValue) + return ValueStr.CompareTo(other.ValueStr); + else + return Value.CompareTo(other.Value); + } + + internal CachedSettingValue() { } + + internal CachedSettingValue(uint Value, string ProfileNames) + { + this.Value = Value; + this.ProfileNames = new StringBuilder(ProfileNames); + this.ValueProfileCount = 1; + } + + internal CachedSettingValue(string ValueStr, string ProfileNames) + { + IsStringValue = true; + this.ValueStr = ValueStr; + this.ProfileNames = new StringBuilder(ProfileNames); + this.ValueProfileCount = 1; + } + + internal readonly bool IsStringValue = false; + internal string ValueStr = ""; + internal uint Value = 0; + internal StringBuilder ProfileNames; + internal uint ValueProfileCount; + } +} \ No newline at end of file diff --git a/nspector/Common/Cache/CachedSettings.cs b/nspector/Common/Cache/CachedSettings.cs new file mode 100644 index 0000000..15f8677 --- /dev/null +++ b/nspector/Common/Cache/CachedSettings.cs @@ -0,0 +1,56 @@ +using nspector.Native.NVAPI2; +using System.Collections.Generic; +using System.Linq; + +namespace nspector.Common +{ + internal class CachedSettings + { + internal CachedSettings() { } + + internal CachedSettings(uint settingId, NVDRS_SETTING_TYPE settingType) + { + SettingId = settingId; + SettingType = settingType; + } + + internal uint SettingId; + + internal List SettingValues = new List(); + + internal uint ProfileCount = 0; + + internal NVDRS_SETTING_TYPE SettingType = NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE; + + internal void AddDwordValue(uint valueDword, string Profile) + { + var setting = SettingValues.FirstOrDefault(s => s.Value == valueDword); + if (setting == null) + { + SettingValues.Add(new CachedSettingValue(valueDword, Profile)); + } + else + { + setting.ProfileNames.Append(", " + Profile); + setting.ValueProfileCount++; + } + ProfileCount++; + } + + internal void AddStringValue(string valueStr, string Profile) + { + + var setting = SettingValues.FirstOrDefault(s => s.ValueStr == valueStr); + if (setting == null) + { + SettingValues.Add(new CachedSettingValue(valueStr, Profile)); + } + else + { + setting.ProfileNames.Append(", " + Profile); + setting.ValueProfileCount++; + } + ProfileCount++; + } + } +} \ No newline at end of file diff --git a/nspector/Common/CustomSettings/CustomSetting.cs b/nspector/Common/CustomSettings/CustomSetting.cs new file mode 100644 index 0000000..8365b4e --- /dev/null +++ b/nspector/Common/CustomSettings/CustomSetting.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Xml.Serialization; + +namespace nspector.Common.CustomSettings +{ + [Serializable] + public class CustomSetting + { + + public string UserfriendlyName { get; set; } + [XmlElement(ElementName = "HexSettingID")] + public string HexSettingId { get; set; } + public string Description { get; set; } + public string GroupName { get; set; } + public string OverrideDefault { get; set; } + public float MinRequiredDriverVersion { get; set; } + + public List SettingValues { get; set; } + + internal uint SettingId + { + get { return Convert.ToUInt32(HexSettingId.Trim(), 16); } + } + + internal uint? DefaultValue + { + get { return string.IsNullOrEmpty(OverrideDefault) ? null : (uint?)Convert.ToUInt32(OverrideDefault.Trim(), 16); } + } + + } +} \ No newline at end of file diff --git a/nspector/Common/CustomSettings/CustomSettingNames.cs b/nspector/Common/CustomSettings/CustomSettingNames.cs new file mode 100644 index 0000000..9f195ca --- /dev/null +++ b/nspector/Common/CustomSettings/CustomSettingNames.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Text; +using nspector.Common.Helper; + +namespace nspector.Common.CustomSettings +{ + [Serializable] + public class CustomSettingNames + { + public bool ShowCustomizedSettingNamesOnly = false; + + public List Settings = new List(); + + public void StoreToFile(string filename) + { + XMLHelper.SerializeToXmlFile(this, filename, Encoding.Unicode, true); + } + + public static CustomSettingNames FactoryLoadFromFile(string filename) + { + return XMLHelper.DeserializeFromXMLFile(filename); + } + + public static CustomSettingNames FactoryLoadFromString(string xml) + { + return XMLHelper.DeserializeFromXmlString(xml); + } + } +} diff --git a/nspector/Common/CustomSettings/CustomSettingValue.cs b/nspector/Common/CustomSettings/CustomSettingValue.cs new file mode 100644 index 0000000..34aeccc --- /dev/null +++ b/nspector/Common/CustomSettings/CustomSettingValue.cs @@ -0,0 +1,19 @@ +using System; +using System.Globalization; + +namespace nspector.Common.CustomSettings +{ + [Serializable] + public class CustomSettingValue + { + internal uint SettingValue + { + get { return Convert.ToUInt32(HexValue.Trim(), 16); } + } + + public string UserfriendlyName { get; set; } + + public string HexValue { get; set; } + + } +} \ No newline at end of file diff --git a/nspector/Common/DrsImportService.cs b/nspector/Common/DrsImportService.cs new file mode 100644 index 0000000..5e62f8a --- /dev/null +++ b/nspector/Common/DrsImportService.cs @@ -0,0 +1,213 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Policy; +using System.Text; +using nspector.Common.Import; +using nspector.Native.NVAPI2; +using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper; +using nspector.Common.Helper; + +namespace nspector.Common +{ + internal class DrsImportService : DrsSettingsServiceBase + { + + private readonly DrsSettingsService _SettingService; + + public DrsImportService(DrsSettingsMetaService metaService, DrsSettingsService settingService, IntPtr? hSession = null) + : base(metaService, hSession) + { + _SettingService = settingService; + } + + internal void ExportAllProfilesToNvidiaTextFile(string filename) + { + DrsSession((hSession) => + { + SaveSettingsFileEx(hSession, filename); + }); + } + + internal void ImportAllProfilesFromNvidiaTextFile(string filename) + { + DrsSession((hSession) => + { + LoadSettingsFileEx(hSession, filename); + SaveSettings(hSession); + }); + } + + internal void ExportProfiles(List profileNames, string filename, bool includePredefined) + { + var exports = new Profiles(); + + DrsSession((hSession) => + { + foreach (var profileName in profileNames) + { + var profile = CreateProfileForExport(hSession, profileName, includePredefined); + exports.Add(profile); + } + }); + + XMLHelper.SerializeToXmlFile(exports, filename, Encoding.Unicode, true); + } + + private Profile CreateProfileForExport(IntPtr hSession, string profileName, bool includePredefined) + { + var result = new Profile(); + + var hProfile = GetProfileHandle(hSession, profileName); + if (hProfile != IntPtr.Zero) + { + + var settings = GetProfileSettings(hSession, hProfile); + if (settings.Count > 0) + { + result.ProfileName = profileName; + + var apps = GetProfileApplications(hSession, hProfile); + foreach (var app in apps) + { + result.Executeables.Add(app.appName); + } + + foreach (var setting in settings) + { + var isPredefined = setting.isCurrentPredefined == 1; + var isDwordSetting = setting.settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE; + var isCurrentProfile = setting.settingLocation == + NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION; + + if (isDwordSetting && isCurrentProfile) + { + if (!isPredefined || includePredefined) + { + var profileSetting = new ProfileSetting() + { + SettingNameInfo = setting.settingName, + SettingId = setting.settingId, + SettingValue = setting.currentValue.dwordValue, + }; + result.Settings.Add(profileSetting); + } + } + } + } + } + + return result; + } + + internal void ImportProfiles(string filename) + { + var profiles = XMLHelper.DeserializeFromXMLFile(filename); + + DrsSession((hSession) => + { + foreach (Profile profile in profiles) + { + var hProfile = GetProfileHandle(hSession, profile.ProfileName); + if (hProfile == IntPtr.Zero) + { + hProfile = CreateProfile(hSession, profile.ProfileName); + } + + if (hProfile != IntPtr.Zero) + { + var modified = false; + _SettingService.ResetProfile(profile.ProfileName, out modified); + + UpdateApplications(hSession, hProfile, profile); + UpdateSettings(hSession, hProfile, profile); + nvw.DRS_SaveSettings(hSession); + } + } + }); + } + + private bool ExistsImportApp(string appName, Profile importProfile) + { + return importProfile.Executeables.Any(x => x.Equals(appName)); + } + + private void UpdateApplications(IntPtr hSession, IntPtr hProfile, Profile importProfile) + { + var alreadySet = new HashSet(); + + var apps = GetProfileApplications(hSession, hProfile); + foreach (var app in apps) + { + if (ExistsImportApp(app.appName, importProfile) && !alreadySet.Contains(app.appName)) + alreadySet.Add(app.appName); + else + nvw.DRS_DeleteApplication(hSession, hProfile, new StringBuilder(app.appName)); + } + + foreach (string appName in importProfile.Executeables) + { + if (!alreadySet.Contains(appName)) + { + AddApplication(hSession, hProfile, appName); + } + } + } + + private uint GetImportValue(uint settingId, Profile importProfile) + { + var setting = importProfile.Settings + .FirstOrDefault(x => x.SettingId.Equals(settingId)); + + if (setting != null) + return setting.SettingValue; + + return 0; + } + + private bool ExistsImportValue(uint settingId, Profile importProfile) + { + return importProfile.Settings + .Any(x => x.SettingId.Equals(settingId)); + } + + private void UpdateSettings(IntPtr hSession, IntPtr hProfile, Profile importProfile) + { + var alreadySet = new HashSet(); + + var settings = GetProfileSettings(hSession, hProfile); + foreach (var setting in settings) + { + var isCurrentProfile = setting.settingLocation == NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION; + var isDwordSetting = setting.settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE; + var isPredefined = setting.isCurrentPredefined == 1; + + if (isCurrentProfile && isDwordSetting) + { + bool exitsValue = ExistsImportValue(setting.settingId, importProfile); + uint importValue = GetImportValue(setting.settingId, importProfile); + if (isPredefined && exitsValue && importValue == setting.currentValue.dwordValue) + { + alreadySet.Add(setting.settingId); + } + else if (exitsValue) + { + StoreDwordValue(hSession, hProfile, setting.settingId, importValue); + alreadySet.Add(setting.settingId); + } + else + nvw.DRS_DeleteProfileSetting(hSession, hProfile, setting.settingId); + } + } + + foreach (var setting in importProfile.Settings) + { + if (!alreadySet.Contains(setting.SettingId)) + { + StoreDwordValue(hSession, hProfile, setting.SettingId, setting.SettingValue); + } + } + } + + } +} diff --git a/nspector/Common/DrsScannerService.cs b/nspector/Common/DrsScannerService.cs new file mode 100644 index 0000000..6600f99 --- /dev/null +++ b/nspector/Common/DrsScannerService.cs @@ -0,0 +1,291 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Security.Policy; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +using nspector.Common.Import; +using nspector.Native.NVAPI2; +using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper; +using nspector.Common.Helper; + +namespace nspector.Common +{ + + internal delegate void SettingScanDoneEvent(); + internal delegate void SettingScanProgressEvent(int percent); + + internal class DrsScannerService : DrsSettingsServiceBase + { + + public DrsScannerService(DrsSettingsMetaService metaService, IntPtr? hSession = null) + : base(metaService, hSession) + { } + + public event SettingScanDoneEvent OnModifiedProfilesScanDone; + public event SettingScanDoneEvent OnPredefinedSettingsScanDone; + public event SettingScanProgressEvent OnSettingScanProgress; + + internal List CachedSettings = new List(); + internal List ModifiedProfiles = new List(); + + // most common setting ids as start pattern for the heuristic scan + private readonly uint[] _commonSettingIds = new uint[] { 0x1095DEF8, 0x1033DCD2, 0x1033CEC1, + 0x10930F46, 0x00A06946, 0x10ECDB82, 0x20EBD7B8, 0x0095DEF9, 0x00D55F7D, + 0x1033DCD3, 0x1033CEC2, 0x2072F036, 0x00664339, 0x002C7F45, 0x209746C1, + 0x0076E164, 0x20FF7493, 0x204CFF7B }; + + + private bool CheckCommonSetting(IntPtr hSession, IntPtr hProfile, NVDRS_PROFILE profile, + ref int checkedSettingsCount, uint checkSettingId, bool addToScanResult, + ref List alreadyCheckedSettingIds) + { + + if (checkedSettingsCount >= profile.numOfSettings) + return false; + + var setting = new NVDRS_SETTING(); + setting.version = nvw.NVDRS_SETTING_VER; + + if (nvw.DRS_GetSetting(hSession, hProfile, checkSettingId, ref setting) != NvAPI_Status.NVAPI_OK) + return false; + + if (setting.settingLocation != NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION) + return false; + + if (!addToScanResult && setting.isCurrentPredefined == 1) + { + checkedSettingsCount++; + } + else if (addToScanResult) + { + checkedSettingsCount++; + AddScannedSettingToCache(profile, setting); + alreadyCheckedSettingIds.Add(setting.settingId); + return true; + } + else if (setting.isCurrentPredefined != 1) + { + return true; + } + + return false; + } + + private void ReportProgress(int current, int max) + { + int percent = (current > 0) ? (int)Math.Round((current * 100f) / max) : 0; + + if (OnSettingScanProgress != null) + OnSettingScanProgress(percent); + } + + private void ScanForModifiedProfiles() + { + ModifiedProfiles = new List(); + var knownPredefines = new List(_commonSettingIds); + + DrsSession((hSession) => + { + IntPtr hBaseProfile = GetProfileHandle(hSession, ""); + var profileHandles = EnumProfileHandles(hSession); + + var maxProfileCount = profileHandles.Count; + int curProfilePos = 0; + + foreach (IntPtr hProfile in profileHandles) + { + ReportProgress(curProfilePos++, maxProfileCount); + + var profile = GetProfileInfo(hSession, hProfile); + + int checkedSettingsCount = 0; + bool foundModifiedProfile = false; + + if (profile.isPredefined == 0) + { + ModifiedProfiles.Add(profile.profileName); + continue; + } + + if ((hBaseProfile == hProfile || profile.numOfApps > 0) && profile.numOfSettings > 0) + { + var alreadyChecked = new List(); + + foreach (uint settingId in knownPredefines) + { + if (CheckCommonSetting(hSession, hProfile, profile, + ref checkedSettingsCount, settingId, false, ref alreadyChecked)) + { + foundModifiedProfile = true; + ModifiedProfiles.Add(profile.profileName); + break; + } + } + + // the detection if only applications has changed in a profile makes the scan process very slow, we leave it out! + //if (!foundModifiedProfile && profile.numOfApps > 0) + //{ + // var apps = GetProfileApplications(hSession, hProfile); + // foreach (var app in apps) + // { + // if (app.isPredefined == 0) + // { + // foundModifiedProfile = true; + // ModifiedProfiles.Add(profile.profileName); + // break; + // } + // } + //} + + if (foundModifiedProfile || checkedSettingsCount >= profile.numOfSettings) + continue; + + var settings = GetProfileSettings(hSession, hProfile); + foreach (var setting in settings) + { + if (knownPredefines.IndexOf(setting.settingId) < 0) + knownPredefines.Add(setting.settingId); + + if (setting.isCurrentPredefined != 1) + { + ModifiedProfiles.Add(profile.profileName); + break; + } + } + } + } + }); + + if (OnModifiedProfilesScanDone != null) + OnModifiedProfilesScanDone(); + } + + private void ScanForPredefinedProfileSettings() + { + var knownPredefines = new List(_commonSettingIds); + + DrsSession((hSession) => + { + var profileHandles = EnumProfileHandles(hSession); + + var maxProfileCount = profileHandles.Count; + int curProfilePos = 0; + + foreach (IntPtr hProfile in profileHandles) + { + ReportProgress(curProfilePos++, maxProfileCount); + + var profile = GetProfileInfo(hSession, hProfile); + + int checkedSettingsCount = 0; + var alreadyChecked = new List(); + + foreach (uint kpd in knownPredefines) + { + CheckCommonSetting(hSession, hProfile, profile, + ref checkedSettingsCount, kpd, true, ref alreadyChecked); + } + + if (checkedSettingsCount >= profile.numOfSettings) + continue; + + var settings = GetProfileSettings(hSession, hProfile); + foreach (var setting in settings) + { + if (knownPredefines.IndexOf(setting.settingId) < 0) + knownPredefines.Add(setting.settingId); + + if (alreadyChecked.IndexOf(setting.settingId) < 0) + AddScannedSettingToCache(profile, setting); + } + } + }); + + if (OnPredefinedSettingsScanDone != null) + OnPredefinedSettingsScanDone(); + } + + public void StartScanForModifiedProfilesAsync() + { + var thread = new Thread(ScanForModifiedProfiles); + thread.Start(); + } + + public void StartScanForPredefinedSettingsAsync() + { + var thread = new Thread(ScanForPredefinedProfileSettings); + thread.Start(); + } + + private void AddScannedSettingToCache(NVDRS_PROFILE profile, NVDRS_SETTING setting) + { + // Skip 3D Vision string values here for improved scan performance + bool allowAddValue = setting.settingId < 0x70000000 || setting.settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE; + + //bool allowAddValue = true; + + var cachedSetting = CachedSettings + .FirstOrDefault(x => x.SettingId.Equals(setting.settingId)); + + bool cacheEntryExists = true; + if (cachedSetting == null) + { + cacheEntryExists = false; + cachedSetting = new CachedSettings(setting.settingId, setting.settingType); + } + + if (setting.isPredefinedValid == 1) + { + if (allowAddValue) + { + if (setting.settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE) + cachedSetting.AddStringValue(setting.currentValue.stringValue, profile.profileName); + else + cachedSetting.AddDwordValue(setting.currentValue.dwordValue, profile.profileName); + } + + if (!cacheEntryExists) + CachedSettings.Add(cachedSetting); + } + + } + + public string FindProfilesUsingApplication(string applicationName) + { + string lowerApplicationName = applicationName.ToLower(); + string tmpfile = Path.GetTempFileName(); + var result = new StringBuilder(); + + DrsSession((hSession) => + { + SaveSettingsFileEx(hSession, tmpfile); + }); + + if (File.Exists(tmpfile)) + { + string content = File.ReadAllText(tmpfile); + string pattern = "\\sProfile\\s\\\"(?.*?)\\\"(?.*?Executable.*?)EndProfile"; + foreach (Match m in Regex.Matches(content, pattern, RegexOptions.Singleline)) + { + string scope = m.Result("${scope}"); + foreach (Match ms in Regex.Matches(scope, "Executable\\s\\\"(?.*?)\\\"", RegexOptions.Singleline)) + { + if (ms.Result("${app}").ToLower() == lowerApplicationName) + { + result.Append(m.Result("${profile}") + ";"); + } + } + } + } + + if (File.Exists(tmpfile)) + File.Delete(tmpfile); + + return result.ToString(); + } + + } +} diff --git a/nspector/Common/DrsServiceLocator.cs b/nspector/Common/DrsServiceLocator.cs new file mode 100644 index 0000000..fa9896c --- /dev/null +++ b/nspector/Common/DrsServiceLocator.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Windows.Forms; +using nspector.Common.CustomSettings; + +using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper; + +namespace nspector.Common +{ + internal class DrsServiceLocator + { + private static readonly CustomSettingNames CustomSettings; + public static readonly CustomSettingNames ReferenceSettings; + public static readonly DrsSettingsMetaService MetaService; + public static readonly DrsSettingsService SettingService; + public static readonly DrsImportService ImportService; + public static readonly DrsScannerService ScannerService; + + private static IntPtr _Session; + + static DrsServiceLocator() + { + CustomSettings = LoadCustomSettings(); + ReferenceSettings = LoadReferenceSettings(); + + ReCreateSession(); + + MetaService = new DrsSettingsMetaService(CustomSettings, ReferenceSettings); + SettingService = new DrsSettingsService(MetaService, _Session); + ImportService = new DrsImportService(MetaService, SettingService, _Session); + ScannerService = new DrsScannerService(MetaService, _Session); + } + + public static void ReCreateSession() + { + if (_Session != null && _Session != IntPtr.Zero) + { + nvw.DRS_DestroySession(_Session); + } + + _Session = DrsSettingsServiceBase.CreateAndLoadSession(); + } + + private static CustomSettingNames LoadCustomSettings() + { + string csnDefaultPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\CustomSettingNames.xml"; + + if (File.Exists(csnDefaultPath)) + return CustomSettingNames.FactoryLoadFromFile(csnDefaultPath); + else + return CustomSettingNames.FactoryLoadFromString(Properties.Resources.CustomSettingNames); + } + + private static CustomSettingNames LoadReferenceSettings() + { + string csnDefaultPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Reference.xml"; + + if (File.Exists(csnDefaultPath)) + return CustomSettingNames.FactoryLoadFromFile(csnDefaultPath); + + return null; + } + + } +} diff --git a/nspector/Common/DrsSettingsMetaService.cs b/nspector/Common/DrsSettingsMetaService.cs new file mode 100644 index 0000000..09f3594 --- /dev/null +++ b/nspector/Common/DrsSettingsMetaService.cs @@ -0,0 +1,312 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using nspector.Common.Meta; +using nspector.Common.CustomSettings; +using nspector.Native.NVAPI2; +using nspector.Native.NvApi.DriverSettings; + +namespace nspector.Common +{ + internal class DrsSettingsMetaService + { + + private ISettingMetaService ConstantMeta; + private ISettingMetaService CustomMeta; + public ISettingMetaService DriverMeta; + private ISettingMetaService ScannedMeta; + private ISettingMetaService ReferenceMeta; + private ISettingMetaService NvD3dUmxMeta; + + private readonly CustomSettingNames _customSettings; + private readonly CustomSettingNames _referenceSettings; + + private List MetaServices = new List(); + + private Dictionary settingMetaCache = new Dictionary(); + + public DrsSettingsMetaService(CustomSettingNames customSettings, CustomSettingNames referenceSettings = null) + { + _customSettings = customSettings; + _referenceSettings = referenceSettings; + + ResetMetaCache(true); + } + + public void ResetMetaCache(bool initOnly = false) + { + settingMetaCache = new Dictionary(); + MetaServices = new List(); + + CustomMeta = new CustomSettingMetaService(_customSettings); + MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 1, Service = CustomMeta }); + + if (!initOnly) + { + DriverMeta = new DriverSettingMetaService(); + MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 5, Service = DriverMeta }); + + ConstantMeta = new ConstantSettingMetaService(); + MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 2, Service = ConstantMeta }); + + if (DrsServiceLocator.ScannerService != null) + { + ScannedMeta = new ScannedSettingMetaService(DrsServiceLocator.ScannerService.CachedSettings); + MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 3, Service = ScannedMeta }); + } + + if (_referenceSettings != null) + { + ReferenceMeta = new CustomSettingMetaService(_referenceSettings, SettingMetaSource.ReferenceSettings); + MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 4, Service = ReferenceMeta }); + } + + NvD3dUmxMeta = new NvD3dUmxSettingMetaService(); + MetaServices.Add(new MetaServiceItem() { ValueNamePrio = 6, Service = NvD3dUmxMeta }); + } + + } + + private NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId) + { + foreach (var service in MetaServices.OrderBy(x => x.Service.Source)) + { + var settingValueType = service.Service.GetSettingValueType(settingId); + if (settingValueType != null) + return settingValueType.Value; + } + + return NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE; + } + + private string GetSettingName(uint settingId) + { + foreach (var service in MetaServices.OrderBy(x=>x.Service.Source)) + { + var settingName = service.Service.GetSettingName(settingId); + if (settingName != null) + return settingName; + } + return null; + } + + private string GetGroupName(uint settingId) + { + foreach (var service in MetaServices.OrderBy(x => x.Service.Source)) + { + var groupName = service.Service.GetGroupName(settingId); + if (groupName != null) + return groupName; + } + return null; + } + + private uint GetDwordDefaultValue(uint settingId) + { + foreach (var service in MetaServices.OrderBy(x => x.Service.Source)) + { + var settingDefault = service.Service.GetDwordDefaultValue(settingId); + if (settingDefault != null) + return settingDefault.Value; + } + + return 0; + } + + private string GetStringDefaultValue(uint settingId) + { + foreach (var service in MetaServices.OrderBy(x => x.Service.Source)) + { + var settingDefault = service.Service.GetStringDefaultValue(settingId); + if (settingDefault != null) + return settingDefault; + } + + return null; + } + + private List> MergeSettingValues(List> a, List> b) + { + if (b == null) + return a; + + // force scanned settings to add instead of merge + if (b.Count > 0 && b.First().ValueSource == SettingMetaSource.ScannedSettings) + { + a.AddRange(b); + } + else + { + var newValues = b.Where(xb => !a.Select(xa => xa.Value).Contains(xb.Value)).ToList(); + a.AddRange(newValues); + + foreach (var settingValue in a) + { + var bVal = b.FirstOrDefault(x => x.Value.Equals(settingValue.Value) && x.ValueSource != SettingMetaSource.ScannedSettings); + if (bVal != null && bVal.ValueName != null) + { + settingValue.ValueName = bVal.ValueName; + settingValue.ValueSource = bVal.ValueSource; + settingValue.ValuePos = bVal.ValuePos; + } + } + } + + return a.OrderBy(x=>x.Value).ToList(); + } + + private List> GetStringValues(uint settingId) + { + var result = new List>(); + + foreach (var service in MetaServices.OrderByDescending(x => x.ValueNamePrio)) + { + result = MergeSettingValues(result, service.Service.GetStringValues(settingId)); + } + + return result; + } + + private List> GetDwordValues(uint settingId) + { + var result = new List>(); + + foreach (var service in MetaServices.OrderByDescending(x => x.ValueNamePrio)) + { + result = MergeSettingValues(result, service.Service.GetDwordValues(settingId)); + } + + if (result != null) + { + result = (from v in result.Where(x=> 1==1 + && !x.ValueName.EndsWith("_NUM") + && !x.ValueName.EndsWith("_MASK") + && (!x.ValueName.EndsWith("_MIN") || x.ValueName.Equals("PREFERRED_PSTATE_PREFER_MIN")) + && (!x.ValueName.EndsWith("_MAX") || x.ValueName.Equals("PREFERRED_PSTATE_PREFER_MAX")) + + ) + group v by v.ValueName into g + select g.First(t => t.ValueName == g.Key)) + .OrderBy(v => v.ValueSource) + .ThenBy(v => v.ValuePos) + .ThenBy(v => v.ValueName).ToList(); + + } + + return result; + } + + public List GetSettingIds(SettingViewMode viewMode) + { + var settingIds = new List(); + var allowedSourcesForViewMode = GetAllowedMetaSourcesForViewMode(viewMode); + + foreach (var service in MetaServices.OrderBy(x => x.Service.Source)) + { + if (allowedSourcesForViewMode.Contains(service.Service.Source)) + { + settingIds.AddRange(service.Service.GetSettingIds()); + } + } + return settingIds.Distinct().ToList(); + } + + private SettingMetaSource[] GetAllowedMetaSourcesForViewMode(SettingViewMode viewMode) + { + switch (viewMode) + { + case SettingViewMode.CustomSettingsOnly: + return new [] { + SettingMetaSource.CustomSettings + }; + case SettingViewMode.IncludeScannedSetttings: + return new [] { + SettingMetaSource.ConstantSettings, + SettingMetaSource.ScannedSettings, + SettingMetaSource.CustomSettings, + SettingMetaSource.DriverSettings, + }; + default: + return new [] { + SettingMetaSource.CustomSettings, + SettingMetaSource.DriverSettings, + }; + } + } + + private SettingMeta CreateSettingMeta(uint settingId) + { + var settingType = GetSettingValueType(settingId); + var settingName = GetSettingName(settingId); + var groupName = GetGroupName(settingId); + + if (groupName == null) + groupName = GetLegacyGroupName(settingId, settingName); + + var result = new SettingMeta() + { + SettingType = settingType, + SettingName = settingName, + GroupName = groupName, + + DefaultDwordValue = + settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE + ? GetDwordDefaultValue(settingId) : 0, + + DefaultStringValue = + settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE + ? GetStringDefaultValue(settingId) : null, + + DwordValues = + settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE + ? GetDwordValues(settingId) : null, + + StringValues = + settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE + ? GetStringValues(settingId) : null, + }; + + return result; + } + + private SettingMeta PostProcessMeta(uint settingId, SettingMeta settingMeta) + { + if (string.IsNullOrEmpty(settingMeta.SettingName)) + settingMeta.SettingName = string.Format("0x{0:X8}", settingId); + + return settingMeta; + } + + public SettingMeta GetSettingMeta(uint settingId) + { + if (settingMetaCache.ContainsKey(settingId)) + { + return PostProcessMeta(settingId, settingMetaCache[settingId]); + } + else + { + var settingMeta = CreateSettingMeta(settingId); + settingMetaCache.Add(settingId, settingMeta); + return PostProcessMeta(settingId, settingMeta); + } + } + + private string GetLegacyGroupName(uint settingId, string settingName) + { + if (settingName == null) + return null; + + if (settingName.ToUpper().Contains("SLI")) + return "6 - SLI"; + else if (settingName.ToUpper().Contains("STEREO")) + return "7 - Stereo"; + else if (settingName.StartsWith("0x")) + return "Unknown"; + else + return "Other"; + + } + } +} diff --git a/nspector/Common/DrsSettingsService.cs b/nspector/Common/DrsSettingsService.cs new file mode 100644 index 0000000..3987628 --- /dev/null +++ b/nspector/Common/DrsSettingsService.cs @@ -0,0 +1,462 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Windows.Forms; +using nspector.Common.Helper; +using nspector.Common.Meta; +using nspector.Native.NVAPI2; +using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper; + +namespace nspector.Common +{ + internal class DrsSettingsService : DrsSettingsServiceBase + { + + public DrsSettingsService(DrsSettingsMetaService metaService, IntPtr? hSession = null) + : base(metaService, hSession) + { + _baseProfileSettingIds = InitBaseProfileSettingIds(); + } + + private List InitBaseProfileSettingIds() + { + return DrsSession((hSession) => + { + var hBaseProfile = GetProfileHandle(hSession, ""); + var baseProfileSettings = GetProfileSettings(hSession, hBaseProfile); + + return baseProfileSettings.Select(x => x.settingId).ToList(); + }); + } + + private readonly List _baseProfileSettingIds; + + private string GetDrsProgramPath() + { + return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), + @"NVIDIA Corporation\Drs"); + } + + private void RunDrsInitProcess() + { + var drsPath = GetDrsProgramPath(); + + var si = new ProcessStartInfo(); + si.UseShellExecute = true; + si.WorkingDirectory = drsPath; + si.Arguments = "-init"; + si.FileName = Path.Combine(drsPath, "dbInstaller.exe"); + if (!AdminHelper.IsAdmin) + si.Verb = "runas"; + var p = Process.Start(si); + p.WaitForExit(); + } + + public void DeleteAllProfilesHard() + { + var tmpFile = Path.GetTempFileName(); + File.WriteAllText(tmpFile, "BaseProfile \"Base Profile\"\r\nProfile \"Base Profile\"\r\nShowOn All\r\nProfileType Global\r\nEndProfile\r\n"); + + DrsSession((hSession) => + { + LoadSettingsFileEx(hSession, tmpFile); + SaveSettings(hSession); + }); + + if (File.Exists(tmpFile)) + File.Delete(tmpFile); + + } + + public void DeleteProfileHard(string profileName) + { + var tmpFileName = Path.GetTempFileName(); + var tmpFileContent = ""; + + DrsSession((hSession) => + { + SaveSettingsFileEx(hSession, tmpFileName); + tmpFileContent = File.ReadAllText(tmpFileName); + string pattern = "(?\nProfile\\s\"" + Regex.Escape(profileName) + "\".*?EndProfile.*?\n)"; + tmpFileContent = Regex.Replace(tmpFileContent, pattern, "", RegexOptions.Singleline); + File.WriteAllText(tmpFileName, tmpFileContent); + }); + + if (tmpFileContent != "") + { + DrsSession((hSession) => + { + LoadSettingsFileEx(hSession, tmpFileName); + SaveSettings(hSession); + }); + } + + if (File.Exists(tmpFileName)) + File.Delete(tmpFileName); + } + + public void DeleteProfile(string profileName) + { + DrsSession((hSession) => + { + var hProfile = GetProfileHandle(hSession, profileName); + if (hProfile != IntPtr.Zero) + { + var nvRes = nvw.DRS_DeleteProfile(hSession, hProfile); + if (nvRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_DeleteProfile", nvRes); + + SaveSettings(hSession); + } + }); + + } + + public List GetProfileNames(out string baseProfileName) + { + var lstResult = new List(); + var tmpBaseProfileName = ""; + + DrsSession((hSession) => + { + var hBase = GetProfileHandle(hSession, null); + var baseProfile = GetProfileInfo(hSession, hBase); + tmpBaseProfileName = baseProfile.profileName; + lstResult.Add("_GLOBAL_DRIVER_PROFILE (" + tmpBaseProfileName + ")"); + + var profileHandles = EnumProfileHandles(hSession); + foreach (IntPtr hProfile in profileHandles) + { + var profile = GetProfileInfo(hSession, hProfile); + + if (profile.isPredefined == 0 || profile.numOfApps > 0) + { + lstResult.Add(profile.profileName); + } + } + }); + + baseProfileName = tmpBaseProfileName; + return lstResult; + } + + public void CreateProfile(string profileName, string applicationName = null) + { + DrsSession((hSession) => + { + var hProfile = CreateProfile(hSession, profileName); + + if (applicationName != null) + AddApplication(hSession, hProfile, applicationName); + }); + } + + public void ResetAllProfilesInternal() + { + RunDrsInitProcess(); + + DrsSession((hSession) => + { + var nvRes = nvw.DRS_RestoreAllDefaults(hSession); + if (nvRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_RestoreAllDefaults", nvRes); + + SaveSettings(hSession); + }); + } + + public void ResetProfile(string profileName, out bool removeFromModified) + { + bool tmpRemoveFromModified = false; + DrsSession((hSession) => + { + var hProfile = GetProfileHandle(hSession, profileName); + var profile = GetProfileInfo(hSession, hProfile); + + if (profile.isPredefined == 1) + { + var nvRes = nvw.DRS_RestoreProfileDefault(hSession, hProfile); + if (nvRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_RestoreProfileDefault", nvRes); + + SaveSettings(hSession); + tmpRemoveFromModified = true; + } + else if (profile.numOfSettings > 0) + { + int dropCount = 0; + var settings = GetProfileSettings(hSession, hProfile); + + foreach (var setting in settings) + { + if (setting.settingLocation == NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION) + { + if (nvw.DRS_DeleteProfileSetting(hSession, hProfile, setting.settingId) == NvAPI_Status.NVAPI_OK) + { + dropCount++; + } + } + } + if (dropCount > 0) + { + SaveSettings(hSession); + } + } + }); + + removeFromModified = tmpRemoveFromModified; + } + + public void ResetValue(string profileName, uint settingId, out bool removeFromModified) + { + var tmpRemoveFromModified = false; + + DrsSession((hSession) => + { + var hProfile = GetProfileHandle(hSession, profileName); + + if (hProfile != IntPtr.Zero) + { + var nvRes = nvw.DRS_RestoreProfileDefaultSetting(hSession, hProfile, settingId); + if (nvRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_RestoreProfileDefaultSetting", nvRes); + + SaveSettings(hSession); + + var modifyCount = 0; + var settings = GetProfileSettings(hSession, hProfile); + + foreach (var setting in settings) + { + if (setting.isCurrentPredefined == 0 && setting.settingLocation == NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION) + { + modifyCount++; + } + } + tmpRemoveFromModified = (modifyCount == 0); + } + }); + + removeFromModified = tmpRemoveFromModified; + } + + public uint GetDwordValueFromProfile(string profileName, uint settingId, bool returnDefaultValue = false) + { + return DrsSession((hSession) => + { + var hProfile = GetProfileHandle(hSession, profileName); + + var dwordValue = ReadDwordValue(hSession, hProfile, settingId); + + if (dwordValue != null) + return dwordValue.Value; + else if (returnDefaultValue) + return meta.GetSettingMeta(settingId).DefaultDwordValue; + + throw new NvapiException("DRS_GetSetting", NvAPI_Status.NVAPI_SETTING_NOT_FOUND); + }); + } + + public void SetDwordValueToProfile(string profileName, uint settingId, uint dwordValue) + { + DrsSession((hSession) => + { + var hProfile = GetProfileHandle(hSession, profileName); + StoreDwordValue(hSession, hProfile, settingId, dwordValue); + SaveSettings(hSession); + }); + } + + public int StoreSettingsToProfile(string profileName, List> settings) + { + DrsSession((hSession) => + { + var hProfile = GetProfileHandle(hSession, profileName); + + foreach (var setting in settings) + { + var settingMeta = meta.GetSettingMeta(setting.Key); + var settingType = settingMeta.SettingType; + + if (settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE) + { + var dword = DrsUtil.ParseDwordSettingValue(settingMeta, setting.Value); + StoreDwordValue(hSession, hProfile, setting.Key, dword); + } + else if (settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE) + { + var str = DrsUtil.ParseStringSettingValue(settingMeta, setting.Value); + StoreStringValue(hSession, hProfile, setting.Key, str); + } + } + + SaveSettings(hSession); + }); + + return 0; + } + + + private SettingItem CreateSettingItem(NVDRS_SETTING setting, bool useDefault = false) + { + var settingMeta = meta.GetSettingMeta(setting.settingId); + //settingMeta.SettingType = setting.settingType; + + if (settingMeta.DwordValues == null) + settingMeta.DwordValues = new List>(); + + + if (settingMeta.StringValues == null) + settingMeta.StringValues = new List>(); + + + var settingState = SettingState.NotAssiged; + string valueRaw = DrsUtil.StringValueRaw; + string valueText = ""; + + if (settingMeta.SettingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE) + { + if (useDefault) + { + valueRaw = DrsUtil.GetDwordString(settingMeta.DefaultDwordValue); + valueText = DrsUtil.GetDwordSettingValueName(settingMeta, settingMeta.DefaultDwordValue); + } + else if (setting.isCurrentPredefined == 1 && setting.isPredefinedValid == 1) + { + valueRaw = DrsUtil.GetDwordString(setting.predefinedValue.dwordValue); + valueText = DrsUtil.GetDwordSettingValueName(settingMeta, setting.predefinedValue.dwordValue); + + if (setting.settingLocation == NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION) + settingState = SettingState.NvidiaSetting; + else + settingState = SettingState.GlobalSetting; + } + else + { + valueRaw = DrsUtil.GetDwordString(setting.currentValue.dwordValue); + valueText = DrsUtil.GetDwordSettingValueName(settingMeta, setting.currentValue.dwordValue); + + if (setting.settingLocation == NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION) + settingState = SettingState.UserdefinedSetting; + else + settingState = SettingState.GlobalSetting; + } + } + + if (settingMeta.SettingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE) + { + if (useDefault) + { + valueRaw = settingMeta.DefaultStringValue; + valueText = DrsUtil.GetStringSettingValueName(settingMeta, settingMeta.DefaultStringValue); + } + else if (setting.isCurrentPredefined == 1 && setting.isPredefinedValid == 1) + { + valueRaw = setting.predefinedValue.stringValue; + valueText = DrsUtil.GetStringSettingValueName(settingMeta, setting.predefinedValue.stringValue); + settingState = SettingState.NvidiaSetting; + } + else + { + valueRaw = setting.currentValue.stringValue; + valueText = DrsUtil.GetStringSettingValueName(settingMeta, setting.currentValue.stringValue); + + if (setting.settingLocation == NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION) + settingState = SettingState.UserdefinedSetting; + else + settingState = SettingState.GlobalSetting; + } + } + + return new SettingItem() + { + SettingId = setting.settingId, + SettingText = settingMeta.SettingName, + GroupName = settingMeta.GroupName, + ValueRaw = valueRaw, + ValueText = valueText, + State = settingState, + IsStringValue = settingMeta.SettingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE, + }; + } + + + public List GetSettingsForProfile(string profileName, SettingViewMode viewMode, ref List applications) + { + var result = new List(); + var settingIds = meta.GetSettingIds(viewMode); + settingIds.AddRange(_baseProfileSettingIds); + settingIds = settingIds.Distinct().ToList(); + + applications = DrsSession((hSession) => + { + var hProfile = GetProfileHandle(hSession, profileName); + + var profileSettings = GetProfileSettings(hSession, hProfile); + foreach (var profileSetting in profileSettings) + { + result.Add(CreateSettingItem(profileSetting)); + + if (settingIds.Contains(profileSetting.settingId)) + settingIds.Remove(profileSetting.settingId); + } + + foreach (var settingId in settingIds) + { + var setting = ReadSetting(hSession, hProfile, settingId); + if (setting != null) + result.Add(CreateSettingItem(setting.Value)); + else + { + var dummySetting = new NVDRS_SETTING() { settingId = settingId }; + result.Add(CreateSettingItem(dummySetting, true)); + } + } + + return GetProfileApplications(hSession, hProfile) + .Select(x => x.appName).ToList(); ; + + }); + + return result.OrderBy(x=>x.SettingText).ThenBy(x=>x.GroupName).ToList(); + } + + public void AddApplication(string profileName, string applicationName) + { + DrsSession((hSession) => + { + var hProfile = GetProfileHandle(hSession, profileName); + AddApplication(hSession, hProfile, applicationName); + SaveSettings(hSession); + }); + } + + public void DeleteApplication(string profileName, string applicationName) + { + DrsSession((hSession) => + { + var hProfile = GetProfileHandle(hSession, profileName); + DeleteApplication(hSession, hProfile, applicationName); + SaveSettings(hSession); + }); + } + + public List GetApplications(string profileName) + { + return DrsSession((hSession) => + { + var hProfile = GetProfileHandle(hSession, profileName); + var applications = GetProfileApplications(hSession, hProfile); + return applications.Select(x => x.appName).ToList(); + }); + } + + } + +} + diff --git a/nspector/Common/DrsSettingsServiceBase.cs b/nspector/Common/DrsSettingsServiceBase.cs new file mode 100644 index 0000000..3f128d6 --- /dev/null +++ b/nspector/Common/DrsSettingsServiceBase.cs @@ -0,0 +1,324 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using nspector.Common.Helper; + +using nspector.Native.NVAPI2; +using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper; + +namespace nspector.Common +{ + internal abstract class DrsSettingsServiceBase + { + + protected DrsSettingsMetaService meta; + + private readonly IntPtr holdSession; + public DrsSettingsServiceBase(DrsSettingsMetaService metaService, IntPtr? hSession = null) + { + meta = metaService; + + if (hSession.HasValue) + holdSession = hSession.Value; + + DriverVersion = GetDriverVersionInternal(); + } + + public readonly float DriverVersion; + private float GetDriverVersionInternal() + { + float result = 0f; + uint sysDrvVersion = 0; + var sysDrvBranch = new StringBuilder((int)NvapiDrsWrapper.NVAPI_SHORT_STRING_MAX); + + if (nvw.SYS_GetDriverAndBranchVersion(ref sysDrvVersion, sysDrvBranch) == NvAPI_Status.NVAPI_OK) + { + try { result = (float)(sysDrvVersion / 100f); } + catch { } + } + + return result; + } + + protected void DrsSession(Action action) + { + DrsSession((hSession) => + { + action(hSession); + return true; + }); + } + + protected T DrsSession(Func action) + { + if (holdSession != null && holdSession != IntPtr.Zero) + { + return action(holdSession); + } + + IntPtr hSession = IntPtr.Zero; + var csRes = nvw.DRS_CreateSession(ref hSession); + if (csRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_CreateSession", csRes); + + try + { + var nvRes = nvw.DRS_LoadSettings(hSession); + if (nvRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_LoadSettings", nvRes); + + return action(hSession); + } + finally + { + var nvRes = nvw.DRS_DestroySession(hSession); + if (nvRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_DestroySession", nvRes); + } + + } + + public static IntPtr CreateAndLoadSession() + { + IntPtr hSession = IntPtr.Zero; + var csRes = nvw.DRS_CreateSession(ref hSession); + if (csRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_CreateSession", csRes); + + var nvRes = nvw.DRS_LoadSettings(hSession); + if (nvRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_LoadSettings", nvRes); + + return hSession; + } + + protected IntPtr GetProfileHandle(IntPtr hSession, string profileName) + { + var hProfile = IntPtr.Zero; + + if (string.IsNullOrEmpty(profileName)) + { + var nvRes = nvw.DRS_GetCurrentGlobalProfile(hSession, ref hProfile); + if (nvRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_GetCurrentGlobalProfile", nvRes); + } + else + { + var nvRes = nvw.DRS_FindProfileByName(hSession, new StringBuilder(profileName), ref hProfile); + + if (nvRes == NvAPI_Status.NVAPI_PROFILE_NOT_FOUND) + return IntPtr.Zero; + + if (nvRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_FindProfileByName", nvRes); + } + return hProfile; + } + + protected IntPtr CreateProfile(IntPtr hSession, string profileName) + { + if (string.IsNullOrEmpty(profileName)) + throw new ArgumentNullException("profileName"); + + var hProfile = IntPtr.Zero; + + var newProfile = new NVDRS_PROFILE() + { + version = nvw.NVDRS_PROFILE_VER, + profileName = profileName, + }; + + var nvRes = nvw.DRS_CreateProfile(hSession, ref newProfile, ref hProfile); + if (nvRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_CreateProfile", nvRes); + + return hProfile; + } + + + protected NVDRS_PROFILE GetProfileInfo(IntPtr hSession, IntPtr hProfile) + { + var tmpProfile = new NVDRS_PROFILE(); + tmpProfile.version = nvw.NVDRS_PROFILE_VER; + + var gpRes = nvw.DRS_GetProfileInfo(hSession, hProfile, ref tmpProfile); + if (gpRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_GetProfileInfo", gpRes); + + return tmpProfile; + } + + protected void StoreDwordValue(IntPtr hSession, IntPtr hProfile, uint settingId, uint dwordValue) + { + var newSetting = new NVDRS_SETTING() + { + version = nvw.NVDRS_SETTING_VER, + settingId = settingId, + settingType = NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE, + settingLocation = NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION, + currentValue = new NVDRS_SETTING_UNION() + { + dwordValue = dwordValue, + }, + }; + + var ssRes = nvw.DRS_SetSetting(hSession, hProfile, ref newSetting); + if (ssRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_SetSetting", ssRes); + + } + + protected void StoreStringValue(IntPtr hSession, IntPtr hProfile, uint settingId, string stringValue) + { + var newSetting = new NVDRS_SETTING() + { + version = nvw.NVDRS_SETTING_VER, + settingId = settingId, + settingType = NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE, + settingLocation = NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION, + currentValue = new NVDRS_SETTING_UNION() + { + stringValue = stringValue, + }, + }; + + var ssRes = nvw.DRS_SetSetting(hSession, hProfile, ref newSetting); + if (ssRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_SetSetting", ssRes); + + } + + protected NVDRS_SETTING? ReadSetting(IntPtr hSession, IntPtr hProfile, uint settingId) + { + var newSetting = new NVDRS_SETTING() + { + version = nvw.NVDRS_SETTING_VER, + }; + + var ssRes = nvw.DRS_GetSetting(hSession, hProfile, settingId, ref newSetting); + if (ssRes == NvAPI_Status.NVAPI_SETTING_NOT_FOUND) + return null; + + if (ssRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_GetSetting", ssRes); + + return newSetting; + } + + protected uint? ReadDwordValue(IntPtr hSession, IntPtr hProfile, uint settingId) + { + var newSetting = ReadSetting(hSession, hProfile, settingId); + if (newSetting == null) + return null; + return newSetting.Value.currentValue.dwordValue; + } + + protected void AddApplication(IntPtr hSession, IntPtr hProfile, string applicationName) + { + var newApp = new NVDRS_APPLICATION_V3() + { + version = nvw.NVDRS_APPLICATION_VER_V3, + appName = applicationName, + }; + + var caRes = nvw.DRS_CreateApplication(hSession, hProfile, ref newApp); + if (caRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_CreateApplication", caRes); + + } + + protected void DeleteApplication(IntPtr hSession, IntPtr hProfile, string applicationName) + { + var caRes = nvw.DRS_DeleteApplication(hSession, hProfile, new StringBuilder(applicationName)); + if (caRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_DeleteApplication", caRes); + } + + protected List EnumProfileHandles(IntPtr hSession) + { + var profileHandles = new List(); + var hProfile = IntPtr.Zero; + uint index = 0; + + NvAPI_Status nvRes; + + do + { + nvRes = nvw.DRS_EnumProfiles(hSession, index, ref hProfile); + if (nvRes == NvAPI_Status.NVAPI_OK) + { + profileHandles.Add(hProfile); + } + index++; + } + while (nvRes == NvAPI_Status.NVAPI_OK); + + if (nvRes != NvAPI_Status.NVAPI_END_ENUMERATION) + throw new NvapiException("DRS_EnumProfiles", nvRes); + + return profileHandles; + } + + protected List GetProfileSettings(IntPtr hSession, IntPtr hProfile) + { + uint settingCount = 512; + var settings = new NVDRS_SETTING[512]; + settings[0].version = NvapiDrsWrapper.NVDRS_SETTING_VER; + + var esRes = NvapiDrsWrapper.DRS_EnumSettings(hSession, hProfile, 0, ref settingCount, ref settings); + + if (esRes == NvAPI_Status.NVAPI_END_ENUMERATION) + return new List(); + + if (esRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_EnumSettings", esRes); + + return settings.ToList(); + } + + protected List GetProfileApplications(IntPtr hSession, IntPtr hProfile) + { + uint appCount = 512; + var apps = new NVDRS_APPLICATION_V3[512]; + apps[0].version = NvapiDrsWrapper.NVDRS_APPLICATION_VER_V3; + + var esRes = NvapiDrsWrapper.DRS_EnumApplications(hSession, hProfile, 0, ref appCount, ref apps); + + if (esRes == NvAPI_Status.NVAPI_END_ENUMERATION) + return new List(); + + if (esRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_EnumApplications", esRes); + + return apps.ToList(); + } + + protected void SaveSettings(IntPtr hSession) + { + var nvRes = nvw.DRS_SaveSettings(hSession); + if (nvRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_SaveSettings", nvRes); + } + + protected void LoadSettingsFileEx(IntPtr hSession, string filename) + { + var nvRes = nvw.DRS_LoadSettingsFromFileEx(hSession, new StringBuilder(filename)); + if (nvRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_LoadSettingsFromFileEx", nvRes); + } + + protected void SaveSettingsFileEx(IntPtr hSession, string filename) + { + var nvRes = nvw.DRS_SaveSettingsToFileEx(hSession, new StringBuilder(filename)); + if (nvRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_SaveSettingsToFileEx", nvRes); + } + + } + +} + diff --git a/nspector/Common/DrsUtil.cs b/nspector/Common/DrsUtil.cs new file mode 100644 index 0000000..54b3536 --- /dev/null +++ b/nspector/Common/DrsUtil.cs @@ -0,0 +1,74 @@ +using nspector.Common.Meta; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; + +namespace nspector.Common +{ + public static class DrsUtil + { + public static string StringValueRaw = "Text"; + + public static string GetDwordString(uint dword) + { + return string.Format("0x{0:X8}", dword); + } + + public static uint ParseDwordByInputSafe(string input) + { + uint result = 0; + if (input.ToLower().StartsWith("0x")) + { + try + { + int blankPos = input.IndexOf(' '); + int parseLen = blankPos > 2 ? blankPos - 2 : input.Length - 2; + result = uint.Parse(input.Substring(2, parseLen), NumberStyles.AllowHexSpecifier); + } + catch { } + } + else + try { result = uint.Parse(input); } + catch { } + + return result; + } + + internal static uint ParseDwordSettingValue(SettingMeta meta, string text) + { + var valueByName = meta.DwordValues.FirstOrDefault(x => x.ValueName != null && x.ValueName.Equals(text)); + if (valueByName != null) + return valueByName.Value; + + return ParseDwordByInputSafe(text); + } + + internal static string GetDwordSettingValueName(SettingMeta meta, uint dwordValue) + { + var settingValue = meta.DwordValues + .FirstOrDefault(x => x.Value.Equals(dwordValue)); + + return settingValue == null ? GetDwordString(dwordValue): settingValue.ValueName; + } + + internal static string ParseStringSettingValue(SettingMeta meta, string text) + { + var valueByName = meta.StringValues.FirstOrDefault(x => x.ValueName != null && x.ValueName.Equals(text)); + if (valueByName != null) + return valueByName.Value; + + return text; + } + + internal static string GetStringSettingValueName(SettingMeta meta, string stringValue) + { + var settingValue = meta.StringValues + .FirstOrDefault(x => x.Value.Equals(stringValue)); + + return settingValue == null ? stringValue : settingValue.ValueName; + } + + } +} diff --git a/nspector/Common/Helper/AdminHelper.cs b/nspector/Common/Helper/AdminHelper.cs new file mode 100644 index 0000000..ed3110d --- /dev/null +++ b/nspector/Common/Helper/AdminHelper.cs @@ -0,0 +1,20 @@ +using System.Security.Principal; + +namespace nspector.Common.Helper +{ + public static class AdminHelper + { + private static bool isAdmin = false; + static AdminHelper() + { + var identity = WindowsIdentity.GetCurrent(); + var principal = new WindowsPrincipal(identity); + isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator); + } + + public static bool IsAdmin + { + get { return isAdmin; } + } + } +} diff --git a/nspector/Common/Helper/InputBox.cs b/nspector/Common/Helper/InputBox.cs new file mode 100644 index 0000000..7803288 --- /dev/null +++ b/nspector/Common/Helper/InputBox.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Text.RegularExpressions; +using System.Windows.Forms; + +namespace nspector.Common.Helper +{ + internal class InputBox + { + internal static DialogResult Show(string title, string promptText, ref string value, List invalidInputs, string mandatoryFormatRegExPattern, int maxLength) + { + var form = new Form(); + var label = new Label(); + var textBox = new TextBox(); + var buttonOk = new Button(); + var buttonCancel = new Button(); + var imageBox = new PictureBox(); + + EventHandler textchanged = delegate(object sender, EventArgs e) + { + bool mandatory_success = Regex.IsMatch(textBox.Text, mandatoryFormatRegExPattern); + + if (textBox.Text == "" || textBox.Text.Length > maxLength || !mandatory_success) + { + imageBox.Image = nspector.Properties.Resources.ieframe_1_18212; + buttonOk.Enabled = false; + return; + } + + foreach (string invStr in invalidInputs) + { + if (textBox.Text.ToUpper() == invStr.ToUpper()) + { + imageBox.Image = Properties.Resources.ieframe_1_18212; + buttonOk.Enabled = false; + return; + } + } + + imageBox.Image = Properties.Resources.ieframe_1_31073_002; + buttonOk.Enabled = true; + }; + + + textBox.TextChanged += textchanged; + + + form.Text = title; + label.Text = promptText; + textBox.Text = value; + textBox.MaxLength = maxLength; + imageBox.Image = Properties.Resources.ieframe_1_18212; + + buttonOk.Text = "OK"; + buttonCancel.Text = "Cancel"; + buttonOk.DialogResult = DialogResult.OK; + buttonCancel.DialogResult = DialogResult.Cancel; + + buttonOk.Enabled = false; + + label.SetBounds(9, 20, 372, 13); + textBox.SetBounds(12, 36, 352, 20); + buttonOk.SetBounds(228, 72, 75, 23); + buttonCancel.SetBounds(309, 72, 75, 23); + + imageBox.SetBounds(368, 36, 16, 16); + + label.AutoSize = true; + imageBox.Anchor = AnchorStyles.Top | AnchorStyles.Right; + textBox.Anchor = textBox.Anchor | AnchorStyles.Right; + buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + + form.ClientSize = new Size(396, 107); + form.Controls.AddRange(new Control[] { label, textBox, imageBox, buttonOk, buttonCancel }); + form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height); + form.FormBorderStyle = FormBorderStyle.FixedDialog; + form.StartPosition = FormStartPosition.CenterParent; + form.MinimizeBox = false; + form.MaximizeBox = false; + form.AcceptButton = buttonOk; + form.CancelButton = buttonCancel; + + textchanged(form, new EventArgs()); + + DialogResult dialogResult = form.ShowDialog(); + value = textBox.Text; + return dialogResult; + } + } +} diff --git a/nspector/Common/Helper/ListSort.cs b/nspector/Common/Helper/ListSort.cs new file mode 100644 index 0000000..2aad9dd --- /dev/null +++ b/nspector/Common/Helper/ListSort.cs @@ -0,0 +1,19 @@ +using System.Collections; + +namespace nspector.Common.Helper +{ + internal class ListSort : IComparer + { + public int Compare(object x, object y) + { + try + { + return System.String.CompareOrdinal(x.ToString(), y.ToString()); + } + catch + { + return 0; + } + } + } +} \ No newline at end of file diff --git a/nspector/Common/Helper/ListViewGroupSorter.cs b/nspector/Common/Helper/ListViewGroupSorter.cs new file mode 100644 index 0000000..987e8ea --- /dev/null +++ b/nspector/Common/Helper/ListViewGroupSorter.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace nspector.Common.Helper +{ + + public class ListViewGroupHeaderSorter : IComparer + { + private bool _ascending = true; + public ListViewGroupHeaderSorter(bool ascending) + { + _ascending = ascending; + } + + #region IComparer Members + + public int Compare(ListViewGroup x, ListViewGroup y) + { + if (_ascending) + return string.Compare(((ListViewGroup)x).Header, ((ListViewGroup)y).Header); + else + return string.Compare(((ListViewGroup)y).Header, ((ListViewGroup)x).Header); + } + #endregion + } + + public class ListViewGroupSorter + { + internal ListView _listview; + + public static bool operator ==(ListView listview, ListViewGroupSorter sorter) + { + return listview == sorter._listview; + } + public static bool operator !=(ListView listview, ListViewGroupSorter sorter) + { + return listview != sorter._listview; + } + + public static implicit operator ListView(ListViewGroupSorter sorter) + { + return sorter._listview; + } + public static implicit operator ListViewGroupSorter(ListView listview) + { + return new ListViewGroupSorter(listview); + } + + internal ListViewGroupSorter(ListView listview) + { + _listview = listview; + } + + public void SortGroups(bool ascending) + { + _listview.BeginUpdate(); + List lvgs = new List(); + foreach (ListViewGroup lvg in _listview.Groups) + lvgs.Add(lvg); + _listview.Groups.Clear(); + lvgs.Sort(new ListViewGroupHeaderSorter(ascending)); + _listview.Groups.AddRange(lvgs.ToArray()); + _listview.EndUpdate(); + } + + #region overridden methods + + public override bool Equals(object obj) + { + return _listview.Equals(obj); + } + + public override int GetHashCode() + { + return _listview.GetHashCode(); + } + + public override string ToString() + { + return _listview.ToString(); + } + + #endregion + } +} diff --git a/nspector/Common/Helper/NoBorderRenderer.cs b/nspector/Common/Helper/NoBorderRenderer.cs new file mode 100644 index 0000000..e2b7bee --- /dev/null +++ b/nspector/Common/Helper/NoBorderRenderer.cs @@ -0,0 +1,11 @@ +using System.Windows.Forms; + +namespace nspector.Common.Helper +{ + internal class NoBorderRenderer : ToolStripProfessionalRenderer + { + protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) {} + + protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) {} + } +} diff --git a/nspector/Common/Helper/XMLHelper.cs b/nspector/Common/Helper/XMLHelper.cs new file mode 100644 index 0000000..0559e59 --- /dev/null +++ b/nspector/Common/Helper/XMLHelper.cs @@ -0,0 +1,55 @@ +using System.IO; +using System.Text; +using System.Xml; +using System.Xml.Serialization; + +namespace nspector.Common.Helper +{ + internal static class XMLHelper where T : new() + { + static XmlSerializer xmlSerializer; + + static XMLHelper() + { + //TODO: Fix It! + //xmlSerializer = new XmlSerializer(typeof(T)); + xmlSerializer = XmlSerializer.FromTypes(new[]{typeof(T)})[0]; + } + + internal static string SerializeToXmlString(T xmlObject, Encoding encoding, bool removeNamespace) + { + var memoryStream = new MemoryStream(); + var xmlWriter = new XmlTextWriter(memoryStream, encoding) { Formatting = Formatting.Indented }; + + if (removeNamespace) + { + var xs = new XmlSerializerNamespaces(); + xs.Add("", ""); + xmlSerializer.Serialize(xmlWriter, xmlObject, xs); + } + else + xmlSerializer.Serialize(xmlWriter, xmlObject); + + return encoding.GetString(memoryStream.ToArray()); + } + + internal static void SerializeToXmlFile(T xmlObject, string filename, Encoding encoding, bool removeNamespace) + { + File.WriteAllText(filename, SerializeToXmlString(xmlObject, encoding, removeNamespace)); + } + + internal static T DeserializeFromXmlString(string xml) + { + var reader = new StringReader(xml); + var xmlObject = (T)xmlSerializer.Deserialize(reader); + return xmlObject; + } + + internal static T DeserializeFromXMLFile(string filename) + { + return DeserializeFromXmlString(File.ReadAllText(filename)); + } + + } + +} diff --git a/nspector/Common/Import/Profile.cs b/nspector/Common/Import/Profile.cs new file mode 100644 index 0000000..20ea3e1 --- /dev/null +++ b/nspector/Common/Import/Profile.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace nspector.Common.Import +{ + [Serializable] + public class Profile + { + public string ProfileName = ""; + public List Executeables = new List(); + public List Settings = new List(); + } +} \ No newline at end of file diff --git a/nspector/Common/Import/ProfileSetting.cs b/nspector/Common/Import/ProfileSetting.cs new file mode 100644 index 0000000..1644a76 --- /dev/null +++ b/nspector/Common/Import/ProfileSetting.cs @@ -0,0 +1,16 @@ +using System; +using System.Xml.Serialization; + +namespace nspector.Common.Import +{ + [Serializable] + public class ProfileSetting + { + public string SettingNameInfo = ""; + + [XmlElement(ElementName = "SettingID")] + public uint SettingId = 0; + + public uint SettingValue = 0; + } +} \ No newline at end of file diff --git a/nspector/Common/Import/Profiles.cs b/nspector/Common/Import/Profiles.cs new file mode 100644 index 0000000..a24fb5b --- /dev/null +++ b/nspector/Common/Import/Profiles.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; + +namespace nspector.Common.Import +{ + [Serializable] + public class Profiles : List + { + + } +} \ No newline at end of file diff --git a/nspector/Common/Meta/ConstantSettingMetaService.cs b/nspector/Common/Meta/ConstantSettingMetaService.cs new file mode 100644 index 0000000..cc75a0c --- /dev/null +++ b/nspector/Common/Meta/ConstantSettingMetaService.cs @@ -0,0 +1,166 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using nspector.Native.NvApi.DriverSettings; +using nspector.Native.NVAPI2; + +namespace nspector.Common.Meta +{ + internal class ConstantSettingMetaService : ISettingMetaService + { + + public ConstantSettingMetaService() + { + settingEnumTypeCache = CreateSettingEnumTypeCache(); + GetSettingIds(); + } + + private readonly Dictionary settingEnumTypeCache; + + private string[] ignoreSettingNames = new[] { "TOTAL_DWORD_SETTING_NUM", "TOTAL_WSTRING_SETTING_NUM", + "TOTAL_SETTING_NUM", "INVALID_SETTING_ID" }; + + private Dictionary CreateSettingEnumTypeCache() + { + var result = new Dictionary(); + + var drsEnumTypes = Assembly.GetExecutingAssembly().GetTypes() + .Where(t => t.Namespace == "nspector.Native.NvApi.DriverSettings" + && t.IsEnum && t.Name.StartsWith("EValues_")).ToList(); + + var settingIdNames = Enum.GetNames(typeof(ESetting)).Distinct().ToList(); + + foreach (var settingIdName in settingIdNames) + { + if (ignoreSettingNames.Contains(settingIdName)) + continue; + + var enumType = drsEnumTypes + .FirstOrDefault(x => settingIdName + .Substring(0, settingIdName.Length - 3) + .Equals(x.Name.Substring(8)) + ); + + if (enumType != null) + { + var settingIdVal = (ESetting)Enum.Parse(typeof(ESetting), settingIdName); + result.Add(settingIdVal, enumType); + } + } + + return result; + } + + public Type GetSettingEnumType(uint settingId) + { + if (settingEnumTypeCache.ContainsKey((ESetting)settingId)) + return settingEnumTypeCache[(ESetting)settingId]; + + return null; + } + + public NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId) + { + return null; + } + + public string GetSettingName(uint settingId) + { + if (settingIds.Contains(settingId)) + return ((ESetting)settingId).ToString(); + + return null; + } + + public uint? GetDwordDefaultValue(uint settingId) + { + if (settingEnumTypeCache.ContainsKey((ESetting)settingId)) + { + var enumType = settingEnumTypeCache[(ESetting)settingId]; + + var defaultName = Enum.GetNames(enumType).FirstOrDefault(x => x.EndsWith("_DEFAULT")); + if (defaultName != null) + return (uint)Enum.Parse(enumType, defaultName); + } + return null; + } + + public string GetStringDefaultValue(uint settingId) + { + return null; + } + + public List> GetStringValues(uint settingId) + { + return null; + } + + private uint ParseEnumValue(Type enumType, string enumText) + { + try + { + return (uint)Enum.Parse(enumType, enumText); + } + catch (InvalidCastException) + { + var intValue = (int)Enum.Parse(enumType, enumText); + var bytes = BitConverter.GetBytes(intValue); + return BitConverter.ToUInt32(bytes, 0); + } + } + + public List> GetDwordValues(uint settingId) + { + if (settingEnumTypeCache.ContainsKey((ESetting)settingId)) + { + var enumType = settingEnumTypeCache[(ESetting)settingId]; + + var validNames = Enum.GetNames(enumType) + .Where(x => 1 == 1 + && !x.EndsWith("_DEFAULT") + && !x.EndsWith("_NUM_VALUES") + //&& !x.EndsWith("_NUM") + //&& !x.EndsWith("_MASK") + //&& (!x.EndsWith("_MIN") || x.Equals("PREFERRED_PSTATE_PREFER_MIN")) + //&& (!x.EndsWith("_MAX") || x.Equals("PREFERRED_PSTATE_PREFER_MAX")) + ).ToList(); + + return validNames.Select(x => new SettingValue(Source) + { + Value = ParseEnumValue(enumType, x), + ValueName = DrsUtil.GetDwordString(ParseEnumValue(enumType, x)) + " " + x + }).ToList(); + + } + return null; + } + + private HashSet settingIds; + public List GetSettingIds() + { + if (settingIds == null) + settingIds = new HashSet( + Enum.GetValues(typeof(ESetting)) + .Cast() + .Where(x => !ignoreSettingNames.Contains(x.ToString())) + .Cast() + .Distinct() + .ToList()); + + return settingIds.ToList(); + } + + + public string GetGroupName(uint settingId) + { + return null; + } + + public SettingMetaSource Source + { + get { return SettingMetaSource.ConstantSettings; } + } + } +} diff --git a/nspector/Common/Meta/CustomSettingMetaService.cs b/nspector/Common/Meta/CustomSettingMetaService.cs new file mode 100644 index 0000000..a94f664 --- /dev/null +++ b/nspector/Common/Meta/CustomSettingMetaService.cs @@ -0,0 +1,101 @@ +using nspector.Common.CustomSettings; +using nspector.Native.NVAPI2; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace nspector.Common.Meta +{ + internal class CustomSettingMetaService : ISettingMetaService + { + + private readonly CustomSettingNames customSettings; + private readonly SettingMetaSource _source; + + public CustomSettingMetaService(CustomSettingNames customSettings, SettingMetaSource sourceOverride = SettingMetaSource.CustomSettings) + { + this.customSettings = customSettings; + _source = sourceOverride; + } + + public NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId) + { + return null; + } + + public string GetSettingName(uint settingId) + { + var setting = customSettings.Settings + .FirstOrDefault(x => x.SettingId.Equals(settingId)); + + if (setting != null) + return setting.UserfriendlyName; + + return null; + } + + public uint? GetDwordDefaultValue(uint settingId) + { + var setting = customSettings.Settings + .FirstOrDefault(x => x.SettingId.Equals(settingId)); + + if (setting != null) + return setting.DefaultValue; + + return null; + } + + public string GetStringDefaultValue(uint settingId) + { + return null; + } + + public List> GetStringValues(uint settingId) + { + return null; + } + + public List> GetDwordValues(uint settingId) + { + var setting = customSettings.Settings + .FirstOrDefault(x => x.SettingId.Equals(settingId)); + + if (setting != null) + { + var i = 0; + return setting.SettingValues.Select(x => new SettingValue(Source) + { + ValuePos = i++, + Value = x.SettingValue, + ValueName = _source == SettingMetaSource.CustomSettings ? x.UserfriendlyName : DrsUtil.GetDwordString(x.SettingValue) + " " + x.UserfriendlyName, + }).ToList(); + } + + return null; + } + + public List GetSettingIds() + { + return customSettings.Settings + .Select(x => x.SettingId).ToList(); + } + + + public string GetGroupName(uint settingId) + { + var setting = customSettings.Settings + .FirstOrDefault(x => x.SettingId.Equals(settingId)); + + if (setting != null && !string.IsNullOrWhiteSpace(setting.GroupName)) + return setting.GroupName; + + return null; + } + + public SettingMetaSource Source + { + get { return _source; } + } + } +} diff --git a/nspector/Common/Meta/DriverSettingMetaService.cs b/nspector/Common/Meta/DriverSettingMetaService.cs new file mode 100644 index 0000000..7e45337 --- /dev/null +++ b/nspector/Common/Meta/DriverSettingMetaService.cs @@ -0,0 +1,189 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using nspector.Common.CustomSettings; + +using nspector.Native.NvApi.DriverSettings; +using nspector.Native.NVAPI2; +using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper; + +namespace nspector.Common.Meta +{ + + internal class DriverSettingMetaService : ISettingMetaService + { + + private readonly Dictionary _settingMetaCache = new Dictionary(); + private readonly List _settingIds; + + public DriverSettingMetaService() + { + _settingIds = InitSettingIds(); + } + + private List InitSettingIds() + { + var settingIds = new List(); + + var nvRes = nvw.DRS_EnumAvailableSettingIds(out settingIds, 512); + if (nvRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_EnumAvailableSettingIds", nvRes); + + return settingIds; + } + + private SettingMeta GetDriverSettingMetaInternal(uint settingId) + { + var values = new NVDRS_SETTING_VALUES(); + values.version = nvw.NVDRS_SETTING_VALUES_VER; + uint valueCount = 255; + + var nvRes = nvw.DRS_EnumAvailableSettingValues(settingId, ref valueCount, ref values); + + if (nvRes == NvAPI_Status.NVAPI_SETTING_NOT_FOUND) + return null; + + if (nvRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_EnumAvailableSettingValues", nvRes); + + + var sbSettingName = new StringBuilder((int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX); + nvRes = nvw.DRS_GetSettingNameFromId(settingId, sbSettingName); + if (nvRes != NvAPI_Status.NVAPI_OK) + throw new NvapiException("DRS_GetSettingNameFromId", nvRes); + + var settingName = sbSettingName.ToString(); + if (string.IsNullOrWhiteSpace(settingName)) + settingName = DrsUtil.GetDwordString(settingId); + + var result = new SettingMeta { + SettingType = values.settingType, + SettingName = settingName, + }; + + + if (values.settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE) + { + result.DefaultDwordValue = values.defaultValue.dwordValue; + result.DwordValues = new List>(); + for (int i = 0; i < values.numSettingValues; i++) + { + result.DwordValues.Add( + new SettingValue (Source) { + Value = values.settingValues[i].dwordValue, + ValueName = DrsUtil.GetDwordString(values.settingValues[i].dwordValue), + }); + } + } + + if (values.settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE) + { + result.DefaultStringValue = values.defaultValue.stringValue; + result.StringValues = new List>(); + for (int i = 0; i < values.numSettingValues; i++) + { + var strValue = values.settingValues[i].stringValue; + if (strValue != null) + { + result.StringValues.Add( + new SettingValue(Source) + { + Value = strValue, + ValueName = strValue, + }); + } + } + } + return result; + + } + + private SettingMeta GetSettingsMeta(uint settingId) + { + if (_settingMetaCache.ContainsKey(settingId)) + return _settingMetaCache[settingId]; + else + { + var settingMeta = GetDriverSettingMetaInternal(settingId); + if (settingMeta != null) + { + _settingMetaCache.Add(settingId, settingMeta); + return settingMeta; + } + + return null; + } + } + + public string GetSettingName(uint settingId) + { + var settingMeta = GetSettingsMeta(settingId); + if (settingMeta != null) + return settingMeta.SettingName; + + return null; + } + + public uint? GetDwordDefaultValue(uint settingId) + { + var settingMeta = GetSettingsMeta(settingId); + if (settingMeta != null) + return settingMeta.DefaultDwordValue; + + return null; + } + + public string GetStringDefaultValue(uint settingId) + { + var settingMeta = GetSettingsMeta(settingId); + if (settingMeta != null) + return settingMeta.DefaultStringValue; + + return null; + } + + public List> GetStringValues(uint settingId) + { + var settingMeta = GetSettingsMeta(settingId); + if (settingMeta != null) + return settingMeta.StringValues; + + return null; + } + + public List> GetDwordValues(uint settingId) + { + var settingMeta = GetSettingsMeta(settingId); + if (settingMeta != null) + return settingMeta.DwordValues; + + return null; + } + + public List GetSettingIds() + { + return _settingIds; + } + + public NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId) + { + var settingMeta = GetSettingsMeta(settingId); + if (settingMeta != null) + return settingMeta.SettingType; + + return null; + } + + public string GetGroupName(uint settingId) + { + return null; + } + + public SettingMetaSource Source + { + get { return SettingMetaSource.DriverSettings; } + } + } +} diff --git a/nspector/Common/Meta/ISettingMetaService.cs b/nspector/Common/Meta/ISettingMetaService.cs new file mode 100644 index 0000000..d965246 --- /dev/null +++ b/nspector/Common/Meta/ISettingMetaService.cs @@ -0,0 +1,29 @@ +using nspector.Native.NVAPI2; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace nspector.Common.Meta +{ + internal interface ISettingMetaService + { + SettingMetaSource Source {get; } + + NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId); + + string GetSettingName(uint settingId); + + string GetGroupName(uint settingId); + + uint? GetDwordDefaultValue(uint settingId); + + string GetStringDefaultValue(uint settingId); + + List> GetStringValues(uint settingId); + + List> GetDwordValues(uint settingId); + + List GetSettingIds(); + } +} diff --git a/nspector/Common/Meta/MetaServiceItem.cs b/nspector/Common/Meta/MetaServiceItem.cs new file mode 100644 index 0000000..6d0837c --- /dev/null +++ b/nspector/Common/Meta/MetaServiceItem.cs @@ -0,0 +1,8 @@ +namespace nspector.Common.Meta +{ + internal class MetaServiceItem + { + public ISettingMetaService Service { get; set; } + public uint ValueNamePrio { get; set; } + } +} \ No newline at end of file diff --git a/nspector/Common/Meta/NvD3dUmxSettingMetaService.cs b/nspector/Common/Meta/NvD3dUmxSettingMetaService.cs new file mode 100644 index 0000000..d374f7d --- /dev/null +++ b/nspector/Common/Meta/NvD3dUmxSettingMetaService.cs @@ -0,0 +1,179 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text; +using nspector.Native.NvApi.DriverSettings; +using nspector.Native.NVAPI2; + +namespace nspector.Common.Meta +{ + internal class NvD3dUmxSettingMetaService : ISettingMetaService + { + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + struct NvD3dUmxName + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)] + public string settingName; + + public uint settingId; + public uint unknown; + } + + [StructLayout(LayoutKind.Sequential)] + struct NvD3dUmxNameList + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 255)] + public NvD3dUmxName[] settingNames; + } + + private static int FindOffset(byte[] bytes, byte[] pattern, int offset = 0, byte? wildcard = null) + { + for (int i = offset; i < bytes.Length; i++) + { + if (pattern[0] == bytes[i] && bytes.Length - i >= pattern.Length) + { + bool ismatch = true; + for (int j = 1; j < pattern.Length && ismatch == true; j++) + { + if (bytes[i + j] != pattern[j] && ((wildcard.HasValue && wildcard != pattern[j]) || !wildcard.HasValue)) + { + ismatch = false; + break; + } + } + if (ismatch) + return i; + + } + } + return -1; + } + + private static List ParseNvD3dUmxNames(string filename) + { + var bytes = File.ReadAllBytes(filename); + + var runtimeNameOffset = FindOffset(bytes, new byte[] { 0x52, 0x75, 0x6E, 0x54, 0x69, 0x6D, 0x65, 0x4E, 0x61, 0x6D, 0x65 }); + if (runtimeNameOffset > -1) + { + var _2ddNotesOffset = FindOffset(bytes, new byte[] { 0x32, 0x44, 0x44, 0x5F, 0x4E, 0x6F, 0x74, 0x65, 0x73 }); + if (_2ddNotesOffset > -1) + { + var itemSize = Marshal.SizeOf(typeof(NvD3dUmxName)); + var startOffset = runtimeNameOffset - itemSize; + var endOffset = _2ddNotesOffset + itemSize; + var tableLength = endOffset - startOffset; + + var bufferSize = Marshal.SizeOf(typeof(NvD3dUmxNameList)); + if (tableLength > bufferSize) + { + tableLength = bufferSize; + } + + var itemCount = tableLength / itemSize; + var buffer = new byte[bufferSize]; + Buffer.BlockCopy(bytes, startOffset, buffer, 0, tableLength); + + var poBuffer = GCHandle.Alloc(buffer, GCHandleType.Pinned); + try + { + var nvD3dUmxNames = (NvD3dUmxNameList)Marshal.PtrToStructure( + poBuffer.AddrOfPinnedObject(), + typeof(NvD3dUmxNameList)); + + var result = new List(); + for (int i = 0; i < itemCount; i++) + { + result.Add(nvD3dUmxNames.settingNames[i]); + } + return result; + + } + finally + { + poBuffer.Free(); + } + } + } + + return null; + } + + private readonly List _SettingNames; + + public NvD3dUmxSettingMetaService() + { + var systemPath = Environment.GetFolderPath(Environment.SpecialFolder.System); + var nvD3dUmxPath = Path.Combine(systemPath, "nvd3dumx.dll"); + _SettingNames = ParseNvD3dUmxNames(nvD3dUmxPath); + } + + public Type GetSettingEnumType(uint settingId) + { + return null; + } + + public NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId) + { + return null; + } + + public string GetSettingName(uint settingId) + { + if (_SettingNames != null) + { + var setting = _SettingNames.FirstOrDefault(s => s.settingId == settingId); + return setting.settingId != 0 ? setting.settingName : null; + } + return null; + } + + public uint? GetDwordDefaultValue(uint settingId) + { + return null; + } + + public string GetStringDefaultValue(uint settingId) + { + return null; + } + + public List> GetStringValues(uint settingId) + { + return null; + } + + public List> GetDwordValues(uint settingId) + { + return null; + } + + public List GetSettingIds() + { + if (_SettingNames != null) + { + return _SettingNames.Select(s => s.settingId).ToList(); + } + return null; + } + + public string GetGroupName(uint settingId) + { + if (_SettingNames != null) + { + var setting = _SettingNames.FirstOrDefault(s => s.settingId == settingId); + return setting.settingId != 0 ? "7 - Stereo" : null; + } + + return null; + } + + public SettingMetaSource Source + { + get { return SettingMetaSource.NvD3dUmxSettings; } + } + } +} diff --git a/nspector/Common/Meta/ScannedSettingMetaService.cs b/nspector/Common/Meta/ScannedSettingMetaService.cs new file mode 100644 index 0000000..f563509 --- /dev/null +++ b/nspector/Common/Meta/ScannedSettingMetaService.cs @@ -0,0 +1,89 @@ +using nspector.Native.NVAPI2; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace nspector.Common.Meta +{ + internal class ScannedSettingMetaService : ISettingMetaService + { + private readonly List CachedSettings; + + public ScannedSettingMetaService(List cachedSettings) + { + CachedSettings = cachedSettings; + } + + public SettingMetaSource Source + { + get { return SettingMetaSource.ScannedSettings; } + } + + public NVDRS_SETTING_TYPE? GetSettingValueType(uint settingId) + { + var cached = CachedSettings.FirstOrDefault(x => x.SettingId.Equals(settingId)); + if (cached != null) + return cached.SettingType; + + return null; + } + + public string GetSettingName(uint settingId) + { + var cached = CachedSettings.FirstOrDefault(x=>x.SettingId.Equals(settingId)); + if (cached != null) + return string.Format("0x{0:X8} ({1} Profiles)", settingId, cached.ProfileCount); + + return null; + } + + public string GetGroupName(uint settingId) + { + return null; + } + + public uint? GetDwordDefaultValue(uint settingId) + { + return null; + } + + public string GetStringDefaultValue(uint settingId) + { + return null; + } + + public List> GetStringValues(uint settingId) + { + var cached = CachedSettings.FirstOrDefault(x => x.SettingId.Equals(settingId)); + if (cached != null) + return cached.SettingValues.Select(s => new SettingValue(Source) + { + Value = s.ValueStr, + ValueName = string.Format("'{0}' ({1})", s.ValueStr.Trim(), s.ProfileNames), + + }).ToList(); + + return null; + } + + public List> GetDwordValues(uint settingId) + { + var cached = CachedSettings.FirstOrDefault(x=>x.SettingId.Equals(settingId)); + if (cached != null) + return cached.SettingValues.Select(s => new SettingValue(Source) + { + Value = s.Value, + ValueName = string.Format("0x{0:X8} ({1})", s.Value, s.ProfileNames), + + }).ToList(); + + return null; + } + + public List GetSettingIds() + { + return CachedSettings.Select(c => c.SettingId).ToList(); + } + } +} diff --git a/nspector/Common/Meta/SettingMeta.cs b/nspector/Common/Meta/SettingMeta.cs new file mode 100644 index 0000000..99b7095 --- /dev/null +++ b/nspector/Common/Meta/SettingMeta.cs @@ -0,0 +1,25 @@ +using nspector.Native.NVAPI2; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace nspector.Common.Meta +{ + internal class SettingMeta + { + public NVDRS_SETTING_TYPE? SettingType { get; set; } + + public string GroupName { get; set; } + + public string SettingName { get; set; } + + public string DefaultStringValue { get; set; } + + public uint DefaultDwordValue { get; set; } + + public List> StringValues { get; set; } + + public List> DwordValues { get; set; } + } +} diff --git a/nspector/Common/Meta/SettingMetaSource.cs b/nspector/Common/Meta/SettingMetaSource.cs new file mode 100644 index 0000000..1da5929 --- /dev/null +++ b/nspector/Common/Meta/SettingMetaSource.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace nspector.Common.Meta +{ + public enum SettingMetaSource + { + CustomSettings = 10, + DriverSettings = 20, + ConstantSettings = 30, + ReferenceSettings = 40, + NvD3dUmxSettings = 50, + ScannedSettings = 60, + } +} diff --git a/nspector/Common/Meta/SettingValue.cs b/nspector/Common/Meta/SettingValue.cs new file mode 100644 index 0000000..ec9f697 --- /dev/null +++ b/nspector/Common/Meta/SettingValue.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace nspector.Common.Meta +{ + internal class SettingValue + { + + public SettingMetaSource ValueSource; + + public SettingValue(SettingMetaSource source) + { + ValueSource = source; + } + + public int ValuePos { get; set; } + public string ValueName { get; set; } + public T Value { get; set; } + + public override string ToString() + { + if (typeof(T) == typeof(uint)) + return string.Format("Value=0x{0:X8}; ValueName={1};", Value, ValueName); + + return string.Format("Value={0}; ValueName={1};", Value, ValueName); + } + } +} diff --git a/nspector/Common/NvapiException.cs b/nspector/Common/NvapiException.cs new file mode 100644 index 0000000..559f6ef --- /dev/null +++ b/nspector/Common/NvapiException.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using nspector.Native.NVAPI2; + +namespace nspector.Common +{ + public class NvapiException : Exception + { + public readonly NvAPI_Status Status; + + public NvapiException(string function, NvAPI_Status status) + : base(function + " failed: " + status) + { + Status = status; + } + + } +} diff --git a/nspector/Common/SettingItem.cs b/nspector/Common/SettingItem.cs new file mode 100644 index 0000000..95e1ec5 --- /dev/null +++ b/nspector/Common/SettingItem.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace nspector.Common +{ + + internal enum SettingState + { + NotAssiged, + GlobalSetting, + UserdefinedSetting, + NvidiaSetting, + } + + internal class SettingItem + { + public uint SettingId { get; set; } + + public string SettingText { get; set; } + + public string ValueText { get; set; } + + public string ValueRaw { get; set; } + + public string GroupName { get; set; } + + public SettingState State { get; set; } + + public bool IsStringValue { get; set; } + + public override string ToString() + { + return string.Format("{0}; 0x{1:X8}; {2}; {3}; {4};", State, SettingId, SettingText, ValueText, ValueRaw); + } + + } +} diff --git a/nspector/Common/SettingViewMode.cs b/nspector/Common/SettingViewMode.cs new file mode 100644 index 0000000..6dd04bc --- /dev/null +++ b/nspector/Common/SettingViewMode.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace nspector.Common +{ + public enum SettingViewMode + { + Normal, + IncludeScannedSetttings, + CustomSettingsOnly, + } +} diff --git a/nspector/CustomSettingNames.xml b/nspector/CustomSettingNames.xml new file mode 100644 index 0000000..af88f2f --- /dev/null +++ b/nspector/CustomSettingNames.xml @@ -0,0 +1,2671 @@ + + + false + + + Enable Maxwell sample interleaving (MFAA) + 0x0098C1AC + 3 - Antialiasing + 344.11 + + + Off + 0x00000000 + + + On + 0x00000001 + + + + + + Prefered Refreshrate + 0x0064B541 + 2 - Sync and Refresh + + + Use the 3D application setting + 0x00000000 + + + Highest available + 0x00000001 + + + + + + GSYNC - Indicator Overlay + 0x10029538 + 331.00 + 2 - Sync and Refresh + + + Off + 0x00000000 + + + On + 0x00000001 + + + + + + GSYNC - Application Mode + 0x1194F158 + 331.00 + 2 - Sync and Refresh + + + Off + 0x00000000 + + + Fullscreen only + 0x00000001 + + + Fullscreen and Windowed + 0x00000002 + + + + + + GSYNC - Global Mode + 0x1094F1F7 + 331.00 + 2 - Sync and Refresh + + + Off + 0x00000000 + + + Fullscreen only + 0x00000001 + + + Fullscreen and Windowed + 0x00000002 + + + + + + GSYNC - Global Feature + 0x1094F157 + 331.00 + 2 - Sync and Refresh + + + Off + 0x00000000 + + + On + 0x00000001 + + + + + + GSYNC - Application State + 0x10A879CF + 331.00 + 2 - Sync and Refresh + + + Allow + 0x00000000 + + + Force Off + 0x00000001 + + + Disallow + 0x00000002 + + + Utra Low Motion Blur + 0x00000003 + + + Fixed Refresh Rate + 0x00000004 + + + + + + GSYNC - Application Requested State + 0x10A879AC + 331.00 + 2 - Sync and Refresh + + + Allow + 0x00000000 + + + Force Off + 0x00000001 + + + Disallow + 0x00000002 + + + Utra Low Motion Blur + 0x00000003 + + + Fixed Refresh Rate + 0x00000004 + + + + + + Prevent Anisotropic filtering + 0x103BCCB5 + 331.00 + 4 - Texture Filtering + + + Off + 0x00000000 + + + On + 0x00000001 + + + + + + Shadercache + 0x00198FFF + 337.50 + + 5 - Common + 0x00000001 + + + Off + 0x00000000 + + + On + 0x00000001 + + + + + + Antialiasing fix + 0x000858F7 + 320.14 + + 1 - Compatibility + 0x00000001 + + + On + 0x00000000 + + + Off + 0x00000001 + + + + + Vertical Sync Smooth AFR behavior + 0x101AE763 + 310.00 + + 2 - Sync and Refresh + + + Off + 0x00000000 + + + On + 0x00000001 + + + + + + Texture filtering - Driver Controlled LOD Bias + 0x00638E8F + 313.00 + + 4 - Texture Filtering + + + Off + 0x00000000 + + + On + 0x00000001 + + + + + + Frame Rate Limiter + 0x10834FEE + 280.26 + + 2 - Sync and Refresh + + + Off + 0x00000000 + + + [~] 23.4 fps + 0xF0000017 + + + [~] 24.4 fps + 0xF0000018 + + + [~] 25.4 fps + 0xF0000019 + + + [~] 26.4 fps + 0xF000001A + + + [~] 27.4 fps + 0xF000001B + + + [~] 28.5 fps + 0xF000001C + + + [~] 29.5 fps + 0xF000001D + + + [~] 30.5 fps + 0xF000001E + + + [~] 31.5 fps + 0xF000001F + + + [~] 32.6 fps + 0xF0000020 + + + [~] 33.6 fps + 0xF0000021 + + + [~] 34.6 fps + 0xF0000022 + + + [~] 35.7 fps + 0xF0000023 + + + [~] 36.7 fps + 0xF0000024 + + + [~] 37.7 fps + 0xF0000025 + + + [~] 38.8 fps + 0xF0000026 + + + [~] 39.8 fps + 0xF0000027 + + + [~] 40.8 fps + 0xF0000028 + + + [~] 41.9 fps + 0xF0000029 + + + [~] 42.9 fps + 0xF000002A + + + [~] 43.9 fps + 0xF000002B + + + [~] 45.0 fps + 0xF000002C + + + [~] 46.0 fps + 0xF000002D + + + [~] 47.1 fps + 0xF000002E + + + [~] 48.1 fps + 0xF000002F + + + [~] 49.1 fps + 0xF0000030 + + + [~] 50.2 fps + 0xF0000031 + + + [~] 51.2 fps + 0xF0000032 + + + [~] 52.3 fps + 0xF0000033 + + + [~] 53.3 fps + 0xF0000034 + + + [~] 54.4 fps + 0xF0000035 + + + [~] 55.4 fps + 0xF0000036 + + + [~] 56.5 fps + 0xF0000037 + + + [~] 57.5 fps + 0xF0000038 + + + [~] 58.6 fps + 0xF0000039 + + + [~] 59.7 fps + 0xF000003A + + + [~] 60.7 fps + 0xF000003B + + + [~] 61.8 fps + 0xF000003C + + + [~] 62.8 fps + 0xF000003D + + + [~] 63.9 fps + 0xF000003E + + + [~] 65.0 fps + 0xF000003F + + + [~] 66.0 fps + 0xF0000040 + + + [~] 67.1 fps + 0xF0000041 + + + [~] 68.1 fps + 0xF0000042 + + + [~] 69.2 fps + 0xF0000043 + + + [~] 70.3 fps + 0xF0000044 + + + [~] 71.3 fps + 0xF0000045 + + + [~] 72.4 fps + 0xF0000046 + + + [~] 73.5 fps + 0xF0000047 + + + [~] 74.6 fps + 0xF0000048 + + + [~] 75.6 fps + 0xF0000049 + + + [~] 76.7 fps + 0xF000004A + + + [~] 77.8 fps + 0xF000004B + + + [~] 78.9 fps + 0xF000004C + + + [~] 79.9 fps + 0xF000004D + + + [~] 81.0 fps + 0xF000004E + + + [~] 82.1 fps + 0xF000004F + + + [~] 83.2 fps + 0xF0000050 + + + [~] 84.3 fps + 0xF0000051 + + + [~] 85.3 fps + 0xF0000052 + + + [~] 86.4 fps + 0xF0000053 + + + [~] 87.5 fps + 0xF0000054 + + + [~] 88.6 fps + 0xF0000055 + + + [~] 89.7 fps + 0xF0000056 + + + [~] 90.8 fps + 0xF0000057 + + + [~] 91.9 fps + 0xF0000058 + + + [~] 93.0 fps + 0xF0000059 + + + [~] 94.0 fps + 0xF000005A + + + [~] 95.1 fps + 0xF000005B + + + [~] 96.2 fps + 0xF000005C + + + [~] 97.3 fps + 0xF000005D + + + [~] 98.4 fps + 0xF000005E + + + [~] 99.5 fps + 0xF000005F + + + [~] 100.6 fps + 0xF0000060 + + + [~] 101.7 fps + 0xF0000061 + + + [~] 102.8 fps + 0xF0000062 + + + [~] 103.9 fps + 0xF0000063 + + + [~] 105.0 fps + 0xF0000064 + + + [~] 106.1 fps + 0xF0000065 + + + [~] 107.3 fps + 0xF0000066 + + + [~] 108.4 fps + 0xF0000067 + + + [~] 109.5 fps + 0xF0000068 + + + [~] 110.6 fps + 0xF0000069 + + + [~] 111.7 fps + 0xF000006A + + + [~] 112.8 fps + 0xF000006B + + + [~] 113.9 fps + 0xF000006C + + + [~] 115.0 fps + 0xF000006D + + + [~] 116.1 fps + 0xF000006E + + + [~] 117.3 fps + 0xF000006F + + + [~] 118.4 fps + 0xF0000070 + + + [~] 119.5 fps + 0xF0000071 + + + [~] 120.6 fps + 0xF0000072 + + + [~] 121.7 fps + 0xF0000073 + + + [~] 122.9 fps + 0xF0000074 + + + [~] 124.0 fps + 0xF0000075 + + + [~] 125.1 fps + 0xF0000076 + + + [~] 126.2 fps + 0xF0000077 + + + [~] 127.4 fps + 0xF0000078 + + + [~] 128.5 fps + 0xF0000079 + + + [~] 129.6 fps + 0xF000007A + + + [~] 130.8 fps + 0xF000007B + + + [~] 131.9 fps + 0xF000007C + + + [~] 133.0 fps + 0xF000007D + + + [~] 134.2 fps + 0xF000007E + + + [~] 135.3 fps + 0xF000007F + + + [~] 136.4 fps + 0xF0000080 + + + [~] 137.6 fps + 0xF0000081 + + + [~] 138.7 fps + 0xF0000082 + + + [~] 139.9 fps + 0xF0000083 + + + [~] 141.0 fps + 0xF0000084 + + + [~] 142.1 fps + 0xF0000085 + + + [~] 143.3 fps + 0xF0000086 + + + [~] 144.4 fps + 0xF0000087 + + + [~] 145.6 fps + 0xF0000088 + + + [~] 146.7 fps + 0xF0000089 + + + [~] 147.9 fps + 0xF000008A + + + [~] 149.0 fps + 0xF000008B + + + [~] 150.2 fps + 0xF000008C + + + [~] 151.3 fps + 0xF000008D + + + [~] 152.5 fps + 0xF000008E + + + [~] 153.6 fps + 0xF000008F + + + [~] 154.8 fps + 0xF0000090 + + + [~] 155.9 fps + 0xF0000091 + + + [~] 157.1 fps + 0xF0000092 + + + [~] 158.3 fps + 0xF0000093 + + + [~] 159.4 fps + 0xF0000094 + + + [~] 160.6 fps + 0xF0000095 + + + [~] 161.8 fps + 0xF0000096 + + + [~] 162.9 fps + 0xF0000097 + + + [~] 164.1 fps + 0xF0000098 + + + [~] 165.3 fps + 0xF0000099 + + + [~] 166.4 fps + 0xF000009A + + + [~] 167.6 fps + 0xF000009B + + + [~] 168.8 fps + 0xF000009C + + + [~] 169.9 fps + 0xF000009D + + + [~] 171.1 fps + 0xF000009E + + + [~] 172.3 fps + 0xF000009F + + + [~] 173.5 fps + 0xF00000A0 + + + [~] 174.6 fps + 0xF00000A1 + + + [~] 175.8 fps + 0xF00000A2 + + + [~] 177.0 fps + 0xF00000A3 + + + [~] 178.2 fps + 0xF00000A4 + + + [~] 179.4 fps + 0xF00000A5 + + + [~] 180.5 fps + 0xF00000A6 + + + [~] 181.7 fps + 0xF00000A7 + + + [~] 182.9 fps + 0xF00000A8 + + + [~] 184.1 fps + 0xF00000A9 + + + [~] 185.3 fps + 0xF00000AA + + + [~] 186.5 fps + 0xF00000AB + + + [~] 187.7 fps + 0xF00000AC + + + [~] 188.9 fps + 0xF00000AD + + + [~] 190.1 fps + 0xF00000AE + + + [~] 191.2 fps + 0xF00000AF + + + [~] 192.4 fps + 0xF00000B0 + + + [~] 193.6 fps + 0xF00000B1 + + + [~] 194.8 fps + 0xF00000B2 + + + [~] 196.0 fps + 0xF00000B3 + + + [~] 197.2 fps + 0xF00000B4 + + + [~] 198.4 fps + 0xF00000B5 + + + [~] 199.6 fps + 0xF00000B6 + + + [~] 200.8 fps + 0xF00000B7 + + + [~] 202.0 fps + 0xF00000B8 + + + [~] 203.3 fps + 0xF00000B9 + + + [~] 204.5 fps + 0xF00000BA + + + [~] 205.7 fps + 0xF00000BB + + + [~] 206.9 fps + 0xF00000BC + + + [~] 208.1 fps + 0xF00000BD + + + [~] 209.3 fps + 0xF00000BE + + + [~] 210.5 fps + 0xF00000BF + + + [~] 211.7 fps + 0xF00000C0 + + + [~] 213.0 fps + 0xF00000C1 + + + [~] 214.2 fps + 0xF00000C2 + + + [~] 215.4 fps + 0xF00000C3 + + + [~] 216.6 fps + 0xF00000C4 + + + [~] 217.8 fps + 0xF00000C5 + + + [~] 219.1 fps + 0xF00000C6 + + + [~] 220.3 fps + 0xF00000C7 + + + [~] 221.5 fps + 0xF00000C8 + + + [~] 222.7 fps + 0xF00000C9 + + + [~] 224.0 fps + 0xF00000CA + + + [~] 225.2 fps + 0xF00000CB + + + [~] 226.4 fps + 0xF00000CC + + + [~] 227.7 fps + 0xF00000CD + + + [~] 228.9 fps + 0xF00000CE + + + [~] 230.1 fps + 0xF00000CF + + + [~] 231.4 fps + 0xF00000D0 + + + [~] 232.6 fps + 0xF00000D1 + + + [~] 233.8 fps + 0xF00000D2 + + + [~] 235.1 fps + 0xF00000D3 + + + [~] 236.3 fps + 0xF00000D4 + + + [~] 237.6 fps + 0xF00000D5 + + + [~] 238.8 fps + 0xF00000D6 + + + [~] 240.0 fps + 0xF00000D7 + + + [~] 241.3 fps + 0xF00000D8 + + + [~] 242.5 fps + 0xF00000D9 + + + [~] 243.8 fps + 0xF00000DA + + + [~] 245.0 fps + 0xF00000DB + + + [~] 246.3 fps + 0xF00000DC + + + [~] 247.5 fps + 0xF00000DD + + + [~] 248.8 fps + 0xF00000DE + + + [~] 250.0 fps + 0xF00000DF + + + [~] 251.3 fps + 0xF00000E0 + + + [~] 252.6 fps + 0xF00000E1 + + + [~] 253.8 fps + 0xF00000E2 + + + [~] 255.1 fps + 0xF00000E3 + + + [~] 256.3 fps + 0xF00000E4 + + + [~] 257.6 fps + 0xF00000E5 + + + [~] 258.9 fps + 0xF00000E6 + + + [~] 260.1 fps + 0xF00000E7 + + + [~] 261.4 fps + 0xF00000E8 + + + [~] 262.7 fps + 0xF00000E9 + + + [~] 263.9 fps + 0xF00000EA + + + [~] 265.2 fps + 0xF00000EB + + + [~] 266.5 fps + 0xF00000EC + + + [~] 267.7 fps + 0xF00000ED + + + [~] 269.0 fps + 0xF00000EE + + + [~] 270.3 fps + 0xF00000EF + + + [~] 271.6 fps + 0xF00000F0 + + + [~] 272.8 fps + 0xF00000F1 + + + [~] 274.1 fps + 0xF00000F2 + + + [~] 275.4 fps + 0xF00000F3 + + + [~] 276.7 fps + 0xF00000F4 + + + [~] 278.0 fps + 0xF00000F5 + + + [~] 279.3 fps + 0xF00000F6 + + + [~] 280.5 fps + 0xF00000F7 + + + [~] 281.8 fps + 0xF00000F8 + + + [~] 283.1 fps + 0xF00000F9 + + + [~] 284.4 fps + 0xF00000FA + + + [~] 285.7 fps + 0xF00000FB + + + [~] 287.0 fps + 0xF00000FC + + + [~] 288.3 fps + 0xF00000FD + + + [~] 289.6 fps + 0xF00000FE + + + [~] 290.9 fps + 0xF00000FF + + + 60°C + 0xF200003C + + + 65°C + 0xF2000041 + + + 70°C + 0xF2000046 + + + 75°C + 0xF200004B + + + 80°C + 0xF2000050 + + + 85°C + 0xF2000055 + + + 90°C + 0xF200005A + + + + + + Toggle FXAA on or off + 0x1074C972 + 300.00 + + 3 - Antialiasing + + + Off + 0x00000000 + + + On + 0x00000001 + + + + + + Toggle FXAA Indicator on or off + 0x1068FB9C + 300.00 + + 3 - Antialiasing + + + Off + 0x00000000 + + + On + 0x00000001 + + + + + + NVIDIA Predefined FXAA Usage + 0x1034CB89 + 300.00 + + 3 - Antialiasing + + + Disallowed + 0x00000000 + + + Allowed + 0x00000001 + + + + + + Antialiasing - Line gamma + 0x2089BF6C + + 3 - Antialiasing + + + Disabled + 0x00000000 + + + Default + 0x00000010 + + + Enabled + 0x00000023 + + + + + + Texture filtering - LOD Bias (DX) + 0x00738E8F + + 4 - Texture Filtering + + + -3.0000 + 0xFFFFFFE8 + + + -2.8750 + 0xFFFFFFE9 + + + -2.7500 + 0xFFFFFFEA + + + -2.6250 + 0xFFFFFFEB + + + -2.5000 + 0xFFFFFFEC + + + -2.3750 + 0xFFFFFFED + + + -2.2500 + 0xFFFFFFEE + + + -2.1250 + 0xFFFFFFEF + + + -2.0000 + 0xFFFFFFF0 + + + -1.8750 + 0xFFFFFFF1 + + + -1.7500 + 0xFFFFFFF2 + + + -1.6250 + 0xFFFFFFF3 + + + -1.5000 + 0xFFFFFFF4 + + + -1.3750 + 0xFFFFFFF5 + + + -1.2500 + 0xFFFFFFF6 + + + -1.1250 + 0xFFFFFFF7 + + + -1.0000 + 0xFFFFFFF8 + + + -0.8750 + 0xFFFFFFF9 + + + -0.7500 + 0xFFFFFFFA + + + -0.6250 + 0xFFFFFFFB + + + -0.5000 + 0xFFFFFFFC + + + -0.3750 + 0xFFFFFFFD + + + -0.2500 + 0xFFFFFFFE + + + -0.1250 + 0xFFFFFFFF + + + +0.0000 + 0x00000000 + + + +0.1250 + 0x00000001 + + + +0.2500 + 0x00000002 + + + +0.3750 + 0x00000003 + + + +0.5000 + 0x00000004 + + + +0.6250 + 0x00000005 + + + +0.7500 + 0x00000006 + + + +0.8750 + 0x00000007 + + + +1.0000 + 0x00000008 + + + +1.1250 + 0x00000009 + + + +1.2500 + 0x0000000A + + + +1.3750 + 0x0000000B + + + +1.5000 + 0x0000000C + + + +1.6250 + 0x0000000D + + + +1.7500 + 0x0000000E + + + +1.8750 + 0x0000000F + + + +2.0000 + 0x00000010 + + + +2.1250 + 0x00000011 + + + +2.2500 + 0x00000012 + + + +2.3750 + 0x00000013 + + + +2.5000 + 0x00000014 + + + +2.6250 + 0x00000015 + + + +2.7500 + 0x00000016 + + + +2.8750 + 0x00000017 + + + +3.0000 + 0x00000018 + + + + + + Texture filtering - LOD Bias (OGL) + 0x20403F79 + + 4 - Texture Filtering + + + -3.0000 + 0xFFFFFFD0 + + + -2.9375 + 0xFFFFFFD1 + + + -2.8750 + 0xFFFFFFD2 + + + -2.8125 + 0xFFFFFFD3 + + + -2.7500 + 0xFFFFFFD4 + + + -2.6875 + 0xFFFFFFD5 + + + -2.6250 + 0xFFFFFFD6 + + + -2.5625 + 0xFFFFFFD7 + + + -2.5000 + 0xFFFFFFD8 + + + -2.4375 + 0xFFFFFFD9 + + + -2.3750 + 0xFFFFFFDA + + + -2.3125 + 0xFFFFFFDB + + + -2.2500 + 0xFFFFFFDC + + + -2.1875 + 0xFFFFFFDD + + + -21250 + 0xFFFFFFDE + + + -2.0625 + 0xFFFFFFDF + + + -2.0000 + 0xFFFFFFE0 + + + -1.9375 + 0xFFFFFFE1 + + + -1.8750 + 0xFFFFFFE2 + + + -1.8125 + 0xFFFFFFE3 + + + -1.7500 + 0xFFFFFFE4 + + + -1.6875 + 0xFFFFFFE5 + + + -1.6250 + 0xFFFFFFE6 + + + -1.5625 + 0xFFFFFFE7 + + + -1.5000 + 0xFFFFFFE8 + + + -1.4375 + 0xFFFFFFE9 + + + -1.3750 + 0xFFFFFFEA + + + -1.3125 + 0xFFFFFFEB + + + -1.2500 + 0xFFFFFFEC + + + -1.1875 + 0xFFFFFFED + + + -1.1250 + 0xFFFFFFEE + + + -1.0625 + 0xFFFFFFEF + + + -1.0000 + 0xFFFFFFF0 + + + -0.9375 + 0xFFFFFFF1 + + + -0.8750 + 0xFFFFFFF2 + + + -0.8125 + 0xFFFFFFF3 + + + -0.7500 + 0xFFFFFFF4 + + + -0.6875 + 0xFFFFFFF5 + + + -0.6250 + 0xFFFFFFF6 + + + -0.5625 + 0xFFFFFFF7 + + + -0.5000 + 0xFFFFFFF8 + + + -0.4375 + 0xFFFFFFF9 + + + -0.3750 + 0xFFFFFFFA + + + -0.3125 + 0xFFFFFFFB + + + -0.2500 + 0xFFFFFFFC + + + -0.1875 + 0xFFFFFFFD + + + -0.1250 + 0xFFFFFFFE + + + -0.0625 + 0xFFFFFFFF + + + +0.0000 + 0x00000000 + + + +0.0625 + 0x00000001 + + + +0.1250 + 0x00000002 + + + +0.1875 + 0x00000003 + + + +0.2500 + 0x00000004 + + + +0.3125 + 0x00000005 + + + +0.3750 + 0x00000006 + + + +0.4375 + 0x00000007 + + + +0.5000 + 0x00000008 + + + +0.5625 + 0x00000009 + + + +0.6250 + 0x0000000A + + + +0.6875 + 0x0000000B + + + +0.7500 + 0x0000000C + + + +0.8125 + 0x0000000D + + + +0.8750 + 0x0000000E + + + +0.9375 + 0x0000000F + + + +1.0000 + 0x00000010 + + + +1.0625 + 0x00000011 + + + +1.1250 + 0x00000012 + + + +1.1875 + 0x00000013 + + + +1.2500 + 0x00000014 + + + +1.3125 + 0x00000015 + + + +1.3750 + 0x00000016 + + + +1.4375 + 0x00000017 + + + +1.5000 + 0x00000018 + + + +1.5625 + 0x00000019 + + + +1.6250 + 0x0000001A + + + +1.6875 + 0x0000001B + + + +1.7500 + 0x0000001C + + + +1.8125 + 0x0000001D + + + +1.8750 + 0x0000001E + + + +1.9375 + 0x0000001F + + + +2.0000 + 0x00000020 + + + +2.0625 + 0x00000021 + + + +2.1250 + 0x00000022 + + + +2.1875 + 0x00000023 + + + +2.2500 + 0x00000024 + + + +2.3125 + 0x00000025 + + + +2.3750 + 0x00000026 + + + +2.4375 + 0x00000027 + + + +2.5000 + 0x00000028 + + + +2.5625 + 0x00000029 + + + +2.6250 + 0x0000002A + + + +2.6875 + 0x0000002B + + + +2.7500 + 0x0000002C + + + +2.8125 + 0x0000002D + + + +2.8750 + 0x0000002E + + + +2.9375 + 0x0000002F + + + +3.0000 + 0x00000030 + + + + + + SLI compatibility bits (DX12) + 0x00A04746 + + 1 - Compatibility + + + + SLI compatibility bits (DX10 + DX11) + 0x00A06946 + + 1 - Compatibility + + + + SLI Mode + 0x0000000F + + + Auto + 0x00000000 + + + Single + 0x00000004 + + + AFR + 0x00000001 + + + SFR + 0x00000002 + + + AFR-SFR + 0x00000003 + + + 3 Way SLI AFR + 0x00000006 + + + 4 Way SLI AFR + 0x00000005 + + + + + + + SLI compatibility bits + 0x1095DEF8 + + 1 - Compatibility + + + + SLI Mode + 0x00000007 + + + Auto + 0x00000000 + + + Single + 0x00000004 + + + AFR + 0x00000001 + + + SFR + 0x00000002 + + + AFR-SFR + 0x00000003 + + + 3 Way SLI AFR + 0x00000006 + + + 4 Way SLI AFR + 0x00000005 + + + + + AFR Mode + 0x02430000 + + + AFR 1 + 0x00000000 + + + AFR 2 + 0x02430000 + + + + + + + Antialiasing compatibility + 0x00D55F7D + + 1 - Compatibility + + + + + Antialiasing compatibility (DX1x) + 0x00E32F8A + + 1 - Compatibility + + + + + Ambient Occlusion compatibility + 0x002C7F45 + + 1 - Compatibility + + + + + Antialiasing - Gamma correction + 0x107D639D + 0x00000002 + + 3 - Antialiasing + + + Off + 0x00000000 + + + On + 0x00000002 + + + + + + Antialiasing - Behavior Flags + 0x10ECDB82 + + 3 - Antialiasing + + + None + 0x00000000 + + + Treat 'Override any application setting' as 'Application-controlled' + 0x00000001 + + + Treat 'Override any application setting' as 'Enhance the application setting' + 0x00000002 + + + Disable 'Override any application setting' + 0x00000003 + + + Treat 'Enhance the application setting' as 'Application-controlled' + 0x00000004 + + + Treat 'Enhance the application setting' as 'Override any application setting' + 0x00000008 + + + Disable 'Enhance the application setting' + 0x0000000C + + + Disable Antialiasing at NVIDIA Control Panel + 0x00040000 + + + + + + Antialiasing - Mode + 0x107EFC5B + + 3 - Antialiasing + + + Application-controlled + 0x00000000 + + + Override any application setting + 0x00000001 + + + Enhance the application setting + 0x00000002 + + + + + + Antialiasing - Setting + 0x10D773D2 + + 3 - Antialiasing + + + Application-controlled / Off + 0x00000000 + + + 2x [2x Multisampling] + 0x0000000E + + + 2xQ [2x Quincunx (blurred)] + 0x0000000F + + + 4x [4x Multisampling] + 0x00000010 + + + 8x [8x CSAA (4 color + 4 cv samples)] + 0x00000026 + + + 16x [16x CSAA (4 color + 12 cv samples)] + 0x00000027 + + + 8xQ [8x Multisampling] + 0x00000025 + + + 16xQ [16x CSAA (8 color + 8 cv samples)] + 0x00000028 + + + 32x [32x CSAA (8 color + 24 cv samples)] + 0x0000001D + + + 2x1 [2x1 Supersampling (D3D only)] + 0x00000001 + + + 1x2 [1x2 Supersampling (D3D only)] + 0x00000002 + + + 2x2 [2x2 Supersampling (D3D only)] + 0x00000005 + + + 3x3 [3x3 Supersampling (D3D only)] + 0x0000000A + + + 4x4 [4x4 Supersampling (D3D only)] + 0x0000000C + + + 4xS [Combined: 1x2 SS + 2x MS (D3D only)] + 0x00000013 + + + 8xS [Combined: 1x2 SS + 4x MS] + 0x00000018 + + + 8xSQ [Combined: 2x2 SS + 2x MS] + 0x00000019 + + + 12xS [Combined: 2x2 SS + 4x OGMS (D3D only)] + 0x00000017 + + + 16xS [Combined: 2x2 SS + 4x MS] + 0x0000001A + + + 32xS [Combined: 2x2 SS + 8x MS] + 0x00000029 + + + + + + Antialiasing - Transparency Multisampling + 0x10FC2D9C + + 3 - Antialiasing + + + Disabled + 0x00000000 + + + Enabled + 0x00000004 + + + + + + Antialiasing - Transparency Supersampling + 0x10D48A85 + + 3 - Antialiasing + + + Off / Multisampling + 0x00000000 + + + Supersampling + 0x00000023 + + + 2x Supersampling + 0x00000014 + + + 4x Supersampling + 0x00000024 + + + 8x Supersampling + 0x00000034 + + + 2x Sparse Grid Supersampling + 0x00000018 + + + 4x Sparse Grid Supersampling + 0x00000028 + + + 8x Sparse Grid Supersampling + 0x00000038 + + + + + + Anisotropic filtering mode + 0x10D2BB16 + + 4 - Texture Filtering + + + Application-controlled + 0x00000000 + + + User-defined / Off + 0x00000001 + + + + + + Anisotropic filtering setting + 0x101E61A9 + + 4 - Texture Filtering + + + Off [Point] + 0x00000000 + + + Off [Linear] + 0x00000001 + + + 2x + 0x00000002 + + + 4x + 0x00000004 + + + 6x + 0x00000004 + + + 8x + 0x00000008 + + + 12x + 0x0000000C + + + 16x + 0x00000010 + + + + + + Texture filtering - Anisotropic filter optimization + 0x0084CD70 + + 4 - Texture Filtering + + + Off + 0x00000000 + + + On + 0x00000001 + + + + + + Texture filtering - Anisotropic sample optimization + 0x00E73211 + + 4 - Texture Filtering + + + Off + 0x00000000 + + + On + 0x00000001 + + + + + + Texture filtering - Negative LOD bias + 0x0019BB68 + + 4 - Texture Filtering + + + Allow + 0x00000000 + + + Clamp + 0x00000001 + + + + + + Texture filtering - Quality + 0x00CE2691 + + 4 - Texture Filtering + + + Quality + 0x00000000 + + + Performance + 0x0000000A + + + High performance + 0x00000014 + + + High quality + 0xFFFFFFF6 + + + + + + Texture filtering - Trilinear optimization + 0x002ECAF2 + + 4 - Texture Filtering + + + On ( will be ignored if using high quality ) + 0x00000000 + + + Off + 0x00000001 + + + + + + Ambient Occlusion usage + 0x00664339 + + 5 - Common + + + Disabled + 0x00000000 + + + Enabled + 0x00000001 + + + + + + Ambient Occlusion setting + 0x00667329 + + 5 - Common + + + Off + 0x00000000 + + + Performance + 0x00000001 + + + Quality + 0x00000002 + + + High quality + 0x00000003 + + + + + + Maximum pre-rendered frames + 0x007BA09E + + 2 - Sync and Refresh + + + Use the 3D application setting + 0x00000000 + + + 1 + 0x00000001 + + + 2 + 0x00000002 + + + 3 + 0x00000003 + + + 4 + 0x00000004 + + + 5 + 0x00000005 + + + 6 + 0x00000006 + + + 7 + 0x00000007 + + + 8 + 0x00000008 + + + + + + Threaded optimization + 0x20C1221E + + 5 - Common + + + Auto + 0x00000000 + + + On + 0x00000001 + + + Off + 0x00000002 + + + + + + Triple buffering + 0x20FDD1F9 + + 2 - Sync and Refresh + + + Off + 0x00000000 + + + On + 0x00000001 + + + + + + Vertical Sync + 0x00A879CF + + 2 - Sync and Refresh + + + Force off + 0x08416747 + + + Force on + 0x47814940 + + + Use the 3D application setting + 0x60925292 + + + 1/2 Refresh Rate + 0x32610244 + + + 1/3 Refresh Rate + 0x71271021 + + + 1/4 Refresh Rate + 0x13245256 + + + + + + Vertical Sync Tear Control + 0x005A375C + 300.00 + + 2 - Sync and Refresh + + + Standard + 0x96861077 + + + Adaptive + 0x99941284 + + + + + + Show PhysX Visual Indicator + 0x1094F16F + + 5 - Common + + + On + 0x24545582 + + + Off + 0x34534064 + + + + + + Power management mode + 0x1057EB71 + + 5 - Common + + + Adaptive + 0x00000000 + + + Prefer maximum performance + 0x00000001 + + + + + + Extension limit + 0x20FF7493 + + 5 - Common + + + Off + 0x00000000 + + + On + 0x00000001 + + + + + + Multi-display/mixed-GPU acceleration + 0x200AEBFC + + 5 - Common + + + Single display performance mode + 0x00000000 + + + Compatibility performance mode + 0x00000001 + + + Multi display performance mode + 0x00000003 + + + + + + \ No newline at end of file diff --git a/nspector/Images/0_gear2.png b/nspector/Images/0_gear2.png new file mode 100644 index 0000000..70dd71e Binary files /dev/null and b/nspector/Images/0_gear2.png differ diff --git a/nspector/Images/1_gear2_2.png b/nspector/Images/1_gear2_2.png new file mode 100644 index 0000000..90af03c Binary files /dev/null and b/nspector/Images/1_gear2_2.png differ diff --git a/nspector/Images/4_gear_nv2.png b/nspector/Images/4_gear_nv2.png new file mode 100644 index 0000000..43ba6b2 Binary files /dev/null and b/nspector/Images/4_gear_nv2.png differ diff --git a/nspector/Images/6_gear_inherit.png b/nspector/Images/6_gear_inherit.png new file mode 100644 index 0000000..16a52e6 Binary files /dev/null and b/nspector/Images/6_gear_inherit.png differ diff --git a/nspector/Images/PortableDeviceStatus_3_16-011.png b/nspector/Images/PortableDeviceStatus_3_16-011.png new file mode 100644 index 0000000..bdbaf38 Binary files /dev/null and b/nspector/Images/PortableDeviceStatus_3_16-011.png differ diff --git a/nspector/Images/apply.png b/nspector/Images/apply.png new file mode 100644 index 0000000..5b4ba08 Binary files /dev/null and b/nspector/Images/apply.png differ diff --git a/nspector/Images/export1.png b/nspector/Images/export1.png new file mode 100644 index 0000000..fcd1f73 Binary files /dev/null and b/nspector/Images/export1.png differ diff --git a/nspector/Images/filter_user.png b/nspector/Images/filter_user.png new file mode 100644 index 0000000..2200532 Binary files /dev/null and b/nspector/Images/filter_user.png differ diff --git a/nspector/Images/find_set2.png b/nspector/Images/find_set2.png new file mode 100644 index 0000000..42221fd Binary files /dev/null and b/nspector/Images/find_set2.png differ diff --git a/nspector/Images/home_sm.png b/nspector/Images/home_sm.png new file mode 100644 index 0000000..9951eae Binary files /dev/null and b/nspector/Images/home_sm.png differ diff --git a/nspector/Images/ieframe_1_18212.png b/nspector/Images/ieframe_1_18212.png new file mode 100644 index 0000000..09f156c Binary files /dev/null and b/nspector/Images/ieframe_1_18212.png differ diff --git a/nspector/Images/ieframe_1_31073-002.png b/nspector/Images/ieframe_1_31073-002.png new file mode 100644 index 0000000..464bcf4 Binary files /dev/null and b/nspector/Images/ieframe_1_31073-002.png differ diff --git a/nspector/Images/import1.png b/nspector/Images/import1.png new file mode 100644 index 0000000..4f62d90 Binary files /dev/null and b/nspector/Images/import1.png differ diff --git a/nspector/Images/n1-016.png b/nspector/Images/n1-016.png new file mode 100644 index 0000000..d7f0910 Binary files /dev/null and b/nspector/Images/n1-016.png differ diff --git a/nspector/Images/nv_btn.png b/nspector/Images/nv_btn.png new file mode 100644 index 0000000..e44f2d4 Binary files /dev/null and b/nspector/Images/nv_btn.png differ diff --git a/nspector/Images/shield.png b/nspector/Images/shield.png new file mode 100644 index 0000000..15e3c0f Binary files /dev/null and b/nspector/Images/shield.png differ diff --git a/nspector/Images/shield16.ico b/nspector/Images/shield16.ico new file mode 100644 index 0000000..2d60996 Binary files /dev/null and b/nspector/Images/shield16.ico differ diff --git a/nspector/Images/text_binary.png b/nspector/Images/text_binary.png new file mode 100644 index 0000000..1722792 Binary files /dev/null and b/nspector/Images/text_binary.png differ diff --git a/nspector/Images/transparent16.png b/nspector/Images/transparent16.png new file mode 100644 index 0000000..3553e3f Binary files /dev/null and b/nspector/Images/transparent16.png differ diff --git a/nspector/Images/window_application_add.png b/nspector/Images/window_application_add.png new file mode 100644 index 0000000..86bfcec Binary files /dev/null and b/nspector/Images/window_application_add.png differ diff --git a/nspector/Images/window_application_delete.png b/nspector/Images/window_application_delete.png new file mode 100644 index 0000000..4a9b0ba Binary files /dev/null and b/nspector/Images/window_application_delete.png differ diff --git a/nspector/ListViewEx.cs b/nspector/ListViewEx.cs new file mode 100644 index 0000000..f98c3a4 --- /dev/null +++ b/nspector/ListViewEx.cs @@ -0,0 +1,275 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; + +namespace nspector +{ + internal delegate void DropFilesNativeHandler(string[] files); + + internal class ListViewEx : ListView + { + + public event DropFilesNativeHandler OnDropFilesNative; + + [DllImport("user32.dll")] + private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wPar, IntPtr lPar); + + private const int LVM_FIRST = 0x1000; + private const int LVM_GETCOLUMNORDERARRAY = (LVM_FIRST + 59); + + private const int WM_PAINT = 0x000F; + + private struct EmbeddedControl + { + internal Control Control; + internal int Column; + internal int Row; + internal DockStyle Dock; + internal ListViewItem Item; + } + + private ArrayList _embeddedControls = new ArrayList(); + + public ListViewEx() + { + this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); + this.SetStyle(ControlStyles.EnableNotifyMessage, true); + } + + protected override void OnNotifyMessage(Message m) + { + if (m.Msg != 0x14) + { + base.OnNotifyMessage(m); + } + } + + protected int[] GetColumnOrder() + { + IntPtr lPar = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)) * Columns.Count); + + IntPtr res = SendMessage(Handle, LVM_GETCOLUMNORDERARRAY, new IntPtr(Columns.Count), lPar); + if (res.ToInt32() == 0) + { + Marshal.FreeHGlobal(lPar); + return null; + } + + int [] order = new int[Columns.Count]; + Marshal.Copy(lPar, order, 0, Columns.Count); + + Marshal.FreeHGlobal(lPar); + + return order; + } + + protected Rectangle GetSubItemBounds(ListViewItem Item, int SubItem) + { + Rectangle subItemRect = Rectangle.Empty; + + if (Item == null) + throw new ArgumentNullException("Item"); + + int[] order = GetColumnOrder(); + if (order == null) // No Columns + return subItemRect; + + if (SubItem >= order.Length) + throw new IndexOutOfRangeException("SubItem "+SubItem+" out of range"); + + Rectangle lviBounds = Item.GetBounds(ItemBoundsPortion.Entire); + int subItemX = lviBounds.Left; + + ColumnHeader col; + int i; + for (i=0; i=Columns.Count || row>=Items.Count) + throw new ArgumentOutOfRangeException(); + + EmbeddedControl ec; + ec.Control = c; + ec.Column = col; + ec.Row = row; + ec.Dock = dock; + ec.Item = Items[row]; + + _embeddedControls.Add(ec); + + c.Click += new EventHandler(_embeddedControl_Click); + + this.Controls.Add(c); + } + + internal void RemoveEmbeddedControl(Control c) + { + if (c == null) + throw new ArgumentNullException(); + + for (int i=0; i<_embeddedControls.Count; i++) + { + EmbeddedControl ec = (EmbeddedControl)_embeddedControls[i]; + if (ec.Control == c) + { + c.Click -= new EventHandler(_embeddedControl_Click); + this.Controls.Remove(c); + _embeddedControls.RemoveAt(i); + return; + } + } + } + + internal Control GetEmbeddedControl(int col, int row) + { + foreach (EmbeddedControl ec in _embeddedControls) + if (ec.Row == row && ec.Column == col) + return ec.Control; + + return null; + } + + [DefaultValue(View.LargeIcon)] + internal new View View + { + get + { + return base.View; + } + set + { + foreach (EmbeddedControl ec in _embeddedControls) + ec.Control.Visible = (value == View.Details); + + base.View = value; + } + } + + [DllImport("shell32.dll", CharSet = CharSet.Auto)] + public static extern int DragQueryFile(IntPtr hDrop, uint iFile, [Out] StringBuilder lpszFile, int cch); + private const int WM_DROPFILES = 0x233; + + protected override void WndProc(ref Message m) + { + switch (m.Msg) + { + case WM_PAINT: + if (View != View.Details) + break; + + foreach (EmbeddedControl ec in _embeddedControls) + { + Rectangle rc = this.GetSubItemBounds(ec.Item, ec.Column); + + if ((this.HeaderStyle != ColumnHeaderStyle.None) && + (rc.Top 0) + { + var files = new List(); + + for (uint i = 0; i < dropped; i++) + { + var size = DragQueryFile(m.WParam, i, null, 0); + if (size > 0) + { + var sb = new StringBuilder(size + 1); + var result = DragQueryFile(m.WParam, i, sb, size + 1); + files.Add(sb.ToString()); + } + } + + OnDropFilesNative(files.ToArray()); + } + } + + base.WndProc(ref m); + break; + } + base.WndProc (ref m); + } + + private void _embeddedControl_Click(object sender, EventArgs e) + { + foreach (EmbeddedControl ec in _embeddedControls) + { + if (ec.Control == (Control)sender) + { + this.SelectedItems.Clear(); + ec.Item.Selected = true; + } + } + } + } +} diff --git a/nspector/Native/NVAPI/NvApiDriverSettings.cs b/nspector/Native/NVAPI/NvApiDriverSettings.cs new file mode 100644 index 0000000..023e8a8 --- /dev/null +++ b/nspector/Native/NVAPI/NvApiDriverSettings.cs @@ -0,0 +1,937 @@ +namespace nspector.Native.NvApi.DriverSettings +{ + public enum ESetting : uint { + OGL_AA_LINE_GAMMA_ID = 0x2089BF6C, + OGL_DEEP_COLOR_SCANOUT_ID = 0x2097C2F6, + OGL_DEFAULT_SWAP_INTERVAL_ID = 0x206A6582, + OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL_ID = 0x206C4581, + OGL_DEFAULT_SWAP_INTERVAL_SIGN_ID = 0x20655CFA, + OGL_EVENT_LOG_SEVERITY_THRESHOLD_ID = 0x209DF23E, + OGL_EXTENSION_STRING_VERSION_ID = 0x20FF7493, + OGL_FORCE_BLIT_ID = 0x201F619F, + OGL_FORCE_STEREO_ID = 0x204D9A0C, + OGL_IMPLICIT_GPU_AFFINITY_ID = 0x20D0F3E6, + OGL_MAX_FRAMES_ALLOWED_ID = 0x208E55E3, + OGL_MULTIMON_ID = 0x200AEBFC, + OGL_OVERLAY_PIXEL_TYPE_ID = 0x209AE66F, + OGL_OVERLAY_SUPPORT_ID = 0x206C28C4, + OGL_QUALITY_ENHANCEMENTS_ID = 0x20797D6C, + OGL_SINGLE_BACKDEPTH_BUFFER_ID = 0x20A29055, + OGL_THREAD_CONTROL_ID = 0x20C1221E, + OGL_TRIPLE_BUFFER_ID = 0x20FDD1F9, + OGL_VIDEO_EDITING_MODE_ID = 0x20EE02B4, + AA_BEHAVIOR_FLAGS_ID = 0x10ECDB82, + AA_MODE_ALPHATOCOVERAGE_ID = 0x10FC2D9C, + AA_MODE_GAMMACORRECTION_ID = 0x107D639D, + AA_MODE_METHOD_ID = 0x10D773D2, + AA_MODE_REPLAY_ID = 0x10D48A85, + AA_MODE_SELECTOR_ID = 0x107EFC5B, + AA_MODE_SELECTOR_SLIAA_ID = 0x107AFC5B, + ANISO_MODE_LEVEL_ID = 0x101E61A9, + ANISO_MODE_SELECTOR_ID = 0x10D2BB16, + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_ID = 0x104554B6, + APPLICATION_STEAM_ID_ID = 0x107CDDBC, + CPL_HIDDEN_PROFILE_ID = 0x106D5CFF, + CUDA_EXCLUDED_GPUS_ID = 0x10354FF8, + D3DOGL_GPU_MAX_POWER_ID = 0x10D1EF29, + EXPORT_PERF_COUNTERS_ID = 0x108F0841, + FXAA_ALLOW_ID = 0x1034CB89, + FXAA_ENABLE_ID = 0x1074C972, + FXAA_INDICATOR_ENABLE_ID = 0x1068FB9C, + MCSFRSHOWSPLIT_ID = 0x10287051, + NV_QUALITY_UPSCALING_ID = 0x10444444, + OPTIMUS_MAXAA_ID = 0x10F9DC83, + PHYSXINDICATOR_ID = 0x1094F16F, + PREFERRED_PSTATE_ID = 0x1057EB71, + PREVENT_UI_AF_OVERRIDE_ID = 0x103BCCB5, + PS_FRAMERATE_LIMITER_ID = 0x10834FEE, + PS_FRAMERATE_LIMITER_GPS_CTRL_ID = 0x10834F01, + PS_FRAMERATE_MONITOR_CTRL_ID = 0x10834F05, + SHIM_MAXRES_ID = 0x10F9DC82, + SHIM_MCCOMPAT_ID = 0x10F9DC80, + SHIM_RENDERING_MODE_ID = 0x10F9DC81, + SHIM_RENDERING_OPTIONS_ID = 0x10F9DC84, + SLI_GPU_COUNT_ID = 0x1033DCD1, + SLI_PREDEFINED_GPU_COUNT_ID = 0x1033DCD2, + SLI_PREDEFINED_GPU_COUNT_DX10_ID = 0x1033DCD3, + SLI_PREDEFINED_MODE_ID = 0x1033CEC1, + SLI_PREDEFINED_MODE_DX10_ID = 0x1033CEC2, + SLI_RENDERING_MODE_ID = 0x1033CED1, + VRPRERENDERLIMIT_ID = 0x10111133, + VRRFEATUREINDICATOR_ID = 0x1094F157, + VRROVERLAYINDICATOR_ID = 0x1095F16F, + VRRREQUESTSTATE_ID = 0x1094F1F7, + VRR_APP_OVERRIDE_ID = 0x10A879CF, + VRR_APP_OVERRIDE_REQUEST_STATE_ID = 0x10A879AC, + VRR_MODE_ID = 0x1194F158, + VSYNCSMOOTHAFR_ID = 0x101AE763, + VSYNCVRRCONTROL_ID = 0x10A879CE, + VSYNC_BEHAVIOR_FLAGS_ID = 0x10FDEC23, + WKS_API_STEREO_EYES_EXCHANGE_ID = 0x11AE435C, + WKS_API_STEREO_MODE_ID = 0x11E91A61, + WKS_MEMORY_ALLOCATION_POLICY_ID = 0x11112233, + WKS_STEREO_DONGLE_SUPPORT_ID = 0x112493BD, + WKS_STEREO_SUPPORT_ID = 0x11AA9E99, + WKS_STEREO_SWAP_MODE_ID = 0x11333333, + AO_MODE_ID = 0x00667329, + AO_MODE_ACTIVE_ID = 0x00664339, + AUTO_LODBIASADJUST_ID = 0x00638E8F, + ICAFE_LOGO_CONFIG_ID = 0x00DB1337, + LODBIASADJUST_ID = 0x00738E8F, + MAXWELL_B_SAMPLE_INTERLEAVE_ID = 0x0098C1AC, + PRERENDERLIMIT_ID = 0x007BA09E, + PS_SHADERDISKCACHE_ID = 0x00198FFF, + PS_TEXFILTER_ANISO_OPTS2_ID = 0x00E73211, + PS_TEXFILTER_BILINEAR_IN_ANISO_ID = 0x0084CD70, + PS_TEXFILTER_DISABLE_TRILIN_SLOPE_ID = 0x002ECAF2, + PS_TEXFILTER_NO_NEG_LODBIAS_ID = 0x0019BB68, + QUALITY_ENHANCEMENTS_ID = 0x00CE2691, + REFRESH_RATE_OVERRIDE_ID = 0x0064B541, + SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_ID = 0x00AE785C, + SET_VAB_DATA_ID = 0x00AB8687, + VSYNCMODE_ID = 0x00A879CF, + VSYNCTEARCONTROL_ID = 0x005A375C, + TOTAL_DWORD_SETTING_NUM = 86, + TOTAL_WSTRING_SETTING_NUM = 4, + TOTAL_SETTING_NUM = 90, + INVALID_SETTING_ID = 0xFFFFFFFF + } + + public enum EValues_OGL_AA_LINE_GAMMA : uint { + OGL_AA_LINE_GAMMA_DISABLED = 0x10, + OGL_AA_LINE_GAMMA_ENABLED = 0x23, + OGL_AA_LINE_GAMMA_MIN = 1, + OGL_AA_LINE_GAMMA_MAX = 100, + OGL_AA_LINE_GAMMA_NUM_VALUES = 4, + OGL_AA_LINE_GAMMA_DEFAULT = OGL_AA_LINE_GAMMA_DISABLED + } + + public enum EValues_OGL_DEEP_COLOR_SCANOUT : uint { + OGL_DEEP_COLOR_SCANOUT_DISABLE = 0, + OGL_DEEP_COLOR_SCANOUT_ENABLE = 1, + OGL_DEEP_COLOR_SCANOUT_NUM_VALUES = 2, + OGL_DEEP_COLOR_SCANOUT_DEFAULT = OGL_DEEP_COLOR_SCANOUT_ENABLE + } + + public enum EValues_OGL_DEFAULT_SWAP_INTERVAL : uint { + OGL_DEFAULT_SWAP_INTERVAL_TEAR = 0, + OGL_DEFAULT_SWAP_INTERVAL_VSYNC_ONE = 1, + OGL_DEFAULT_SWAP_INTERVAL_VSYNC = 1, + OGL_DEFAULT_SWAP_INTERVAL_VALUE_MASK = 0x0000FFFF, + OGL_DEFAULT_SWAP_INTERVAL_FORCE_MASK = 0xF0000000, + OGL_DEFAULT_SWAP_INTERVAL_FORCE_OFF = 0xF0000000, + OGL_DEFAULT_SWAP_INTERVAL_FORCE_ON = 0x10000000, + OGL_DEFAULT_SWAP_INTERVAL_APP_CONTROLLED = 0x00000000, + OGL_DEFAULT_SWAP_INTERVAL_DISABLE = 0xffffffff, + OGL_DEFAULT_SWAP_INTERVAL_NUM_VALUES = 9, + OGL_DEFAULT_SWAP_INTERVAL_DEFAULT = OGL_DEFAULT_SWAP_INTERVAL_VSYNC_ONE + } + + public enum EValues_OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL : uint { + OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL_ZERO_SCANLINES = 0, + OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL_ONE_FULL_FRAME_OF_SCANLINES = 100, + OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL_NUM_VALUES = 2, + OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL_DEFAULT = 0 + } + + public enum EValues_OGL_DEFAULT_SWAP_INTERVAL_SIGN : uint { + OGL_DEFAULT_SWAP_INTERVAL_SIGN_POSITIVE = 0, + OGL_DEFAULT_SWAP_INTERVAL_SIGN_NEGATIVE = 1, + OGL_DEFAULT_SWAP_INTERVAL_SIGN_NUM_VALUES = 2, + OGL_DEFAULT_SWAP_INTERVAL_SIGN_DEFAULT = OGL_DEFAULT_SWAP_INTERVAL_SIGN_POSITIVE + } + + public enum EValues_OGL_EVENT_LOG_SEVERITY_THRESHOLD : uint { + OGL_EVENT_LOG_SEVERITY_THRESHOLD_DISABLE = 0, + OGL_EVENT_LOG_SEVERITY_THRESHOLD_CRITICAL = 1, + OGL_EVENT_LOG_SEVERITY_THRESHOLD_WARNING = 2, + OGL_EVENT_LOG_SEVERITY_THRESHOLD_INFORMATION = 3, + OGL_EVENT_LOG_SEVERITY_THRESHOLD_ALL = 4, + OGL_EVENT_LOG_SEVERITY_THRESHOLD_NUM_VALUES = 5, + OGL_EVENT_LOG_SEVERITY_THRESHOLD_DEFAULT = OGL_EVENT_LOG_SEVERITY_THRESHOLD_CRITICAL + } + + public enum EValues_OGL_FORCE_BLIT : uint { + OGL_FORCE_BLIT_ON = 1, + OGL_FORCE_BLIT_OFF = 0, + OGL_FORCE_BLIT_NUM_VALUES = 2, + OGL_FORCE_BLIT_DEFAULT = OGL_FORCE_BLIT_OFF + } + + public enum EValues_OGL_FORCE_STEREO : uint { + OGL_FORCE_STEREO_OFF = 0, + OGL_FORCE_STEREO_ON = 1, + OGL_FORCE_STEREO_NUM_VALUES = 2, + OGL_FORCE_STEREO_DEFAULT = OGL_FORCE_STEREO_OFF + } + + public enum EValues_OGL_MULTIMON : uint { + OGL_MULTIMON_SINGLE_MONITOR = 0, + OGL_MULTIMON_COMPATIBILITY_LCD = 1, + OGL_MULTIMON_COMPATIBILITY_GCD = 2, + OGL_MULTIMON_PERFORMANCE_LCD = 3, + OGL_MULTIMON_PERFORMANCE_GCD = 4, + OGL_MULTIMON_EXTENDED_SINGLE_MONITOR = 5, + OGL_MULTIMON_PERFORMANCE_QUADRO = 6, + OGL_MULTIMON_MULTIMON_BUFFER = 7, + OGL_MULTIMON_NUM_VALUES = 8, + OGL_MULTIMON_DEFAULT = OGL_MULTIMON_PERFORMANCE_LCD + } + + public enum EValues_OGL_OVERLAY_PIXEL_TYPE : uint { + OGL_OVERLAY_PIXEL_TYPE_NONE = 0x0, + OGL_OVERLAY_PIXEL_TYPE_CI = 0x1, + OGL_OVERLAY_PIXEL_TYPE_RGBA = 0x2, + OGL_OVERLAY_PIXEL_TYPE_CI_AND_RGBA = 0x3, + OGL_OVERLAY_PIXEL_TYPE_NUM_VALUES = 4, + OGL_OVERLAY_PIXEL_TYPE_DEFAULT = OGL_OVERLAY_PIXEL_TYPE_CI + } + + public enum EValues_OGL_OVERLAY_SUPPORT : uint { + OGL_OVERLAY_SUPPORT_OFF = 0, + OGL_OVERLAY_SUPPORT_ON = 1, + OGL_OVERLAY_SUPPORT_FORCE_SW = 2, + OGL_OVERLAY_SUPPORT_NUM_VALUES = 3, + OGL_OVERLAY_SUPPORT_DEFAULT = OGL_OVERLAY_SUPPORT_OFF + } + + public enum EValues_OGL_QUALITY_ENHANCEMENTS : int { + OGL_QUALITY_ENHANCEMENTS_HQUAL = -10, + OGL_QUALITY_ENHANCEMENTS_QUAL = 0, + OGL_QUALITY_ENHANCEMENTS_PERF = 10, + OGL_QUALITY_ENHANCEMENTS_HPERF = 20, + OGL_QUALITY_ENHANCEMENTS_NUM_VALUES = 4, + OGL_QUALITY_ENHANCEMENTS_DEFAULT = OGL_QUALITY_ENHANCEMENTS_QUAL + } + + public enum EValues_OGL_SINGLE_BACKDEPTH_BUFFER : uint { + OGL_SINGLE_BACKDEPTH_BUFFER_DISABLE = 0x0, + OGL_SINGLE_BACKDEPTH_BUFFER_ENABLE = 0x1, + OGL_SINGLE_BACKDEPTH_BUFFER_USE_HW_DEFAULT = 0xffffffff, + OGL_SINGLE_BACKDEPTH_BUFFER_NUM_VALUES = 3, + OGL_SINGLE_BACKDEPTH_BUFFER_DEFAULT = OGL_SINGLE_BACKDEPTH_BUFFER_DISABLE + } + + public enum EValues_OGL_THREAD_CONTROL : uint { + OGL_THREAD_CONTROL_ENABLE = 0x00000001, + OGL_THREAD_CONTROL_DISABLE = 0x00000002, + OGL_THREAD_CONTROL_NUM_VALUES = 2, + OGL_THREAD_CONTROL_DEFAULT = 0 + } + + public enum EValues_OGL_TRIPLE_BUFFER : uint { + OGL_TRIPLE_BUFFER_DISABLED = 0x00000000, + OGL_TRIPLE_BUFFER_ENABLED = 0x00000001, + OGL_TRIPLE_BUFFER_NUM_VALUES = 2, + OGL_TRIPLE_BUFFER_DEFAULT = OGL_TRIPLE_BUFFER_DISABLED + } + + public enum EValues_OGL_VIDEO_EDITING_MODE : uint { + OGL_VIDEO_EDITING_MODE_DISABLE = 0x00000000, + OGL_VIDEO_EDITING_MODE_ENABLE = 0x00000001, + OGL_VIDEO_EDITING_MODE_NUM_VALUES = 2, + OGL_VIDEO_EDITING_MODE_DEFAULT = OGL_VIDEO_EDITING_MODE_DISABLE + } + + public enum EValues_AA_BEHAVIOR_FLAGS : uint { + AA_BEHAVIOR_FLAGS_NONE = 0x00000000, + AA_BEHAVIOR_FLAGS_TREAT_OVERRIDE_AS_APP_CONTROLLED = 0x00000001, + AA_BEHAVIOR_FLAGS_TREAT_OVERRIDE_AS_ENHANCE = 0x00000002, + AA_BEHAVIOR_FLAGS_DISABLE_OVERRIDE = 0x00000003, + AA_BEHAVIOR_FLAGS_TREAT_ENHANCE_AS_APP_CONTROLLED = 0x00000004, + AA_BEHAVIOR_FLAGS_TREAT_ENHANCE_AS_OVERRIDE = 0x00000008, + AA_BEHAVIOR_FLAGS_DISABLE_ENHANCE = 0x0000000c, + AA_BEHAVIOR_FLAGS_MAP_VCAA_TO_MULTISAMPLING = 0x00010000, + AA_BEHAVIOR_FLAGS_SLI_DISABLE_TRANSPARENCY_SUPERSAMPLING = 0x00020000, + AA_BEHAVIOR_FLAGS_DISABLE_CPLAA = 0x00040000, + AA_BEHAVIOR_FLAGS_SKIP_RT_DIM_CHECK_FOR_ENHANCE = 0x00080000, + AA_BEHAVIOR_FLAGS_DISABLE_SLIAA = 0x00100000, + AA_BEHAVIOR_FLAGS_DEFAULT = 0x00000000, + AA_BEHAVIOR_FLAGS_AA_RT_BPP_DIV_4 = 0xf0000000, + AA_BEHAVIOR_FLAGS_AA_RT_BPP_DIV_4_SHIFT = 28, + AA_BEHAVIOR_FLAGS_NON_AA_RT_BPP_DIV_4 = 0x0f000000, + AA_BEHAVIOR_FLAGS_NON_AA_RT_BPP_DIV_4_SHIFT = 24, + AA_BEHAVIOR_FLAGS_MASK = 0xff1f000f, + AA_BEHAVIOR_FLAGS_NUM_VALUES = 18, + } + + public enum EValues_AA_MODE_ALPHATOCOVERAGE : uint { + AA_MODE_ALPHATOCOVERAGE_MODE_MASK = 0x00000004, + AA_MODE_ALPHATOCOVERAGE_MODE_OFF = 0x00000000, + AA_MODE_ALPHATOCOVERAGE_MODE_ON = 0x00000004, + AA_MODE_ALPHATOCOVERAGE_MODE_MAX = 0x00000004, + AA_MODE_ALPHATOCOVERAGE_NUM_VALUES = 4, + AA_MODE_ALPHATOCOVERAGE_DEFAULT = 0x00000000 + } + + public enum EValues_AA_MODE_GAMMACORRECTION : uint { + AA_MODE_GAMMACORRECTION_MASK = 0x00000003, + AA_MODE_GAMMACORRECTION_OFF = 0x00000000, + AA_MODE_GAMMACORRECTION_ON_IF_FOS = 0x00000001, + AA_MODE_GAMMACORRECTION_ON_ALWAYS = 0x00000002, + AA_MODE_GAMMACORRECTION_MAX = 0x00000002, + AA_MODE_GAMMACORRECTION_DEFAULT = 0x00000000, + AA_MODE_GAMMACORRECTION_DEFAULT_TESLA = 0x00000002, + AA_MODE_GAMMACORRECTION_DEFAULT_FERMI = 0x00000002, + AA_MODE_GAMMACORRECTION_NUM_VALUES = 8, + } + + public enum EValues_AA_MODE_METHOD : uint { + AA_MODE_METHOD_NONE = 0x0, + AA_MODE_METHOD_SUPERSAMPLE_2X_H = 0x1, + AA_MODE_METHOD_SUPERSAMPLE_2X_V = 0x2, + AA_MODE_METHOD_SUPERSAMPLE_1_5X1_5 = 0x2, + AA_MODE_METHOD_FREE_0x03 = 0x3, + AA_MODE_METHOD_FREE_0x04 = 0x4, + AA_MODE_METHOD_SUPERSAMPLE_4X = 0x5, + AA_MODE_METHOD_SUPERSAMPLE_4X_BIAS = 0x6, + AA_MODE_METHOD_SUPERSAMPLE_4X_GAUSSIAN = 0x7, + AA_MODE_METHOD_FREE_0x08 = 0x8, + AA_MODE_METHOD_FREE_0x09 = 0x9, + AA_MODE_METHOD_SUPERSAMPLE_9X = 0xA, + AA_MODE_METHOD_SUPERSAMPLE_9X_BIAS = 0xB, + AA_MODE_METHOD_SUPERSAMPLE_16X = 0xC, + AA_MODE_METHOD_SUPERSAMPLE_16X_BIAS = 0xD, + AA_MODE_METHOD_MULTISAMPLE_2X_DIAGONAL = 0xE, + AA_MODE_METHOD_MULTISAMPLE_2X_QUINCUNX = 0xF, + AA_MODE_METHOD_MULTISAMPLE_4X = 0x10, + AA_MODE_METHOD_FREE_0x11 = 0x11, + AA_MODE_METHOD_MULTISAMPLE_4X_GAUSSIAN = 0x12, + AA_MODE_METHOD_MIXEDSAMPLE_4X_SKEWED_4TAP = 0x13, + AA_MODE_METHOD_FREE_0x14 = 0x14, + AA_MODE_METHOD_FREE_0x15 = 0x15, + AA_MODE_METHOD_MIXEDSAMPLE_6X = 0x16, + AA_MODE_METHOD_MIXEDSAMPLE_6X_SKEWED_6TAP = 0x17, + AA_MODE_METHOD_MIXEDSAMPLE_8X = 0x18, + AA_MODE_METHOD_MIXEDSAMPLE_8X_SKEWED_8TAP = 0x19, + AA_MODE_METHOD_MIXEDSAMPLE_16X = 0x1a, + AA_MODE_METHOD_MULTISAMPLE_4X_GAMMA = 0x1b, + AA_MODE_METHOD_MULTISAMPLE_16X = 0x1c, + AA_MODE_METHOD_VCAA_32X_8v24 = 0x1d, + AA_MODE_METHOD_CORRUPTION_CHECK = 0x1e, + AA_MODE_METHOD_6X_CT = 0x1f, + AA_MODE_METHOD_MULTISAMPLE_2X_DIAGONAL_GAMMA = 0x20, + AA_MODE_METHOD_SUPERSAMPLE_4X_GAMMA = 0x21, + AA_MODE_METHOD_MULTISAMPLE_4X_FOSGAMMA = 0x22, + AA_MODE_METHOD_MULTISAMPLE_2X_DIAGONAL_FOSGAMMA = 0x23, + AA_MODE_METHOD_SUPERSAMPLE_4X_FOSGAMMA = 0x24, + AA_MODE_METHOD_MULTISAMPLE_8X = 0x25, + AA_MODE_METHOD_VCAA_8X_4v4 = 0x26, + AA_MODE_METHOD_VCAA_16X_4v12 = 0x27, + AA_MODE_METHOD_VCAA_16X_8v8 = 0x28, + AA_MODE_METHOD_MIXEDSAMPLE_32X = 0x29, + AA_MODE_METHOD_SUPERVCAA_64X_4v12 = 0x2a, + AA_MODE_METHOD_SUPERVCAA_64X_8v8 = 0x2b, + AA_MODE_METHOD_MIXEDSAMPLE_64X = 0x2c, + AA_MODE_METHOD_MIXEDSAMPLE_128X = 0x2d, + AA_MODE_METHOD_COUNT = 0x2e, + AA_MODE_METHOD_METHOD_MASK = 0x0000ffff, + AA_MODE_METHOD_METHOD_MAX = 0xf1c57815, + AA_MODE_METHOD_NUM_VALUES = 50, + AA_MODE_METHOD_DEFAULT = AA_MODE_METHOD_NONE + } + + public enum EValues_AA_MODE_REPLAY : uint { + AA_MODE_REPLAY_SAMPLES_MASK = 0x00000070, + AA_MODE_REPLAY_SAMPLES_ONE = 0x00000000, + AA_MODE_REPLAY_SAMPLES_TWO = 0x00000010, + AA_MODE_REPLAY_SAMPLES_FOUR = 0x00000020, + AA_MODE_REPLAY_SAMPLES_EIGHT = 0x00000030, + AA_MODE_REPLAY_SAMPLES_MAX = 0x00000030, + AA_MODE_REPLAY_MODE_MASK = 0x0000000f, + AA_MODE_REPLAY_MODE_OFF = 0x00000000, + AA_MODE_REPLAY_MODE_ALPHA_TEST = 0x00000001, + AA_MODE_REPLAY_MODE_PIXEL_KILL = 0x00000002, + AA_MODE_REPLAY_MODE_DYN_BRANCH = 0x00000004, + AA_MODE_REPLAY_MODE_OPTIMAL = 0x00000004, + AA_MODE_REPLAY_MODE_ALL = 0x00000008, + AA_MODE_REPLAY_MODE_MAX = 0x0000000f, + AA_MODE_REPLAY_TRANSPARENCY = 0x00000023, + AA_MODE_REPLAY_DISALLOW_TRAA = 0x00000100, + AA_MODE_REPLAY_TRANSPARENCY_DEFAULT = 0x00000000, + AA_MODE_REPLAY_TRANSPARENCY_DEFAULT_TESLA = 0x00000000, + AA_MODE_REPLAY_TRANSPARENCY_DEFAULT_FERMI = 0x00000000, + AA_MODE_REPLAY_MASK = 0x0000017f, + AA_MODE_REPLAY_NUM_VALUES = 20, + AA_MODE_REPLAY_DEFAULT = 0x00000000 + } + + public enum EValues_AA_MODE_SELECTOR : uint { + AA_MODE_SELECTOR_MASK = 0x00000003, + AA_MODE_SELECTOR_APP_CONTROL = 0x00000000, + AA_MODE_SELECTOR_OVERRIDE = 0x00000001, + AA_MODE_SELECTOR_ENHANCE = 0x00000002, + AA_MODE_SELECTOR_MAX = 0x00000002, + AA_MODE_SELECTOR_NUM_VALUES = 5, + AA_MODE_SELECTOR_DEFAULT = AA_MODE_SELECTOR_APP_CONTROL + } + + public enum EValues_AA_MODE_SELECTOR_SLIAA : uint { + AA_MODE_SELECTOR_SLIAA_DISABLED = 0, + AA_MODE_SELECTOR_SLIAA_ENABLED = 1, + AA_MODE_SELECTOR_SLIAA_NUM_VALUES = 2, + AA_MODE_SELECTOR_SLIAA_DEFAULT = AA_MODE_SELECTOR_SLIAA_DISABLED + } + + public enum EValues_ANISO_MODE_LEVEL : uint { + ANISO_MODE_LEVEL_MASK = 0x0000ffff, + ANISO_MODE_LEVEL_NONE_POINT = 0x00000000, + ANISO_MODE_LEVEL_NONE_LINEAR = 0x00000001, + ANISO_MODE_LEVEL_MAX = 0x00000010, + ANISO_MODE_LEVEL_DEFAULT = 0x00000001, + ANISO_MODE_LEVEL_NUM_VALUES = 5, + } + + public enum EValues_ANISO_MODE_SELECTOR : uint { + ANISO_MODE_SELECTOR_MASK = 0x0000000f, + ANISO_MODE_SELECTOR_APP = 0x00000000, + ANISO_MODE_SELECTOR_USER = 0x00000001, + ANISO_MODE_SELECTOR_COND = 0x00000002, + ANISO_MODE_SELECTOR_MAX = 0x00000002, + ANISO_MODE_SELECTOR_DEFAULT = 0x00000000, + ANISO_MODE_SELECTOR_NUM_VALUES = 6, + } + + public enum EValues_APPLICATION_PROFILE_NOTIFICATION_TIMEOUT : uint { + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_DISABLED = 0, + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_NINE_SECONDS = 9, + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_FIFTEEN_SECONDS = 15, + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_THIRTY_SECONDS = 30, + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_ONE_MINUTE = 60, + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_TWO_MINUTES = 120, + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_NUM_VALUES = 6, + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_DEFAULT = APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_DISABLED + } + + public enum EValues_CPL_HIDDEN_PROFILE : uint { + CPL_HIDDEN_PROFILE_DISABLED = 0, + CPL_HIDDEN_PROFILE_ENABLED = 1, + CPL_HIDDEN_PROFILE_NUM_VALUES = 2, + CPL_HIDDEN_PROFILE_DEFAULT = CPL_HIDDEN_PROFILE_DISABLED + } + + public enum EValues_EXPORT_PERF_COUNTERS : uint { + EXPORT_PERF_COUNTERS_OFF = 0x00000000, + EXPORT_PERF_COUNTERS_ON = 0x00000001, + EXPORT_PERF_COUNTERS_NUM_VALUES = 2, + EXPORT_PERF_COUNTERS_DEFAULT = EXPORT_PERF_COUNTERS_OFF + } + + public enum EValues_FXAA_ALLOW : uint { + FXAA_ALLOW_DISALLOWED = 0, + FXAA_ALLOW_ALLOWED = 1, + FXAA_ALLOW_NUM_VALUES = 2, + FXAA_ALLOW_DEFAULT = FXAA_ALLOW_ALLOWED + } + + public enum EValues_FXAA_ENABLE : uint { + FXAA_ENABLE_OFF = 0, + FXAA_ENABLE_ON = 1, + FXAA_ENABLE_NUM_VALUES = 2, + FXAA_ENABLE_DEFAULT = FXAA_ENABLE_OFF + } + + public enum EValues_FXAA_INDICATOR_ENABLE : uint { + FXAA_INDICATOR_ENABLE_OFF = 0, + FXAA_INDICATOR_ENABLE_ON = 1, + FXAA_INDICATOR_ENABLE_NUM_VALUES = 2, + FXAA_INDICATOR_ENABLE_DEFAULT = FXAA_INDICATOR_ENABLE_OFF + } + + public enum EValues_MCSFRSHOWSPLIT : uint { + MCSFRSHOWSPLIT_DISABLED = 0x34534064, + MCSFRSHOWSPLIT_ENABLED = 0x24545582, + MCSFRSHOWSPLIT_NUM_VALUES = 2, + MCSFRSHOWSPLIT_DEFAULT = MCSFRSHOWSPLIT_DISABLED + } + + public enum EValues_NV_QUALITY_UPSCALING : uint { + NV_QUALITY_UPSCALING_OFF = 0, + NV_QUALITY_UPSCALING_ON = 1, + NV_QUALITY_UPSCALING_NUM_VALUES = 2, + NV_QUALITY_UPSCALING_DEFAULT = NV_QUALITY_UPSCALING_OFF + } + + public enum EValues_OPTIMUS_MAXAA : uint { + OPTIMUS_MAXAA_MIN = 0, + OPTIMUS_MAXAA_MAX = 16, + OPTIMUS_MAXAA_NUM_VALUES = 2, + OPTIMUS_MAXAA_DEFAULT = 0 + } + + public enum EValues_PHYSXINDICATOR : uint { + PHYSXINDICATOR_DISABLED = 0x34534064, + PHYSXINDICATOR_ENABLED = 0x24545582, + PHYSXINDICATOR_NUM_VALUES = 2, + PHYSXINDICATOR_DEFAULT = PHYSXINDICATOR_DISABLED + } + + public enum EValues_PREFERRED_PSTATE : uint { + PREFERRED_PSTATE_ADAPTIVE = 0x00000000, + PREFERRED_PSTATE_PREFER_MAX = 0x00000001, + PREFERRED_PSTATE_DRIVER_CONTROLLED = 0x00000002, + PREFERRED_PSTATE_PREFER_CONSISTENT_PERFORMANCE = 0x00000003, + PREFERRED_PSTATE_PREFER_MIN = 0x00000004, + PREFERRED_PSTATE_MIN = 0x00000000, + PREFERRED_PSTATE_MAX = 0x00000004, + PREFERRED_PSTATE_NUM_VALUES = 7, + PREFERRED_PSTATE_DEFAULT = PREFERRED_PSTATE_ADAPTIVE + } + + public enum EValues_PREVENT_UI_AF_OVERRIDE : uint { + PREVENT_UI_AF_OVERRIDE_OFF = 0, + PREVENT_UI_AF_OVERRIDE_ON = 1, + PREVENT_UI_AF_OVERRIDE_NUM_VALUES = 2, + PREVENT_UI_AF_OVERRIDE_DEFAULT = PREVENT_UI_AF_OVERRIDE_OFF + } + + public enum EValues_PS_FRAMERATE_LIMITER : uint { + PS_FRAMERATE_LIMITER_DISABLED = 0x00000000, + PS_FRAMERATE_LIMITER_FPS_20 = 0x00000014, + PS_FRAMERATE_LIMITER_FPS_30 = 0x0000001e, + PS_FRAMERATE_LIMITER_FPS_40 = 0x00000028, + PS_FRAMERATE_LIMITER_FPSMASK = 0x000000ff, + PS_FRAMERATE_LIMITER_FORCE_VSYNC_OFF = 0x00040000, + PS_FRAMERATE_LIMITER_GPS_WEB = 0x00080000, + PS_FRAMERATE_LIMITER_FORCE_OPTIMUS_POLICY = 0x00100000, + PS_FRAMERATE_LIMITER_DISALLOWED = 0x00200000, + PS_FRAMERATE_LIMITER_USE_CPU_WAIT = 0x00400000, + PS_FRAMERATE_LIMITER_THRESHOLD = 0x00000000, + PS_FRAMERATE_LIMITER_TEMPERATURE = 0x02000000, + PS_FRAMERATE_LIMITER_POWER = 0x04000000, + PS_FRAMERATE_LIMITER_MODEMASK = 0x0f000000, + PS_FRAMERATE_LIMITER_ACCURATE = 0x10000000, + PS_FRAMERATE_LIMITER_ALLOW_WINDOWED = 0x20000000, + PS_FRAMERATE_LIMITER_FORCEON = 0x40000000, + PS_FRAMERATE_LIMITER_ENABLED = 0x80000000, + PS_FRAMERATE_LIMITER_OPENGL_REMOTE_DESKTOP = 0xe010003c, + PS_FRAMERATE_LIMITER_MASK = 0xff7C00ff, + PS_FRAMERATE_LIMITER_NUM_VALUES = 20, + PS_FRAMERATE_LIMITER_DEFAULT = PS_FRAMERATE_LIMITER_DISABLED + } + + public enum EValues_PS_FRAMERATE_LIMITER_GPS_CTRL : uint { + PS_FRAMERATE_LIMITER_GPS_CTRL_DISABLED = 0x00000000, + PS_FRAMERATE_LIMITER_GPS_CTRL_DECREASE_FILTER_MASK = 0x000001FF, + PS_FRAMERATE_LIMITER_GPS_CTRL_PAUSE_TIME_MASK = 0x0000FE00, + PS_FRAMERATE_LIMITER_GPS_CTRL_PAUSE_TIME_SHIFT = 9, + PS_FRAMERATE_LIMITER_GPS_CTRL_TARGET_RENDER_TIME_MASK = 0x00FF0000, + PS_FRAMERATE_LIMITER_GPS_CTRL_TARGET_RENDER_TIME_SHIFT = 16, + PS_FRAMERATE_LIMITER_GPS_CTRL_PERF_STEP_SIZE_MASK = 0x1F000000, + PS_FRAMERATE_LIMITER_GPS_CTRL_PERF_STEP_SIZE_SHIFT = 24, + PS_FRAMERATE_LIMITER_GPS_CTRL_INCREASE_FILTER_MASK = 0xE0000000, + PS_FRAMERATE_LIMITER_GPS_CTRL_INCREASE_FILTER_SHIFT = 29, + PS_FRAMERATE_LIMITER_GPS_CTRL_OPTIMAL_SETTING = 0x4A5A3219, + PS_FRAMERATE_LIMITER_GPS_CTRL_NUM_VALUES = 11, + PS_FRAMERATE_LIMITER_GPS_CTRL_DEFAULT = PS_FRAMERATE_LIMITER_GPS_CTRL_DISABLED + } + + public enum EValues_PS_FRAMERATE_MONITOR_CTRL : uint { + PS_FRAMERATE_MONITOR_CTRL_DISABLED = 0x00000000, + PS_FRAMERATE_MONITOR_CTRL_THRESHOLD_PCT_MASK = 0x000000FF, + PS_FRAMERATE_MONITOR_CTRL_MOVING_AVG_X_MASK = 0x00000F00, + PS_FRAMERATE_MONITOR_CTRL_MOVING_AVG_X_SHIFT = 8, + PS_FRAMERATE_MONITOR_CTRL_OPTIMAL_SETTING = 0x00000364, + PS_FRAMERATE_MONITOR_CTRL_NUM_VALUES = 5, + PS_FRAMERATE_MONITOR_CTRL_DEFAULT = PS_FRAMERATE_MONITOR_CTRL_DISABLED + } + + public enum EValues_SHIM_MCCOMPAT : uint { + SHIM_MCCOMPAT_INTEGRATED = 0x00000000, + SHIM_MCCOMPAT_ENABLE = 0x00000001, + SHIM_MCCOMPAT_USER_EDITABLE = 0x00000002, + SHIM_MCCOMPAT_MASK = 0x00000003, + SHIM_MCCOMPAT_VIDEO_MASK = 0x00000004, + SHIM_MCCOMPAT_VARYING_BIT = 0x00000008, + SHIM_MCCOMPAT_AUTO_SELECT = 0x00000010, + SHIM_MCCOMPAT_OVERRIDE_BIT = 0x80000000, + SHIM_MCCOMPAT_NUM_VALUES = 8, + SHIM_MCCOMPAT_DEFAULT = SHIM_MCCOMPAT_AUTO_SELECT + } + + public enum EValues_SHIM_RENDERING_MODE : uint { + SHIM_RENDERING_MODE_INTEGRATED = 0x00000000, + SHIM_RENDERING_MODE_ENABLE = 0x00000001, + SHIM_RENDERING_MODE_USER_EDITABLE = 0x00000002, + SHIM_RENDERING_MODE_MASK = 0x00000003, + SHIM_RENDERING_MODE_VIDEO_MASK = 0x00000004, + SHIM_RENDERING_MODE_VARYING_BIT = 0x00000008, + SHIM_RENDERING_MODE_AUTO_SELECT = 0x00000010, + SHIM_RENDERING_MODE_OVERRIDE_BIT = 0x80000000, + SHIM_RENDERING_MODE_NUM_VALUES = 8, + SHIM_RENDERING_MODE_DEFAULT = SHIM_RENDERING_MODE_AUTO_SELECT + } + + public enum EValues_SHIM_RENDERING_OPTIONS : uint { + SHIM_RENDERING_OPTIONS_DEFAULT_RENDERING_MODE = 0x00000000, + SHIM_RENDERING_OPTIONS_DISABLE_ASYNC_PRESENT = 0x00000001, + SHIM_RENDERING_OPTIONS_EHSHELL_DETECT = 0x00000002, + SHIM_RENDERING_OPTIONS_FLASHPLAYER_HOST_DETECT = 0x00000004, + SHIM_RENDERING_OPTIONS_VIDEO_DRM_APP_DETECT = 0x00000008, + SHIM_RENDERING_OPTIONS_IGNORE_OVERRIDES = 0x00000010, + SHIM_RENDERING_OPTIONS_CHILDPROCESS_DETECT = 0x00000020, + SHIM_RENDERING_OPTIONS_ENABLE_DWM_ASYNC_PRESENT = 0x00000040, + SHIM_RENDERING_OPTIONS_PARENTPROCESS_DETECT = 0x00000080, + SHIM_RENDERING_OPTIONS_ALLOW_INHERITANCE = 0x00000100, + SHIM_RENDERING_OPTIONS_DISABLE_WRAPPERS = 0x00000200, + SHIM_RENDERING_OPTIONS_DISABLE_DXGI_WRAPPERS = 0x00000400, + SHIM_RENDERING_OPTIONS_PRUNE_UNSUPPORTED_FORMATS = 0x00000800, + SHIM_RENDERING_OPTIONS_ENABLE_ALPHA_FORMAT = 0x00001000, + SHIM_RENDERING_OPTIONS_IGPU_TRANSCODING = 0x00002000, + SHIM_RENDERING_OPTIONS_DISABLE_CUDA = 0x00004000, + SHIM_RENDERING_OPTIONS_ALLOW_CP_CAPS_FOR_VIDEO = 0x00008000, + SHIM_RENDERING_OPTIONS_IGPU_TRANSCODING_FWD_OPTIMUS = 0x00010000, + SHIM_RENDERING_OPTIONS_DISABLE_DURING_SECURE_BOOT = 0x00020000, + SHIM_RENDERING_OPTIONS_INVERT_FOR_QUADRO = 0x00040000, + SHIM_RENDERING_OPTIONS_INVERT_FOR_MSHYBRID = 0x00080000, + SHIM_RENDERING_OPTIONS_REGISTER_PROCESS_ENABLE_GOLD = 0x00100000, + SHIM_RENDERING_OPTIONS_HANDLE_WINDOWED_MODE_PERF_OPT = 0x00200000, + SHIM_RENDERING_OPTIONS_HANDLE_WIN7_ASYNC_RUNTIME_BUG = 0x00400000, + SHIM_RENDERING_OPTIONS_NUM_VALUES = 24, + SHIM_RENDERING_OPTIONS_DEFAULT = SHIM_RENDERING_OPTIONS_DEFAULT_RENDERING_MODE + } + + public enum EValues_SLI_GPU_COUNT : uint { + SLI_GPU_COUNT_AUTOSELECT = 0x00000000, + SLI_GPU_COUNT_ONE = 0x00000001, + SLI_GPU_COUNT_TWO = 0x00000002, + SLI_GPU_COUNT_THREE = 0x00000003, + SLI_GPU_COUNT_FOUR = 0x00000004, + SLI_GPU_COUNT_NUM_VALUES = 5, + SLI_GPU_COUNT_DEFAULT = SLI_GPU_COUNT_AUTOSELECT + } + + public enum EValues_SLI_PREDEFINED_GPU_COUNT : uint { + SLI_PREDEFINED_GPU_COUNT_AUTOSELECT = 0x00000000, + SLI_PREDEFINED_GPU_COUNT_ONE = 0x00000001, + SLI_PREDEFINED_GPU_COUNT_TWO = 0x00000002, + SLI_PREDEFINED_GPU_COUNT_THREE = 0x00000003, + SLI_PREDEFINED_GPU_COUNT_FOUR = 0x00000004, + SLI_PREDEFINED_GPU_COUNT_NUM_VALUES = 5, + SLI_PREDEFINED_GPU_COUNT_DEFAULT = SLI_PREDEFINED_GPU_COUNT_AUTOSELECT + } + + public enum EValues_SLI_PREDEFINED_GPU_COUNT_DX10 : uint { + SLI_PREDEFINED_GPU_COUNT_DX10_AUTOSELECT = 0x00000000, + SLI_PREDEFINED_GPU_COUNT_DX10_ONE = 0x00000001, + SLI_PREDEFINED_GPU_COUNT_DX10_TWO = 0x00000002, + SLI_PREDEFINED_GPU_COUNT_DX10_THREE = 0x00000003, + SLI_PREDEFINED_GPU_COUNT_DX10_FOUR = 0x00000004, + SLI_PREDEFINED_GPU_COUNT_DX10_NUM_VALUES = 5, + SLI_PREDEFINED_GPU_COUNT_DX10_DEFAULT = SLI_PREDEFINED_GPU_COUNT_DX10_AUTOSELECT + } + + public enum EValues_SLI_PREDEFINED_MODE : uint { + SLI_PREDEFINED_MODE_AUTOSELECT = 0x00000000, + SLI_PREDEFINED_MODE_FORCE_SINGLE = 0x00000001, + SLI_PREDEFINED_MODE_FORCE_AFR = 0x00000002, + SLI_PREDEFINED_MODE_FORCE_AFR2 = 0x00000003, + SLI_PREDEFINED_MODE_FORCE_SFR = 0x00000004, + SLI_PREDEFINED_MODE_FORCE_AFR_OF_SFR__FALLBACK_3AFR = 0x00000005, + SLI_PREDEFINED_MODE_NUM_VALUES = 6, + SLI_PREDEFINED_MODE_DEFAULT = SLI_PREDEFINED_MODE_AUTOSELECT + } + + public enum EValues_SLI_PREDEFINED_MODE_DX10 : uint { + SLI_PREDEFINED_MODE_DX10_AUTOSELECT = 0x00000000, + SLI_PREDEFINED_MODE_DX10_FORCE_SINGLE = 0x00000001, + SLI_PREDEFINED_MODE_DX10_FORCE_AFR = 0x00000002, + SLI_PREDEFINED_MODE_DX10_FORCE_AFR2 = 0x00000003, + SLI_PREDEFINED_MODE_DX10_FORCE_SFR = 0x00000004, + SLI_PREDEFINED_MODE_DX10_FORCE_AFR_OF_SFR__FALLBACK_3AFR = 0x00000005, + SLI_PREDEFINED_MODE_DX10_NUM_VALUES = 6, + SLI_PREDEFINED_MODE_DX10_DEFAULT = SLI_PREDEFINED_MODE_DX10_AUTOSELECT + } + + public enum EValues_SLI_RENDERING_MODE : uint { + SLI_RENDERING_MODE_AUTOSELECT = 0x00000000, + SLI_RENDERING_MODE_FORCE_SINGLE = 0x00000001, + SLI_RENDERING_MODE_FORCE_AFR = 0x00000002, + SLI_RENDERING_MODE_FORCE_AFR2 = 0x00000003, + SLI_RENDERING_MODE_FORCE_SFR = 0x00000004, + SLI_RENDERING_MODE_FORCE_AFR_OF_SFR__FALLBACK_3AFR = 0x00000005, + SLI_RENDERING_MODE_NUM_VALUES = 6, + SLI_RENDERING_MODE_DEFAULT = SLI_RENDERING_MODE_AUTOSELECT + } + + public enum EValues_VRPRERENDERLIMIT : uint { + VRPRERENDERLIMIT_MIN = 0x00, + VRPRERENDERLIMIT_MAX = 0xff, + VRPRERENDERLIMIT_APP_CONTROLLED = 0x00, + VRPRERENDERLIMIT_DEFAULT = 0x01, + VRPRERENDERLIMIT_NUM_VALUES = 4, + } + + public enum EValues_VRRFEATUREINDICATOR : uint { + VRRFEATUREINDICATOR_DISABLED = 0x0, + VRRFEATUREINDICATOR_ENABLED = 0x1, + VRRFEATUREINDICATOR_NUM_VALUES = 2, + VRRFEATUREINDICATOR_DEFAULT = VRRFEATUREINDICATOR_ENABLED + } + + public enum EValues_VRROVERLAYINDICATOR : uint { + VRROVERLAYINDICATOR_DISABLED = 0x0, + VRROVERLAYINDICATOR_ENABLED = 0x1, + VRROVERLAYINDICATOR_NUM_VALUES = 2, + VRROVERLAYINDICATOR_DEFAULT = VRROVERLAYINDICATOR_ENABLED + } + + public enum EValues_VRRREQUESTSTATE : uint { + VRRREQUESTSTATE_DISABLED = 0x0, + VRRREQUESTSTATE_FULLSCREEN_ONLY = 0x1, + VRRREQUESTSTATE_FULLSCREEN_AND_WINDOWED = 0x2, + VRRREQUESTSTATE_NUM_VALUES = 3, + VRRREQUESTSTATE_DEFAULT = VRRREQUESTSTATE_FULLSCREEN_ONLY + } + + public enum EValues_VRR_APP_OVERRIDE : uint { + VRR_APP_OVERRIDE_ALLOW = 0, + VRR_APP_OVERRIDE_FORCE_OFF = 1, + VRR_APP_OVERRIDE_DISALLOW = 2, + VRR_APP_OVERRIDE_ULMB = 3, + VRR_APP_OVERRIDE_FIXED_REFRESH = 4, + VRR_APP_OVERRIDE_NUM_VALUES = 5, + VRR_APP_OVERRIDE_DEFAULT = VRR_APP_OVERRIDE_ALLOW + } + + public enum EValues_VRR_APP_OVERRIDE_REQUEST_STATE : uint { + VRR_APP_OVERRIDE_REQUEST_STATE_ALLOW = 0, + VRR_APP_OVERRIDE_REQUEST_STATE_FORCE_OFF = 1, + VRR_APP_OVERRIDE_REQUEST_STATE_DISALLOW = 2, + VRR_APP_OVERRIDE_REQUEST_STATE_ULMB = 3, + VRR_APP_OVERRIDE_REQUEST_STATE_FIXED_REFRESH = 4, + VRR_APP_OVERRIDE_REQUEST_STATE_NUM_VALUES = 5, + VRR_APP_OVERRIDE_REQUEST_STATE_DEFAULT = VRR_APP_OVERRIDE_REQUEST_STATE_ALLOW + } + + public enum EValues_VRR_MODE : uint { + VRR_MODE_DISABLED = 0x0, + VRR_MODE_FULLSCREEN_ONLY = 0x1, + VRR_MODE_FULLSCREEN_AND_WINDOWED = 0x2, + VRR_MODE_NUM_VALUES = 3, + VRR_MODE_DEFAULT = VRR_MODE_FULLSCREEN_ONLY + } + + public enum EValues_VSYNCSMOOTHAFR : uint { + VSYNCSMOOTHAFR_OFF = 0x00000000, + VSYNCSMOOTHAFR_ON = 0x00000001, + VSYNCSMOOTHAFR_NUM_VALUES = 2, + VSYNCSMOOTHAFR_DEFAULT = VSYNCSMOOTHAFR_OFF + } + + public enum EValues_VSYNCVRRCONTROL : uint { + VSYNCVRRCONTROL_DISABLE = 0x00000000, + VSYNCVRRCONTROL_ENABLE = 0x00000001, + VSYNCVRRCONTROL_NOTSUPPORTED = 0x9f95128e, + VSYNCVRRCONTROL_NUM_VALUES = 3, + VSYNCVRRCONTROL_DEFAULT = VSYNCVRRCONTROL_ENABLE + } + + public enum EValues_VSYNC_BEHAVIOR_FLAGS : uint { + VSYNC_BEHAVIOR_FLAGS_NONE = 0x00000000, + VSYNC_BEHAVIOR_FLAGS_DEFAULT = 0x00000000, + VSYNC_BEHAVIOR_FLAGS_IGNORE_FLIPINTERVAL_MULTIPLE = 0x00000001, + VSYNC_BEHAVIOR_FLAGS_NUM_VALUES = 3, + } + + public enum EValues_WKS_API_STEREO_EYES_EXCHANGE : uint { + WKS_API_STEREO_EYES_EXCHANGE_OFF = 0, + WKS_API_STEREO_EYES_EXCHANGE_ON = 1, + WKS_API_STEREO_EYES_EXCHANGE_NUM_VALUES = 2, + WKS_API_STEREO_EYES_EXCHANGE_DEFAULT = WKS_API_STEREO_EYES_EXCHANGE_OFF + } + + public enum EValues_WKS_API_STEREO_MODE : uint { + WKS_API_STEREO_MODE_SHUTTER_GLASSES = 0, + WKS_API_STEREO_MODE_VERTICAL_INTERLACED = 1, + WKS_API_STEREO_MODE_TWINVIEW = 2, + WKS_API_STEREO_MODE_NV17_SHUTTER_GLASSES_AUTO = 3, + WKS_API_STEREO_MODE_NV17_SHUTTER_GLASSES_DAC0 = 4, + WKS_API_STEREO_MODE_NV17_SHUTTER_GLASSES_DAC1 = 5, + WKS_API_STEREO_MODE_COLOR_LINE = 6, + WKS_API_STEREO_MODE_COLOR_INTERLEAVED = 7, + WKS_API_STEREO_MODE_ANAGLYPH = 8, + WKS_API_STEREO_MODE_HORIZONTAL_INTERLACED = 9, + WKS_API_STEREO_MODE_SIDE_FIELD = 10, + WKS_API_STEREO_MODE_SUB_FIELD = 11, + WKS_API_STEREO_MODE_CHECKERBOARD = 12, + WKS_API_STEREO_MODE_INVERSE_CHECKERBOARD = 13, + WKS_API_STEREO_MODE_TRIDELITY_SL = 14, + WKS_API_STEREO_MODE_TRIDELITY_MV = 15, + WKS_API_STEREO_MODE_SEEFRONT = 16, + WKS_API_STEREO_MODE_STEREO_MIRROR = 17, + WKS_API_STEREO_MODE_FRAME_SEQUENTIAL = 18, + WKS_API_STEREO_MODE_AUTODETECT_PASSIVE_MODE = 19, + WKS_API_STEREO_MODE_AEGIS_DT_FRAME_SEQUENTIAL = 20, + WKS_API_STEREO_MODE_OEM_EMITTER_FRAME_SEQUENTIAL = 21, + WKS_API_STEREO_MODE_USE_HW_DEFAULT = 0xffffffff, + WKS_API_STEREO_MODE_DEFAULT_GL = 3, + WKS_API_STEREO_MODE_NUM_VALUES = 24, + WKS_API_STEREO_MODE_DEFAULT = WKS_API_STEREO_MODE_SHUTTER_GLASSES + } + + public enum EValues_WKS_MEMORY_ALLOCATION_POLICY : uint { + WKS_MEMORY_ALLOCATION_POLICY_AS_NEEDED = 0x0, + WKS_MEMORY_ALLOCATION_POLICY_MODERATE_PRE_ALLOCATION = 0x1, + WKS_MEMORY_ALLOCATION_POLICY_AGGRESSIVE_PRE_ALLOCATION = 0x2, + WKS_MEMORY_ALLOCATION_POLICY_NUM_VALUES = 3, + WKS_MEMORY_ALLOCATION_POLICY_DEFAULT = WKS_MEMORY_ALLOCATION_POLICY_AS_NEEDED + } + + public enum EValues_WKS_STEREO_DONGLE_SUPPORT : uint { + WKS_STEREO_DONGLE_SUPPORT_OFF = 0, + WKS_STEREO_DONGLE_SUPPORT_DAC = 1, + WKS_STEREO_DONGLE_SUPPORT_DLP = 2, + WKS_STEREO_DONGLE_SUPPORT_NUM_VALUES = 3, + WKS_STEREO_DONGLE_SUPPORT_DEFAULT = WKS_STEREO_DONGLE_SUPPORT_OFF + } + + public enum EValues_WKS_STEREO_SUPPORT : uint { + WKS_STEREO_SUPPORT_OFF = 0, + WKS_STEREO_SUPPORT_ON = 1, + WKS_STEREO_SUPPORT_NUM_VALUES = 2, + WKS_STEREO_SUPPORT_DEFAULT = WKS_STEREO_SUPPORT_OFF + } + + public enum EValues_WKS_STEREO_SWAP_MODE : uint { + WKS_STEREO_SWAP_MODE_APPLICATION_CONTROL = 0x0, + WKS_STEREO_SWAP_MODE_PER_EYE = 0x1, + WKS_STEREO_SWAP_MODE_PER_EYE_PAIR = 0x2, + WKS_STEREO_SWAP_MODE_LEGACY_BEHAVIOR = 0x3, + WKS_STEREO_SWAP_MODE_NUM_VALUES = 4, + WKS_STEREO_SWAP_MODE_DEFAULT = WKS_STEREO_SWAP_MODE_APPLICATION_CONTROL + } + + public enum EValues_AO_MODE : uint { + AO_MODE_OFF = 0, + AO_MODE_LOW = 1, + AO_MODE_MEDIUM = 2, + AO_MODE_HIGH = 3, + AO_MODE_NUM_VALUES = 4, + AO_MODE_DEFAULT = AO_MODE_OFF + } + + public enum EValues_AO_MODE_ACTIVE : uint { + AO_MODE_ACTIVE_DISABLED = 0, + AO_MODE_ACTIVE_ENABLED = 1, + AO_MODE_ACTIVE_NUM_VALUES = 2, + AO_MODE_ACTIVE_DEFAULT = AO_MODE_ACTIVE_DISABLED + } + + public enum EValues_AUTO_LODBIASADJUST : uint { + AUTO_LODBIASADJUST_OFF = 0x00000000, + AUTO_LODBIASADJUST_ON = 0x00000001, + AUTO_LODBIASADJUST_NUM_VALUES = 2, + AUTO_LODBIASADJUST_DEFAULT = AUTO_LODBIASADJUST_ON + } + + public enum EValues_LODBIASADJUST : uint { + LODBIASADJUST_MIN = 0xffffff80, + LODBIASADJUST_MAX = 128, + LODBIASADJUST_NUM_VALUES = 2, + LODBIASADJUST_DEFAULT = 0 + } + + public enum EValues_MAXWELL_B_SAMPLE_INTERLEAVE : uint { + MAXWELL_B_SAMPLE_INTERLEAVE_OFF = 0, + MAXWELL_B_SAMPLE_INTERLEAVE_ON = 1, + MAXWELL_B_SAMPLE_INTERLEAVE_NUM_VALUES = 2, + MAXWELL_B_SAMPLE_INTERLEAVE_DEFAULT = MAXWELL_B_SAMPLE_INTERLEAVE_OFF + } + + public enum EValues_PRERENDERLIMIT : uint { + PRERENDERLIMIT_MIN = 0x00, + PRERENDERLIMIT_MAX = 0xff, + PRERENDERLIMIT_APP_CONTROLLED = 0x00, + PRERENDERLIMIT_NUM_VALUES = 3, + PRERENDERLIMIT_DEFAULT = PRERENDERLIMIT_APP_CONTROLLED + } + + public enum EValues_PS_SHADERDISKCACHE : uint { + PS_SHADERDISKCACHE_OFF = 0x00000000, + PS_SHADERDISKCACHE_ON = 0x00000001, + PS_SHADERDISKCACHE_NUM_VALUES = 2, + PS_SHADERDISKCACHE_DEFAULT = 0x1 + } + + public enum EValues_PS_TEXFILTER_ANISO_OPTS2 : uint { + PS_TEXFILTER_ANISO_OPTS2_OFF = 0x00000000, + PS_TEXFILTER_ANISO_OPTS2_ON = 0x00000001, + PS_TEXFILTER_ANISO_OPTS2_NUM_VALUES = 2, + PS_TEXFILTER_ANISO_OPTS2_DEFAULT = PS_TEXFILTER_ANISO_OPTS2_OFF + } + + public enum EValues_PS_TEXFILTER_BILINEAR_IN_ANISO : uint { + PS_TEXFILTER_BILINEAR_IN_ANISO_OFF = 0x00000000, + PS_TEXFILTER_BILINEAR_IN_ANISO_ON = 0x00000001, + PS_TEXFILTER_BILINEAR_IN_ANISO_NUM_VALUES = 2, + PS_TEXFILTER_BILINEAR_IN_ANISO_DEFAULT = PS_TEXFILTER_BILINEAR_IN_ANISO_OFF + } + + public enum EValues_PS_TEXFILTER_DISABLE_TRILIN_SLOPE : uint { + PS_TEXFILTER_DISABLE_TRILIN_SLOPE_OFF = 0x00000000, + PS_TEXFILTER_DISABLE_TRILIN_SLOPE_ON = 0x00000001, + PS_TEXFILTER_DISABLE_TRILIN_SLOPE_NUM_VALUES = 2, + PS_TEXFILTER_DISABLE_TRILIN_SLOPE_DEFAULT = PS_TEXFILTER_DISABLE_TRILIN_SLOPE_OFF + } + + public enum EValues_PS_TEXFILTER_NO_NEG_LODBIAS : uint { + PS_TEXFILTER_NO_NEG_LODBIAS_OFF = 0x00000000, + PS_TEXFILTER_NO_NEG_LODBIAS_ON = 0x00000001, + PS_TEXFILTER_NO_NEG_LODBIAS_NUM_VALUES = 2, + PS_TEXFILTER_NO_NEG_LODBIAS_DEFAULT = PS_TEXFILTER_NO_NEG_LODBIAS_OFF + } + + public enum EValues_QUALITY_ENHANCEMENTS : uint { + QUALITY_ENHANCEMENTS_HIGHQUALITY = 0xfffffff6, + QUALITY_ENHANCEMENTS_QUALITY = 0x00000000, + QUALITY_ENHANCEMENTS_PERFORMANCE = 0x0000000a, + QUALITY_ENHANCEMENTS_HIGHPERFORMANCE = 0x00000014, + QUALITY_ENHANCEMENTS_NUM_VALUES = 4, + QUALITY_ENHANCEMENTS_DEFAULT = QUALITY_ENHANCEMENTS_QUALITY + } + + public enum EValues_REFRESH_RATE_OVERRIDE : uint { + REFRESH_RATE_OVERRIDE_APPLICATION_CONTROLLED = 0, + REFRESH_RATE_OVERRIDE_HIGHEST_AVAILABLE = 1, + REFRESH_RATE_OVERRIDE_NUM_VALUES = 2, + REFRESH_RATE_OVERRIDE_DEFAULT = REFRESH_RATE_OVERRIDE_APPLICATION_CONTROLLED + } + + public enum EValues_SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE : uint { + SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_OFF = 0x00000000, + SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_ON = 0x00000001, + SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_NUM_VALUES = 2, + SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_DEFAULT = SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_OFF + } + + public enum EValues_SET_VAB_DATA : uint { + SET_VAB_DATA_ZERO = 0x00000000, + SET_VAB_DATA_UINT_ONE = 0x00000001, + SET_VAB_DATA_FLOAT_ONE = 0x3f800000, + SET_VAB_DATA_FLOAT_POS_INF = 0x7f800000, + SET_VAB_DATA_FLOAT_NAN = 0x7fc00000, + SET_VAB_DATA_USE_API_DEFAULTS = 0xffffffff, + SET_VAB_DATA_NUM_VALUES = 6, + SET_VAB_DATA_DEFAULT = SET_VAB_DATA_USE_API_DEFAULTS + } + + public enum EValues_VSYNCMODE : uint { + VSYNCMODE_PASSIVE = 0x60925292, + VSYNCMODE_FORCEOFF = 0x08416747, + VSYNCMODE_FORCEON = 0x47814940, + VSYNCMODE_FLIPINTERVAL2 = 0x32610244, + VSYNCMODE_FLIPINTERVAL3 = 0x71271021, + VSYNCMODE_FLIPINTERVAL4 = 0x13245256, + VSYNCMODE_NUM_VALUES = 6, + VSYNCMODE_DEFAULT = VSYNCMODE_PASSIVE + } + + public enum EValues_VSYNCTEARCONTROL : uint { + VSYNCTEARCONTROL_DISABLE = 0x96861077, + VSYNCTEARCONTROL_ENABLE = 0x99941284, + VSYNCTEARCONTROL_NUM_VALUES = 2, + VSYNCTEARCONTROL_DEFAULT = VSYNCTEARCONTROL_DISABLE + } + +} \ No newline at end of file diff --git a/nspector/Native/NVAPI/NvApiDriverSettings.h b/nspector/Native/NVAPI/NvApiDriverSettings.h new file mode 100644 index 0000000..a7db2df --- /dev/null +++ b/nspector/Native/NVAPI/NvApiDriverSettings.h @@ -0,0 +1,1101 @@ +/***************************************************************************\ +|* *| +|* Copyright NVIDIA Corporation. All rights reserved. *| +|* *| +|* NOTICE TO USER: *| +|* *| +|* This source code is subject to NVIDIA ownership rights under U.S. *| +|* and international Copyright laws. Users and possessors of this *| +|* source code are hereby granted a nonexclusive, royalty-free *| +|* license to use this code in individual and commercial software. *| +|* *| +|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE *| +|* CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR *| +|* IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH *| +|* REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF *| +|* MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR *| +|* PURPOSE. IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, *| +|* INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES *| +|* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN *| +|* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING *| +|* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE *| +|* CODE. *| +|* *| +|* U.S. Government End Users. This source code is a "commercial item" *| +|* as that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting *| +|* of "commercial computer software" and "commercial computer software *| +|* documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) *| +|* and is provided to the U.S. Government only as a commercial end item. *| +|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through *| +|* 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the *| +|* source code with only those rights set forth herein. *| +|* *| +|* Any use of this source code in individual and commercial software must *| +|* include, in the user documentation and internal comments to the code, *| +|* the above Disclaimer and U.S. Government End Users Notice. *| +|* *| +|* *| +\***************************************************************************/ + +#ifndef _NVAPI_DRIVER_SETTINGS_H_ +#define _NVAPI_DRIVER_SETTINGS_H_ + +#define OGL_AA_LINE_GAMMA_STRING L"Antialiasing - Line gamma" +#define OGL_DEEP_COLOR_SCANOUT_STRING L"Deep color for 3D applications" +#define OGL_DEFAULT_SWAP_INTERVAL_STRING L"OpenGL default swap interval" +#define OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL_STRING L"OpenGL default swap interval fraction" +#define OGL_DEFAULT_SWAP_INTERVAL_SIGN_STRING L"OpenGL default swap interval sign" +#define OGL_EVENT_LOG_SEVERITY_THRESHOLD_STRING L"Event Log Severity Threshold" +#define OGL_EXTENSION_STRING_VERSION_STRING L"Extension String version" +#define OGL_FORCE_BLIT_STRING L"Buffer-flipping mode" +#define OGL_FORCE_STEREO_STRING L"Force Stereo shuttering" +#define OGL_IMPLICIT_GPU_AFFINITY_STRING L"Preferred OpenGL GPU" +#define OGL_MAX_FRAMES_ALLOWED_STRING L"Maximum frames allowed" +#define OGL_MULTIMON_STRING L"Multi-display/mixed-GPU acceleration" +#define OGL_OVERLAY_PIXEL_TYPE_STRING L"Exported Overlay pixel types" +#define OGL_OVERLAY_SUPPORT_STRING L"Enable overlay" +#define OGL_QUALITY_ENHANCEMENTS_STRING L"High level control of the rendering quality on OpenGL" +#define OGL_SINGLE_BACKDEPTH_BUFFER_STRING L"Unified back/depth buffer" +#define OGL_THREAD_CONTROL_STRING L"Threaded optimization" +#define OGL_TRIPLE_BUFFER_STRING L"Triple buffering" +#define OGL_VIDEO_EDITING_MODE_STRING L"OpenGL video-editing mode" +#define AA_BEHAVIOR_FLAGS_STRING L"Antialiasing - Behavior Flags" +#define AA_MODE_ALPHATOCOVERAGE_STRING L"Antialiasing - Transparency Multisampling" +#define AA_MODE_GAMMACORRECTION_STRING L"Antialiasing - Gamma correction" +#define AA_MODE_METHOD_STRING L"Antialiasing - Setting" +#define AA_MODE_REPLAY_STRING L"Antialiasing - Transparency Supersampling" +#define AA_MODE_SELECTOR_STRING L"Antialiasing - Mode" +#define AA_MODE_SELECTOR_SLIAA_STRING L"Antialiasing - SLI AA" +#define ANISO_MODE_LEVEL_STRING L"Anisotropic filtering setting" +#define ANISO_MODE_SELECTOR_STRING L"Anisotropic filtering mode" +#define APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_STRING L"Application Profile Notification Popup Timeout" +#define APPLICATION_STEAM_ID_STRING L"Steam Application ID" +#define CPL_HIDDEN_PROFILE_STRING L"Do not display this profile in the Control Panel" +#define CUDA_EXCLUDED_GPUS_STRING L"List of Universal GPU ids" +#define D3DOGL_GPU_MAX_POWER_STRING L"Maximum GPU Power" +#define EXPORT_PERF_COUNTERS_STRING L"Export Performance Counters" +#define FXAA_ALLOW_STRING L"NVIDIA Predefined FXAA Usage" +#define FXAA_ENABLE_STRING L"Enable FXAA" +#define FXAA_INDICATOR_ENABLE_STRING L"Enable FXAA Indicator" +#define MCSFRSHOWSPLIT_STRING L"SLI indicator" +#define NV_QUALITY_UPSCALING_STRING L"NVIDIA Quality upscaling" +#define OPTIMUS_MAXAA_STRING L"Maximum AA samples allowed for a given application" +#define PHYSXINDICATOR_STRING L"Display the PhysX indicator" +#define PREFERRED_PSTATE_STRING L"Power management mode" +#define PREVENT_UI_AF_OVERRIDE_STRING L"No override of Anisotropic filtering" +#define PS_FRAMERATE_LIMITER_STRING L"Frame Rate Limiter" +#define PS_FRAMERATE_LIMITER_GPS_CTRL_STRING L"Frame Rate Monitor" +#define PS_FRAMERATE_MONITOR_CTRL_STRING L"Frame Rate Monitor Control" +#define SHIM_MAXRES_STRING L"Maximum resolution allowed for a given application" +#define SHIM_MCCOMPAT_STRING L"Optimus flags for enabled applications" +#define SHIM_RENDERING_MODE_STRING L"Enable application for Optimus" +#define SHIM_RENDERING_OPTIONS_STRING L"Shim Rendering Mode Options per application for Optimus" +#define SLI_GPU_COUNT_STRING L"Number of GPUs to use on SLI rendering mode" +#define SLI_PREDEFINED_GPU_COUNT_STRING L"NVIDIA predefined number of GPUs to use on SLI rendering mode" +#define SLI_PREDEFINED_GPU_COUNT_DX10_STRING L"NVIDIA predefined number of GPUs to use on SLI rendering mode on DirectX 10" +#define SLI_PREDEFINED_MODE_STRING L"NVIDIA predefined SLI mode" +#define SLI_PREDEFINED_MODE_DX10_STRING L"NVIDIA predefined SLI mode on DirectX 10" +#define SLI_RENDERING_MODE_STRING L"SLI rendering mode" +#define VRPRERENDERLIMIT_STRING L"Virtual Reality pre-rendered frames" +#define VRRFEATUREINDICATOR_STRING L"Toggle the VRR global feature" +#define VRROVERLAYINDICATOR_STRING L"Display the VRR Overlay Indicator" +#define VRRREQUESTSTATE_STRING L"VRR requested state" +#define VRR_APP_OVERRIDE_STRING L"G-SYNC" +#define VRR_APP_OVERRIDE_REQUEST_STATE_STRING L"G-SYNC" +#define VRR_MODE_STRING L"Enable G-SYNC globally" +#define VSYNCSMOOTHAFR_STRING L"Flag to control smooth AFR behavior" +#define VSYNCVRRCONTROL_STRING L"Variable refresh Rate" +#define VSYNC_BEHAVIOR_FLAGS_STRING L"Vsync - Behavior Flags" +#define WKS_API_STEREO_EYES_EXCHANGE_STRING L"Stereo - Swap eyes" +#define WKS_API_STEREO_MODE_STRING L"Stereo - Display mode" +#define WKS_MEMORY_ALLOCATION_POLICY_STRING L"Memory Allocation Policy" +#define WKS_STEREO_DONGLE_SUPPORT_STRING L"Stereo - Dongle Support" +#define WKS_STEREO_SUPPORT_STRING L"Stereo - Enable" +#define WKS_STEREO_SWAP_MODE_STRING L"Stereo – swap mode" +#define AO_MODE_STRING L"Ambient Occlusion" +#define AO_MODE_ACTIVE_STRING L"NVIDIA Predefined Ambient Occlusion Usage" +#define AUTO_LODBIASADJUST_STRING L"Texture filtering - Driver Controlled LOD Bias" +#define ICAFE_LOGO_CONFIG_STRING L"ICafe Settings" +#define LODBIASADJUST_STRING L"Texture filtering - LOD Bias" +#define MAXWELL_B_SAMPLE_INTERLEAVE_STRING L"Enable sample interleaving (MFAA)" +#define PRERENDERLIMIT_STRING L"Maximum pre-rendered frames" +#define PS_SHADERDISKCACHE_STRING L"Shader Cache" +#define PS_TEXFILTER_ANISO_OPTS2_STRING L"Texture filtering - Anisotropic sample optimization" +#define PS_TEXFILTER_BILINEAR_IN_ANISO_STRING L"Texture filtering - Anisotropic filter optimization" +#define PS_TEXFILTER_DISABLE_TRILIN_SLOPE_STRING L"Texture filtering - Trilinear optimization" +#define PS_TEXFILTER_NO_NEG_LODBIAS_STRING L"Texture filtering - Negative LOD bias" +#define QUALITY_ENHANCEMENTS_STRING L"Texture filtering - Quality" +#define REFRESH_RATE_OVERRIDE_STRING L"Preferred refresh rate" +#define SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_STRING L"PowerThrottle" +#define SET_VAB_DATA_STRING L"VAB Default Data" +#define VSYNCMODE_STRING L"Vertical Sync" +#define VSYNCTEARCONTROL_STRING L"Vertical Sync Tear Control" + +enum ESetting { + OGL_AA_LINE_GAMMA_ID = 0x2089BF6C, + OGL_DEEP_COLOR_SCANOUT_ID = 0x2097C2F6, + OGL_DEFAULT_SWAP_INTERVAL_ID = 0x206A6582, + OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL_ID = 0x206C4581, + OGL_DEFAULT_SWAP_INTERVAL_SIGN_ID = 0x20655CFA, + OGL_EVENT_LOG_SEVERITY_THRESHOLD_ID = 0x209DF23E, + OGL_EXTENSION_STRING_VERSION_ID = 0x20FF7493, + OGL_FORCE_BLIT_ID = 0x201F619F, + OGL_FORCE_STEREO_ID = 0x204D9A0C, + OGL_IMPLICIT_GPU_AFFINITY_ID = 0x20D0F3E6, + OGL_MAX_FRAMES_ALLOWED_ID = 0x208E55E3, + OGL_MULTIMON_ID = 0x200AEBFC, + OGL_OVERLAY_PIXEL_TYPE_ID = 0x209AE66F, + OGL_OVERLAY_SUPPORT_ID = 0x206C28C4, + OGL_QUALITY_ENHANCEMENTS_ID = 0x20797D6C, + OGL_SINGLE_BACKDEPTH_BUFFER_ID = 0x20A29055, + OGL_THREAD_CONTROL_ID = 0x20C1221E, + OGL_TRIPLE_BUFFER_ID = 0x20FDD1F9, + OGL_VIDEO_EDITING_MODE_ID = 0x20EE02B4, + AA_BEHAVIOR_FLAGS_ID = 0x10ECDB82, + AA_MODE_ALPHATOCOVERAGE_ID = 0x10FC2D9C, + AA_MODE_GAMMACORRECTION_ID = 0x107D639D, + AA_MODE_METHOD_ID = 0x10D773D2, + AA_MODE_REPLAY_ID = 0x10D48A85, + AA_MODE_SELECTOR_ID = 0x107EFC5B, + AA_MODE_SELECTOR_SLIAA_ID = 0x107AFC5B, + ANISO_MODE_LEVEL_ID = 0x101E61A9, + ANISO_MODE_SELECTOR_ID = 0x10D2BB16, + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_ID = 0x104554B6, + APPLICATION_STEAM_ID_ID = 0x107CDDBC, + CPL_HIDDEN_PROFILE_ID = 0x106D5CFF, + CUDA_EXCLUDED_GPUS_ID = 0x10354FF8, + D3DOGL_GPU_MAX_POWER_ID = 0x10D1EF29, + EXPORT_PERF_COUNTERS_ID = 0x108F0841, + FXAA_ALLOW_ID = 0x1034CB89, + FXAA_ENABLE_ID = 0x1074C972, + FXAA_INDICATOR_ENABLE_ID = 0x1068FB9C, + MCSFRSHOWSPLIT_ID = 0x10287051, + NV_QUALITY_UPSCALING_ID = 0x10444444, + OPTIMUS_MAXAA_ID = 0x10F9DC83, + PHYSXINDICATOR_ID = 0x1094F16F, + PREFERRED_PSTATE_ID = 0x1057EB71, + PREVENT_UI_AF_OVERRIDE_ID = 0x103BCCB5, + PS_FRAMERATE_LIMITER_ID = 0x10834FEE, + PS_FRAMERATE_LIMITER_GPS_CTRL_ID = 0x10834F01, + PS_FRAMERATE_MONITOR_CTRL_ID = 0x10834F05, + SHIM_MAXRES_ID = 0x10F9DC82, + SHIM_MCCOMPAT_ID = 0x10F9DC80, + SHIM_RENDERING_MODE_ID = 0x10F9DC81, + SHIM_RENDERING_OPTIONS_ID = 0x10F9DC84, + SLI_GPU_COUNT_ID = 0x1033DCD1, + SLI_PREDEFINED_GPU_COUNT_ID = 0x1033DCD2, + SLI_PREDEFINED_GPU_COUNT_DX10_ID = 0x1033DCD3, + SLI_PREDEFINED_MODE_ID = 0x1033CEC1, + SLI_PREDEFINED_MODE_DX10_ID = 0x1033CEC2, + SLI_RENDERING_MODE_ID = 0x1033CED1, + VRPRERENDERLIMIT_ID = 0x10111133, + VRRFEATUREINDICATOR_ID = 0x1094F157, + VRROVERLAYINDICATOR_ID = 0x1095F16F, + VRRREQUESTSTATE_ID = 0x1094F1F7, + VRR_APP_OVERRIDE_ID = 0x10A879CF, + VRR_APP_OVERRIDE_REQUEST_STATE_ID = 0x10A879AC, + VRR_MODE_ID = 0x1194F158, + VSYNCSMOOTHAFR_ID = 0x101AE763, + VSYNCVRRCONTROL_ID = 0x10A879CE, + VSYNC_BEHAVIOR_FLAGS_ID = 0x10FDEC23, + WKS_API_STEREO_EYES_EXCHANGE_ID = 0x11AE435C, + WKS_API_STEREO_MODE_ID = 0x11E91A61, + WKS_MEMORY_ALLOCATION_POLICY_ID = 0x11112233, + WKS_STEREO_DONGLE_SUPPORT_ID = 0x112493BD, + WKS_STEREO_SUPPORT_ID = 0x11AA9E99, + WKS_STEREO_SWAP_MODE_ID = 0x11333333, + AO_MODE_ID = 0x00667329, + AO_MODE_ACTIVE_ID = 0x00664339, + AUTO_LODBIASADJUST_ID = 0x00638E8F, + ICAFE_LOGO_CONFIG_ID = 0x00DB1337, + LODBIASADJUST_ID = 0x00738E8F, + MAXWELL_B_SAMPLE_INTERLEAVE_ID = 0x0098C1AC, + PRERENDERLIMIT_ID = 0x007BA09E, + PS_SHADERDISKCACHE_ID = 0x00198FFF, + PS_TEXFILTER_ANISO_OPTS2_ID = 0x00E73211, + PS_TEXFILTER_BILINEAR_IN_ANISO_ID = 0x0084CD70, + PS_TEXFILTER_DISABLE_TRILIN_SLOPE_ID = 0x002ECAF2, + PS_TEXFILTER_NO_NEG_LODBIAS_ID = 0x0019BB68, + QUALITY_ENHANCEMENTS_ID = 0x00CE2691, + REFRESH_RATE_OVERRIDE_ID = 0x0064B541, + SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_ID = 0x00AE785C, + SET_VAB_DATA_ID = 0x00AB8687, + VSYNCMODE_ID = 0x00A879CF, + VSYNCTEARCONTROL_ID = 0x005A375C, + TOTAL_DWORD_SETTING_NUM = 86, + TOTAL_WSTRING_SETTING_NUM = 4, + TOTAL_SETTING_NUM = 90, + INVALID_SETTING_ID = 0xFFFFFFFF +}; + +enum EValues_OGL_AA_LINE_GAMMA { + OGL_AA_LINE_GAMMA_DISABLED = 0x10, + OGL_AA_LINE_GAMMA_ENABLED = 0x23, + OGL_AA_LINE_GAMMA_MIN = 1, + OGL_AA_LINE_GAMMA_MAX = 100, + OGL_AA_LINE_GAMMA_NUM_VALUES = 4, + OGL_AA_LINE_GAMMA_DEFAULT = OGL_AA_LINE_GAMMA_DISABLED +}; + +enum EValues_OGL_DEEP_COLOR_SCANOUT { + OGL_DEEP_COLOR_SCANOUT_DISABLE = 0, + OGL_DEEP_COLOR_SCANOUT_ENABLE = 1, + OGL_DEEP_COLOR_SCANOUT_NUM_VALUES = 2, + OGL_DEEP_COLOR_SCANOUT_DEFAULT = OGL_DEEP_COLOR_SCANOUT_ENABLE +}; + +enum EValues_OGL_DEFAULT_SWAP_INTERVAL { + OGL_DEFAULT_SWAP_INTERVAL_TEAR = 0, + OGL_DEFAULT_SWAP_INTERVAL_VSYNC_ONE = 1, + OGL_DEFAULT_SWAP_INTERVAL_VSYNC = 1, + OGL_DEFAULT_SWAP_INTERVAL_VALUE_MASK = 0x0000FFFF, + OGL_DEFAULT_SWAP_INTERVAL_FORCE_MASK = 0xF0000000, + OGL_DEFAULT_SWAP_INTERVAL_FORCE_OFF = 0xF0000000, + OGL_DEFAULT_SWAP_INTERVAL_FORCE_ON = 0x10000000, + OGL_DEFAULT_SWAP_INTERVAL_APP_CONTROLLED = 0x00000000, + OGL_DEFAULT_SWAP_INTERVAL_DISABLE = 0xffffffff, + OGL_DEFAULT_SWAP_INTERVAL_NUM_VALUES = 9, + OGL_DEFAULT_SWAP_INTERVAL_DEFAULT = OGL_DEFAULT_SWAP_INTERVAL_VSYNC_ONE +}; + +enum EValues_OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL { + OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL_ZERO_SCANLINES = 0, + OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL_ONE_FULL_FRAME_OF_SCANLINES = 100, + OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL_NUM_VALUES = 2, + OGL_DEFAULT_SWAP_INTERVAL_FRACTIONAL_DEFAULT = 0 +}; + +enum EValues_OGL_DEFAULT_SWAP_INTERVAL_SIGN { + OGL_DEFAULT_SWAP_INTERVAL_SIGN_POSITIVE = 0, + OGL_DEFAULT_SWAP_INTERVAL_SIGN_NEGATIVE = 1, + OGL_DEFAULT_SWAP_INTERVAL_SIGN_NUM_VALUES = 2, + OGL_DEFAULT_SWAP_INTERVAL_SIGN_DEFAULT = OGL_DEFAULT_SWAP_INTERVAL_SIGN_POSITIVE +}; + +enum EValues_OGL_EVENT_LOG_SEVERITY_THRESHOLD { + OGL_EVENT_LOG_SEVERITY_THRESHOLD_DISABLE = 0, + OGL_EVENT_LOG_SEVERITY_THRESHOLD_CRITICAL = 1, + OGL_EVENT_LOG_SEVERITY_THRESHOLD_WARNING = 2, + OGL_EVENT_LOG_SEVERITY_THRESHOLD_INFORMATION = 3, + OGL_EVENT_LOG_SEVERITY_THRESHOLD_ALL = 4, + OGL_EVENT_LOG_SEVERITY_THRESHOLD_NUM_VALUES = 5, + OGL_EVENT_LOG_SEVERITY_THRESHOLD_DEFAULT = OGL_EVENT_LOG_SEVERITY_THRESHOLD_CRITICAL +}; + +enum EValues_OGL_FORCE_BLIT { + OGL_FORCE_BLIT_ON = 1, + OGL_FORCE_BLIT_OFF = 0, + OGL_FORCE_BLIT_NUM_VALUES = 2, + OGL_FORCE_BLIT_DEFAULT = OGL_FORCE_BLIT_OFF +}; + +enum EValues_OGL_FORCE_STEREO { + OGL_FORCE_STEREO_OFF = 0, + OGL_FORCE_STEREO_ON = 1, + OGL_FORCE_STEREO_NUM_VALUES = 2, + OGL_FORCE_STEREO_DEFAULT = OGL_FORCE_STEREO_OFF +}; + +#define OGL_IMPLICIT_GPU_AFFINITY_ENV_VAR L"OGL_DEFAULT_RENDERING_GPU" +#define OGL_IMPLICIT_GPU_AFFINITY_AUTOSELECT L"autoselect" +#define OGL_IMPLICIT_GPU_AFFINITY_NUM_VALUES 1 +#define OGL_IMPLICIT_GPU_AFFINITY_DEFAULT OGL_IMPLICIT_GPU_AFFINITY_AUTOSELECT + +enum EValues_OGL_MULTIMON { + OGL_MULTIMON_SINGLE_MONITOR = 0, + OGL_MULTIMON_COMPATIBILITY_LCD = 1, + OGL_MULTIMON_COMPATIBILITY_GCD = 2, + OGL_MULTIMON_PERFORMANCE_LCD = 3, + OGL_MULTIMON_PERFORMANCE_GCD = 4, + OGL_MULTIMON_EXTENDED_SINGLE_MONITOR = 5, + OGL_MULTIMON_PERFORMANCE_QUADRO = 6, + OGL_MULTIMON_MULTIMON_BUFFER = 7, + OGL_MULTIMON_NUM_VALUES = 8, + OGL_MULTIMON_DEFAULT = OGL_MULTIMON_PERFORMANCE_LCD +}; + +enum EValues_OGL_OVERLAY_PIXEL_TYPE { + OGL_OVERLAY_PIXEL_TYPE_NONE = 0x0, + OGL_OVERLAY_PIXEL_TYPE_CI = 0x1, + OGL_OVERLAY_PIXEL_TYPE_RGBA = 0x2, + OGL_OVERLAY_PIXEL_TYPE_CI_AND_RGBA = 0x3, + OGL_OVERLAY_PIXEL_TYPE_NUM_VALUES = 4, + OGL_OVERLAY_PIXEL_TYPE_DEFAULT = OGL_OVERLAY_PIXEL_TYPE_CI +}; + +enum EValues_OGL_OVERLAY_SUPPORT { + OGL_OVERLAY_SUPPORT_OFF = 0, + OGL_OVERLAY_SUPPORT_ON = 1, + OGL_OVERLAY_SUPPORT_FORCE_SW = 2, + OGL_OVERLAY_SUPPORT_NUM_VALUES = 3, + OGL_OVERLAY_SUPPORT_DEFAULT = OGL_OVERLAY_SUPPORT_OFF +}; + +enum EValues_OGL_QUALITY_ENHANCEMENTS { + OGL_QUALITY_ENHANCEMENTS_HQUAL = -10, + OGL_QUALITY_ENHANCEMENTS_QUAL = 0, + OGL_QUALITY_ENHANCEMENTS_PERF = 10, + OGL_QUALITY_ENHANCEMENTS_HPERF = 20, + OGL_QUALITY_ENHANCEMENTS_NUM_VALUES = 4, + OGL_QUALITY_ENHANCEMENTS_DEFAULT = OGL_QUALITY_ENHANCEMENTS_QUAL +}; + +enum EValues_OGL_SINGLE_BACKDEPTH_BUFFER { + OGL_SINGLE_BACKDEPTH_BUFFER_DISABLE = 0x0, + OGL_SINGLE_BACKDEPTH_BUFFER_ENABLE = 0x1, + OGL_SINGLE_BACKDEPTH_BUFFER_USE_HW_DEFAULT = 0xffffffff, + OGL_SINGLE_BACKDEPTH_BUFFER_NUM_VALUES = 3, + OGL_SINGLE_BACKDEPTH_BUFFER_DEFAULT = OGL_SINGLE_BACKDEPTH_BUFFER_DISABLE +}; + +enum EValues_OGL_THREAD_CONTROL { + OGL_THREAD_CONTROL_ENABLE = 0x00000001, + OGL_THREAD_CONTROL_DISABLE = 0x00000002, + OGL_THREAD_CONTROL_NUM_VALUES = 2, + OGL_THREAD_CONTROL_DEFAULT = 0 +}; + +enum EValues_OGL_TRIPLE_BUFFER { + OGL_TRIPLE_BUFFER_DISABLED = 0x00000000, + OGL_TRIPLE_BUFFER_ENABLED = 0x00000001, + OGL_TRIPLE_BUFFER_NUM_VALUES = 2, + OGL_TRIPLE_BUFFER_DEFAULT = OGL_TRIPLE_BUFFER_DISABLED +}; + +enum EValues_OGL_VIDEO_EDITING_MODE { + OGL_VIDEO_EDITING_MODE_DISABLE = 0x00000000, + OGL_VIDEO_EDITING_MODE_ENABLE = 0x00000001, + OGL_VIDEO_EDITING_MODE_NUM_VALUES = 2, + OGL_VIDEO_EDITING_MODE_DEFAULT = OGL_VIDEO_EDITING_MODE_DISABLE +}; + +enum EValues_AA_BEHAVIOR_FLAGS { + AA_BEHAVIOR_FLAGS_NONE = 0x00000000, + AA_BEHAVIOR_FLAGS_TREAT_OVERRIDE_AS_APP_CONTROLLED = 0x00000001, + AA_BEHAVIOR_FLAGS_TREAT_OVERRIDE_AS_ENHANCE = 0x00000002, + AA_BEHAVIOR_FLAGS_DISABLE_OVERRIDE = 0x00000003, + AA_BEHAVIOR_FLAGS_TREAT_ENHANCE_AS_APP_CONTROLLED = 0x00000004, + AA_BEHAVIOR_FLAGS_TREAT_ENHANCE_AS_OVERRIDE = 0x00000008, + AA_BEHAVIOR_FLAGS_DISABLE_ENHANCE = 0x0000000c, + AA_BEHAVIOR_FLAGS_MAP_VCAA_TO_MULTISAMPLING = 0x00010000, + AA_BEHAVIOR_FLAGS_SLI_DISABLE_TRANSPARENCY_SUPERSAMPLING = 0x00020000, + AA_BEHAVIOR_FLAGS_DISABLE_CPLAA = 0x00040000, + AA_BEHAVIOR_FLAGS_SKIP_RT_DIM_CHECK_FOR_ENHANCE = 0x00080000, + AA_BEHAVIOR_FLAGS_DISABLE_SLIAA = 0x00100000, + AA_BEHAVIOR_FLAGS_DEFAULT = 0x00000000, + AA_BEHAVIOR_FLAGS_AA_RT_BPP_DIV_4 = 0xf0000000, + AA_BEHAVIOR_FLAGS_AA_RT_BPP_DIV_4_SHIFT = 28, + AA_BEHAVIOR_FLAGS_NON_AA_RT_BPP_DIV_4 = 0x0f000000, + AA_BEHAVIOR_FLAGS_NON_AA_RT_BPP_DIV_4_SHIFT = 24, + AA_BEHAVIOR_FLAGS_MASK = 0xff1f000f, + AA_BEHAVIOR_FLAGS_NUM_VALUES = 18, +}; + +enum EValues_AA_MODE_ALPHATOCOVERAGE { + AA_MODE_ALPHATOCOVERAGE_MODE_MASK = 0x00000004, + AA_MODE_ALPHATOCOVERAGE_MODE_OFF = 0x00000000, + AA_MODE_ALPHATOCOVERAGE_MODE_ON = 0x00000004, + AA_MODE_ALPHATOCOVERAGE_MODE_MAX = 0x00000004, + AA_MODE_ALPHATOCOVERAGE_NUM_VALUES = 4, + AA_MODE_ALPHATOCOVERAGE_DEFAULT = 0x00000000 +}; + +enum EValues_AA_MODE_GAMMACORRECTION { + AA_MODE_GAMMACORRECTION_MASK = 0x00000003, + AA_MODE_GAMMACORRECTION_OFF = 0x00000000, + AA_MODE_GAMMACORRECTION_ON_IF_FOS = 0x00000001, + AA_MODE_GAMMACORRECTION_ON_ALWAYS = 0x00000002, + AA_MODE_GAMMACORRECTION_MAX = 0x00000002, + AA_MODE_GAMMACORRECTION_DEFAULT = 0x00000000, + AA_MODE_GAMMACORRECTION_DEFAULT_TESLA = 0x00000002, + AA_MODE_GAMMACORRECTION_DEFAULT_FERMI = 0x00000002, + AA_MODE_GAMMACORRECTION_NUM_VALUES = 8, +}; + +enum EValues_AA_MODE_METHOD { + AA_MODE_METHOD_NONE = 0x0, + AA_MODE_METHOD_SUPERSAMPLE_2X_H = 0x1, + AA_MODE_METHOD_SUPERSAMPLE_2X_V = 0x2, + AA_MODE_METHOD_SUPERSAMPLE_1_5X1_5 = 0x2, + AA_MODE_METHOD_FREE_0x03 = 0x3, + AA_MODE_METHOD_FREE_0x04 = 0x4, + AA_MODE_METHOD_SUPERSAMPLE_4X = 0x5, + AA_MODE_METHOD_SUPERSAMPLE_4X_BIAS = 0x6, + AA_MODE_METHOD_SUPERSAMPLE_4X_GAUSSIAN = 0x7, + AA_MODE_METHOD_FREE_0x08 = 0x8, + AA_MODE_METHOD_FREE_0x09 = 0x9, + AA_MODE_METHOD_SUPERSAMPLE_9X = 0xA, + AA_MODE_METHOD_SUPERSAMPLE_9X_BIAS = 0xB, + AA_MODE_METHOD_SUPERSAMPLE_16X = 0xC, + AA_MODE_METHOD_SUPERSAMPLE_16X_BIAS = 0xD, + AA_MODE_METHOD_MULTISAMPLE_2X_DIAGONAL = 0xE, + AA_MODE_METHOD_MULTISAMPLE_2X_QUINCUNX = 0xF, + AA_MODE_METHOD_MULTISAMPLE_4X = 0x10, + AA_MODE_METHOD_FREE_0x11 = 0x11, + AA_MODE_METHOD_MULTISAMPLE_4X_GAUSSIAN = 0x12, + AA_MODE_METHOD_MIXEDSAMPLE_4X_SKEWED_4TAP = 0x13, + AA_MODE_METHOD_FREE_0x14 = 0x14, + AA_MODE_METHOD_FREE_0x15 = 0x15, + AA_MODE_METHOD_MIXEDSAMPLE_6X = 0x16, + AA_MODE_METHOD_MIXEDSAMPLE_6X_SKEWED_6TAP = 0x17, + AA_MODE_METHOD_MIXEDSAMPLE_8X = 0x18, + AA_MODE_METHOD_MIXEDSAMPLE_8X_SKEWED_8TAP = 0x19, + AA_MODE_METHOD_MIXEDSAMPLE_16X = 0x1a, + AA_MODE_METHOD_MULTISAMPLE_4X_GAMMA = 0x1b, + AA_MODE_METHOD_MULTISAMPLE_16X = 0x1c, + AA_MODE_METHOD_VCAA_32X_8v24 = 0x1d, + AA_MODE_METHOD_CORRUPTION_CHECK = 0x1e, + AA_MODE_METHOD_6X_CT = 0x1f, + AA_MODE_METHOD_MULTISAMPLE_2X_DIAGONAL_GAMMA = 0x20, + AA_MODE_METHOD_SUPERSAMPLE_4X_GAMMA = 0x21, + AA_MODE_METHOD_MULTISAMPLE_4X_FOSGAMMA = 0x22, + AA_MODE_METHOD_MULTISAMPLE_2X_DIAGONAL_FOSGAMMA = 0x23, + AA_MODE_METHOD_SUPERSAMPLE_4X_FOSGAMMA = 0x24, + AA_MODE_METHOD_MULTISAMPLE_8X = 0x25, + AA_MODE_METHOD_VCAA_8X_4v4 = 0x26, + AA_MODE_METHOD_VCAA_16X_4v12 = 0x27, + AA_MODE_METHOD_VCAA_16X_8v8 = 0x28, + AA_MODE_METHOD_MIXEDSAMPLE_32X = 0x29, + AA_MODE_METHOD_SUPERVCAA_64X_4v12 = 0x2a, + AA_MODE_METHOD_SUPERVCAA_64X_8v8 = 0x2b, + AA_MODE_METHOD_MIXEDSAMPLE_64X = 0x2c, + AA_MODE_METHOD_MIXEDSAMPLE_128X = 0x2d, + AA_MODE_METHOD_COUNT = 0x2e, + AA_MODE_METHOD_METHOD_MASK = 0x0000ffff, + AA_MODE_METHOD_METHOD_MAX = 0xf1c57815, + AA_MODE_METHOD_NUM_VALUES = 50, + AA_MODE_METHOD_DEFAULT = AA_MODE_METHOD_NONE +}; + +enum EValues_AA_MODE_REPLAY { + AA_MODE_REPLAY_SAMPLES_MASK = 0x00000070, + AA_MODE_REPLAY_SAMPLES_ONE = 0x00000000, + AA_MODE_REPLAY_SAMPLES_TWO = 0x00000010, + AA_MODE_REPLAY_SAMPLES_FOUR = 0x00000020, + AA_MODE_REPLAY_SAMPLES_EIGHT = 0x00000030, + AA_MODE_REPLAY_SAMPLES_MAX = 0x00000030, + AA_MODE_REPLAY_MODE_MASK = 0x0000000f, + AA_MODE_REPLAY_MODE_OFF = 0x00000000, + AA_MODE_REPLAY_MODE_ALPHA_TEST = 0x00000001, + AA_MODE_REPLAY_MODE_PIXEL_KILL = 0x00000002, + AA_MODE_REPLAY_MODE_DYN_BRANCH = 0x00000004, + AA_MODE_REPLAY_MODE_OPTIMAL = 0x00000004, + AA_MODE_REPLAY_MODE_ALL = 0x00000008, + AA_MODE_REPLAY_MODE_MAX = 0x0000000f, + AA_MODE_REPLAY_TRANSPARENCY = 0x00000023, + AA_MODE_REPLAY_DISALLOW_TRAA = 0x00000100, + AA_MODE_REPLAY_TRANSPARENCY_DEFAULT = 0x00000000, + AA_MODE_REPLAY_TRANSPARENCY_DEFAULT_TESLA = 0x00000000, + AA_MODE_REPLAY_TRANSPARENCY_DEFAULT_FERMI = 0x00000000, + AA_MODE_REPLAY_MASK = 0x0000017f, + AA_MODE_REPLAY_NUM_VALUES = 20, + AA_MODE_REPLAY_DEFAULT = 0x00000000 +}; + +enum EValues_AA_MODE_SELECTOR { + AA_MODE_SELECTOR_MASK = 0x00000003, + AA_MODE_SELECTOR_APP_CONTROL = 0x00000000, + AA_MODE_SELECTOR_OVERRIDE = 0x00000001, + AA_MODE_SELECTOR_ENHANCE = 0x00000002, + AA_MODE_SELECTOR_MAX = 0x00000002, + AA_MODE_SELECTOR_NUM_VALUES = 5, + AA_MODE_SELECTOR_DEFAULT = AA_MODE_SELECTOR_APP_CONTROL +}; + +enum EValues_AA_MODE_SELECTOR_SLIAA { + AA_MODE_SELECTOR_SLIAA_DISABLED = 0, + AA_MODE_SELECTOR_SLIAA_ENABLED = 1, + AA_MODE_SELECTOR_SLIAA_NUM_VALUES = 2, + AA_MODE_SELECTOR_SLIAA_DEFAULT = AA_MODE_SELECTOR_SLIAA_DISABLED +}; + +enum EValues_ANISO_MODE_LEVEL { + ANISO_MODE_LEVEL_MASK = 0x0000ffff, + ANISO_MODE_LEVEL_NONE_POINT = 0x00000000, + ANISO_MODE_LEVEL_NONE_LINEAR = 0x00000001, + ANISO_MODE_LEVEL_MAX = 0x00000010, + ANISO_MODE_LEVEL_DEFAULT = 0x00000001, + ANISO_MODE_LEVEL_NUM_VALUES = 5, +}; + +enum EValues_ANISO_MODE_SELECTOR { + ANISO_MODE_SELECTOR_MASK = 0x0000000f, + ANISO_MODE_SELECTOR_APP = 0x00000000, + ANISO_MODE_SELECTOR_USER = 0x00000001, + ANISO_MODE_SELECTOR_COND = 0x00000002, + ANISO_MODE_SELECTOR_MAX = 0x00000002, + ANISO_MODE_SELECTOR_DEFAULT = 0x00000000, + ANISO_MODE_SELECTOR_NUM_VALUES = 6, +}; + +enum EValues_APPLICATION_PROFILE_NOTIFICATION_TIMEOUT { + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_DISABLED = 0, + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_NINE_SECONDS = 9, + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_FIFTEEN_SECONDS = 15, + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_THIRTY_SECONDS = 30, + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_ONE_MINUTE = 60, + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_TWO_MINUTES = 120, + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_NUM_VALUES = 6, + APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_DEFAULT = APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_DISABLED +}; + +enum EValues_CPL_HIDDEN_PROFILE { + CPL_HIDDEN_PROFILE_DISABLED = 0, + CPL_HIDDEN_PROFILE_ENABLED = 1, + CPL_HIDDEN_PROFILE_NUM_VALUES = 2, + CPL_HIDDEN_PROFILE_DEFAULT = CPL_HIDDEN_PROFILE_DISABLED +}; + +#define CUDA_EXCLUDED_GPUS_NONE L"none" +#define CUDA_EXCLUDED_GPUS_NUM_VALUES 1 +#define CUDA_EXCLUDED_GPUS_DEFAULT CUDA_EXCLUDED_GPUS_NONE + +#define D3DOGL_GPU_MAX_POWER_DEFAULTPOWER L"0" +#define D3DOGL_GPU_MAX_POWER_NUM_VALUES 1 +#define D3DOGL_GPU_MAX_POWER_DEFAULT D3DOGL_GPU_MAX_POWER_DEFAULTPOWER + +enum EValues_EXPORT_PERF_COUNTERS { + EXPORT_PERF_COUNTERS_OFF = 0x00000000, + EXPORT_PERF_COUNTERS_ON = 0x00000001, + EXPORT_PERF_COUNTERS_NUM_VALUES = 2, + EXPORT_PERF_COUNTERS_DEFAULT = EXPORT_PERF_COUNTERS_OFF +}; + +enum EValues_FXAA_ALLOW { + FXAA_ALLOW_DISALLOWED = 0, + FXAA_ALLOW_ALLOWED = 1, + FXAA_ALLOW_NUM_VALUES = 2, + FXAA_ALLOW_DEFAULT = FXAA_ALLOW_ALLOWED +}; + +enum EValues_FXAA_ENABLE { + FXAA_ENABLE_OFF = 0, + FXAA_ENABLE_ON = 1, + FXAA_ENABLE_NUM_VALUES = 2, + FXAA_ENABLE_DEFAULT = FXAA_ENABLE_OFF +}; + +enum EValues_FXAA_INDICATOR_ENABLE { + FXAA_INDICATOR_ENABLE_OFF = 0, + FXAA_INDICATOR_ENABLE_ON = 1, + FXAA_INDICATOR_ENABLE_NUM_VALUES = 2, + FXAA_INDICATOR_ENABLE_DEFAULT = FXAA_INDICATOR_ENABLE_OFF +}; + +enum EValues_MCSFRSHOWSPLIT { + MCSFRSHOWSPLIT_DISABLED = 0x34534064, + MCSFRSHOWSPLIT_ENABLED = 0x24545582, + MCSFRSHOWSPLIT_NUM_VALUES = 2, + MCSFRSHOWSPLIT_DEFAULT = MCSFRSHOWSPLIT_DISABLED +}; + +enum EValues_NV_QUALITY_UPSCALING { + NV_QUALITY_UPSCALING_OFF = 0, + NV_QUALITY_UPSCALING_ON = 1, + NV_QUALITY_UPSCALING_NUM_VALUES = 2, + NV_QUALITY_UPSCALING_DEFAULT = NV_QUALITY_UPSCALING_OFF +}; + +enum EValues_OPTIMUS_MAXAA { + OPTIMUS_MAXAA_MIN = 0, + OPTIMUS_MAXAA_MAX = 16, + OPTIMUS_MAXAA_NUM_VALUES = 2, + OPTIMUS_MAXAA_DEFAULT = 0 +}; + +enum EValues_PHYSXINDICATOR { + PHYSXINDICATOR_DISABLED = 0x34534064, + PHYSXINDICATOR_ENABLED = 0x24545582, + PHYSXINDICATOR_NUM_VALUES = 2, + PHYSXINDICATOR_DEFAULT = PHYSXINDICATOR_DISABLED +}; + +enum EValues_PREFERRED_PSTATE { + PREFERRED_PSTATE_ADAPTIVE = 0x00000000, + PREFERRED_PSTATE_PREFER_MAX = 0x00000001, + PREFERRED_PSTATE_DRIVER_CONTROLLED = 0x00000002, + PREFERRED_PSTATE_PREFER_CONSISTENT_PERFORMANCE = 0x00000003, + PREFERRED_PSTATE_PREFER_MIN = 0x00000004, + PREFERRED_PSTATE_MIN = 0x00000000, + PREFERRED_PSTATE_MAX = 0x00000004, + PREFERRED_PSTATE_NUM_VALUES = 7, + PREFERRED_PSTATE_DEFAULT = PREFERRED_PSTATE_ADAPTIVE +}; + +enum EValues_PREVENT_UI_AF_OVERRIDE { + PREVENT_UI_AF_OVERRIDE_OFF = 0, + PREVENT_UI_AF_OVERRIDE_ON = 1, + PREVENT_UI_AF_OVERRIDE_NUM_VALUES = 2, + PREVENT_UI_AF_OVERRIDE_DEFAULT = PREVENT_UI_AF_OVERRIDE_OFF +}; + +enum EValues_PS_FRAMERATE_LIMITER { + PS_FRAMERATE_LIMITER_DISABLED = 0x00000000, + PS_FRAMERATE_LIMITER_FPS_20 = 0x00000014, + PS_FRAMERATE_LIMITER_FPS_30 = 0x0000001e, + PS_FRAMERATE_LIMITER_FPS_40 = 0x00000028, + PS_FRAMERATE_LIMITER_FPSMASK = 0x000000ff, + PS_FRAMERATE_LIMITER_FORCE_VSYNC_OFF = 0x00040000, + PS_FRAMERATE_LIMITER_GPS_WEB = 0x00080000, + PS_FRAMERATE_LIMITER_FORCE_OPTIMUS_POLICY = 0x00100000, + PS_FRAMERATE_LIMITER_DISALLOWED = 0x00200000, + PS_FRAMERATE_LIMITER_USE_CPU_WAIT = 0x00400000, + PS_FRAMERATE_LIMITER_THRESHOLD = 0x00000000, + PS_FRAMERATE_LIMITER_TEMPERATURE = 0x02000000, + PS_FRAMERATE_LIMITER_POWER = 0x04000000, + PS_FRAMERATE_LIMITER_MODEMASK = 0x0f000000, + PS_FRAMERATE_LIMITER_ACCURATE = 0x10000000, + PS_FRAMERATE_LIMITER_ALLOW_WINDOWED = 0x20000000, + PS_FRAMERATE_LIMITER_FORCEON = 0x40000000, + PS_FRAMERATE_LIMITER_ENABLED = 0x80000000, + PS_FRAMERATE_LIMITER_OPENGL_REMOTE_DESKTOP = 0xe010003c, + PS_FRAMERATE_LIMITER_MASK = 0xff7C00ff, + PS_FRAMERATE_LIMITER_NUM_VALUES = 20, + PS_FRAMERATE_LIMITER_DEFAULT = PS_FRAMERATE_LIMITER_DISABLED +}; + +enum EValues_PS_FRAMERATE_LIMITER_GPS_CTRL { + PS_FRAMERATE_LIMITER_GPS_CTRL_DISABLED = 0x00000000, + PS_FRAMERATE_LIMITER_GPS_CTRL_DECREASE_FILTER_MASK = 0x000001FF, + PS_FRAMERATE_LIMITER_GPS_CTRL_PAUSE_TIME_MASK = 0x0000FE00, + PS_FRAMERATE_LIMITER_GPS_CTRL_PAUSE_TIME_SHIFT = 9, + PS_FRAMERATE_LIMITER_GPS_CTRL_TARGET_RENDER_TIME_MASK = 0x00FF0000, + PS_FRAMERATE_LIMITER_GPS_CTRL_TARGET_RENDER_TIME_SHIFT = 16, + PS_FRAMERATE_LIMITER_GPS_CTRL_PERF_STEP_SIZE_MASK = 0x1F000000, + PS_FRAMERATE_LIMITER_GPS_CTRL_PERF_STEP_SIZE_SHIFT = 24, + PS_FRAMERATE_LIMITER_GPS_CTRL_INCREASE_FILTER_MASK = 0xE0000000, + PS_FRAMERATE_LIMITER_GPS_CTRL_INCREASE_FILTER_SHIFT = 29, + PS_FRAMERATE_LIMITER_GPS_CTRL_OPTIMAL_SETTING = 0x4A5A3219, + PS_FRAMERATE_LIMITER_GPS_CTRL_NUM_VALUES = 11, + PS_FRAMERATE_LIMITER_GPS_CTRL_DEFAULT = PS_FRAMERATE_LIMITER_GPS_CTRL_DISABLED +}; + +enum EValues_PS_FRAMERATE_MONITOR_CTRL { + PS_FRAMERATE_MONITOR_CTRL_DISABLED = 0x00000000, + PS_FRAMERATE_MONITOR_CTRL_THRESHOLD_PCT_MASK = 0x000000FF, + PS_FRAMERATE_MONITOR_CTRL_MOVING_AVG_X_MASK = 0x00000F00, + PS_FRAMERATE_MONITOR_CTRL_MOVING_AVG_X_SHIFT = 8, + PS_FRAMERATE_MONITOR_CTRL_OPTIMAL_SETTING = 0x00000364, + PS_FRAMERATE_MONITOR_CTRL_NUM_VALUES = 5, + PS_FRAMERATE_MONITOR_CTRL_DEFAULT = PS_FRAMERATE_MONITOR_CTRL_DISABLED +}; + +enum EValues_SHIM_MCCOMPAT { + SHIM_MCCOMPAT_INTEGRATED = 0x00000000, + SHIM_MCCOMPAT_ENABLE = 0x00000001, + SHIM_MCCOMPAT_USER_EDITABLE = 0x00000002, + SHIM_MCCOMPAT_MASK = 0x00000003, + SHIM_MCCOMPAT_VIDEO_MASK = 0x00000004, + SHIM_MCCOMPAT_VARYING_BIT = 0x00000008, + SHIM_MCCOMPAT_AUTO_SELECT = 0x00000010, + SHIM_MCCOMPAT_OVERRIDE_BIT = 0x80000000, + SHIM_MCCOMPAT_NUM_VALUES = 8, + SHIM_MCCOMPAT_DEFAULT = SHIM_MCCOMPAT_AUTO_SELECT +}; + +enum EValues_SHIM_RENDERING_MODE { + SHIM_RENDERING_MODE_INTEGRATED = 0x00000000, + SHIM_RENDERING_MODE_ENABLE = 0x00000001, + SHIM_RENDERING_MODE_USER_EDITABLE = 0x00000002, + SHIM_RENDERING_MODE_MASK = 0x00000003, + SHIM_RENDERING_MODE_VIDEO_MASK = 0x00000004, + SHIM_RENDERING_MODE_VARYING_BIT = 0x00000008, + SHIM_RENDERING_MODE_AUTO_SELECT = 0x00000010, + SHIM_RENDERING_MODE_OVERRIDE_BIT = 0x80000000, + SHIM_RENDERING_MODE_NUM_VALUES = 8, + SHIM_RENDERING_MODE_DEFAULT = SHIM_RENDERING_MODE_AUTO_SELECT +}; + +enum EValues_SHIM_RENDERING_OPTIONS { + SHIM_RENDERING_OPTIONS_DEFAULT_RENDERING_MODE = 0x00000000, + SHIM_RENDERING_OPTIONS_DISABLE_ASYNC_PRESENT = 0x00000001, + SHIM_RENDERING_OPTIONS_EHSHELL_DETECT = 0x00000002, + SHIM_RENDERING_OPTIONS_FLASHPLAYER_HOST_DETECT = 0x00000004, + SHIM_RENDERING_OPTIONS_VIDEO_DRM_APP_DETECT = 0x00000008, + SHIM_RENDERING_OPTIONS_IGNORE_OVERRIDES = 0x00000010, + SHIM_RENDERING_OPTIONS_CHILDPROCESS_DETECT = 0x00000020, + SHIM_RENDERING_OPTIONS_ENABLE_DWM_ASYNC_PRESENT = 0x00000040, + SHIM_RENDERING_OPTIONS_PARENTPROCESS_DETECT = 0x00000080, + SHIM_RENDERING_OPTIONS_ALLOW_INHERITANCE = 0x00000100, + SHIM_RENDERING_OPTIONS_DISABLE_WRAPPERS = 0x00000200, + SHIM_RENDERING_OPTIONS_DISABLE_DXGI_WRAPPERS = 0x00000400, + SHIM_RENDERING_OPTIONS_PRUNE_UNSUPPORTED_FORMATS = 0x00000800, + SHIM_RENDERING_OPTIONS_ENABLE_ALPHA_FORMAT = 0x00001000, + SHIM_RENDERING_OPTIONS_IGPU_TRANSCODING = 0x00002000, + SHIM_RENDERING_OPTIONS_DISABLE_CUDA = 0x00004000, + SHIM_RENDERING_OPTIONS_ALLOW_CP_CAPS_FOR_VIDEO = 0x00008000, + SHIM_RENDERING_OPTIONS_IGPU_TRANSCODING_FWD_OPTIMUS = 0x00010000, + SHIM_RENDERING_OPTIONS_DISABLE_DURING_SECURE_BOOT = 0x00020000, + SHIM_RENDERING_OPTIONS_INVERT_FOR_QUADRO = 0x00040000, + SHIM_RENDERING_OPTIONS_INVERT_FOR_MSHYBRID = 0x00080000, + SHIM_RENDERING_OPTIONS_REGISTER_PROCESS_ENABLE_GOLD = 0x00100000, + SHIM_RENDERING_OPTIONS_HANDLE_WINDOWED_MODE_PERF_OPT = 0x00200000, + SHIM_RENDERING_OPTIONS_HANDLE_WIN7_ASYNC_RUNTIME_BUG = 0x00400000, + SHIM_RENDERING_OPTIONS_NUM_VALUES = 24, + SHIM_RENDERING_OPTIONS_DEFAULT = SHIM_RENDERING_OPTIONS_DEFAULT_RENDERING_MODE +}; + +enum EValues_SLI_GPU_COUNT { + SLI_GPU_COUNT_AUTOSELECT = 0x00000000, + SLI_GPU_COUNT_ONE = 0x00000001, + SLI_GPU_COUNT_TWO = 0x00000002, + SLI_GPU_COUNT_THREE = 0x00000003, + SLI_GPU_COUNT_FOUR = 0x00000004, + SLI_GPU_COUNT_NUM_VALUES = 5, + SLI_GPU_COUNT_DEFAULT = SLI_GPU_COUNT_AUTOSELECT +}; + +enum EValues_SLI_PREDEFINED_GPU_COUNT { + SLI_PREDEFINED_GPU_COUNT_AUTOSELECT = 0x00000000, + SLI_PREDEFINED_GPU_COUNT_ONE = 0x00000001, + SLI_PREDEFINED_GPU_COUNT_TWO = 0x00000002, + SLI_PREDEFINED_GPU_COUNT_THREE = 0x00000003, + SLI_PREDEFINED_GPU_COUNT_FOUR = 0x00000004, + SLI_PREDEFINED_GPU_COUNT_NUM_VALUES = 5, + SLI_PREDEFINED_GPU_COUNT_DEFAULT = SLI_PREDEFINED_GPU_COUNT_AUTOSELECT +}; + +enum EValues_SLI_PREDEFINED_GPU_COUNT_DX10 { + SLI_PREDEFINED_GPU_COUNT_DX10_AUTOSELECT = 0x00000000, + SLI_PREDEFINED_GPU_COUNT_DX10_ONE = 0x00000001, + SLI_PREDEFINED_GPU_COUNT_DX10_TWO = 0x00000002, + SLI_PREDEFINED_GPU_COUNT_DX10_THREE = 0x00000003, + SLI_PREDEFINED_GPU_COUNT_DX10_FOUR = 0x00000004, + SLI_PREDEFINED_GPU_COUNT_DX10_NUM_VALUES = 5, + SLI_PREDEFINED_GPU_COUNT_DX10_DEFAULT = SLI_PREDEFINED_GPU_COUNT_DX10_AUTOSELECT +}; + +enum EValues_SLI_PREDEFINED_MODE { + SLI_PREDEFINED_MODE_AUTOSELECT = 0x00000000, + SLI_PREDEFINED_MODE_FORCE_SINGLE = 0x00000001, + SLI_PREDEFINED_MODE_FORCE_AFR = 0x00000002, + SLI_PREDEFINED_MODE_FORCE_AFR2 = 0x00000003, + SLI_PREDEFINED_MODE_FORCE_SFR = 0x00000004, + SLI_PREDEFINED_MODE_FORCE_AFR_OF_SFR__FALLBACK_3AFR = 0x00000005, + SLI_PREDEFINED_MODE_NUM_VALUES = 6, + SLI_PREDEFINED_MODE_DEFAULT = SLI_PREDEFINED_MODE_AUTOSELECT +}; + +enum EValues_SLI_PREDEFINED_MODE_DX10 { + SLI_PREDEFINED_MODE_DX10_AUTOSELECT = 0x00000000, + SLI_PREDEFINED_MODE_DX10_FORCE_SINGLE = 0x00000001, + SLI_PREDEFINED_MODE_DX10_FORCE_AFR = 0x00000002, + SLI_PREDEFINED_MODE_DX10_FORCE_AFR2 = 0x00000003, + SLI_PREDEFINED_MODE_DX10_FORCE_SFR = 0x00000004, + SLI_PREDEFINED_MODE_DX10_FORCE_AFR_OF_SFR__FALLBACK_3AFR = 0x00000005, + SLI_PREDEFINED_MODE_DX10_NUM_VALUES = 6, + SLI_PREDEFINED_MODE_DX10_DEFAULT = SLI_PREDEFINED_MODE_DX10_AUTOSELECT +}; + +enum EValues_SLI_RENDERING_MODE { + SLI_RENDERING_MODE_AUTOSELECT = 0x00000000, + SLI_RENDERING_MODE_FORCE_SINGLE = 0x00000001, + SLI_RENDERING_MODE_FORCE_AFR = 0x00000002, + SLI_RENDERING_MODE_FORCE_AFR2 = 0x00000003, + SLI_RENDERING_MODE_FORCE_SFR = 0x00000004, + SLI_RENDERING_MODE_FORCE_AFR_OF_SFR__FALLBACK_3AFR = 0x00000005, + SLI_RENDERING_MODE_NUM_VALUES = 6, + SLI_RENDERING_MODE_DEFAULT = SLI_RENDERING_MODE_AUTOSELECT +}; + +enum EValues_VRPRERENDERLIMIT { + VRPRERENDERLIMIT_MIN = 0x00, + VRPRERENDERLIMIT_MAX = 0xff, + VRPRERENDERLIMIT_APP_CONTROLLED = 0x00, + VRPRERENDERLIMIT_DEFAULT = 0x01, + VRPRERENDERLIMIT_NUM_VALUES = 4, +}; + +enum EValues_VRRFEATUREINDICATOR { + VRRFEATUREINDICATOR_DISABLED = 0x0, + VRRFEATUREINDICATOR_ENABLED = 0x1, + VRRFEATUREINDICATOR_NUM_VALUES = 2, + VRRFEATUREINDICATOR_DEFAULT = VRRFEATUREINDICATOR_ENABLED +}; + +enum EValues_VRROVERLAYINDICATOR { + VRROVERLAYINDICATOR_DISABLED = 0x0, + VRROVERLAYINDICATOR_ENABLED = 0x1, + VRROVERLAYINDICATOR_NUM_VALUES = 2, + VRROVERLAYINDICATOR_DEFAULT = VRROVERLAYINDICATOR_ENABLED +}; + +enum EValues_VRRREQUESTSTATE { + VRRREQUESTSTATE_DISABLED = 0x0, + VRRREQUESTSTATE_FULLSCREEN_ONLY = 0x1, + VRRREQUESTSTATE_FULLSCREEN_AND_WINDOWED = 0x2, + VRRREQUESTSTATE_NUM_VALUES = 3, + VRRREQUESTSTATE_DEFAULT = VRRREQUESTSTATE_FULLSCREEN_ONLY +}; + +enum EValues_VRR_APP_OVERRIDE { + VRR_APP_OVERRIDE_ALLOW = 0, + VRR_APP_OVERRIDE_FORCE_OFF = 1, + VRR_APP_OVERRIDE_DISALLOW = 2, + VRR_APP_OVERRIDE_ULMB = 3, + VRR_APP_OVERRIDE_FIXED_REFRESH = 4, + VRR_APP_OVERRIDE_NUM_VALUES = 5, + VRR_APP_OVERRIDE_DEFAULT = VRR_APP_OVERRIDE_ALLOW +}; + +enum EValues_VRR_APP_OVERRIDE_REQUEST_STATE { + VRR_APP_OVERRIDE_REQUEST_STATE_ALLOW = 0, + VRR_APP_OVERRIDE_REQUEST_STATE_FORCE_OFF = 1, + VRR_APP_OVERRIDE_REQUEST_STATE_DISALLOW = 2, + VRR_APP_OVERRIDE_REQUEST_STATE_ULMB = 3, + VRR_APP_OVERRIDE_REQUEST_STATE_FIXED_REFRESH = 4, + VRR_APP_OVERRIDE_REQUEST_STATE_NUM_VALUES = 5, + VRR_APP_OVERRIDE_REQUEST_STATE_DEFAULT = VRR_APP_OVERRIDE_REQUEST_STATE_ALLOW +}; + +enum EValues_VRR_MODE { + VRR_MODE_DISABLED = 0x0, + VRR_MODE_FULLSCREEN_ONLY = 0x1, + VRR_MODE_FULLSCREEN_AND_WINDOWED = 0x2, + VRR_MODE_NUM_VALUES = 3, + VRR_MODE_DEFAULT = VRR_MODE_FULLSCREEN_ONLY +}; + +enum EValues_VSYNCSMOOTHAFR { + VSYNCSMOOTHAFR_OFF = 0x00000000, + VSYNCSMOOTHAFR_ON = 0x00000001, + VSYNCSMOOTHAFR_NUM_VALUES = 2, + VSYNCSMOOTHAFR_DEFAULT = VSYNCSMOOTHAFR_OFF +}; + +enum EValues_VSYNCVRRCONTROL { + VSYNCVRRCONTROL_DISABLE = 0x00000000, + VSYNCVRRCONTROL_ENABLE = 0x00000001, + VSYNCVRRCONTROL_NOTSUPPORTED = 0x9f95128e, + VSYNCVRRCONTROL_NUM_VALUES = 3, + VSYNCVRRCONTROL_DEFAULT = VSYNCVRRCONTROL_ENABLE +}; + +enum EValues_VSYNC_BEHAVIOR_FLAGS { + VSYNC_BEHAVIOR_FLAGS_NONE = 0x00000000, + VSYNC_BEHAVIOR_FLAGS_DEFAULT = 0x00000000, + VSYNC_BEHAVIOR_FLAGS_IGNORE_FLIPINTERVAL_MULTIPLE = 0x00000001, + VSYNC_BEHAVIOR_FLAGS_NUM_VALUES = 3, +}; + +enum EValues_WKS_API_STEREO_EYES_EXCHANGE { + WKS_API_STEREO_EYES_EXCHANGE_OFF = 0, + WKS_API_STEREO_EYES_EXCHANGE_ON = 1, + WKS_API_STEREO_EYES_EXCHANGE_NUM_VALUES = 2, + WKS_API_STEREO_EYES_EXCHANGE_DEFAULT = WKS_API_STEREO_EYES_EXCHANGE_OFF +}; + +enum EValues_WKS_API_STEREO_MODE { + WKS_API_STEREO_MODE_SHUTTER_GLASSES = 0, + WKS_API_STEREO_MODE_VERTICAL_INTERLACED = 1, + WKS_API_STEREO_MODE_TWINVIEW = 2, + WKS_API_STEREO_MODE_NV17_SHUTTER_GLASSES_AUTO = 3, + WKS_API_STEREO_MODE_NV17_SHUTTER_GLASSES_DAC0 = 4, + WKS_API_STEREO_MODE_NV17_SHUTTER_GLASSES_DAC1 = 5, + WKS_API_STEREO_MODE_COLOR_LINE = 6, + WKS_API_STEREO_MODE_COLOR_INTERLEAVED = 7, + WKS_API_STEREO_MODE_ANAGLYPH = 8, + WKS_API_STEREO_MODE_HORIZONTAL_INTERLACED = 9, + WKS_API_STEREO_MODE_SIDE_FIELD = 10, + WKS_API_STEREO_MODE_SUB_FIELD = 11, + WKS_API_STEREO_MODE_CHECKERBOARD = 12, + WKS_API_STEREO_MODE_INVERSE_CHECKERBOARD = 13, + WKS_API_STEREO_MODE_TRIDELITY_SL = 14, + WKS_API_STEREO_MODE_TRIDELITY_MV = 15, + WKS_API_STEREO_MODE_SEEFRONT = 16, + WKS_API_STEREO_MODE_STEREO_MIRROR = 17, + WKS_API_STEREO_MODE_FRAME_SEQUENTIAL = 18, + WKS_API_STEREO_MODE_AUTODETECT_PASSIVE_MODE = 19, + WKS_API_STEREO_MODE_AEGIS_DT_FRAME_SEQUENTIAL = 20, + WKS_API_STEREO_MODE_OEM_EMITTER_FRAME_SEQUENTIAL = 21, + WKS_API_STEREO_MODE_USE_HW_DEFAULT = 0xffffffff, + WKS_API_STEREO_MODE_DEFAULT_GL = 3, + WKS_API_STEREO_MODE_NUM_VALUES = 24, + WKS_API_STEREO_MODE_DEFAULT = WKS_API_STEREO_MODE_SHUTTER_GLASSES +}; + +enum EValues_WKS_MEMORY_ALLOCATION_POLICY { + WKS_MEMORY_ALLOCATION_POLICY_AS_NEEDED = 0x0, + WKS_MEMORY_ALLOCATION_POLICY_MODERATE_PRE_ALLOCATION = 0x1, + WKS_MEMORY_ALLOCATION_POLICY_AGGRESSIVE_PRE_ALLOCATION = 0x2, + WKS_MEMORY_ALLOCATION_POLICY_NUM_VALUES = 3, + WKS_MEMORY_ALLOCATION_POLICY_DEFAULT = WKS_MEMORY_ALLOCATION_POLICY_AS_NEEDED +}; + +enum EValues_WKS_STEREO_DONGLE_SUPPORT { + WKS_STEREO_DONGLE_SUPPORT_OFF = 0, + WKS_STEREO_DONGLE_SUPPORT_DAC = 1, + WKS_STEREO_DONGLE_SUPPORT_DLP = 2, + WKS_STEREO_DONGLE_SUPPORT_NUM_VALUES = 3, + WKS_STEREO_DONGLE_SUPPORT_DEFAULT = WKS_STEREO_DONGLE_SUPPORT_OFF +}; + +enum EValues_WKS_STEREO_SUPPORT { + WKS_STEREO_SUPPORT_OFF = 0, + WKS_STEREO_SUPPORT_ON = 1, + WKS_STEREO_SUPPORT_NUM_VALUES = 2, + WKS_STEREO_SUPPORT_DEFAULT = WKS_STEREO_SUPPORT_OFF +}; + +enum EValues_WKS_STEREO_SWAP_MODE { + WKS_STEREO_SWAP_MODE_APPLICATION_CONTROL = 0x0, + WKS_STEREO_SWAP_MODE_PER_EYE = 0x1, + WKS_STEREO_SWAP_MODE_PER_EYE_PAIR = 0x2, + WKS_STEREO_SWAP_MODE_LEGACY_BEHAVIOR = 0x3, + WKS_STEREO_SWAP_MODE_NUM_VALUES = 4, + WKS_STEREO_SWAP_MODE_DEFAULT = WKS_STEREO_SWAP_MODE_APPLICATION_CONTROL +}; + +enum EValues_AO_MODE { + AO_MODE_OFF = 0, + AO_MODE_LOW = 1, + AO_MODE_MEDIUM = 2, + AO_MODE_HIGH = 3, + AO_MODE_NUM_VALUES = 4, + AO_MODE_DEFAULT = AO_MODE_OFF +}; + +enum EValues_AO_MODE_ACTIVE { + AO_MODE_ACTIVE_DISABLED = 0, + AO_MODE_ACTIVE_ENABLED = 1, + AO_MODE_ACTIVE_NUM_VALUES = 2, + AO_MODE_ACTIVE_DEFAULT = AO_MODE_ACTIVE_DISABLED +}; + +enum EValues_AUTO_LODBIASADJUST { + AUTO_LODBIASADJUST_OFF = 0x00000000, + AUTO_LODBIASADJUST_ON = 0x00000001, + AUTO_LODBIASADJUST_NUM_VALUES = 2, + AUTO_LODBIASADJUST_DEFAULT = AUTO_LODBIASADJUST_ON +}; + +enum EValues_LODBIASADJUST { + LODBIASADJUST_MIN = 0xffffff80, + LODBIASADJUST_MAX = 128, + LODBIASADJUST_NUM_VALUES = 2, + LODBIASADJUST_DEFAULT = 0 +}; + +enum EValues_MAXWELL_B_SAMPLE_INTERLEAVE { + MAXWELL_B_SAMPLE_INTERLEAVE_OFF = 0, + MAXWELL_B_SAMPLE_INTERLEAVE_ON = 1, + MAXWELL_B_SAMPLE_INTERLEAVE_NUM_VALUES = 2, + MAXWELL_B_SAMPLE_INTERLEAVE_DEFAULT = MAXWELL_B_SAMPLE_INTERLEAVE_OFF +}; + +enum EValues_PRERENDERLIMIT { + PRERENDERLIMIT_MIN = 0x00, + PRERENDERLIMIT_MAX = 0xff, + PRERENDERLIMIT_APP_CONTROLLED = 0x00, + PRERENDERLIMIT_NUM_VALUES = 3, + PRERENDERLIMIT_DEFAULT = PRERENDERLIMIT_APP_CONTROLLED +}; + +enum EValues_PS_SHADERDISKCACHE { + PS_SHADERDISKCACHE_OFF = 0x00000000, + PS_SHADERDISKCACHE_ON = 0x00000001, + PS_SHADERDISKCACHE_NUM_VALUES = 2, + PS_SHADERDISKCACHE_DEFAULT = 0x1 +}; + +enum EValues_PS_TEXFILTER_ANISO_OPTS2 { + PS_TEXFILTER_ANISO_OPTS2_OFF = 0x00000000, + PS_TEXFILTER_ANISO_OPTS2_ON = 0x00000001, + PS_TEXFILTER_ANISO_OPTS2_NUM_VALUES = 2, + PS_TEXFILTER_ANISO_OPTS2_DEFAULT = PS_TEXFILTER_ANISO_OPTS2_OFF +}; + +enum EValues_PS_TEXFILTER_BILINEAR_IN_ANISO { + PS_TEXFILTER_BILINEAR_IN_ANISO_OFF = 0x00000000, + PS_TEXFILTER_BILINEAR_IN_ANISO_ON = 0x00000001, + PS_TEXFILTER_BILINEAR_IN_ANISO_NUM_VALUES = 2, + PS_TEXFILTER_BILINEAR_IN_ANISO_DEFAULT = PS_TEXFILTER_BILINEAR_IN_ANISO_OFF +}; + +enum EValues_PS_TEXFILTER_DISABLE_TRILIN_SLOPE { + PS_TEXFILTER_DISABLE_TRILIN_SLOPE_OFF = 0x00000000, + PS_TEXFILTER_DISABLE_TRILIN_SLOPE_ON = 0x00000001, + PS_TEXFILTER_DISABLE_TRILIN_SLOPE_NUM_VALUES = 2, + PS_TEXFILTER_DISABLE_TRILIN_SLOPE_DEFAULT = PS_TEXFILTER_DISABLE_TRILIN_SLOPE_OFF +}; + +enum EValues_PS_TEXFILTER_NO_NEG_LODBIAS { + PS_TEXFILTER_NO_NEG_LODBIAS_OFF = 0x00000000, + PS_TEXFILTER_NO_NEG_LODBIAS_ON = 0x00000001, + PS_TEXFILTER_NO_NEG_LODBIAS_NUM_VALUES = 2, + PS_TEXFILTER_NO_NEG_LODBIAS_DEFAULT = PS_TEXFILTER_NO_NEG_LODBIAS_OFF +}; + +enum EValues_QUALITY_ENHANCEMENTS { + QUALITY_ENHANCEMENTS_HIGHQUALITY = 0xfffffff6, + QUALITY_ENHANCEMENTS_QUALITY = 0x00000000, + QUALITY_ENHANCEMENTS_PERFORMANCE = 0x0000000a, + QUALITY_ENHANCEMENTS_HIGHPERFORMANCE = 0x00000014, + QUALITY_ENHANCEMENTS_NUM_VALUES = 4, + QUALITY_ENHANCEMENTS_DEFAULT = QUALITY_ENHANCEMENTS_QUALITY +}; + +enum EValues_REFRESH_RATE_OVERRIDE { + REFRESH_RATE_OVERRIDE_APPLICATION_CONTROLLED = 0, + REFRESH_RATE_OVERRIDE_HIGHEST_AVAILABLE = 1, + REFRESH_RATE_OVERRIDE_NUM_VALUES = 2, + REFRESH_RATE_OVERRIDE_DEFAULT = REFRESH_RATE_OVERRIDE_APPLICATION_CONTROLLED +}; + +enum EValues_SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE { + SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_OFF = 0x00000000, + SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_ON = 0x00000001, + SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_NUM_VALUES = 2, + SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_DEFAULT = SET_POWER_THROTTLE_FOR_PCIe_COMPLIANCE_OFF +}; + +enum EValues_SET_VAB_DATA { + SET_VAB_DATA_ZERO = 0x00000000, + SET_VAB_DATA_UINT_ONE = 0x00000001, + SET_VAB_DATA_FLOAT_ONE = 0x3f800000, + SET_VAB_DATA_FLOAT_POS_INF = 0x7f800000, + SET_VAB_DATA_FLOAT_NAN = 0x7fc00000, + SET_VAB_DATA_USE_API_DEFAULTS = 0xffffffff, + SET_VAB_DATA_NUM_VALUES = 6, + SET_VAB_DATA_DEFAULT = SET_VAB_DATA_USE_API_DEFAULTS +}; + +enum EValues_VSYNCMODE { + VSYNCMODE_PASSIVE = 0x60925292, + VSYNCMODE_FORCEOFF = 0x08416747, + VSYNCMODE_FORCEON = 0x47814940, + VSYNCMODE_FLIPINTERVAL2 = 0x32610244, + VSYNCMODE_FLIPINTERVAL3 = 0x71271021, + VSYNCMODE_FLIPINTERVAL4 = 0x13245256, + VSYNCMODE_NUM_VALUES = 6, + VSYNCMODE_DEFAULT = VSYNCMODE_PASSIVE +}; + +enum EValues_VSYNCTEARCONTROL { + VSYNCTEARCONTROL_DISABLE = 0x96861077, + VSYNCTEARCONTROL_ENABLE = 0x99941284, + VSYNCTEARCONTROL_NUM_VALUES = 2, + VSYNCTEARCONTROL_DEFAULT = VSYNCTEARCONTROL_DISABLE +}; + + + +typedef struct _SettingDWORDNameString { + NvU32 settingId; + const wchar_t * settingNameString; + NvU32 numSettingValues; + NvU32 *settingValues; + NvU32 defaultValue; +} SettingDWORDNameString; + +typedef struct _SettingWSTRINGNameString { + NvU32 settingId; + const wchar_t * settingNameString; + NvU32 numSettingValues; + const wchar_t **settingValues; + const wchar_t * defaultValue; +} SettingWSTRINGNameString; + + +#endif // _NVAPI_DRIVER_SETTINGS_H_ + diff --git a/nspector/Native/NVAPI/NvApiDriverSettings.tt b/nspector/Native/NVAPI/NvApiDriverSettings.tt new file mode 100644 index 0000000..72f8325 --- /dev/null +++ b/nspector/Native/NVAPI/NvApiDriverSettings.tt @@ -0,0 +1,42 @@ +<#@ template debug="false" hostspecific="true" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ import namespace="System.IO" #> +<#@ import namespace="System.Text.RegularExpressions" #> +<#@ output extension=".cs" #> +namespace nspector.Native.NvApi.DriverSettings +{ +<# + string absolutePath = Host.ResolvePath("NvApiDriverSettings.h"); + string contents = File.ReadAllText(absolutePath); + + string pattern = "enum\\s+(?.*?)\\{(?.*?)\\}"; + var rx = new Regex(pattern, RegexOptions.Singleline); + foreach (Match m in rx.Matches(contents)) + { + PushIndent("\t"); + + string enumSrc = m.Result("${enums}").Trim(); + string enumType = ""; + + if (Regex.IsMatch(enumSrc, "0x[A-Fa-f0-9]{8}L")) + enumType = " : ulong"; + else if (Regex.IsMatch(enumSrc, @".*?=\s+-.*?")) + enumType = " : int"; + else + enumType = " : uint"; + + WriteLine("public enum " + m.Result("${name}").Trim() + enumType + " {"); + + WriteLine("\t" + enumSrc); + + WriteLine("}"); + + PopIndent(); + WriteLine(""); + } + +#> +} \ No newline at end of file diff --git a/nspector/Native/NVAPI/NvapiDrsWrapper.cs b/nspector/Native/NVAPI/NvapiDrsWrapper.cs new file mode 100644 index 0000000..1cf841c --- /dev/null +++ b/nspector/Native/NVAPI/NvapiDrsWrapper.cs @@ -0,0 +1,677 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; + +namespace nspector.Native.NVAPI2 +{ + + public enum NvAPI_Status : int + { + NVAPI_OK = 0, + NVAPI_ERROR = -1, + NVAPI_LIBRARY_NOT_FOUND = -2, + NVAPI_NO_IMPLEMENTATION = -3, + NVAPI_API_NOT_INITIALIZED = -4, + NVAPI_INVALID_ARGUMENT = -5, + NVAPI_NVIDIA_DEVICE_NOT_FOUND = -6, + NVAPI_END_ENUMERATION = -7, + NVAPI_INVALID_HANDLE = -8, + NVAPI_INCOMPATIBLE_STRUCT_VERSION = -9, + NVAPI_HANDLE_INVALIDATED = -10, + NVAPI_OPENGL_CONTEXT_NOT_CURRENT = -11, + NVAPI_INVALID_POINTER = -14, + NVAPI_NO_GL_EXPERT = -12, + NVAPI_INSTRUMENTATION_DISABLED = -13, + NVAPI_NO_GL_NSIGHT = -15, + NVAPI_EXPECTED_LOGICAL_GPU_HANDLE = -100, + NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE = -101, + NVAPI_EXPECTED_DISPLAY_HANDLE = -102, + NVAPI_INVALID_COMBINATION = -103, + NVAPI_NOT_SUPPORTED = -104, + NVAPI_PORTID_NOT_FOUND = -105, + NVAPI_EXPECTED_UNATTACHED_DISPLAY_HANDLE = -106, + NVAPI_INVALID_PERF_LEVEL = -107, + NVAPI_DEVICE_BUSY = -108, + NVAPI_NV_PERSIST_FILE_NOT_FOUND = -109, + NVAPI_PERSIST_DATA_NOT_FOUND = -110, + NVAPI_EXPECTED_TV_DISPLAY = -111, + NVAPI_EXPECTED_TV_DISPLAY_ON_DCONNECTOR = -112, + NVAPI_NO_ACTIVE_SLI_TOPOLOGY = -113, + NVAPI_SLI_RENDERING_MODE_NOTALLOWED = -114, + NVAPI_EXPECTED_DIGITAL_FLAT_PANEL = -115, + NVAPI_ARGUMENT_EXCEED_MAX_SIZE = -116, + NVAPI_DEVICE_SWITCHING_NOT_ALLOWED = -117, + NVAPI_TESTING_CLOCKS_NOT_SUPPORTED = -118, + NVAPI_UNKNOWN_UNDERSCAN_CONFIG = -119, + NVAPI_TIMEOUT_RECONFIGURING_GPU_TOPO = -120, + NVAPI_DATA_NOT_FOUND = -121, + NVAPI_EXPECTED_ANALOG_DISPLAY = -122, + NVAPI_NO_VIDLINK = -123, + NVAPI_REQUIRES_REBOOT = -124, + NVAPI_INVALID_HYBRID_MODE = -125, + NVAPI_MIXED_TARGET_TYPES = -126, + NVAPI_SYSWOW64_NOT_SUPPORTED = -127, + NVAPI_IMPLICIT_SET_GPU_TOPOLOGY_CHANGE_NOT_ALLOWED = -128, + NVAPI_REQUEST_USER_TO_CLOSE_NON_MIGRATABLE_APPS = -129, + NVAPI_OUT_OF_MEMORY = -130, + NVAPI_WAS_STILL_DRAWING = -131, + NVAPI_FILE_NOT_FOUND = -132, + NVAPI_TOO_MANY_UNIQUE_STATE_OBJECTS = -133, + NVAPI_INVALID_CALL = -134, + NVAPI_D3D10_1_LIBRARY_NOT_FOUND = -135, + NVAPI_FUNCTION_NOT_FOUND = -136, + NVAPI_INVALID_USER_PRIVILEGE = -137, + NVAPI_EXPECTED_NON_PRIMARY_DISPLAY_HANDLE = -138, + NVAPI_EXPECTED_COMPUTE_GPU_HANDLE = -139, + NVAPI_STEREO_NOT_INITIALIZED = -140, + NVAPI_STEREO_REGISTRY_ACCESS_FAILED = -141, + NVAPI_STEREO_REGISTRY_PROFILE_TYPE_NOT_SUPPORTED = -142, + NVAPI_STEREO_REGISTRY_VALUE_NOT_SUPPORTED = -143, + NVAPI_STEREO_NOT_ENABLED = -144, + NVAPI_STEREO_NOT_TURNED_ON = -145, + NVAPI_STEREO_INVALID_DEVICE_INTERFACE = -146, + NVAPI_STEREO_PARAMETER_OUT_OF_RANGE = -147, + NVAPI_STEREO_FRUSTUM_ADJUST_MODE_NOT_SUPPORTED = -148, + NVAPI_TOPO_NOT_POSSIBLE = -149, + NVAPI_MODE_CHANGE_FAILED = -150, + NVAPI_D3D11_LIBRARY_NOT_FOUND = -151, + NVAPI_INVALID_ADDRESS = -152, + NVAPI_STRING_TOO_SMALL = -153, + NVAPI_MATCHING_DEVICE_NOT_FOUND = -154, + NVAPI_DRIVER_RUNNING = -155, + NVAPI_DRIVER_NOTRUNNING = -156, + NVAPI_ERROR_DRIVER_RELOAD_REQUIRED = -157, + NVAPI_SET_NOT_ALLOWED = -158, + NVAPI_ADVANCED_DISPLAY_TOPOLOGY_REQUIRED = -159, + NVAPI_SETTING_NOT_FOUND = -160, + NVAPI_SETTING_SIZE_TOO_LARGE = -161, + NVAPI_TOO_MANY_SETTINGS_IN_PROFILE = -162, + NVAPI_PROFILE_NOT_FOUND = -163, + NVAPI_PROFILE_NAME_IN_USE = -164, + NVAPI_PROFILE_NAME_EMPTY = -165, + NVAPI_EXECUTABLE_NOT_FOUND = -166, + NVAPI_EXECUTABLE_ALREADY_IN_USE = -167, + NVAPI_DATATYPE_MISMATCH = -168, + NVAPI_PROFILE_REMOVED = -169, + NVAPI_UNREGISTERED_RESOURCE = -170, + NVAPI_ID_OUT_OF_RANGE = -171, + NVAPI_DISPLAYCONFIG_VALIDATION_FAILED = -172, + NVAPI_DPMST_CHANGED = -173, + NVAPI_INSUFFICIENT_BUFFER = -174, + NVAPI_ACCESS_DENIED = -175, + NVAPI_MOSAIC_NOT_ACTIVE = -176, + NVAPI_SHARE_RESOURCE_RELOCATED = -177, + NVAPI_REQUEST_USER_TO_DISABLE_DWM = -178, + NVAPI_D3D_DEVICE_LOST = -179, + NVAPI_INVALID_CONFIGURATION = -180, + NVAPI_STEREO_HANDSHAKE_NOT_DONE = -181, + NVAPI_EXECUTABLE_PATH_IS_AMBIGUOUS = -182, + NVAPI_DEFAULT_STEREO_PROFILE_IS_NOT_DEFINED = -183, + NVAPI_DEFAULT_STEREO_PROFILE_DOES_NOT_EXIST = -184, + NVAPI_CLUSTER_ALREADY_EXISTS = -185, + NVAPI_DPMST_DISPLAY_ID_EXPECTED = -186, + NVAPI_INVALID_DISPLAY_ID = -187, + NVAPI_STREAM_IS_OUT_OF_SYNC = -188, + NVAPI_INCOMPATIBLE_AUDIO_DRIVER = -189, + NVAPI_VALUE_ALREADY_SET = -190, + NVAPI_TIMEOUT = -191, + NVAPI_GPU_WORKSTATION_FEATURE_INCOMPLETE = -192, + NVAPI_STEREO_INIT_ACTIVATION_NOT_DONE = -193, + NVAPI_SYNC_NOT_ACTIVE = -194, + NVAPI_SYNC_MASTER_NOT_FOUND = -195, + NVAPI_INVALID_SYNC_TOPOLOGY = -196, + NVAPI_ECID_SIGN_ALGO_UNSUPPORTED = -197, + NVAPI_ECID_KEY_VERIFICATION_FAILED = -198, + } + + internal enum NVDRS_SETTING_TYPE : int + { + NVDRS_DWORD_TYPE, + NVDRS_BINARY_TYPE, + NVDRS_STRING_TYPE, + NVDRS_WSTRING_TYPE, + } + + internal enum NVDRS_SETTING_LOCATION : int + { + NVDRS_CURRENT_PROFILE_LOCATION, + NVDRS_GLOBAL_PROFILE_LOCATION, + NVDRS_BASE_PROFILE_LOCATION, + NVDRS_DEFAULT_PROFILE_LOCATION, + } + + [Flags] + public enum NVDRS_GPU_SUPPORT : uint + { + None, + Geforce, + Quadro, + Nvs, + } + + [StructLayout(LayoutKind.Sequential, Pack = 8)] + internal struct NVDRS_SETTING_VALUES + { + public uint version; + public uint numSettingValues; + public NVDRS_SETTING_TYPE settingType; + public NVDRS_SETTING_UNION defaultValue; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)NvapiDrsWrapper.NVAPI_SETTING_MAX_VALUES)] + public NVDRS_SETTING_UNION[] settingValues; + } + + //[StructLayout(LayoutKind.Sequential, Pack = 8)] + //internal struct NVDRS_BINARY_SETTING + //{ + // public uint valueLength; + + // [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)NvapiDrsWrapper.NVAPI_BINARY_DATA_MAX)] + // public byte[] valueData; + //} + + //[StructLayout(LayoutKind.Explicit, Pack = 8, CharSet = CharSet.Unicode)] + //internal struct NVDRS_SETTING_UNION + //{ + // public uint dwordValue + // { + // get { return binaryValue.valueLength; } + // set { binaryValue.valueLength = value; } + // } + + // [FieldOffsetAttribute(0)] + // public NVDRS_BINARY_SETTING binaryValue; + + // [FieldOffsetAttribute(0)] + // [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)] + // public string stringValue; + //} + + [StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Unicode, Size = 4100)] + internal struct NVDRS_SETTING_UNION + { + public uint dwordValue; + + //massive hack for marshalling issues with unicode string overlapping + public string stringValue + { + get { + var firstPart = Encoding.Unicode.GetString(BitConverter.GetBytes(dwordValue)); + return firstPart + stringRaw; + } + + set + { + var bytesRaw = Encoding.Unicode.GetBytes(value); + var bytesFirst = new byte[4]; + var firstLength = bytesRaw.Length; + if (firstLength > 4) + firstLength = 4; + Buffer.BlockCopy(bytesRaw, 0, bytesFirst, 0, firstLength); + dwordValue = BitConverter.ToUInt32(bytesFirst, 0); + + if (value.Length > 2) + { + stringRaw = value.Substring(2); + } + } + + } + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)] + private string stringRaw; + + } + + [StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Unicode)] + internal struct NVDRS_SETTING + { + public uint version; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)] + public string settingName; + public uint settingId; + public NVDRS_SETTING_TYPE settingType; + public NVDRS_SETTING_LOCATION settingLocation; + public uint isCurrentPredefined; + public uint isPredefinedValid; + public NVDRS_SETTING_UNION predefinedValue; + public NVDRS_SETTING_UNION currentValue; + } + + [StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Unicode)] + internal struct NVDRS_APPLICATION_V1 + { + public uint version; + public uint isPredefined; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)] + public string appName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)] + public string userFriendlyName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)] + public string launcher; + } + + [StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Unicode)] + internal struct NVDRS_APPLICATION_V2 + { + public uint version; + public uint isPredefined; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)] + public string appName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)] + public string userFriendlyName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)] + public string launcher; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)] + public string fileInFolder; + } + + [StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Unicode)] + internal struct NVDRS_APPLICATION_V3 + { + public uint isMetro { get { return ((uint)((bitvector1 & 1))); } set { bitvector1 = ((uint)((value | bitvector1))); } } + + public uint version; + public uint isPredefined; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)] + public string appName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)] + public string userFriendlyName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)] + public string launcher; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)] + public string fileInFolder; + private uint bitvector1; + } + + [StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Unicode)] + internal struct NVDRS_PROFILE + { + public uint version; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)] + public string profileName; + public NVDRS_GPU_SUPPORT gpuSupport; + public uint isPredefined; + public uint numOfApps; + public uint numOfSettings; + } + + internal class NvapiDrsWrapper + { + + #region CONSTANTS + public const uint NVAPI_GENERIC_STRING_MAX = 4096; + public const uint NVAPI_LONG_STRING_MAX = 256; + public const uint NVAPI_SHORT_STRING_MAX = 64; + public const uint NVAPI_MAX_PHYSICAL_GPUS = 64; + public const uint NVAPI_UNICODE_STRING_MAX = 2048; + public const uint NVAPI_BINARY_DATA_MAX = 4096; + + public const uint NVAPI_SETTING_MAX_VALUES = 100; + public static uint NVDRS_SETTING_VALUES_VER = MAKE_NVAPI_VERSION(1); + public static uint NVDRS_SETTING_VER = MAKE_NVAPI_VERSION(1); + public static uint NVDRS_APPLICATION_VER_V1 = MAKE_NVAPI_VERSION(1); + public static uint NVDRS_APPLICATION_VER_V2 = MAKE_NVAPI_VERSION(2); + public static uint NVDRS_APPLICATION_VER_V3 = MAKE_NVAPI_VERSION(3); + public static uint NVDRS_APPLICATION_VER = NVDRS_APPLICATION_VER_V3; + public static uint NVDRS_PROFILE_VER = MAKE_NVAPI_VERSION(1); + + public const uint OGL_IMPLICIT_GPU_AFFINITY_NUM_VALUES = 1; + public const uint CUDA_EXCLUDED_GPUS_NUM_VALUES = 1; + public const string D3DOGL_GPU_MAX_POWER_DEFAULTPOWER = "0"; + public const uint D3DOGL_GPU_MAX_POWER_NUM_VALUES = 1; + public const string D3DOGL_GPU_MAX_POWER_DEFAULT = D3DOGL_GPU_MAX_POWER_DEFAULTPOWER; + #endregion + + + private NvapiDrsWrapper() { } + + [DllImport("kernel32.dll")] + private static extern IntPtr LoadLibrary(String dllname); + + [DllImport("kernel32.dll")] + private static extern IntPtr GetProcAddress(IntPtr hModule, String procname); + + private static uint MAKE_NVAPI_VERSION(int version) + { + return (UInt32)((Marshal.SizeOf(typeof(T))) | (int)(version << 16)); + } + + private static string GetDllName() + { + if (IntPtr.Size == 4) + { + return "nvapi.dll"; + } + else + { + return "nvapi64.dll"; + } + } + + private static void GetDelegate(uint id, out T newDelegate) where T : class + { + IntPtr ptr = nvapi_QueryInterface(id); + if (ptr != IntPtr.Zero) + { + newDelegate = Marshal.GetDelegateForFunctionPointer(ptr, typeof(T)) as T; + } + else + { + newDelegate = null; + } + } + + private static T GetDelegateOfFunction(IntPtr pLib, string signature) + { + T FuncT = default(T); + IntPtr FuncAddr = GetProcAddress(pLib, signature); + if (FuncAddr != IntPtr.Zero) + FuncT = (T)(object)Marshal.GetDelegateForFunctionPointer(FuncAddr, typeof(T)); + return FuncT; + } + + #region DELEGATES + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + private delegate IntPtr nvapi_QueryInterfaceDelegate(uint id); + private static readonly nvapi_QueryInterfaceDelegate nvapi_QueryInterface; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status NvAPI_InitializeDelegate(); + public static readonly NvAPI_InitializeDelegate NvAPI_Initialize; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status InitializeDelegate(); + public static readonly InitializeDelegate Initialize; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status UnloadDelegate(); + public static readonly UnloadDelegate Unload; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status GetErrorMessageDelegate(NvAPI_Status nr, [MarshalAs(UnmanagedType.LPStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_SHORT_STRING_MAX)]StringBuilder szDesc); + public static readonly GetErrorMessageDelegate GetErrorMessage; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status GetInterfaceVersionStringDelegate([MarshalAs(UnmanagedType.LPStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_SHORT_STRING_MAX)]StringBuilder szDesc); + public static readonly GetInterfaceVersionStringDelegate GetInterfaceVersionString; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status SYS_GetDriverAndBranchVersionDelegate(ref uint pDriverVersion, [MarshalAs(UnmanagedType.LPStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_SHORT_STRING_MAX)]StringBuilder szBuildBranchString); + public static readonly SYS_GetDriverAndBranchVersionDelegate SYS_GetDriverAndBranchVersion; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_CreateSessionDelegate(ref IntPtr phSession); + public static readonly DRS_CreateSessionDelegate DRS_CreateSession; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_DestroySessionDelegate(IntPtr hSession); + public static readonly DRS_DestroySessionDelegate DRS_DestroySession; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_LoadSettingsDelegate(IntPtr hSession); + public static readonly DRS_LoadSettingsDelegate DRS_LoadSettings; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_SaveSettingsDelegate(IntPtr hSession); + public static readonly DRS_SaveSettingsDelegate DRS_SaveSettings; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_LoadSettingsFromFileDelegate(IntPtr hSession, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder fileName); + public static readonly DRS_LoadSettingsFromFileDelegate DRS_LoadSettingsFromFile; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_SaveSettingsToFileDelegate(IntPtr hSession, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder fileName); + public static readonly DRS_SaveSettingsToFileDelegate DRS_SaveSettingsToFile; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_LoadSettingsFromFileExDelegate(IntPtr hSession, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder fileName); + public static readonly DRS_LoadSettingsFromFileExDelegate DRS_LoadSettingsFromFileEx; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_SaveSettingsToFileExDelegate(IntPtr hSession, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder fileName); + public static readonly DRS_SaveSettingsToFileExDelegate DRS_SaveSettingsToFileEx; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_CreateProfileDelegate(IntPtr hSession, ref NVDRS_PROFILE pProfileInfo, ref IntPtr phProfile); + public static readonly DRS_CreateProfileDelegate DRS_CreateProfile; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_DeleteProfileDelegate(IntPtr hSession, IntPtr hProfile); + public static readonly DRS_DeleteProfileDelegate DRS_DeleteProfile; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_SetCurrentGlobalProfileDelegate(IntPtr hSession, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder wszGlobalProfileName); + public static readonly DRS_SetCurrentGlobalProfileDelegate DRS_SetCurrentGlobalProfile; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_GetCurrentGlobalProfileDelegate(IntPtr hSession, ref IntPtr phProfile); + public static readonly DRS_GetCurrentGlobalProfileDelegate DRS_GetCurrentGlobalProfile; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_GetProfileInfoDelegate(IntPtr hSession, IntPtr hProfile, ref NVDRS_PROFILE pProfileInfo); + public static readonly DRS_GetProfileInfoDelegate DRS_GetProfileInfo; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_SetProfileInfoDelegate(IntPtr hSession, IntPtr hProfile, ref NVDRS_PROFILE pProfileInfo); + public static readonly DRS_SetProfileInfoDelegate DRS_SetProfileInfo; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_FindProfileByNameDelegate(IntPtr hSession, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder profileName, ref IntPtr phProfile); + public static readonly DRS_FindProfileByNameDelegate DRS_FindProfileByName; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_EnumProfilesDelegate(IntPtr hSession, uint index, ref IntPtr phProfile); + public static readonly DRS_EnumProfilesDelegate DRS_EnumProfiles; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_GetNumProfilesDelegate(IntPtr hSession, ref uint numProfiles); + public static readonly DRS_GetNumProfilesDelegate DRS_GetNumProfiles; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_CreateApplicationDelegate(IntPtr hSession, IntPtr hProfile, ref NVDRS_APPLICATION_V3 pApplication); + public static readonly DRS_CreateApplicationDelegate DRS_CreateApplication; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_DeleteApplicationExDelegate(IntPtr hSession, IntPtr hProfile, ref NVDRS_APPLICATION_V3 pApp); + public static readonly DRS_DeleteApplicationExDelegate DRS_DeleteApplicationEx; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_DeleteApplicationDelegate(IntPtr hSession, IntPtr hProfile, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder appName); + public static readonly DRS_DeleteApplicationDelegate DRS_DeleteApplication; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_GetApplicationInfoDelegate(IntPtr hSession, IntPtr hProfile, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder appName, ref NVDRS_APPLICATION_V3 pApplication); + public static readonly DRS_GetApplicationInfoDelegate DRS_GetApplicationInfo; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + private delegate NvAPI_Status DRS_EnumApplicationsDelegate(IntPtr hSession, IntPtr hProfile, uint startIndex, ref uint appCount, IntPtr pApplication); + private static readonly DRS_EnumApplicationsDelegate DRS_EnumApplicationsInternal; + public static NvAPI_Status DRS_EnumApplications(IntPtr hSession, IntPtr hProfile, uint startIndex, ref uint appCount, ref TDrsAppVersion[] apps) + { + NvAPI_Status res; + + IntPtr pSettings; + NativeArrayHelper.SetArrayData(apps, out pSettings); + try + { + res = DRS_EnumApplicationsInternal(hSession, hProfile, startIndex, ref appCount, pSettings); + apps = NativeArrayHelper.GetArrayData(pSettings, (int)appCount); + } + finally + { + Marshal.FreeHGlobal(pSettings); + } + return res; + } + + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_FindApplicationByNameDelegate(IntPtr hSession, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder appName, ref IntPtr phProfile, ref NVDRS_APPLICATION_V3 pApplication); + public static readonly DRS_FindApplicationByNameDelegate DRS_FindApplicationByName; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_SetSettingDelegate(IntPtr hSession, IntPtr hProfile, ref NVDRS_SETTING pSetting); + public static readonly DRS_SetSettingDelegate DRS_SetSetting; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_GetSettingDelegate(IntPtr hSession, IntPtr hProfile, uint settingId, ref NVDRS_SETTING pSetting); + public static readonly DRS_GetSettingDelegate DRS_GetSetting; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + private delegate NvAPI_Status DRS_EnumSettingsDelegate(IntPtr hSession, IntPtr hProfile, uint startIndex, ref uint settingsCount, IntPtr pSetting); + private static readonly DRS_EnumSettingsDelegate DRS_EnumSettingsInternal; + public static NvAPI_Status DRS_EnumSettings(IntPtr hSession, IntPtr hProfile, uint startIndex, ref uint settingsCount, ref NVDRS_SETTING[] settings) + { + NvAPI_Status res; + + IntPtr pSettings; + NativeArrayHelper.SetArrayData(settings, out pSettings); + try + { + res = DRS_EnumSettingsInternal(hSession, hProfile, startIndex, ref settingsCount, pSettings); + settings = NativeArrayHelper.GetArrayData(pSettings, (int)settingsCount); + } + finally + { + Marshal.FreeHGlobal(pSettings); + } + return res; + } + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_EnumAvailableSettingIdsDelegate(IntPtr pSettingIds, ref uint pMaxCount); + public static readonly DRS_EnumAvailableSettingIdsDelegate DRS_EnumAvailableSettingIdsInternal; + public static NvAPI_Status DRS_EnumAvailableSettingIds(out List settingIds, uint maxCount) + { + NvAPI_Status res; + var settingIdArray = new uint[maxCount]; + var pSettingIds = IntPtr.Zero; + NativeArrayHelper.SetArrayData(settingIdArray, out pSettingIds); + try + { + res = DRS_EnumAvailableSettingIdsInternal(pSettingIds, ref maxCount); + + settingIdArray = NativeArrayHelper.GetArrayData(pSettingIds, (int)maxCount); + settingIds = settingIdArray.ToList(); + } + finally + { + Marshal.FreeHGlobal(pSettingIds); + } + return res; + } + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + private delegate NvAPI_Status DRS_EnumAvailableSettingValuesDelegate(uint settingId, ref uint pMaxNumValues, IntPtr pSettingValues); + private static readonly DRS_EnumAvailableSettingValuesDelegate DRS_EnumAvailableSettingValuesInternal; + public static NvAPI_Status DRS_EnumAvailableSettingValues(uint settingId, ref uint pMaxNumValues, ref NVDRS_SETTING_VALUES settingValues) + { + var pSettingValues = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NVDRS_SETTING_VALUES))); + NvAPI_Status res; + try + { + settingValues.settingValues = new NVDRS_SETTING_UNION[(int)NVAPI_SETTING_MAX_VALUES]; + Marshal.StructureToPtr(settingValues, pSettingValues, true); + res = DRS_EnumAvailableSettingValuesInternal(settingId, ref pMaxNumValues, pSettingValues); + settingValues = (NVDRS_SETTING_VALUES)Marshal.PtrToStructure(pSettingValues, typeof(NVDRS_SETTING_VALUES)); + } + finally + { + Marshal.FreeHGlobal(pSettingValues); + } + return res; + } + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_GetSettingIdFromNameDelegate([MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder settingName, ref uint pSettingId); + public static readonly DRS_GetSettingIdFromNameDelegate DRS_GetSettingIdFromName; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_GetSettingNameFromIdDelegate(uint settingId, [MarshalAs(UnmanagedType.LPWStr, SizeConst = (int)NvapiDrsWrapper.NVAPI_UNICODE_STRING_MAX)]StringBuilder pSettingName); + public static readonly DRS_GetSettingNameFromIdDelegate DRS_GetSettingNameFromId; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_DeleteProfileSettingDelegate(IntPtr hSession, IntPtr hProfile, uint settingId); + public static readonly DRS_DeleteProfileSettingDelegate DRS_DeleteProfileSetting; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_RestoreAllDefaultsDelegate(IntPtr hSession); + public static readonly DRS_RestoreAllDefaultsDelegate DRS_RestoreAllDefaults; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_RestoreProfileDefaultDelegate(IntPtr hSession, IntPtr hProfile); + public static readonly DRS_RestoreProfileDefaultDelegate DRS_RestoreProfileDefault; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_RestoreProfileDefaultSettingDelegate(IntPtr hSession, IntPtr hProfile, uint settingId); + public static readonly DRS_RestoreProfileDefaultSettingDelegate DRS_RestoreProfileDefaultSetting; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate NvAPI_Status DRS_GetBaseProfileDelegate(IntPtr hSession, ref IntPtr phProfile); + public static readonly DRS_GetBaseProfileDelegate DRS_GetBaseProfile; + + #endregion + static NvapiDrsWrapper() + { + IntPtr lib = LoadLibrary(GetDllName()); + if (lib != IntPtr.Zero) + { + nvapi_QueryInterface = GetDelegateOfFunction(lib, "nvapi_QueryInterface"); + if (nvapi_QueryInterface != null) + { + GetDelegate(0x0150E828, out NvAPI_Initialize); + if (NvAPI_Initialize() == NvAPI_Status.NVAPI_OK) + { + #region FUNCTION IDs + GetDelegate(0x0150E828, out Initialize); + GetDelegate(0xD22BDD7E, out Unload); + GetDelegate(0x6C2D048C, out GetErrorMessage); + GetDelegate(0x01053FA5, out GetInterfaceVersionString); + GetDelegate(0x2926AAAD, out SYS_GetDriverAndBranchVersion); + GetDelegate(0x0694D52E, out DRS_CreateSession); + GetDelegate(0xDAD9CFF8, out DRS_DestroySession); + GetDelegate(0x375DBD6B, out DRS_LoadSettings); + GetDelegate(0xFCBC7E14, out DRS_SaveSettings); + GetDelegate(0xD3EDE889, out DRS_LoadSettingsFromFile); + GetDelegate(0x2BE25DF8, out DRS_SaveSettingsToFile); + GetDelegate(0xC63C045B, out DRS_LoadSettingsFromFileEx); + GetDelegate(0x1267818E, out DRS_SaveSettingsToFileEx); + GetDelegate(0xCC176068, out DRS_CreateProfile); + GetDelegate(0x17093206, out DRS_DeleteProfile); + GetDelegate(0x1C89C5DF, out DRS_SetCurrentGlobalProfile); + GetDelegate(0x617BFF9F, out DRS_GetCurrentGlobalProfile); + GetDelegate(0x61CD6FD6, out DRS_GetProfileInfo); + GetDelegate(0x16ABD3A9, out DRS_SetProfileInfo); + GetDelegate(0x7E4A9A0B, out DRS_FindProfileByName); + GetDelegate(0xBC371EE0, out DRS_EnumProfiles); + GetDelegate(0x1DAE4FBC, out DRS_GetNumProfiles); + GetDelegate(0x4347A9DE, out DRS_CreateApplication); + GetDelegate(0xC5EA85A1, out DRS_DeleteApplicationEx); + GetDelegate(0x2C694BC6, out DRS_DeleteApplication); + GetDelegate(0xED1F8C69, out DRS_GetApplicationInfo); + GetDelegate(0x7FA2173A, out DRS_EnumApplicationsInternal); + GetDelegate(0xEEE566B2, out DRS_FindApplicationByName); + GetDelegate(0x577DD202, out DRS_SetSetting); + GetDelegate(0x73BF8338, out DRS_GetSetting); + GetDelegate(0xAE3039DA, out DRS_EnumSettingsInternal); + GetDelegate(0xF020614A, out DRS_EnumAvailableSettingIdsInternal); + GetDelegate(0x2EC39F90, out DRS_EnumAvailableSettingValuesInternal); + GetDelegate(0xCB7309CD, out DRS_GetSettingIdFromName); + GetDelegate(0xD61CBE6E, out DRS_GetSettingNameFromId); + GetDelegate(0xE4A26362, out DRS_DeleteProfileSetting); + GetDelegate(0x5927B094, out DRS_RestoreAllDefaults); + GetDelegate(0xFA5F6134, out DRS_RestoreProfileDefault); + GetDelegate(0x53F0381E, out DRS_RestoreProfileDefaultSetting); + GetDelegate(0xDA8466A0, out DRS_GetBaseProfile); + #endregion + + } + } + } + } + } + +} diff --git a/nspector/Native/NativeArrayHelper.cs b/nspector/Native/NativeArrayHelper.cs new file mode 100644 index 0000000..b3ca076 --- /dev/null +++ b/nspector/Native/NativeArrayHelper.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; + +namespace nspector.Native +{ + internal class NativeArrayHelper + { + public static T GetArrayItemData(IntPtr sourcePointer) + { + return (T)Marshal.PtrToStructure(sourcePointer, typeof(T)); + } + + public static T[] GetArrayData(IntPtr sourcePointer, int itemCount) + { + var lstResult = new List(); + if (sourcePointer != IntPtr.Zero && itemCount > 0) + { + var sizeOfItem = Marshal.SizeOf(typeof(T)); + for (int i = 0; i < itemCount; i++) + { + lstResult.Add(GetArrayItemData(sourcePointer + (sizeOfItem * i))); + } + } + return lstResult.ToArray(); + } + + public static void SetArrayData(T[] items, out IntPtr targetPointer) + { + if (items != null && items.Length > 0) + { + var sizeOfItem = Marshal.SizeOf(typeof(T)); + targetPointer = Marshal.AllocHGlobal(sizeOfItem * items.Length); + for (int i = 0; i < items.Length; i++) + { + Marshal.StructureToPtr(items[i], targetPointer + (sizeOfItem * i), true); + } + } + else + { + targetPointer = IntPtr.Zero; + } + + } + + public static void SetArrayItemData(T item, out IntPtr targetPointer) + { + var sizeOfItem = Marshal.SizeOf(typeof(T)); + targetPointer = Marshal.AllocHGlobal(sizeOfItem); + Marshal.StructureToPtr(item, targetPointer, true); + } + + } +} diff --git a/nspector/Native/WINAPI/DragAcceptNativeHelper.cs b/nspector/Native/WINAPI/DragAcceptNativeHelper.cs new file mode 100644 index 0000000..2be9285 --- /dev/null +++ b/nspector/Native/WINAPI/DragAcceptNativeHelper.cs @@ -0,0 +1,45 @@ +using System; +using System.Runtime.InteropServices; + +namespace nspector.Native.WINAPI +{ + internal static class DragAcceptNativeHelper + { + /// + /// Modifies the User Interface Privilege Isolation (UIPI) message filter for whole process. (Vista only) + /// + /// + /// + /// + [DllImport("user32.dll", SetLastError = true)] + internal static extern IntPtr ChangeWindowMessageFilter(int message, int dwFlag); + + /// + /// Modifies the User Interface Privilege Isolation (UIPI) message filter for a specified window. (Win7 or higher) + /// + /// + /// + /// + /// + [DllImport("user32.dll", SetLastError = true)] + internal static extern IntPtr ChangeWindowMessageFilterEx(IntPtr handle, int message, int action, IntPtr pChangeFilterStruct); + + //ChangeWindowMessageFilter + internal const int MSGFLT_ADD = 1; + internal const int MSGFLT_REMOVE = 2; + + //ChangeWindowMessageFilterEx + internal const int MSGFLT_ALLOW = 1; + internal const int MSGFLT_DISALLOW = 2; + internal const int MSGFLT_RESET = 3; + + + [DllImport("shell32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)] + public static extern void DragAcceptFiles(IntPtr hWnd, bool fAccept); + + internal const int WM_DROPFILES = 0x233; + internal const int WM_COPYDATA = 0x004A; + internal const int WM_COPYGLOBALDATA = 0x0049; + + } +} diff --git a/nspector/Native/WINAPI/MessageHelper.cs b/nspector/Native/WINAPI/MessageHelper.cs new file mode 100644 index 0000000..fa5f4a7 --- /dev/null +++ b/nspector/Native/WINAPI/MessageHelper.cs @@ -0,0 +1,380 @@ +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; + +namespace nspector.Native.WINAPI +{ + internal class MessageHelper + { + [DllImport("User32.dll")] + private static extern int RegisterWindowMessage(string lpString); + + [DllImport("User32.dll", EntryPoint = "FindWindow")] + internal static extern Int32 FindWindow(String lpClassName, String lpWindowName); + + //For use with WM_COPYDATA and COPYDATASTRUCT + [DllImport("User32.dll", EntryPoint = "SendMessage")] + internal static extern int SendMessage(int hWnd, int Msg, int wParam, ref COPYDATASTRUCT lParam); + + //For use with WM_COPYDATA and COPYDATASTRUCT + [DllImport("User32.dll", EntryPoint = "PostMessage")] + internal static extern int PostMessage(int hWnd, int Msg, int wParam, ref COPYDATASTRUCT lParam); + + [DllImport("User32.dll", EntryPoint = "SendMessage")] + internal static extern int SendMessage(int hWnd, int Msg, int wParam, int lParam); + + [DllImport("User32.dll", EntryPoint = "PostMessage")] + internal static extern int PostMessage(int hWnd, int Msg, int wParam, int lParam); + + [DllImport("User32.dll", EntryPoint = "SetForegroundWindow")] + internal static extern bool SetForegroundWindow(int hWnd); + + [DllImport("User32.dll")] + static extern bool SetWindowPlacement(int hWnd, [In] ref WINDOWPLACEMENT lpwndpl); + + [DllImport("User32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + static extern bool GetWindowPlacement(int hWnd, ref WINDOWPLACEMENT lpwndpl); + + #region Message Constants + + internal const int WM_NULL = 0x00; + internal const int WM_CREATE = 0x01; + internal const int WM_DESTROY = 0x02; + internal const int WM_MOVE = 0x03; + internal const int WM_SIZE = 0x05; + internal const int WM_ACTIVATE = 0x06; + internal const int WM_SETFOCUS = 0x07; + internal const int WM_KILLFOCUS = 0x08; + internal const int WM_ENABLE = 0x0A; + internal const int WM_SETREDRAW = 0x0B; + internal const int WM_SETTEXT = 0x0C; + internal const int WM_GETTEXT = 0x0D; + internal const int WM_GETTEXTLENGTH = 0x0E; + internal const int WM_PAINT = 0x0F; + internal const int WM_CLOSE = 0x10; + internal const int WM_QUERYENDSESSION = 0x11; + internal const int WM_QUIT = 0x12; + internal const int WM_QUERYOPEN = 0x13; + internal const int WM_ERASEBKGND = 0x14; + internal const int WM_SYSCOLORCHANGE = 0x15; + internal const int WM_ENDSESSION = 0x16; + internal const int WM_SYSTEMERROR = 0x17; + internal const int WM_SHOWWINDOW = 0x18; + internal const int WM_CTLCOLOR = 0x19; + internal const int WM_WININICHANGE = 0x1A; + internal const int WM_SETTINGCHANGE = 0x1A; + internal const int WM_DEVMODECHANGE = 0x1B; + internal const int WM_ACTIVATEAPP = 0x1C; + internal const int WM_FONTCHANGE = 0x1D; + internal const int WM_TIMECHANGE = 0x1E; + internal const int WM_CANCELMODE = 0x1F; + internal const int WM_SETCURSOR = 0x20; + internal const int WM_MOUSEACTIVATE = 0x21; + internal const int WM_CHILDACTIVATE = 0x22; + internal const int WM_QUEUESYNC = 0x23; + internal const int WM_GETMINMAXINFO = 0x24; + internal const int WM_PAINTICON = 0x26; + internal const int WM_ICONERASEBKGND = 0x27; + internal const int WM_NEXTDLGCTL = 0x28; + internal const int WM_SPOOLERSTATUS = 0x2A; + internal const int WM_DRAWITEM = 0x2B; + internal const int WM_MEASUREITEM = 0x2C; + internal const int WM_DELETEITEM = 0x2D; + internal const int WM_VKEYTOITEM = 0x2E; + internal const int WM_CHARTOITEM = 0x2F; + + internal const int WM_SETFONT = 0x30; + internal const int WM_GETFONT = 0x31; + internal const int WM_SETHOTKEY = 0x32; + internal const int WM_GETHOTKEY = 0x33; + internal const int WM_QUERYDRAGICON = 0x37; + internal const int WM_COMPAREITEM = 0x39; + internal const int WM_COMPACTING = 0x41; + internal const int WM_WINDOWPOSCHANGING = 0x46; + internal const int WM_WINDOWPOSCHANGED = 0x47; + internal const int WM_POWER = 0x48; + internal const int WM_COPYDATA = 0x4A; + internal const int WM_CANCELJOURNAL = 0x4B; + internal const int WM_NOTIFY = 0x4E; + internal const int WM_INPUTLANGCHANGEREQUEST = 0x50; + internal const int WM_INPUTLANGCHANGE = 0x51; + internal const int WM_TCARD = 0x52; + internal const int WM_HELP = 0x53; + internal const int WM_USERCHANGED = 0x54; + internal const int WM_NOTIFYFORMAT = 0x55; + internal const int WM_CONTEXTMENU = 0x7B; + internal const int WM_STYLECHANGING = 0x7C; + internal const int WM_STYLECHANGED = 0x7D; + internal const int WM_DISPLAYCHANGE = 0x7E; + internal const int WM_GETICON = 0x7F; + internal const int WM_SETICON = 0x80; + + internal const int WM_NCCREATE = 0x81; + internal const int WM_NCDESTROY = 0x82; + internal const int WM_NCCALCSIZE = 0x83; + internal const int WM_NCHITTEST = 0x84; + internal const int WM_NCPAINT = 0x85; + internal const int WM_NCACTIVATE = 0x86; + internal const int WM_GETDLGCODE = 0x87; + internal const int WM_NCMOUSEMOVE = 0xA0; + internal const int WM_NCLBUTTONDOWN = 0xA1; + internal const int WM_NCLBUTTONUP = 0xA2; + internal const int WM_NCLBUTTONDBLCLK = 0xA3; + internal const int WM_NCRBUTTONDOWN = 0xA4; + internal const int WM_NCRBUTTONUP = 0xA5; + internal const int WM_NCRBUTTONDBLCLK = 0xA6; + internal const int WM_NCMBUTTONDOWN = 0xA7; + internal const int WM_NCMBUTTONUP = 0xA8; + internal const int WM_NCMBUTTONDBLCLK = 0xA9; + + internal const int WM_KEYFIRST = 0x100; + internal const int WM_KEYDOWN = 0x100; + internal const int WM_KEYUP = 0x101; + internal const int WM_CHAR = 0x102; + internal const int WM_DEADCHAR = 0x103; + internal const int WM_SYSKEYDOWN = 0x104; + internal const int WM_SYSKEYUP = 0x105; + internal const int WM_SYSCHAR = 0x106; + internal const int WM_SYSDEADCHAR = 0x107; + internal const int WM_KEYLAST = 0x108; + + internal const int WM_IME_STARTCOMPOSITION = 0x10D; + internal const int WM_IME_ENDCOMPOSITION = 0x10E; + internal const int WM_IME_COMPOSITION = 0x10F; + internal const int WM_IME_KEYLAST = 0x10F; + + internal const int WM_INITDIALOG = 0x110; + internal const int WM_COMMAND = 0x111; + internal const int WM_SYSCOMMAND = 0x112; + internal const int WM_TIMER = 0x113; + internal const int WM_HSCROLL = 0x114; + internal const int WM_VSCROLL = 0x115; + internal const int WM_INITMENU = 0x116; + internal const int WM_INITMENUPOPUP = 0x117; + internal const int WM_MENUSELECT = 0x11F; + internal const int WM_MENUCHAR = 0x120; + internal const int WM_ENTERIDLE = 0x121; + + internal const int WM_CTLCOLORMSGBOX = 0x132; + internal const int WM_CTLCOLOREDIT = 0x133; + internal const int WM_CTLCOLORLISTBOX = 0x134; + internal const int WM_CTLCOLORBTN = 0x135; + internal const int WM_CTLCOLORDLG = 0x136; + internal const int WM_CTLCOLORSCROLLBAR = 0x137; + internal const int WM_CTLCOLORSTATIC = 0x138; + + internal const int WM_MOUSEFIRST = 0x200; + internal const int WM_MOUSEMOVE = 0x200; + internal const int WM_LBUTTONDOWN = 0x201; + internal const int WM_LBUTTONUP = 0x202; + internal const int WM_LBUTTONDBLCLK = 0x203; + internal const int WM_RBUTTONDOWN = 0x204; + internal const int WM_RBUTTONUP = 0x205; + internal const int WM_RBUTTONDBLCLK = 0x206; + internal const int WM_MBUTTONDOWN = 0x207; + internal const int WM_MBUTTONUP = 0x208; + internal const int WM_MBUTTONDBLCLK = 0x209; + internal const int WM_MOUSELAST = 0x20A; + internal const int WM_MOUSEWHEEL = 0x20A; + + internal const int WM_PARENTNOTIFY = 0x210; + internal const int WM_ENTERMENULOOP = 0x211; + internal const int WM_EXITMENULOOP = 0x212; + internal const int WM_NEXTMENU = 0x213; + internal const int WM_SIZING = 0x214; + internal const int WM_CAPTURECHANGED = 0x215; + internal const int WM_MOVING = 0x216; + internal const int WM_POWERBROADCAST = 0x218; + internal const int WM_DEVICECHANGE = 0x219; + + internal const int WM_MDICREATE = 0x220; + internal const int WM_MDIDESTROY = 0x221; + internal const int WM_MDIACTIVATE = 0x222; + internal const int WM_MDIRESTORE = 0x223; + internal const int WM_MDINEXT = 0x224; + internal const int WM_MDIMAXIMIZE = 0x225; + internal const int WM_MDITILE = 0x226; + internal const int WM_MDICASCADE = 0x227; + internal const int WM_MDIICONARRANGE = 0x228; + internal const int WM_MDIGETACTIVE = 0x229; + internal const int WM_MDISETMENU = 0x230; + internal const int WM_ENTERSIZEMOVE = 0x231; + internal const int WM_EXITSIZEMOVE = 0x232; + internal const int WM_DROPFILES = 0x233; + internal const int WM_MDIREFRESHMENU = 0x234; + + internal const int WM_IME_SETCONTEXT = 0x281; + internal const int WM_IME_NOTIFY = 0x282; + internal const int WM_IME_CONTROL = 0x283; + internal const int WM_IME_COMPOSITIONFULL = 0x284; + internal const int WM_IME_SELECT = 0x285; + internal const int WM_IME_CHAR = 0x286; + internal const int WM_IME_KEYDOWN = 0x290; + internal const int WM_IME_KEYUP = 0x291; + + internal const int WM_MOUSEHOVER = 0x2A1; + internal const int WM_NCMOUSELEAVE = 0x2A2; + internal const int WM_MOUSELEAVE = 0x2A3; + + internal const int WM_CUT = 0x300; + internal const int WM_COPY = 0x301; + internal const int WM_PASTE = 0x302; + internal const int WM_CLEAR = 0x303; + internal const int WM_UNDO = 0x304; + + internal const int WM_RENDERFORMAT = 0x305; + internal const int WM_RENDERALLFORMATS = 0x306; + internal const int WM_DESTROYCLIPBOARD = 0x307; + internal const int WM_DRAWCLIPBOARD = 0x308; + internal const int WM_PAINTCLIPBOARD = 0x309; + internal const int WM_VSCROLLCLIPBOARD = 0x30A; + internal const int WM_SIZECLIPBOARD = 0x30B; + internal const int WM_ASKCBFORMATNAME = 0x30C; + internal const int WM_CHANGECBCHAIN = 0x30D; + internal const int WM_HSCROLLCLIPBOARD = 0x30E; + internal const int WM_QUERYNEWPALETTE = 0x30F; + internal const int WM_PALETTEISCHANGING = 0x310; + internal const int WM_PALETTECHANGED = 0x311; + + internal const int WM_HOTKEY = 0x312; + internal const int WM_PRINT = 0x317; + internal const int WM_PRINTCLIENT = 0x318; + + internal const int WM_HANDHELDFIRST = 0x358; + internal const int WM_HANDHELDLAST = 0x35F; + internal const int WM_PENWINFIRST = 0x380; + internal const int WM_PENWINLAST = 0x38F; + internal const int WM_COALESCE_FIRST = 0x390; + internal const int WM_COALESCE_LAST = 0x39F; + internal const int WM_DDE_FIRST = 0x3E0; + internal const int WM_DDE_INITIATE = 0x3E0; + internal const int WM_DDE_TERMINATE = 0x3E1; + internal const int WM_DDE_ADVISE = 0x3E2; + internal const int WM_DDE_UNADVISE = 0x3E3; + internal const int WM_DDE_ACK = 0x3E4; + internal const int WM_DDE_DATA = 0x3E5; + internal const int WM_DDE_REQUEST = 0x3E6; + internal const int WM_DDE_POKE = 0x3E7; + internal const int WM_DDE_EXECUTE = 0x3E8; + internal const int WM_DDE_LAST = 0x3E8; + + internal const int WM_USER = 0x400; + internal const int WM_APP = 0x8000; + + + internal const int SW_HIDE = 0; + internal const int SW_SHOWNORMAL = 1; + internal const int SW_NORMAL = 1; + internal const int SW_SHOWMINIMIZED = 2; + internal const int SW_SHOWMAXIMIZED = 3; + internal const int SW_MAXIMIZE = 3; + internal const int SW_SHOWNOACTIVATE = 4; + internal const int SW_SHOW = 5; + internal const int SW_MINIMIZE = 6; + internal const int SW_SHOWMINNOACTIVE = 7; + internal const int SW_SHOWNA = 8; + internal const int SW_RESTORE = 9; + + #endregion + + //Used for WM_COPYDATA for string messages + internal struct COPYDATASTRUCT + { + internal IntPtr dwData; + internal int cbData; + [MarshalAs(UnmanagedType.LPStr)] + internal string lpData; + } + + + internal struct WINDOWPLACEMENT + { + internal int length; + internal int flags; + internal int showCmd; + internal System.Drawing.Point ptMinPosition; + internal System.Drawing.Point ptMaxPosition; + internal System.Drawing.Rectangle rcNormalPosition; + } + + internal bool bringAppToFront(int hWnd) + { + WINDOWPLACEMENT param = new WINDOWPLACEMENT(); + if (GetWindowPlacement(hWnd,ref param)) + { + if (param.showCmd != SW_NORMAL) + { + param.length = Marshal.SizeOf(typeof(WINDOWPLACEMENT)); + param.showCmd = SW_NORMAL; + SetWindowPlacement(hWnd, ref param); + } + } + return SetForegroundWindow(hWnd); + } + + internal int sendWindowsStringMessage(int hWnd, int wParam, string msg) + { + int result = 0; + + if (hWnd > 0) + { + byte[] sarr = System.Text.Encoding.Default.GetBytes(msg); + int len = sarr.Length; + COPYDATASTRUCT cds; + cds.dwData = (IntPtr)100; + cds.lpData = msg; + cds.cbData = len + 1; + result = SendMessage(hWnd, WM_COPYDATA, wParam, ref cds); + } + + return result; + } + + internal int sendWindowsMessage(int hWnd, int Msg, int wParam, int lParam) + { + int result = 0; + + if (hWnd > 0) + { + result = SendMessage(hWnd, Msg, wParam, lParam); + } + + return result; + } + + internal int getWindowId(string className, string windowName) + { + return FindWindow(className, windowName); + } + + internal int checkIfProcessRunning(string process) + { + Process[] processes = Process.GetProcessesByName(process); + return processes.Length; + } + + internal void closeProcesses(string process, bool force) + { + Process[] processes = Process.GetProcessesByName(process); + + for (int i = 0; i < processes.Length; i++) + { + processes[i].CloseMainWindow(); + + if (force) + processes[i].Kill(); + else + processes[i].WaitForExit(); + } + } + + internal void startProcess(string processName) + { + System.Diagnostics.Process process = new System.Diagnostics.Process(); + process.StartInfo.UseShellExecute = true; + process.StartInfo.FileName = processName; + process.Start(); + } + } +} \ No newline at end of file diff --git a/nspector/Native/WINAPI/SafeNativeMethods.cs b/nspector/Native/WINAPI/SafeNativeMethods.cs new file mode 100644 index 0000000..7273064 --- /dev/null +++ b/nspector/Native/WINAPI/SafeNativeMethods.cs @@ -0,0 +1,11 @@ +using System.Runtime.InteropServices; + +namespace nspector.Native.WINAPI +{ + static class SafeNativeMethods + { + [DllImport("kernel32", CharSet = CharSet.Unicode, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool DeleteFile(string name); + } +} diff --git a/nspector/Native/WINAPI/ShellLink.cs b/nspector/Native/WINAPI/ShellLink.cs new file mode 100644 index 0000000..4aab4ab --- /dev/null +++ b/nspector/Native/WINAPI/ShellLink.cs @@ -0,0 +1,662 @@ +using System; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; + +namespace nspector.Native.WINAPI +{ + + internal class ShellLink : IDisposable + { + + [ComImport()] + [Guid("0000010C-0000-0000-C000-000000000046")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + private interface IPersist + { + [PreserveSig] + void GetClassID(out Guid pClassID); + } + + [ComImport()] + [Guid("0000010B-0000-0000-C000-000000000046")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + private interface IPersistFile + { + [PreserveSig] + void GetClassID(out Guid pClassID); + void IsDirty(); + void Load( + [MarshalAs(UnmanagedType.LPWStr)] string pszFileName, + uint dwMode); + + void Save( + [MarshalAs(UnmanagedType.LPWStr)] string pszFileName, + [MarshalAs(UnmanagedType.Bool)] bool fRemember); + + void SaveCompleted( + [MarshalAs(UnmanagedType.LPWStr)] string pszFileName); + + void GetCurFile( + [MarshalAs(UnmanagedType.LPWStr)] out string ppszFileName); + } + + [ComImport()] + [Guid("000214EE-0000-0000-C000-000000000046")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + private interface IShellLinkA + { + void GetPath( + [Out(), MarshalAs(UnmanagedType.LPStr)] StringBuilder pszFile, + int cchMaxPath, + ref _WIN32_FIND_DATAA pfd, + uint fFlags); + + void GetIDList(out IntPtr ppidl); + + void SetIDList(IntPtr pidl); + + void GetDescription( + [Out(), MarshalAs(UnmanagedType.LPStr)] StringBuilder pszFile, + int cchMaxName); + + void SetDescription( + [MarshalAs(UnmanagedType.LPStr)] string pszName); + + void GetWorkingDirectory( + [Out(), MarshalAs(UnmanagedType.LPStr)] StringBuilder pszDir, + int cchMaxPath); + + void SetWorkingDirectory( + [MarshalAs(UnmanagedType.LPStr)] string pszDir); + + void GetArguments( + [Out(), MarshalAs(UnmanagedType.LPStr)] StringBuilder pszArgs, + int cchMaxPath); + + void SetArguments( + [MarshalAs(UnmanagedType.LPStr)] string pszArgs); + + void GetHotkey(out short pwHotkey); + void SetHotkey(short pwHotkey); + + void GetShowCmd(out uint piShowCmd); + void SetShowCmd(uint piShowCmd); + + void GetIconLocation( + [Out(), MarshalAs(UnmanagedType.LPStr)] StringBuilder pszIconPath, + int cchIconPath, + out int piIcon); + + void SetIconLocation( + [MarshalAs(UnmanagedType.LPStr)] string pszIconPath, + int iIcon); + + void SetRelativePath( + [MarshalAs(UnmanagedType.LPStr)] string pszPathRel, + uint dwReserved); + + void Resolve( + IntPtr hWnd, + uint fFlags); + + void SetPath( + [MarshalAs(UnmanagedType.LPStr)] string pszFile); + } + + + [ComImport()] + [Guid("000214F9-0000-0000-C000-000000000046")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + private interface IShellLinkW + { + void GetPath( + [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile, + int cchMaxPath, + ref _WIN32_FIND_DATAW pfd, + uint fFlags); + + void GetIDList(out IntPtr ppidl); + void SetIDList(IntPtr pidl); + void GetDescription( + [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile, + int cchMaxName); + + void SetDescription( + [MarshalAs(UnmanagedType.LPWStr)] string pszName); + + void GetWorkingDirectory( + [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDir, + int cchMaxPath); + + void SetWorkingDirectory( + [MarshalAs(UnmanagedType.LPWStr)] string pszDir); + + void GetArguments( + [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszArgs, + int cchMaxPath); + + void SetArguments( + [MarshalAs(UnmanagedType.LPWStr)] string pszArgs); + + void GetHotkey(out short pwHotkey); + void SetHotkey(short pwHotkey); + + void GetShowCmd(out uint piShowCmd); + void SetShowCmd(uint piShowCmd); + + void GetIconLocation( + [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszIconPath, + int cchIconPath, + out int piIcon); + + void SetIconLocation( + [MarshalAs(UnmanagedType.LPWStr)] string pszIconPath, + int iIcon); + + void SetRelativePath( + [MarshalAs(UnmanagedType.LPWStr)] string pszPathRel, + uint dwReserved); + + void Resolve( + IntPtr hWnd, + uint fFlags); + + void SetPath( + [MarshalAs(UnmanagedType.LPWStr)] string pszFile); + } + + [Guid("00021401-0000-0000-C000-000000000046")] + [ClassInterface(ClassInterfaceType.None)] + [ComImport()] + private class CShellLink { } + + private enum EShellLinkGP : uint + { + SLGP_SHORTPATH = 1, + SLGP_UNCPRIORITY = 2 + } + + [Flags] + private enum EShowWindowFlags : uint + { + SW_HIDE = 0, + SW_SHOWNORMAL = 1, + SW_NORMAL = 1, + SW_SHOWMINIMIZED = 2, + SW_SHOWMAXIMIZED = 3, + SW_MAXIMIZE = 3, + SW_SHOWNOACTIVATE = 4, + SW_SHOW = 5, + SW_MINIMIZE = 6, + SW_SHOWMINNOACTIVE = 7, + SW_SHOWNA = 8, + SW_RESTORE = 9, + SW_SHOWDEFAULT = 10, + SW_MAX = 10 + } + + + [StructLayout(LayoutKind.Sequential, Pack = 4, Size = 0, CharSet = CharSet.Unicode)] + private struct _WIN32_FIND_DATAW + { + internal uint dwFileAttributes; + internal _FILETIME ftCreationTime; + internal _FILETIME ftLastAccessTime; + internal _FILETIME ftLastWriteTime; + internal uint nFileSizeHigh; + internal uint nFileSizeLow; + internal uint dwReserved0; + internal uint dwReserved1; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] // MAX_PATH + internal string cFileName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)] + internal string cAlternateFileName; + } + + [StructLayout(LayoutKind.Sequential, Pack = 4, Size = 0, CharSet = CharSet.Ansi)] + private struct _WIN32_FIND_DATAA + { + internal uint dwFileAttributes; + internal _FILETIME ftCreationTime; + internal _FILETIME ftLastAccessTime; + internal _FILETIME ftLastWriteTime; + internal uint nFileSizeHigh; + internal uint nFileSizeLow; + internal uint dwReserved0; + internal uint dwReserved1; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] // MAX_PATH + internal string cFileName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)] + internal string cAlternateFileName; + } + + [StructLayout(LayoutKind.Sequential, Pack = 4, Size = 0)] + private struct _FILETIME + { + internal uint dwLowDateTime; + internal uint dwHighDateTime; + } + + private class NativeMethods + { + [DllImport("Shell32", CharSet = CharSet.Auto)] + internal extern static int ExtractIconEx([MarshalAs(UnmanagedType.LPTStr)] + string lpszFile, + int nIconIndex, + IntPtr[] phIconLarge, + IntPtr[] phIconSmall, + int nIcons); + + [DllImport("user32")] + internal static extern int DestroyIcon(IntPtr hIcon); + } + + [Flags] + internal enum EShellLinkResolveFlags : uint + { + SLR_ANY_MATCH = 0x2, + SLR_INVOKE_MSI = 0x80, + SLR_NOLINKINFO = 0x40, + SLR_NO_UI = 0x1, + SLR_NO_UI_WITH_MSG_PUMP = 0x101, + SLR_NOUPDATE = 0x8, + SLR_NOSEARCH = 0x10, + SLR_NOTRACK = 0x20, + SLR_UPDATE = 0x4 + } + + internal enum LinkDisplayMode : uint + { + edmNormal = EShowWindowFlags.SW_NORMAL, + edmMinimized = EShowWindowFlags.SW_SHOWMINNOACTIVE, + edmMaximized = EShowWindowFlags.SW_MAXIMIZE + } + + private IShellLinkW linkW; + private IShellLinkA linkA; + private string shortcutFile = ""; + + internal ShellLink() + { + if (System.Environment.OSVersion.Platform == PlatformID.Win32NT) + { + linkW = (IShellLinkW)new CShellLink(); + } + else + { + linkA = (IShellLinkA)new CShellLink(); + } + } + + internal ShellLink(string linkFile) + : this() + { + Open(linkFile); + } + + ~ShellLink() + { + Dispose(); + } + + public void Dispose() + { + if (linkW != null) + { + Marshal.ReleaseComObject(linkW); + linkW = null; + } + if (linkA != null) + { + Marshal.ReleaseComObject(linkA); + linkA = null; + } + } + + internal string ShortCutFile + { + get + { + return this.shortcutFile; + } + set + { + this.shortcutFile = value; + } + } + + internal string IconPath + { + get + { + StringBuilder iconPath = new StringBuilder(260, 260); + int iconIndex = 0; + if (linkA == null) + { + linkW.GetIconLocation(iconPath, iconPath.Capacity, out + iconIndex); + } + else + { + linkA.GetIconLocation(iconPath, iconPath.Capacity, out + iconIndex); + } + return iconPath.ToString(); + } + set + { + StringBuilder iconPath = new StringBuilder(260, 260); + int iconIndex = 0; + if (linkA == null) + { + linkW.GetIconLocation(iconPath, iconPath.Capacity, out + iconIndex); + } + else + { + linkA.GetIconLocation(iconPath, iconPath.Capacity, out + iconIndex); + } + if (linkA == null) + { + linkW.SetIconLocation(value, iconIndex); + } + else + { + linkA.SetIconLocation(value, iconIndex); + } + } + } + + internal int IconIndex + { + get + { + StringBuilder iconPath = new StringBuilder(260, 260); + int iconIndex = 0; + if (linkA == null) + { + linkW.GetIconLocation(iconPath, iconPath.Capacity, out + iconIndex); + } + else + { + linkA.GetIconLocation(iconPath, iconPath.Capacity, out + iconIndex); + } + return iconIndex; + } + set + { + StringBuilder iconPath = new StringBuilder(260, 260); + int iconIndex = 0; + if (linkA == null) + { + linkW.GetIconLocation(iconPath, iconPath.Capacity, out + iconIndex); + } + else + { + linkA.GetIconLocation(iconPath, iconPath.Capacity, out + iconIndex); + } + if (linkA == null) + { + linkW.SetIconLocation(iconPath.ToString(), value); + } + else + { + linkA.SetIconLocation(iconPath.ToString(), value); + } + } + } + + internal string Target + { + get + { + StringBuilder target = new StringBuilder(260, 260); + if (linkA == null) + { + _WIN32_FIND_DATAW fd = new _WIN32_FIND_DATAW(); + linkW.GetPath(target, target.Capacity, ref fd, + (uint)EShellLinkGP.SLGP_UNCPRIORITY); + } + else + { + _WIN32_FIND_DATAA fd = new _WIN32_FIND_DATAA(); + linkA.GetPath(target, target.Capacity, ref fd, + (uint)EShellLinkGP.SLGP_UNCPRIORITY); + } + return target.ToString(); + } + set + { + if (linkA == null) + { + linkW.SetPath(value); + } + else + { + linkA.SetPath(value); + } + } + } + + internal string WorkingDirectory + { + get + { + StringBuilder path = new StringBuilder(260, 260); + if (linkA == null) + { + linkW.GetWorkingDirectory(path, path.Capacity); + } + else + { + linkA.GetWorkingDirectory(path, path.Capacity); + } + return path.ToString(); + } + set + { + if (linkA == null) + { + linkW.SetWorkingDirectory(value); + } + else + { + linkA.SetWorkingDirectory(value); + } + } + } + + internal string Description + { + get + { + StringBuilder description = new StringBuilder(1024, 1024); + if (linkA == null) + { + linkW.GetDescription(description, description.Capacity); + } + else + { + linkA.GetDescription(description, description.Capacity); + } + return description.ToString(); + } + set + { + if (linkA == null) + { + linkW.SetDescription(value); + } + else + { + linkA.SetDescription(value); + } + } + } + + internal string Arguments + { + get + { + StringBuilder arguments = new StringBuilder(260, 260); + if (linkA == null) + { + linkW.GetArguments(arguments, arguments.Capacity); + } + else + { + linkA.GetArguments(arguments, arguments.Capacity); + } + return arguments.ToString(); + } + set + { + if (linkA == null) + { + linkW.SetArguments(value); + } + else + { + linkA.SetArguments(value); + } + } + } + + internal LinkDisplayMode DisplayMode + { + get + { + uint cmd = 0; + if (linkA == null) + { + linkW.GetShowCmd(out cmd); + } + else + { + linkA.GetShowCmd(out cmd); + } + return (LinkDisplayMode)cmd; + } + set + { + if (linkA == null) + { + linkW.SetShowCmd((uint)value); + } + else + { + linkA.SetShowCmd((uint)value); + } + } + } + + internal Keys HotKey + { + get + { + short key = 0; + if (linkA == null) + { + linkW.GetHotkey(out key); + } + else + { + linkA.GetHotkey(out key); + } + return (Keys)key; + } + set + { + if (linkA == null) + { + linkW.SetHotkey((short)value); + } + else + { + linkA.SetHotkey((short)value); + } + } + } + + internal void Save() + { + Save(shortcutFile); + } + + internal void Save(string linkFile + ) + { + if (linkA == null) + { + ((IPersistFile)linkW).Save(linkFile, true); + shortcutFile = linkFile; + } + else + { + ((IPersistFile)linkA).Save(linkFile, true); + shortcutFile = linkFile; + } + } + + internal void Open(string linkFile) + { + Open(linkFile, + IntPtr.Zero, + (EShellLinkResolveFlags.SLR_ANY_MATCH | + EShellLinkResolveFlags.SLR_NO_UI), 1); + } + + internal void Open( + string linkFile, + IntPtr hWnd, + EShellLinkResolveFlags resolveFlags + ) + { + Open(linkFile, + hWnd, + resolveFlags, + 1); + } + + internal void Open( + string linkFile, + IntPtr hWnd, + EShellLinkResolveFlags resolveFlags, + ushort timeOut + ) + { + uint flags; + + if ((resolveFlags & EShellLinkResolveFlags.SLR_NO_UI) + == EShellLinkResolveFlags.SLR_NO_UI) + { + flags = (uint)((int)resolveFlags | (timeOut << 16)); + } + else + { + flags = (uint)resolveFlags; + } + + if (linkA == null) + { + ((IPersistFile)linkW).Load(linkFile, 0); //STGM_DIRECT) + linkW.Resolve(hWnd, flags); + this.shortcutFile = linkFile; + } + else + { + ((IPersistFile)linkA).Load(linkFile, 0); //STGM_DIRECT) + linkA.Resolve(hWnd, flags); + this.shortcutFile = linkFile; + } + } + } + +} + diff --git a/nspector/Native/WINAPI/TaskBarList3.cs b/nspector/Native/WINAPI/TaskBarList3.cs new file mode 100644 index 0000000..de7f148 --- /dev/null +++ b/nspector/Native/WINAPI/TaskBarList3.cs @@ -0,0 +1,161 @@ +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace nspector.Native.WINAPI +{ + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + internal struct THUMBBUTTON + { + Int32 dwMask; + uint iId; + uint iBitmap; + IntPtr hIcon; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + string szTip; + Int32 dwFlags; + } + + [Flags] + internal enum THBF + { + THBF_ENABLED = 0x0000, + THBF_DISABLED = 0x0001, + THBF_DISMISSONCLICK = 0x0002, + THBF_NOBACKGROUND = 0x0004, + THBF_HIDDEN = 0x0008 + } + + [Flags] + internal enum THB + { + THB_BITMAP = 0x0001, + THB_ICON = 0x0002, + THB_TOOLTIP = 0x0004, + THB_FLAGS = 0x0008, + THBN_CLICKED = 0x1800 + } + + internal enum TBPFLAG + { + TBPF_NOPROGRESS = 0, + TBPF_INDETERMINATE = 0x1, + TBPF_NORMAL = 0x2, + TBPF_ERROR = 0x4, + TBPF_PAUSED = 0x8 + } + + internal enum TBATFLAG + { + TBATF_USEMDITHUMBNAIL = 0x1, + TBATF_USEMDILIVEPREVIEW = 0x2 + } + + [ComImport, + Guid("EA1AFB91-9E28-4B86-90E9-9E9F8A5EEFAF"), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface ITaskbarList3 + { + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void HrInit(); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void AddTab([In] IntPtr hwnd); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void DeleteTab([In] IntPtr hwnd); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void ActivateTab([In] IntPtr hwnd); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void SetActiveAlt([In] IntPtr hwnd); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void MarkFullscreenWindow([In] IntPtr hwnd, + [In, MarshalAs(UnmanagedType.Bool)] bool fFullscreen); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void SetProgressValue([In] IntPtr hwnd, + [In] ulong ullCompleted, + [In] ulong ullTotal); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void SetProgressState([In] IntPtr hwnd, + [In] TBPFLAG tbpFlags); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void RegisterTab([In] IntPtr hwndTab, + [In] IntPtr hwndMDI); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void UnregisterTab([In] IntPtr hwndTab); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void SetTabOrder([In] IntPtr hwndTab, + [In] IntPtr hwndInsertBefore); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void SetTabActive([In] IntPtr hwndTab, + [In] IntPtr hwndMDI, + [In] TBATFLAG tbatFlags); + + //preliminary + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void ThumbBarAddButtons([In] IntPtr hwnd, + [In] uint cButtons, + [In] IntPtr pButton); + ///* [size_is][in] */ __RPC__in_ecount_full(cButtons) LPTHUMBBUTTON pButton); + + //preliminary + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void ThumbBarUpdateButtons([In] IntPtr hwnd, + [In] uint cButtons, + [In] IntPtr pButton); + ///* [size_is][in] */ __RPC__in_ecount_full(cButtons) LPTHUMBBUTTON pButton); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void ThumbBarSetImageList([In] IntPtr hwnd, + [In] IntPtr himl); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void SetOverlayIcon([In] IntPtr hwnd, + [In] IntPtr hIcon, + [In, MarshalAs(UnmanagedType.LPWStr)] string pszDescription); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void SetThumbnailTooltip([In] IntPtr hwnd, + [In, MarshalAs(UnmanagedType.LPWStr)] string pszTip); + + //preliminary + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void SetThumbnailClip([In] IntPtr hwnd, + [In] IntPtr prcClip); + + } + + + [ComImport] + [Guid("56FDF344-FD6D-11d0-958A-006097C9A090")] + internal class TaskbarList { } + +} diff --git a/nspector/Program.cs b/nspector/Program.cs new file mode 100644 index 0000000..6c1d616 --- /dev/null +++ b/nspector/Program.cs @@ -0,0 +1,123 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Threading; +using System.Windows.Forms; +using nspector.Common; +using nspector.Common.Import; +using nspector.Native.WINAPI; + +namespace nspector +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main(string[] args) + { +#if DEBUG + if (!Debugger.IsAttached) + { + Application.EnableVisualStyles(); + MessageBox.Show("Something unexpected has happened! Exit!","Error!"); + return; + } +#endif + + try + { + // Remove Zone.Identifier from Alternate Data Stream + SafeNativeMethods.DeleteFile(Application.ExecutablePath + ":Zone.Identifier"); + } + catch { } + + try + { + + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + + if (args.Length == 1 && File.Exists(args[0])) + { + + if (new FileInfo(args[0]).Extension.ToLower() == ".nip") + { + try + { + var import = DrsServiceLocator.ImportService; + import.ImportProfiles(args[0]); + GC.Collect(); + Process current = Process.GetCurrentProcess(); + foreach ( + Process process in + Process.GetProcessesByName(current.ProcessName.Replace(".vshost", ""))) + { + if (process.Id != current.Id && process.MainWindowTitle.Contains("Settings")) + { + MessageHelper mh = new MessageHelper(); + mh.sendWindowsStringMessage((int)process.MainWindowHandle, 0, "ProfilesImported"); + } + } + MessageBox.Show("Profile(s) successfully imported!", Application.ProductName, + MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + MessageBox.Show("Import Error: " + ex.Message, Application.ProductName + " Error", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + else if (ArgExists(args, "-createCSN")) + { + File.WriteAllText("CustomSettingNames.xml", Properties.Resources.CustomSettingNames); + } + else + { + + bool createdNew = true; + using (Mutex mutex = new Mutex(true, Application.ProductName, out createdNew)) + { + if (createdNew) + { + Application.Run(new frmDrvSettings(ArgExists(args, "-showOnlyCSN"), ArgExists(args, "-disableScan"))); + } + else + { + Process current = Process.GetCurrentProcess(); + foreach ( + Process process in + Process.GetProcessesByName(current.ProcessName.Replace(".vshost", ""))) + { + if (process.Id != current.Id && process.MainWindowTitle.Contains("Settings")) + { + MessageHelper mh = new MessageHelper(); + mh.bringAppToFront((int)process.MainWindowHandle); + } + } + } + } + } + + } + catch (Exception ex) + { + MessageBox.Show(ex.Message + "\r\n\r\n" + ex.StackTrace ,"Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + static bool ArgExists(string[] args, string arg) + { + foreach (string a in args) + { + if (a.ToUpper() == arg.ToUpper()) + return true; + } + return false; + } + } +} diff --git a/nspector/Properties/AssemblyInfo.cs b/nspector/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9a96abe --- /dev/null +++ b/nspector/Properties/AssemblyInfo.cs @@ -0,0 +1,38 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("nvidiaProfileInspector")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("NVIDIA Profile Inspector")] +[assembly: AssemblyCopyright("©2016 by Orbmu2k")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c2fe2861-54c5-4d63-968e-30472019bed3")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("2.1.1.1")] +[assembly: AssemblyFileVersion("2.1.1.1")] +[assembly: InternalsVisibleTo("nspector.Test")] + diff --git a/nspector/Properties/Resources.Designer.cs b/nspector/Properties/Resources.Designer.cs new file mode 100644 index 0000000..b5012af --- /dev/null +++ b/nspector/Properties/Resources.Designer.cs @@ -0,0 +1,253 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +namespace nspector.Properties { + using System; + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("nspector.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap apply { + get { + object obj = ResourceManager.GetObject("apply", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die <?xml version="1.0" encoding="utf-8"?> + ///<CustomSettingNames> + /// <ShowCustomizedSettingNamesOnly>false</ShowCustomizedSettingNamesOnly> + /// <Settings> + /// <CustomSetting> + /// <UserfriendlyName>Enable Maxwell sample interleaving (MFAA)</UserfriendlyName> + /// <HexSettingID>0x0098C1AC</HexSettingID> + /// <GroupName>3 - Antialiasing</GroupName> + /// <MinRequiredDriverVersion>344.11</MinRequiredDriverVersion> + /// <SettingValues> + /// <CustomSettingValue> + /// <UserfriendlyName>Off</Userfrie [Rest der Zeichenfolge wurde abgeschnitten]"; ähnelt. + /// + public static string CustomSettingNames { + get { + return ResourceManager.GetString("CustomSettingNames", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap export1 { + get { + object obj = ResourceManager.GetObject("export1", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap filter_user { + get { + object obj = ResourceManager.GetObject("filter_user", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap find_set2 { + get { + object obj = ResourceManager.GetObject("find_set2", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap home_sm { + get { + object obj = ResourceManager.GetObject("home_sm", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Icon ähnlich wie (Symbol). + /// + public static System.Drawing.Icon Icon1 { + get { + object obj = ResourceManager.GetObject("Icon1", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap ieframe_1_18212 { + get { + object obj = ResourceManager.GetObject("ieframe_1_18212", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap ieframe_1_31073_002 { + get { + object obj = ResourceManager.GetObject("ieframe_1_31073_002", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap import1 { + get { + object obj = ResourceManager.GetObject("import1", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap n1_016 { + get { + object obj = ResourceManager.GetObject("n1-016", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap nv_btn { + get { + object obj = ResourceManager.GetObject("nv_btn", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap PortableDeviceStatus_3_16_011 { + get { + object obj = ResourceManager.GetObject("PortableDeviceStatus_3_16_011", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Icon ähnlich wie (Symbol). + /// + public static System.Drawing.Icon shield16 { + get { + object obj = ResourceManager.GetObject("shield16", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap text_binary { + get { + object obj = ResourceManager.GetObject("text_binary", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap transparent16 { + get { + object obj = ResourceManager.GetObject("transparent16", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap window_application_add { + get { + object obj = ResourceManager.GetObject("window_application_add", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap window_application_delete { + get { + object obj = ResourceManager.GetObject("window_application_delete", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/nspector/Properties/Resources.resx b/nspector/Properties/Resources.resx new file mode 100644 index 0000000..7d0b546 --- /dev/null +++ b/nspector/Properties/Resources.resx @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Images\transparent16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\filter_user.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\apply.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\export1.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\ieframe_1_18212.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\window_application_delete.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\home_sm.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\window_application_add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + + + AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAHJyciV6enqzf39/7H9/f+96enqucnJyIgAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAHV1dUp+fn7nz8/P+NfX1/zX19f7yMjI+H5+fud1dXVKAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAHR0dEp/f3/p19fX+Yewwv84hq//tWY1/7yWZf/Pz8/4f39/6nR0 + dEoAAAAAAAAAAAAAAAAAAAAAAAAAAHFxcRh+fn7e19fX+VWwzP9Nv9v/Pcrq/9l/Hv/Pdjj/t3RA/9DQ + 0Ph+fn7bcXFxGAAAAAAAAAAAAAAAAAAAAAB6enq72NjY+E2qx/9Q1O3/V+L2/z/b8f/Zfxf/9aQq/+qT + LP/BfkH/1tbW93l5eaYAAAAAAAAAAAAAAABycnIikJCQ19fX1/o2sdv/U933/03k9/8/2vH/2HsT//eI + EP/1nSH/0Hcu/9PBqvqPj4/OcXFxHAAAAAAAAAAAdnZ2bb6+vvFAo9L/PMfp/0vi9/9G6ff/P9rx/9h6 + Ef/ufgf/940Y//CZHv/NhSf/urq653Z2dnIAAAAAAAAAAHp6ep/U1NT4K4+k/zfH5f8+2O//Ptjv/z3Z + 8P/WeRH/13UK/9h5EP/agB//uXQ8/9DQ0Pd6enqlAAAAAAAAAAB9fX3S3t7e/c19Dv/Sgh//x3of/8Ny + Iv/GciT/Ir/l/ya85f8pvOP/Jrbd/zacyf/X19f6fX190gAAAAAAAAAAfn5+3N3d3f7ahhL/3Jcm/92R + If/Ndyz/wW0o/yLD5v8ky+z/KM/v/yrW8v8zocj/19fX/H5+fuMAAAAAAAAAAH5+ft7c3Nz+2oYS/+u2 + Wv/orkr/3JAu/8V2LP8qvuT/Vev+/2To/f8f5/3/NZrE/9fX1/x/f3/jAAAAAAAAAAB+fn7d3d3d/uaS + Hf/msVr/7smC/+y1WP/Ohif/M7vi/3To+v806f7/KcLe/ziayP/X19f8f39/4wAAAAAAAAAAfHx80s3N + zfrY2Nj+25Aj/9CHKP/tyIL/048r/x6x3P8f4/n/L7LR/0moxv/Pz8/6zc3N+nx8fNwAAAAAAAAAAHNz + c0yIiIjJioqK6NDQ0PnR0dH9x5FF/8+RNf80osH/RLHP/8DAwPnMzMz3ioqK6IiIiL1zc3NMAAAAAAAA + AAAAAAAAAAAAAHJyciCXl5eVmJiY6MrKyvrY2Nj919fX/MnJyfiUlJTml5eXmHJyciAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAHJyciGIiIi/iYmJ6ImJieqHh4e8cnJyEwAAAAAAAAAAAAAAAAAA + AAAAAAAA+B8AAPAPAADgBwAAwAMAAMADAACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIAB + AADgBwAA+B8AAA== + + + + ..\Images\PortableDeviceStatus_3_16-011.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\text_binary.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\nv_btn.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\import1.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\ieframe_1_31073-002.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\find_set2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\n1-016.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + + AAABAAIAEBAQAAAABAAoAQAAJgAAACAgEAAAAAQA6AIAAE4BAAAoAAAAEAAAACAAAAABAAQAAAAAAMAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAICAgADAwMAAAAD/AAD/ + AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAH//j/j/jwAAf/+P+P+PAAB4iIiIiIgAAH93h3h3 + jwAAf3eHeHePAAB4iIiIiIgAAH93h3h3jwAAf3eHeHePAAB4iIiIiIgAAH93h3h3jwAAf3eHeHePAAB4 + iIiIgAAAAH//j/j39wAAf/+P+PdwAAB3d3d3dwAAwAEAAMABAADAAQAAwAEAAMABAADAAQAAwAEAAMAB + AADAAQAAwAEAAMABAADAAQAAwAEAAMADAADABwAAwA8AACgAAAAgAAAAQAAAAAEABAAAAAAAgAIAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD/ + /wD/AAAA/wD/AP//AAD///8AAAAAAAAAAAAAAAAAAAAAAAAHiIiIiIiIiIiIiIiIAAAAB/////j///j/ + //j/+AAAAAf////4///4///4//gAAAAH////+P//+P//+P/4AAAAB/////j///j///j/+AAAAAf////4 + ///4///4//gAAAAHiIiIiIiIiIiIiIiIAAAAB/94eHh4eHh4eHj/+AAAAAf/h4eIh4eIh4eI//gAAAAH + /3h4eHh4eHh4eP/4AAAAB/+Hh4iHh4iHh4j/+AAAAAf/eHh4eHh4eHh4//gAAAAHiIiIiIiIiIiIiIiI + AAAAB/94eHh4eHh4eHj/+AAAAAf/h4eIh4eIh4eI//gAAAAH/3h4eHh4eHh4eP/4AAAAB/+Hh4iHh4iH + h4j/+AAAAAf/eHh4eHh4eHh4//gAAAAHiIiIiIiIiIiIiIiIAAAAB/94eHh4eHh4eHj/+AAAAAf/h4eI + h4eIh4eI//gAAAAH/3h4eHh4eHh4eP/4AAAAB/+Hh4iHh4iHh4j/+AAAAAf/eHh4eHh4eHh4//gAAAAH + iIiIiIiIiIiIcAAAAAAAB/////j///j//3/4cAAAAAf////4///4//9/hwAAAAAH////+P//+P//eHAA + AAAAB/////j///j//3cAAAAAAAf////4///4//9wAAAAAAAHd3d3d3d3d3d3cAAAAADgAAAH4AAAB+AA + AAfgAAAH4AAAB+AAAAfgAAAH4AAAB+AAAAfgAAAH4AAAB+AAAAfgAAAH4AAAB+AAAAfgAAAH4AAAB+AA + AAfgAAAH4AAAB+AAAAfgAAAH4AAAB+AAAAfgAAAH4AAAB+AAAA/gAAAf4AAAP+AAAH/gAAD/4AAB/w== + + + + ..\CustomSettingNames.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + + \ No newline at end of file diff --git a/nspector/app.config b/nspector/app.config new file mode 100644 index 0000000..57c0f2c --- /dev/null +++ b/nspector/app.config @@ -0,0 +1,3 @@ + + + diff --git a/nspector/app.manifest b/nspector/app.manifest new file mode 100644 index 0000000..0060310 --- /dev/null +++ b/nspector/app.manifest @@ -0,0 +1,15 @@ + + + + + + + + + + + + false + + + \ No newline at end of file diff --git a/nspector/frmBitEditor.Designer.cs b/nspector/frmBitEditor.Designer.cs new file mode 100644 index 0000000..ce206f3 --- /dev/null +++ b/nspector/frmBitEditor.Designer.cs @@ -0,0 +1,253 @@ +namespace nspector +{ + partial class frmBitEditor + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.btnClose = new System.Windows.Forms.Button(); + this.lValue = new System.Windows.Forms.Label(); + this.lFilter = new System.Windows.Forms.Label(); + this.tbFilter = new System.Windows.Forms.TextBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.btnDirectApplyStart = new System.Windows.Forms.Button(); + this.gbDirectTest = new System.Windows.Forms.GroupBox(); + this.btnBrowseGame = new System.Windows.Forms.Button(); + this.tbGamePath = new System.Windows.Forms.TextBox(); + this.lblGamePath = new System.Windows.Forms.Label(); + this.clbBits = new nspector.ListViewEx(); + this.chBit = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chProfileCount = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chProfileNames = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.gbDirectTest.SuspendLayout(); + this.SuspendLayout(); + // + // btnClose + // + this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnClose.Location = new System.Drawing.Point(914, 806); + this.btnClose.Margin = new System.Windows.Forms.Padding(4); + this.btnClose.Name = "btnClose"; + this.btnClose.Size = new System.Drawing.Size(132, 29); + this.btnClose.TabIndex = 1; + this.btnClose.Text = "Apply && Close"; + this.btnClose.UseVisualStyleBackColor = true; + this.btnClose.Click += new System.EventHandler(this.btnClose_Click); + // + // lValue + // + this.lValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lValue.AutoSize = true; + this.lValue.Location = new System.Drawing.Point(21, 813); + this.lValue.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lValue.Name = "lValue"; + this.lValue.Size = new System.Drawing.Size(48, 17); + this.lValue.TabIndex = 2; + this.lValue.Text = "Value:"; + // + // lFilter + // + this.lFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lFilter.AutoSize = true; + this.lFilter.Location = new System.Drawing.Point(187, 813); + this.lFilter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lFilter.Name = "lFilter"; + this.lFilter.Size = new System.Drawing.Size(87, 17); + this.lFilter.TabIndex = 23; + this.lFilter.Text = "Profile Filter:"; + // + // tbFilter + // + this.tbFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tbFilter.Location = new System.Drawing.Point(274, 809); + this.tbFilter.Margin = new System.Windows.Forms.Padding(4); + this.tbFilter.Name = "tbFilter"; + this.tbFilter.Size = new System.Drawing.Size(632, 22); + this.tbFilter.TabIndex = 24; + this.tbFilter.TextChanged += new System.EventHandler(this.tbFilter_TextChanged); + // + // textBox1 + // + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.textBox1.Location = new System.Drawing.Point(74, 809); + this.textBox1.Margin = new System.Windows.Forms.Padding(4); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(86, 22); + this.textBox1.TabIndex = 31; + this.textBox1.Text = "0x00FF00FF"; + this.textBox1.Leave += new System.EventHandler(this.textBox1_Leave); + this.textBox1.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.textBox1_PreviewKeyDown); + // + // btnDirectApplyStart + // + this.btnDirectApplyStart.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnDirectApplyStart.Location = new System.Drawing.Point(6, 19); + this.btnDirectApplyStart.Margin = new System.Windows.Forms.Padding(4); + this.btnDirectApplyStart.Name = "btnDirectApplyStart"; + this.btnDirectApplyStart.Size = new System.Drawing.Size(105, 42); + this.btnDirectApplyStart.TabIndex = 32; + this.btnDirectApplyStart.Text = "GO!"; + this.btnDirectApplyStart.UseVisualStyleBackColor = true; + this.btnDirectApplyStart.Click += new System.EventHandler(this.btnDirectApply_Click); + // + // gbDirectTest + // + this.gbDirectTest.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.gbDirectTest.Controls.Add(this.btnBrowseGame); + this.gbDirectTest.Controls.Add(this.tbGamePath); + this.gbDirectTest.Controls.Add(this.lblGamePath); + this.gbDirectTest.Controls.Add(this.btnDirectApplyStart); + this.gbDirectTest.Location = new System.Drawing.Point(18, 733); + this.gbDirectTest.Margin = new System.Windows.Forms.Padding(4); + this.gbDirectTest.Name = "gbDirectTest"; + this.gbDirectTest.Padding = new System.Windows.Forms.Padding(4); + this.gbDirectTest.Size = new System.Drawing.Size(1029, 66); + this.gbDirectTest.TabIndex = 33; + this.gbDirectTest.TabStop = false; + this.gbDirectTest.Text = "Quick Bit Value Tester (stores this setting value to the current profile and imme" + + "diately starts the game when successful)"; + // + // btnBrowseGame + // + this.btnBrowseGame.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnBrowseGame.Location = new System.Drawing.Point(971, 24); + this.btnBrowseGame.Margin = new System.Windows.Forms.Padding(4); + this.btnBrowseGame.Name = "btnBrowseGame"; + this.btnBrowseGame.Size = new System.Drawing.Size(41, 29); + this.btnBrowseGame.TabIndex = 35; + this.btnBrowseGame.Text = "..."; + this.btnBrowseGame.UseVisualStyleBackColor = true; + this.btnBrowseGame.Click += new System.EventHandler(this.btnBrowseGame_Click); + // + // tbGamePath + // + this.tbGamePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tbGamePath.Location = new System.Drawing.Point(218, 26); + this.tbGamePath.Margin = new System.Windows.Forms.Padding(4); + this.tbGamePath.Name = "tbGamePath"; + this.tbGamePath.Size = new System.Drawing.Size(745, 22); + this.tbGamePath.TabIndex = 34; + // + // lblGamePath + // + this.lblGamePath.AutoSize = true; + this.lblGamePath.Location = new System.Drawing.Point(119, 29); + this.lblGamePath.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblGamePath.Name = "lblGamePath"; + this.lblGamePath.Size = new System.Drawing.Size(98, 17); + this.lblGamePath.TabIndex = 33; + this.lblGamePath.Text = "Game to start:"; + // + // clbBits + // + this.clbBits.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.clbBits.CheckBoxes = true; + this.clbBits.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.chBit, + this.chName, + this.chProfileCount, + this.chProfileNames}); + this.clbBits.FullRowSelect = true; + this.clbBits.GridLines = true; + this.clbBits.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.clbBits.Location = new System.Drawing.Point(12, 12); + this.clbBits.MultiSelect = false; + this.clbBits.Name = "clbBits"; + this.clbBits.ShowGroups = false; + this.clbBits.Size = new System.Drawing.Size(1035, 714); + this.clbBits.TabIndex = 34; + this.clbBits.UseCompatibleStateImageBehavior = false; + this.clbBits.View = System.Windows.Forms.View.Details; + this.clbBits.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.clbBits_ItemCheck); + // + // chBit + // + this.chBit.Text = "Bit"; + // + // chName + // + this.chName.Text = "Name"; + this.chName.Width = 200; + // + // chProfileCount + // + this.chProfileCount.Text = "Count"; + // + // chProfileNames + // + this.chProfileNames.Text = "Profiles"; + this.chProfileNames.Width = 4000; + // + // frmBitEditor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(120F, 120F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.ClientSize = new System.Drawing.Size(1059, 847); + this.Controls.Add(this.clbBits); + this.Controls.Add(this.gbDirectTest); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.tbFilter); + this.Controls.Add(this.lFilter); + this.Controls.Add(this.lValue); + this.Controls.Add(this.btnClose); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; + this.Margin = new System.Windows.Forms.Padding(4); + this.MinimumSize = new System.Drawing.Size(854, 609); + this.Name = "frmBitEditor"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Bit Value Editor"; + this.Load += new System.EventHandler(this.frmBitEditor_Load); + this.gbDirectTest.ResumeLayout(false); + this.gbDirectTest.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.Button btnClose; + private System.Windows.Forms.Label lValue; + private System.Windows.Forms.Label lFilter; + private System.Windows.Forms.TextBox tbFilter; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button btnDirectApplyStart; + private System.Windows.Forms.GroupBox gbDirectTest; + private System.Windows.Forms.Button btnBrowseGame; + private System.Windows.Forms.TextBox tbGamePath; + private System.Windows.Forms.Label lblGamePath; + private ListViewEx clbBits; + private System.Windows.Forms.ColumnHeader chBit; + private System.Windows.Forms.ColumnHeader chProfileCount; + private System.Windows.Forms.ColumnHeader chName; + private System.Windows.Forms.ColumnHeader chProfileNames; + } +} \ No newline at end of file diff --git a/nspector/frmBitEditor.cs b/nspector/frmBitEditor.cs new file mode 100644 index 0000000..dbacdbe --- /dev/null +++ b/nspector/frmBitEditor.cs @@ -0,0 +1,245 @@ +using System; +using System.Diagnostics; +using System.Drawing; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Windows.Forms; +using nspector.Common; +using nspector.Common.CustomSettings; + +namespace nspector +{ + internal partial class frmBitEditor : Form + { + private uint _Settingid = 0; + private frmDrvSettings _SettingsOwner = null; + private uint _InitValue = 0; + private uint _CurrentValue = 0; + + + internal frmBitEditor() + { + InitializeComponent(); + this.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); + this.DoubleBuffered = true; + } + + internal void ShowDialog(frmDrvSettings SettingsOwner, uint SettingId, uint InitValue, string SettingName) + { + _Settingid = SettingId; + _SettingsOwner = SettingsOwner; + _InitValue = InitValue; + Text = string.Format("Bit Value Editor - {0}", SettingName); + this.ShowDialog(SettingsOwner); + } + + private void frmBitEditor_Load(object sender, EventArgs e) + { + SplitBitsFromUnknownSettings(); + clbBits.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); + SetValue(_InitValue); + } + + private void SplitBitsFromUnknownSettings() + { + uint lastValue = 0; + lastValue = _CurrentValue; + string[] filters = tbFilter.Text.Split(','); + clbBits.Items.Clear(); + + var referenceSettings = DrsServiceLocator.ReferenceSettings?.Settings.FirstOrDefault(s => s.SettingId == _Settingid); + + var settingsCache = DrsServiceLocator.ScannerService.CachedSettings.FirstOrDefault(x => x.SettingId == _Settingid); + if (settingsCache != null) + { + for (int bit = 0; bit < 32; bit++) + { + string profileNames = ""; + uint profileCount = 0; + + for (int i = 0; i < settingsCache.SettingValues.Count; i++) + { + if (((settingsCache.SettingValues[i].Value >> bit) & 0x1) == 0x1) + { + if (filters.Length == 0) + { + profileNames += settingsCache.SettingValues[i].ProfileNames + ","; + } + else + { + string[] settingProfileNames = settingsCache.SettingValues[i].ProfileNames.ToString().Split(','); + for (int p = 0; p < settingProfileNames.Length; p++) + { + for (int f = 0; f < filters.Length; f++) + { + if (settingProfileNames[p].ToLower().Contains(filters[f].ToLower())) + { + profileNames += settingProfileNames[p] + ","; + } + } + } + } + profileCount += settingsCache.SettingValues[i].ValueProfileCount; + } + } + + uint mask = (uint)1 << bit; + string maskStr=""; + + if (referenceSettings != null) + { + var maskValue = referenceSettings.SettingValues.FirstOrDefault(v => v.SettingValue == mask); + if (maskValue != null) + { + maskStr = maskValue.UserfriendlyName; + if (maskStr.Contains("(")) + { + maskStr = maskStr.Substring(0, maskStr.IndexOf("(") - 1); + } + } + } + + clbBits.Items.Add(new ListViewItem(new string[] { + string.Format("#{0:00}",bit), + maskStr, + profileCount.ToString(), + profileNames, + })); + + } + } + + SetValue(lastValue); + } + + private void updateValue(bool changeState, int changedIndex) + { + uint val = 0; + for (int b = 0; b < clbBits.Items.Count; b++) + { + if (((clbBits.Items[b].Checked) && changedIndex != b) || (changeState && (changedIndex == b))) + { + val = (uint)((uint)val | (uint)(1 << b)); + } + } + + UpdateCurrent(val); + } + + private void UpdateValue() + { + uint val = 0; + for (int b = 0; b < clbBits.Items.Count; b++) + { + if (clbBits.Items[b].Checked) + { + val = (uint)((uint)val | (uint)(1 << b)); + } + } + + UpdateCurrent(val); + } + + + private void SetValue(uint val) + { + for (int b = 0; b < clbBits.Items.Count; b++) + { + if (((val >> b) & 0x1) == 0x1) + clbBits.Items[b].Checked = true; + else + clbBits.Items[b].Checked = false; + } + + UpdateValue(); + } + + private void UpdateCurrent(uint val) + { + _CurrentValue = val; + textBox1.Text = "0x" + (val).ToString("X8"); + } + + private void UpdateCurrent(string text) + { + uint val = DrsUtil.ParseDwordByInputSafe(text); + UpdateCurrent(val); + SetValue(val); + } + + private void clbBits_ItemCheck(object sender, ItemCheckEventArgs e) + { + updateValue(e.NewValue == CheckState.Checked, e.Index); + } + + private void btnClose_Click(object sender, EventArgs e) + { + _SettingsOwner.SetSelectedDwordValue(_CurrentValue); + Close(); + } + + private void tbFilter_TextChanged(object sender, EventArgs e) + { + SplitBitsFromUnknownSettings(); + } + + private void numericUpDown1_ValueChanged(object sender, EventArgs e) + { + SplitBitsFromUnknownSettings(); + } + + private void textBox1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) + { + if (e.KeyValue == 13) + { + UpdateCurrent(textBox1.Text); + } + } + + private void textBox1_Leave(object sender, EventArgs e) + { + UpdateCurrent(textBox1.Text); + } + + + private void ApplyValueToProfile(uint val) + { + DrsServiceLocator + .SettingService + .SetDwordValueToProfile(_SettingsOwner._CurrentProfile, _Settingid, val); + } + + private uint GetStoredValue() + { + return DrsServiceLocator + .SettingService + .GetDwordValueFromProfile(_SettingsOwner._CurrentProfile, _Settingid); + } + + private void btnDirectApply_Click(object sender, EventArgs e) + { + ApplyValueToProfile(_CurrentValue); + while (GetStoredValue() != _CurrentValue) + Application.DoEvents(); + if (File.Exists(tbGamePath.Text)) + { + Process.Start(tbGamePath.Text); + } + } + + private void btnBrowseGame_Click(object sender, EventArgs e) + { + OpenFileDialog ofd = new OpenFileDialog(); + ofd.DefaultExt = "*.exe"; + ofd.Filter = "Applications|*.exe"; + ofd.DereferenceLinks = false; + + if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + tbGamePath.Text = ofd.FileName; + } + } + + } +} diff --git a/nspector/frmBitEditor.resx b/nspector/frmBitEditor.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/nspector/frmBitEditor.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/nspector/frmDrvSettings.Designer.cs b/nspector/frmDrvSettings.Designer.cs new file mode 100644 index 0000000..b558c77 --- /dev/null +++ b/nspector/frmDrvSettings.Designer.cs @@ -0,0 +1,601 @@ +namespace nspector +{ + partial class frmDrvSettings + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmDrvSettings)); + this.ilListView = new System.Windows.Forms.ImageList(this.components); + this.pbMain = new System.Windows.Forms.ProgressBar(); + this.tsMain = new System.Windows.Forms.ToolStrip(); + this.tslProfiles = new System.Windows.Forms.ToolStripLabel(); + this.cbProfiles = new System.Windows.Forms.ToolStripComboBox(); + this.tsbModifiedProfiles = new System.Windows.Forms.ToolStripSplitButton(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.tsbRefreshProfile = new System.Windows.Forms.ToolStripButton(); + this.tsbRestoreProfile = new System.Windows.Forms.ToolStripButton(); + this.tsbCreateProfile = new System.Windows.Forms.ToolStripButton(); + this.tsbDeleteProfile = new System.Windows.Forms.ToolStripButton(); + this.tsSep2 = new System.Windows.Forms.ToolStripSeparator(); + this.tsbAddApplication = new System.Windows.Forms.ToolStripButton(); + this.tssbRemoveApplication = new System.Windows.Forms.ToolStripSplitButton(); + this.tsSep3 = new System.Windows.Forms.ToolStripSeparator(); + this.tsbExportProfiles = new System.Windows.Forms.ToolStripSplitButton(); + this.exportUserdefinedProfilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.exportCurrentProfileOnlyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.exportAllProfilesNVIDIATextFormatToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.tsbImportProfiles = new System.Windows.Forms.ToolStripSplitButton(); + this.importProfilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.importAllProfilesNVIDIATextFormatToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.tsSep4 = new System.Windows.Forms.ToolStripSeparator(); + this.tscbShowCustomSettingNamesOnly = new System.Windows.Forms.ToolStripButton(); + this.tsSep5 = new System.Windows.Forms.ToolStripSeparator(); + this.tscbShowScannedUnknownSettings = new System.Windows.Forms.ToolStripButton(); + this.tsbBitValueEditor = new System.Windows.Forms.ToolStripButton(); + this.tsSep6 = new System.Windows.Forms.ToolStripSeparator(); + this.tsbApplyProfile = new System.Windows.Forms.ToolStripButton(); + this.btnResetValue = new System.Windows.Forms.Button(); + this.lblApplications = new System.Windows.Forms.Label(); + this.toolStripButton5 = new System.Windows.Forms.ToolStripButton(); + this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel(); + this.toolStripButton6 = new System.Windows.Forms.ToolStripButton(); + this.ilCombo = new System.Windows.Forms.ImageList(this.components); + this.cbValues = new System.Windows.Forms.ComboBox(); + this.lblWidth96 = new System.Windows.Forms.Label(); + this.lblWidth330 = new System.Windows.Forms.Label(); + this.lblWidth16 = new System.Windows.Forms.Label(); + this.lblWidth30 = new System.Windows.Forms.Label(); + this.lvSettings = new nspector.ListViewEx(); + this.chSettingID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chSettingValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chSettingValueHex = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.tsMain.SuspendLayout(); + this.SuspendLayout(); + // + // ilListView + // + this.ilListView.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ilListView.ImageStream"))); + this.ilListView.TransparentColor = System.Drawing.Color.Transparent; + this.ilListView.Images.SetKeyName(0, "0_gear2.png"); + this.ilListView.Images.SetKeyName(1, "1_gear2_2.png"); + this.ilListView.Images.SetKeyName(2, "4_gear_nv2.png"); + this.ilListView.Images.SetKeyName(3, "6_gear_inherit.png"); + // + // pbMain + // + this.pbMain.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.pbMain.Location = new System.Drawing.Point(12, 692); + this.pbMain.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.pbMain.Name = "pbMain"; + this.pbMain.Size = new System.Drawing.Size(883, 9); + this.pbMain.TabIndex = 19; + // + // tsMain + // + this.tsMain.AllowMerge = false; + this.tsMain.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tsMain.AutoSize = false; + this.tsMain.BackgroundImage = global::nspector.Properties.Resources.transparent16; + this.tsMain.CanOverflow = false; + this.tsMain.Dock = System.Windows.Forms.DockStyle.None; + this.tsMain.GripMargin = new System.Windows.Forms.Padding(0); + this.tsMain.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; + this.tsMain.ImageScalingSize = new System.Drawing.Size(20, 20); + this.tsMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.tslProfiles, + this.cbProfiles, + this.tsbModifiedProfiles, + this.toolStripSeparator1, + this.tsbRefreshProfile, + this.tsbRestoreProfile, + this.tsbCreateProfile, + this.tsbDeleteProfile, + this.tsSep2, + this.tsbAddApplication, + this.tssbRemoveApplication, + this.tsSep3, + this.tsbExportProfiles, + this.tsbImportProfiles, + this.tsSep4, + this.tscbShowCustomSettingNamesOnly, + this.tsSep5, + this.tscbShowScannedUnknownSettings, + this.tsbBitValueEditor, + this.tsSep6, + this.tsbApplyProfile}); + this.tsMain.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow; + this.tsMain.Location = new System.Drawing.Point(12, 4); + this.tsMain.Name = "tsMain"; + this.tsMain.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; + this.tsMain.Size = new System.Drawing.Size(883, 25); + this.tsMain.TabIndex = 24; + this.tsMain.Text = "toolStrip1"; + // + // tslProfiles + // + this.tslProfiles.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.tslProfiles.Margin = new System.Windows.Forms.Padding(0, 5, 10, 2); + this.tslProfiles.Name = "tslProfiles"; + this.tslProfiles.Size = new System.Drawing.Size(49, 18); + this.tslProfiles.Text = "Profiles:"; + // + // cbProfiles + // + this.cbProfiles.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.cbProfiles.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.cbProfiles.AutoSize = false; + this.cbProfiles.DropDownWidth = 290; + this.cbProfiles.Margin = new System.Windows.Forms.Padding(1); + this.cbProfiles.MaxDropDownItems = 50; + this.cbProfiles.Name = "cbProfiles"; + this.cbProfiles.Size = new System.Drawing.Size(290, 23); + this.cbProfiles.SelectedIndexChanged += new System.EventHandler(this.cbProfiles_SelectedIndexChanged); + this.cbProfiles.TextChanged += new System.EventHandler(this.cbProfiles_TextChanged); + // + // tsbModifiedProfiles + // + this.tsbModifiedProfiles.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.tsbModifiedProfiles.Enabled = false; + this.tsbModifiedProfiles.Image = global::nspector.Properties.Resources.home_sm; + this.tsbModifiedProfiles.ImageTransparentColor = System.Drawing.Color.Magenta; + this.tsbModifiedProfiles.Name = "tsbModifiedProfiles"; + this.tsbModifiedProfiles.Size = new System.Drawing.Size(36, 22); + this.tsbModifiedProfiles.TextImageRelation = System.Windows.Forms.TextImageRelation.Overlay; + this.tsbModifiedProfiles.ToolTipText = "Back to global profile (Home) / User modified profiles"; + this.tsbModifiedProfiles.ButtonClick += new System.EventHandler(this.tsbModifiedProfiles_ButtonClick); + this.tsbModifiedProfiles.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.tsbModifiedProfiles_DropDownItemClicked); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); + // + // tsbRefreshProfile + // + this.tsbRefreshProfile.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.tsbRefreshProfile.Image = ((System.Drawing.Image)(resources.GetObject("tsbRefreshProfile.Image"))); + this.tsbRefreshProfile.ImageTransparentColor = System.Drawing.Color.Magenta; + this.tsbRefreshProfile.Name = "tsbRefreshProfile"; + this.tsbRefreshProfile.Size = new System.Drawing.Size(24, 22); + this.tsbRefreshProfile.Text = "Refresh current profile."; + this.tsbRefreshProfile.Click += new System.EventHandler(this.tsbRefreshProfile_Click); + // + // tsbRestoreProfile + // + this.tsbRestoreProfile.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.tsbRestoreProfile.Image = ((System.Drawing.Image)(resources.GetObject("tsbRestoreProfile.Image"))); + this.tsbRestoreProfile.ImageTransparentColor = System.Drawing.Color.Magenta; + this.tsbRestoreProfile.Name = "tsbRestoreProfile"; + this.tsbRestoreProfile.Size = new System.Drawing.Size(24, 22); + this.tsbRestoreProfile.Text = "Restore current profile to NVIDIA defaults."; + this.tsbRestoreProfile.Click += new System.EventHandler(this.tsbRestoreProfile_Click); + // + // tsbCreateProfile + // + this.tsbCreateProfile.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.tsbCreateProfile.Image = ((System.Drawing.Image)(resources.GetObject("tsbCreateProfile.Image"))); + this.tsbCreateProfile.ImageTransparentColor = System.Drawing.Color.Magenta; + this.tsbCreateProfile.Name = "tsbCreateProfile"; + this.tsbCreateProfile.Size = new System.Drawing.Size(24, 22); + this.tsbCreateProfile.Text = "Create new profile"; + this.tsbCreateProfile.Click += new System.EventHandler(this.tsbCreateProfile_Click); + // + // tsbDeleteProfile + // + this.tsbDeleteProfile.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.tsbDeleteProfile.Image = global::nspector.Properties.Resources.ieframe_1_18212; + this.tsbDeleteProfile.ImageTransparentColor = System.Drawing.Color.Magenta; + this.tsbDeleteProfile.Name = "tsbDeleteProfile"; + this.tsbDeleteProfile.Size = new System.Drawing.Size(24, 22); + this.tsbDeleteProfile.Text = "Delete current Profile"; + this.tsbDeleteProfile.Click += new System.EventHandler(this.tsbDeleteProfile_Click); + // + // tsSep2 + // + this.tsSep2.Name = "tsSep2"; + this.tsSep2.Size = new System.Drawing.Size(6, 25); + // + // tsbAddApplication + // + this.tsbAddApplication.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.tsbAddApplication.Image = global::nspector.Properties.Resources.window_application_add; + this.tsbAddApplication.ImageTransparentColor = System.Drawing.Color.Magenta; + this.tsbAddApplication.Name = "tsbAddApplication"; + this.tsbAddApplication.Size = new System.Drawing.Size(24, 22); + this.tsbAddApplication.Text = "Add application to current profile."; + this.tsbAddApplication.Click += new System.EventHandler(this.tsbAddApplication_Click); + // + // tssbRemoveApplication + // + this.tssbRemoveApplication.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.tssbRemoveApplication.Image = global::nspector.Properties.Resources.window_application_delete; + this.tssbRemoveApplication.ImageTransparentColor = System.Drawing.Color.Magenta; + this.tssbRemoveApplication.Name = "tssbRemoveApplication"; + this.tssbRemoveApplication.Size = new System.Drawing.Size(36, 22); + this.tssbRemoveApplication.Text = "Remove application from current profile"; + this.tssbRemoveApplication.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.tssbRemoveApplication_DropDownItemClicked); + this.tssbRemoveApplication.Click += new System.EventHandler(this.tssbRemoveApplication_Click); + // + // tsSep3 + // + this.tsSep3.Name = "tsSep3"; + this.tsSep3.Size = new System.Drawing.Size(6, 25); + // + // tsbExportProfiles + // + this.tsbExportProfiles.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.tsbExportProfiles.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.exportUserdefinedProfilesToolStripMenuItem, + this.exportCurrentProfileOnlyToolStripMenuItem, + this.exportAllProfilesNVIDIATextFormatToolStripMenuItem}); + this.tsbExportProfiles.Image = global::nspector.Properties.Resources.export1; + this.tsbExportProfiles.ImageTransparentColor = System.Drawing.Color.Magenta; + this.tsbExportProfiles.Name = "tsbExportProfiles"; + this.tsbExportProfiles.Size = new System.Drawing.Size(36, 22); + this.tsbExportProfiles.Text = "Export user defined profiles"; + this.tsbExportProfiles.Click += new System.EventHandler(this.tsbExportProfiles_Click); + // + // exportUserdefinedProfilesToolStripMenuItem + // + this.exportUserdefinedProfilesToolStripMenuItem.Name = "exportUserdefinedProfilesToolStripMenuItem"; + this.exportUserdefinedProfilesToolStripMenuItem.Size = new System.Drawing.Size(312, 22); + this.exportUserdefinedProfilesToolStripMenuItem.Text = "Export all customized profiles"; + this.exportUserdefinedProfilesToolStripMenuItem.Click += new System.EventHandler(this.exportUserdefinedProfilesToolStripMenuItem_Click); + // + // exportCurrentProfileOnlyToolStripMenuItem + // + this.exportCurrentProfileOnlyToolStripMenuItem.Name = "exportCurrentProfileOnlyToolStripMenuItem"; + this.exportCurrentProfileOnlyToolStripMenuItem.Size = new System.Drawing.Size(312, 22); + this.exportCurrentProfileOnlyToolStripMenuItem.Text = "Export current profile only"; + this.exportCurrentProfileOnlyToolStripMenuItem.Click += new System.EventHandler(this.exportCurrentProfileOnlyToolStripMenuItem_Click); + // + // exportAllProfilesNVIDIATextFormatToolStripMenuItem + // + this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Name = "exportAllProfilesNVIDIATextFormatToolStripMenuItem"; + this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(312, 22); + this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Text = "Export all driver profiles (NVIDIA Text Format)"; + this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Click += new System.EventHandler(this.exportAllProfilesNVIDIATextFormatToolStripMenuItem_Click); + // + // tsbImportProfiles + // + this.tsbImportProfiles.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.tsbImportProfiles.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.importProfilesToolStripMenuItem, + this.importAllProfilesNVIDIATextFormatToolStripMenuItem}); + this.tsbImportProfiles.Image = global::nspector.Properties.Resources.import1; + this.tsbImportProfiles.ImageTransparentColor = System.Drawing.Color.Magenta; + this.tsbImportProfiles.Name = "tsbImportProfiles"; + this.tsbImportProfiles.Size = new System.Drawing.Size(36, 22); + this.tsbImportProfiles.Text = "Import user defined profiles"; + this.tsbImportProfiles.Click += new System.EventHandler(this.tsbImportProfiles_Click); + // + // importProfilesToolStripMenuItem + // + this.importProfilesToolStripMenuItem.Name = "importProfilesToolStripMenuItem"; + this.importProfilesToolStripMenuItem.Size = new System.Drawing.Size(364, 22); + this.importProfilesToolStripMenuItem.Text = "Import profile(s)"; + this.importProfilesToolStripMenuItem.Click += new System.EventHandler(this.importProfilesToolStripMenuItem_Click); + // + // importAllProfilesNVIDIATextFormatToolStripMenuItem + // + this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Name = "importAllProfilesNVIDIATextFormatToolStripMenuItem"; + this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(364, 22); + this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Text = "Import (replace) all driver profiles (NVIDIA Text Format)"; + this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Click += new System.EventHandler(this.importAllProfilesNVIDIATextFormatToolStripMenuItem_Click); + // + // tsSep4 + // + this.tsSep4.Name = "tsSep4"; + this.tsSep4.Size = new System.Drawing.Size(6, 25); + // + // tscbShowCustomSettingNamesOnly + // + this.tscbShowCustomSettingNamesOnly.CheckOnClick = true; + this.tscbShowCustomSettingNamesOnly.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.tscbShowCustomSettingNamesOnly.Image = global::nspector.Properties.Resources.filter_user; + this.tscbShowCustomSettingNamesOnly.ImageTransparentColor = System.Drawing.Color.Magenta; + this.tscbShowCustomSettingNamesOnly.Name = "tscbShowCustomSettingNamesOnly"; + this.tscbShowCustomSettingNamesOnly.Size = new System.Drawing.Size(24, 22); + this.tscbShowCustomSettingNamesOnly.Text = "Show the settings and values from CustomSettingNames file only."; + this.tscbShowCustomSettingNamesOnly.CheckedChanged += new System.EventHandler(this.cbCustomSettingsOnly_CheckedChanged); + // + // tsSep5 + // + this.tsSep5.Name = "tsSep5"; + this.tsSep5.Size = new System.Drawing.Size(6, 25); + // + // tscbShowScannedUnknownSettings + // + this.tscbShowScannedUnknownSettings.CheckOnClick = true; + this.tscbShowScannedUnknownSettings.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.tscbShowScannedUnknownSettings.Enabled = false; + this.tscbShowScannedUnknownSettings.Image = global::nspector.Properties.Resources.find_set2; + this.tscbShowScannedUnknownSettings.ImageTransparentColor = System.Drawing.Color.Magenta; + this.tscbShowScannedUnknownSettings.Name = "tscbShowScannedUnknownSettings"; + this.tscbShowScannedUnknownSettings.Size = new System.Drawing.Size(24, 22); + this.tscbShowScannedUnknownSettings.Text = "Show unknown settings from NVIDIA predefined profiles"; + this.tscbShowScannedUnknownSettings.Click += new System.EventHandler(this.tscbShowScannedUnknownSettings_Click); + // + // tsbBitValueEditor + // + this.tsbBitValueEditor.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.tsbBitValueEditor.Image = global::nspector.Properties.Resources.text_binary; + this.tsbBitValueEditor.ImageTransparentColor = System.Drawing.Color.Magenta; + this.tsbBitValueEditor.Name = "tsbBitValueEditor"; + this.tsbBitValueEditor.Size = new System.Drawing.Size(24, 22); + this.tsbBitValueEditor.Text = "Show bit value editor."; + this.tsbBitValueEditor.Click += new System.EventHandler(this.tsbBitValueEditor_Click); + // + // tsSep6 + // + this.tsSep6.Name = "tsSep6"; + this.tsSep6.Size = new System.Drawing.Size(6, 25); + // + // tsbApplyProfile + // + this.tsbApplyProfile.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; + this.tsbApplyProfile.Image = global::nspector.Properties.Resources.apply; + this.tsbApplyProfile.ImageTransparentColor = System.Drawing.Color.Magenta; + this.tsbApplyProfile.Name = "tsbApplyProfile"; + this.tsbApplyProfile.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never; + this.tsbApplyProfile.Size = new System.Drawing.Size(109, 22); + this.tsbApplyProfile.Text = "Apply changes"; + this.tsbApplyProfile.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.tsbApplyProfile.Click += new System.EventHandler(this.tsbApplyProfile_Click); + // + // btnResetValue + // + this.btnResetValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnResetValue.Enabled = false; + this.btnResetValue.Image = global::nspector.Properties.Resources.nv_btn; + this.btnResetValue.Location = new System.Drawing.Point(775, 175); + this.btnResetValue.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0); + this.btnResetValue.Name = "btnResetValue"; + this.btnResetValue.Size = new System.Drawing.Size(25, 19); + this.btnResetValue.TabIndex = 7; + this.btnResetValue.UseVisualStyleBackColor = true; + this.btnResetValue.Click += new System.EventHandler(this.btnResetValue_Click); + // + // lblApplications + // + this.lblApplications.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lblApplications.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(118)))), ((int)(((byte)(185)))), ((int)(((byte)(0))))); + this.lblApplications.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.lblApplications.ForeColor = System.Drawing.Color.White; + this.lblApplications.Location = new System.Drawing.Point(12, 32); + this.lblApplications.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblApplications.Name = "lblApplications"; + this.lblApplications.Size = new System.Drawing.Size(883, 17); + this.lblApplications.TabIndex = 25; + this.lblApplications.Text = "fsagame.exe, bond.exe, herozero.exe"; + // + // toolStripButton5 + // + this.toolStripButton5.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton5.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton5.Image"))); + this.toolStripButton5.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton5.Name = "toolStripButton5"; + this.toolStripButton5.Size = new System.Drawing.Size(23, 22); + this.toolStripButton5.Text = "toolStripButton5"; + // + // toolStripLabel2 + // + this.toolStripLabel2.Name = "toolStripLabel2"; + this.toolStripLabel2.Size = new System.Drawing.Size(86, 22); + this.toolStripLabel2.Text = "toolStripLabel2"; + // + // toolStripButton6 + // + this.toolStripButton6.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton6.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton6.Image"))); + this.toolStripButton6.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton6.Name = "toolStripButton6"; + this.toolStripButton6.Size = new System.Drawing.Size(23, 22); + this.toolStripButton6.Text = "toolStripButton6"; + // + // ilCombo + // + this.ilCombo.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; + this.ilCombo.ImageSize = new System.Drawing.Size(16, 16); + this.ilCombo.TransparentColor = System.Drawing.Color.Transparent; + // + // cbValues + // + this.cbValues.BackColor = System.Drawing.SystemColors.Window; + this.cbValues.FormattingEnabled = true; + this.cbValues.Location = new System.Drawing.Point(524, 175); + this.cbValues.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.cbValues.Name = "cbValues"; + this.cbValues.Size = new System.Drawing.Size(72, 21); + this.cbValues.TabIndex = 5; + this.cbValues.Visible = false; + this.cbValues.SelectedValueChanged += new System.EventHandler(this.cbValues_SelectedValueChanged); + this.cbValues.Leave += new System.EventHandler(this.cbValues_Leave); + // + // lblWidth96 + // + this.lblWidth96.Location = new System.Drawing.Point(77, 233); + this.lblWidth96.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblWidth96.Name = "lblWidth96"; + this.lblWidth96.Size = new System.Drawing.Size(96, 18); + this.lblWidth96.TabIndex = 77; + this.lblWidth96.Text = "96"; + this.lblWidth96.Visible = false; + // + // lblWidth330 + // + this.lblWidth330.Location = new System.Drawing.Point(77, 210); + this.lblWidth330.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblWidth330.Name = "lblWidth330"; + this.lblWidth330.Size = new System.Drawing.Size(330, 22); + this.lblWidth330.TabIndex = 78; + this.lblWidth330.Text = "330 (Helper Labels for DPI Scaling)"; + this.lblWidth330.Visible = false; + // + // lblWidth16 + // + this.lblWidth16.Location = new System.Drawing.Point(77, 269); + this.lblWidth16.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblWidth16.Name = "lblWidth16"; + this.lblWidth16.Size = new System.Drawing.Size(16, 18); + this.lblWidth16.TabIndex = 79; + this.lblWidth16.Text = "16"; + this.lblWidth16.Visible = false; + // + // lblWidth30 + // + this.lblWidth30.Location = new System.Drawing.Point(77, 251); + this.lblWidth30.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblWidth30.Name = "lblWidth30"; + this.lblWidth30.Size = new System.Drawing.Size(30, 18); + this.lblWidth30.TabIndex = 80; + this.lblWidth30.Text = "30"; + this.lblWidth30.Visible = false; + // + // lvSettings + // + this.lvSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lvSettings.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.chSettingID, + this.chSettingValue, + this.chSettingValueHex}); + this.lvSettings.FullRowSelect = true; + this.lvSettings.GridLines = true; + this.lvSettings.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + this.lvSettings.Location = new System.Drawing.Point(12, 51); + this.lvSettings.Margin = new System.Windows.Forms.Padding(4); + this.lvSettings.MultiSelect = false; + this.lvSettings.Name = "lvSettings"; + this.lvSettings.ShowItemToolTips = true; + this.lvSettings.Size = new System.Drawing.Size(883, 635); + this.lvSettings.SmallImageList = this.ilListView; + this.lvSettings.TabIndex = 2; + this.lvSettings.UseCompatibleStateImageBehavior = false; + this.lvSettings.View = System.Windows.Forms.View.Details; + this.lvSettings.ColumnWidthChanging += new System.Windows.Forms.ColumnWidthChangingEventHandler(this.lvSettings_ColumnWidthChanging); + this.lvSettings.SelectedIndexChanged += new System.EventHandler(this.lvSettings_SelectedIndexChanged); + this.lvSettings.DoubleClick += new System.EventHandler(this.lvSettings_DoubleClick); + this.lvSettings.Resize += new System.EventHandler(this.lvSettings_Resize); + // + // chSettingID + // + this.chSettingID.Text = "SettingID"; + this.chSettingID.Width = 330; + // + // chSettingValue + // + this.chSettingValue.Text = "SettingValue"; + this.chSettingValue.Width = 340; + // + // chSettingValueHex + // + this.chSettingValueHex.Text = "SettingValueHex"; + this.chSettingValueHex.Width = 96; + // + // frmDrvSettings + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(907, 709); + this.Controls.Add(this.lblWidth30); + this.Controls.Add(this.lblWidth16); + this.Controls.Add(this.lblWidth330); + this.Controls.Add(this.lblWidth96); + this.Controls.Add(this.lvSettings); + this.Controls.Add(this.lblApplications); + this.Controls.Add(this.tsMain); + this.Controls.Add(this.pbMain); + this.Controls.Add(this.btnResetValue); + this.Controls.Add(this.cbValues); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.MinimumSize = new System.Drawing.Size(920, 348); + this.Name = "frmDrvSettings"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "nSpector - Driver Profile Settings"; + this.Activated += new System.EventHandler(this.frmDrvSettings_Activated); + this.Load += new System.EventHandler(this.frmDrvSettings_Load); + this.Shown += new System.EventHandler(this.frmDrvSettings_Shown); + this.tsMain.ResumeLayout(false); + this.tsMain.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private ListViewEx lvSettings; + private System.Windows.Forms.ColumnHeader chSettingID; + private System.Windows.Forms.ColumnHeader chSettingValue; + private System.Windows.Forms.ColumnHeader chSettingValueHex; + private System.Windows.Forms.ImageList ilListView; + private System.Windows.Forms.ComboBox cbValues; + private System.Windows.Forms.Button btnResetValue; + private System.Windows.Forms.ProgressBar pbMain; + private System.Windows.Forms.ToolStrip tsMain; + private System.Windows.Forms.ToolStripButton tsbRestoreProfile; + private System.Windows.Forms.ToolStripButton tsbApplyProfile; + private System.Windows.Forms.ToolStripButton tsbRefreshProfile; + private System.Windows.Forms.ToolStripSeparator tsSep3; + private System.Windows.Forms.ToolStripButton tsbBitValueEditor; + private System.Windows.Forms.ToolStripSeparator tsSep6; + private System.Windows.Forms.ToolStripButton tscbShowCustomSettingNamesOnly; + private System.Windows.Forms.ToolStripSeparator tsSep5; + private System.Windows.Forms.ToolStripButton tscbShowScannedUnknownSettings; + private System.Windows.Forms.ToolStripLabel tslProfiles; + private System.Windows.Forms.Label lblApplications; + private System.Windows.Forms.ToolStripButton toolStripButton5; + private System.Windows.Forms.ToolStripLabel toolStripLabel2; + private System.Windows.Forms.ToolStripButton toolStripButton6; + private System.Windows.Forms.ToolStripSeparator tsSep2; + private System.Windows.Forms.ToolStripButton tsbDeleteProfile; + private System.Windows.Forms.ToolStripButton tsbCreateProfile; + private System.Windows.Forms.ToolStripButton tsbAddApplication; + private System.Windows.Forms.ToolStripSplitButton tssbRemoveApplication; + private System.Windows.Forms.ToolStripSeparator tsSep4; + private System.Windows.Forms.ToolStripSplitButton tsbExportProfiles; + private System.Windows.Forms.ToolStripMenuItem exportCurrentProfileOnlyToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem exportUserdefinedProfilesToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + public System.Windows.Forms.ToolStripComboBox cbProfiles; + private System.Windows.Forms.ToolStripSplitButton tsbModifiedProfiles; + private System.Windows.Forms.ImageList ilCombo; + private System.Windows.Forms.ToolStripMenuItem exportAllProfilesNVIDIATextFormatToolStripMenuItem; + private System.Windows.Forms.ToolStripSplitButton tsbImportProfiles; + private System.Windows.Forms.ToolStripMenuItem importProfilesToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem importAllProfilesNVIDIATextFormatToolStripMenuItem; + private System.Windows.Forms.Label lblWidth96; + private System.Windows.Forms.Label lblWidth330; + private System.Windows.Forms.Label lblWidth16; + private System.Windows.Forms.Label lblWidth30; + } +} \ No newline at end of file diff --git a/nspector/frmDrvSettings.cs b/nspector/frmDrvSettings.cs new file mode 100644 index 0000000..92bb4bf --- /dev/null +++ b/nspector/frmDrvSettings.cs @@ -0,0 +1,1191 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Drawing; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Threading; +using System.Windows.Forms; +using nspector.Common; +using nspector.Common.Helper; +using nspector.Native.NVAPI2; +using nspector.Native.WINAPI; +using nvw = nspector.Native.NVAPI2.NvapiDrsWrapper; +using System.Text.RegularExpressions; +using System.Diagnostics; + +namespace nspector +{ + + internal partial class frmDrvSettings : Form + { + readonly DrsSettingsMetaService _meta = DrsServiceLocator.MetaService; + readonly DrsSettingsService _drs = DrsServiceLocator.SettingService; + readonly DrsScannerService _scanner = DrsServiceLocator.ScannerService; + readonly DrsImportService _import = DrsServiceLocator.ImportService; + + private List _currentProfileSettingItems = new List(); + private bool _alreadyScannedForPredefinedSettings = false; + private IntPtr _taskbarParent = IntPtr.Zero; + private bool _showCustomSettingsOnly = false; + private bool _activated = false; + private bool _isStartup = true; + private bool _skipScan = false; + + private string _baseProfileName = ""; + private bool _isWin7TaskBar = false; + private int _lastComboRowIndex = -1; + private ITaskbarList3 _taskbarList; + + public string _CurrentProfile = ""; + + protected override void WndProc(ref Message m) + { + switch (m.Msg) + { + case MessageHelper.WM_COPYDATA: + MessageHelper.COPYDATASTRUCT copyDataStruct = new MessageHelper.COPYDATASTRUCT(); + Type copyDataType = copyDataStruct.GetType(); + copyDataStruct = (MessageHelper.COPYDATASTRUCT)m.GetLParam(copyDataType); + if (copyDataStruct.lpData.Equals("ProfilesImported")) + { + RefreshAll(); + } + break; + } + base.WndProc(ref m); + } + + private ListViewGroup FindOrCreateGroup(string groupName) + { + if (string.IsNullOrEmpty(groupName)) + groupName = "Unknown"; + + foreach (ListViewGroup group in lvSettings.Groups) + if (group.Header == groupName) + return group; + + var newGroup = new ListViewGroup(groupName); + lvSettings.Groups.Insert(0, newGroup); + + return newGroup; + } + + private ListViewItem CreateListViewItem(SettingItem setting) + { + var group = FindOrCreateGroup(setting.GroupName); + + var item = new ListViewItem(setting.SettingText); + item.Tag = setting.SettingId; + item.Group = group; + item.SubItems.Add(setting.ValueText); + item.SubItems.Add(setting.ValueRaw); + + switch (setting.State) + { + default: + item.ImageIndex = 1; + item.ForeColor = SystemColors.GrayText; + break; + + case SettingState.NvidiaSetting: + item.ImageIndex = 2; + break; + + case SettingState.GlobalSetting: + item.ImageIndex = 3; + item.ForeColor = SystemColors.GrayText; + break; + + case SettingState.UserdefinedSetting: + item.ImageIndex = 0; + break; + + + } + + return item; + } + + private void RefreshApplicationsCombosAndText(List applications) + { + lblApplications.Text = ""; + tssbRemoveApplication.DropDownItems.Clear(); + + lblApplications.Text = " " + string.Join(", ", applications); + foreach (var app in applications) + { + tssbRemoveApplication.DropDownItems.Add(app, Properties.Resources.ieframe_1_18212); + } + tssbRemoveApplication.Enabled = (tssbRemoveApplication.DropDownItems.Count > 0); + } + + private SettingViewMode GetSettingViewMode() + { + if (tscbShowCustomSettingNamesOnly.Checked) + return SettingViewMode.CustomSettingsOnly; + else if (tscbShowScannedUnknownSettings.Checked) + return SettingViewMode.IncludeScannedSetttings; + else + return SettingViewMode.Normal; + } + + private void RefreshCurrentProfile() + { + string lvSelection = ""; + if (lvSettings.SelectedItems.Count > 0) + lvSelection = lvSettings.SelectedItems[0].Text; + + lvSettings.BeginUpdate(); + try + { + lvSettings.Items.Clear(); + lvSettings.Groups.Clear(); + var applications = new List(); + + _currentProfileSettingItems = _drs.GetSettingsForProfile(_CurrentProfile, GetSettingViewMode(), ref applications); + RefreshApplicationsCombosAndText(applications); + + foreach (var settingItem in _currentProfileSettingItems) + { + lvSettings.Items.Add(CreateListViewItem(settingItem)); + } + + btnResetValue.Enabled = false; + + try + { + lvSettings.RemoveEmbeddedControl(cbValues); + lvSettings.RemoveEmbeddedControl(btnResetValue); + } + catch { } + } + finally + { + lvSettings.EndUpdate(); + ((ListViewGroupSorter)lvSettings).SortGroups(true); + + GC.Collect(); + for (int i = 0; i < lvSettings.Items.Count; i++) + { + if (lvSettings.Items[i].Text == lvSelection) + { + lvSettings.Items[i].Selected = true; + lvSettings.Items[i].EnsureVisible(); + + if (!cbProfiles.Focused) + { + lvSettings.Select(); + cbValues.Text = lvSettings.Items[i].SubItems[1].Text; + } + break; + } + } + } + } + + private void RefreshProfilesCombo() + { + cbProfiles.Items.Clear(); + + var profileNames = _drs.GetProfileNames(out _baseProfileName); + cbProfiles.Items.AddRange(profileNames.Cast().ToArray()); + + cbProfiles.Sorted = true; + } + + private void MoveComboToItemAndFill() + { + if (lvSettings.SelectedItems.Count > 0) + { + if (!cbValues.ContainsFocus && (_lastComboRowIndex != lvSettings.SelectedItems[0].Index)) + { + btnResetValue.Enabled = true; + + cbValues.BeginUpdate(); + + cbValues.Items.Clear(); + cbValues.Tag = lvSettings.SelectedItems[0].Tag; + uint settingid = (uint)lvSettings.SelectedItems[0].Tag; + + var settingMeta = _meta.GetSettingMeta(settingid); + if (settingMeta != null) + { + if (settingMeta.SettingType == Native.NVAPI2.NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE && settingMeta.DwordValues != null) + { + var valueNames = settingMeta.DwordValues.Select(x => x.ValueName).ToList(); + foreach (string v in valueNames) + { + var itm = ""; + if (v.Length > 4000) + itm = v.Substring(0, 4000) + " ..."; + else + itm = v; + + cbValues.Items.Add(itm); + + } + } + + if (settingMeta.SettingType == Native.NVAPI2.NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE && settingMeta.StringValues != null) + { + var valueNames = settingMeta.StringValues.Select(x => x.ValueName).ToList(); + foreach (string v in valueNames) + cbValues.Items.Add(v); + } + + var scannedCount = settingMeta?.DwordValues? + .Where(x => x.ValueSource == Common.Meta.SettingMetaSource.ScannedSettings) + .Count(); + + tsbBitValueEditor.Enabled = scannedCount > 0; + + } + + if (cbValues.Items.Count < 1) + { + cbValues.Items.Add(""); + cbValues.Items.RemoveAt(0); + } + + + cbValues.Text = lvSettings.SelectedItems[0].SubItems[1].Text; + cbValues.EndUpdate(); + + lvSettings.AddEmbeddedControl(cbValues, 1, lvSettings.SelectedItems[0].Index); + + if (lvSettings.SelectedItems[0].ImageIndex == 0) + lvSettings.AddEmbeddedControl(btnResetValue, 2, lvSettings.SelectedItems[0].Index, DockStyle.Right); + _lastComboRowIndex = lvSettings.SelectedItems[0].Index; + cbValues.Visible = true; + + + + } + } + else + { + _lastComboRowIndex = -1; + + if (!cbValues.ContainsFocus) + { + try + { + lvSettings.RemoveEmbeddedControl(cbValues); + lvSettings.RemoveEmbeddedControl(btnResetValue); + } + catch { } + + btnResetValue.Enabled = false; + cbValues.Visible = false; + + tsbBitValueEditor.Enabled = false; + } + } + } + + private int GetListViewIndexOfSetting(uint settingId) + { + int idx = 0; + foreach (ListViewItem lvi in lvSettings.Items) + { + if (settingId == (uint)lvi.Tag) + { + return idx; + } + idx++; + } + return -1; + } + + private void UpdateItemByComboValue() + { + var settingId = (uint)cbValues.Tag; + var activeImages = new[] { 0, 2 }; + + int idx = GetListViewIndexOfSetting(settingId); + if (idx != -1) + { + var lvItem = lvSettings.Items[idx]; + + var settingMeta = _meta.GetSettingMeta(settingId); + + var currentProfileItem = _currentProfileSettingItems + .First(x => x.SettingId.Equals(settingId)); + + var cbValueText = cbValues.Text.Trim(); + + var valueHasChanged = currentProfileItem.ValueText != cbValueText; + if (settingMeta.SettingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE) + { + var stringBehind = DrsUtil.ParseStringSettingValue(settingMeta, cbValueText); + valueHasChanged = currentProfileItem.ValueRaw != stringBehind; + } + + if (valueHasChanged || activeImages.Contains(lvItem.ImageIndex)) + { + lvItem.ForeColor = SystemColors.ControlText; + } + else + { + lvItem.ForeColor = SystemColors.GrayText; + } + + if (settingMeta.SettingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE) + { + lvItem.SubItems[2].Text = DrsUtil.GetDwordString(DrsUtil.ParseDwordSettingValue(settingMeta, cbValueText)); + lvItem.SubItems[1].Text = cbValueText; + } + else + { + lvItem.SubItems[2].Text = DrsUtil.ParseStringSettingValue(settingMeta, cbValueText); // DrsUtil.StringValueRaw; + lvItem.SubItems[1].Text = cbValueText; + } + + } + } + + private void StoreChangesOfProfileToDriver() + { + + var settingsToStore = new List>(); + + foreach (ListViewItem lvi in lvSettings.Items) + { + var currentProfileItem = _currentProfileSettingItems + .First(x => x.SettingId.Equals((uint)lvi.Tag)); + + var listValueX = lvi.SubItems[1].Text; + + if (currentProfileItem.ValueText != listValueX) + { + settingsToStore.Add(new KeyValuePair((uint)lvi.Tag, listValueX)); + } + + } + + if (settingsToStore.Count > 0) + { + _drs.StoreSettingsToProfile(_CurrentProfile, settingsToStore); + AddToModifiedProfiles(_CurrentProfile); + } + + RefreshCurrentProfile(); + } + + private void ResetCurrentProfile() + { + bool removeFromModified = false; + _drs.ResetProfile(_CurrentProfile, out removeFromModified); + + if (removeFromModified) + { + RemoveFromModifiedProfiles(_CurrentProfile); + } + RefreshCurrentProfile(); + } + + private void ResetSelectedValue() + { + if (lvSettings.SelectedItems != null && lvSettings.SelectedItems.Count > 0) + { + var settingId = (uint)lvSettings.SelectedItems[0].Tag; + + bool removeFromModified; + _drs.ResetValue(_CurrentProfile, settingId, out removeFromModified); + + if (removeFromModified) + RemoveFromModifiedProfiles(_CurrentProfile); + + RefreshCurrentProfile(); + } + } + + private void InitTaskbarList() + { + if (Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 1) + { + try + { + _taskbarList = (ITaskbarList3)new TaskbarList(); + _taskbarList.HrInit(); + _taskbarParent = this.Handle; + _isWin7TaskBar = true; + } + catch + { + _taskbarList = null; + _taskbarParent = IntPtr.Zero; + _isWin7TaskBar = false; + } + } + } + + private void SetTaskbarIcon() + { + if (_taskbarList != null && _isWin7TaskBar && AdminHelper.IsAdmin) + { + try + { + _taskbarList.SetOverlayIcon(_taskbarParent, Properties.Resources.shield16.Handle, "Elevated"); + } + catch { } + } + } + + private void SetTitleVersion() + { + var numberFormat = new NumberFormatInfo() { NumberDecimalSeparator = "." }; + var version = Assembly.GetExecutingAssembly().GetName().Version; + var fileVersionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location); + var titleText = string.Format("{8} {0}.{1}{5}{2}{5}{4} - {6} Profile Settings {3}- {7}", + version.Major, version.Minor, version.Build, AdminHelper.IsAdmin ? "(Elevated) " : "", + (version.Revision > 0 ? version.Revision.ToString() : ""), + (version.Revision > 0 ? "." : ""), + (_drs.DriverVersion > 0) ? "GeForce " + _drs.DriverVersion.ToString("#.00", numberFormat) + " -" : "Driver", + fileVersionInfo.LegalCopyright, + Application.ProductName + ); + + Text = titleText; + } + + private static void InitMessageFilter(IntPtr handle) + { + if ((Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 1)) + { + DragAcceptNativeHelper.ChangeWindowMessageFilterEx(handle, DragAcceptNativeHelper.WM_DROPFILES, DragAcceptNativeHelper.MSGFLT_ALLOW, IntPtr.Zero); + DragAcceptNativeHelper.ChangeWindowMessageFilterEx(handle, DragAcceptNativeHelper.WM_COPYDATA, DragAcceptNativeHelper.MSGFLT_ALLOW, IntPtr.Zero); + DragAcceptNativeHelper.ChangeWindowMessageFilterEx(handle, DragAcceptNativeHelper.WM_COPYGLOBALDATA, DragAcceptNativeHelper.MSGFLT_ALLOW, IntPtr.Zero); + } + else if (Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 0) + { + DragAcceptNativeHelper.ChangeWindowMessageFilter(DragAcceptNativeHelper.WM_DROPFILES, DragAcceptNativeHelper.MSGFLT_ADD); + DragAcceptNativeHelper.ChangeWindowMessageFilter(DragAcceptNativeHelper.WM_COPYDATA, DragAcceptNativeHelper.MSGFLT_ADD); + DragAcceptNativeHelper.ChangeWindowMessageFilter(DragAcceptNativeHelper.WM_COPYGLOBALDATA, DragAcceptNativeHelper.MSGFLT_ADD); + } + } + + internal frmDrvSettings() : this(false, false) { } + internal frmDrvSettings(bool showCsnOnly, bool skipScan) + { + _skipScan = skipScan; + InitializeComponent(); + InitTaskbarList(); + InitScannerEvents(); + SetupDropFilesNative(); + SetupToolbar(); + SetupDpiAdjustments(); + + _showCustomSettingsOnly = showCsnOnly; + Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); + } + + private void SetupDpiAdjustments() + { + chSettingID.Width = lblWidth330.Width; + chSettingValueHex.Width = lblWidth96.Width; + } + + private void SetupToolbar() + { + tsMain.Renderer = new NoBorderRenderer(); + tsMain.ImageScalingSize = new Size(lblWidth16.Width, lblWidth16.Width); + } + + private void SetupDropFilesNative() + { + lvSettings.OnDropFilesNative += new DropFilesNativeHandler(lvSettings_OnDropFilesNative); + DragAcceptNativeHelper.DragAcceptFiles(this.Handle, true); + DragAcceptNativeHelper.DragAcceptFiles(lvSettings.Handle, true); + InitMessageFilter(lvSettings.Handle); + } + + private void SetupLayout() + { + if (Screen.GetWorkingArea(this).Height < Height + 10) + { + Height = Screen.GetWorkingArea(this).Height - 20; + } + } + + private void RefreshModifiesProfilesDropDown() + { + tsbModifiedProfiles.DropDownItems.Clear(); + _scanner.ModifiedProfiles.Sort(); + foreach (string modProfile in _scanner.ModifiedProfiles) + if (modProfile != _baseProfileName) + tsbModifiedProfiles.DropDownItems.Add(modProfile); + + if (tsbModifiedProfiles.DropDownItems.Count > 0) + tsbModifiedProfiles.Enabled = true; + } + + private void frmDrvSettings_Load(object sender, EventArgs e) + { + SetupLayout(); + SetTitleVersion(); + + RefreshProfilesCombo(); + cbProfiles.Text = GetBaseProfileName(); + + tsbBitValueEditor.Enabled = false; + tsbDeleteProfile.Enabled = false; + tsbAddApplication.Enabled = false; + tssbRemoveApplication.Enabled = false; + + InitResetValueTooltip(); + } + + private void InitResetValueTooltip() + { + var toolTip = new ToolTip(); + toolTip.SetToolTip(btnResetValue, "Restore this value to NVIDIA defaults."); + } + + private void lvSettings_SelectedIndexChanged(object sender, EventArgs e) + { + MoveComboToItemAndFill(); + } + + private void cbValues_SelectedValueChanged(object sender, EventArgs e) + { + UpdateItemByComboValue(); + } + + private void cbValues_Leave(object sender, EventArgs e) + { + UpdateItemByComboValue(); + } + + private void btnResetValue_Click(object sender, EventArgs e) + { + ResetSelectedValue(); + } + + private void ChangeCurrentProfile(string profileName) + { + if (profileName == GetBaseProfileName() || profileName == _baseProfileName) + { + _CurrentProfile = _baseProfileName; + cbProfiles.Text = GetBaseProfileName(); + tsbDeleteProfile.Enabled = false; + tsbAddApplication.Enabled = false; + tssbRemoveApplication.Enabled = false; + } + else + { + _CurrentProfile = cbProfiles.Text; + tsbDeleteProfile.Enabled = true; + tsbAddApplication.Enabled = true; + tssbRemoveApplication.Enabled = true; + } + + + RefreshCurrentProfile(); + } + + private void cbProfiles_SelectedIndexChanged(object sender, EventArgs e) + { + if (cbProfiles.SelectedIndex > -1) + { + ChangeCurrentProfile(cbProfiles.Text); + } + } + + private void SetTaskbarProgress(int progress) + { + if (_isWin7TaskBar) + { + try + { + if (progress == 0) + _taskbarList.SetProgressState(_taskbarParent, TBPFLAG.TBPF_NOPROGRESS); + else + { + _taskbarList.SetProgressState(_taskbarParent, TBPFLAG.TBPF_NORMAL); + _taskbarList.SetProgressValue(_taskbarParent, (ulong)progress, 100); + } + } + catch { } + } + } + + private void AddToModifiedProfiles(string profileName) + { + if (!_scanner.ModifiedProfiles.Contains(profileName) && profileName != _baseProfileName) + { + _scanner.ModifiedProfiles.Add(profileName); + RefreshModifiesProfilesDropDown(); + } + } + + private void RemoveFromModifiedProfiles(string profileName) + { + if (_scanner.ModifiedProfiles.Contains(profileName)) + { + _scanner.ModifiedProfiles.Remove(profileName); + RefreshModifiesProfilesDropDown(); + } + } + + private void InvokeUi(Control invokeControl, Action action) + { + MethodInvoker mi = () => action(); + + if (invokeControl.InvokeRequired) + invokeControl.BeginInvoke(mi); + else + mi.Invoke(); + } + + private void frmDrvSettings_OnModifiedScanDoneAndShowExport() + { + InvokeUi(this, () => + { + + pbMain.Value = 0; + pbMain.Enabled = false; + SetTaskbarProgress(0); + + if (_scanner.ModifiedProfiles.Count > 0) + { + var frmExport = new frmExportProfiles(); + frmExport.ShowDialog(this); + } + else + MessageBox.Show("No user modified profiles found! Nothing to export.", "Userprofile Search", MessageBoxButtons.OK, MessageBoxIcon.Information); + + RefreshModifiesProfilesDropDown(); + + }); + } + + private void frmDrvSettings_OnPredefinedScanDoneAndStartModifiedProfileScan() + { + + InvokeUi(this, () => + { + pbMain.Value = 0; + pbMain.Enabled = false; + SetTaskbarProgress(0); + + tscbShowScannedUnknownSettings.Enabled = true; + }); + + StartModifiedProfilesScan(false); + } + + private void frmDrvSettings_OnScanDoneDoNothing() + { + _meta.ResetMetaCache(); + + InvokeUi(this, () => + { + pbMain.Value = 0; + pbMain.Enabled = false; + SetTaskbarProgress(0); + RefreshCurrentProfile(); + RefreshModifiesProfilesDropDown(); + }); + } + + private void frmDrvSettings_OnSettingScanProgress(int percent) + { + InvokeUi(this, () => + { + pbMain.Value = percent; + SetTaskbarProgress(percent); + }); + + } + + private void InitScannerEvents() + { + _scanner.OnSettingScanProgress += new Common.SettingScanProgressEvent(frmDrvSettings_OnSettingScanProgress); + _scanner.OnPredefinedSettingsScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing); + _scanner.OnModifiedProfilesScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing); + } + + private void StartModifiedProfilesScan(bool showProfilesDialog) + { + pbMain.Minimum = 0; + pbMain.Maximum = 100; + + _scanner.OnModifiedProfilesScanDone -= new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing); + _scanner.OnModifiedProfilesScanDone -= new Common.SettingScanDoneEvent(frmDrvSettings_OnModifiedScanDoneAndShowExport); + + if (showProfilesDialog) + _scanner.OnModifiedProfilesScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnModifiedScanDoneAndShowExport); + else + _scanner.OnModifiedProfilesScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing); + + _scanner.StartScanForModifiedProfilesAsync(); + } + + private void StartPredefinedSettingsScan(bool startModifiedProfileScan) + { + pbMain.Minimum = 0; + pbMain.Maximum = 100; + + _scanner.OnPredefinedSettingsScanDone -= new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing); + _scanner.OnPredefinedSettingsScanDone -= new Common.SettingScanDoneEvent(frmDrvSettings_OnPredefinedScanDoneAndStartModifiedProfileScan); + + if (startModifiedProfileScan) + _scanner.OnPredefinedSettingsScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnPredefinedScanDoneAndStartModifiedProfileScan); + else + _scanner.OnPredefinedSettingsScanDone += new Common.SettingScanDoneEvent(frmDrvSettings_OnScanDoneDoNothing); + + _alreadyScannedForPredefinedSettings = true; + + _scanner.StartScanForPredefinedSettingsAsync(); + } + + private void ScanProfilesSilent(bool scanPredefined, bool showProfileDialog) + { + tsbModifiedProfiles.Enabled = false; + pbMain.Minimum = 0; + pbMain.Maximum = 100; + + if (_skipScan) + return; + + if (scanPredefined && !_alreadyScannedForPredefinedSettings) + StartPredefinedSettingsScan(true); + else + StartModifiedProfilesScan(showProfileDialog); + } + + private void cbCustomSettingsOnly_CheckedChanged(object sender, EventArgs e) + { + RefreshCurrentProfile(); + } + + internal void SetSelectedDwordValue(uint dwordValue) + { + if (lvSettings.SelectedItems != null & lvSettings.SelectedItems.Count > 0) + { + cbValues.Text = DrsUtil.GetDwordString(dwordValue); ; + UpdateItemByComboValue(); + } + } + + private void tsbRestoreProfile_Click(object sender, EventArgs e) + { + if (Control.ModifierKeys == Keys.Control) + { + if (MessageBox.Show(this, + "Restore all profiles to NVIDIA driver defaults?", + "Restore all profiles", + MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + _drs.ResetAllProfilesInternal(); + + RefreshProfilesCombo(); + RefreshCurrentProfile(); + ScanProfilesSilent(true, false); + cbProfiles.Text = GetBaseProfileName(); + } + } + else + ResetCurrentProfile(); + } + + private void tsbRefreshProfile_Click(object sender, EventArgs e) + { + DrsServiceLocator.ReCreateSession(); + RefreshAll(); + } + + private void tsbApplyProfile_Click(object sender, EventArgs e) + { + try + { + UpdateItemByComboValue(); + } + catch { } + + StoreChangesOfProfileToDriver(); + } + + private void tsbBitValueEditor_Click(object sender, EventArgs e) + { + if (lvSettings.SelectedItems != null & lvSettings.SelectedItems.Count > 0) + { + var frmBits = new frmBitEditor(); + frmBits.ShowDialog(this, + (uint)lvSettings.SelectedItems[0].Tag, + uint.Parse(lvSettings.SelectedItems[0].SubItems[2].Text.Substring(2), NumberStyles.AllowHexSpecifier), + lvSettings.SelectedItems[0].Text); + } + } + + private void tscbShowScannedUnknownSettings_Click(object sender, EventArgs e) + { + RefreshCurrentProfile(); + } + + private void lvSettings_Resize(object sender, EventArgs e) + { + ResizeColumn(); + } + + private void ResizeColumn() + { + lvSettings.Columns[1].Width = lvSettings.Width - (lvSettings.Columns[0].Width + lvSettings.Columns[2].Width + lblWidth30.Width); + } + + private void lvSettings_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e) + { + if (e.ColumnIndex != 1) + { + + if (e.ColumnIndex == 0 && e.NewWidth < 260) + { + e.NewWidth = 260; + e.Cancel = true; + } + else if (e.ColumnIndex == 2 && e.NewWidth < 96) + { + e.Cancel = true; + e.NewWidth = 96; + } + + ResizeColumn(); + } + } + + private void frmDrvSettings_Shown(object sender, EventArgs e) + { + if (_isStartup) + { + new Thread(SetTaskbarIcon).Start(); + ScanProfilesSilent(true, false); + + if (WindowState != FormWindowState.Maximized) + { + new MessageHelper().bringAppToFront((int)this.Handle); + } + _isStartup = false; + } + } + + private void tsbDeleteProfile_Click(object sender, EventArgs e) + { + if (Control.ModifierKeys == Keys.Control) + { + if (MessageBox.Show(this, "Really delete all profiles?", "Delete all profiles", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) + { + _drs.DeleteAllProfilesHard(); + } + } + else if (MessageBox.Show(this, "Really delete this profile?\r\n\r\nNote: NVIDIA predefined profiles can not be restored until next driver installation!", "Delete Profile", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) + { + if (_drs.DriverVersion > 280 && _drs.DriverVersion < 310) + // hack for driverbug + _drs.DeleteProfileHard(_CurrentProfile); + else + _drs.DeleteProfile(_CurrentProfile); + + RemoveFromModifiedProfiles(_CurrentProfile); + MessageBox.Show(this, string.Format("Profile '{0}' has been deleted.", _CurrentProfile), "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); + RefreshProfilesCombo(); + ChangeCurrentProfile(_baseProfileName); + } + } + + private void tsbAddApplication_Click(object sender, EventArgs e) + { + var openDialog = new OpenFileDialog(); + openDialog.DefaultExt = "*.exe"; + openDialog.Filter = "Application EXE Name|*.exe|Application Absolute Path|*.exe"; + + if (openDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + string applicationName = new FileInfo(openDialog.FileName).Name; + if (openDialog.FilterIndex == 2) + applicationName = openDialog.FileName; + + try + { + _drs.AddApplication(_CurrentProfile, applicationName); + } + catch (NvapiException ex) + { + if (ex.Status == Native.NVAPI2.NvAPI_Status.NVAPI_EXECUTABLE_ALREADY_IN_USE) + { + if (lblApplications.Text.ToUpper().IndexOf(" " + applicationName.ToUpper() + ",") != -1) + MessageBox.Show("This application executable is already assigned to this profile!", + "Error adding Application", MessageBoxButtons.OK, MessageBoxIcon.Error); + else + { + string profileNames = _scanner.FindProfilesUsingApplication(applicationName); + if (profileNames == "") + MessageBox.Show("This application executable is already assigned to another profile!", + "Error adding Application", MessageBoxButtons.OK, MessageBoxIcon.Error); + else + MessageBox.Show( + "This application executable is already assigned to the following profiles: " + + profileNames, "Error adding Application", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + else + throw; + } + } + RefreshCurrentProfile(); + } + + private void tssbRemoveApplication_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) + { + //if ((uint)e.ClickedItem.Tag == 0 + // || ( + // (uint)e.ClickedItem.Tag == 1 + // && + // MessageBox.Show(this, + // "Do you really want to delete this NVIDIA predefined application executeable?\r\n\r\nNote: This can not be restored until next driver installation!", + // "Delete Application", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + // ) + //{ + // drs.DeleteApplication(currentProfile, e.ClickedItem.Text); + //} + _drs.DeleteApplication(_CurrentProfile, e.ClickedItem.Text); + RefreshCurrentProfile(); + } + + private void tsbCreateProfile_Click(object sender, EventArgs e) + { + ShowCreateProfileDialog(""); + } + + private void ShowCreateProfileDialog(string nameProposal, string applicationName = null) + { + var ignoreList = cbProfiles.Items.Cast().ToList(); + string result = nameProposal; + + if (InputBox.Show("Create Profile", "Please enter profile name:", ref result, ignoreList, "", 2048) == System.Windows.Forms.DialogResult.OK) + { + try + { + _drs.CreateProfile(result, applicationName); + RefreshProfilesCombo(); + cbProfiles.SelectedIndex = cbProfiles.Items.IndexOf(result); + AddToModifiedProfiles(result); + } + catch (NvapiException ex) + { + //TODO: could not create profile + MessageBox.Show(ex.Message); + } + } + } + + private void tsbExportProfiles_Click(object sender, EventArgs e) + { + tsbExportProfiles.ShowDropDown(); + } + + private void tsbImportProfiles_Click(object sender, EventArgs e) + { + tsbImportProfiles.ShowDropDown(); + } + + private void exportUserdefinedProfilesToolStripMenuItem_Click(object sender, EventArgs e) + { + ScanProfilesSilent(false, true); + } + + private void exportCurrentProfileOnlyToolStripMenuItem_Click(object sender, EventArgs e) + { + var saveDialog = new SaveFileDialog(); + saveDialog.DefaultExt = "*.nip"; + saveDialog.Filter = Application.ProductName + " Profiles|*.nip"; + if (saveDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + var profiles = new[] { _CurrentProfile }.ToList(); + _import.ExportProfiles(profiles, saveDialog.FileName, false); + } + } + + private void tssbRemoveApplication_Click(object sender, EventArgs e) + { + if (tssbRemoveApplication.DropDown.Items.Count > 0) + tssbRemoveApplication.ShowDropDown(); + } + + private void tsbModifiedProfiles_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) + { + cbProfiles.SelectedIndex = cbProfiles.FindStringExact(e.ClickedItem.Text); + } + + private string GetBaseProfileName() + { + return string.Format("_GLOBAL_DRIVER_PROFILE ({0})", _baseProfileName); + } + + private void tsbModifiedProfiles_ButtonClick(object sender, EventArgs e) + { + ChangeCurrentProfile(GetBaseProfileName()); + } + + private void frmDrvSettings_Activated(object sender, EventArgs e) + { + if (!_activated) + _activated = true; + } + + private void exportAllProfilesNVIDIATextFormatToolStripMenuItem_Click(object sender, EventArgs e) + { + var saveDialog = new SaveFileDialog(); + saveDialog.DefaultExt = "*.txt"; + saveDialog.Filter = "Profiles (NVIDIA Text Format)|*.txt"; + if (saveDialog.ShowDialog() == DialogResult.OK) + { + _import.ExportAllProfilesToNvidiaTextFile(saveDialog.FileName); + } + } + + private void RefreshAll() + { + RefreshProfilesCombo(); + ScanProfilesSilent(true, false); + + int idx = cbProfiles.Items.IndexOf(_CurrentProfile); + if (idx == -1 || _CurrentProfile == _baseProfileName) + cbProfiles.Text = GetBaseProfileName(); + else + cbProfiles.SelectedIndex = idx; + + RefreshCurrentProfile(); + } + + private void importAllProfilesNVIDIATextFormatToolStripMenuItem_Click(object sender, EventArgs e) + { + var openDialog = new OpenFileDialog(); + openDialog.DefaultExt = "*.txt"; + openDialog.Filter = "Profiles (NVIDIA Text Format)|*.txt"; + if (openDialog.ShowDialog() == DialogResult.OK) + { + try + { + _import.ImportAllProfilesFromNvidiaTextFile(openDialog.FileName); + MessageBox.Show("Profile(s) successfully imported!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); + RefreshAll(); + } + catch (NvapiException) + { + MessageBox.Show("Profile(s) could not imported!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + private void importProfilesToolStripMenuItem_Click(object sender, EventArgs e) + { + var openDialog = new OpenFileDialog(); + openDialog.DefaultExt = "*.nip"; + openDialog.Filter = Application.ProductName + " Profiles|*.nip"; + if (openDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + _import.ImportProfiles(openDialog.FileName); + RefreshAll(); + MessageBox.Show("Profile(s) successfully imported!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + + private void cbProfiles_TextChanged(object sender, EventArgs e) + { + if (cbProfiles.DroppedDown) + { + string txt = cbProfiles.Text; + cbProfiles.DroppedDown = false; + cbProfiles.Text = txt; + cbProfiles.Select(cbProfiles.Text.Length, 0); + } + } + + private string ResolveExecuteable(string filename, out string profileName) + { + var fileInfo = new FileInfo(filename); + profileName = fileInfo.Name.Substring(0, fileInfo.Name.Length - fileInfo.Extension.Length); + if (fileInfo.Extension.ToLower().Equals(".lnk")) + { + try + { + var shellLink = new ShellLink(filename); + var targetInfo = new FileInfo(shellLink.Target); + if (targetInfo.Extension.ToLower().Equals(".exe")) + return targetInfo.Name; + + return ""; + } + catch + { + return ""; + } + } + + if (fileInfo.Extension.ToLower().Equals(".exe")) + return fileInfo.Name; + + return ""; + } + + private void lvSettings_OnDropFilesNative(string[] files) + { + if (files.Length == 1) + { + var fileInfo = new FileInfo(files[0]); + if (fileInfo.Extension.ToLower().Equals(".nip")) + { + _import.ImportProfiles(fileInfo.FullName); + RefreshAll(); + MessageBox.Show("Profile(s) successfully imported!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + + var profileName = ""; + var exeFile = ResolveExecuteable(files[0], out profileName); + if (exeFile != "") + { + var profiles = _scanner.FindProfilesUsingApplication(exeFile); + if (profiles != "") + { + var profile = profiles.Split(';')[0]; + var idx = cbProfiles.Items.IndexOf(profile); + if (idx > -1) + { + cbProfiles.SelectedIndex = idx; + } + } + else + { + var dr = MessageBox.Show("Would you like to create a new profile for this application?", "Profile not found!", MessageBoxButtons.YesNo); + if (dr == DialogResult.Yes) + { + ShowCreateProfileDialog(profileName, exeFile); + } + + } + } + } + } + + private void lvSettings_DoubleClick(object sender, EventArgs e) + { + if (Debugger.IsAttached && lvSettings.SelectedItems != null && lvSettings.SelectedItems.Count == 1) + { + var settingId = ((uint)lvSettings.SelectedItems[0].Tag); + var settingName = lvSettings.SelectedItems[0].Text; + Clipboard.SetText(string.Format($"0x{settingId:X8} {settingName}")); + } + } + } +} + + + + + diff --git a/nspector/frmDrvSettings.resx b/nspector/frmDrvSettings.resx new file mode 100644 index 0000000..29625ce --- /dev/null +++ b/nspector/frmDrvSettings.resx @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 115, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADI + DAAAAk1TRnQBSQFMAgEBBAEAAWgBBwFoAQcBEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA + AwABIAMAAQEBAAEYBgABGP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/ADMAAcgBvQGvAacBkQF5BgAD/iEA + A+QD2gYAA/4hAAGXAcMBqwFMAZwBcAYAA/4hAAOmA2gGAAP+FQAB8gHxAfABqQGPAXQBzwHHAbwD/wG6 + AaUBjAGuAZQBeAHxAe8B7QHvAe0B6wGhAYgBbQHkAeAB2xIAA/UD3QPmA/8D4APeA/QD8wPaA+4SAAHt + AfIB7wE3AaEBZgGlAcwBtwP/AVgBsQGAATUBpgFoAekB8AHsAecB7wHqATwBlQFkAdQB4gHaEgAD7gNi + A7UD/wN6A2QD7APqA1oD2BIAAfMB8QHvAbwBoQGGAb4BogGHAb4BpQGIAbsBogGFAbwBogGEAagBlQGB + Aa0BlgF/Aa4BkgF3AegB5QHhEgAD9QnjBuIJ3gPwEgAB6wHyAe4BOgG1AXEBPAG2AXQBPgG3AXMBOgG1 + AXEBOgG1AXEBNwGmAWoBOAGoAWsBNAGkAWcB2QHnAd8SAAPuA3MDdgN0A3EDbwNxA20DZAPeDAAB9AHz + AfIB7wHsAekB6AHiAdwByQGyAZcB0wHCAa4BzgG8AaYBzAG6AaUBzAG5AaMBywG3AaIBygG3AaIBvgGn + AY8BxgG1AaMB5AHgAdsB4wHeAdoD/wMAA/YD8wPvA+cD7AbqCekG5AbuA/8DAAHvAfQB8QHiAe4B5wHM + AeYB1wFCAcMBfAFUAckBiQFOAccBhQFLAcYBggFLAcYBggFJAcUBgQFJAcUBgQE8AbsBdQF7Ab8BmgHT + AeIB2gHTAeAB2QP/AwAD8QPnA9cDhAOgA5cDlgmTA34DlgPYA9cD/wMAAcYBswGdAb4BqAGPAcwBtQGa + AdMBvwGrAdUBxQGyAccBsAGXAcMBrAGNAb8BpgGMAb8BpwGMAcUBrwGXAcYBswGdAbsBowGJAaIBiwFx + AY0BcwFXAeEB3QHYAwAD5QPkA+gD7APtA+cD5APiA+QG5wPjA9sD1APtAwABXQHCAYoBPAG7AXUBSAHE + AYEBVAHJAYkBWAHKAYsBQgHDAXwBQAG+AXgBQAG5AXYBOwG5AXQBQAHCAXsBQwHDAX0BOgG2AXIBMQGb + AWEBLAGAAVEB0QHeAdcDAAOOA30DhwOdA6UDhQN3A3gDeQOGA40DdwNfA0MD1QMAAekB5AHeAcYBrgGU + AdUBxAGtAc0BuQGlAcoBsAGYAeUB3gHXAfgB9wH2A/oB6AHiAdwBwQGpAY4BwAGoAY4BxAGuAZUBsQGZ + AYABzwHGAb0D+wMAA+8D5gPsA+oD5gPtA/kD+wPvBuQD5gPgA+cD/AMAAc4B5wHaAUABwgF8AVUByQGJ + AUwBxgGDAUcBxAF/AcMB4wHRAfQB9wH2AfkC+gHOAeYB2QFFAbkBeQE8AbwBdgE9AcEBeQE3AawBbAGt + AcsBuwH6AvsDAAPZA4IDnQOXA4YD0QP2A/oD2AN6A3wDgwNuA7YD+wMAAfcB9gH1AcgBsAGVAd4BzAG2 + AcsBtQGcAdQByQG6DAAB4gHdAdoBtwGgAY4BwwGwAaEBpQGSAYAB8AHuAewGAAP4A+cD7wboDAAD7gPj + A+gD3gPzBgAB8gH2AfQBQgHCAX0BYAHNAZEBRgHEAX8BmgHRAbMMAAHIAeMB1AE6AbYBcgFFAcQBfgE2 + AaMBaAHnAe8B6gYAA/QDggOnA4oDsQwAA9gDgQOWA3ID6gMAAc0BuQGiAcsBtAGZAeMBzQG3AecB1gHD + AbsBoQGFA/oMAAP6Ab8BpgGMAcwBuQGjAbwBogGEAa4BlAF4AacBkQF5A+cD6APwA/ID4QP7DAAD+wPi + A+kD4gPeA9oBXgHJAY4BRQHEAX4BYwHOAZMBbAHQAZkBPAG0AXMB+QL6DAAB+QL6AUABuQF2AUsBxgGC + AToBtQFxATUBpgFoAUwBnAFwA5IDhgOnA7YDcwP5DAAD+gN4A5MDbwNkA2gB1wHJAbgBzwG4AaIB5gHR + Ab0B7AHbAcoBugGhAYUC+QH4DAAB+AH3AfYBwwGsAY0BzAG6AaUBuwGiAYUBugGlAYwByAG9Aa8D6QPn + A/ED9APhA/oMAAP5A+QD6gPiA+AD5AGKAdMBqwFXAccBigFoAc8BlgFyAdIBnQE8AbIBcAH4AfkB+AwA + AfQB9wH2AUABvgF4AUsBxgGCAToBtQFxAVgBsQGAAZcBwwGrA6wDkgOvA74DcQP4DAAD9gN3A5YDcQN6 + A6YDAAP7AdwByQGzAewB3AHLAccBswGaAc4BxAG5DAAB5QHeAdcBxwGwAZcBzgG8AaYBvgGlAYgD/wYA + A/sD7QP0A+cD5QwAA+0D5wPqA+MD/wYAAfoC+wFeAcwBjwFyAdIBnQFCAcMBfAGoAckBtgwAAcMB4wHR + AUIBwwF8AU4BxwGFAT4BtwFzA/8GAAP7A6MDvwOIA7IMAAPRA4UDlwN0A/8GAAHxAe8B7AHZAcQBrQHv + Ad8BzgHfAc0BuwG2AaEBhQHOAcQBuQL5AfgD+gHUAckBugHKAbABmAHVAcUBsgHTAcIBrgG+AaIBhwHP + AccBvAYAA/QD7QP1A/AD4QPlA/oD+wPoA+YD7QPsA+MD5gYAAeUB8QHqAVkBygGNAXcB1AGhAWMBzgGT + ATwBsQFwAagByQG2AfgB+QH4AfkC+gGaAdEBswFHAcQBfwFYAcoBiwFUAckBiQE8AbYBdAGlAcwBtwYA + A+oDmwPCA64DcQOyA/gD+QOxA4YDpQOgA3YDtQYAAdYBxgGyAdABuAGdAdsBxQGwAfIB4gHSAeABzwG8 + AccBswGaAboBoQGFAbsBoQGFAcsBtQGcAc0BuQGlAdMBvwGrAckBsgGXAbwBoQGGAakBjwF0BgAD6APp + A+wD9gPwA+cG4QPoA+oD7APnA+MD3QYAAXsB0QGhAUkBxQGBAV0BywGOAXsB1QGkAWQBzgGUAUIBwwF8 + ATwBsgFwATwBtAFzAUYBxAF/AUwBxgGDAVQByQGJAUIBwwF8AToBtQFxATcBoQFmBgADowOKA6ADxwOv + A4gDcQNzA4oDlwOdA4QDcwNiBgAB8wHxAe8B8AHtAeoB8QHuAesB4gHOAboB7gHfAc0B7AHcAcsB7AHb + AcoB5wHWAcMB3gHMAbYB1QHEAa0BzAG1AZoB6AHiAdwB8wHxAe8B8gHxAfAGAAP1A/ID8wPwA/UG9APy + A+8D7APoA+8G9QYAAeoB8wHuAeEB7wHnAeMB8AHoAWQBzgGUAXUB0wGfAXIB0gGdAXIB0gGdAWwB0AGZ + AWABzQGRAVUByQGJAUgBxAGBAcwB5gHXAesB8gHuAe0B8gHvBgAD7gPoA+kDrAPAA78DvgO2A6cDnQOH + A9cG7gwAAfQB8wHxAdUBwAGnAdkBwwGqAdwByQGzAeYB0QG9AeMBzQG3AcgBsAGVAcYBrgGUAb4BqAGP + Ae8B7AHpEgAD9gPrA+wD7QPxA/AD5wPmA+QD8xIAAe0B9AHwAVIByAGHAVcByQGJAV4BzAGPAWgBzwGW + AWMBzgGTAUIBwgF9AUABwgF8ATwBuwF1AeIB7gHnEgAD8AOVA5gDowOvA6cGggN9A+cSAAH1AfQB8gHQ + Ab0BpAHgAdYBzAP7Ac8BuAGiAcsBtAGZAfcB9gH1AekB5AHeAcYBswGdAfQB8wHyEgAD9gPpA+sD+wPn + A+gD+APvA+UD9hIAAe4B9QHxAVsByQGNAasB3QHCAfoC+wFXAccBigFFAcQBfgHyAfYB9AHOAecB2gFd + AcIBigHvAfQB8RIAA/EDkgPEA/sDkgOGA/QD2QOOA/EVAAH9AvwD/gMAAdcByQG4Ac0BuQGiIQAD/QP+ + AwAD6QPnIQAD/AP+AwABigHTAasBXgHJAY4hAAP8A/4DAAOsA5IVAAFCAU0BPgcAAT4DAAEoAwABQAMA + ASADAAEBAQABAQYAAQEWAAP/gQAB/gFvAf4BbwH+AW8B/gFvAeABBwHgAQcB4AEHAeABBwHgAQcB4AEH + AeABBwHgAQcBgAEAAYABAAGAAQABgAEAAYABAAGAAQABgAEAAYABAAGAAQABgAEAAYABAAGAAQABgwHB + AYMBwQGDAcEBgwHBAQMBwAEDAcABAwHAAQMBwAEDAcABAwHAAQMBwAEDAcABgwHBAYMBwQGDAcEBgwHB + AYABAQGAAQEBgAEBAYABAQGAAQEBgAEBAYABAQGAAQEBgAEBAYABAQGAAQEBgAEBAeABBwHgAQcB4AEH + AeABBwHgAQcB4AEHAeABBwHgAQcB8gF/AfIBfwHyAX8B8gF/Cw== + + + + True + + + 217, 17 + + + True + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGgSURBVDhPrZPLSsNAFIb7BoKP4Upw5UoQBHfmMrG1olCa + pFoExY2KiHcRERFEwYUKglSQesFeQK2rFkFr0Y26MRAKpa2+QS+/MzGpaS114wdhQv7/nDknZ8bx7xDi + a+FFeYvnFU2QFHCcRxdEOcQTmTctjWHB4UgM2Wwe5XIZ+fwnko/PWF3bhiAqJzRRp2mtD0/U7oWlTbAK + Bj1jYO/vmo5SqYR44gG9fcPgiNpu2uvDkrCVEG+zIMkqcfqQuEuiWCwidhsHJ8qHhtEOLX2H9cxW81MF + nni7XP1+5PIfKBQKmJlbR1UrVnAul0O9JJa+fxAwPJehqx+fPdh6apPU6nZfY9Gk4SaWGDwN09FlsUfL + rIg2LB/z/NI5SW4bHZ9FJpPBy+sbnG4//Unfk7BjJalNbsBGEzwLIZ1OIxK9AXGqdCdZlSS1iel/HiB2 + OCTXEM4vItB1nc79HpPTK3APjBiHamJquXp09eCI0sGJyvH84gat4hqp1BM0TUMymcJRIEhLV3ZNa2ME + 4nXSCxQ1LhLrmVbAgnskudW0/BcOxxdQeE7WHAMG/AAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFcSURBVDhP3VFNK0RhFL4/wNbM3PdcCgsfsbHDgkJKWPgD + ilJGNN73XEs/gbKUmvITuPc9d5iwYKfZyULZ26BkhTjnnXs1TWTNqafOx/M895z3ev84FsrwigQfvyGl + 1yNM1IyO4cQNrUKdqGFj1awmuGgWZnDC9Wouz8U1xnATkj+oE78HLVyWKPeAlH9EUkOa1FyzWOAxeVIS + JuxtRoVeERhS51zviLlsIHNjYRltW1ejWOChDdbqhEIfRoVbE0PZbXXoP3G/ygZFNyeYZ4xlwgzC9fAI + 7rmomUrQL01TyXekPUfSVo3zSSVXW3Ug75PNnEEpau+Uglff5XsnOH9D8reZuBJamOa6JvPQqkXhF89a + W9jw+MtAIiTVjRE88+AKY3/E5fKVGO74jC3hbMTBAPf2XT+FEzcGb7BqrH/KWNIUTLk34LX5V740Cn80 + yGKU4P07QTNS+t8Nz/sEkToIpLSWKNoAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEgSURBVDhP3Y/PKwRhHIf3f5g/wMWUlIuDUk5y5MCB3Dk4 + 7EUbBwdXJ3EXsksjidlk2x27NrXt5kdjlTQXbSFK2iaGaX7s491Zjppx5FNP7/et9/n0fmP/PFwu8JGd + 5OsaLdxpNIyVQPL1GcyDwWDmVsEx1sLLGvdHeLtduKVh/GIPTlbGPRvF3mmjXm0Vh8a9SEBGAl1gCMoS + j2p/uOyX5/AK4/i5bqgI8UrQPFUJO9mOr43gHk/9XOToy9QLCd4O+yAvxCb7gg0JK9WJqcWxTubDf+Kd + x0ERYkqwLliVeE8PRNufWhpnUxY7j2Fu92IlO3jOT+AqMk+lxfAS+6HI6/VW8NA5neVlb6g11zLcVNRo + v/gO1SXM3PTvpL+WWOwT04jC5H73kgIAAAAASUVORK5CYII= + + + + True + + + True + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + + 17, 17 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/nspector/frmExportProfiles.Designer.cs b/nspector/frmExportProfiles.Designer.cs new file mode 100644 index 0000000..bbd34a6 --- /dev/null +++ b/nspector/frmExportProfiles.Designer.cs @@ -0,0 +1,171 @@ +namespace nspector +{ + partial class frmExportProfiles + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lvProfiles = new System.Windows.Forms.ListView(); + this.chProfileName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.lProfiles = new System.Windows.Forms.Label(); + this.btnExport = new System.Windows.Forms.Button(); + this.btnCancel = new System.Windows.Forms.Button(); + this.btnSelAll = new System.Windows.Forms.Button(); + this.btnSelNone = new System.Windows.Forms.Button(); + this.btnInvertSelection = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // lvProfiles + // + this.lvProfiles.CheckBoxes = true; + this.lvProfiles.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.chProfileName}); + this.lvProfiles.FullRowSelect = true; + this.lvProfiles.GridLines = true; + this.lvProfiles.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + this.lvProfiles.Location = new System.Drawing.Point(18, 60); + this.lvProfiles.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.lvProfiles.MultiSelect = false; + this.lvProfiles.Name = "lvProfiles"; + this.lvProfiles.Size = new System.Drawing.Size(688, 595); + this.lvProfiles.Sorting = System.Windows.Forms.SortOrder.Ascending; + this.lvProfiles.TabIndex = 0; + this.lvProfiles.UseCompatibleStateImageBehavior = false; + this.lvProfiles.View = System.Windows.Forms.View.Details; + this.lvProfiles.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.lvProfiles_ItemChecked); + // + // chProfileName + // + this.chProfileName.Text = "ProfileName"; + this.chProfileName.Width = 420; + // + // lProfiles + // + this.lProfiles.AutoSize = true; + this.lProfiles.Location = new System.Drawing.Point(14, 18); + this.lProfiles.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lProfiles.Name = "lProfiles"; + this.lProfiles.Size = new System.Drawing.Size(273, 20); + this.lProfiles.TabIndex = 1; + this.lProfiles.Text = "Select the profiles you want to export:"; + // + // btnExport + // + this.btnExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnExport.Enabled = false; + this.btnExport.Location = new System.Drawing.Point(596, 666); + this.btnExport.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.btnExport.Name = "btnExport"; + this.btnExport.Size = new System.Drawing.Size(112, 35); + this.btnExport.TabIndex = 2; + this.btnExport.Text = "Export"; + this.btnExport.UseVisualStyleBackColor = true; + this.btnExport.Click += new System.EventHandler(this.btnExport_Click); + // + // btnCancel + // + this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnCancel.Location = new System.Drawing.Point(474, 666); + this.btnCancel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(112, 35); + this.btnCancel.TabIndex = 3; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); + // + // btnSelAll + // + this.btnSelAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnSelAll.Location = new System.Drawing.Point(18, 666); + this.btnSelAll.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.btnSelAll.Name = "btnSelAll"; + this.btnSelAll.Size = new System.Drawing.Size(112, 35); + this.btnSelAll.TabIndex = 4; + this.btnSelAll.Text = "Select All"; + this.btnSelAll.UseVisualStyleBackColor = true; + this.btnSelAll.Click += new System.EventHandler(this.btnSelAll_Click); + // + // btnSelNone + // + this.btnSelNone.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnSelNone.Location = new System.Drawing.Point(140, 666); + this.btnSelNone.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.btnSelNone.Name = "btnSelNone"; + this.btnSelNone.Size = new System.Drawing.Size(112, 35); + this.btnSelNone.TabIndex = 4; + this.btnSelNone.Text = "Select None"; + this.btnSelNone.UseVisualStyleBackColor = true; + this.btnSelNone.Click += new System.EventHandler(this.btnSelNone_Click); + // + // btnInvertSelection + // + this.btnInvertSelection.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnInvertSelection.Location = new System.Drawing.Point(261, 666); + this.btnInvertSelection.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.btnInvertSelection.Name = "btnInvertSelection"; + this.btnInvertSelection.Size = new System.Drawing.Size(150, 35); + this.btnInvertSelection.TabIndex = 4; + this.btnInvertSelection.Text = "Invert Selection"; + this.btnInvertSelection.UseVisualStyleBackColor = true; + this.btnInvertSelection.Click += new System.EventHandler(this.btnInvertSelection_Click); + // + // frmExportProfiles + // + this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.ClientSize = new System.Drawing.Size(726, 720); + this.Controls.Add(this.btnInvertSelection); + this.Controls.Add(this.btnSelNone); + this.Controls.Add(this.btnSelAll); + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.btnExport); + this.Controls.Add(this.lProfiles); + this.Controls.Add(this.lvProfiles); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "frmExportProfiles"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "frmExportProfiles"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.ListView lvProfiles; + private System.Windows.Forms.ColumnHeader chProfileName; + private System.Windows.Forms.Label lProfiles; + private System.Windows.Forms.Button btnExport; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Button btnSelAll; + private System.Windows.Forms.Button btnSelNone; + private System.Windows.Forms.Button btnInvertSelection; + } +} \ No newline at end of file diff --git a/nspector/frmExportProfiles.cs b/nspector/frmExportProfiles.cs new file mode 100644 index 0000000..aacab14 --- /dev/null +++ b/nspector/frmExportProfiles.cs @@ -0,0 +1,120 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using nspector.Common; +using nspector.Common.Helper; +using nspector.Common.Import; + +namespace nspector +{ + internal partial class frmExportProfiles : Form + { + frmDrvSettings settingsOwner = null; + + internal frmExportProfiles() + { + InitializeComponent(); + this.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); + this.DoubleBuffered = true; + } + + internal void ShowDialog(frmDrvSettings SettingsOwner) + { + settingsOwner = SettingsOwner; + Text = "Profile Export"; + updateProfileList(); + this.ShowDialog(); + } + + + private void updateProfileList() + { + lvProfiles.Items.Clear(); + + if (settingsOwner != null) + { + foreach(string mp in DrsServiceLocator.ScannerService.ModifiedProfiles) + { + lvProfiles.Items.Add(mp); + } + } + } + + + private void btnCancel_Click(object sender, EventArgs e) + { + Close(); + } + + private void btnSelAll_Click(object sender, EventArgs e) + { + for(int i=0;i(); + for (int i = 0; i < lvProfiles.Items.Count; i++) + { + if (lvProfiles.Items[i].Checked) + { + profileNamesToExport.Add(lvProfiles.Items[i].Text); + } + } + + DrsServiceLocator.ImportService.ExportProfiles(profileNamesToExport, sfd.FileName, false); + + if (profileNamesToExport.Count > 0) + { + if (MessageBox.Show("Export succeeded.\r\n\r\nWould you like to continue exporting profiles?", "Profiles Export", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No) + Close(); + } + else + MessageBox.Show("Nothing to export"); + } + } + + private void lvProfiles_ItemChecked(object sender, ItemCheckedEventArgs e) + { + int cc = 0; + for (int i = 0; i < lvProfiles.Items.Count;i++ ) + if (lvProfiles.Items[i].Checked) + cc++; + + if (cc > 0) + btnExport.Enabled = true; + else + btnExport.Enabled = false; + } + + + + } + +} diff --git a/nspector/frmExportProfiles.resx b/nspector/frmExportProfiles.resx new file mode 100644 index 0000000..5ea0895 --- /dev/null +++ b/nspector/frmExportProfiles.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/nspector/n1.ico b/nspector/n1.ico new file mode 100644 index 0000000..96391d1 Binary files /dev/null and b/nspector/n1.ico differ diff --git a/nspector/nspector.csproj b/nspector/nspector.csproj new file mode 100644 index 0000000..c3a34e3 --- /dev/null +++ b/nspector/nspector.csproj @@ -0,0 +1,306 @@ + + + + Debug + x86 + 10.0.20506 + 2.0 + {27B20027-E783-4ADC-AF16-40A49463F4BF} + WinExe + Properties + nspector + nspector + v4.0 + 512 + x86 + + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + false + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + true + bin\x64\Debug\ + DEBUG;TRACE + false + full + x64 + default + prompt + false + false + true + false + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + default + prompt + false + false + true + false + + + true + bin\Debug\ + DEBUG;TRACE + full + AnyCPU + default + prompt + false + false + true + false + false + + + bin\Release\ + TRACE + false + pdbonly + AnyCPU + default + prompt + false + false + true + false + false + false + Auto + + + n1.ico + + + nspector.Program + + + app.manifest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + True + NvApiDriverSettings.tt + + + + + + + + + + Form + + + frmBitEditor.cs + + + Form + + + frmDrvSettings.cs + + + Form + + + frmExportProfiles.cs + + + Component + + + + + frmBitEditor.cs + Designer + + + frmDrvSettings.cs + Designer + + + frmExportProfiles.cs + Designer + + + PublicResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + Designer + + + Designer + + + TextTemplatingFileGenerator + NvApiDriverSettings.cs + + + + + PreserveNewest + Designer + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + Microsoft .NET Framework 4 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + false + + + False + Windows Installer 4.5 + true + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nvidiaProfileInspector.sln b/nvidiaProfileInspector.sln new file mode 100644 index 0000000..d2b4e9d --- /dev/null +++ b/nvidiaProfileInspector.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nspector", "nspector\nspector.csproj", "{27B20027-E783-4ADC-AF16-40A49463F4BF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {27B20027-E783-4ADC-AF16-40A49463F4BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {27B20027-E783-4ADC-AF16-40A49463F4BF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {27B20027-E783-4ADC-AF16-40A49463F4BF}.Debug|x64.ActiveCfg = Debug|x64 + {27B20027-E783-4ADC-AF16-40A49463F4BF}.Debug|x64.Build.0 = Debug|x64 + {27B20027-E783-4ADC-AF16-40A49463F4BF}.Debug|x86.ActiveCfg = Debug|x86 + {27B20027-E783-4ADC-AF16-40A49463F4BF}.Debug|x86.Build.0 = Debug|x86 + {27B20027-E783-4ADC-AF16-40A49463F4BF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {27B20027-E783-4ADC-AF16-40A49463F4BF}.Release|Any CPU.Build.0 = Release|Any CPU + {27B20027-E783-4ADC-AF16-40A49463F4BF}.Release|x64.ActiveCfg = Release|x64 + {27B20027-E783-4ADC-AF16-40A49463F4BF}.Release|x64.Build.0 = Release|x64 + {27B20027-E783-4ADC-AF16-40A49463F4BF}.Release|x86.ActiveCfg = Release|x86 + {27B20027-E783-4ADC-AF16-40A49463F4BF}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal