From: William A. Rowe Jr Date: Thu, 14 Dec 2000 22:24:03 +0000 (+0000) Subject: Thanks again, Andrew Braund... a little testing and sleuthing revealed X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5dcfd1d334f5fc428cde159d400e551d0fb386cb;p=apache Thanks again, Andrew Braund... a little testing and sleuthing revealed we were trying to load kernel32.dll as we unloaded, which is badness. Right there, in my face, was the 'won't stay alive on logout' bug. Squashed. So Win95/98 are working as they were in 1.3.14, only better! Happy day, time to roll once the remaining showstopper is cleaned up. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87348 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/mpm/winnt/Win9xConHook.c b/server/mpm/winnt/Win9xConHook.c index 0fca85ffcf..ea6c35e695 100644 --- a/server/mpm/winnt/Win9xConHook.c +++ b/server/mpm/winnt/Win9xConHook.c @@ -496,40 +496,47 @@ static LRESULT CALLBACK ttyConsoleCtrlWndProc(HWND hwnd, UINT msg, */ static LRESULT WINAPI RegisterWindows9xService(BOOL set_service) { - HINSTANCE hkernel; - DWORD (WINAPI *register_service_process)(DWORD, DWORD); + static HINSTANCE hkernel; + static DWORD (WINAPI *register_service_process)(DWORD, DWORD) = NULL; BOOL rv; if (set_service == is_service) return 1; #ifdef DBG - DbgPrintf("R %s proc %8.8x as a service\r\n", - set_service ? "installing" : "removing", - GetCurrentProcessId()); + DbgPrintf("R %s proc %8.8x as a service\r\n", + set_service ? "installing" : "removing", + GetCurrentProcessId()); #endif - /* Obtain a handle to the kernel library */ - hkernel = LoadLibrary("KERNEL32.DLL"); - if (!hkernel) - return 0; + if (!register_service_process) + { + /* Obtain a handle to the kernel library */ + hkernel = LoadLibrary("KERNEL32.DLL"); + if (!hkernel) + return 0; - /* Find the RegisterServiceProcess function */ - register_service_process = (DWORD (WINAPI *)(DWORD, DWORD)) - GetProcAddress(hkernel, "RegisterServiceProcess"); - if (register_service_process == NULL) { - FreeLibrary(hkernel); - return 0; + /* Find the RegisterServiceProcess function */ + register_service_process = (DWORD (WINAPI *)(DWORD, DWORD)) + GetProcAddress(hkernel, "RegisterServiceProcess"); + if (register_service_process == NULL) { + FreeLibrary(hkernel); + return 0; + } } - + /* Register this process as a service */ - rv = register_service_process(0, is_service != FALSE); + rv = register_service_process(0, set_service != FALSE); if (rv) is_service = set_service; - /* Unload the kernel library */ - FreeLibrary(hkernel); - return rv; + if (!is_service) + { + /* Unload the kernel library */ + FreeLibrary(hkernel); + register_service_process = NULL; + return rv; + } }