diff options
| author | Bruce Momjian | 2004-08-29 05:07:03 +0000 |
|---|---|---|
| committer | Bruce Momjian | 2004-08-29 05:07:03 +0000 |
| commit | b6b71b85bc45b49005b5aec87cba2c33fc8baf49 (patch) | |
| tree | c23dbd1dbc43972a8e48327c8a771baf36952f3d /src/bin/pgevent | |
| parent | 90cb9c305140684b2b00c739b724f67915e11404 (diff) | |
Pgindent run for 8.0.
Diffstat (limited to 'src/bin/pgevent')
| -rw-r--r-- | src/bin/pgevent/pgevent.c | 123 | ||||
| -rw-r--r-- | src/bin/pgevent/pgmsgevent.h | 81 |
2 files changed, 104 insertions, 100 deletions
diff --git a/src/bin/pgevent/pgevent.c b/src/bin/pgevent/pgevent.c index 71d08b603f..6d72b60b09 100644 --- a/src/bin/pgevent/pgevent.c +++ b/src/bin/pgevent/pgevent.c @@ -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; } - diff --git a/src/bin/pgevent/pgmsgevent.h b/src/bin/pgevent/pgmsgevent.h index fad729d353..94e0bcf7e5 100644 --- a/src/bin/pgevent/pgmsgevent.h +++ b/src/bin/pgevent/pgmsgevent.h @@ -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 |
