From c615a712bf9eae3c88252c4a37bd91a0e9db89da Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 7 Oct 2015 18:09:50 -0400 Subject: [PATCH] Windows: Only install Service NP if one exists Do not blindly install a network provider for the service since at least one end user organization does not install the service's network provider. Change-Id: I15a528ff34ffd3e060fdbd93545af3857592c835 Reviewed-on: http://gerrit.openafs.org/12051 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/afsd_service.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/WINNT/afsd/afsd_service.c b/src/WINNT/afsd/afsd_service.c index c736706a9e..9a28a785be 100644 --- a/src/WINNT/afsd/afsd_service.c +++ b/src/WINNT/afsd/afsd_service.c @@ -1305,6 +1305,21 @@ InstNetProvider(const char *svcname, int bInst, const char *before) return rv; } +static int +clientServiceProviderKeyExists(void) +{ + HKEY hk; + LONG rv; + + rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, + AFSREG_CLT_SVC_PROVIDER_KEY, 0, + KEY_READ, &hk); + if (rv == ERROR_SUCCESS) + RegCloseKey(hk); + + return (rv == ERROR_SUCCESS); +} + /* control serviceex exists only on 2000/xp. These functions will be loaded dynamically. */ @@ -1563,7 +1578,8 @@ afsd_Main(DWORD argc, LPTSTR *argv) InstNetProvider("AFSRedirector", FALSE, NULL); } - InstNetProvider("TransarcAFSDaemon", TRUE, NULL); + InstNetProvider("TransarcAFSDaemon", clientServiceProviderKeyExists(), + NULL); /* * Set the default for the SMB interface based upon the state of the