From e7e31832389bd592b670e4b54859ff29fad0bef2 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 21 Mar 2008 04:17:14 +0000 Subject: [PATCH] DEVEL15-windows-pioctl-disable-service-mgr-check-20080320 LICENSE MIT Adds HKLM\\Software\\OpenAFS\\Client DisableIoctlSMCheck For use in setting tokens when afsd_service.exe is started without use of the NT Service Manager. Permits profiling authenticated operations. (cherry picked from commit 77c1e986369c8151ec19e74dccbd2b40de6270d9) --- src/sys/pioctl_nt.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/sys/pioctl_nt.c b/src/sys/pioctl_nt.c index dd323d81a..009d874f5 100644 --- a/src/sys/pioctl_nt.c +++ b/src/sys/pioctl_nt.c @@ -139,6 +139,30 @@ IoctlDebug(void) return debug; } +static BOOL +DisableServiceManagerCheck(void) +{ + static int init = 0; + static BOOL smcheck = 0; + + if ( !init ) { + HKEY hk; + + if (RegOpenKey (HKEY_LOCAL_MACHINE, + TEXT("Software\\OpenAFS\\Client"), &hk) == 0) + { + DWORD dwSize = sizeof(BOOL); + DWORD dwType = REG_DWORD; + RegQueryValueEx (hk, TEXT("DisableIoctlSMCheck"), NULL, &dwType, (PBYTE)&smcheck, &dwSize); + RegCloseKey (hk); + } + + init = 1; + } + + return smcheck; +} + static DWORD GetServiceStatus( LPSTR lpszMachineName, @@ -390,7 +414,8 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep) memset(HostName, '\0', sizeof(HostName)); gethostname(HostName, sizeof(HostName)); - if (GetServiceStatus(HostName, TEXT("TransarcAFSDaemon"), &CurrentState) == NOERROR && + if (!DisableServiceManagerCheck() && + GetServiceStatus(HostName, TEXT("TransarcAFSDaemon"), &CurrentState) == NOERROR && CurrentState != SERVICE_RUNNING) return -1; -- 2.39.5