View Issue Details

IDProjectCategoryView StatusLast Update
0002889JEDI VCL00 JVCL Componentspublic2006-06-07 03:46
ReporterdbondAssigned Toobones 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.00 
Target VersionFixed in Version3.30 
Summary0002889: Access Violation with JvNTEventLog
DescriptionThe JvNTEventLog component repeatedly causes an access violation when used to access the local client 'System' Event log (see attached "JvNTEventLog-ScreenShot.gif"). The project used was the distributed example "JVCL\examples\JvNTEventLog\EventViewer.dpr".

Error appears to be generated by line 510 of "JvNTEventLog.pas":
" if LookupAccountSID(nil, SID, UserName, UserNameLen, DomainName, DomainNameLen, Use) then
    Result := string(DomainName) + '\' + string(UserName);"
in "function TJvNTEventLogRecord.GetUsername: string;"

Error Message =
"Project EventViewer.exe raised exception class EAccessViolation with message 'Access violation address 77E7F912 in module 'RPCRT4.dll'.
Read of address 00934000'. Process stopped. Use Step or Run to continue."

RPCRT4.dll has file version "5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)" (Creation Date 10 December 2004).
Additional InformationClient/Build Operating System=Windows XP Pro (Build 2600: Service Pack 2)
Compiler=Delphi 7.0 Enterprise (Build 8.1)

JCL Build=JCL1.95-Build1848 (Clean Install)
JVCL Build=JVCL300CompleteJCL195-Build1848 (Clean Install)
TagsNo tags attached.

Relationships

related to 0002970 resolvedobones JvNTEventLog hangs if OnChange is assigned 

Activities

2005-04-20 03:49

 

obones

2005-04-22 06:30

administrator   ~0007045

Same here, under WinXP SP1, I'm looking into it.

obones

2005-04-22 07:15

administrator   ~0007046

This seems to be a big bug with the LookupAccountSID function as if you pass it 0 for the lenghts of the parameters, it does return False, but does not fill up the parameters with the required lengths.
Further, it sometimes fails at item 263, then 1252...
I'm not clear as to what I can do about this.

obones

2006-03-30 07:35

administrator   ~0008764

Could you try again with a patched windows and the latest version of the JVCL?
I tried here compiled with BDS2006 and I don't get an AV anymore.

dbond

2006-04-06 06:28

reporter   ~0009008

Hi there, tried with Windows XP SP2 fully patched, and JVCL 3.2 (still using Delphi Enterprise Version 7 Build 8.1) - problem still there.

vorxio

2006-05-10 09:22

reporter   ~0009270

Hi,
I SOLVED the problem:

function TJvNTEventLogRecord.GetSID: PSID;
begin
  if PEventLogRecord(FCurrentRecord)^.UserSidLength = 0 then
    Result := nil
  else
    Result := PSID( PChar(FCurrentRecord) + PEventLogRecord(FCurrentRecord)^.UserSidOffset);
end;


function TJvNTEventLogRecord.GetUsername: string;
...
...

  if SID = nil then // SID can be nil
  begin
    Result := 'N/A';
    Exit;
  end;

  try
    if LookupAccountSID(nil, SID, UserName, UserNameLen, DomainName, DomainNameLen, Use) then
      Result := string(DomainName) + '\' + string(UserName);
  except
    result := '???';
  end;
end;

Bye,
  Vor

vorxio

2006-05-10 09:26

reporter   ~0009271

Reminder sent to: dbond, obones

I solved 0002889

Bye

dbond

2006-05-10 10:47

reporter   ~0009272

Hi all,
Yes, the fix from Vorxio fixed the problem - I managed to compile a couple of test programs looking at different logs with no issues.
Many thanks to all involved (especially Vorxio) for all their hard work.
Cheers,
David

obones

2006-06-07 03:46

administrator   ~0009406

This is now fixed in SVN

Issue History

Date Modified Username Field Change
2005-04-20 03:49 dbond New Issue
2005-04-20 03:49 dbond File Added: JvNTEventLog-ScreenShot.gif
2005-04-22 06:30 obones Note Added: 0007045
2005-04-22 06:30 obones Status new => confirmed
2005-04-22 07:15 obones Note Added: 0007046
2005-05-20 08:02 obones Relationship added has duplicate 0002970
2005-05-20 08:03 obones Relationship deleted has duplicate 0002970
2005-05-20 08:03 obones Relationship added related to 0002970
2006-03-30 07:35 obones Note Added: 0008764
2006-03-30 07:35 obones Status confirmed => feedback
2006-04-06 06:28 dbond Note Added: 0009008
2006-05-10 09:22 vorxio Note Added: 0009270
2006-05-10 09:26 vorxio Note Added: 0009271
2006-05-10 10:47 dbond Note Added: 0009272
2006-06-07 03:46 obones Status feedback => resolved
2006-06-07 03:46 obones Resolution open => fixed
2006-06-07 03:46 obones Assigned To => obones
2006-06-07 03:46 obones Note Added: 0009406