我試圖從GPU-Z共享內存中讀取信息,但我做錯了什麼。我設法翻譯發佈在TechPowerUp論壇上的共享內存結構。我可以閱讀所有GPUZ_RECORD
但不是GPUZ_SENSOR_RECORD
。任何幫助都會有所幫助。謝謝!閱讀GPU-Z共享內存
以後編輯我:
如果我使用packet record
相反,我不`噸獲得AV了,但我還是不能讓傳感器信息。
稍後編輯II:
如果i從0到128(129種元素)讀出的data
,則元件128是第一傳感器,我可以看到正確的數據。 :(
const
MAX_RECORDS = 128;
GPUZ_RECORD = record
key: array[0..255] of WChar;
value: array[0..255] of WChar;
end;
GPUZ_SENSOR_RECORD = record
name: array[0..255] of WChar;
units: array[0..7] of WChar;
digits: Cardinal;
value: double;
end;
GPUZ_SH_MEM = record
version : Cardinal;
busy: Boolean;
lastUpdate: Cardinal;
data: array [0..MAX_RECORDS] of GPUZ_RECORD;
sensors: array [0..MAX_RECORDS] of GPUZ_SENSOR_RECORD;
end;
PGPUZ_SH_MEM = ^GPUZ_SH_MEM;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
procedure TMainForm.readSensors;
var
hMapFile: Thandle;
sKey, sVal: string;
GPUInfo: PGPUZ_SH_MEM;
s, d: integer;
begin
hMapFile := OpenFileMapping(FILE_MAP_READ, FALSE, 'GPUZShMem');
if hMapFile <> 0 then begin
log(['Mapping succesfully']);;
GPUInfo := MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, 0);
// ShowMessage(IntToStr(GetLastError));
if GPUInfo <> nil then begin
log([ GPUInfo^.version ]);
log([ GPUInfo^.busy ]);
log([ GPUInfo^.lastUpdate ]);
log(['LOGING DATA ~~~~~~~~~~~~~~~~~~~~~~']);
for d:= 0 to Pred(MAX_RECORDS) do begin
sKey := GPUInfo^.data[d].key;
sVal := GPUInfo^.data[d].value;
if sKey <> '' then log([d, '#: ', sKey, sVal ]);
end;
log(['LOGING SENSORS ~~~~~~~~~~~~~~~~~~~~']);
for s:= 0 to Pred(MAX_RECORDS) do begin
sKey := GPUInfo^.sensors[s].name; // i get an AV here when s:=127
log([ 'Sensor ', s, '#: ', sKey ]);
// sVal := TPN^.sensors[s].units;
// log([ 'Unit: ', sVal ]);
// log(['Digits: ', TPN^.sensors[s].digits ]);
// log(['Value: ', TPN^.sensors[s].value ]);
end;
end else log([ 'Could not map that zone!' ]);
end else begin
log(['Could not find the zone for mapping...']);
UnmapViewOfFile(GPUInfo);
CloseHandle(hMapFile);
end;
end;
日誌()是這樣定義的小程序:
procedure log(vData: array of Variant);
因此,GPU-Z是一個基準程序,你通過內存映射文件訪問共享內存?有點背景會讓你的問題變得不那麼神祕。你真的希望這裏的人能夠解釋你在說什麼嗎?幫助別人幫助你。 –
嗯,我認爲GPU-Z是一個非常知名的視頻卡信息程序,似乎我的假設是錯誤的,我很抱歉。我的問題是,由於某種原因,我無法讀取'GPUZ_SENSOR_RECORD'。也許我沒有正確地翻譯共享內存佈局。 –