mirror of
https://github.com/postgres/postgres.git
synced 2025-10-18 04:29:09 +03:00
Pgindent run for 8.0.
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
*
|
||||
* pgevent.c
|
||||
* Defines the entry point for pgevent dll.
|
||||
* The DLL defines event source for backend
|
||||
* The DLL defines event source for backend
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/bin/pgevent/pgevent.c,v 1.1 2004/06/20 01:32:49 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/pgevent/pgevent.c,v 1.2 2004/08/29 05:06:54 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -17,65 +17,69 @@
|
||||
#include "string.h"
|
||||
|
||||
/* Global variables */
|
||||
HANDLE g_module = NULL; /* hModule of DLL */
|
||||
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 );
|
||||
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
|
||||
* DllRegisterServer --- Instructs DLL to create its registry entries
|
||||
*/
|
||||
|
||||
STDAPI DllRegisterServer(void)
|
||||
STDAPI
|
||||
DllRegisterServer(void)
|
||||
{
|
||||
HKEY key;
|
||||
DWORD data;
|
||||
char buffer[_MAX_PATH];
|
||||
HKEY key;
|
||||
DWORD data;
|
||||
char buffer[_MAX_PATH];
|
||||
|
||||
/* Set the name of DLL full path name. */
|
||||
if (!GetModuleFileName((HMODULE)g_module, buffer, sizeof(buffer)))
|
||||
/* 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;
|
||||
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) )
|
||||
/*
|
||||
* 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;
|
||||
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))
|
||||
/* 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;
|
||||
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)))
|
||||
|
||||
/* 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;
|
||||
MessageBox(NULL, "Could not set the supported types.", "PostgreSQL error", MB_OK | MB_ICONSTOP);
|
||||
return SELFREG_E_TYPELIB;
|
||||
}
|
||||
|
||||
RegCloseKey(key);
|
||||
|
||||
RegCloseKey(key);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -83,15 +87,18 @@ STDAPI DllRegisterServer(void)
|
||||
* DllUnregisterServer --- Instructs DLL to remove only those entries created through DllRegisterServer
|
||||
*/
|
||||
|
||||
STDAPI DllUnregisterServer(void)
|
||||
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") )
|
||||
/*
|
||||
* 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;
|
||||
MessageBox(NULL, "Could not delete the registry key.", "PostgreSQL error", MB_OK | MB_ICONSTOP);
|
||||
return SELFREG_E_TYPELIB;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
@@ -100,15 +107,13 @@ STDAPI DllUnregisterServer(void)
|
||||
* DllMain --- is an optional entry point into a DLL.
|
||||
*/
|
||||
|
||||
BOOL WINAPI DllMain( HANDLE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
BOOL WINAPI
|
||||
DllMain(HANDLE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
if ( ul_reason_for_call == DLL_PROCESS_ATTACH )
|
||||
{
|
||||
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
|
||||
g_module = hModule;
|
||||
}
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@@ -1,45 +1,44 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// Sev - is the severity code
|
||||
//
|
||||
// 00 - Success
|
||||
// 01 - Informational
|
||||
// 10 - Warning
|
||||
// 11 - Error
|
||||
//
|
||||
// C - is the Customer code flag
|
||||
//
|
||||
// R - is a reserved bit
|
||||
//
|
||||
// Facility - is the facility code
|
||||
//
|
||||
// Code - is the facility's status code
|
||||
//
|
||||
//
|
||||
// Define the facility codes
|
||||
//
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* Sev - is the severity code */
|
||||
/* */
|
||||
/* 00 - Success */
|
||||
/* 01 - Informational */
|
||||
/* 10 - Warning */
|
||||
/* 11 - Error */
|
||||
/* */
|
||||
/* C - is the Customer code flag */
|
||||
/* */
|
||||
/* R - is a reserved bit */
|
||||
/* */
|
||||
/* Facility - is the facility code */
|
||||
/* */
|
||||
/* Code - is the facility's status code */
|
||||
/* */
|
||||
/* */
|
||||
/* Define the facility codes */
|
||||
/* */
|
||||
|
||||
|
||||
//
|
||||
// Define the severity codes
|
||||
//
|
||||
/* */
|
||||
/* Define the severity codes */
|
||||
/* */
|
||||
|
||||
|
||||
//
|
||||
// MessageId: PGWIN32_EVENTLOG_MSG
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// %1
|
||||
//
|
||||
#define PGWIN32_EVENTLOG_MSG 0x00000000L
|
||||
|
||||
/* */
|
||||
/* MessageId: PGWIN32_EVENTLOG_MSG */
|
||||
/* */
|
||||
/* MessageText: */
|
||||
/* */
|
||||
/* %1 */
|
||||
/* */
|
||||
#define PGWIN32_EVENTLOG_MSG 0x00000000L
|
||||
|
Reference in New Issue
Block a user