Skip to content

Commit

Permalink
Add require admin rights, x64 build.
Browse files Browse the repository at this point in the history
  • Loading branch information
Demion committed Jan 5, 2019
1 parent 863baae commit 4e22ad2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
### Changelog:

- **v0.3** - [NvApiOc v0.3](https://github.com/Demion/nvapioc/releases/download/v0.3/NvApiOc_v0.3.zip)
* Add require administrator rights (UAC).
* Add x64 build support.
- **v0.2** - [NvApiOc v0.2](https://github.com/Demion/nvapioc/releases/download/v0.2/NvApiOc_v0.2.zip)
* Add log file.
* Add TCC devices support.
Expand Down
13 changes: 10 additions & 3 deletions Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,13 @@ int Load()

HMODULE nvapi = 0;

LOG(nvapi = LoadLibraryA("nvapi.dll"));
#if defined _WIN64
char nvapiDllName[] = "nvapi64.dll";
#else
char nvapiDllName[] = "nvapi.dll";
#endif

LOG(nvapi = LoadLibraryA(nvapiDllName));

result = !(nvapi != 0);

Expand All @@ -236,7 +242,7 @@ int Load()
NvAPI_Unload = (int (__cdecl*)()) NvAPI_QueryInterface(0xD22BDD7E);
NvAPI_RestartDisplayDriver = (int (__cdecl*)()) NvAPI_QueryInterface(0xB4B26B65);
NvAPI_EnumPhysicalGPUs = (int (__cdecl*)(unsigned int*, unsigned int*)) NvAPI_QueryInterface(0xE5AC921F);
NvAPI_EnumTCCPhysicalGPUs = (int(__cdecl*)(unsigned int*, unsigned int*)) NvAPI_QueryInterface(0xD9930B07);
NvAPI_EnumTCCPhysicalGPUs = (int (__cdecl*)(unsigned int*, unsigned int*)) NvAPI_QueryInterface(0xD9930B07);
NvAPI_GPU_SetPstates20 = (int (__cdecl*)(unsigned int, NV_GPU_PERF_PSTATES20_INFO*)) NvAPI_QueryInterface(0x0F4DAE6B);
NvAPI_GPU_GetClockBoostLock = (int (__cdecl*)(unsigned int, NV_GPU_CLOCK_LOCK*)) NvAPI_QueryInterface(0xE440B867);
NvAPI_GPU_SetClockBoostLock = (int (__cdecl*)(unsigned int, NV_GPU_CLOCK_LOCK*)) NvAPI_QueryInterface(0x39442CFB);
Expand Down Expand Up @@ -647,7 +653,8 @@ void ParseArgs(int argc, char *argv[])
}
else
{
printf("Invalid parameter #%d \"%s\"\n", arg, argv[arg]);
printf("\n"
"Invalid parameter #%d \"%s\"\n", arg, argv[arg]);
}

++arg;
Expand Down
4 changes: 4 additions & 0 deletions nvapioc.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
Expand All @@ -104,6 +105,7 @@
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand All @@ -120,6 +122,7 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand All @@ -136,6 +139,7 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down

0 comments on commit 4e22ad2

Please sign in to comment.