diff options
author | Jens Peters <jp7677@gmail.com> | 2022-06-06 12:11:57 +0300 |
---|---|---|
committer | Jens Peters <jp7677@gmail.com> | 2022-06-06 12:11:57 +0300 |
commit | ad6df3dd593a1c5c79d476ac6193093fc1ec84a9 (patch) | |
tree | fc540dfb1d534281a4160a4e80c9f4bf4503837f | |
parent | c3bdd3b5827a3828a8b47afc0f0566b36360856a (diff) |
nvapi-d3d: Validate that NVAPI has been initialized
-rw-r--r-- | src/nvapi_d3d.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nvapi_d3d.cpp b/src/nvapi_d3d.cpp index b6f4cee..92723f4 100644 --- a/src/nvapi_d3d.cpp +++ b/src/nvapi_d3d.cpp @@ -109,6 +109,9 @@ extern "C" { static bool alreadyLoggedOk = false; static bool alreadyLoggedNoLfx = false; + if (nvapiAdapterRegistry == nullptr) + return ApiNotInitialized(n); + if (!nvapiD3dInstance->IsReflexAvailable()) return NoImplementation(n, alreadyLoggedNoLfx); @@ -121,6 +124,9 @@ extern "C" { constexpr auto n = __func__; static bool alreadyLoggedNoLfx = false; + if (nvapiAdapterRegistry == nullptr) + return ApiNotInitialized(n); + if (pSetSleepModeParams->version != NV_SET_SLEEP_MODE_PARAMS_VER1) return IncompatibleStructVersion(n); @@ -138,6 +144,9 @@ extern "C" { constexpr auto n = __func__; static bool alreadyLoggedNoLfx = false; + if (nvapiAdapterRegistry == nullptr) + return ApiNotInitialized(n); + if (pGetSleepStatusParams->version != NV_GET_SLEEP_STATUS_PARAMS_VER1) return IncompatibleStructVersion(n); |