From 4d09ea957944088a4b370d2f6fdb3d95bcf2a843 Mon Sep 17 00:00:00 2001 From: "William A. Rowe Jr" Date: Thu, 14 Dec 2000 22:24:03 +0000 Subject: [PATCH] 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 --- server/mpm/winnt/Win9xConHook.c | 47 +++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 20 deletions(-) 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; + } } -- 2.50.1