Orbmu2k/nvidiaProfileInspector · error · NvapiException
DRS_EnumSettings
Error message
DRS_EnumSettings
What it means
NvapiException wrapping the NVAPI status returned by DRS_EnumSettings when it is neither NVAPI_OK nor the benign NVAPI_END_ENUMERATION. DRS_EnumSettings enumerates the driver settings on a profile; a non-OK status means the enumeration call itself failed at the NVIDIA driver interface level. The exception is thrown by GetProfileSettings in DrsSettingsServiceBase before any per-setting decryption/processing.
Solutions
- Check that the NvapiException.Status is not NVAPI_END_ENUMERATION/expected value and log the exact status to identify the failure
- Ensure NVAPI_Initialize succeeded and DRS_CreateSession/DRS_OpenProfileSession returned NVAPI_OK before enumerating
- Re-create the DRS session and re-open the profile after driver updates or process changes
- Verify the app runs with the privileges NVAPI DRS requires (usually the same user, sometimes admin for system profile)
- Call NvapiDrsWrapper.Initialize once at startup and check its result instead of assuming it succeeded
Example fix
// before
var settings = GetProfileSettings(hSession, hProfile);
// after
try { var settings = GetProfileSettings(hSession, hProfile); }
catch (NvapiException ex) { Log.Warn($"DRS_EnumSettings failed: {ex.Status}"); settings = new List<NVDRS_SETTING>(); } Defensive patterns
Strategy: try-catch
Validate before calling
if (hSession == IntPtr.Zero || hProfile == IntPtr.Zero) throw new InvalidOperationException("DRS session/profile not open"); Try / catch
try { settings = GetProfileSettings(hSession, hProfile); }
catch (NvapiException ex) { Log.Warn($"DRS_EnumSettings failed with {ex.Status}"); settings = new List<NVDRS_SETTING>(); } Prevention
- Initialize NVAPI once and verify it returned NVAPI_OK
- Reuse handles from a single DRS session; recreate after driver updates
- Check each DRS call's status instead of assuming success
- Log the wrapped NvapiException.Status for diagnosis
When it happens
Trigger: Calling GetProfileSettings with an invalid or already-closed hSession/hProfile handle; the profile handle was invalidated by a driver reload or DRS_DestroySession; an NVAPI call earlier in the flow failed silently (e.g. Initialize without admin rights on some driver versions); passing a session created without DRS_CreateSession returning OK.
Common situations: Reading settings right after the NVIDIA driver was updated (session/handle invalidation); using a profile handle obtained from a different session; running without sufficient privileges so DRS calls return NVAPI_ERROR/NVAPI_NO_IMPLEMENTATION; app running before NVAPI_Initialize succeeded.
Related errors
- DRS_CreateApplication
- DRS_DeleteApplication
- DRS_EnumApplications
- DRS_FindApplicationByName
- DRS_SaveSettings
AI-assisted analysis of Orbmu2k/nvidiaProfileInspector@2f50c388b3 (2026-09-15).
Data as JSON: /api/errors/c196e1c6ce671c6b.
Report an issue: GitHub.
Appendix: source
Thrown at nvidiaProfileInspector/Common/DrsSettingsServiceBase.cs:377
if (nvRes != NvAPI_Status.NVAPI_END_ENUMERATION)
throw new NvapiException("DRS_EnumProfiles", nvRes);
return profileHandles;
}
protected List<NVDRS_SETTING> GetProfileSettings(IntPtr hSession, IntPtr hProfile, uint expectedCount = 512)
{
uint settingCount = expectedCount > 0 ? expectedCount : 1;
var settings = new NVDRS_SETTING[settingCount];
settings[0].version = NvapiDrsWrapper.NVDRS_SETTING_VER;
var esRes = NvapiDrsWrapper.Instance.DRS_EnumSettings(hSession, hProfile, 0, ref settingCount, ref settings);
if (esRes == NvAPI_Status.NVAPI_END_ENUMERATION)
return new List<NVDRS_SETTING>();
if (esRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_EnumSettings", esRes);
if (decrypter != null)
{
var profile = GetProfileInfo(hSession, hProfile);
for (int i = 0; i < settingCount; i++)
{
decrypter.DecryptSettingIfNeeded(profile.profileName, ref settings[i]);
}
}
return settings.ToList();
}
protected List<NVDRS_APPLICATION_V4> GetProfileApplications(IntPtr hSession, IntPtr hProfile)
{
uint appCount = 512;
var apps = new NVDRS_APPLICATION_V4[512];
apps[0].version = NvapiDrsWrapper.NVDRS_APPLICATION_VER_V4;View on GitHub (pinned to 2f50c388b3)