Hardware/Nvidia/NVAPI.cs
author moel.mich
Wed, 08 Sep 2010 19:29:58 +0000
changeset 182 4801e9eaf979
parent 167 b7cc9d09aefe
child 195 0ee888c485d5
permissions -rw-r--r--
Fixed some Code Analysis warnings.
moel@1
     1
/*
moel@1
     2
  
moel@1
     3
  Version: MPL 1.1/GPL 2.0/LGPL 2.1
moel@1
     4
moel@1
     5
  The contents of this file are subject to the Mozilla Public License Version
moel@1
     6
  1.1 (the "License"); you may not use this file except in compliance with
moel@1
     7
  the License. You may obtain a copy of the License at
moel@1
     8
 
moel@1
     9
  http://www.mozilla.org/MPL/
moel@1
    10
moel@1
    11
  Software distributed under the License is distributed on an "AS IS" basis,
moel@1
    12
  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
moel@1
    13
  for the specific language governing rights and limitations under the License.
moel@1
    14
moel@1
    15
  The Original Code is the Open Hardware Monitor code.
moel@1
    16
moel@1
    17
  The Initial Developer of the Original Code is 
moel@1
    18
  Michael Möller <m.moeller@gmx.ch>.
moel@1
    19
  Portions created by the Initial Developer are Copyright (C) 2009-2010
moel@1
    20
  the Initial Developer. All Rights Reserved.
moel@1
    21
moel@1
    22
  Contributor(s):
moel@1
    23
moel@1
    24
  Alternatively, the contents of this file may be used under the terms of
moel@1
    25
  either the GNU General Public License Version 2 or later (the "GPL"), or
moel@1
    26
  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
moel@1
    27
  in which case the provisions of the GPL or the LGPL are applicable instead
moel@1
    28
  of those above. If you wish to allow use of your version of this file only
moel@1
    29
  under the terms of either the GPL or the LGPL, and not to allow others to
moel@1
    30
  use your version of this file under the terms of the MPL, indicate your
moel@1
    31
  decision by deleting the provisions above and replace them with the notice
moel@1
    32
  and other provisions required by the GPL or the LGPL. If you do not delete
moel@1
    33
  the provisions above, a recipient may use your version of this file under
moel@1
    34
  the terms of any one of the MPL, the GPL or the LGPL.
moel@1
    35
 
moel@1
    36
*/
moel@1
    37
moel@1
    38
using System;
moel@1
    39
using System.Runtime.InteropServices;
moel@1
    40
using System.Text;
moel@1
    41
moel@1
    42
namespace OpenHardwareMonitor.Hardware.Nvidia {
moel@1
    43
moel@165
    44
  internal enum NvStatus {
moel@1
    45
    OK = 0,
moel@1
    46
    ERROR = -1,
moel@1
    47
    LIBRARY_NOT_FOUND = -2,
moel@1
    48
    NO_IMPLEMENTATION = -3,
moel@1
    49
    API_NOT_INTIALIZED = -4,
moel@1
    50
    INVALID_ARGUMENT = -5,
moel@1
    51
    NVIDIA_DEVICE_NOT_FOUND = -6,
moel@1
    52
    END_ENUMERATION = -7,
moel@1
    53
    INVALID_HANDLE = -8,
moel@1
    54
    INCOMPATIBLE_STRUCT_VERSION = -9,
moel@1
    55
    HANDLE_INVALIDATED = -10,
moel@1
    56
    OPENGL_CONTEXT_NOT_CURRENT = -11,
moel@1
    57
    NO_GL_EXPERT = -12,
moel@1
    58
    INSTRUMENTATION_DISABLED = -13,
moel@1
    59
    EXPECTED_LOGICAL_GPU_HANDLE = -100,
moel@1
    60
    EXPECTED_PHYSICAL_GPU_HANDLE = -101,
moel@1
    61
    EXPECTED_DISPLAY_HANDLE = -102,
moel@1
    62
    INVALID_COMBINATION = -103,
moel@1
    63
    NOT_SUPPORTED = -104,
moel@1
    64
    PORTID_NOT_FOUND = -105,
moel@1
    65
    EXPECTED_UNATTACHED_DISPLAY_HANDLE = -106,
moel@1
    66
    INVALID_PERF_LEVEL = -107,
moel@1
    67
    DEVICE_BUSY = -108,
moel@1
    68
    NV_PERSIST_FILE_NOT_FOUND = -109,
moel@1
    69
    PERSIST_DATA_NOT_FOUND = -110,
moel@1
    70
    EXPECTED_TV_DISPLAY = -111,
moel@1
    71
    EXPECTED_TV_DISPLAY_ON_DCONNECTOR = -112,
moel@1
    72
    NO_ACTIVE_SLI_TOPOLOGY = -113,
moel@1
    73
    SLI_RENDERING_MODE_NOTALLOWED = -114,
moel@1
    74
    EXPECTED_DIGITAL_FLAT_PANEL = -115,
moel@1
    75
    ARGUMENT_EXCEED_MAX_SIZE = -116,
moel@1
    76
    DEVICE_SWITCHING_NOT_ALLOWED = -117,
moel@1
    77
    TESTING_CLOCKS_NOT_SUPPORTED = -118,
moel@1
    78
    UNKNOWN_UNDERSCAN_CONFIG = -119,
moel@1
    79
    TIMEOUT_RECONFIGURING_GPU_TOPO = -120,
moel@1
    80
    DATA_NOT_FOUND = -121,
moel@1
    81
    EXPECTED_ANALOG_DISPLAY = -122,
moel@1
    82
    NO_VIDLINK = -123,
moel@1
    83
    REQUIRES_REBOOT = -124,
moel@1
    84
    INVALID_HYBRID_MODE = -125,
moel@1
    85
    MIXED_TARGET_TYPES = -126,
moel@1
    86
    SYSWOW64_NOT_SUPPORTED = -127,
moel@1
    87
    IMPLICIT_SET_GPU_TOPOLOGY_CHANGE_NOT_ALLOWED = -128,
moel@1
    88
    REQUEST_USER_TO_CLOSE_NON_MIGRATABLE_APPS = -129,
moel@1
    89
    OUT_OF_MEMORY = -130,
moel@1
    90
    WAS_STILL_DRAWING = -131,
moel@1
    91
    FILE_NOT_FOUND = -132,
moel@1
    92
    TOO_MANY_UNIQUE_STATE_OBJECTS = -133,
moel@1
    93
    INVALID_CALL = -134,
moel@1
    94
    D3D10_1_LIBRARY_NOT_FOUND = -135,
moel@1
    95
    FUNCTION_NOT_FOUND = -136
moel@165
    96
  }
moel@1
    97
moel@165
    98
  internal enum NvThermalController {
moel@1
    99
    NONE = 0,
moel@1
   100
    GPU_INTERNAL,  
moel@1
   101
    ADM1032,
moel@1
   102
    MAX6649,       
moel@1
   103
    MAX1617,      
moel@1
   104
    LM99,      
moel@1
   105
    LM89,         
moel@1
   106
    LM64,         
moel@1
   107
    ADT7473,
moel@1
   108
    SBMAX6649,
moel@1
   109
    VBIOSEVT,  
moel@1
   110
    OS,    
moel@1
   111
    UNKNOWN = -1,
moel@165
   112
  }
moel@1
   113
moel@165
   114
  internal enum NvThermalTarget {
moel@1
   115
    NONE = 0,
moel@1
   116
    GPU = 1,
moel@1
   117
    MEMORY = 2,
moel@1
   118
    POWER_SUPPLY = 4,
moel@1
   119
    BOARD = 8,
moel@1
   120
    ALL = 15,
moel@1
   121
    UNKNOWN = -1
moel@1
   122
  };
moel@1
   123
moel@61
   124
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   125
  internal struct NvSensor {
moel@1
   126
    public NvThermalController Controller;
moel@140
   127
    public uint DefaultMinTemp;
moel@140
   128
    public uint DefaultMaxTemp;
moel@140
   129
    public uint CurrentTemp;
moel@1
   130
    public NvThermalTarget Target;     
moel@1
   131
  }
moel@1
   132
moel@61
   133
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   134
  internal struct NvGPUThermalSettings {
moel@140
   135
    public uint Version;
moel@140
   136
    public uint Count;
moel@1
   137
    [MarshalAs(UnmanagedType.ByValArray, 
moel@1
   138
      SizeConst = NVAPI.MAX_THERMAL_SENSORS_PER_GPU)]
moel@1
   139
    public NvSensor[] Sensor;
moel@1
   140
  }
moel@1
   141
moel@61
   142
  [StructLayout(LayoutKind.Sequential)]
moel@165
   143
  internal struct NvDisplayHandle {
moel@61
   144
    private IntPtr ptr;
moel@1
   145
  }
moel@1
   146
moel@61
   147
  [StructLayout(LayoutKind.Sequential)]
moel@165
   148
  internal struct NvPhysicalGpuHandle {
moel@61
   149
    private IntPtr ptr;
moel@1
   150
  }
moel@1
   151
moel@140
   152
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   153
  internal struct NvClocks {
moel@140
   154
    public uint Version;
moel@140
   155
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.MAX_CLOCKS_PER_GPU)]
moel@140
   156
    public uint[] Clock;
moel@140
   157
  }
moel@140
   158
moel@140
   159
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   160
  internal struct NvPState {
moel@140
   161
    public bool Present;
moel@140
   162
    public int Percentage;
moel@140
   163
  }
moel@140
   164
moel@140
   165
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   166
  internal struct NvPStates {
moel@140
   167
    public uint Version;
moel@140
   168
    public uint Flags;
moel@140
   169
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.MAX_PSTATES_PER_GPU)]
moel@140
   170
    public NvPState[] PStates;
moel@140
   171
  }
moel@140
   172
moel@140
   173
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   174
  internal struct NvUsages {
moel@140
   175
    public uint Version;
moel@140
   176
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.MAX_USAGES_PER_GPU)]
moel@140
   177
    public uint[] Usage;
moel@140
   178
  }
moel@140
   179
moel@140
   180
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   181
  internal struct NvCooler {
moel@140
   182
    public int Type;
moel@140
   183
    public int Controller;
moel@140
   184
    public int DefaultMin;
moel@140
   185
    public int DefaultMax;
moel@140
   186
    public int CurrentMin;
moel@140
   187
    public int CurrentMax;
moel@140
   188
    public int CurrentLevel;
moel@140
   189
    public int DefaultPolicy;
moel@140
   190
    public int CurrentPolicy;
moel@140
   191
    public int Target;
moel@140
   192
    public int ControlType;
moel@140
   193
    public int Active;
moel@140
   194
  }
moel@140
   195
moel@140
   196
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   197
  internal struct NvGPUCoolerSettings {
moel@140
   198
    public uint Version;
moel@140
   199
    public uint Count;
moel@140
   200
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.MAX_COOLER_PER_GPU)]
moel@140
   201
    public NvCooler[] Cooler;
moel@140
   202
  }
moel@140
   203
moel@140
   204
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   205
  internal struct NvMemoryInfo {
moel@140
   206
    public uint Version;
moel@140
   207
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 
moel@140
   208
      NVAPI.MAX_MEMORY_VALUES_PER_GPU)]
moel@140
   209
    public uint[] Values;
moel@140
   210
  }
moel@140
   211
moel@140
   212
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   213
  internal struct NvDisplayDriverVersion {
moel@140
   214
    public uint Version;
moel@140
   215
    public uint DriverVersion;
moel@140
   216
    public uint BldChangeListNum;
moel@140
   217
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = NVAPI.SHORT_STRING_MAX)]
moel@140
   218
    public string BuildBranch;
moel@140
   219
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = NVAPI.SHORT_STRING_MAX)]
moel@140
   220
    public string Adapter;
moel@165
   221
  }
moel@140
   222
moel@165
   223
  internal class NVAPI {
moel@1
   224
moel@1
   225
    public const int MAX_PHYSICAL_GPUS = 64;
moel@140
   226
    public const int SHORT_STRING_MAX = 64;
moel@140
   227
moel@140
   228
    public const int MAX_THERMAL_SENSORS_PER_GPU = 3;    
moel@140
   229
    public const int MAX_CLOCKS_PER_GPU = 0x120;
moel@140
   230
    public const int MAX_PSTATES_PER_GPU = 8;
moel@140
   231
    public const int MAX_USAGES_PER_GPU = 33;
moel@140
   232
    public const int MAX_COOLER_PER_GPU = 20;
moel@140
   233
    public const int MAX_MEMORY_VALUES_PER_GPU = 5;
moel@140
   234
moel@140
   235
    public static readonly uint GPU_THERMAL_SETTINGS_VER = (uint)
moel@1
   236
      Marshal.SizeOf(typeof(NvGPUThermalSettings)) | 0x10000;
moel@140
   237
    public static readonly uint GPU_CLOCKS_VER = (uint)
moel@140
   238
      Marshal.SizeOf(typeof(NvClocks)) | 0x20000;
moel@140
   239
    public static readonly uint GPU_PSTATES_VER = (uint)
moel@140
   240
      Marshal.SizeOf(typeof(NvPStates)) | 0x10000;
moel@140
   241
    public static readonly uint GPU_USAGES_VER = (uint)
moel@140
   242
      Marshal.SizeOf(typeof(NvUsages)) | 0x10000;
moel@140
   243
    public static readonly uint GPU_COOLER_SETTINGS_VER = (uint)
moel@140
   244
      Marshal.SizeOf(typeof(NvGPUCoolerSettings)) | 0x20000;
moel@140
   245
    public static readonly uint GPU_MEMORY_INFO_VER = (uint) 
moel@140
   246
      Marshal.SizeOf(typeof(NvMemoryInfo)) | 0x20000;
moel@140
   247
    public static readonly uint DISPLAY_DRIVER_VERSION_VER = (uint)
moel@140
   248
      Marshal.SizeOf(typeof(NvDisplayDriverVersion)) | 0x10000;
moel@140
   249
      
moel@1
   250
    private delegate IntPtr nvapi_QueryInterfaceDelegate(uint id);
moel@1
   251
    private delegate NvStatus NvAPI_InitializeDelegate();
moel@1
   252
    private delegate NvStatus NvAPI_GPU_GetFullNameDelegate(
moel@1
   253
      NvPhysicalGpuHandle gpuHandle, StringBuilder name);
moel@1
   254
moel@1
   255
    public delegate NvStatus NvAPI_GPU_GetThermalSettingsDelegate(
moel@1
   256
      NvPhysicalGpuHandle gpuHandle, int sensorIndex, 
moel@1
   257
      ref NvGPUThermalSettings nvGPUThermalSettings);
moel@1
   258
    public delegate NvStatus NvAPI_EnumNvidiaDisplayHandleDelegate(int thisEnum,
moel@1
   259
      ref NvDisplayHandle displayHandle);
moel@1
   260
    public delegate NvStatus NvAPI_GetPhysicalGPUsFromDisplayDelegate(
moel@1
   261
      NvDisplayHandle displayHandle, [Out] NvPhysicalGpuHandle[] gpuHandles, 
moel@140
   262
      out uint gpuCount);
moel@1
   263
    public delegate NvStatus NvAPI_EnumPhysicalGPUsDelegate(
moel@1
   264
      [Out] NvPhysicalGpuHandle[] gpuHandles, out int gpuCount);
moel@38
   265
    public delegate NvStatus NvAPI_GPU_GetTachReadingDelegate(
moel@38
   266
      NvPhysicalGpuHandle gpuHandle, out int value);
moel@140
   267
    public delegate NvStatus NvAPI_GPU_GetAllClocksDelegate(
moel@140
   268
      NvPhysicalGpuHandle gpuHandle, ref NvClocks nvClocks);
moel@140
   269
    public delegate NvStatus NvAPI_GPU_GetPStatesDelegate(
moel@140
   270
      NvPhysicalGpuHandle gpuHandle, ref NvPStates nvPStates);
moel@140
   271
    public delegate NvStatus NvAPI_GPU_GetUsagesDelegate(
moel@140
   272
      NvPhysicalGpuHandle gpuHandle, ref NvUsages nvUsages);
moel@140
   273
    public delegate NvStatus NvAPI_GPU_GetCoolerSettingsDelegate(
moel@140
   274
      NvPhysicalGpuHandle gpuHandle, int coolerIndex,
moel@140
   275
      ref NvGPUCoolerSettings nvGPUCoolerSettings);
moel@140
   276
    public delegate NvStatus NvAPI_GPU_GetMemoryInfoDelegate(
moel@140
   277
      NvDisplayHandle displayHandle, ref NvMemoryInfo nvMemoryInfo);
moel@140
   278
    public delegate NvStatus NvAPI_GetDisplayDriverVersionDelegate(
moel@140
   279
      NvDisplayHandle displayHandle, [In, Out] ref NvDisplayDriverVersion
moel@140
   280
      nvDisplayDriverVersion);
moel@140
   281
    public delegate NvStatus NvAPI_GetInterfaceVersionStringDelegate(
moel@140
   282
      StringBuilder version);
moel@1
   283
moel@1
   284
    private static bool available = false;
moel@1
   285
    private static nvapi_QueryInterfaceDelegate nvapi_QueryInterface;
moel@1
   286
    private static NvAPI_InitializeDelegate NvAPI_Initialize;
moel@1
   287
    private static NvAPI_GPU_GetFullNameDelegate _NvAPI_GPU_GetFullName;
moel@140
   288
    private static NvAPI_GetInterfaceVersionStringDelegate
moel@140
   289
      _NvAPI_GetInterfaceVersionString;
moel@1
   290
moel@140
   291
    public static readonly NvAPI_GPU_GetThermalSettingsDelegate 
moel@1
   292
      NvAPI_GPU_GetThermalSettings;
moel@140
   293
    public static readonly NvAPI_EnumNvidiaDisplayHandleDelegate
moel@1
   294
      NvAPI_EnumNvidiaDisplayHandle;
moel@140
   295
    public static readonly NvAPI_GetPhysicalGPUsFromDisplayDelegate
moel@1
   296
      NvAPI_GetPhysicalGPUsFromDisplay;
moel@140
   297
    public static readonly NvAPI_EnumPhysicalGPUsDelegate
moel@1
   298
      NvAPI_EnumPhysicalGPUs;
moel@140
   299
    public static readonly NvAPI_GPU_GetTachReadingDelegate
moel@38
   300
      NvAPI_GPU_GetTachReading;
moel@140
   301
    public static readonly NvAPI_GPU_GetAllClocksDelegate
moel@140
   302
      NvAPI_GPU_GetAllClocks;
moel@140
   303
    public static readonly NvAPI_GPU_GetPStatesDelegate
moel@140
   304
      NvAPI_GPU_GetPStates;
moel@140
   305
    public static readonly NvAPI_GPU_GetUsagesDelegate
moel@140
   306
      NvAPI_GPU_GetUsages;
moel@140
   307
    public static readonly NvAPI_GPU_GetCoolerSettingsDelegate
moel@140
   308
      NvAPI_GPU_GetCoolerSettings;
moel@140
   309
    public static readonly NvAPI_GPU_GetMemoryInfoDelegate
moel@140
   310
      NvAPI_GPU_GetMemoryInfo;
moel@140
   311
    public static readonly NvAPI_GetDisplayDriverVersionDelegate
moel@167
   312
      NvAPI_GetDisplayDriverVersion;
moel@167
   313
moel@167
   314
    private NVAPI() { }
moel@1
   315
moel@1
   316
    public static NvStatus NvAPI_GPU_GetFullName(NvPhysicalGpuHandle gpuHandle,
moel@1
   317
      out string name) {
moel@1
   318
      StringBuilder builder = new StringBuilder(SHORT_STRING_MAX);
moel@101
   319
      NvStatus status;
moel@101
   320
      if (_NvAPI_GPU_GetFullName != null)
moel@101
   321
        status = _NvAPI_GPU_GetFullName(gpuHandle, builder);
moel@101
   322
      else
moel@101
   323
        status = NvStatus.FUNCTION_NOT_FOUND;
moel@1
   324
      name = builder.ToString();
moel@1
   325
      return status;
moel@1
   326
    }
moel@1
   327
moel@140
   328
    public static NvStatus NvAPI_GetInterfaceVersionString(out string version) {
moel@140
   329
      StringBuilder builder = new StringBuilder(SHORT_STRING_MAX);
moel@140
   330
      NvStatus status;
moel@140
   331
      if (_NvAPI_GetInterfaceVersionString != null)
moel@140
   332
        status = _NvAPI_GetInterfaceVersionString(builder);
moel@140
   333
      else
moel@140
   334
        status = NvStatus.FUNCTION_NOT_FOUND;
moel@140
   335
      version = builder.ToString();
moel@140
   336
      return status;
moel@140
   337
    }
moel@140
   338
moel@1
   339
    private static string GetDllName() {
moel@1
   340
      if (IntPtr.Size == 4) {
moel@1
   341
        return "nvapi.dll";
moel@1
   342
      } else {
moel@1
   343
        return "nvapi64.dll";
moel@1
   344
      }
moel@1
   345
    }
moel@1
   346
moel@1
   347
    private static void GetDelegate<T>(uint id, out T newDelegate) 
moel@1
   348
      where T : class 
moel@1
   349
    {
moel@1
   350
      IntPtr ptr = nvapi_QueryInterface(id);
moel@38
   351
      if (ptr != IntPtr.Zero) {
moel@38
   352
        newDelegate =
moel@38
   353
          Marshal.GetDelegateForFunctionPointer(ptr, typeof(T)) as T;
moel@38
   354
      } else {
moel@38
   355
        newDelegate = null;
moel@38
   356
      }
moel@1
   357
    }
moel@1
   358
moel@1
   359
    static NVAPI() { 
moel@1
   360
      DllImportAttribute attribute = new DllImportAttribute(GetDllName());
moel@1
   361
      attribute.CallingConvention = CallingConvention.Cdecl;
moel@1
   362
      attribute.PreserveSig = true;
moel@1
   363
      attribute.EntryPoint = "nvapi_QueryInterface";
moel@1
   364
      PInvokeDelegateFactory.CreateDelegate(attribute,
moel@1
   365
        out nvapi_QueryInterface);
moel@1
   366
moel@1
   367
      try {
moel@1
   368
        GetDelegate(0x0150E828, out NvAPI_Initialize);
moel@1
   369
      } catch (DllNotFoundException) { return; } 
moel@121
   370
        catch (EntryPointNotFoundException) { return; } 
moel@1
   371
        catch (ArgumentNullException) { return; }
moel@1
   372
moel@1
   373
      if (NvAPI_Initialize() == NvStatus.OK) {
moel@1
   374
        GetDelegate(0xE3640A56, out NvAPI_GPU_GetThermalSettings);
moel@1
   375
        GetDelegate(0xCEEE8E9F, out _NvAPI_GPU_GetFullName);
moel@1
   376
        GetDelegate(0x9ABDD40D, out NvAPI_EnumNvidiaDisplayHandle);
moel@1
   377
        GetDelegate(0x34EF9506, out NvAPI_GetPhysicalGPUsFromDisplay);
moel@1
   378
        GetDelegate(0xE5AC921F, out NvAPI_EnumPhysicalGPUs);
moel@140
   379
        GetDelegate(0x5F608315, out NvAPI_GPU_GetTachReading);
moel@140
   380
        GetDelegate(0x1BD69F49, out NvAPI_GPU_GetAllClocks);
moel@140
   381
        GetDelegate(0x60DED2ED, out NvAPI_GPU_GetPStates);
moel@140
   382
        GetDelegate(0x189A1FDF, out NvAPI_GPU_GetUsages);
moel@140
   383
        GetDelegate(0xDA141340, out NvAPI_GPU_GetCoolerSettings);
moel@140
   384
        GetDelegate(0x774AA982, out NvAPI_GPU_GetMemoryInfo);
moel@140
   385
        GetDelegate(0xF951A4D1, out NvAPI_GetDisplayDriverVersion);
moel@140
   386
        GetDelegate(0x01053FA5, out _NvAPI_GetInterfaceVersionString);
moel@140
   387
moel@1
   388
        available = true;
moel@1
   389
      }
moel@1
   390
    }
moel@1
   391
moel@1
   392
    public static bool IsAvailable {
moel@1
   393
      get { return available; }
moel@1
   394
    }
moel@1
   395
moel@1
   396
  }
moel@1
   397
}