Re: Postmaster service code - Mailing list pgsql-hackers-win32

From Dave Page
Subject Re: Postmaster service code
Date
Msg-id 03AF4E498C591348A42FC93DEA9661B889FCCF@mail.vale-housing.co.uk
Whole thread Raw
In response to Postmaster service code  ("Dave Page" <dpage@vale-housing.co.uk>)
List pgsql-hackers-win32

> -----Original Message-----
> From: Magnus Hagander [mailto:mha@sollentuna.net]
> Sent: 09 May 2004 18:41
> To: Laurent Ballester; Darko Prenosil; Dave Page;
> pgsql-hackers-win32@postgresql.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.

pgsql-hackers-win32 by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: JDBC problem/question
Next
From: "Dave Page"
Date:
Subject: Re: Postmaster service code