Orbmu2k/nvidiaProfileInspector · error · NvapiException

DRS_RestoreProfileDefaultSetting

Error message

DRS_RestoreProfileDefaultSetting

What it means

NvapiException wrapping a non-NVAPI_OK status from DRS_RestoreProfileDefaultSetting. It is raised by ResetValue when deleting a single setting override: within a DRS session the profile handle is looked up and, if it exists, the driver is asked to restore the factory default for the given settingId; any failure status from the call is wrapped and thrown, so the individual setting override remains in place.

Solutions

  1. Check that the settingId is a valid, currently-set value on that profile before resetting.
  2. Catch NvapiException in the UI layer and inform the user the reset failed, keeping the current value.
  3. Reopen the DRS session and retry once, as transient session-state errors can occur.
  4. If the profile handle is IntPtr.Zero, skip the driver call instead of proceeding.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at nvidiaProfileInspector/Common/DrsSettingsService.cs:304 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Orbmu2k/nvidiaProfileInspector@2f50c388b3 (2026-09-15). Data as JSON: /api/errors/b93f5f0a35d9c806. Report an issue: GitHub.

Appendix: source

Thrown at nvidiaProfileInspector/Common/DrsSettingsService.cs:304

                }
            });

            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.Instance.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;

View on GitHub (pinned to 2f50c388b3)