srvsvc: Add LanmanServer stub service.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
This commit is contained in:
Dmitry Timoshkov 2022-08-08 14:33:20 +03:00 committed by Alexandre Julliard
parent d7c5797bee
commit 3acdfe3180
Notes: Alexandre Julliard 2023-09-08 23:15:24 +02:00
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/-/merge_requests/3771
6 changed files with 98 additions and 2 deletions

2
configure vendored
View file

@ -1403,6 +1403,7 @@ enable_spoolss
enable_sppc
enable_srclient
enable_srvcli
enable_srvsvc
enable_sspicli
enable_stdole2_tlb
enable_stdole32_tlb
@ -21664,6 +21665,7 @@ wine_fn_config_makefile dlls/spoolss/tests enable_tests
wine_fn_config_makefile dlls/sppc enable_sppc
wine_fn_config_makefile dlls/srclient enable_srclient
wine_fn_config_makefile dlls/srvcli enable_srvcli
wine_fn_config_makefile dlls/srvsvc enable_srvsvc
wine_fn_config_makefile dlls/sspicli enable_sspicli
wine_fn_config_makefile dlls/stdole2.tlb enable_stdole2_tlb
wine_fn_config_makefile dlls/stdole32.tlb enable_stdole32_tlb

View file

@ -3031,6 +3031,7 @@ WINE_CONFIG_MAKEFILE(dlls/spoolss/tests)
WINE_CONFIG_MAKEFILE(dlls/sppc)
WINE_CONFIG_MAKEFILE(dlls/srclient)
WINE_CONFIG_MAKEFILE(dlls/srvcli)
WINE_CONFIG_MAKEFILE(dlls/srvsvc)
WINE_CONFIG_MAKEFILE(dlls/sspicli)
WINE_CONFIG_MAKEFILE(dlls/stdole2.tlb)
WINE_CONFIG_MAKEFILE(dlls/stdole32.tlb)

5
dlls/srvsvc/Makefile.in Normal file
View file

@ -0,0 +1,5 @@
MODULE = srvsvc.dll
IMPORTS = advapi32
C_SRCS = \
srvsvc.c

87
dlls/srvsvc/srvsvc.c Normal file
View file

@ -0,0 +1,87 @@
/*
* LanmanServer Service
*
* Copyright 2022 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winsvc.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(lanman);
static SERVICE_STATUS_HANDLE svc_handle;
static HANDLE done_event;
static void svc_update_status(DWORD state)
{
SERVICE_STATUS status;
status.dwServiceType = SERVICE_WIN32;
status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
status.dwWin32ExitCode = 0;
status.dwServiceSpecificExitCode = 0;
status.dwCheckPoint = 0;
status.dwWaitHint = 0;
status.dwCurrentState = state;
SetServiceStatus(svc_handle, &status);
}
static void WINAPI svc_handler(DWORD control)
{
TRACE("%#lx\n", control);
switch (control)
{
case SERVICE_CONTROL_STOP:
case SERVICE_CONTROL_SHUTDOWN:
svc_update_status(SERVICE_STOP_PENDING);
SetEvent(done_event);
break;
default:
svc_update_status(SERVICE_RUNNING);
break;
}
}
void WINAPI ServiceMain(DWORD argc, LPWSTR *argv)
{
TRACE("Starting LanmanServer\n");
svc_handle = RegisterServiceCtrlHandlerW(L"LanmanServer", svc_handler);
if (!svc_handle)
{
ERR("RegisterServiceCtrlHandler error %ld\n", GetLastError());
return;
}
svc_update_status(SERVICE_START_PENDING);
done_event = CreateEventW(NULL, TRUE, FALSE, NULL);
svc_update_status(SERVICE_RUNNING);
WaitForSingleObject(done_event, INFINITE);
CloseHandle(done_event);
svc_update_status(SERVICE_STOPPED);
TRACE("Exiting LanmanServer\n");
}

1
dlls/srvsvc/srvsvc.spec Normal file
View file

@ -0,0 +1 @@
@ stdcall -private ServiceMain(long ptr)

View file

@ -2448,12 +2448,12 @@ Description="Lanman Server"
DisplayName="Lanman Server"
ServiceBinary="%11%\svchost.exe -k netsvcs"
ServiceType=32
StartType=4
StartType=3
ErrorControl=1
[LanmanServerServiceKeys]
HKR,Parameters,"ServiceDll",,"%11%\srvsvc.dll"
;; HKLM,%CurrentVersionNT%\SvcHost,"netsvcs",0x00010008,"lanmanserver"
HKLM,%CurrentVersionNT%\SvcHost,"netsvcs",0x00010008,"lanmanserver"
[FontCacheService]
AddReg=FontCacheServiceKeys