1.1 --- a/Hardware/Nvidia/NVAPI.cs Tue Feb 09 18:55:45 2010 +0000
1.2 +++ b/Hardware/Nvidia/NVAPI.cs Tue Feb 09 19:42:33 2010 +0000
1.3 @@ -174,6 +174,8 @@
1.4 out int gpuCount);
1.5 public delegate NvStatus NvAPI_EnumPhysicalGPUsDelegate(
1.6 [Out] NvPhysicalGpuHandle[] gpuHandles, out int gpuCount);
1.7 + public delegate NvStatus NvAPI_GPU_GetTachReadingDelegate(
1.8 + NvPhysicalGpuHandle gpuHandle, out int value);
1.9
1.10 private static bool available = false;
1.11 private static nvapi_QueryInterfaceDelegate nvapi_QueryInterface;
1.12 @@ -188,6 +190,8 @@
1.13 NvAPI_GetPhysicalGPUsFromDisplay;
1.14 public static NvAPI_EnumPhysicalGPUsDelegate
1.15 NvAPI_EnumPhysicalGPUs;
1.16 + public static NvAPI_GPU_GetTachReadingDelegate
1.17 + NvAPI_GPU_GetTachReading;
1.18
1.19 public static NvStatus NvAPI_GPU_GetFullName(NvPhysicalGpuHandle gpuHandle,
1.20 out string name) {
1.21 @@ -209,7 +213,12 @@
1.22 where T : class
1.23 {
1.24 IntPtr ptr = nvapi_QueryInterface(id);
1.25 - newDelegate = Marshal.GetDelegateForFunctionPointer(ptr, typeof(T)) as T;
1.26 + if (ptr != IntPtr.Zero) {
1.27 + newDelegate =
1.28 + Marshal.GetDelegateForFunctionPointer(ptr, typeof(T)) as T;
1.29 + } else {
1.30 + newDelegate = null;
1.31 + }
1.32 }
1.33
1.34 static NVAPI() {
1.35 @@ -231,6 +240,7 @@
1.36 GetDelegate(0x9ABDD40D, out NvAPI_EnumNvidiaDisplayHandle);
1.37 GetDelegate(0x34EF9506, out NvAPI_GetPhysicalGPUsFromDisplay);
1.38 GetDelegate(0xE5AC921F, out NvAPI_EnumPhysicalGPUs);
1.39 + GetDelegate(0x5F608315, out NvAPI_GPU_GetTachReading);
1.40 available = true;
1.41 }
1.42 }