Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006160 [JEDI VCL] 00 JVCL Components major always 2013-07-06 16:54 2017-04-20 11:19
Reporter Delphi86 View Status public  
Assigned To
Priority normal Resolution open  
Status confirmed   Product Version 3.47
Summary 0006160: JvNTEventLog shows wrong properties
Description Hello,
I'm new to this and not an Delphi expert, but I have found an Issue. This is some kind of unprofessional code, but shows the issue:

--- Delphi Code ---
  JvLog.Server := 'localhost';
  JvLog.Source := 'Security'; // System, Application
  JvLog.Open;
  JvLog.Last;
  ShowMessage(IntToStr(JvLog.EventRecord.ID) + ' | ' +
    JvLog.EventRecord.EventType + ' | ' + JvLog.EventRecord.Source + ' | ' +
    JvLog.EventRecord.Computer + ' | ' +
    IntToStr(JvLog.EventRecord.RecordNumber) + ' | ' +
    DateTimeToStr(JvLog.EventRecord.DateTime));
--- Delphi Code End ---

I just wanted to show some properties of the EventLog in a ShowMessage, but for the 3 logs Application, System and Security I got different properties. For Example "JvLog.EventRecord.Computer" shows the Computer name only in the Security log. In the other Logs the Source propertie holds my Computer name and in the System Log the name is cut off (Lukas-PC --> s-PC).It's hard to describe but I added a picture which should underline what I mean.

Thank you,
Lukas
Additional Information I don't know if there is an issue, but I had to covert the ID of the System and Application Log into hey code to cut off the flag and than convert it back to become the real ID. But sometimes the ID comes without a flag. So if I watch the EventLog and get the Event ID 1014 everything is okay. But when I get 1073748860 I have to convert it into hey code 40001B7C, cut off the flag (4000) and then convert it back 1B7C --> 7036. But how to make a difference between them, so Delphi knows which ID has a flag and which not. My first thought was to use the amount of digits but that's unsafe and I don't know how many flags exists and how long they are.
Tags No tags attached.
Attached Files ? file icon Issues.bmp [^] (455,382 bytes) 2013-07-06 16:54
rar file icon JvNTEventLog Demo.rar [^] (632,239 bytes) 2013-09-01 00:19
? file icon 0001-6160-TJvNTEventLog.patch [^] (140,770 bytes) 2013-09-02 14:16
? file icon 0002-6160-fixed-obtaining-user-name-and-SID.patch [^] (1,749 bytes) 2013-09-02 14:47
7z file icon JvNTEventLog Updated.7z [^] (93,350 bytes) 2013-09-02 14:49
? file icon 0003-jvcl_NTEventLog_Win32-only.patch [^] (2,432 bytes) 2013-10-08 17:11

- Relationships
parent of 0006209resolvedobones Package Generator (and JVCL Installer) treats win64 as win32 

-  Notes
(0020614)
Arioch (developer)
2013-08-31 04:16

Attach demo project please

Also, there is no such version as "Delphi86" - that is something bogus

PS. to post screenshots, better use PNG or GIF formats

> to cut off the flag and than convert it back to become the real ID

why do you think those were some flags (which flags? what do they mean, what do they describe?) and not real IDs (large ? yes, there are large numbers in computers...)

> first thought was to use the amount of digits but that's unsafe

True. You'd better read about binary operations.

For example you can use something like IntToStr(ID and not $F0000000) - but i also don't have a clue if that is correct or how many flags or if there are any flags at all.

See bitwise operators at http://docwiki.embarcadero.com/RADStudio/XE4/en/Expressions_(Delphi)#Logical_.28Bitwise.29_Operators [^]

See also http://en.wikipedia.org/wiki/Binary_number [^]
That is the basis of programming, unless some exotic ternary computers used
(0020618)
Delphi86 (reporter)
2013-09-01 00:19

> Attach demo project please

Done!

> Also, there is no such version as "Delphi86" - that is something bogus

Ops, where have I mentioned "Delphi86" as version? It's my username here, my Delphi Version is Rad Studio XE2, JVCL Version mentioned above.

> For example you can use something like IntToStr(ID and not $F0000000) - but i also don't have a clue if that is correct or how many flags or if there are any flags at all.

Works, thanks, my fault!



Still UserName/Computername does not work properly.
(0020619)
Delphi86 (reporter)
2013-09-01 00:24

Btw: OS: Win7 Prof. 64bit
(0020620)
Arioch (developer)
2013-09-01 12:52
edited on: 2013-09-01 12:53

Well, at work i also use w7x64 and xe2u4hf1
I also try to keep JVCL at git-master, so it maybe somewhat more recent than 3.47

OTOH this month would be very busy for me, so i cannot promise anything, but trying your demo project on my box

(0020621)
Arioch (developer)
2013-09-01 12:58

A bit of offtopic:

ShowMessage(IntToStr(JvLog.EventRecord.ID) + ' | ' +
     JvLog.EventRecord.EventType + ' | ' + JvLog.EventRecord.Source + ' | ' +
     JvLog.EventRecord.Computer + ' | ' +
     IntToStr(JvLog.EventRecord.RecordNumber) + ' | ' +
     DateTimeToStr(JvLog.EventRecord.DateTime));

i wonder if this would do the same but with easier to read (IMHO) code :-)

ShowMessage(
  JclStringsList.Add( [
     JvLog.EventRecord.ID, JvLog.EventRecord.EventType, JvLog.EventRecord.Source,
     JvLog.EventRecord.Computer, JvLog.EventRecord.RecordNumber, JvLog.EventRecord.DateTime
  ]).Join(' | ')
);
(0020625)
jfudickar (developer)
2013-09-01 21:46

Looks better!
Interesting type of code, The option would be to use Format
(0020626)
Arioch (developer)
2013-09-02 14:07
edited on: 2013-09-02 14:50

This god-forgotten component could easily blow the stack ever since Delphi 2009

It does not support new rich event sources introduce by Vista and Win2008 Server

It only partially supports classic Win2K/XP event messages.

Messages are not supported on Win64

Should rather it be just removed from JVCL ? This component is a kind of whit elephant (a little one, but still). Or perhaps "handle-less suitcase".

(0020627)
Arioch (developer)
2013-09-02 14:11
edited on: 2013-09-02 14:51

Delphi86 - try new code.

And yes, those were not flags but an integral part of IDs.
Event ID is not a plain integer but a structure.

So "ID and not $F0000000:" that you show is not ID at all.

http://msdn.microsoft.com/en-us/library/aa363651(v=vs.85).aspx [^]

(0020628)
Arioch (developer)
2013-09-02 14:16

Cannot make pull request due to Git CR/LF issues.
Please, someone, apply the patch.
(0020656)
Arioch (developer)
2013-10-08 16:46

Delphi86, did you tried this ? Do you still have problems ?
(0020658)
Delphi86 (reporter)
2013-10-09 21:35

No, I haven't tried this yet. I'm currently working on an exam over a longer period of time and had no time. I solved my problem using WMI. But I will try this in the next two weeks, WMI isn't a good solution.
(0020681)
Delphi86 (reporter)
2013-10-22 23:19

Finished my stuff. Can work on this problem. So... What shall I do exactly. Tried it with the latest development snapshot (3.48). Still the same issue. Sorry, but I haven't worked with Delphi in the last months. I'm totally out of practice :(
(0020682)
Arioch (developer)
2013-10-23 08:27

This was not merged into trunk, at least not until something would really test it. Sincerely i don't know if jfudickar is part of the team. If not, then maybe none of the team read this yet.

There i think nothing changed in this regard in dailies. You can compare JvNTEvents.pas of this daily and your prior one. Or even easier, right-click on JvNTEvents.pas and go menu Tortoise Git -> history and see if any changes were made since day you registered this ticker.

Somewhat reworked module and demo are attached to this ticket, either in format of patches or as 7z blob. Take what suits you best and try them.
(0020683)
Delphi86 (reporter)
2013-10-23 19:15

Ah, I havent's seen that there have been added attachments. This is my first ticket, so I'm not familiar with this.

But yes, your updated JvNTEvents.pas worked for me. But how to use the patches? Neber worked with such files.
(0020685)
Arioch (developer)
2013-10-24 08:18

Well, those patch-files were created by Git and contain references to Git history, so i don't actually know if you can apply them automatically without having Git installed. Maybe tools like KDiff3, WinMerge, DiffMerge and similar can be used to some extent. Or you just can read those patch files yourselves and see the changes, which then you'd manually apply.
(0021424)
Pannier (reporter)
2017-04-20 11:19

Hello, I had the same problem. JvNTEventLog Updated.7z worked except the MessageText is wrong.
This changes are not in the latest repo. Is this right?

- Issue History
Date Modified Username Field Change
2013-07-06 16:54 Delphi86 New Issue
2013-07-06 16:54 Delphi86 File Added: Issues.bmp
2013-08-31 04:16 Arioch Note Added: 0020614
2013-08-31 04:16 Arioch Status new => feedback
2013-09-01 00:19 Delphi86 Note Added: 0020618
2013-09-01 00:19 Delphi86 File Added: JvNTEventLog Demo.rar
2013-09-01 00:20 Delphi86 Issue Monitored: Delphi86
2013-09-01 00:20 Delphi86 Issue End Monitor: Delphi86
2013-09-01 00:24 Delphi86 Note Added: 0020619
2013-09-01 12:52 Arioch Note Added: 0020620
2013-09-01 12:53 Arioch Note Edited: 0020620
2013-09-01 12:58 Arioch Note Added: 0020621
2013-09-01 21:46 jfudickar Note Added: 0020625
2013-09-02 14:07 Arioch Note Added: 0020626
2013-09-02 14:07 Arioch Status feedback => confirmed
2013-09-02 14:10 Arioch File Added: JvNTEventLog Updated.7z
2013-09-02 14:11 Arioch Note Added: 0020627
2013-09-02 14:16 Arioch Note Added: 0020628
2013-09-02 14:16 Arioch File Added: 0001-6160-TJvNTEventLog.patch
2013-09-02 14:18 Arioch Note Edited: 0020627
2013-09-02 14:47 Arioch File Added: 0002-6160-fixed-obtaining-user-name-and-SID.patch
2013-09-02 14:49 Arioch File Deleted: JvNTEventLog Updated.7z
2013-09-02 14:49 Arioch File Added: JvNTEventLog Updated.7z
2013-09-02 14:50 Arioch Note Edited: 0020626
2013-09-02 14:51 Arioch Note Edited: 0020627
2013-10-08 16:45 Arioch Relationship added parent of 0006209
2013-10-08 16:46 Arioch Note Added: 0020656
2013-10-08 17:11 Arioch File Added: 0003-jvcl_NTEventLog_Win32-only.patch
2013-10-09 21:35 Delphi86 Note Added: 0020658
2013-10-22 23:19 Delphi86 Note Added: 0020681
2013-10-23 08:27 Arioch Note Added: 0020682
2013-10-23 19:15 Delphi86 Note Added: 0020683
2013-10-24 08:18 Arioch Note Added: 0020685
2017-04-20 11:19 Pannier Note Added: 0021424


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker