summaryrefslogtreecommitdiff
path: root/openbsd-compat/bsd-cygwin_util.c
diff options
context:
space:
mode:
authortim <tim>2001-11-27 01:19:43 +0000
committertim <tim>2001-11-27 01:19:43 +0000
commit4e076ea09b3167ed0c20ef238dbd5968018eccd0 (patch)
tree70aa4707e736267860af43e65f21b42287405a3a /openbsd-compat/bsd-cygwin_util.c
parentcab08503258191fa2f5b8d02e7a2f7a53cebf03f (diff)
downloadopenssh-4e076ea09b3167ed0c20ef238dbd5968018eccd0.tar.gz
[contrib/cygwin/README, openbsd-compat/bsd-cygwin_util.c,
openbsd-compat/bsd-cygwin_util.h, openbsd-compat/daemon.c] Allow SSHD to install as service under WIndows 9x/Me [configure.ac] Fix to allow linking against PCRE on Cygwin Patches by Corinna Vinschen <vinschen@redhat.com>
Diffstat (limited to 'openbsd-compat/bsd-cygwin_util.c')
-rw-r--r--openbsd-compat/bsd-cygwin_util.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/openbsd-compat/bsd-cygwin_util.c b/openbsd-compat/bsd-cygwin_util.c
index 87f36c0c..6d6aafa4 100644
--- a/openbsd-compat/bsd-cygwin_util.c
+++ b/openbsd-compat/bsd-cygwin_util.c
@@ -15,7 +15,7 @@
#include "includes.h"
-RCSID("$Id: bsd-cygwin_util.c,v 1.5 2001/07/18 16:19:49 mouring Exp $");
+RCSID("$Id: bsd-cygwin_util.c,v 1.6 2001/11/27 01:19:44 tim Exp $");
#ifdef HAVE_CYGWIN
@@ -139,4 +139,26 @@ int check_ntsec(const char *filename)
return 0;
}
+void register_9x_service(void)
+{
+ HINSTANCE kerneldll;
+ DWORD (*RegisterServiceProcess)(DWORD, DWORD);
+
+ /* The service register mechanism in 9x/Me is pretty different from
+ * NT/2K/XP. In NT/2K/XP we're using a special service starter
+ * application to register and control sshd as service. This method
+ * doesn't play nicely with 9x/Me. For that reason we register here
+ * as service when running under 9x/Me. This function is only called
+ * by the child sshd when it's going to daemonize.
+ */
+ if (is_winnt)
+ return;
+ if (! (kerneldll = LoadLibrary("KERNEL32.DLL")))
+ return;
+ if (! (RegisterServiceProcess = (DWORD (*)(DWORD, DWORD))
+ GetProcAddress(kerneldll, "RegisterServiceProcess")))
+ return;
+ RegisterServiceProcess(0, 1);
+}
+
#endif /* HAVE_CYGWIN */