15. juni 2002 - 00:24Der er
10 kommentarer og 1 løsning
mbm shared memory 5.1.9.x
Nogen der ud fra denne side, kan fortælle mig hvordan jeg henter værdier ud fra mbm shared memory ? har lavet det i 5.0.1.x engang, men strukturen er ændret, og jeg kan ikke få det her til at compile.
type TBusType = (btISA,btSMBus,btVIA686ABus,btDirectIO); TSMBType = (smtSMBIntel,smtSMBAMD,smtSMBALi,smtSMBNForce,smtSMBSIS); TSensorType = (stUnknown,stTemperature,stVoltage,stFan,stMhz,stPercentage);
TSharedIndex = record iType : TSensorType; // type of sensor Count : integer; // number of sensor for that type end;
TSharedSensor = record ssType : TSensorType; // type of sensor ssName : array [0..11] of AnsiChar; // name of sensor ssCurrent : Double; // current value ssLow : Double; // lowest readout ssHigh : Double; // highest readout ssCount : LongInt; // total number of readout ssTotal : Extended; // total amout of all readouts ssAlarm1 : Double; // temp & fan: low alarm; voltage: % off; ssAlarm2 : Double; // temp: high alarm end;
TSharedInfo = record siSMB_Base : Word; // SMBus base address siSMB_Type : TBusType; // SMBus/Isa bus used to access chip siSMB_Code : TSMBType; // SMBus sub type, Intel, AMD or ALi siSMB_Addr : Byte; // Address of sensor chip on SMBus siSMB_Name : array [0..40] of AnsiChar; // Nice name for SMBus siISA_Base : Word; // ISA base address of sensor chip on ISA siChipType : Integer; // Chip nr, connects with Chipinfo.ini siVoltageSubType : Byte; // Subvoltage option selected end;
TSharedData = record sdVersion : Double; // version number (example: 51090) sdIndex : array [0..9] of TSharedIndex; // Sensor index sdSensor : array [0..99] of TSharedSensor; // sensor info sdInfo : TSharedInfo; // misc. info sdStart : array [0..40] of AnsiChar; // start time sdCurrent : array [0..40] of AnsiChar; // current time sdPath : array [0..255] of AnsiChar; // MBM path end; pSharedData = ^TSharedData;
procedure TForm1.FormCreate(Sender: TObject); var Size : Integer; begin hSData:=OpenFileMapping(FILE_MAP_READ, False, '$M$B$M$5$S$D$'); if hSData = 0 then begin MessageDlg('Du er sq da en hest !.'+#13+ 'Er du sikker på det er det rigtige motherboard du har i din skod dunk ?'+#13+ 'Lige meget jeg kan ikke finde nogert info.'+#13+ 'Jeg skrider !', mtError, [mbOk], 0); Application.Terminate; end; Size := sizeof(TSharedData); SharedData := MapViewOfFile( hSData , FILE_MAP_READ, 0, 0, Size); //FILE_MAP_READ er et godt gæt //SharedData^.sdIndex bla bla bla ..... (* sdIndex[0].iType:=stTemperature; sdIndex[0].Count:=32 sdIndex[1].iType:=stVoltage; sdIndex[1].Count:=16 sdIndex[2].iType:=stFan; sdIndex[2].Count:=16 sdIndex[3].iType:=stMhz; sdIndex[3].Count:=1; sdIndex[4].iType:=stPercentage; sdIndex[4].Count:=NrCPU;
TSharedIndex = record iType : TSensorType; // type of sensor Count : integer; // number of sensor for that type end;
TSharedSensor = record ssType : TSensorType; // type of sensor ssName : array [0..11] of AnsiChar; // name of sensor sspadding1: array [0..2] of Char; // padding of 3 byte ssCurrent : Double; // current value ssLow : Double; // lowest readout ssHigh : Double; // highest readout ssCount : LongInt; // total number of readout sspadding2: array [0..3] of Char; // padding of 4 byte ssTotal : Extended; // total amout of all readouts sspadding3: array [0..5] of Char; // padding of 6 byte ssAlarm1 : Double; // temp & fan: high alarm; voltage: % off; ssAlarm2 : Double; // temp: low alarm end;
TSharedInfo = record siSMB_Base : Word; // SMBus base address siSMB_Type : TBusType; // SMBus/Isa bus used to access chip siSMB_Code : TSMBType; // SMBus sub type, Intel, AMD or ALi siSMB_Addr : Byte; // Address of sensor chip on SMBus siSMB_Name : array [0..40] of AnsiChar; // Nice name for SMBus siISA_Base : Word; // ISA base address of sensor chip on ISA siChipType : Integer; // Chip nr, connects with Chipinfo.ini siVoltageSubType : Byte; // Subvoltage option selected end;
TSharedData = record sdVersion : Double; // version number (example: 51090) sdIndex : array [0..9] of TSharedIndex; // Sensor index sdSensor : array [0..99] of TSharedSensor; // sensor info sdInfo : TSharedInfo; // misc. info sdStart : array [0..40] of AnsiChar; // start time sdCurrent : array [0..40] of AnsiChar; // current time sdPath : array [0..255] of AnsiChar; // MBM path end;
PSharedData = ^TSharedData;
var SharedIndex : TSharedIndex; SharedSensor : TSharedSensor; SharedInfo : TSharedInfo; SharedData : PSharedData; function gettemp(nr: integer):double; implementation
function gettemp(nr: integer):double; var myHandle : Integer; begin myHandle := OpenFileMapping(FILE_MAP_READ, False, '$M$B$M$5$S$D$'); if myHandle > 0 then begin SharedData := MapViewOfFile(myHandle, FILE_MAP_READ, 0, 0, 0); with SharedData^ do gettemp:=sdSensor[nr].ssCurrent; end else gettemp:=0; end; end.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.