Created
January 7, 2017 02:20
-
-
Save riverar/a793d1682a2aacf67a7e6fd673331f1a to your computer and use it in GitHub Desktop.
NVIDIA DRS throwaway code to investigate why Astroneer is reporting as Asteroid Assembler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include "nvapi.h" | |
#include "NvApiDriverSettings.h" | |
#define FAST_FAIL(x) { __debugbreak; NvAPI_Status __status = x; if (__status != NVAPI_OK) { return __status; } } | |
int wmain() | |
{ | |
auto NvStringOrEmpty = [](NvAPI_UnicodeString nvstring) -> LPWSTR | |
{ | |
auto string = std::wstring(reinterpret_cast<LPWSTR>(nvstring)); | |
if (string.length() == 0) | |
return L"<empty>"; | |
else | |
return reinterpret_cast<LPWSTR>(nvstring); | |
}; | |
FAST_FAIL(NvAPI_Initialize()); | |
NvDRSSessionHandle session; | |
FAST_FAIL(NvAPI_DRS_CreateSession(&session)); | |
FAST_FAIL(NvAPI_DRS_LoadSettings(session)); | |
NvDRSProfileHandle profile; | |
NVDRS_APPLICATION application = {}; | |
application.version = NVDRS_APPLICATION_VER_V4; | |
NvAPI_UnicodeString name = { 0 }; | |
memcpy(&name, L"astro.exe", sizeof(wchar_t) * 9); | |
FAST_FAIL(NvAPI_DRS_FindApplicationByName(session, name, &profile, &application)); | |
NVDRS_PROFILE profileInfo = { 0 }; | |
profileInfo.version = NVDRS_PROFILE_VER1; | |
FAST_FAIL(NvAPI_DRS_GetProfileInfo(session, profile, &profileInfo)); | |
printf("\n"); | |
printf(" [*] Profile name:\t%ws\n", NvStringOrEmpty(profileInfo.profileName)); | |
printf(" [*] App count: \t%d\n", profileInfo.numOfApps); | |
printf(" [*] Is Predefined:\t%d\n", profileInfo.isPredefined); | |
NVDRS_APPLICATION* app = new NVDRS_APPLICATION[profileInfo.numOfApps]; | |
app[0].version = NVDRS_APPLICATION_VER_V4; | |
NvU32 appsRead = profileInfo.numOfApps; | |
FAST_FAIL(NvAPI_DRS_EnumApplications(session, profile, 0, &appsRead, app)); | |
printf(" [*] Tied to executables:\n"); | |
for (auto i = 0; i < appsRead; i++) | |
{ | |
printf(" > %ws\n", app[i].appName); | |
printf(" ... if this file exists in same folder: %ws\n", NvStringOrEmpty(app[i].fileInFolder)); | |
printf(" ... uses specific command line: %ws\n", app[i].isCommandLine ? NvStringOrEmpty(app[i].commandLine) : L"<empty>"); | |
printf(" ... uses this launcher: %ws\n", NvStringOrEmpty(app[i].launcher)); | |
} | |
FAST_FAIL(NvAPI_DRS_DestroySession(session)); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment