Re: Postmaster service code

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

> -----Original Message-----
> From: Magnus Hagander [mailto:mha(at)sollentuna(dot)net]
> Sent: 09 May 2004 18:41
> To: Laurent Ballester; Darko Prenosil; Dave Page;
> pgsql-hackers-win32(at)postgresql(dot)org
> Subject: RE: [pgsql-hackers-win32] Postmaster service code
>
> 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

I wonder if this should also be added to the service install code so at
least it is done automatically when that is run. I used the following in
the autovacuum daemon:

/*
* Set the Event source for the application log
*/
sprintf(szKey,
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\PostgreSQL
Auto Vacuum");
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hk, NULL)) return -5;

sprintf(szMsgDLL, "pgmessages.dll");
if (RegSetValueEx(hk, "EventMessageFile", 0, REG_EXPAND_SZ,
(LPBYTE)szMsgDLL, (DWORD)strlen(szMsgDLL)+1)) return -6;

And to remove it again


/*
* Remove the Event source from the application log
*/
sprintf(szKey,
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application");
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_ALL_ACCESS,
&hk)) return -4;
if (RegDeleteKey(hk, "PostgreSQL Auto Vacuum")) return -5;

> >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?

Sounds OK to me.

Regards, Dave.

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Dave Page 2004-05-10 08:18:23 Re: Postmaster service code
Previous Message Andrew Dunstan 2004-05-10 07:17:46 Re: mingw configure failure detection