RRUZ / tsmbios

Library to access the SMBIOS using Object Pascal (Delphi, FPC).
https://theroadtodelphi.wordpress.com/
202 stars 72 forks source link

access violation in TProcessorInformation.ProcessorManufacturerStr #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Some of my clients are reporting that they get access violation.

I tried asking one of the clients to help me debug this and i narrowed it down 
to:

TProcessorInformation.ProcessorManufacturerStr

specifically @RAWProcessorInformation^ is throwing access violation in that 
function.

The user has Windows 8 (64-bit) build 9200

I put {$DEFINE NOGENERICS} and commented out the {$DEFINE USEWMI}, but still 
same issue.

Original issue reported on code.google.com by swanty...@gmail.com on 4 Apr 2014 at 9:39

GoogleCodeExporter commented 9 years ago
I cannot reproduce the issue, In Windows 8. Can you use the TSMBios.SaveToFile 
method to dump the SMBIOS data and then send that file?

Original comment by Rodrigo.Ruz.V@gmail.com on 4 Apr 2014 at 5:25

GoogleCodeExporter commented 9 years ago

Original comment by swanty...@gmail.com on 5 Apr 2014 at 2:02

Attachments:

GoogleCodeExporter commented 9 years ago
I tried with the dump file, but not exception was raised. Which version of 
Delphi are you using?

Original comment by Rodrigo.Ruz.V@gmail.com on 8 Apr 2014 at 3:31

GoogleCodeExporter commented 9 years ago
Weird.
I'm using Embarcadero RAD Studio XE3 (update 2) Version 17.0.4770.56661

My test code:
-------------
var
  SMBios  : TSMBios;
  LProcessorInfo : TProcessorInformation;
begin
  SMBios := TSMBios.Create('smbiosdmp.dat');
  try
    if SMBios.HasProcessorInfo then
    begin
      for LProcessorInfo in SMBios.ProcessorInfo do
      begin
        try
          Memo1.Lines.Add(LProcessorInfo.ProcessorManufacturerStr);
          IntToStr(1);
        except
          on E: Exception do
          begin
            IntToStr(1);
          end;
        end;
      end;
    end;
  finally
    SMBios.Free;
  end;
end;
-------------
Those IntToStr are there so I can set breakpoints.

Original comment by swanty...@gmail.com on 8 Apr 2014 at 5:29

GoogleCodeExporter commented 9 years ago
Okay I believe I have found the problem in your code.

uSMBIOS.pas

Change all "LIndex:=0;" to "LIndex:=-1;" in
procedure TSMBios.ReadSMBiosTables

The smbios file I provided previously has processor information as first table, 
but your code assumes every table except BiosInformation and SystemInformation 
are not the first table judging by the LIndex values.

Original comment by swanty...@gmail.com on 8 Apr 2014 at 12:19

GoogleCodeExporter commented 9 years ago
Thanks very much, for your time finding the issue. 

Original comment by Rodrigo.Ruz.V@gmail.com on 10 Apr 2014 at 1:27

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r107.

Original comment by Rodrigo.Ruz.V@gmail.com on 10 Apr 2014 at 1:28

GoogleCodeExporter commented 9 years ago
Uh, you forgot to set LIndex to -1 for FSystemSlotInfo.

Original comment by swanty...@gmail.com on 10 Apr 2014 at 9:15