Code: Select all
function THWInfo.StoragesInfo():AnsiString;
var
result : Integer;
cData : PChar;
dataLength: Integer;
begin
try
cData := PChar(LocalAlloc(LPTR, 32));
try
result := pHWInfo_StoragesInfo(cData, dataLength, @LoggerDll, @GetMemoryDll);
fLogString('pHWInfo_StorageInfo result: %x', [result]);
if Result = 0 then
begin
SetLength(data, dataLength);
Move(cData^, PChar(Data)^, dataLength);
end;
finally
localFree(Cardinal(cData));
end;
except
on E : Exception do
raise Exception.Create('StorageInfo ERROR. Exception: ' + E.Message);
end;
if result <> 0 then
raise Exception.Create('StorageInfo ERROR. failed: ' + IntToStr(result));
end;