28HRESULT
DllInstall(BOOL bInstall, LPCWSTR pszCmdLine);
31BOOL WINAPI
DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved);
41 if (pszCmdLine && *pszCmdLine !=
'\0')
69 char buffer[_MAX_PATH];
73 if (!GetModuleFileName((HMODULE)
g_module, buffer,
sizeof(buffer)))
75 MessageBox(NULL,
"Could not retrieve DLL filename",
"PostgreSQL error", MB_OK | MB_ICONSTOP);
76 return SELFREG_E_TYPELIB;
83 _snprintf(key_name,
sizeof(key_name),
84 "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\%s",
86 if (RegCreateKey(HKEY_LOCAL_MACHINE, key_name, &
key))
88 MessageBox(NULL,
"Could not create the registry key.",
"PostgreSQL error", MB_OK | MB_ICONSTOP);
89 return SELFREG_E_TYPELIB;
93 if (RegSetValueEx(
key,
100 MessageBox(NULL,
"Could not set the event message file.",
"PostgreSQL error", MB_OK | MB_ICONSTOP);
101 return SELFREG_E_TYPELIB;
105 data = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE;
107 if (RegSetValueEx(
key,
114 MessageBox(NULL,
"Could not set the supported types.",
"PostgreSQL error", MB_OK | MB_ICONSTOP);
115 return SELFREG_E_TYPELIB;
136 _snprintf(key_name,
sizeof(key_name),
137 "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\%s",
139 if (RegDeleteKey(HKEY_LOCAL_MACHINE, key_name))
141 MessageBox(NULL,
"Could not delete the registry key.",
"PostgreSQL error", MB_OK | MB_ICONSTOP);
142 return SELFREG_E_TYPELIB;
153 DWORD ul_reason_for_call,
157 if (ul_reason_for_call == DLL_PROCESS_ATTACH)
#define DEFAULT_EVENT_SOURCE
STDAPI DllRegisterServer(void)
STDAPI DllUnregisterServer(void)
HRESULT DllInstall(BOOL bInstall, LPCWSTR pszCmdLine)
static char event_source[256]
BOOL WINAPI DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)