|
#pragma once |
|
// HWiNFOSharedMem - Reverse engineered HWiNFO shared memory format |
|
// Copyright (C) 2020 namazso |
|
// |
|
// This program 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. |
|
// |
|
// This program 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 this program. If not, see <https://www.gnu.org/licenses/>. |
|
// |
|
// |
|
// Unfortunately the real HWiNFO interface headers are under some proprietary license, so this is a reimplementation |
|
// based on me looking at the shared section with ReClass and comparing it to "HWiNFO Shared Memory Viewer" |
|
|
|
#define HWiNFO_SHARED_MEM_PATH "Global\\HWiNFO_SENS_SM2" |
|
#define HWiNFO_SHARED_MEM_MUTEX "Global\\HWiNFO_SM2_MUTEX" |
|
#define HWiNFO_HEADER_MAGIC ((uint32_t)'SiWH') |
|
|
|
#define PACKED_STRUCT(...) __pragma(pack(push, 1)) __VA_ARGS__ __pragma(pack(pop)) |
|
|
|
PACKED_STRUCT(struct HWiNFOHeader |
|
{ |
|
/* 0x0000 */ uint32_t magic; // must be HWiNFO_HEADER_MAGIC |
|
/* 0x0004 */ uint32_t version; // 1 as of 6.40-4330 |
|
/* 0x0008 */ uint32_t version2; // 1 as of 6.40-4330 |
|
/* 0x000C */ int64_t last_update; // unix timestamp |
|
/* 0x0014 */ uint32_t sensor_section_offset; |
|
/* 0x0018 */ uint32_t sensor_element_size; |
|
/* 0x001C */ uint32_t sensor_element_count; |
|
/* 0x0020 */ uint32_t entry_section_offset; |
|
/* 0x0024 */ uint32_t entry_element_size; |
|
/* 0x0028 */ uint32_t entry_element_count; |
|
}); |
|
|
|
PACKED_STRUCT(struct HWiNFOSensor |
|
{ |
|
/* 0x0000 */ uint32_t id; |
|
/* 0x0004 */ uint32_t instance; |
|
/* 0x0008 */ char name_original[128]; |
|
/* 0x0088 */ char name_user[128]; |
|
}); |
|
|
|
enum class SensorType : uint32_t |
|
{ |
|
None, |
|
Temperature, |
|
Voltage, |
|
Fan, |
|
Current, |
|
Power, |
|
Clock, |
|
Usage, |
|
Other, |
|
}; |
|
|
|
PACKED_STRUCT(struct HWiNFOEntry |
|
{ |
|
/* 0x0000 */ SensorType type; |
|
/* 0x0004 */ uint32_t sensor_index; // !!! not id, this is an index into the other array |
|
/* 0x0008 */ uint32_t id; |
|
/* 0x000C */ char name_original[128]; |
|
/* 0x008C */ char name_user[128]; |
|
/* 0x010C */ char unit[16]; |
|
/* 0x011C */ double value; |
|
/* 0x0124 */ double value_min; |
|
/* 0x012C */ double value_max; |
|
/* 0x0134 */ double value_avg; |
|
}); |
what did you use that for, if i may ask?