add plugins-extra

This commit is contained in:
AirDog46
2025-05-13 19:49:49 +03:00
parent c5fab8aa94
commit 3575d86c17
531 changed files with 70258 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
1.1
*
1.0
* Initial release

View File

@@ -0,0 +1,225 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (Australia) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
#pragma code_page(1252)
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,1,0,0
PRODUCTVERSION 1,1,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "0c0904b0"
BEGIN
VALUE "CompanyName", "dmex"
VALUE "FileDescription", "Nvidia GPU plugin for Process Hacker"
VALUE "FileVersion", "1.1"
VALUE "InternalName", "dmex.NvGpuPlugin"
VALUE "LegalCopyright", "Licensed under the GNU GPL, v3."
VALUE "OriginalFilename", "NvGpuPlugin.dll"
VALUE "ProductName", "Nvidia GPU plugin for Process Hacker"
VALUE "ProductVersion", "1.1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0xc09, 1200
END
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\0"
END
3 TEXTINCLUDE
BEGIN
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_GPU_DIALOG DIALOGEX 0, 0, 315, 191
STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_APPWINDOW
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "GPU",IDC_TITLE,0,0,72,21
RTEXT "GPU Name",IDC_GPUNAME,83,4,232,16,SS_WORDELLIPSIS
LTEXT "Panel layout",IDC_PANEL_LAYOUT,0,145,315,46,NOT WS_VISIBLE
LTEXT "Graph layout",IDC_GRAPH_LAYOUT,0,22,315,120,NOT WS_VISIBLE
LTEXT "GPU:",IDC_GPU_L,73,0,17,8
LTEXT "Memory:",IDC_MEMORY_L,73,5,29,8
LTEXT "Memory Controller:",IDC_SHARED_L,74,11,62,8
LTEXT "Bus Interface:",IDC_BUS_L,74,18,47,8
END
IDD_GPU_PANEL DIALOGEX 0, 0, 372, 47
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
GROUPBOX "Clocks",IDC_STATIC,0,0,118,43
LTEXT "Core",IDC_STATIC,8,10,16,8
LTEXT "Memory",IDC_STATIC,8,21,26,8
RTEXT "Static",IDC_CLOCK_CORE,55,10,54,8,SS_ENDELLIPSIS
RTEXT "Static",IDC_CLOCK_MEMORY,55,21,54,8,SS_ENDELLIPSIS
GROUPBOX "Fan",IDC_STATIC,122,0,124,22
LTEXT "Speed",IDC_STATIC,130,10,21,8
RTEXT "Static",IDC_FAN_PERCENT,158,10,78,8,SS_ENDELLIPSIS
LTEXT "Shader",IDC_STATIC,8,32,24,8
RTEXT "Static",IDC_CLOCK_SHADER,55,32,54,8,SS_ENDELLIPSIS
GROUPBOX "Temperature",IDC_STATIC,122,22,124,21
LTEXT "Core",IDC_STATIC,130,32,16,8
RTEXT "Static",IDC_TEMP_VALUE,158,32,78,8,SS_ENDELLIPSIS
GROUPBOX "Voltage",IDC_STATIC,248,0,124,22
LTEXT "Core",IDC_STATIC,256,10,16,8
RTEXT "Static",IDC_VOLTAGE,284,10,78,8,SS_ENDELLIPSIS
PUSHBUTTON "Details",IDC_DETAILS,249,27,50,14
END
IDD_OPTIONS DIALOGEX 0, 0, 211, 58
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,100,37,50,14
PUSHBUTTON "Cancel",IDCANCEL,154,37,50,14
CONTROL "Enable Nvidia GPU graphs",IDC_ENABLENVIDIASUPPORT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,98,10
END
IDD_GPU_DETAILS DIALOGEX 0, 0, 265, 245
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
PUSHBUTTON "Close",IDCANCEL,208,224,50,14
EDITTEXT IDC_EDIT1,31,7,155,12,ES_CENTER | ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_EDIT2,31,26,60,12,ES_CENTER | ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_EDIT3,31,43,155,12,ES_CENTER | ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_EDIT4,133,26,53,12,ES_CENTER | ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_EDIT5,31,59,74,12,ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_EDIT6,31,77,74,12,ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_EDIT7,31,95,74,12,ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_EDIT8,112,59,74,12,ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_EDIT9,112,77,74,12,ES_AUTOHSCROLL | ES_READONLY
CONTROL "",IDC_NVIMAGE,"Static",SS_BITMAP,197,7,15,13
EDITTEXT IDC_EDIT10,111,95,74,12,ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_EDIT11,31,129,179,12,ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_EDIT12,31,148,179,12,ES_AUTOHSCROLL | ES_READONLY
RTEXT "Name",IDC_STATIC,7,9,20,8
RTEXT "GPU",IDC_STATIC,7,28,20,8
RTEXT "Revision",IDC_STATIC,101,28,28,8
RTEXT "BIOS",IDC_STATIC,7,46,20,8
RTEXT "ID",IDC_STATIC,7,61,20,8
EDITTEXT IDC_EDIT13,31,112,74,12,ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_EDIT14,111,112,74,12,ES_AUTOHSCROLL | ES_READONLY
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_GPU_DIALOG, DIALOG
BEGIN
BOTTOMMARGIN, 183
END
IDD_GPU_PANEL, DIALOG
BEGIN
END
IDD_OPTIONS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 204
TOPMARGIN, 7
BOTTOMMARGIN, 51
END
IDD_GPU_DETAILS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 258
TOPMARGIN, 7
BOTTOMMARGIN, 238
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// AFX_DIALOG_LAYOUT
//
IDD_GPU_DETAILS AFX_DIALOG_LAYOUT
BEGIN
0
END
/////////////////////////////////////////////////////////////////////////////
//
// PNG
//
IDB_NV_LOGO_PNG PNG "resources\\NVLogo_2D.png"
#endif // English (Australia) resources
/////////////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{B509BF8F-6007-4173-B05E-5037B958C12F}</ProjectGuid>
<RootNamespace>NvGpuPlugin</RootNamespace>
<Keyword>Win32Proj</Keyword>
<ProjectName>NvGpuPlugin</ProjectName>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\ExtraPlugins.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\ExtraPlugins.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\ExtraPlugins.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\ExtraPlugins.props" />
</ImportGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;C:\Users\AirDog46\Downloads\processhacker-2.39-src\bin\Debug32</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;C:\Users\AirDog46\Downloads\processhacker-2.39-src\bin\Release64</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;C:\Users\AirDog46\Downloads\processhacker-2.39-src\bin\Release32</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="details.c" />
<ClCompile Include="graph.c" />
<ClCompile Include="main.c" />
<ClCompile Include="nvgpu.c" />
<ClCompile Include="nvidia.c" />
<ClCompile Include="options.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="main.h" />
<ClInclude Include="nvapi\nvapi.h" />
<ClInclude Include="nvapi\nvapi_lite_common.h" />
<ClInclude Include="nvidia.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="NvGpuPlugin.rc" />
</ItemGroup>
<ItemGroup>
<None Include="CHANGELOG.txt" />
</ItemGroup>
<ItemGroup>
<Image Include="resources\NVLogo_2D.png" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{47359E56-A930-4DDC-A651-E2E99D48E957}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{4965CB7A-371A-4B22-AC3F-E70DC77C5D24}</UniqueIdentifier>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{00475F04-2369-42D8-9A52-9DB77E37AE62}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\nvapi">
<UniqueIdentifier>{6ead20da-8b3b-4b7e-a987-e08ab26425f2}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="main.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="nvapi\nvapi.h">
<Filter>Header Files\nvapi</Filter>
</ClInclude>
<ClInclude Include="nvapi\nvapi_lite_common.h">
<Filter>Header Files\nvapi</Filter>
</ClInclude>
<ClInclude Include="nvidia.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="graph.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="options.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="nvidia.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="details.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="nvgpu.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="CHANGELOG.txt" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="NvGpuPlugin.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="resources\NVLogo_2D.png">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,133 @@
/*
* Process Hacker Extra Plugins -
* Nvidia GPU Plugin
*
* Copyright (C) 2015 dmex
*
* This file is part of Process Hacker.
*
* Process Hacker is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Process Hacker is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Process Hacker. If not, see <http://www.gnu.org/licenses/>.
*/
#include "main.h"
VOID NvUpdateDetails(
_Inout_ PPH_NVGPU_SYSINFO_CONTEXT Context
)
{
SetDlgItemText(Context->DetailsHandle, IDC_EDIT1, ((PPH_STRING)PhAutoDereferenceObject(NvGpuQueryName()))->Buffer);
SetDlgItemText(Context->DetailsHandle, IDC_EDIT2, ((PPH_STRING)PhAutoDereferenceObject(NvGpuQueryShortName()))->Buffer);
SetDlgItemText(Context->DetailsHandle, IDC_EDIT3, ((PPH_STRING)PhAutoDereferenceObject(NvGpuQueryVbiosVersionString()))->Buffer);
SetDlgItemText(Context->DetailsHandle, IDC_EDIT4, ((PPH_STRING)PhAutoDereferenceObject(NvGpuQueryRevision()))->Buffer);
SetDlgItemText(Context->DetailsHandle, IDC_EDIT5, ((PPH_STRING)PhAutoDereferenceObject(NvGpuQueryDeviceId()))->Buffer);
SetDlgItemText(Context->DetailsHandle, IDC_EDIT6, ((PPH_STRING)PhAutoDereferenceObject(NvGpuQueryRopsCount()))->Buffer);
SetDlgItemText(Context->DetailsHandle, IDC_EDIT7, ((PPH_STRING)PhAutoDereferenceObject(NvGpuQueryShaderCount()))->Buffer);
//SetDlgItemText(Context->DetailsHandle, IDC_EDIT8, ((PPH_STRING)PhAutoDereferenceObject(NvGpuQueryPciInfo()))->Buffer);
SetDlgItemText(Context->DetailsHandle, IDC_EDIT9, ((PPH_STRING)PhAutoDereferenceObject(NvGpuQueryBusWidth()))->Buffer);
SetDlgItemText(Context->DetailsHandle, IDC_EDIT10, ((PPH_STRING)PhAutoDereferenceObject(NvGpuQueryDriverVersion()))->Buffer);
SetDlgItemText(Context->DetailsHandle, IDC_EDIT11, ((PPH_STRING)PhAutoDereferenceObject(NvGpuQueryPcbValue()))->Buffer);
SetDlgItemText(Context->DetailsHandle, IDC_EDIT12, ((PPH_STRING)PhAutoDereferenceObject(NvGpuQueryDriverSettings()))->Buffer);
SetDlgItemText(Context->DetailsHandle, IDC_EDIT14, ((PPH_STRING)PhAutoDereferenceObject(NvGpuQueryRamType()))->Buffer);
//SetDlgItemText(Context->DetailsHandle, IDC_EDIT13, ((PPH_STRING)PhAutoDereferenceObject(NvGpuQueryRamMaker()))->Buffer);
//SetDlgItemText(Context->DetailsHandle, IDC_EDIT13, NvGpuDriverIsWHQL() ? L"WHQL" : L"");
SetDlgItemText(Context->DetailsHandle, IDC_EDIT13, ((PPH_STRING)PhAutoDereferenceObject(NvGpuQueryFoundry()))->Buffer);
}
INT_PTR CALLBACK DetailsDlgProc(
_In_ HWND hwndDlg,
_In_ UINT uMsg,
_In_ WPARAM wParam,
_In_ LPARAM lParam
)
{
PPH_NVGPU_SYSINFO_CONTEXT context = NULL;
if (uMsg == WM_INITDIALOG)
{
context = (PPH_NVGPU_SYSINFO_CONTEXT)lParam;
SetProp(hwndDlg, L"Context", (HANDLE)context);
}
else
{
context = (PPH_NVGPU_SYSINFO_CONTEXT)GetProp(hwndDlg, L"Context");
if (uMsg == WM_NCDESTROY)
{
RemoveProp(hwndDlg, L"Context");
}
}
if (context == NULL)
return FALSE;
switch (uMsg)
{
case WM_INITDIALOG:
{
context->DetailsHandle = hwndDlg;
PhCenterWindow(hwndDlg, GetParent(hwndDlg));
HBITMAP bitmapRefresh = NULL;
bitmapRefresh = LoadImageFromResources(96, 64, MAKEINTRESOURCE(IDB_NV_LOGO_PNG));
SendMessage(GetDlgItem(hwndDlg, IDC_NVIMAGE), STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)bitmapRefresh);
DeleteObject(bitmapRefresh);
NvUpdateDetails(context);
}
break;
case WM_DESTROY:
{
context->DetailsHandle = NULL;
}
break;
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDCANCEL:
case IDOK:
EndDialog(hwndDlg, IDOK);
break;
}
}
break;
case MSG_UPDATE:
{
NvUpdateDetails(context);
}
break;
}
return FALSE;
}
VOID ShowDetailsDialog(
_In_ HWND ParentHandle,
_In_ PVOID Context
)
{
DialogBoxParam(
PluginInstance->DllBase,
MAKEINTRESOURCE(IDD_GPU_DETAILS),
ParentHandle,
DetailsDlgProc,
(LPARAM)Context
);
}

View File

@@ -0,0 +1,834 @@
/*
* Process Hacker Extra Plugins -
* Nvidia GPU Plugin
*
* Copyright (C) 2015 dmex
*
* This file is part of Process Hacker.
*
* Process Hacker is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Process Hacker is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Process Hacker. If not, see <http://www.gnu.org/licenses/>.
*/
#include "main.h"
static RECT NormalGraphTextMargin = { 5, 5, 5, 5 };
static RECT NormalGraphTextPadding = { 3, 3, 3, 3 };
INT_PTR CALLBACK NvGpuPanelDialogProc(
_In_ HWND hwndDlg,
_In_ UINT uMsg,
_In_ WPARAM wParam,
_In_ LPARAM lParam
)
{
PPH_NVGPU_SYSINFO_CONTEXT context = NULL;
if (uMsg == WM_INITDIALOG)
{
context = (PPH_NVGPU_SYSINFO_CONTEXT)lParam;
SetProp(hwndDlg, L"Context", (HANDLE)context);
}
else
{
context = (PPH_NVGPU_SYSINFO_CONTEXT)GetProp(hwndDlg, L"Context");
if (uMsg == WM_NCDESTROY)
{
RemoveProp(hwndDlg, L"Context");
}
}
if (context == NULL)
return FALSE;
switch (uMsg)
{
case WM_COMMAND:
{
switch (GET_WM_COMMAND_ID(wParam, lParam))
{
case IDC_DETAILS:
{
ShowDetailsDialog(GetParent(hwndDlg), context);
}
break;
}
}
break;
}
return FALSE;
}
VOID NvGpuCreateGraphs(
_Inout_ PPH_NVGPU_SYSINFO_CONTEXT Context
)
{
Context->GpuGraphHandle = CreateWindow(
PH_GRAPH_CLASSNAME,
NULL,
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
Context->WindowHandle,
NULL,
NULL,
NULL
);
Graph_SetTooltip(Context->GpuGraphHandle, TRUE);
Context->MemGraphHandle = CreateWindow(
PH_GRAPH_CLASSNAME,
NULL,
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
Context->WindowHandle,
NULL,
NULL,
NULL
);
Graph_SetTooltip(Context->MemGraphHandle, TRUE);
Context->SharedGraphHandle = CreateWindow(
PH_GRAPH_CLASSNAME,
NULL,
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
Context->WindowHandle,
NULL,
NULL,
NULL
);
Graph_SetTooltip(Context->SharedGraphHandle, TRUE);
Context->BusGraphHandle = CreateWindow(
PH_GRAPH_CLASSNAME,
NULL,
WS_VISIBLE | WS_CHILD | WS_BORDER,
0,
0,
3,
3,
Context->WindowHandle,
NULL,
NULL,
NULL
);
Graph_SetTooltip(Context->BusGraphHandle, TRUE);
}
VOID NvGpuLayoutGraphs(
_Inout_ PPH_NVGPU_SYSINFO_CONTEXT Context
)
{
RECT clientRect;
RECT labelRect;
ULONG graphWidth;
ULONG graphHeight;
HDWP deferHandle;
ULONG y;
#define ET_GPU_PADDING 3
PhLayoutManagerLayout(&Context->LayoutManager);
GetClientRect(Context->WindowHandle, &clientRect);
GetClientRect(Context->GpuLabelHandle, &labelRect);
graphWidth = clientRect.right - Context->GpuGraphMargin.left - Context->GpuGraphMargin.right;
graphHeight = (clientRect.bottom - Context->GpuGraphMargin.top - Context->GpuGraphMargin.bottom - labelRect.bottom * 4 - ET_GPU_PADDING * 5) / 4;
deferHandle = BeginDeferWindowPos(8);
y = Context->GpuGraphMargin.top;
deferHandle = DeferWindowPos(
deferHandle,
Context->GpuLabelHandle,
NULL,
Context->GpuGraphMargin.left,
y,
0,
0,
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER
);
y += labelRect.bottom + ET_GPU_PADDING;
deferHandle = DeferWindowPos(
deferHandle,
Context->GpuGraphHandle,
NULL,
Context->GpuGraphMargin.left,
y,
graphWidth,
graphHeight,
SWP_NOACTIVATE | SWP_NOZORDER
);
y += graphHeight + ET_GPU_PADDING;
deferHandle = DeferWindowPos(
deferHandle,
Context->MemLabelHandle,
NULL,
Context->GpuGraphMargin.left,
y,
0,
0,
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER
);
y += labelRect.bottom + ET_GPU_PADDING;
deferHandle = DeferWindowPos(
deferHandle,
Context->MemGraphHandle,
NULL,
Context->GpuGraphMargin.left,
y,
graphWidth,
graphHeight,
SWP_NOACTIVATE | SWP_NOZORDER
);
y += graphHeight + ET_GPU_PADDING;
deferHandle = DeferWindowPos(
deferHandle,
Context->SharedLabelHandle,
NULL,
Context->GpuGraphMargin.left,
y,
0,
0,
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER
);
y += labelRect.bottom + ET_GPU_PADDING;
deferHandle = DeferWindowPos(
deferHandle,
Context->SharedGraphHandle,
NULL,
Context->GpuGraphMargin.left,
y,
graphWidth,
graphHeight,
SWP_NOACTIVATE | SWP_NOZORDER
);
y += graphHeight + ET_GPU_PADDING;
deferHandle = DeferWindowPos(
deferHandle,
Context->BusLabelHandle,
NULL,
Context->GpuGraphMargin.left,
y,
0,
0,
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER
);
y += labelRect.bottom + ET_GPU_PADDING;
deferHandle = DeferWindowPos(
deferHandle,
Context->BusGraphHandle,
NULL,
Context->GpuGraphMargin.left,
y,
graphWidth,
clientRect.bottom - Context->GpuGraphMargin.bottom - y,
SWP_NOACTIVATE | SWP_NOZORDER
);
EndDeferWindowPos(deferHandle);
}
VOID NvGpuNotifyUsageGraph(
_Inout_ PPH_NVGPU_SYSINFO_CONTEXT Context,
_In_ NMHDR *Header
)
{
switch (Header->code)
{
case GCN_GETDRAWINFO:
{
PPH_GRAPH_GETDRAWINFO getDrawInfo = (PPH_GRAPH_GETDRAWINFO)Header;
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y;
Context->Section->Parameters->ColorSetupFunction(drawInfo, PhGetIntegerSetting(L"ColorCpuKernel"), 0);
PhGraphStateGetDrawInfo(&Context->GpuGraphState, getDrawInfo, GpuUtilizationHistory.Count);
if (PhGetIntegerSetting(L"GraphShowText"))
{
HDC hdc = Graph_GetBufferedContext(Context->GpuGraphHandle);
PhMoveReference(&Context->GpuGraphState.Text,
PhFormatString(L"%.0f%%", GpuCurrentGpuUsage * 100)
);
SelectObject(hdc, PhApplicationFont);
PhSetGraphText(hdc, drawInfo, &Context->GpuGraphState.Text->sr,
&NormalGraphTextMargin, &NormalGraphTextPadding, PH_ALIGN_TOP | PH_ALIGN_LEFT);
}
else
{
drawInfo->Text.Buffer = NULL;
}
if (!Context->GpuGraphState.Valid)
{
PhCopyCircularBuffer_FLOAT(&GpuUtilizationHistory, Context->GpuGraphState.Data1, drawInfo->LineDataCount);
Context->GpuGraphState.Valid = TRUE;
}
}
break;
case GCN_GETTOOLTIPTEXT:
{
PPH_GRAPH_GETTOOLTIPTEXT getTooltipText = (PPH_GRAPH_GETTOOLTIPTEXT)Header;
if (getTooltipText->Index < getTooltipText->TotalCount)
{
if (Context->GpuGraphState.TooltipIndex != getTooltipText->Index)
{
FLOAT gpuUsageValue;
gpuUsageValue = PhGetItemCircularBuffer_FLOAT(&GpuUtilizationHistory, getTooltipText->Index);
PhMoveReference(&Context->GpuGraphState.TooltipText, PhFormatString(
L"%.0f%%\n%s",
gpuUsageValue * 100,
((PPH_STRING)PhAutoDereferenceObject(PhGetStatisticsTimeString(NULL, getTooltipText->Index)))->Buffer
));
}
getTooltipText->Text = Context->GpuGraphState.TooltipText->sr;
}
}
break;
}
}
VOID NvGpuNotifyMemoryGraph(
_Inout_ PPH_NVGPU_SYSINFO_CONTEXT Context,
_In_ NMHDR *Header
)
{
switch (Header->code)
{
case GCN_GETDRAWINFO:
{
PPH_GRAPH_GETDRAWINFO getDrawInfo = (PPH_GRAPH_GETDRAWINFO)Header;
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y;
Context->Section->Parameters->ColorSetupFunction(drawInfo, PhGetIntegerSetting(L"ColorPhysical"), 0);
PhGraphStateGetDrawInfo(&Context->MemGraphState, getDrawInfo, GpuMemoryHistory.Count);
if (PhGetIntegerSetting(L"GraphShowText"))
{
HDC hdc = Graph_GetBufferedContext(Context->MemGraphHandle);
PhMoveReference(&Context->MemGraphState.Text, PhFormatString(
L"%s / %s (%.2f%%)",
PhaFormatSize(UInt32x32To64(GpuCurrentMemUsage, 1024), -1)->Buffer,
PhaFormatSize(UInt32x32To64(GpuMemoryLimit, 1024), -1)->Buffer,
(FLOAT)GpuCurrentMemUsage / GpuMemoryLimit * 100
));
SelectObject(hdc, PhApplicationFont);
PhSetGraphText(hdc, drawInfo, &Context->MemGraphState.Text->sr,
&NormalGraphTextMargin, &NormalGraphTextPadding, PH_ALIGN_TOP | PH_ALIGN_LEFT);
}
else
{
drawInfo->Text.Buffer = NULL;
}
if (!Context->MemGraphState.Valid)
{
for (ULONG i = 0; i < drawInfo->LineDataCount; i++)
{
Context->MemGraphState.Data1[i] = (FLOAT)PhGetItemCircularBuffer_ULONG(&GpuMemoryHistory, i);
}
if (GpuMemoryLimit != 0)
{
// Scale the data.
PhDivideSinglesBySingle(
Context->MemGraphState.Data1,
(FLOAT)GpuMemoryLimit,
drawInfo->LineDataCount
);
}
Context->MemGraphState.Valid = TRUE;
}
}
break;
case GCN_GETTOOLTIPTEXT:
{
PPH_GRAPH_GETTOOLTIPTEXT getTooltipText = (PPH_GRAPH_GETTOOLTIPTEXT)Header;
if (getTooltipText->Index < getTooltipText->TotalCount)
{
if (Context->MemGraphState.TooltipIndex != getTooltipText->Index)
{
ULONG usedPages;
usedPages = PhGetItemCircularBuffer_ULONG(&GpuMemoryHistory, getTooltipText->Index);
PhMoveReference(&Context->MemGraphState.TooltipText, PhFormatString(
L"%s / %s (%.2f%%)\n%s",
PhaFormatSize(UInt32x32To64(usedPages, 1024), -1)->Buffer,
PhaFormatSize(UInt32x32To64(GpuMemoryLimit, 1024), -1)->Buffer,
(FLOAT)usedPages / GpuMemoryLimit * 100,
((PPH_STRING)PhAutoDereferenceObject(PhGetStatisticsTimeString(NULL, getTooltipText->Index)))->Buffer
));
}
getTooltipText->Text = Context->MemGraphState.TooltipText->sr;
}
}
break;
}
}
VOID NvGpuNotifySharedGraph(
_Inout_ PPH_NVGPU_SYSINFO_CONTEXT Context,
_In_ NMHDR *Header
)
{
switch (Header->code)
{
case GCN_GETDRAWINFO:
{
PPH_GRAPH_GETDRAWINFO getDrawInfo = (PPH_GRAPH_GETDRAWINFO)Header;
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y;
Context->Section->Parameters->ColorSetupFunction(drawInfo, PhGetIntegerSetting(L"ColorCpuKernel"), 0);
PhGraphStateGetDrawInfo(&Context->SharedGraphState, getDrawInfo, GpuBoardHistory.Count);
if (PhGetIntegerSetting(L"GraphShowText"))
{
HDC hdc = Graph_GetBufferedContext(Context->SharedGraphHandle);
PhMoveReference(&Context->SharedGraphState.Text, PhFormatString(
L"%.0f%%",
(FLOAT)GpuCurrentCoreUsage * 100
));
SelectObject(hdc, PhApplicationFont);
PhSetGraphText(hdc, drawInfo, &Context->SharedGraphState.Text->sr,
&NormalGraphTextMargin, &NormalGraphTextPadding, PH_ALIGN_TOP | PH_ALIGN_LEFT);
}
else
{
drawInfo->Text.Buffer = NULL;
}
if (!Context->SharedGraphState.Valid)
{
PhCopyCircularBuffer_FLOAT(&GpuBoardHistory, Context->SharedGraphState.Data1, drawInfo->LineDataCount);
Context->SharedGraphState.Valid = TRUE;
}
}
break;
case GCN_GETTOOLTIPTEXT:
{
PPH_GRAPH_GETTOOLTIPTEXT getTooltipText = (PPH_GRAPH_GETTOOLTIPTEXT)Header;
if (getTooltipText->Index < getTooltipText->TotalCount)
{
if (Context->SharedGraphState.TooltipIndex != getTooltipText->Index)
{
FLOAT usedPages;
usedPages = PhGetItemCircularBuffer_FLOAT(&GpuBoardHistory, getTooltipText->Index);
PhMoveReference(&Context->SharedGraphState.TooltipText, PhFormatString(
L"%.0f%%\n%s",
usedPages * 100,
((PPH_STRING)PhAutoDereferenceObject(PhGetStatisticsTimeString(NULL, getTooltipText->Index)))->Buffer
));
}
getTooltipText->Text = Context->SharedGraphState.TooltipText->sr;
}
}
break;
}
}
VOID NvGpuNotifyBusGraph(
_Inout_ PPH_NVGPU_SYSINFO_CONTEXT Context,
_In_ NMHDR *Header
)
{
switch (Header->code)
{
case GCN_GETDRAWINFO:
{
PPH_GRAPH_GETDRAWINFO getDrawInfo = (PPH_GRAPH_GETDRAWINFO)Header;
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y;
Context->Section->Parameters->ColorSetupFunction(drawInfo, PhGetIntegerSetting(L"ColorCpuKernel"), 0);
PhGraphStateGetDrawInfo(&Context->BusGraphState, getDrawInfo, GpuBusHistory.Count);
if (PhGetIntegerSetting(L"GraphShowText"))
{
HDC hdc = Graph_GetBufferedContext(Context->BusGraphHandle);
PhMoveReference(&Context->BusGraphState.Text, PhFormatString(
L"%.0f%%",
(FLOAT)GpuCurrentBusUsage * 100
));
SelectObject(hdc, PhApplicationFont);
PhSetGraphText(hdc, drawInfo, &Context->BusGraphState.Text->sr,
&NormalGraphTextMargin, &NormalGraphTextPadding, PH_ALIGN_TOP | PH_ALIGN_LEFT);
}
else
{
drawInfo->Text.Buffer = NULL;
}
if (!Context->BusGraphState.Valid)
{
PhCopyCircularBuffer_FLOAT(&GpuBusHistory, Context->BusGraphState.Data1, drawInfo->LineDataCount);
Context->BusGraphState.Valid = TRUE;
}
}
break;
case GCN_GETTOOLTIPTEXT:
{
PPH_GRAPH_GETTOOLTIPTEXT getTooltipText = (PPH_GRAPH_GETTOOLTIPTEXT)Header;
if (getTooltipText->Index < getTooltipText->TotalCount)
{
if (Context->BusGraphState.TooltipIndex != getTooltipText->Index)
{
FLOAT busUsage;
busUsage = PhGetItemCircularBuffer_FLOAT(&GpuBusHistory, getTooltipText->Index);
PhMoveReference(&Context->BusGraphState.TooltipText, PhFormatString(
L"%.0f%%\n%s",
busUsage * 100,
((PPH_STRING)PhAutoDereferenceObject(PhGetStatisticsTimeString(NULL, getTooltipText->Index)))->Buffer
));
}
getTooltipText->Text = Context->BusGraphState.TooltipText->sr;
}
}
break;
}
}
VOID NvGpuUpdateGraphs(
_Inout_ PPH_NVGPU_SYSINFO_CONTEXT Context
)
{
Context->GpuGraphState.Valid = FALSE;
Context->GpuGraphState.TooltipIndex = -1;
Graph_MoveGrid(Context->GpuGraphHandle, 1);
Graph_Draw(Context->GpuGraphHandle);
Graph_UpdateTooltip(Context->GpuGraphHandle);
InvalidateRect(Context->GpuGraphHandle, NULL, FALSE);
Context->MemGraphState.Valid = FALSE;
Context->MemGraphState.TooltipIndex = -1;
Graph_MoveGrid(Context->MemGraphHandle, 1);
Graph_Draw(Context->MemGraphHandle);
Graph_UpdateTooltip(Context->MemGraphHandle);
InvalidateRect(Context->MemGraphHandle, NULL, FALSE);
Context->SharedGraphState.Valid = FALSE;
Context->SharedGraphState.TooltipIndex = -1;
Graph_MoveGrid(Context->SharedGraphHandle, 1);
Graph_Draw(Context->SharedGraphHandle);
Graph_UpdateTooltip(Context->SharedGraphHandle);
InvalidateRect(Context->SharedGraphHandle, NULL, FALSE);
Context->BusGraphState.Valid = FALSE;
Context->BusGraphState.TooltipIndex = -1;
Graph_MoveGrid(Context->BusGraphHandle, 1);
Graph_Draw(Context->BusGraphHandle);
Graph_UpdateTooltip(Context->BusGraphHandle);
InvalidateRect(Context->BusGraphHandle, NULL, FALSE);
}
VOID NvGpuUpdatePanel(
_Inout_ PPH_NVGPU_SYSINFO_CONTEXT Context
)
{
SetDlgItemText(Context->GpuPanel, IDC_CLOCK_CORE, PhaFormatString(L"%lu MHz", GpuCurrentCoreClock)->Buffer);
SetDlgItemText(Context->GpuPanel, IDC_CLOCK_MEMORY, PhaFormatString(L"%lu MHz", GpuCurrentMemoryClock)->Buffer);
SetDlgItemText(Context->GpuPanel, IDC_CLOCK_SHADER, PhaFormatString(L"%lu MHz", GpuCurrentShaderClock)->Buffer);
SetDlgItemText(Context->GpuPanel, IDC_FAN_PERCENT, ((PPH_STRING)PhAutoDereferenceObject(NvGpuQueryFanSpeed()))->Buffer);
if (PhGetIntegerSetting(SETTING_NAME_ENABLE_FAHRENHEIT))
{
FLOAT fahrenheit = (FLOAT)(GpuCurrentCoreTemp * 1.8 + 32);
SetDlgItemText(Context->GpuPanel, IDC_TEMP_VALUE, PhaFormatString(L"%.1f\u00b0F", fahrenheit)->Buffer);
}
else
{
SetDlgItemText(Context->GpuPanel, IDC_TEMP_VALUE, PhaFormatString(L"%lu\u00b0C", GpuCurrentCoreTemp)->Buffer);
}
//SetDlgItemText(Context->GpuPanel, IDC_TEMP_VALUE, PhaFormatString(L"%s\u00b0C", PhaFormatUInt64(GpuCurrentBoardTemp, TRUE)->Buffer)->Buffer);
SetDlgItemText(Context->GpuPanel, IDC_VOLTAGE, PhaFormatString(L"%lu mV", GpuCurrentVoltage)->Buffer);
}
INT_PTR CALLBACK NvGpuDialogProc(
_In_ HWND hwndDlg,
_In_ UINT uMsg,
_In_ WPARAM wParam,
_In_ LPARAM lParam
)
{
PPH_NVGPU_SYSINFO_CONTEXT context = NULL;
if (uMsg == WM_INITDIALOG)
{
context = (PPH_NVGPU_SYSINFO_CONTEXT)lParam;
SetProp(hwndDlg, L"Context", (HANDLE)context);
}
else
{
context = (PPH_NVGPU_SYSINFO_CONTEXT)GetProp(hwndDlg, L"Context");
if (uMsg == WM_NCDESTROY)
{
PhDeleteLayoutManager(&context->LayoutManager);
PhDeleteGraphState(&context->GpuGraphState);
PhDeleteGraphState(&context->MemGraphState);
PhDeleteGraphState(&context->SharedGraphState);
PhDeleteGraphState(&context->BusGraphState);
if (context->GpuGraphHandle)
DestroyWindow(context->GpuGraphHandle);
if (context->MemGraphHandle)
DestroyWindow(context->MemGraphHandle);
if (context->SharedGraphHandle)
DestroyWindow(context->SharedGraphHandle);
if (context->BusGraphHandle)
DestroyWindow(context->BusGraphHandle);
if (context->GpuPanel)
DestroyWindow(context->GpuPanel);
RemoveProp(hwndDlg, L"Context");
}
}
if (context == NULL)
return FALSE;
switch (uMsg)
{
case WM_INITDIALOG:
{
PPH_LAYOUT_ITEM graphItem;
PPH_LAYOUT_ITEM panelItem;
context->WindowHandle = hwndDlg;
context->GpuLabelHandle = GetDlgItem(hwndDlg, IDC_GPU_L);
context->MemLabelHandle = GetDlgItem(hwndDlg, IDC_MEMORY_L);
context->SharedLabelHandle = GetDlgItem(hwndDlg, IDC_SHARED_L);
context->BusLabelHandle = GetDlgItem(hwndDlg, IDC_BUS_L);
PhInitializeGraphState(&context->GpuGraphState);
PhInitializeGraphState(&context->MemGraphState);
PhInitializeGraphState(&context->SharedGraphState);
PhInitializeGraphState(&context->BusGraphState);
PhInitializeLayoutManager(&context->LayoutManager, hwndDlg);
PhAddLayoutItem(&context->LayoutManager, GetDlgItem(hwndDlg, IDC_GPUNAME), NULL, PH_ANCHOR_LEFT | PH_ANCHOR_TOP | PH_ANCHOR_RIGHT | PH_LAYOUT_FORCE_INVALIDATE);
graphItem = PhAddLayoutItem(&context->LayoutManager, GetDlgItem(hwndDlg, IDC_GRAPH_LAYOUT), NULL, PH_ANCHOR_ALL);
context->GpuGraphMargin = graphItem->Margin;
panelItem = PhAddLayoutItem(&context->LayoutManager, GetDlgItem(hwndDlg, IDC_PANEL_LAYOUT), NULL, PH_ANCHOR_LEFT | PH_ANCHOR_RIGHT | PH_ANCHOR_BOTTOM);
SendMessage(GetDlgItem(hwndDlg, IDC_TITLE), WM_SETFONT, (WPARAM)context->Section->Parameters->LargeFont, FALSE);
SendMessage(GetDlgItem(hwndDlg, IDC_GPUNAME), WM_SETFONT, (WPARAM)context->Section->Parameters->MediumFont, FALSE);
SetDlgItemText(hwndDlg, IDC_GPUNAME, context->GpuName->Buffer);
context->GpuPanel = CreateDialogParam(PluginInstance->DllBase, MAKEINTRESOURCE(IDD_GPU_PANEL), hwndDlg, NvGpuPanelDialogProc, (LPARAM)context);
ShowWindow(context->GpuPanel, SW_SHOW);
PhAddLayoutItemEx(&context->LayoutManager, context->GpuPanel, NULL, PH_ANCHOR_LEFT | PH_ANCHOR_RIGHT | PH_ANCHOR_BOTTOM, panelItem->Margin);
NvGpuCreateGraphs(context);
NvGpuUpdateValues();
NvGpuUpdateGraphs(context);
NvGpuUpdatePanel(context);
}
break;
case WM_SIZE:
NvGpuLayoutGraphs(context);
break;
case WM_NOTIFY:
{
NMHDR* header = (NMHDR*)lParam;
if (header->hwndFrom == context->GpuGraphHandle)
{
NvGpuNotifyUsageGraph(context, header);
}
else if (header->hwndFrom == context->MemGraphHandle)
{
NvGpuNotifyMemoryGraph(context, header);
}
else if (header->hwndFrom == context->SharedGraphHandle)
{
NvGpuNotifySharedGraph(context, header);
}
else if (header->hwndFrom == context->BusGraphHandle)
{
NvGpuNotifyBusGraph(context, header);
}
}
break;
case MSG_UPDATE:
{
NvGpuUpdateGraphs(context);
NvGpuUpdatePanel(context);
}
break;
}
return FALSE;
}
BOOLEAN NvGpuSectionCallback(
_In_ PPH_SYSINFO_SECTION Section,
_In_ PH_SYSINFO_SECTION_MESSAGE Message,
_In_opt_ PVOID Parameter1,
_In_opt_ PVOID Parameter2
)
{
PPH_NVGPU_SYSINFO_CONTEXT context = (PPH_NVGPU_SYSINFO_CONTEXT)Section->Context;
switch (Message)
{
case SysInfoCreate:
return TRUE;
case SysInfoDestroy:
{
if (context->GpuName)
PhDereferenceObject(context->GpuName);
PhFree(context);
}
return TRUE;
case SysInfoTick:
{
if (context->WindowHandle)
{
PostMessage(context->WindowHandle, MSG_UPDATE, 0, 0);
}
if (context->DetailsHandle)
{
PostMessage(context->DetailsHandle, MSG_UPDATE, 0, 0);
}
}
return TRUE;
case SysInfoCreateDialog:
{
PPH_SYSINFO_CREATE_DIALOG createDialog = (PPH_SYSINFO_CREATE_DIALOG)Parameter1;
createDialog->Instance = PluginInstance->DllBase;
createDialog->Template = MAKEINTRESOURCE(IDD_GPU_DIALOG);
createDialog->DialogProc = NvGpuDialogProc;
createDialog->Parameter = context;
}
return TRUE;
case SysInfoGraphGetDrawInfo:
{
PPH_GRAPH_DRAW_INFO drawInfo = (PPH_GRAPH_DRAW_INFO)Parameter1;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y;
Section->Parameters->ColorSetupFunction(drawInfo, PhGetIntegerSetting(L"ColorCpuKernel"), 0);
PhGetDrawInfoGraphBuffers(&Section->GraphState.Buffers, drawInfo, GpuUtilizationHistory.Count);
if (!Section->GraphState.Valid)
{
PhCopyCircularBuffer_FLOAT(&GpuUtilizationHistory, Section->GraphState.Data1, drawInfo->LineDataCount);
Section->GraphState.Valid = TRUE;
}
}
return TRUE;
case SysInfoGraphGetTooltipText:
{
FLOAT gpuUsageValue;
PPH_SYSINFO_GRAPH_GET_TOOLTIP_TEXT getTooltipText = (PPH_SYSINFO_GRAPH_GET_TOOLTIP_TEXT)Parameter1;
gpuUsageValue = PhGetItemCircularBuffer_FLOAT(&GpuUtilizationHistory, getTooltipText->Index);
PhMoveReference(&Section->GraphState.TooltipText, PhFormatString(
L"%.0f%%\n%s",
gpuUsageValue * 100,
((PPH_STRING)PhAutoDereferenceObject(PhGetStatisticsTimeString(NULL, getTooltipText->Index)))->Buffer
));
getTooltipText->Text = Section->GraphState.TooltipText->sr;
}
return TRUE;
case SysInfoGraphDrawPanel:
{
PPH_SYSINFO_DRAW_PANEL drawPanel = (PPH_SYSINFO_DRAW_PANEL)Parameter1;
drawPanel->Title = PhCreateString(Section->Name.Buffer);
drawPanel->SubTitle = PhFormatString(
L"%.0f%%",
GpuCurrentGpuUsage * 100
);
}
return TRUE;
}
return FALSE;
}
VOID NvGpuSysInfoInitializing(
_In_ PPH_PLUGIN_SYSINFO_POINTERS Pointers
)
{
PH_SYSINFO_SECTION section;
PPH_NVGPU_SYSINFO_CONTEXT context;
context = (PPH_NVGPU_SYSINFO_CONTEXT)PhAllocate(sizeof(PH_NVGPU_SYSINFO_CONTEXT));
memset(context, 0, sizeof(PH_NVGPU_SYSINFO_CONTEXT));
memset(&section, 0, sizeof(PH_SYSINFO_SECTION));
section.Context = context;
section.Callback = NvGpuSectionCallback;
context->GpuName = NvGpuQueryName();
PhInitializeStringRef(&section.Name, context->GpuName->Buffer);
context->Section = Pointers->CreateSection(&section);
}

View File

@@ -0,0 +1,155 @@
/*
* Process Hacker Extra Plugins -
* Nvidia GPU Plugin
*
* Copyright (C) 2015 dmex
*
* This file is part of Process Hacker.
*
* Process Hacker is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Process Hacker is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Process Hacker. If not, see <http://www.gnu.org/licenses/>.
*/
#include "main.h"
BOOLEAN NvApiInitialized = FALSE;
PPH_PLUGIN PluginInstance = NULL;
PH_CALLBACK_REGISTRATION PluginLoadCallbackRegistration;
PH_CALLBACK_REGISTRATION PluginUnloadCallbackRegistration;
PH_CALLBACK_REGISTRATION PluginShowOptionsCallbackRegistration;
PH_CALLBACK_REGISTRATION ProcessesUpdatedCallbackRegistration;
PH_CALLBACK_REGISTRATION SystemInformationInitializingCallbackRegistration;
VOID NTAPI LoadCallback(
_In_opt_ PVOID Parameter,
_In_opt_ PVOID Context
)
{
if (PhGetIntegerSetting(SETTING_NAME_ENABLE_MONITORING))
{
NvApiInitialized = InitializeNvApi();
}
if (NvApiInitialized)
{
NvGpuInitialize();
}
}
VOID NTAPI UnloadCallback(
_In_opt_ PVOID Parameter,
_In_opt_ PVOID Context
)
{
NOTHING;
}
VOID NTAPI ShowOptionsCallback(
_In_opt_ PVOID Parameter,
_In_opt_ PVOID Context
)
{
ShowOptionsDialog((HWND)Parameter);
}
VOID NTAPI ProcessesUpdatedCallback(
_In_opt_ PVOID Parameter,
_In_opt_ PVOID Context
)
{
if (NvApiInitialized)
{
NvGpuUpdate();
}
}
VOID NTAPI SystemInformationInitializingCallback(
_In_opt_ PVOID Parameter,
_In_opt_ PVOID Context
)
{
PPH_PLUGIN_SYSINFO_POINTERS pluginEntry = (PPH_PLUGIN_SYSINFO_POINTERS)Parameter;
if (NvApiInitialized)
{
NvGpuSysInfoInitializing(pluginEntry);
}
}
LOGICAL DllMain(
_In_ HINSTANCE Instance,
_In_ ULONG Reason,
_Reserved_ PVOID Reserved
)
{
switch (Reason)
{
case DLL_PROCESS_ATTACH:
{
PPH_PLUGIN_INFORMATION info;
PH_SETTING_CREATE settings[] =
{
{ IntegerSettingType, SETTING_NAME_ENABLE_MONITORING, L"1" },
{ IntegerSettingType, SETTING_NAME_ENABLE_FAHRENHEIT, L"0" }
};
PluginInstance = PhRegisterPlugin(PLUGIN_NAME, Instance, &info);
if (!PluginInstance)
return FALSE;
info->DisplayName = L"Nvidia GPU";
info->Author = L"dmex";
info->Description = L"Plugin for extended Nvidia GPU monitoring via the System Information window.";
info->HasOptions = TRUE;
PhRegisterCallback(
PhGetPluginCallback(PluginInstance, PluginCallbackLoad),
LoadCallback,
NULL,
&PluginLoadCallbackRegistration
);
PhRegisterCallback(
PhGetPluginCallback(PluginInstance, PluginCallbackUnload),
UnloadCallback,
NULL,
&PluginUnloadCallbackRegistration
);
PhRegisterCallback(
PhGetPluginCallback(PluginInstance, PluginCallbackShowOptions),
ShowOptionsCallback,
NULL,
&PluginShowOptionsCallbackRegistration
);
PhRegisterCallback(
&PhProcessesUpdatedEvent,
ProcessesUpdatedCallback,
NULL,
&ProcessesUpdatedCallbackRegistration
);
PhRegisterCallback(
PhGetGeneralCallback(GeneralCallbackSystemInformationInitializing),
SystemInformationInitializingCallback,
NULL,
&SystemInformationInitializingCallbackRegistration
);
PhAddSettings(settings, ARRAYSIZE(settings));
}
break;
}
return TRUE;
}

View File

@@ -0,0 +1,142 @@
/*
* Process Hacker Extra Plugins -
* Nvidia GPU Plugin
*
* Copyright (C) 2015 dmex
*
* This file is part of Process Hacker.
*
* Process Hacker is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Process Hacker is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Process Hacker. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _NVGPU_H_
#define _NVGPU_H_
#define PLUGIN_NAME L"dmex.NvGpuPlugin"
#define SETTING_NAME_ENABLE_MONITORING (PLUGIN_NAME L".Enabled")
#define SETTING_NAME_ENABLE_FAHRENHEIT (PLUGIN_NAME L".EnableFahrenheit")
#define CINTERFACE
#define COBJMACROS
#include <phdk.h>
#include <phappresource.h>
#include <verify.h>
#include <windowsx.h>
#include "resource.h"
#define MSG_UPDATE (WM_APP + 1)
extern BOOLEAN NvApiInitialized;
extern PPH_PLUGIN PluginInstance;
extern ULONG GpuMemoryLimit;
extern FLOAT GpuCurrentGpuUsage;
extern FLOAT GpuCurrentCoreUsage;
extern FLOAT GpuCurrentBusUsage;
extern ULONG GpuCurrentMemUsage;
extern ULONG GpuCurrentMemSharedUsage;
extern ULONG GpuCurrentCoreTemp;
extern ULONG GpuCurrentBoardTemp;
extern ULONG GpuCurrentCoreClock;
extern ULONG GpuCurrentMemoryClock;
extern ULONG GpuCurrentShaderClock;
extern ULONG GpuCurrentVoltage;
BOOLEAN InitializeNvApi(VOID);
BOOLEAN DestroyNvApi(VOID);
PPH_STRING NvGpuQueryDriverVersion(VOID);
PPH_STRING NvGpuQueryVbiosVersionString(VOID);
PPH_STRING NvGpuQueryName(VOID);
PPH_STRING NvGpuQueryShortName(VOID);
PPH_STRING NvGpuQueryRevision(VOID);
PPH_STRING NvGpuQueryRamType(VOID);
PPH_STRING NvGpuQueryFoundry(VOID);
PPH_STRING NvGpuQueryDeviceId(VOID);
PPH_STRING NvGpuQueryRopsCount(VOID);
PPH_STRING NvGpuQueryShaderCount(VOID);
PPH_STRING NvGpuQueryPciInfo(VOID);
PPH_STRING NvGpuQueryBusWidth(VOID);
PPH_STRING NvGpuQueryPcbValue(VOID);
PPH_STRING NvGpuQueryDriverSettings(VOID);
PPH_STRING NvGpuQueryFanSpeed(VOID);
BOOLEAN NvGpuDriverIsWHQL(VOID);
VOID NvGpuUpdateValues(VOID);
typedef struct _PH_NVGPU_SYSINFO_CONTEXT
{
PPH_STRING GpuName;
HWND WindowHandle;
HWND DetailsHandle;
PPH_SYSINFO_SECTION Section;
PH_LAYOUT_MANAGER LayoutManager;
RECT GpuGraphMargin;
HWND GpuPanel;
HWND GpuLabelHandle;
HWND MemLabelHandle;
HWND SharedLabelHandle;
HWND BusLabelHandle;
HWND GpuGraphHandle;
HWND MemGraphHandle;
HWND SharedGraphHandle;
HWND BusGraphHandle;
PH_GRAPH_STATE GpuGraphState;
PH_GRAPH_STATE MemGraphState;
PH_GRAPH_STATE SharedGraphState;
PH_GRAPH_STATE BusGraphState;
} PH_NVGPU_SYSINFO_CONTEXT, *PPH_NVGPU_SYSINFO_CONTEXT;
extern PH_CIRCULAR_BUFFER_FLOAT GpuUtilizationHistory;
extern PH_CIRCULAR_BUFFER_ULONG GpuMemoryHistory;
extern PH_CIRCULAR_BUFFER_FLOAT GpuBoardHistory;
extern PH_CIRCULAR_BUFFER_FLOAT GpuBusHistory;
VOID NvGpuInitialize(
VOID
);
VOID NvGpuUpdate(
VOID
);
VOID NvGpuSysInfoInitializing(
_In_ PPH_PLUGIN_SYSINFO_POINTERS Pointers
);
HBITMAP LoadImageFromResources(
_In_ UINT Width,
_In_ UINT Height,
_In_ PCWSTR Name
);
VOID ShowOptionsDialog(
_In_ HWND ParentHandle
);
VOID ShowDetailsDialog(
_In_ HWND ParentHandle,
_In_ PVOID Context
);
#endif _NVGPU_H_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,429 @@
#pragma once
#include <pshpack8.h>
#ifdef __cplusplus
extern "C" {
#endif
#if (defined(WIN32) || defined(_WIN32)) && defined(_MSC_VER) && (_MSC_VER > 1399) && !defined(NVAPI_INTERNAL) && !defined(NVAPI_DEPRECATED_OLD)
#ifndef __nvapi_deprecated_function
#define __nvapi_deprecated_function(message) __declspec(deprecated(message))
#endif
#ifndef __nvapi_deprecated_datatype
#define __nvapi_deprecated_datatype(FirstRelease) __declspec(deprecated("Do not use this data type - it is deprecated in release " #FirstRelease "."))
#endif
#else
#ifndef __nvapi_deprecated_function
#define __nvapi_deprecated_function(message)
#endif
#ifndef __nvapi_deprecated_datatype
#define __nvapi_deprecated_datatype(FirstRelease)
#endif
#endif
/* 64-bit types for compilers that support them, plus some obsolete variants */
#if defined(__GNUC__) || defined(__arm) || defined(__IAR_SYSTEMS_ICC__) || defined(__ghs__) || defined(_WIN64)
typedef unsigned long long NvU64; /* 0 to 18446744073709551615 */
typedef long long NvS64; /* -9223372036854775808 to 9223372036854775807 */
#else
typedef unsigned __int64 NvU64; /* 0 to 18446744073709551615 */
typedef __int64 NvS64; /* -9223372036854775808 to 9223372036854775807 */
#endif
// mac os 32-bit still needs this
#if (defined(macintosh) || defined(__APPLE__)) && !defined(__LP64__)
typedef signed long NvS32; /* -2147483648 to 2147483647 */
#else
typedef signed int NvS32; /* -2147483648 to 2147483647 */
#endif
// mac os 32-bit still needs this
#if ( (defined(macintosh) && defined(__LP64__) && (__NVAPI_RESERVED0__)) || (!defined(macintosh) && defined(__NVAPI_RESERVED0__)) )
typedef unsigned int NvU32; /* 0 to 4294967295 */
#else
typedef unsigned long NvU32; /* 0 to 4294967295 */
#endif
typedef signed short NvS16;
typedef unsigned short NvU16;
typedef unsigned char NvU8;
typedef signed char NvS8;
typedef struct _NV_RECT
{
NvU32 left;
NvU32 top;
NvU32 right;
NvU32 bottom;
} NV_RECT;
#define NVAPI_INTERFACE extern __success(return == NVAPI_OK) NvAPI_Status __cdecl
#define NV_DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
//! \addtogroup nvapihandles
//! NVAPI Handles - These handles are retrieved from various calls and passed in to others in NvAPI
//! These are meant to be opaque types. Do not assume they correspond to indices, HDCs,
//! display indexes or anything else.
//!
//! Most handles remain valid until a display re-configuration (display mode set) or GPU
//! reconfiguration (going into or out of SLI modes) occurs. If NVAPI_HANDLE_INVALIDATED
//! is received by an app, it should discard all handles, and re-enumerate them.
//! @{
NV_DECLARE_HANDLE(NvDisplayHandle); //!< Display Device driven by NVIDIA GPU(s) (an attached display)
NV_DECLARE_HANDLE(NvMonitorHandle); //!< Monitor handle
NV_DECLARE_HANDLE(NvUnAttachedDisplayHandle); //!< Unattached Display Device driven by NVIDIA GPU(s)
NV_DECLARE_HANDLE(NvLogicalGpuHandle); //!< One or more physical GPUs acting in concert (SLI)
NV_DECLARE_HANDLE(NvPhysicalGpuHandle); //!< A single physical GPU
NV_DECLARE_HANDLE(NvEventHandle); //!< A handle to an event registration instance
NV_DECLARE_HANDLE(NvVisualComputingDeviceHandle); //!< A handle to a Visual Computing Device
NV_DECLARE_HANDLE(NvHICHandle); //!< A handle to a Host Interface Card
NV_DECLARE_HANDLE(NvGSyncDeviceHandle); //!< A handle to a Sync device
NV_DECLARE_HANDLE(NvVioHandle); //!< A handle to an SDI device
NV_DECLARE_HANDLE(NvTransitionHandle); //!< A handle to address a single transition request
NV_DECLARE_HANDLE(NvAudioHandle); //!< NVIDIA HD Audio Device
NV_DECLARE_HANDLE(Nv3DVPContextHandle); //!< A handle for a 3D Vision Pro (3DVP) context
NV_DECLARE_HANDLE(Nv3DVPTransceiverHandle); //!< A handle for a 3DVP RF transceiver
NV_DECLARE_HANDLE(Nv3DVPGlassesHandle); //!< A handle for a pair of 3DVP RF shutter glasses
NV_DECLARE_HANDLE(NvSourceHandle); //!< Unique source handle on the system
NV_DECLARE_HANDLE(NvTargetHandle); //!< Unique target handle on the system
//! @}
//! \ingroup nvapihandles
//! @{
#define NVAPI_DEFAULT_HANDLE 0
#define NV_BIT(x) (1 << (x))
//! @}
//! \addtogroup nvapitypes
//! @{
#define NVAPI_GENERIC_STRING_MAX 4096
#define NVAPI_LONG_STRING_MAX 256
#define NVAPI_SHORT_STRING_MAX 64
typedef struct _NvSBox
{
NvS32 sX;
NvS32 sY;
NvS32 sWidth;
NvS32 sHeight;
} NvSBox;
#ifndef NvGUID_Defined
#define NvGUID_Defined
typedef struct _NvGUID
{
NvU32 data1;
NvU16 data2;
NvU16 data3;
NvU8 data4[8];
} NvGUID, NvLUID;
#endif //#ifndef NvGUID_Defined
#define NVAPI_MAX_PHYSICAL_GPUS 64
#define NVAPI_MAX_PHYSICAL_BRIDGES 100
#define NVAPI_PHYSICAL_GPUS 32
#define NVAPI_MAX_LOGICAL_GPUS 64
#define NVAPI_MAX_AVAILABLE_GPU_TOPOLOGIES 256
#define NVAPI_MAX_AVAILABLE_SLI_GROUPS 256
#define NVAPI_MAX_GPU_TOPOLOGIES NVAPI_MAX_PHYSICAL_GPUS
#define NVAPI_MAX_GPU_PER_TOPOLOGY 8
#define NVAPI_MAX_DISPLAY_HEADS 2
#define NVAPI_ADVANCED_DISPLAY_HEADS 4
#define NVAPI_MAX_DISPLAYS NVAPI_PHYSICAL_GPUS * NVAPI_ADVANCED_DISPLAY_HEADS
#define NVAPI_MAX_ACPI_IDS 16
#define NVAPI_MAX_VIEW_MODES 8
#define NV_MAX_HEADS 4 //!< Maximum heads, each with NVAPI_DESKTOP_RES resolution
#define NVAPI_MAX_HEADS_PER_GPU 32
#define NV_MAX_HEADS 4 //!< Maximum number of heads, each with #NVAPI_DESKTOP_RES resolution
#define NV_MAX_VID_STREAMS 4 //!< Maximum number of input video streams, each with a #NVAPI_VIDEO_SRC_INFO
#define NV_MAX_VID_PROFILES 4 //!< Maximum number of output video profiles supported
#define NVAPI_SYSTEM_MAX_DISPLAYS NVAPI_MAX_PHYSICAL_GPUS * NV_MAX_HEADS
#define NVAPI_SYSTEM_MAX_HWBCS 128
#define NVAPI_SYSTEM_HWBC_INVALID_ID 0xffffffff
#define NVAPI_MAX_AUDIO_DEVICES 16
typedef char NvAPI_String[NVAPI_GENERIC_STRING_MAX];
typedef char NvAPI_LongString[NVAPI_LONG_STRING_MAX];
typedef char NvAPI_ShortString[NVAPI_SHORT_STRING_MAX];
//! @}
// =========================================================================================
//! NvAPI Version Definition \n
//! Maintain per structure specific version define using the MAKE_NVAPI_VERSION macro. \n
//! Usage: #define NV_GENLOCK_STATUS_VER MAKE_NVAPI_VERSION(NV_GENLOCK_STATUS, 1)
//! \ingroup nvapitypes
// =========================================================================================
#define MAKE_NVAPI_VERSION(typeName,ver) (NvU32)(sizeof(typeName) | ((ver) << 16))
//! \ingroup nvapitypes
#define GET_NVAPI_VERSION(ver) (NvU32)((ver)>>16)
//! \ingroup nvapitypes
#define GET_NVAPI_SIZE(ver) (NvU32)((ver) & 0xffff)
// ====================================================
//! NvAPI Status Values
//! All NvAPI functions return one of these codes.
//! \ingroup nvapistatus
// ====================================================
typedef enum _NvAPI_Status
{
NVAPI_OK = 0, //!< Success. Request is completed.
NVAPI_ERROR = -1, //!< Generic error
NVAPI_LIBRARY_NOT_FOUND = -2, //!< NVAPI support library cannot be loaded.
NVAPI_NO_IMPLEMENTATION = -3, //!< not implemented in current driver installation
NVAPI_API_NOT_INITIALIZED = -4, //!< NvAPI_Initialize has not been called (successfully)
NVAPI_INVALID_ARGUMENT = -5, //!< The argument/parameter value is not valid or NULL.
NVAPI_NVIDIA_DEVICE_NOT_FOUND = -6, //!< No NVIDIA display driver, or NVIDIA GPU driving a display, was found.
NVAPI_END_ENUMERATION = -7, //!< No more items to enumerate
NVAPI_INVALID_HANDLE = -8, //!< Invalid handle
NVAPI_INCOMPATIBLE_STRUCT_VERSION = -9, //!< An argument's structure version is not supported
NVAPI_HANDLE_INVALIDATED = -10, //!< The handle is no longer valid (likely due to GPU or display re-configuration)
NVAPI_OPENGL_CONTEXT_NOT_CURRENT = -11, //!< No NVIDIA OpenGL context is current (but needs to be)
NVAPI_INVALID_POINTER = -14, //!< An invalid pointer, usually NULL, was passed as a parameter
NVAPI_NO_GL_EXPERT = -12, //!< OpenGL Expert is not supported by the current drivers
NVAPI_INSTRUMENTATION_DISABLED = -13, //!< OpenGL Expert is supported, but driver instrumentation is currently disabled
NVAPI_NO_GL_NSIGHT = -15, //!< OpenGL does not support Nsight
NVAPI_EXPECTED_LOGICAL_GPU_HANDLE = -100, //!< Expected a logical GPU handle for one or more parameters
NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE = -101, //!< Expected a physical GPU handle for one or more parameters
NVAPI_EXPECTED_DISPLAY_HANDLE = -102, //!< Expected an NV display handle for one or more parameters
NVAPI_INVALID_COMBINATION = -103, //!< The combination of parameters is not valid.
NVAPI_NOT_SUPPORTED = -104, //!< Requested feature is not supported in the selected GPU
NVAPI_PORTID_NOT_FOUND = -105, //!< No port ID was found for the I2C transaction
NVAPI_EXPECTED_UNATTACHED_DISPLAY_HANDLE = -106, //!< Expected an unattached display handle as one of the input parameters.
NVAPI_INVALID_PERF_LEVEL = -107, //!< Invalid perf level
NVAPI_DEVICE_BUSY = -108, //!< Device is busy; request not fulfilled
NVAPI_NV_PERSIST_FILE_NOT_FOUND = -109, //!< NV persist file is not found
NVAPI_PERSIST_DATA_NOT_FOUND = -110, //!< NV persist data is not found
NVAPI_EXPECTED_TV_DISPLAY = -111, //!< Expected a TV output display
NVAPI_EXPECTED_TV_DISPLAY_ON_DCONNECTOR = -112, //!< Expected a TV output on the D Connector - HDTV_EIAJ4120.
NVAPI_NO_ACTIVE_SLI_TOPOLOGY = -113, //!< SLI is not active on this device.
NVAPI_SLI_RENDERING_MODE_NOTALLOWED = -114, //!< Setup of SLI rendering mode is not possible right now.
NVAPI_EXPECTED_DIGITAL_FLAT_PANEL = -115, //!< Expected a digital flat panel.
NVAPI_ARGUMENT_EXCEED_MAX_SIZE = -116, //!< Argument exceeds the expected size.
NVAPI_DEVICE_SWITCHING_NOT_ALLOWED = -117, //!< Inhibit is ON due to one of the flags in NV_GPU_DISPLAY_CHANGE_INHIBIT or SLI active.
NVAPI_TESTING_CLOCKS_NOT_SUPPORTED = -118, //!< Testing of clocks is not supported.
NVAPI_UNKNOWN_UNDERSCAN_CONFIG = -119, //!< The specified underscan config is from an unknown source (e.g. INF)
NVAPI_TIMEOUT_RECONFIGURING_GPU_TOPO = -120, //!< Timeout while reconfiguring GPUs
NVAPI_DATA_NOT_FOUND = -121, //!< Requested data was not found
NVAPI_EXPECTED_ANALOG_DISPLAY = -122, //!< Expected an analog display
NVAPI_NO_VIDLINK = -123, //!< No SLI video bridge is present
NVAPI_REQUIRES_REBOOT = -124, //!< NVAPI requires a reboot for the settings to take effect
NVAPI_INVALID_HYBRID_MODE = -125, //!< The function is not supported with the current Hybrid mode.
NVAPI_MIXED_TARGET_TYPES = -126, //!< The target types are not all the same
NVAPI_SYSWOW64_NOT_SUPPORTED = -127, //!< The function is not supported from 32-bit on a 64-bit system.
NVAPI_IMPLICIT_SET_GPU_TOPOLOGY_CHANGE_NOT_ALLOWED = -128, //!< There is no implicit GPU topology active. Use NVAPI_SetHybridMode to change topology.
NVAPI_REQUEST_USER_TO_CLOSE_NON_MIGRATABLE_APPS = -129, //!< Prompt the user to close all non-migratable applications.
NVAPI_OUT_OF_MEMORY = -130, //!< Could not allocate sufficient memory to complete the call.
NVAPI_WAS_STILL_DRAWING = -131, //!< The previous operation that is transferring information to or from this surface is incomplete.
NVAPI_FILE_NOT_FOUND = -132, //!< The file was not found.
NVAPI_TOO_MANY_UNIQUE_STATE_OBJECTS = -133, //!< There are too many unique instances of a particular type of state object.
NVAPI_INVALID_CALL = -134, //!< The method call is invalid. For example, a method's parameter may not be a valid pointer.
NVAPI_D3D10_1_LIBRARY_NOT_FOUND = -135, //!< d3d10_1.dll cannot be loaded.
NVAPI_FUNCTION_NOT_FOUND = -136, //!< Couldn't find the function in the loaded DLL.
NVAPI_INVALID_USER_PRIVILEGE = -137, //!< Current User is not Admin.
NVAPI_EXPECTED_NON_PRIMARY_DISPLAY_HANDLE = -138, //!< The handle corresponds to GDIPrimary.
NVAPI_EXPECTED_COMPUTE_GPU_HANDLE = -139, //!< Setting Physx GPU requires that the GPU is compute-capable.
NVAPI_STEREO_NOT_INITIALIZED = -140, //!< The Stereo part of NVAPI failed to initialize completely. Check if the stereo driver is installed.
NVAPI_STEREO_REGISTRY_ACCESS_FAILED = -141, //!< Access to stereo-related registry keys or values has failed.
NVAPI_STEREO_REGISTRY_PROFILE_TYPE_NOT_SUPPORTED = -142, //!< The given registry profile type is not supported.
NVAPI_STEREO_REGISTRY_VALUE_NOT_SUPPORTED = -143, //!< The given registry value is not supported.
NVAPI_STEREO_NOT_ENABLED = -144, //!< Stereo is not enabled and the function needed it to execute completely.
NVAPI_STEREO_NOT_TURNED_ON = -145, //!< Stereo is not turned on and the function needed it to execute completely.
NVAPI_STEREO_INVALID_DEVICE_INTERFACE = -146, //!< Invalid device interface.
NVAPI_STEREO_PARAMETER_OUT_OF_RANGE = -147, //!< Separation percentage or JPEG image capture quality is out of [0-100] range.
NVAPI_STEREO_FRUSTUM_ADJUST_MODE_NOT_SUPPORTED = -148, //!< The given frustum adjust mode is not supported.
NVAPI_TOPO_NOT_POSSIBLE = -149, //!< The mosaic topology is not possible given the current state of the hardware.
NVAPI_MODE_CHANGE_FAILED = -150, //!< An attempt to do a display resolution mode change has failed.
NVAPI_D3D11_LIBRARY_NOT_FOUND = -151, //!< d3d11.dll/d3d11_beta.dll cannot be loaded.
NVAPI_INVALID_ADDRESS = -152, //!< Address is outside of valid range.
NVAPI_STRING_TOO_SMALL = -153, //!< The pre-allocated string is too small to hold the result.
NVAPI_MATCHING_DEVICE_NOT_FOUND = -154, //!< The input does not match any of the available devices.
NVAPI_DRIVER_RUNNING = -155, //!< Driver is running.
NVAPI_DRIVER_NOTRUNNING = -156, //!< Driver is not running.
NVAPI_ERROR_DRIVER_RELOAD_REQUIRED = -157, //!< A driver reload is required to apply these settings.
NVAPI_SET_NOT_ALLOWED = -158, //!< Intended setting is not allowed.
NVAPI_ADVANCED_DISPLAY_TOPOLOGY_REQUIRED = -159, //!< Information can't be returned due to "advanced display topology".
NVAPI_SETTING_NOT_FOUND = -160, //!< Setting is not found.
NVAPI_SETTING_SIZE_TOO_LARGE = -161, //!< Setting size is too large.
NVAPI_TOO_MANY_SETTINGS_IN_PROFILE = -162, //!< There are too many settings for a profile.
NVAPI_PROFILE_NOT_FOUND = -163, //!< Profile is not found.
NVAPI_PROFILE_NAME_IN_USE = -164, //!< Profile name is duplicated.
NVAPI_PROFILE_NAME_EMPTY = -165, //!< Profile name is empty.
NVAPI_EXECUTABLE_NOT_FOUND = -166, //!< Application not found in the Profile.
NVAPI_EXECUTABLE_ALREADY_IN_USE = -167, //!< Application already exists in the other profile.
NVAPI_DATATYPE_MISMATCH = -168, //!< Data Type mismatch
NVAPI_PROFILE_REMOVED = -169, //!< The profile passed as parameter has been removed and is no longer valid.
NVAPI_UNREGISTERED_RESOURCE = -170, //!< An unregistered resource was passed as a parameter.
NVAPI_ID_OUT_OF_RANGE = -171, //!< The DisplayId corresponds to a display which is not within the normal outputId range.
NVAPI_DISPLAYCONFIG_VALIDATION_FAILED = -172, //!< Display topology is not valid so the driver cannot do a mode set on this configuration.
NVAPI_DPMST_CHANGED = -173, //!< Display Port Multi-Stream topology has been changed.
NVAPI_INSUFFICIENT_BUFFER = -174, //!< Input buffer is insufficient to hold the contents.
NVAPI_ACCESS_DENIED = -175, //!< No access to the caller.
NVAPI_MOSAIC_NOT_ACTIVE = -176, //!< The requested action cannot be performed without Mosaic being enabled.
NVAPI_SHARE_RESOURCE_RELOCATED = -177, //!< The surface is relocated away from video memory.
NVAPI_REQUEST_USER_TO_DISABLE_DWM = -178, //!< The user should disable DWM before calling NvAPI.
NVAPI_D3D_DEVICE_LOST = -179, //!< D3D device status is D3DERR_DEVICELOST or D3DERR_DEVICENOTRESET - the user has to reset the device.
NVAPI_INVALID_CONFIGURATION = -180, //!< The requested action cannot be performed in the current state.
NVAPI_STEREO_HANDSHAKE_NOT_DONE = -181, //!< Call failed as stereo handshake not completed.
NVAPI_EXECUTABLE_PATH_IS_AMBIGUOUS = -182, //!< The path provided was too short to determine the correct NVDRS_APPLICATION
NVAPI_DEFAULT_STEREO_PROFILE_IS_NOT_DEFINED = -183, //!< Default stereo profile is not currently defined
NVAPI_DEFAULT_STEREO_PROFILE_DOES_NOT_EXIST = -184, //!< Default stereo profile does not exist
NVAPI_CLUSTER_ALREADY_EXISTS = -185, //!< A cluster is already defined with the given configuration.
NVAPI_DPMST_DISPLAY_ID_EXPECTED = -186, //!< The input display id is not that of a multi stream enabled connector or a display device in a multi stream topology
NVAPI_INVALID_DISPLAY_ID = -187, //!< The input display id is not valid or the monitor associated to it does not support the current operation
NVAPI_STREAM_IS_OUT_OF_SYNC = -188, //!< While playing secure audio stream, stream goes out of sync
NVAPI_INCOMPATIBLE_AUDIO_DRIVER = -189, //!< Older audio driver version than required
NVAPI_VALUE_ALREADY_SET = -190, //!< Value already set, setting again not allowed.
NVAPI_TIMEOUT = -191, //!< Requested operation timed out
NVAPI_GPU_WORKSTATION_FEATURE_INCOMPLETE = -192, //!< The requested workstation feature set has incomplete driver internal allocation resources
NVAPI_STEREO_INIT_ACTIVATION_NOT_DONE = -193, //!< Call failed because InitActivation was not called.
NVAPI_SYNC_NOT_ACTIVE = -194, //!< The requested action cannot be performed without Sync being enabled.
NVAPI_SYNC_MASTER_NOT_FOUND = -195, //!< The requested action cannot be performed without Sync Master being enabled.
NVAPI_INVALID_SYNC_TOPOLOGY = -196, //!< Invalid displays passed in the NV_GSYNC_DISPLAY pointer.
NVAPI_ECID_SIGN_ALGO_UNSUPPORTED = -197, //!< The specified signing algorithm is not supported. Either an incorrect value was entered or the current installed driver/hardware does not support the input value.
NVAPI_ECID_KEY_VERIFICATION_FAILED = -198, //!< The encrypted public key verification has failed.
} NvAPI_Status;
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_SYS_GetDriverAndBranchVersion
//
//! DESCRIPTION: This API returns display driver version and driver-branch string.
//!
//! SUPPORTED OS: Windows XP and higher
//!
//!
//! \param [out] pDriverVersion Contains the driver version after successful return.
//! \param [out] szBuildBranchString Contains the driver-branch string after successful return.
//!
//! \retval ::NVAPI_INVALID_ARGUMENT: either pDriverVersion is NULL or enum index too big
//! \retval ::NVAPI_OK - completed request
//! \retval ::NVAPI_API_NOT_INTIALIZED - NVAPI not initialized
//! \retval ::NVAPI_ERROR - miscellaneous error occurred
//!
//! \ingroup driverapi
///////////////////////////////////////////////////////////////////////////////
typedef NvAPI_Status (__cdecl *_NvAPI_SYS_GetDriverAndBranchVersion)(_Out_ NvU32* pDriverVersion, _Out_ NvAPI_ShortString szBuildBranchString);
_NvAPI_SYS_GetDriverAndBranchVersion NvAPI_SYS_GetDriverAndBranchVersion;
//! \ingroup driverapi
//! Used in NvAPI_GPU_GetMemoryInfo().
typedef struct _NV_DISPLAY_DRIVER_MEMORY_INFO_V1
{
NvU32 version; //!< Version info
NvU32 dedicatedVideoMemory; //!< Size(in kb) of the physical framebuffer.
NvU32 availableDedicatedVideoMemory; //!< Size(in kb) of the available physical framebuffer for allocating video memory surfaces.
NvU32 systemVideoMemory; //!< Size(in kb) of system memory the driver allocates at load time.
NvU32 sharedSystemMemory; //!< Size(in kb) of shared system memory that driver is allowed to commit for surfaces across all allocations.
} NV_DISPLAY_DRIVER_MEMORY_INFO_V1;
//! \ingroup driverapi
//! Used in NvAPI_GPU_GetMemoryInfo().
typedef struct _NV_DISPLAY_DRIVER_MEMORY_INFO_V2
{
NvU32 version; //!< Version info
NvU32 dedicatedVideoMemory; //!< Size(in kb) of the physical framebuffer.
NvU32 availableDedicatedVideoMemory; //!< Size(in kb) of the available physical framebuffer for allocating video memory surfaces.
NvU32 systemVideoMemory; //!< Size(in kb) of system memory the driver allocates at load time.
NvU32 sharedSystemMemory; //!< Size(in kb) of shared system memory that driver is allowed to commit for surfaces across all allocations.
NvU32 curAvailableDedicatedVideoMemory; //!< Size(in kb) of the current available physical framebuffer for allocating video memory surfaces.
} NV_DISPLAY_DRIVER_MEMORY_INFO_V2;
//! \ingroup driverapi
typedef NV_DISPLAY_DRIVER_MEMORY_INFO_V2 NV_DISPLAY_DRIVER_MEMORY_INFO;
//! \ingroup driverapi
//! Macro for constructing the version field of NV_DISPLAY_DRIVER_MEMORY_INFO_V1
#define NV_DISPLAY_DRIVER_MEMORY_INFO_VER_1 MAKE_NVAPI_VERSION(NV_DISPLAY_DRIVER_MEMORY_INFO_V1, 1)
//! \ingroup driverapi
//! Macro for constructing the version field of NV_DISPLAY_DRIVER_MEMORY_INFO_V2
#define NV_DISPLAY_DRIVER_MEMORY_INFO_VER_2 MAKE_NVAPI_VERSION(NV_DISPLAY_DRIVER_MEMORY_INFO_V2, 2)
//! \ingroup driverapi
#define NV_DISPLAY_DRIVER_MEMORY_INFO_VER NV_DISPLAY_DRIVER_MEMORY_INFO_VER_2
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_GPU_GetMemoryInfo
//
//! DESCRIPTION: This function retrieves the available driver memory footprint for the specified GPU.
//!
//! SUPPORTED OS: Windows XP and higher
//!
//!
//! TCC_SUPPORTED
//!
//! \since Release: 177
//!
//! \param [in] hPhysicalGpu Handle of the physical GPU for which the memory information is to be extracted.
//! \param [out] pMemoryInfo The memory footprint available in the driver. See NV_DISPLAY_DRIVER_MEMORY_INFO.
//!
//! \retval NVAPI_INVALID_ARGUMENT pMemoryInfo is NULL.
//! \retval NVAPI_OK Call successful.
//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found.
//! \retval NVAPI_INCOMPATIBLE_STRUCT_VERSION NV_DISPLAY_DRIVER_MEMORY_INFO structure version mismatch.
//!
//! \ingroup driverapi
///////////////////////////////////////////////////////////////////////////////
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_GetMemoryInfo)(NvDisplayHandle hNvDisplay, NV_DISPLAY_DRIVER_MEMORY_INFO *pMemoryInfo);
_NvAPI_GPU_GetMemoryInfo NvAPI_GPU_GetMemoryInfo;
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_EnumPhysicalGPUs
//
//! This function returns an array of physical GPU handles.
//! Each handle represents a physical GPU present in the system.
//! That GPU may be part of an SLI configuration, or may not be visible to the OS directly.
//!
//! At least one GPU must be present in the system and running an NVIDIA display driver.
//!
//! The array nvGPUHandle will be filled with physical GPU handle values. The returned
//! gpuCount determines how many entries in the array are valid.
//!
//! \note In drivers older than 105.00, all physical GPU handles get invalidated on a
//! modeset. So the calling applications need to renum the handles after every modeset.\n
//! With drivers 105.00 and up, all physical GPU handles are constant.
//! Physical GPU handles are constant as long as the GPUs are not physically moved and
//! the SBIOS VGA order is unchanged.
//!
//! For GPU handles in TCC MODE please use NvAPI_EnumTCCPhysicalGPUs()
//!
//! SUPPORTED OS: Windows XP and higher, Mac OS X
//!
//!
//! \par Introduced in
//! \since Release: 80
//!
//! \retval NVAPI_INVALID_ARGUMENT nvGPUHandle or pGpuCount is NULL
//! \retval NVAPI_OK One or more handles were returned
//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found
//! \ingroup gpu
///////////////////////////////////////////////////////////////////////////////
typedef NvAPI_Status (__cdecl *_NvAPI_EnumPhysicalGPUs)(NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32* pGpuCount);
_NvAPI_EnumPhysicalGPUs NvAPI_EnumPhysicalGPUs;
#ifdef __cplusplus
}
#endif
#include <poppack.h>

View File

@@ -0,0 +1,61 @@
/*
* Process Hacker Extra Plugins -
* Nvidia GPU Plugin
*
* Copyright (C) 2016 dmex
*
* This file is part of Process Hacker.
*
* Process Hacker is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Process Hacker is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Process Hacker. If not, see <http://www.gnu.org/licenses/>.
*/
#include "main.h"
PH_CIRCULAR_BUFFER_FLOAT GpuUtilizationHistory;
PH_CIRCULAR_BUFFER_ULONG GpuMemoryHistory;
PH_CIRCULAR_BUFFER_FLOAT GpuBoardHistory;
PH_CIRCULAR_BUFFER_FLOAT GpuBusHistory;
VOID NvGpuInitialize(
VOID
)
{
ULONG sampleCount;
sampleCount = PhGetIntegerSetting(L"SampleCount");
PhInitializeCircularBuffer_FLOAT(&GpuUtilizationHistory, sampleCount);
PhInitializeCircularBuffer_ULONG(&GpuMemoryHistory, sampleCount);
PhInitializeCircularBuffer_FLOAT(&GpuBoardHistory, sampleCount);
PhInitializeCircularBuffer_FLOAT(&GpuBusHistory, sampleCount);
}
VOID NvGpuUpdate(
VOID
)
{
static ULONG runCount = 0; // MUST keep in sync with runCount in process provider
if (runCount != 0)
{
NvGpuUpdateValues();
PhAddItemCircularBuffer_FLOAT(&GpuUtilizationHistory, GpuCurrentGpuUsage);
PhAddItemCircularBuffer_ULONG(&GpuMemoryHistory, GpuCurrentMemUsage);
PhAddItemCircularBuffer_FLOAT(&GpuBoardHistory, GpuCurrentCoreUsage);
PhAddItemCircularBuffer_FLOAT(&GpuBusHistory, GpuCurrentBusUsage);
}
runCount++;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,604 @@
/*
* Process Hacker Extra Plugins -
* Nvidia GPU Plugin
*
* Copyright (C) 2015 dmex
*
* This file is part of Process Hacker.
*
* Process Hacker is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Process Hacker is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Process Hacker. If not, see <http://www.gnu.org/licenses/>.
*/
#include "main.h"
#include <pshpack8.h>
// rev
#define NVAPI_MAX_USAGES_PER_GPU 33
#define NVAPI_MAX_CLOCKS_PER_GPU 0x120
#define NVAPI_MAX_COOLERS_PER_GPU 3
#define NVAPI_MIN_COOLER_LEVEL 0
#define NVAPI_MAX_COOLER_LEVEL 100
#define NVAPI_MAX_COOLER_LEVELS 24
#define NVAPI_MAX_PROCESSES 128
// rev
typedef PVOID (__cdecl *_NvAPI_QueryInterface)(NvU32 FunctionOffset);
_NvAPI_QueryInterface NvAPI_QueryInterface;
// rev
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_GetShaderPipeCount)(_In_ NvPhysicalGpuHandle hPhysicalGPU, NvU32* pShaderPipeCount);
_NvAPI_GPU_GetShaderPipeCount NvAPI_GPU_GetShaderPipeCount;
// rev
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_GetShaderSubPipeCount)(_In_ NvPhysicalGpuHandle hPhysicalGPU, NvU32* pShaderSubPipeCount);
_NvAPI_GPU_GetShaderSubPipeCount NvAPI_GPU_GetShaderSubPipeCount;
// rev
typedef enum _NV_RAM_TYPE
{
NV_RAM_TYPE_NONE,
NV_RAM_TYPE_SDRAM,
NV_RAM_TYPE_DDR1,
NV_RAM_TYPE_DDR2,
NV_RAM_TYPE_GDDR2,
NV_RAM_TYPE_GDDR3,
NV_RAM_TYPE_GDDR4,
NV_RAM_TYPE_DDR3,
NV_RAM_TYPE_GDDR5,
NV_RAM_TYPE_LPDDR2
} NV_RAM_TYPE;
// rev
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_GetRamType)(_In_ NvPhysicalGpuHandle hPhysicalGPU, NV_RAM_TYPE* pRamType);
_NvAPI_GPU_GetRamType NvAPI_GPU_GetRamType;
// rev
typedef enum _NV_RAM_MAKER
{
NV_RAM_MAKER_NONE,
NV_RAM_MAKER_SAMSUNG,
NV_RAM_MAKER_QIMONDA,
NV_RAM_MAKER_ELPIDA,
NV_RAM_MAKER_ETRON,
NV_RAM_MAKER_NANYA,
NV_RAM_MAKER_HYNIX,
NV_RAM_MAKER_MOSEL,
NV_RAM_MAKER_WINBOND,
NV_RAM_MAKER_ELITE,
NV_RAM_MAKER_MICRON
} NV_RAM_MAKER;
// rev
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_GetRamType)(_In_ NvPhysicalGpuHandle hPhysicalGPU, NV_RAM_MAKER* pRamMaker);
_NvAPI_GPU_GetRamType NvAPI_GPU_GetRamMaker;
// rev
typedef NvAPI_Status(__cdecl *_NvAPI_GPU_GetRamBusWidth)(_In_ NvPhysicalGpuHandle hPhysicalGPU, NvU32* pRamBusWidth);
_NvAPI_GPU_GetRamBusWidth NvAPI_GPU_GetRamBusWidth;
// rev
typedef NvAPI_Status(__cdecl *_NvAPI_GPU_GetRamBankCount)(_In_ NvPhysicalGpuHandle hPhysicalGPU, NvU32* pRamBankCount);
_NvAPI_GPU_GetRamBankCount NvAPI_GPU_GetRamBankCount;
typedef enum _NV_FOUNDRY
{
NV_FOUNDRY_NONE,
NV_FOUNDRY_TSMC,
NV_FOUNDRY_UMC,
NV_FOUNDRY_IBM,
NV_FOUNDRY_SMIC,
NV_FOUNDRY_CSM,
NV_FOUNDRY_TOSHIBA
} NV_FOUNDRY;
// rev
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_GetFoundry)(_In_ NvPhysicalGpuHandle hPhysicalGPU, NV_FOUNDRY* pFoundry);
_NvAPI_GPU_GetFoundry NvAPI_GPU_GetFoundry;
// rev
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_GetFBWidthAndLocation)(_In_ NvPhysicalGpuHandle hPhysicalGPU, NvU32* pWidth, NvU32* pLocation);
_NvAPI_GPU_GetFBWidthAndLocation NvAPI_GPU_GetFBWidthAndLocation;
// rev (This has a different offset than the NvAPI_GPU_GetMemoryInfo function despite both returning the same struct).
typedef NvAPI_Status (__cdecl *_NvAPI_GetDisplayDriverMemoryInfo)(_In_ NvDisplayHandle NvDispHandle, _Inout_ NV_DISPLAY_DRIVER_MEMORY_INFO* pMemoryInfo);
_NvAPI_GetDisplayDriverMemoryInfo NvAPI_GetDisplayDriverMemoryInfo;
// rev
typedef enum _NV_COOLER_TYPE
{
NVAPI_COOLER_TYPE_NONE = 0,
NVAPI_COOLER_TYPE_FAN,
NVAPI_COOLER_TYPE_WATER,
NVAPI_COOLER_TYPE_LIQUID_NO2,
} NV_COOLER_TYPE;
// rev
typedef enum _NV_COOLER_CONTROLLER
{
NVAPI_COOLER_CONTROLLER_NONE = 0,
NVAPI_COOLER_CONTROLLER_ADI,
NVAPI_COOLER_CONTROLLER_INTERNAL,
} NV_COOLER_CONTROLLER;
// rev
typedef enum _NV_COOLER_POLICY
{
NVAPI_COOLER_POLICY_NONE = 0,
NVAPI_COOLER_POLICY_MANUAL, // Manual adjustment of cooler level. Gets applied right away independent of temperature or performance level.
NVAPI_COOLER_POLICY_PERF, // GPU performance controls the cooler level.
NVAPI_COOLER_POLICY_TEMPERATURE_DISCRETE = 4, // Discrete thermal levels control the cooler level.
NVAPI_COOLER_POLICY_TEMPERATURE_CONTINUOUS = 8, // Cooler level adjusted at continuous thermal levels.
NVAPI_COOLER_POLICY_HYBRID, // Hybrid of performance and temperature levels.
} NV_COOLER_POLICY;
// rev
typedef enum _NV_COOLER_TARGET
{
NVAPI_COOLER_TARGET_NONE = 0,
NVAPI_COOLER_TARGET_GPU,
NVAPI_COOLER_TARGET_MEMORY,
NVAPI_COOLER_TARGET_POWER_SUPPLY = 4,
NVAPI_COOLER_TARGET_ALL = 7 // This cooler cools all of the components related to its target gpu.
} NV_COOLER_TARGET;
// rev
typedef enum _NV_COOLER_CONTROL
{
NVAPI_COOLER_CONTROL_NONE = 0,
NVAPI_COOLER_CONTROL_TOGGLE, // ON/OFF
NVAPI_COOLER_CONTROL_VARIABLE, // Suppports variable control.
} NV_COOLER_CONTROL;
// rev
typedef enum _NV_COOLER_ACTIVITY_LEVEL
{
NVAPI_INACTIVE = 0, // inactive or unsupported
NVAPI_ACTIVE = 1, // active and spinning in case of fan
} NV_COOLER_ACTIVITY_LEVEL;
// rev
typedef struct _NV_GPU_COOLER_SETTINGS
{
NvU32 version; // structure version
NvU32 count; // number of associated coolers with the selected GPU
struct
{
NV_COOLER_TYPE type; // type of cooler - FAN, WATER, LIQUID_NO2...
NV_COOLER_CONTROLLER controller; // internal, ADI...
NvU32 defaultMinLevel; // the min default value % of the cooler
NvU32 defaultMaxLevel; // the max default value % of the cooler
NvU32 currentMinLevel; // the current allowed min value % of the cooler
NvU32 currentMaxLevel; // the current allowed max value % of the cooler
NvU32 currentLevel; // the current value % of the cooler
NV_COOLER_POLICY defaultPolicy; // cooler control policy - auto-perf, auto-thermal, manual, hybrid...
NV_COOLER_POLICY currentPolicy; // cooler control policy - auto-perf, auto-thermal, manual, hybrid...
NV_COOLER_TARGET target; // cooling target - GPU, memory, chipset, powersupply, canoas...
NV_COOLER_CONTROL controlType; // toggle or variable
NV_COOLER_ACTIVITY_LEVEL active; // is the cooler active - fan spinning...
} cooler[NVAPI_MAX_COOLERS_PER_GPU];
} NV_GPU_COOLER_SETTINGS, *PNV_GPU_COOLER_SETTINGS;
#define NV_GPU_COOLER_SETTINGS_VER MAKE_NVAPI_VERSION(NV_GPU_COOLER_SETTINGS, 1)
// rev
typedef struct _NV_GPU_SETCOOLER_LEVEL
{
NvU32 version; //structure version
struct
{
NvU32 currentLevel; // the new value % of the cooler
NV_COOLER_POLICY currentPolicy; // the new cooler control policy - auto-perf, auto-thermal, manual, hybrid...
} cooler[NVAPI_MAX_COOLERS_PER_GPU];
} NV_GPU_SETCOOLER_LEVEL;
#define NV_GPU_SETCOOLER_LEVEL_VER MAKE_NVAPI_VERSION(NV_GPU_SETCOOLER_LEVEL, 1)
// rev
typedef struct _NV_GPU_COOLER_POLICY_TABLE
{
NvU32 version; //structure version
NV_COOLER_POLICY policy; //selected policy to update the cooler levels for, example NVAPI_COOLER_POLICY_PERF
struct
{
NvU32 levelId; // level indicator for a policy
NvU32 currentLevel; // new cooler level for the selected policy level indicator.
NvU32 defaultLevel; // default cooler level for the selected policy level indicator.
} policyCoolerLevel[NVAPI_MAX_COOLER_LEVELS];
} NV_GPU_COOLER_POLICY_TABLE;
#define NV_GPU_COOLER_POLICY_TABLE_VER MAKE_NVAPI_VERSION(NV_GPU_COOLER_POLICY_TABLE, 1)
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_GPU_GetCoolerSettings
//
// DESCRIPTION: Retrieves the cooler information of all coolers or a specific cooler associated with the selected GPU.
// Coolers are indexed 0 to NVAPI_MAX_COOLERS_PER_GPU-1.
// To retrieve specific cooler info set the coolerIndex to the appropriate cooler index.
// To retrieve info for all cooler set coolerIndex to NVAPI_COOLER_TARGET_ALL.
//
// PARAMETERS : hPhysicalGPU(IN) - GPU selection.
// coolerIndex(IN) - Explict cooler index selection.
// pCoolerInfo(OUT) - Array of cooler settings.
//
///////////////////////////////////////////////////////////////////////////////
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_GetCoolerSettings)(_In_ NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex, NV_GPU_COOLER_SETTINGS* pCoolerInfo);
_NvAPI_GPU_GetCoolerSettings NvAPI_GPU_GetCoolerSettings;
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_GPU_SetCoolerLevels
//
// DESCRIPTION: Set the cooler levels for all coolers or a specific cooler associated with the selected GPU.
// Coolers are indexed 0 to NVAPI_MAX_COOLERS_PER_GPU-1. Every cooler level with non-zero currentpolicy gets applied.
// The new level should be in the range of minlevel and maxlevel retrieved from GetCoolerSettings API or between
// and NVAPI_MIN_COOLER_LEVEL to MAX_COOLER_LEVEL.
// To set level for a specific cooler set the coolerIndex to the appropriate cooler index.
// To set level for all coolers set coolerIndex to NVAPI_COOLER_TARGET_ALL.
// NOTE: To lock the fan speed independent of the temperature or performance changes set the cooler currentPolicy to
// NVAPI_COOLER_POLICY_MANUAL else set it to the current policy retrieved from the GetCoolerSettings API.
// PARAMETERS: hPhysicalGPU(IN) - GPU selection.
// coolerIndex(IN) - Explict cooler index selection.
// pCoolerLevels(IN) - Updated cooler level and cooler policy.
//
///////////////////////////////////////////////////////////////////////////////
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_SetCoolerLevels)(_In_ NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex, NV_GPU_SETCOOLER_LEVEL *pCoolerLevels);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_GPU_RestoreCoolerSettings
//
// DESCRIPTION: Restore the modified cooler settings to NVIDIA defaults.
//
// PARAMETERS: hPhysicalGPU(IN) - GPU selection.
// pCoolerIndex(IN) - Array containing absolute cooler indexes to restore. Pass NULL restore all coolers.
// CoolerCount - Number of coolers to restore.
//
///////////////////////////////////////////////////////////////////////////////
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_RestoreCoolerSettings)(_In_ NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pCoolerIndex, NvU32 coolerCount);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_GPU_GetCoolerPolicyTable
//
// DESCRIPTION: Retrieves the table of cooler and policy levels for the selected policy. Supported only for NVAPI_COOLER_POLICY_PERF.
//
// PARAMETERS: hPhysicalGPU(IN) - GPU selection.
// coolerIndex(IN) - cooler index selection.
// pCoolerTable(OUT) - Table of policy levels and associated cooler levels.
// count(OUT) - Count of the number of valid levels for the selected policy.
//
///////////////////////////////////////////////////////////////////////////////
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_GetCoolerPolicyTable)(_In_ NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex, NV_GPU_COOLER_POLICY_TABLE *pCoolerTable, NvU32 *count);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_GPU_SetCoolerPolicyTable
//
// DESCRIPTION: Restore the modified cooler settings to NVIDIA defaults. Supported only for NVAPI_COOLER_POLICY_PERF.
//
// PARAMETERS: hPhysicalGPU(IN) - GPU selection.
// coolerIndex(IN) - cooler index selection.
// pCoolerTable(IN) - Updated table of policy levels and associated cooler levels. Every non-zero policy level gets updated.
// count(IN) - Number of valid levels in the policy table.
//
///////////////////////////////////////////////////////////////////////////////
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_SetCoolerPolicyTable)(_In_ NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex, NV_GPU_COOLER_POLICY_TABLE *pCoolerTable, NvU32 count);
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_GPU_RestoreCoolerPolicyTable
//
// DESCRIPTION: Restores the perf table policy levels to the defaults.
//
// PARAMETERS: hPhysicalGPU(IN) - GPU selection.
// coolerIndex(IN) - cooler index selection.
// pCoolerIndex(IN) - Array containing absolute cooler indexes to restore. Pass NULL restore all coolers.
// coolerCount - Number of coolers to restore.
// policy - restore for the selected policy
//
///////////////////////////////////////////////////////////////////////////////
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_RestoreCoolerPolicyTable)(_In_ NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pCoolerIndex, NvU32 coolerCount, NV_COOLER_POLICY policy);
// rev - NvAPI_GPU_GetUsages
typedef struct _NV_USAGES_INFO
{
NvU32 version; //!< Structure version
NvU32 usages[NVAPI_MAX_USAGES_PER_GPU];
} NV_USAGES_INFO;
#define NV_USAGES_INFO_VER MAKE_NVAPI_VERSION(NV_USAGES_INFO, 1)
// rev
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_GetUsages)(_In_ NvPhysicalGpuHandle hPhysicalGpu, _Inout_ NV_USAGES_INFO* pUsagesInfo);
_NvAPI_GPU_GetUsages NvAPI_GPU_GetUsages;
// rev - NvAPI_GPU_GetAllClocks
typedef struct _NV_CLOCKS_INFO
{
NvU32 version; //!< Structure version
NvU32 clocks[NVAPI_MAX_CLOCKS_PER_GPU];
} NV_CLOCKS_INFO;
#define NV_CLOCKS_INFO_VER MAKE_NVAPI_VERSION(NV_CLOCKS_INFO, 2)
// rev
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_GetAllClocks)(_In_ NvPhysicalGpuHandle hPhysicalGpu, _Inout_ NV_CLOCKS_INFO* pClocksInfo);
_NvAPI_GPU_GetAllClocks NvAPI_GPU_GetAllClocks;
// rev - NvAPI_GPU_GetVoltageDomainsStatus
typedef struct _NV_VOLTAGE_DOMAINS
{
NvU32 version; //!< Structure version
NvU32 flags; //!< Reserved for future use. Must be set to 0
NvU32 max;
struct
{
NV_GPU_PERF_VOLTAGE_INFO_DOMAIN_ID domainId; //!< ID of the voltage domain
NvU32 mvolt; //!< Voltage in mV
} domain[NVAPI_MAX_GPU_PERF_VOLTAGES];
} NV_VOLTAGE_DOMAINS;
#define NV_VOLTAGE_DOMAIN_INFO_VER MAKE_NVAPI_VERSION(NV_VOLTAGE_DOMAINS, 1)
// rev
typedef NvAPI_Status(__cdecl *_NvAPI_GPU_GetVoltageDomainsStatus)(_In_ NvPhysicalGpuHandle hPhysicalGPU, _Inout_ NV_VOLTAGE_DOMAINS* pVoltageDomainsStatus);
_NvAPI_GPU_GetVoltageDomainsStatus NvAPI_GPU_GetVoltageDomainsStatus;
// rev - NvAPI_GPU_GetVoltages
typedef struct _NV_VOLTAGES_INFO
{
NV_GPU_PERF_VOLTAGE_INFO_DOMAIN_ID domainId; //!< ID of the voltage domain
NvU32 unknown1;
NvU32 max;
struct
{
NvU32 unknown2;
NvU32 mvolt; //!< Voltage in mV
} info[128];
} NV_VOLTAGES_INFO;
// rev
typedef struct _NV_VOLTAGES
{
NvU32 version; //!< Structure version
NvU32 flags; //!< Reserved for future use. Must be set to 0
NvU32 max;
NV_VOLTAGES_INFO voltages[NVAPI_MAX_GPU_PERF_VOLTAGES];
} NV_VOLTAGES;
#define NV_VOLTAGES_INFO_VER MAKE_NVAPI_VERSION(NV_VOLTAGES, 1)
// rev
typedef NvAPI_Status(__cdecl *_NvAPI_GPU_GetVoltages)(_In_ NvPhysicalGpuHandle hPhysicalGPU, _Inout_ NV_VOLTAGES* pPerfVoltages);
_NvAPI_GPU_GetVoltages NvAPI_GPU_GetVoltages;
// rev - NvAPI_GPU_GetPerfClocks
typedef struct _NV_PERF_CLOCKS_UNKNOWN_2
{
NvU32 unknown1;
NvU32 unknown2;
NvU32 unknown3;
NvU32 unknown4;
NvU32 unknown5;
NvU32 unknown6;
NvU32 unknown7;
} NV_PERF_CLOCKS_UNKNOWN_2;
// rev
typedef struct _NV_PERF_CLOCKS_UNKNOWN_1
{
NvU32 unknown1;
NvU32 unknown2;
NV_PERF_CLOCKS_UNKNOWN_2 unknown3[32];
} NV_PERF_CLOCKS_UNKNOWN_1;
// rev
typedef struct _NV_PERF_CLOCKS
{
NvU32 version; //!< Structure version
NvU32 unknown1;
NvU32 unknown2;
NvU32 unknown3;
NvU32 unknown4;
NV_PERF_CLOCKS_UNKNOWN_1 unknown5[12];
} NV_PERF_CLOCKS;
#define NV_PERF_CLOCKS_INFO_VER MAKE_NVAPI_VERSION(NV_PERF_CLOCKS, 1)
// rev
typedef NvAPI_Status(__cdecl *_NvAPI_GPU_GetPerfClocks)(_In_ NvPhysicalGpuHandle hPhysicalGPU, INT i, _Inout_ NV_PERF_CLOCKS* pPerfClocks);
_NvAPI_GPU_GetPerfClocks NvAPI_GPU_GetPerfClocks;
// rev - NvAPI_GPU_QueryActiveApps
typedef struct _NV_ACTIVE_APP
{
NvU32 version; //!< Structure version
NvU32 processPID;
NvAPI_LongString processName;
} NV_ACTIVE_APP;
#define NV_ACTIVE_APPS_INFO_VER MAKE_NVAPI_VERSION(NV_ACTIVE_APP, 2)
// rev
typedef NvAPI_Status(__cdecl *_NvAPI_GPU_QueryActiveApps)(_In_ NvPhysicalGpuHandle hPhysicalGPU, _Inout_ NV_ACTIVE_APP pActiveApps[NVAPI_MAX_PROCESSES], _Inout_ NvU32* pTotal);
_NvAPI_GPU_QueryActiveApps NvAPI_GPU_QueryActiveApps;
// rev - NvAPI_GPU_GetPowerMizerInfo
typedef enum _PowerSourceInfo
{
PowerSourceInfo_Unknown1 = 1,
PowerSourceInfo_Unknown2,
PowerSourceInfo_Unknown3 = 8738
} PowerSourceInfo;
// rev
typedef enum _SelectSource
{
SelectSource_Unknown1 = 1,
SelectSource_Unknown2,
SelectSource_Unknown3
} SelectSource;
// rev
typedef enum _LevelInfo
{
LevelInfo_Unknown1 = 1,
LevelInfo_Unknown2,
LevelInfo_Unknown3,
LevelInfo_Unknown4,
LevelInfo_Unknown5,
LevelInfo_Unknown6,
LevelInfo_Unknown7
} LevelInfo;
// rev
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_GetPowerMizerInfo)(_In_ NvPhysicalGpuHandle hPhysicalGPU, PowerSourceInfo powerSourceInfo, SelectSource select, LevelInfo* pLevelInfo);
_NvAPI_GPU_GetPowerMizerInfo NvAPI_GPU_GetPowerMizerInfo;
// rev
typedef NvAPI_Status (__cdecl *_NvAPI_GetDisplayDriverRegistryPath)(_In_ NvDisplayHandle hNvDisplay, _Inout_ NvAPI_LongString szDriverRegistryPath);
_NvAPI_GetDisplayDriverRegistryPath NvAPI_GetDisplayDriverRegistryPath;
// rev
//typedef NvAPI_Status (__cdecl *_NvAPI_RestartDisplayDriver)(_In_ NvU32 NvDriverIndex);
//_NvAPI_RestartDisplayDriver NvAPI_RestartDisplayDriver;
typedef enum _NV_POWER_TOPOLOGY_FLAGS
{
NV_POWER_TOPOLOGY_FLAG_UNKNOWN1,
NV_POWER_TOPOLOGY_FLAG_UNKNOWN2
} NV_POWER_TOPOLOGY_FLAGS;
typedef struct _NV_POWER_TOPOLOGY_1
{
NvU32 unknown1;
NvU32 unknown2;
NvU32 unknown3;
//public uint UInt32_0
//{
// get { return this.unknown1 & 1u; }
//}
//public uint UInt32_1
//{
// get { return (this.unknown1 & 4294967294u) / 2u; }
//}
} NV_POWER_TOPOLOGY_1;
typedef struct _NV_POWER_TOPOLOGY_2
{
NV_POWER_TOPOLOGY_FLAGS flags;
NV_POWER_TOPOLOGY_1 unknown;
} NV_POWER_TOPOLOGY_2;
typedef struct _NV_POWER_TOPOLOGY_STATUS
{
NvU32 version; //!< Structure version
NvU32 count;
NV_POWER_TOPOLOGY_2 unknown[4];
} NV_POWER_TOPOLOGY_STATUS;
#define NV_POWER_TOPOLOGY_STATUS_VER MAKE_NVAPI_VERSION(NV_POWER_TOPOLOGY_STATUS, 1)
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_ClientPowerTopologyGetStatus)(_In_ NvPhysicalGpuHandle hPhysicalGPU, _Inout_ NV_POWER_TOPOLOGY_STATUS* pClientPowerTopologyStatus);
_NvAPI_GPU_ClientPowerTopologyGetStatus NvAPI_GPU_ClientPowerTopologyGetStatus;
// rev
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_GetShortName)(_In_ NvPhysicalGpuHandle hPhysicalGPU, _Inout_ NvAPI_ShortString szName);
_NvAPI_GPU_GetShortName NvAPI_GPU_GetShortName;
// rev
typedef struct _NV_ARCH_INFO
{
NvU32 version; //!< Structure version
NvU32 unknown[3];
} NV_ARCH_INFO;
#define NV_ARCH_INFO_VER MAKE_NVAPI_VERSION(NV_ARCH_INFO, 2)
// rev
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_GetArchInfo)(_In_ NvPhysicalGpuHandle hPhysicalGPU, _Inout_ NV_ARCH_INFO* pArchInfo);
_NvAPI_GPU_GetArchInfo NvAPI_GPU_GetArchInfo;
// rev
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_GetPartitionCount)(_In_ NvPhysicalGpuHandle hPhysicalGPU, _Out_ NvU32* pCount);
_NvAPI_GPU_GetPartitionCount NvAPI_GPU_GetPartitionCount;
typedef struct _NV_PCIE_INFO_UNKNOWN
{
NvU32 unknown0;
NvU32 unknown1;
NvU32 unknown2;
NvU32 unknown3;
NvU32 unknown4;
NvU32 unknown5;
NvU32 unknown6;
NvU32 unknown7;
} NV_PCIE_INFO_UNKNOWN;
typedef struct _NV_PCIE_INFO
{
NvU32 version; //!< Structure version
NV_PCIE_INFO_UNKNOWN info[5];
} NV_PCIE_INFO;
#define NV_PCIE_INFO_VER MAKE_NVAPI_VERSION(NV_PCIE_INFO, 2)
typedef NvAPI_Status (__cdecl *_NvAPI_GPU_GetPCIEInfo)(_In_ NvPhysicalGpuHandle hPhysicalGPU, _Inout_ NV_PCIE_INFO* pPciInfo);
_NvAPI_GPU_GetPCIEInfo NvAPI_GPU_GetPCIEInfo;
#include <poppack.h>

View File

@@ -0,0 +1,263 @@
/*
* Process Hacker Extra Plugins -
* Nvidia GPU Plugin
*
* Copyright (C) 2015 dmex
*
* This file is part of Process Hacker.
*
* Process Hacker is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Process Hacker is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Process Hacker. If not, see <http://www.gnu.org/licenses/>.
*/
#include "main.h"
#include <windowsx.h>
#pragma comment(lib, "WindowsCodecs.lib")
#include <Wincodec.h>
#define SetDlgItemCheckForSetting(hwndDlg, Id, Name) \
Button_SetCheck(GetDlgItem(hwndDlg, Id), PhGetIntegerSetting(Name) ? BST_CHECKED : BST_UNCHECKED)
#define SetSettingForDlgItemCheckRestartRequired(hwndDlg, Id, Name) \
do { \
BOOLEAN __oldValue = !!PhGetIntegerSetting(Name); \
BOOLEAN __newValue = Button_GetCheck(GetDlgItem(hwndDlg, Id)) == BST_CHECKED; \
if (__newValue != __oldValue) \
RestartRequired = TRUE; \
PhSetIntegerSetting(Name, __newValue); \
} while (0)
HBITMAP LoadImageFromResources(
_In_ UINT Width,
_In_ UINT Height,
_In_ PCWSTR Name
)
{
UINT width = 0;
UINT height = 0;
UINT frameCount = 0;
BOOLEAN isSuccess = FALSE;
ULONG resourceLength = 0;
HGLOBAL resourceHandle = NULL;
HRSRC resourceHandleSource = NULL;
WICInProcPointer resourceBuffer = NULL;
BITMAPINFO bitmapInfo = { 0 };
HBITMAP bitmapHandle = NULL;
PBYTE bitmapBuffer = NULL;
IWICStream* wicStream = NULL;
IWICBitmapSource* wicBitmapSource = NULL;
IWICBitmapDecoder* wicDecoder = NULL;
IWICBitmapFrameDecode* wicFrame = NULL;
IWICImagingFactory* wicFactory = NULL;
IWICBitmapScaler* wicScaler = NULL;
WICPixelFormatGUID pixelFormat;
WICRect rect = { 0, 0, Width, Height };
__try
{
// Create the ImagingFactory
if (FAILED(CoCreateInstance(&CLSID_WICImagingFactory1, NULL, CLSCTX_INPROC_SERVER, &IID_IWICImagingFactory, &wicFactory)))
__leave;
// Find the resource
if ((resourceHandleSource = FindResource(PluginInstance->DllBase, Name, L"PNG")) == NULL)
__leave;
// Get the resource length
resourceLength = SizeofResource(PluginInstance->DllBase, resourceHandleSource);
// Load the resource
if ((resourceHandle = LoadResource(PluginInstance->DllBase, resourceHandleSource)) == NULL)
__leave;
if ((resourceBuffer = (WICInProcPointer)LockResource(resourceHandle)) == NULL)
__leave;
// Create the Stream
if (FAILED(IWICImagingFactory_CreateStream(wicFactory, &wicStream)))
__leave;
// Initialize the Stream from Memory
if (FAILED(IWICStream_InitializeFromMemory(wicStream, resourceBuffer, resourceLength)))
__leave;
if (FAILED(IWICImagingFactory_CreateDecoder(wicFactory, &GUID_ContainerFormatPng, NULL, &wicDecoder)))
__leave;
if (FAILED(IWICBitmapDecoder_Initialize(wicDecoder, (IStream*)wicStream, WICDecodeMetadataCacheOnLoad)))
__leave;
// Get the Frame count
if (FAILED(IWICBitmapDecoder_GetFrameCount(wicDecoder, &frameCount)) || frameCount < 1)
__leave;
// Get the Frame
if (FAILED(IWICBitmapDecoder_GetFrame(wicDecoder, 0, &wicFrame)))
__leave;
// Get the WicFrame image format
if (FAILED(IWICBitmapFrameDecode_GetPixelFormat(wicFrame, &pixelFormat)))
__leave;
// Check if the image format is supported:
if (IsEqualGUID(&pixelFormat, &GUID_WICPixelFormat32bppPBGRA)) // GUID_WICPixelFormat32bppRGB
{
wicBitmapSource = (IWICBitmapSource*)wicFrame;
}
else
{
// Convert the image to the correct format:
if (FAILED(WICConvertBitmapSource(&GUID_WICPixelFormat32bppPBGRA, (IWICBitmapSource*)wicFrame, &wicBitmapSource)))
__leave;
IWICBitmapFrameDecode_Release(wicFrame);
}
bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bitmapInfo.bmiHeader.biWidth = rect.Width;
bitmapInfo.bmiHeader.biHeight = -((LONG)rect.Height);
bitmapInfo.bmiHeader.biPlanes = 1;
bitmapInfo.bmiHeader.biBitCount = 32;
bitmapInfo.bmiHeader.biCompression = BI_RGB;
HDC hdc = CreateCompatibleDC(NULL);
bitmapHandle = CreateDIBSection(hdc, &bitmapInfo, DIB_RGB_COLORS, (PVOID*)&bitmapBuffer, NULL, 0);
ReleaseDC(NULL, hdc);
// Check if it's the same rect as the requested size.
//if (width != rect.Width || height != rect.Height)
if (FAILED(IWICImagingFactory_CreateBitmapScaler(wicFactory, &wicScaler)))
__leave;
if (FAILED(IWICBitmapScaler_Initialize(wicScaler, wicBitmapSource, rect.Width, rect.Height, WICBitmapInterpolationModeFant)))
__leave;
if (FAILED(IWICBitmapScaler_CopyPixels(wicScaler, &rect, rect.Width * 4, rect.Width * rect.Height * 4, bitmapBuffer)))
__leave;
isSuccess = TRUE;
}
__finally
{
if (wicScaler)
{
IWICBitmapScaler_Release(wicScaler);
}
if (wicBitmapSource)
{
IWICBitmapSource_Release(wicBitmapSource);
}
if (wicStream)
{
IWICStream_Release(wicStream);
}
if (wicDecoder)
{
IWICBitmapDecoder_Release(wicDecoder);
}
if (wicFactory)
{
IWICImagingFactory_Release(wicFactory);
}
if (resourceHandle)
{
FreeResource(resourceHandle);
}
}
return bitmapHandle;
}
INT_PTR CALLBACK OptionsDlgProc(
_In_ HWND hwndDlg,
_In_ UINT uMsg,
_In_ WPARAM wParam,
_In_ LPARAM lParam
)
{
static BOOLEAN RestartRequired;
switch (uMsg)
{
case WM_INITDIALOG:
{
RestartRequired = FALSE;
PhCenterWindow(hwndDlg, GetParent(hwndDlg));
SetDlgItemCheckForSetting(hwndDlg, IDC_ENABLENVIDIASUPPORT, SETTING_NAME_ENABLE_MONITORING);
}
break;
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDCANCEL:
EndDialog(hwndDlg, IDCANCEL);
break;
case IDOK:
{
SetSettingForDlgItemCheckRestartRequired(hwndDlg, IDC_ENABLENVIDIASUPPORT, SETTING_NAME_ENABLE_MONITORING);
if (RestartRequired)
{
if (PhShowMessage(
PhMainWndHandle,
MB_ICONQUESTION | MB_YESNO,
L"One or more options you have changed requires a restart of Process Hacker. "
L"Do you want to restart Process Hacker now?"
) == IDYES)
{
ProcessHacker_PrepareForEarlyShutdown(PhMainWndHandle);
PhShellProcessHacker(
PhMainWndHandle,
L"-v",
SW_SHOW,
0,
PH_SHELL_APP_PROPAGATE_PARAMETERS | PH_SHELL_APP_PROPAGATE_PARAMETERS_IGNORE_VISIBILITY,
0,
NULL
);
ProcessHacker_Destroy(PhMainWndHandle);
}
}
EndDialog(hwndDlg, IDOK);
}
break;
}
}
break;
}
return FALSE;
}
VOID ShowOptionsDialog(
_In_ HWND ParentHandle
)
{
DialogBox(
PluginInstance->DllBase,
MAKEINTRESOURCE(IDD_OPTIONS),
ParentHandle,
OptionsDlgProc
);
}

View File

@@ -0,0 +1,53 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by NvGpuPlugin.rc
//
#define IDC_RESET 3
#define IDD_GPU_PANEL 100
#define IDD_GPU_DIALOG 101
#define IDC_GRAPH_LAYOUT 102
#define IDC_TITLE 103
#define IDC_GPUNAME 104
#define IDC_PANEL_LAYOUT 105
#define IDC_GPU_L 106
#define IDC_MEMORY_L 107
#define IDC_SHARED_L 108
#define IDC_SHARED_BUS 109
#define IDC_BUS_L 110
#define IDC_CLOCK_CORE 111
#define IDC_CLOCK_MEMORY 112
#define IDC_FAN_PERCENT 113
#define IDC_TEMP_VALUE 114
#define IDC_CLOCK_SHADER 115
#define IDD_OPTIONS 116
#define IDC_VOLTAGE 117
#define IDD_GPU_DETAILS 117
#define IDB_NV_LOGO_PNG 119
#define IDC_DETAILS 1001
#define IDC_ENABLENVIDIASUPPORT 1002
#define IDC_EDIT1 1003
#define IDC_EDIT2 1004
#define IDC_EDIT3 1005
#define IDC_EDIT4 1006
#define IDC_EDIT5 1007
#define IDC_EDIT6 1008
#define IDC_EDIT7 1009
#define IDC_EDIT8 1010
#define IDC_EDIT9 1011
#define IDC_NVIMAGE 1012
#define IDC_EDIT10 1013
#define IDC_EDIT11 1014
#define IDC_EDIT12 1015
#define IDC_EDIT13 1016
#define IDC_EDIT14 1017
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 121
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1013
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB