-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetCoreTempInfoDelphi.pas
More file actions
72 lines (59 loc) · 1.66 KB
/
GetCoreTempInfoDelphi.pas
File metadata and controls
72 lines (59 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Core Temp shared memory reader for Delphi
// Author: Michal Kokorceny
// Web: http://74.cz
// E-mail: michal@74.cz
//
// Core Temp project home page:
// http://www.alcpu.com/CoreTemp
unit GetCoreTempInfoDelphi;
interface
{$IFDEF MSWINDOWS}
type
CORE_TEMP_SHARED_DATA = packed record
uiLoad: packed array [0 .. 255] of Cardinal;
uiTjMax: packed array [0 .. 127] of Cardinal;
uiCoreCnt: Cardinal;
uiCPUCnt: Cardinal;
fTemp: packed array [0 .. 255] of Single;
fVID: Single;
fCPUSpeed: Single;
fFSBSpeed: Single;
fMultipier: Single;
sCPUName: packed array [0 .. 99] of AnsiChar;
ucFahrenheit: ByteBool;
ucDeltaToTjMax: ByteBool;
end;
function fnGetCoreTempInfo(out Data: CORE_TEMP_SHARED_DATA): Boolean;
{$ENDIF}
implementation
{$IFDEF MSWINDOWS}
uses
Windows;
const
CoreTempSharedArea = 'CoreTempMappingObject';
function fnGetCoreTempInfo(out Data: CORE_TEMP_SHARED_DATA): Boolean;
var
HCoreTempSharedArea: Cardinal;
PCoreTempSharedArea: Pointer;
begin
Result := False;
HCoreTempSharedArea := OpenFileMapping(FILE_MAP_READ, True,
CoreTempSharedArea);
if HCoreTempSharedArea <> 0 then
try
PCoreTempSharedArea := MapViewOfFile(HCoreTempSharedArea, FILE_MAP_READ,
0, 0, SizeOf(Data));
if Assigned(PCoreTempSharedArea) then
try
FillChar(Data, SizeOf(Data), 0);
Move(PCoreTempSharedArea^, Data, SizeOf(Data));
Result := True;
finally
UnmapViewOfFile(PCoreTempSharedArea);
end;
finally
CloseHandle(HCoreTempSharedArea);
end;
end;
{$ENDIF}
end.