Re: Postmaster service code

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Laurent Ballester" <postgresql(dot)ballester(at)wanadoo(dot)fr>, "Darko Prenosil" <Darko(dot)Prenosil(at)finteh(dot)hr>, "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk>, <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: Postmaster service code
Date: 2004-05-09 17:41:16
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCE17167B@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers-win32

>Yes, we need to create and register a tiny DLL to avoid to have error
>message joined to our log message such as describe Dave in
>it's previous mail.
>
>By studing the works made by Claudio, a simple way to achieve
>this work it
>to create a message wich contains only %1 like the mc file
>i'am attached
>with this post, and to modify a little bit the write_eventlog
>function he
>made (4 parameters of ReportEvent have to change to 0 with
>0x00000001L or
>PGWIN32_EVENTLOG_MSG in my sample).

Yes, this is exactly what I had in mind whien I did the eventlogging
code. Except can't you keep using msgid 0? Or is it prohibited? (I
thought I had used 0 in a previous project, but my memory may be a bit
off)
If we can go with 0 I think we should - it seems more appropriate,
especialy in case we evern want to map error codes to eventids.

>To obtain a DLL, we need Microsoft MC Compiler to create a RC
>file and after
>we can finish the compilation with Msys tools.

Question: Doesn't MC also generate a .bin-file? IIRC, the .RC file is
just a reference to the .BIN?

If not, then it's an easy go - I suggest we put both the .RC and the .MC
file in, so things will still build fully from mingw. If not, I don't
know what the deal is about binary files - could we stuff a
pre-generated .BIN file in CVS? [I know cvs can, but is that acceptable
in postgresql?]

>To finish, we have to register the DLL in
>HKEY_LOCAL_MACHINE\system\CurrentControlSet\Services\EventLog\A
>pplication
>Create a entry name PostGreSQL, add a key EventMessageFile set
>it with the
>full path of the DLL
>two issues : made this job by setup program or by
>write_eventlog() itself.

write_eventlog() cannot do this, since the postmaster will run as a
non-administrator, and thus not have permissions under that key.
The installation program should normally do this.

I would suggest implementing the DllRegisterServer() and
DllUnRegisterServer() entrypoint in a small C file that is compiled into
the DLL. That way, a user can just run "regsvr32 pgevent.dll" (or
whatever it's called).
See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/htm
/cmf_d2l_3cmq.asp

>Do you know, where will be the right place to put these files and
>update/create a Makefile

I would suggest creating "bin/pgevent". Comments?

//mha

Responses

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Thomas Kellerer 2004-05-09 18:00:22 JDBC problem/question
Previous Message Andrew Dunstan 2004-05-09 12:16:02 Re: mingw configure failure detection