Shared Memory

One of the most common ways to share information between Windows applications is shared memory. AIDA64 Extreme Edition hardware monitoring module uses the shared memory named AIDA64_SensorValues

The shared memory content is a long string value closed with a 0×00 char, making it a classic PChar or char*

The string is made of XML tags, but it’s not a complete XML document. It includes all temperature, cooling fan and voltage values AIDA64 measures. Temperatures are always in Celsius, regardless of the Fahrenheit display setting in AIDA64 Preferences. Sensor value labels are always in English, they’re not localized.

The buffer size (ie. the size of the shared memory block) should be at least 10 KB. A typical buffer size is around 1 to 3 KB, but for e.g. Abit MicroGuru 2005 based boards it may be a lot more.

The shared memory content can be read by using a similar code like the following Delphi procedure:



Const

sharedmem_name = ’AIDA64_SensorValues’;

Function ExtApp_SharedMem_ReadBuffer(bu:PChar;bu_size:DWord):Boolean;

Var

mappedData : PChar;

th : THandle;

Begin

Result:=False;


th:=OpenFileMapping(FILE_MAP_READ,False,sharedmem_name);


If th<>INVALID_HANDLE_VALUE Then

Begin


mappedData:=MapViewOfFile(th,FILE_MAP_READ,0,0,0);


If mappedData<>Nil Then


Begin



StrLCopy(bu,mappedData,bu_size);



If UnmapViewOfFile(mappedData) Then Result:=True;


End;


CloseHandle(th);

End;
End;


An example output for the shared memory content:

Aida64 extapp sharedmem Shared Memory

Shared Memory