Orbmu2k/nvidiaProfileInspector · error · NvapiException
DRS_EnumApplications
Error message
DRS_EnumApplications
What it means
NvapiException wrapping a non-OK, non-END_ENUMERATION status from DRS_EnumApplications, which lists the applications attached to a profile. NVAPI_END_ENUMERATION is treated as an empty list; any other failure status is thrown. Raised in GetProfileApplications, which feeds the applications view (otherApps).
Solutions
- Log the wrapped NVAPI status to distinguish handle invalidation from struct-version mismatch
- Re-create the session and re-acquire the profile handle, then retry enumeration
- Keep NVDRS_APPLICATION_VER_V4 (and other version constants) in sync with the bundled NVAPI header version for the target driver
- Only use hSession/hProfile handles obtained from the same DRS session instance
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 { apps = GetProfileApplications(hSession, hProfile); }
catch (NvapiException ex) { Log.Warn($"DRS_EnumApplications failed: {ex.Status}"); apps = new List<NVDRS_APPLICATION_V4>(); } Prevention
- Keep NVDRS_APPLICATION_VER version constants matched to the bundled NVAPI header
- Never mix handles across DRS sessions
- Reopen the profile after driver reloads
- Treat non-OK statuses as recoverable and log them
When it happens
Trigger: Calling GetProfileApplications with an invalid hProfile or a session that was destroyed; the profile handle belongs to another DRS session; the underlying struct version (NVDRS_APPLICATION_VER) mismatches the driver's expected version; driver state changed between calls.
Common situations: Enumerating applications on the base/global profile after a driver update invalidated handles; mixing handles from two sessions; struct version constants lagging a new NVIDIA driver release causing NVAPI_INCOMPATIBLE_STRUCT_VERSION.
Related errors
AI-assisted analysis of Orbmu2k/nvidiaProfileInspector@2f50c388b3 (2026-09-15).
Data as JSON: /api/errors/4dc448ec9de5e331.
Report an issue: GitHub.
Appendix: source
Thrown at nvidiaProfileInspector/Common/DrsSettingsServiceBase.cs:403
}
}
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;
var esRes = NvapiDrsWrapper.Instance.DRS_EnumApplications(hSession, hProfile, 0, ref appCount, ref apps);
if (esRes == NvAPI_Status.NVAPI_END_ENUMERATION)
return new List<NVDRS_APPLICATION_V4>();
if (esRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_EnumApplications", esRes);
return apps.ToList();
}
protected IntPtr FindApplicationByName(IntPtr hSession, string appName)
{
IntPtr hProfile = IntPtr.Zero;
NVDRS_APPLICATION_V4 app = new NVDRS_APPLICATION_V4();
app.version = NvapiDrsWrapper.NVDRS_APPLICATION_VER_V4;
var res = NvapiDrsWrapper.Instance.DRS_FindApplicationByName(hSession, new StringBuilder(appName), ref hProfile, ref app);
if (res != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_FindApplicationByName", res);
return hProfile;
}
View on GitHub (pinned to 2f50c388b3)