Re: [PATCHES] eventlog fix

2004-06-20 Thread Laurent Ballester
Hello,

I downloaded and compiled all files you store in CVS pgevent directory and
it works.

Following the discusion posted yesterday, I made a test with SimpleMC a
alternative MC compiler ( http://www.volny.cz/xnavara/SimpleMC.zip) but
unfortunatelly it doesn't works MSG0001.bin file generated are differents
and consequently Messages are seing missing for Windows eventviewer.

regards
Laurent Ballester

- Original Message - 
From: Bruce Momjian [EMAIL PROTECTED]
To: Laurent Ballester [EMAIL PROTECTED]
Cc: Alvaro Herrera [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Sunday, June 20, 2004 3:33 AM
Subject: Re: [PATCHES] eventlog fix



 Patch applied, with doc additions I already posted.  Please test CVS and
 let me know how it works.  I added a README containing your explaination
 below for our later reference.  I added the MSG01.bin as a binary
 CVS checkin.



---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [PATCHES] eventlog fix

2004-06-19 Thread Laurent Ballester
Hello,

I just looking under CVS web interface what is stored in pgevent directory
and what is missing.

The files attached with this mail have to be stored in pgevent directory.
MSG01.bin is a bin files, result of Microsoft MC compiler. MC compiler
can be downloaded for free with MS Core SDK but it is not included with MSYS
tools and I didn't find a alternative way to compile MC file.

To summarize MC pgmsgevent.mc command generates pgmsgevent.h pgmsgevent.rc
and MSG1.bin files.
In MC file, we declare a string with %s format, so we can write anything we
want in the future without need to change the definition of this string.

To finish, because DllUnregisterServer and DllRegisterServer are system
defined entry point, we need to export these two functions with their names
without decoration, so we cannot uses auto generated .def files without
handy modifications.

regards
Laurent Ballester

- Original Message - 
From: Bruce Momjian [EMAIL PROTECTED]
To: Laurent Ballester [EMAIL PROTECTED]
Cc: Alvaro Herrera [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Saturday, June 19, 2004 7:13 AM
Subject: Re: [PATCHES] eventlog fix



 OK, I have created the following diff to document the pgevent
 installation instructions.  However, you didn't send me a Makefile for
 creating the DLL, and I am not sure how to do that.  Would you send me a
 `Makefile for src/bin/pgevent?  Thanks.

LANGUAGE 0x9,0x1
1 11 MSG1.bin


Makefile
Description: Binary data


MSG1.bin
Description: Binary data
/*-
 *
 * pgevent.c
 *  Defines the entry point for pgevent dll.
 *  The DLL defines event source for backend
 *
 *
 * IDENTIFICATION
 *$PostgreSQL$
 *
 *-
 */


#include windows.h
#include olectl.h
#include string.h

/* Global variables */
HANDLE g_module = NULL; /* hModule of DLL */

/* Prototypes */
STDAPI DllRegisterServer(void) ;
STDAPI DllUnregisterServer(void);
BOOL WINAPI DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved );

/*
 * DllRegisterServer --- Instructs DLL to create its registry entries 
 */

STDAPI DllRegisterServer(void) 
{
HKEY key; 
DWORD data; 
char buffer[_MAX_PATH]; 

/* Set the name of DLL full path name. */
if (!GetModuleFileName((HMODULE)g_module, buffer, sizeof(buffer)))
{
MessageBox(NULL, Could not retrieve DLL filename, PostgreSQL 
error, MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}

/* Add PostgreSQL source name as a subkey under the Application 
   key in the EventLog registry key. */
if ( RegCreateKey(HKEY_LOCAL_MACHINE, 
SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\PostgreSQL, key) ) 
{
MessageBox(NULL, Could not create the registry key., PostgreSQL error, 
MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}

 /* Add the name to the EventMessageFile subkey. */
if (RegSetValueEx(key,  
EventMessageFile, 
0,  
REG_EXPAND_SZ,
(LPBYTE) buffer,
strlen(buffer) + 1))
{
MessageBox(NULL, Could not set the event message file., PostgreSQL error, 
MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}
 
/* Set the supported event types in the TypesSupported subkey. */
data = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE; 
 
if (RegSetValueEx(key,  
TypesSupported,  
0, 
REG_DWORD, 
(LPBYTE) data,  
sizeof(DWORD)))
{
MessageBox(NULL, Could not set the supported types., PostgreSQL error, 
MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}
 
RegCloseKey(key); 
return S_OK;
}

/*
 * DllUnregisterServer --- Instructs DLL to remove only those entries created through 
DllRegisterServer
 */

STDAPI DllUnregisterServer(void)
{
/* Remove PostgreSQL source name as a subkey under the Application 
   key in the EventLog registry key. */
 
if ( RegDeleteKey(HKEY_LOCAL_MACHINE, 
SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\PostgreSQL) )
{
MessageBox(NULL, Could not delete the registry key., PostgreSQL 
error, MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}
return S_OK;
}

/*
 * DllMain --- is an optional entry point into a DLL.
 */

BOOL WINAPI DllMain( HANDLE hModule, 
 DWORD  ul_reason_for_call, 
 LPVOID lpReserved

Re: [PATCHES] eventlog fix

2004-06-19 Thread Bruce Momjian

Woh, we aren't requring MS C to compile this feature.  Can't it be
created by mingw?  If not, I don't see what value an MS C compile is
going to do for us.

---

Laurent Ballester wrote:
 Hello,
 
 I just looking under CVS web interface what is stored in pgevent directory
 and what is missing.
 
 The files attached with this mail have to be stored in pgevent directory.
 MSG01.bin is a bin files, result of Microsoft MC compiler. MC compiler
 can be downloaded for free with MS Core SDK but it is not included with MSYS
 tools and I didn't find a alternative way to compile MC file.
 
 To summarize MC pgmsgevent.mc command generates pgmsgevent.h pgmsgevent.rc
 and MSG1.bin files.
 In MC file, we declare a string with %s format, so we can write anything we
 want in the future without need to change the definition of this string.
 
 To finish, because DllUnregisterServer and DllRegisterServer are system
 defined entry point, we need to export these two functions with their names
 without decoration, so we cannot uses auto generated .def files without
 handy modifications.
 
 regards
 Laurent Ballester
 
 - Original Message - 
 From: Bruce Momjian [EMAIL PROTECTED]
 To: Laurent Ballester [EMAIL PROTECTED]
 Cc: Alvaro Herrera [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Saturday, June 19, 2004 7:13 AM
 Subject: Re: [PATCHES] eventlog fix
 
 
 
  OK, I have created the following diff to document the pgevent
  installation instructions.  However, you didn't send me a Makefile for
  creating the DLL, and I am not sure how to do that.  Would you send me a
  `Makefile for src/bin/pgevent?  Thanks.
 

[ Attachment, skipping... ]

[ Attachment, skipping... ]

[ Attachment, skipping... ]

[ Attachment, skipping... ]

[ Attachment, skipping... ]

[ Attachment, skipping... ]

[ Attachment, skipping... ]

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


Re: [PATCHES] eventlog fix

2004-06-19 Thread Magnus Hagander
We require the MS MC compiler to build the BIN file (note - this is
not C - this is the Message Compiler). The Ccode should compile fine
in mingw.

Not requiring it is the reason we'd include the .BIN file in CVS. MC is
only needed to *rebuild* it.

//Magnus


-Original Message-
From: Bruce Momjian [mailto:[EMAIL PROTECTED] 


Woh, we aren't requring MS C to compile this feature.  Can't it be
created by mingw?  If not, I don't see what value an MS C compile is
going to do for us.

---


Laurent Ballester wrote:
 Hello,
 
 I just looking under CVS web interface what is stored in 
pgevent directory
 and what is missing.
 
 The files attached with this mail have to be stored in 
pgevent directory.
 MSG01.bin is a bin files, result of Microsoft MC 
compiler. MC compiler
 can be downloaded for free with MS Core SDK but it is not 
included with MSYS
 tools and I didn't find a alternative way to compile MC file.
 
 To summarize MC pgmsgevent.mc command generates pgmsgevent.h 
pgmsgevent.rc
 and MSG1.bin files.
 In MC file, we declare a string with %s format, so we can 
write anything we
 want in the future without need to change the definition of 
this string.
 
 To finish, because DllUnregisterServer and DllRegisterServer 
are system
 defined entry point, we need to export these two functions 
with their names
 without decoration, so we cannot uses auto generated .def 
files without
 handy modifications.
 
 regards
 Laurent Ballester
 
 - Original Message - 
 From: Bruce Momjian [EMAIL PROTECTED]
 To: Laurent Ballester [EMAIL PROTECTED]
 Cc: Alvaro Herrera [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Saturday, June 19, 2004 7:13 AM
 Subject: Re: [PATCHES] eventlog fix
 
 
 
  OK, I have created the following diff to document the pgevent
  installation instructions.  However, you didn't send me a 
Makefile for
  creating the DLL, and I am not sure how to do that.  Would 
you send me a
  `Makefile for src/bin/pgevent?  Thanks.
 

[ Attachment, skipping... ]

[ Attachment, skipping... ]

[ Attachment, skipping... ]

[ Attachment, skipping... ]

[ Attachment, skipping... ]

[ Attachment, skipping... ]

[ Attachment, skipping... ]

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, 
Pennsylvania 19073

---(end of 
broadcast)---
TIP 1: subscribe and unsubscribe commands go to 
[EMAIL PROTECTED]


---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [PATCHES] eventlog fix

2004-06-19 Thread Andrew Dunstan
There is also this message compiler - I have no idea of the quality:
http://www.volny.cz/xnavara/SimpleMC.zip
I believe the WINE project also has one.
Putting the .bin file in CVS doesn't seem too horrible to me.
cheers
andrew
Magnus Hagander wrote:
We require the MS MC compiler to build the BIN file (note - this is
not C - this is the Message Compiler). The Ccode should compile fine
in mingw.
Not requiring it is the reason we'd include the .BIN file in CVS. MC is
only needed to *rebuild* it.
//Magnus
 

-Original Message-
From: Bruce Momjian [mailto:[EMAIL PROTECTED] 

Woh, we aren't requring MS C to compile this feature.  Can't it be
created by mingw?  If not, I don't see what value an MS C compile is
going to do for us.
---

Laurent Ballester wrote:
   

Hello,
I just looking under CVS web interface what is stored in 
 

pgevent directory
   

and what is missing.
The files attached with this mail have to be stored in 
 

pgevent directory.
   

MSG01.bin is a bin files, result of Microsoft MC 
 

compiler. MC compiler
   

can be downloaded for free with MS Core SDK but it is not 
 

included with MSYS
   

tools and I didn't find a alternative way to compile MC file.
To summarize MC pgmsgevent.mc command generates pgmsgevent.h 
 

pgmsgevent.rc
   

and MSG1.bin files.
In MC file, we declare a string with %s format, so we can 
 

write anything we
   

want in the future without need to change the definition of 
 

this string.
   

To finish, because DllUnregisterServer and DllRegisterServer 
 

are system
   

defined entry point, we need to export these two functions 
 

with their names
   

without decoration, so we cannot uses auto generated .def 
 

files without
   

handy modifications.
regards
Laurent Ballester
- Original Message - 
From: Bruce Momjian [EMAIL PROTECTED]
To: Laurent Ballester [EMAIL PROTECTED]
Cc: Alvaro Herrera [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Saturday, June 19, 2004 7:13 AM
Subject: Re: [PATCHES] eventlog fix

 

OK, I have created the following diff to document the pgevent
installation instructions.  However, you didn't send me a 
   

Makefile for
   

creating the DLL, and I am not sure how to do that.  Would 
   

you send me a
   

`Makefile for src/bin/pgevent?  Thanks.
   

[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
--
Bruce Momjian|  http://candle.pha.pa.us
[EMAIL PROTECTED]   |  (610) 359-1001
+  If your life is a hard drive, |  13 Roberts Road
+  Christ can be your backup.|  Newtown Square, 
Pennsylvania 19073

---(end of 
broadcast)---
TIP 1: subscribe and unsubscribe commands go to 
[EMAIL PROTECTED]

   

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
 

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [PATCHES] eventlog fix

2004-06-19 Thread Tom Lane
Magnus Hagander [EMAIL PROTECTED] writes:
 We require the MS MC compiler to build the BIN file (note - this is
 not C - this is the Message Compiler).

So is this tool readily available?  What does one have to do/buy to
lay hands on it?

 Not requiring it is the reason we'd include the .BIN file in CVS. MC is
 only needed to *rebuild* it.

I'd prefer to avoid having derived files like this in CVS.  We do not
keep any other derived files in CVS (except configure, which decision
seems more and more like a historical artifact).

regards, tom lane

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [PATCHES] eventlog fix

2004-06-19 Thread Dave Page
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Tom Lane
 Sent: 19 June 2004 20:03
 To: Magnus Hagander
 Cc: Bruce Momjian; Laurent Ballester; [EMAIL PROTECTED]
 Subject: Re: [PATCHES] eventlog fix 
 
 Magnus Hagander [EMAIL PROTECTED] writes:
  We require the MS MC compiler to build the BIN file (note 
 - this is 
  not C - this is the Message Compiler).
 
 So is this tool readily available?  What does one have to 
 do/buy to lay hands on it?

Download it from
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ (dunno how
that'll render outside of IE - it's part of an active setup thingy).
It's included with the Windows Platform SDK (which is free).

  Not requiring it is the reason we'd include the .BIN file 
 in CVS. MC 
  is only needed to *rebuild* it.
 
 I'd prefer to avoid having derived files like this in CVS.  
 We do not keep any other derived files in CVS (except 
 configure, which decision seems more and more like a 
 historical artifact).

It's a very large download to get the SDK (180MB) - that's a lot of
bandwidth for one little derived file that will almost certainly never
change.

Regards, Dave.

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [PATCHES] eventlog fix

2004-06-19 Thread Tom Lane
Dave Page [EMAIL PROTECTED] writes:
 So is this tool readily available?  What does one have to 
 do/buy to lay hands on it?

 It's included with the Windows Platform SDK (which is free).

Oh, good.

 It's a very large download to get the SDK (180MB) - that's a lot of
 bandwidth for one little derived file that will almost certainly never
 change.

Hm, that is a lot ... but wouldn't the sort of people interested in
hacking PG on Windows likely already have it?

If you think not, I'll withdraw my objection to keeping the .BIN in CVS,
but I'm just wondering whether we're worrying about something that
hackers would have anyway.

regards, tom lane

---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


Re: [PATCHES] eventlog fix

2004-06-19 Thread Dave Page
 

 -Original Message-
 From: Tom Lane [mailto:[EMAIL PROTECTED] 
 Sent: 19 June 2004 22:49
 To: Dave Page
 Cc: Magnus Hagander; Bruce Momjian; Laurent Ballester; 
 [EMAIL PROTECTED]
 Subject: Re: [PATCHES] eventlog fix 
 
 Hm, that is a lot ... but wouldn't the sort of people 
 interested in hacking PG on Windows likely already have it?
 
 If you think not, I'll withdraw my objection to keeping the 
 .BIN in CVS, but I'm just wondering whether we're worrying 
 about something that hackers would have anyway.

I have mc.exe, but only because I have paid for Visual Studio. I don't
have the platform SDK installed, however I cannot honestly say whether
or not I would have it if I didn't have VS. I would include the file in
CVS if it were my choice - it's clearly a pain to download the compiler
if you don't have it, and the file is unlikely to need updating in the
future - it was designed to be a generic DLL that just formats any
message as '%s'.

Regards Dave.

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])


Re: [PATCHES] eventlog fix

2004-06-19 Thread Bruce Momjian
Dave Page wrote:
  
 
  -Original Message-
  From: Tom Lane [mailto:[EMAIL PROTECTED] 
  Sent: 19 June 2004 22:49
  To: Dave Page
  Cc: Magnus Hagander; Bruce Momjian; Laurent Ballester; 
  [EMAIL PROTECTED]
  Subject: Re: [PATCHES] eventlog fix 
  
  Hm, that is a lot ... but wouldn't the sort of people 
  interested in hacking PG on Windows likely already have it?
  
  If you think not, I'll withdraw my objection to keeping the 
  .BIN in CVS, but I'm just wondering whether we're worrying 
  about something that hackers would have anyway.
 
 I have mc.exe, but only because I have paid for Visual Studio. I don't
 have the platform SDK installed, however I cannot honestly say whether
 or not I would have it if I didn't have VS. I would include the file in
 CVS if it were my choice - it's clearly a pain to download the compiler
 if you don't have it, and the file is unlikely to need updating in the
 future - it was designed to be a generic DLL that just formats any
 message as '%s'.

Agreed.  We have to include the .bin file because if we don't, we would
have an additional Win32 depenency beyond Mingw.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [PATCHES] eventlog fix

2004-06-19 Thread Bruce Momjian

Patch applied, with doc additions I already posted.  Please test CVS and
let me know how it works.  I added a README containing your explaination
below for our later reference.  I added the MSG01.bin as a binary
CVS checkin.

---

Laurent Ballester wrote:
 Hello,
 
 I just looking under CVS web interface what is stored in pgevent directory
 and what is missing.
 
 The files attached with this mail have to be stored in pgevent directory.
 MSG01.bin is a bin files, result of Microsoft MC compiler. MC compiler
 can be downloaded for free with MS Core SDK but it is not included with MSYS
 tools and I didn't find a alternative way to compile MC file.
 
 To summarize MC pgmsgevent.mc command generates pgmsgevent.h pgmsgevent.rc
 and MSG1.bin files.
 In MC file, we declare a string with %s format, so we can write anything we
 want in the future without need to change the definition of this string.
 
 To finish, because DllUnregisterServer and DllRegisterServer are system
 defined entry point, we need to export these two functions with their names
 without decoration, so we cannot uses auto generated .def files without
 handy modifications.
 
 regards
 Laurent Ballester
 
 - Original Message - 
 From: Bruce Momjian [EMAIL PROTECTED]
 To: Laurent Ballester [EMAIL PROTECTED]
 Cc: Alvaro Herrera [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Saturday, June 19, 2004 7:13 AM
 Subject: Re: [PATCHES] eventlog fix
 
 
 
  OK, I have created the following diff to document the pgevent
  installation instructions.  However, you didn't send me a Makefile for
  creating the DLL, and I am not sure how to do that.  Would you send me a
  `Makefile for src/bin/pgevent?  Thanks.
 

[ Attachment, skipping... ]

[ Attachment, skipping... ]

[ Attachment, skipping... ]

[ Attachment, skipping... ]

[ Attachment, skipping... ]

[ Attachment, skipping... ]

[ Attachment, skipping... ]

 
 ---(end of broadcast)---
 TIP 8: explain analyze is your friend

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [PATCHES] eventlog fix

2004-06-18 Thread Bruce Momjian

OK, I have created the following diff to document the pgevent
installation instructions.  However, you didn't send me a Makefile for
creating the DLL, and I am not sure how to do that.  Would you send me a
`Makefile for src/bin/pgevent?  Thanks.

---

Laurent Ballester wrote:
 Hello,
 
 
  We don't use this hungarian notation anywhere ... it certainly looks
  ugly.
 
 
 Sorry, I modify pgevent.c again and suppress all hungarian variables naming.
 
 I add a diff -c for src/bin/Makefile, necessary to compile pgevent for
 windows platform.
 
 
 regards
 
 Laurent Ballester

[ Attachment, skipping... ]

[ Attachment, skipping... ]

 
 ---(end of broadcast)---
 TIP 7: don't forget to increase your free space map settings

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073
Index: doc/src/sgml/installation.sgml
===
RCS file: /cvsroot/pgsql-server/doc/src/sgml/installation.sgml,v
retrieving revision 1.202
diff -c -c -r1.202 installation.sgml
*** doc/src/sgml/installation.sgml  23 May 2004 15:13:43 -  1.202
--- doc/src/sgml/installation.sgml  19 Jun 2004 05:12:09 -
***
*** 1073,1078 
--- 1073,1091 
/procedure
  
formalpara
+titleRegistering applicationeventlog/ on systemitem 
+class=osnameWindows/:/title
+para
+ To register a systemitem class=osnameWindows/ applicationeventlog/
+ library with the operating system, issue this command after installation:
+ screen
+ userinputregsvr32 replaceablepgsql_library_directory//pgevent.dll/
+ /screen
+ This creates registry entries used by the event viewer.
+/para
+   /formalpara
+ 
+   formalpara
 titleUninstallation:/title
 para
  To undo the installation use the command commandgmake
Index: src/bin/Makefile
===
RCS file: /cvsroot/pgsql-server/src/bin/Makefile,v
retrieving revision 1.44
diff -c -c -r1.44 Makefile
*** src/bin/Makefile18 Jun 2004 21:24:05 -  1.44
--- src/bin/Makefile19 Jun 2004 05:12:11 -
***
*** 15,20 
--- 15,23 
  
  DIRS := initdb ipcclean pg_ctl pg_dump \
psql scripts pg_config pg_controldata pg_resetxlog
+ ifeq ($(PORTNAME), win32)
+ DIRS+=pgevent
+ endif
  
  all install installdirs uninstall depend distprep:
@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [PATCHES] eventlog fix

2004-06-16 Thread Laurent Ballester

 Would you send me documentation explaining how to register this DLL with
 the event logger on Win32?  Ideally you could send me a diff against
 installation.sgml.


Hello Bruce,



After the DLL was in it target directory (C:\msys\1.0\local\pgsql\lib with
make install)

You can register the DLL to windows event log with the command

Regsvr32 pgevent.dll or regsvr32 /s pgevent.dll whish is a silent mode.



To uninstall, regsvr32 /u pgevent.dll will delete key add by the DLL in
Windows registry.



The DLL create the following entry:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\P
ostgreSQL] with two values :

EventMessageFile wish contains full path of DLL
C:\msys\1.0\local\pgsql\lib\pgevent.dll

TypesSupported : error type message send by postgresql



Regsvr32 is a standard program located in %systemroot%\system32



Regards

Laurent Ballester




---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [PATCHES] eventlog fix

2004-06-14 Thread Bruce Momjian

Would you send me documentation explaining how to register this DLL with
the event logger on Win32?  Ideally you could send me a diff against
installation.sgml.

---

Laurent Ballester wrote:
 Hello,
 
 
  We don't use this hungarian notation anywhere ... it certainly looks
  ugly.
 
 
 Sorry, I modify pgevent.c again and suppress all hungarian variables naming.
 
 I add a diff -c for src/bin/Makefile, necessary to compile pgevent for
 windows platform.
 
 
 regards
 
 Laurent Ballester

[ Attachment, skipping... ]

[ Attachment, skipping... ]

 
 ---(end of broadcast)---
 TIP 7: don't forget to increase your free space map settings

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


Re: [PATCHES] eventlog fix

2004-06-02 Thread Magnus Hagander
 The purpose of this patch is to fix an error when 
 log_destination is set to 'eventlog' value in postgresql.conf files.

Looks good to me, just a couple of tiny things:

snip

 After discussion on win32 mailing list, I suggest to store 
 source under src/bin/pg_event

I assume you mean src/bin/pgevent, to be consistent with the naming used
inside the program.


Second, I'd register the source as PostgreSQL, not PostGreSQL. I
don't think the captital-G is generally used, and it's specifically
NOT what the backend uses. Sure, the key reading process is
case-insensitive today, but it's still a good idea to keep things
consistent :-)

(Actually, this goes for the error msgs as well)


Finally, I'd also move the GetModuleFilename() call to before
RegCreateKey(). In the (very rare) case that it would fail, you don't
want to alerady have created the registry key.



//Magnus


---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [PATCHES] eventlog fix

2004-06-02 Thread Laurent Ballester
Hello magnus,

 I assume you mean src/bin/pgevent, to be consistent with the naming used
 inside the program.

OK, I Modify Makefile subdir value. In fact I name it pg_event because many
directory under src/bin began with pg_ .

 Second, I'd register the source as PostgreSQL, not PostGreSQL. I
 don't think the captital-G is generally used, and it's specifically
 NOT what the backend uses. Sure, the key reading process is
 case-insensitive today, but it's still a good idea to keep things
 consistent :-)

I modify pgevent.c, for your both remarks: capital G are disappears from
source and I move GetModuleFilename() before RegCreateKey() call.

I sent full set file again, it will be easier to apply.

regards,

Laurent
LANGUAGE 0x9,0x1
1 11 MSG1.bin


Makefile
Description: Binary data


MSG1.bin
Description: Binary data
/*-
 *
 * pgevent.c
 *  Defines the entry point for pgevent dll.
 *  The DLL defines event source for backend
 *
 *
 * IDENTIFICATION
 *$PostgreSQL$
 *
 *-
 */


#include windows.h
#include olectl.h
#include string.h

/* Global variables */
HANDLE g_hModule = NULL;/* hModule of DLL */

/* Prototypes */
STDAPI DllRegisterServer(void) ;
STDAPI DllUnregisterServer(void);
BOOL WINAPI DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved );

/*
 * DllRegisterServer --- Instructs DLL to create its registry entries 
 */

STDAPI DllRegisterServer(void) 
{
HKEY hk; 
DWORD dwData; 
char szBuffer[_MAX_PATH]; 

/* Set the name of DLL full path name. */
if (!GetModuleFileName((HMODULE)g_hModule, szBuffer, sizeof(szBuffer)))
{
MessageBox(NULL, Could not retrieve DLL filename, PostgreSQL 
error, MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}

/* Add PostgreSQL source name as a subkey under the Application 
   key in the EventLog registry key. */
if ( RegCreateKey(HKEY_LOCAL_MACHINE, 
SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\PostgreSQL, hk) ) 
{
MessageBox(NULL, Could not create the registry key., PostgreSQL error, 
MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}

 /* Add the name to the EventMessageFile subkey. */
if (RegSetValueEx(hk,   
EventMessageFile, 
0,  
REG_EXPAND_SZ,
(LPBYTE) szBuffer,
strlen(szBuffer) + 1))
{
MessageBox(NULL, Could not set the event message file., PostgreSQL error, 
MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}
 
/* Set the supported event types in the TypesSupported subkey. */
dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE; 
 
if (RegSetValueEx(hk,  
TypesSupported,  
0, 
REG_DWORD, 
(LPBYTE) dwData,  
sizeof(DWORD)))
{
MessageBox(NULL, Could not set the supported types., PostgreSQL error, 
MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}
 
RegCloseKey(hk); 
return S_OK;
}

/*
 * DllUnregisterServer --- Instructs DLL to remove only those entries created through 
DllRegisterServer
 */

STDAPI DllUnregisterServer(void)
{
/* Remove PostgreSQL source name as a subkey under the Application 
   key in the EventLog registry key. */
 
if ( RegDeleteKey(HKEY_LOCAL_MACHINE, 
SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\PostgreSQL) )
{
MessageBox(NULL, Could not delete the registry key., PostgreSQL 
error, MB_OK|MB_ICONSTOP); 
return SELFREG_E_TYPELIB; 
}
return S_OK;
}

/*
 * DllMain --- is an optional entry point into a DLL.
 */

BOOL WINAPI DllMain( HANDLE hModule, 
 DWORD  ul_reason_for_call, 
 LPVOID lpReserved
)
{
if ( ul_reason_for_call == DLL_PROCESS_ATTACH ) 
{
g_hModule = hModule;
}
return TRUE;
}

; dlltool --output-def pgevent.def pgevent.o pgmsgevent.o
EXPORTS
[EMAIL PROTECTED] @ 1; 
[EMAIL PROTECTED] @ 2; 
//
//  Values are 32 bit values layed out as follows:
//
//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
//  +---+-+-+---+---+
//  |Sev|C|R| Facility  |   Code|
//  +---+-+-+---+---+
//
//  where
//
//