Can't blame you for missing the original e-mail, the lists at ActiveState
have never been very reliable for me either.  I didn't receive a copy of
Dax's e-mail requesting code samples, so I'm glad that a couple of you
replied to him so I would know about it.  I hope that someone from
ActiveState will look into the very spotty performance of their list
server(s). (hint, hint)

My original question explained that I could make my program work using
Win32::EventLog::Message, but that ::Message was less than ideal for a
couple of reasons: (1) ::Message allows for use of only Event ID 1, but I
want to use many different Event IDs in order to more specifically define an
event; (2) I was entirely unsure of how reliable ::Message would be when
used in my published PerlSvc application -- the module is pretty long in the
tooth and Dave Roth doesn't seem to make himself available any longer.

So I rolled my own.  I wrote a little script to generate a message text file
with Event IDs from zero to 65,535:

<http://www.acornnetsec.com/perl/CreateMessageTextFile.pl>

That script created this barebones messages.mc file for me to compile:

<http://www.acornnetsec.com/perl/messages.mc>

I used the tools in the Windows SDK to compile messages.mc into msg.dll:

mc messages.mc
rc -r messages.rc
link -machine:i386 -dll -noentry -out:msg.dll messages.res

I ended up with this generic DLL that allows me to use any legal Event ID,
and passes any given string message to the created event:

<http://www.acornnetsec.com/perl/msg.dll>

Using the information in the referenced PerlMonks article, I wrote a wrapper
module for Win32::EventLog that registers a message DLL to a given source,
deletes a source registration, or creates a new event:

<http://www.acornnetsec.com/perl/WEL.pm>

Then I wrote a simple test script:

<http://www.acornnetsec.com/perl/EventLogTest.pl>

And that's pretty much it, boys and girls.  I tried to document everything
in my code, but please let me know if I need to clarify anything.

-Brian


-----Original Message-----
From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
David Dick
Sent: Tuesday, June 23, 2009 05:06
To: perl-win32-users@listserv.ActiveState.com
Subject: Re: Registering message DLL for Win32::EventLog

On 23/06/09 15:15, Dax T. Games wrote:
> You could also have used Win32::Eventlog::Message.
>
> Much easier, less hassle. If you could post working samples of code I
would appreciate it.  I never could get the perlmonks linked  info to work
properly for me.
>
>    
I missed the original email, but i did a talk covering this last year.  
I spent a bit of time making sure that the EventLog code worked.  You 
can find it at 
http://perl.net.au/wiki/Melbourne_Perl_Mongers/Meeting_History_2008_07#Log_M
essages


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to