@@ -60,6 +60,11 @@ public class _HWiNFO_SENSOR
6060 public string SensorNameOrig ;
6161 [ MarshalAs ( UnmanagedType . ByValTStr , SizeConst = HWINFO_SENSORS_STRING_LEN ) ]
6262 public string SensorNameUser ;
63+
64+ // Version 2+ new:
65+ [ MarshalAs ( UnmanagedType . ByValTStr , SizeConst = HWINFO_SENSORS_STRING_LEN ) ]
66+ public string utfSensorNameUser ; // Sensor name displayed, which might be translated or renamed by user [UTF-8 string]
67+
6368 }
6469
6570 [ StructLayout ( LayoutKind . Sequential , Pack = 1 ) ]
@@ -78,6 +83,12 @@ public class _HWiNFO_ELEMENT
7883 public double ValueMin ;
7984 public double ValueMax ;
8085 public double ValueAvg ;
86+
87+ // Version 2+ new:
88+ [ MarshalAs ( UnmanagedType . ByValTStr , SizeConst = HWINFO_SENSORS_STRING_LEN ) ]
89+ public string utfLabelUser ; // Label displayed, which might be translated or renamed by user [UTF-8 string]
90+ [ MarshalAs ( UnmanagedType . ByValTStr , SizeConst = HWINFO_UNIT_STRING_LEN ) ]
91+ public string utfUnit ; // e.g. "RPM" [UTF-8 string]
8192 }
8293
8394 public class ElementObj
@@ -398,12 +409,18 @@ private static void ReadSensors(MemoryMappedFile mmf, _HWiNFO_SHARED_MEM hWiNFOM
398409
399410 if ( ! FullSensorData . ContainsKey ( index ) )
400411 {
412+ var sensorName = structure . SensorNameUser ;
413+ if ( hWiNFOMemory . Version > 1 )
414+ {
415+ sensorName = structure . utfSensorNameUser ;
416+ }
417+
401418 var sensor = new SensorObj
402419 {
403420 SensorId = structure . SensorId ,
404421 SensorInstance = structure . SensorInstance ,
405422 SensorNameOrig = structure . SensorNameOrig ,
406- SensorNameUser = structure . SensorNameUser ,
423+ SensorNameUser = sensorName ,
407424 Elements = new Dictionary < string , ElementObj > ( )
408425 } ;
409426
@@ -444,15 +461,27 @@ private static void ReadElements(MemoryMappedFile mmf, _HWiNFO_SHARED_MEM hWiNFO
444461
445462 var elementKey = sensor . SensorId + "-" + sensor . SensorInstance + "-" + structure . ElementId ;
446463
464+ var unit = structure . Unit ;
465+ if ( hWiNFOMemory . Version > 1 )
466+ {
467+ unit = structure . utfUnit ;
468+ }
469+
470+ var label = structure . LabelUser ;
471+ if ( hWiNFOMemory . Version > 1 )
472+ {
473+ label = structure . utfLabelUser ;
474+ }
475+
447476 var element = new ElementObj
448477 {
449478 ElementKey = elementKey ,
450479
451480 SensorType = structure . SensorType ,
452481 ElementId = structure . ElementId ,
453482 LabelOrig = structure . LabelOrig ,
454- LabelUser = structure . LabelUser ,
455- Unit = structure . Unit ,
483+ LabelUser = label ,
484+ Unit = unit ,
456485 NumericValue = ( float ) RoundValue ( structure . SensorType , structure . Unit , structure . Value ) ,
457486 Value = NumberFormat ( structure . SensorType , structure . Unit , structure . Value ) ,
458487 ValueMin = NumberFormat ( structure . SensorType , structure . Unit , structure . ValueMin ) ,
0 commit comments