From 97bae25ad4179b597e122e4095316d417d9460be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Sun, 6 Feb 2005 21:57:44 +0000 Subject: [PATCH] - Add RegisterServiceCtrlHandlerExA/W - Add stubs for CheckTokenMembership and LsaGetUserName svn path=/trunk/; revision=13450 --- reactos/lib/advapi32/advapi32.def | 5 ++- reactos/lib/advapi32/sec/lsa.c | 19 ++++++++- reactos/lib/advapi32/service/sctrl.c | 60 ++++++++++++++++++++++++++++ reactos/lib/advapi32/token/token.c | 19 ++++++++- 4 files changed, 98 insertions(+), 5 deletions(-) diff --git a/reactos/lib/advapi32/advapi32.def b/reactos/lib/advapi32/advapi32.def index cabf743d788..0945f2130ee 100644 --- a/reactos/lib/advapi32/advapi32.def +++ b/reactos/lib/advapi32/advapi32.def @@ -45,6 +45,7 @@ BuildTrusteeWithSidA@8 BuildTrusteeWithSidW@8 ChangeServiceConfigA@44 ChangeServiceConfigW@44 +CheckTokenMembership@12 ClearEventLogA@8 ClearEventLogW@8 CloseEventLog@4 @@ -235,7 +236,7 @@ LsaClose@4 LsaFreeMemory@4 ;LsaGetQuotasForAccount@8 ;LsaGetSystemAccessAccount@8 -;LsaGetUserName@8 +LsaGetUserName@8 ;LsaICLookupNames@32 ;LsaICLookupSids@32 ;LsaLookupNames@20 @@ -359,6 +360,8 @@ RegisterEventSourceA@8 RegisterEventSourceW@8 RegisterServiceCtrlHandlerA@8 RegisterServiceCtrlHandlerW@8 +RegisterServiceCtrlHandlerExA@12 +RegisterServiceCtrlHandlerExW@12 ;ReplaceAllAccessRightsA ;ReplaceAllAccessRightsW ReportEventA@36 diff --git a/reactos/lib/advapi32/sec/lsa.c b/reactos/lib/advapi32/sec/lsa.c index eaf061034d0..bc915a6d4c8 100644 --- a/reactos/lib/advapi32/sec/lsa.c +++ b/reactos/lib/advapi32/sec/lsa.c @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries * FILE: lib/advapi32/sec/lsa.c @@ -493,3 +492,19 @@ LsaStorePrivateData( { return STATUS_NOT_IMPLEMENTED; } + +/* + * @unimplemented + */ +NTSTATUS +STDCALL +LsaGetUserName( + PUNICODE_STRING *UserName, + PUNICODE_STRING *DomainName) +{ + DPRINT1("LsaGetUserName not implemented\n"); + + return STATUS_NOT_IMPLEMENTED; +} + +/* EOF */ diff --git a/reactos/lib/advapi32/service/sctrl.c b/reactos/lib/advapi32/service/sctrl.c index defa64c0152..e6fd2499b58 100644 --- a/reactos/lib/advapi32/service/sctrl.c +++ b/reactos/lib/advapi32/service/sctrl.c @@ -31,6 +31,8 @@ typedef struct _ACTIVE_SERVICE LPSERVICE_MAIN_FUNCTIONW lpFuncW; } Main; LPHANDLER_FUNCTION HandlerFunction; + LPHANDLER_FUNCTION_EX HandlerFunctionEx; + LPVOID HandlerContext; SERVICE_STATUS ServiceStatus; BOOL bUnicode; LPWSTR Arguments; @@ -326,6 +328,64 @@ RegisterServiceCtrlHandlerW(LPCWSTR lpServiceName, } Service->HandlerFunction = lpHandlerProc; + Service->HandlerFunctionEx = NULL; + + return (SERVICE_STATUS_HANDLE)Service->ThreadId; +} + + +/********************************************************************** + * RegisterServiceCtrlHandlerExA + * + * @implemented + */ +SERVICE_STATUS_HANDLE STDCALL +RegisterServiceCtrlHandlerExA(LPCSTR lpServiceName, + LPHANDLER_FUNCTION_EX lpHandlerProc, + LPVOID lpContext) +{ + ANSI_STRING ServiceNameA; + UNICODE_STRING ServiceNameU; + SERVICE_STATUS_HANDLE SHandle; + + RtlInitAnsiString(&ServiceNameA, (LPSTR)lpServiceName); + if (!NT_SUCCESS(RtlAnsiStringToUnicodeString(&ServiceNameU, &ServiceNameA, TRUE))) + { + SetLastError(ERROR_OUTOFMEMORY); + return (SERVICE_STATUS_HANDLE)0; + } + + SHandle = RegisterServiceCtrlHandlerExW(ServiceNameU.Buffer, + lpHandlerProc, + lpContext); + + RtlFreeUnicodeString(&ServiceNameU); + + return SHandle; +} + + +/********************************************************************** + * RegisterServiceCtrlHandlerExW + * + * @implemented + */ +SERVICE_STATUS_HANDLE STDCALL +RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, + LPHANDLER_FUNCTION_EX lpHandlerProc, + LPVOID lpContext) +{ + PACTIVE_SERVICE Service; + + Service = ScLookupServiceByServiceName((LPWSTR)lpServiceName); + if (Service == NULL) + { + return (SERVICE_STATUS_HANDLE)NULL; + } + + Service->HandlerFunction = NULL; + Service->HandlerFunctionEx = lpHandlerProc; + Service->HandlerContext = lpContext; return (SERVICE_STATUS_HANDLE)Service->ThreadId; } diff --git a/reactos/lib/advapi32/token/token.c b/reactos/lib/advapi32/token/token.c index 9b7a0c51a66..94d68c0fa45 100644 --- a/reactos/lib/advapi32/token/token.c +++ b/reactos/lib/advapi32/token/token.c @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries * FILE: lib/advapi32/token/token.c @@ -11,6 +10,8 @@ #include "advapi32.h" +#define NDEBUG +#include /* * @implemented @@ -310,4 +311,18 @@ DuplicateToken (HANDLE ExistingTokenHandle, DuplicateTokenHandle); } + +/* + * @unimplemented + */ +BOOL STDCALL +CheckTokenMembership(HANDLE Token, PSID SidToCheck, PBOOL IsMember) +{ + DPRINT1("CheckTokenMembership not implemented\n"); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return FALSE; +} + /* EOF */