Skip to content

Instantly share code, notes, and snippets.

@Barakat
Last active July 28, 2018 16:20
Show Gist options
  • Select an option

  • Save Barakat/f9deb59edf696f21b95bf5cc2e3abec0 to your computer and use it in GitHub Desktop.

Select an option

Save Barakat/f9deb59edf696f21b95bf5cc2e3abec0 to your computer and use it in GitHub Desktop.
Kill MSI logo LEDs in MSI GTX 980 Ti Graphics Card
#include <Windows.h>
typedef bool (__stdcall *NDA_SetIlluminationParm_t)(int adapter_index, int attribute, int value);
typedef bool (__stdcall *NDA_GetIlluminationParm_t)(int adapter_index, int attribute, int *value);
typedef bool (__stdcall *NDA_GetGPUCounts_t)(int *gpu_count);
typedef bool (__stdcall *NDA_Initialize_t)();
typedef bool (__stdcall *NDA_Unload_t)();
int
main()
{
auto nda = LoadLibraryW(LR"(C:\Program Files (x86)\MSI\MSI Gaming APP\Lib\NDA.dll)");
auto NDA_Initialize = reinterpret_cast<NDA_Initialize_t>(
GetProcAddress(nda, "_NDA_Initialize@0")
);
auto NDA_Unload = reinterpret_cast<NDA_Unload_t>(
GetProcAddress(nda, "_NDA_Unload@0")
);
auto NDA_GetGPUCounts = reinterpret_cast<NDA_GetGPUCounts_t>(
GetProcAddress(nda, "_NDA_GetGPUCounts@4")
);
auto NDA_SetIlluminationParm = reinterpret_cast<NDA_SetIlluminationParm_t>(
GetProcAddress(nda, "_NDA_SetIlluminationParm@12")
);
auto NDA_GetIlluminationParm = reinterpret_cast<NDA_GetIlluminationParm_t>(
GetProcAddress(nda, "_NDA_GetIlluminationParm@12")
);
NDA_Initialize();
int gpu_count;
NDA_GetGPUCounts(&gpu_count);
for (auto i = 0; i < gpu_count; ++i)
{
int illumination;
NDA_GetIlluminationParm(i, 0, &illumination);
if (illumination > 0)
{
illumination = 0;
}
else
{
illumination = 100;
}
NDA_SetIlluminationParm(i, 0, illumination);
}
NDA_Unload();
FreeLibrary(nda);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment