mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[RPCSS] Sync with Wine Staging 3.3. CORE-14434
This commit is contained in:
parent
905c9ea7b1
commit
444338ae2e
9 changed files with 118 additions and 253 deletions
|
@ -8,8 +8,7 @@ list(APPEND SOURCE
|
|||
epmp.c
|
||||
irotp.c
|
||||
rpcss_main.c
|
||||
service_main.c
|
||||
rpcss.h
|
||||
precomp.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/epm_s.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/irot_s.c)
|
||||
|
||||
|
@ -23,5 +22,5 @@ endif()
|
|||
target_link_libraries(rpcss ${PSEH_LIB} wine)
|
||||
set_module_type(rpcss win32cui UNICODE)
|
||||
add_importlibs(rpcss advapi32 rpcrt4 msvcrt kernel32 ntdll)
|
||||
add_pch(rpcss rpcss.h SOURCE)
|
||||
add_pch(rpcss precomp.h SOURCE)
|
||||
add_cd_file(TARGET rpcss DESTINATION reactos/system32 FOR all)
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "rpcss.h"
|
||||
#include "epm_s.h"
|
||||
|
||||
#include <wine/debug.h>
|
||||
#include "wine/debug.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
|
|
|
@ -18,9 +18,17 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "rpcss.h"
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <wine/debug.h>
|
||||
#include "winerror.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
|
||||
#include "irot_s.h"
|
||||
|
||||
#include "wine/list.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(rpcss);
|
||||
|
||||
|
|
22
base/services/rpcss/precomp.h
Normal file
22
base/services/rpcss/precomp.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
#ifndef _RPCSS_PRECOMP_H_
|
||||
#define _RPCSS_PRECOMP_H_
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#define _INC_WINDOWS
|
||||
#define COM_NO_WINDOWS_H
|
||||
|
||||
#define NONAMELESSUNION
|
||||
#define NONAMELESSSTRUCT
|
||||
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
|
||||
#include <irot_s.h>
|
||||
#include <epm_s.h>
|
||||
|
||||
#include <wine/list.h>
|
||||
|
||||
#endif /* !_RPCSS_PRECOMP_H_ */
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* RPCSS definitions
|
||||
*
|
||||
* Copyright (C) 2002 Greg Turner
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __WINE_RPCSS_H
|
||||
#define __WINE_RPCSS_H
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#define _INC_WINDOWS
|
||||
#define COM_NO_WINDOWS_H
|
||||
|
||||
#define NONAMELESSUNION
|
||||
#define NONAMELESSSTRUCT
|
||||
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
|
||||
#include <irot_s.h>
|
||||
#include <epm_s.h>
|
||||
|
||||
#include <wine/list.h>
|
||||
|
||||
#endif /* __WINE_RPCSS_H */
|
|
@ -15,45 +15,29 @@
|
|||
* 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
|
||||
*
|
||||
* ---- rpcss_main.c:
|
||||
* Initialize and start serving requests. Bail if rpcss already is
|
||||
* running.
|
||||
*
|
||||
* ---- RPCSS.EXE:
|
||||
*
|
||||
* Wine needs a server whose role is somewhat like that
|
||||
* of rpcss.exe in windows. This is not a clone of
|
||||
* windows rpcss at all. It has been given the same name, however,
|
||||
* to provide for the possibility that at some point in the future,
|
||||
* it may become interface compatible with the "real" rpcss.exe on
|
||||
* Windows.
|
||||
*
|
||||
* ---- KNOWN BUGS / TODO:
|
||||
*
|
||||
* o Service hooks are unimplemented (if you bother to implement
|
||||
* these, also implement net.exe, at least for "net start" and
|
||||
* "net stop" (should be pretty easy I guess, assuming the rest
|
||||
* of the services API infrastructure works.
|
||||
*
|
||||
* o There is a looming problem regarding listening on privileged
|
||||
* ports. We will need to be able to coexist with SAMBA, and be able
|
||||
* to function without running winelib code as root. This may
|
||||
* take some doing, including significant reconceptualization of the
|
||||
* role of rpcss.exe in wine.
|
||||
*/
|
||||
|
||||
#include "rpcss.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <wine/debug.h>
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winnt.h"
|
||||
#include "winsvc.h"
|
||||
#include "irot_s.h"
|
||||
#include "epm_s.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
HANDLE exit_event;
|
||||
static WCHAR rpcssW[] = {'R','p','c','S','s',0};
|
||||
static HANDLE exit_event;
|
||||
static SERVICE_STATUS_HANDLE service_handle;
|
||||
|
||||
//extern HANDLE __wine_make_process_system(void);
|
||||
|
||||
BOOL RPCSS_Initialize(void)
|
||||
static BOOL RPCSS_Initialize(void)
|
||||
{
|
||||
static unsigned short irot_protseq[] = IROT_PROTSEQ;
|
||||
static unsigned short irot_endpoint[] = IROT_ENDPOINT;
|
||||
|
@ -94,16 +78,6 @@ BOOL RPCSS_Initialize(void)
|
|||
if (status != RPC_S_OK)
|
||||
goto fail;
|
||||
|
||||
#ifndef __REACTOS__
|
||||
exit_event = __wine_make_process_system();
|
||||
#else
|
||||
exit_event = CreateEventW(NULL, FALSE, FALSE, NULL); // never fires
|
||||
{
|
||||
HANDLE hStartEvent = CreateEventW(NULL, TRUE, FALSE, L"ScmCreatedEvent");
|
||||
SetEvent(hStartEvent);
|
||||
}
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
|
||||
fail:
|
||||
|
@ -112,33 +86,76 @@ fail:
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* returns false if we discover at the last moment that we
|
||||
aren't ready to terminate */
|
||||
BOOL RPCSS_Shutdown(void)
|
||||
static DWORD WINAPI service_handler( DWORD ctrl, DWORD event_type, LPVOID event_data, LPVOID context )
|
||||
{
|
||||
RpcMgmtStopServerListening(NULL);
|
||||
RpcServerUnregisterIf(epm_v3_0_s_ifspec, NULL, TRUE);
|
||||
RpcServerUnregisterIf(Irot_v0_2_s_ifspec, NULL, TRUE);
|
||||
SERVICE_STATUS status;
|
||||
|
||||
CloseHandle(exit_event);
|
||||
status.dwServiceType = SERVICE_WIN32;
|
||||
status.dwControlsAccepted = SERVICE_ACCEPT_STOP;
|
||||
status.dwWin32ExitCode = 0;
|
||||
status.dwServiceSpecificExitCode = 0;
|
||||
status.dwCheckPoint = 0;
|
||||
status.dwWaitHint = 0;
|
||||
|
||||
return TRUE;
|
||||
switch (ctrl)
|
||||
{
|
||||
case SERVICE_CONTROL_STOP:
|
||||
case SERVICE_CONTROL_SHUTDOWN:
|
||||
TRACE( "shutting down\n" );
|
||||
RpcMgmtStopServerListening( NULL );
|
||||
RpcServerUnregisterIf( epm_v3_0_s_ifspec, NULL, TRUE );
|
||||
RpcServerUnregisterIf( Irot_v0_2_s_ifspec, NULL, TRUE );
|
||||
status.dwCurrentState = SERVICE_STOP_PENDING;
|
||||
status.dwControlsAccepted = 0;
|
||||
SetServiceStatus( service_handle, &status );
|
||||
SetEvent( exit_event );
|
||||
return NO_ERROR;
|
||||
default:
|
||||
FIXME( "got service ctrl %x\n", ctrl );
|
||||
status.dwCurrentState = SERVICE_RUNNING;
|
||||
SetServiceStatus( service_handle, &status );
|
||||
return NO_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __REACTOS__
|
||||
int main( int argc, char **argv )
|
||||
static void WINAPI ServiceMain( DWORD argc, LPWSTR *argv )
|
||||
{
|
||||
/*
|
||||
* We are invoked as a standard executable; we act in a
|
||||
* "lazy" manner. We register our interfaces and endpoints, and hang around
|
||||
* until we all user processes exit, and then silently terminate.
|
||||
*/
|
||||
SERVICE_STATUS status;
|
||||
|
||||
if (RPCSS_Initialize()) {
|
||||
WaitForSingleObject(exit_event, INFINITE);
|
||||
RPCSS_Shutdown();
|
||||
}
|
||||
TRACE( "starting service\n" );
|
||||
|
||||
return 0;
|
||||
if (!RPCSS_Initialize()) return;
|
||||
|
||||
exit_event = CreateEventW( NULL, TRUE, FALSE, NULL );
|
||||
|
||||
service_handle = RegisterServiceCtrlHandlerExW( rpcssW, service_handler, NULL );
|
||||
if (!service_handle) return;
|
||||
|
||||
status.dwServiceType = SERVICE_WIN32;
|
||||
status.dwCurrentState = SERVICE_RUNNING;
|
||||
status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
|
||||
status.dwWin32ExitCode = 0;
|
||||
status.dwServiceSpecificExitCode = 0;
|
||||
status.dwCheckPoint = 0;
|
||||
status.dwWaitHint = 10000;
|
||||
SetServiceStatus( service_handle, &status );
|
||||
|
||||
WaitForSingleObject( exit_event, INFINITE );
|
||||
|
||||
status.dwCurrentState = SERVICE_STOPPED;
|
||||
status.dwControlsAccepted = 0;
|
||||
SetServiceStatus( service_handle, &status );
|
||||
TRACE( "service stopped\n" );
|
||||
}
|
||||
|
||||
int wmain( int argc, WCHAR *argv[] )
|
||||
{
|
||||
static const SERVICE_TABLE_ENTRYW service_table[] =
|
||||
{
|
||||
{ rpcssW, ServiceMain },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
StartServiceCtrlDispatcherW( service_table );
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
Index: rpcss_main.c
|
||||
===================================================================
|
||||
--- rpcss_main.c
|
||||
+++ rpcss_main.c
|
||||
@@ -58,11 +58,11 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
-static HANDLE exit_event;
|
||||
+HANDLE exit_event;
|
||||
|
||||
//extern HANDLE __wine_make_process_system(void);
|
||||
|
||||
-static BOOL RPCSS_Initialize(void)
|
||||
+BOOL RPCSS_Initialize(void)
|
||||
{
|
||||
static unsigned short irot_protseq[] = IROT_PROTSEQ;
|
||||
static unsigned short irot_endpoint[] = IROT_ENDPOINT;
|
||||
@@ -116,7 +116,7 @@
|
||||
|
||||
/* returns false if we discover at the last moment that we
|
||||
aren't ready to terminate */
|
||||
-static BOOL RPCSS_Shutdown(void)
|
||||
+BOOL RPCSS_Shutdown(void)
|
||||
{
|
||||
RpcMgmtStopServerListening(NULL);
|
||||
RpcServerUnregisterIf(epm_v3_0_s_ifspec, NULL, TRUE);
|
||||
@@ -127,6 +127,7 @@
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+#if 0
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
/*
|
||||
@@ -142,3 +143,4 @@
|
||||
|
||||
return 0;
|
||||
}
|
||||
+#endif
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Remote Procedure Call service
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: base/services/rpcss/service_main.c
|
||||
* PURPOSE: Service control code
|
||||
* COPYRIGHT: Copyright 2008 Ged Murphy <gedmurphy@reactos.org>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "rpcss.h"
|
||||
|
||||
#include <winsvc.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
extern BOOL RPCSS_Initialize(void);
|
||||
extern BOOL RPCSS_Shutdown(void);
|
||||
extern HANDLE exit_event;
|
||||
|
||||
static VOID WINAPI ServiceMain(DWORD, LPWSTR *);
|
||||
static WCHAR ServiceName[] = L"RpcSs";
|
||||
SERVICE_TABLE_ENTRYW ServiceTable[] =
|
||||
{
|
||||
{ ServiceName, ServiceMain },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static SERVICE_STATUS ServiceStatus;
|
||||
static SERVICE_STATUS_HANDLE ServiceStatusHandle;
|
||||
|
||||
DWORD WINAPI
|
||||
ServiceControlHandler(DWORD dwControl,
|
||||
DWORD dwEventType,
|
||||
LPVOID lpEventData,
|
||||
LPVOID lpContext)
|
||||
{
|
||||
switch (dwControl)
|
||||
{
|
||||
case SERVICE_CONTROL_SHUTDOWN:
|
||||
case SERVICE_CONTROL_STOP:
|
||||
SetEvent(exit_event);
|
||||
return NO_ERROR;
|
||||
|
||||
case SERVICE_CONTROL_INTERROGATE:
|
||||
return NO_ERROR;
|
||||
|
||||
default:
|
||||
return ERROR_CALL_NOT_IMPLEMENTED;
|
||||
}
|
||||
}
|
||||
|
||||
VOID WINAPI
|
||||
ServiceMain(DWORD argc, LPWSTR argv[])
|
||||
{
|
||||
DWORD dwError;
|
||||
|
||||
ServiceStatusHandle = RegisterServiceCtrlHandlerExW(ServiceName,
|
||||
ServiceControlHandler,
|
||||
NULL);
|
||||
if (!ServiceStatusHandle)
|
||||
{
|
||||
dwError = GetLastError();
|
||||
DPRINT1("RegisterServiceCtrlHandlerW() failed! (Error %lu)\n", dwError);
|
||||
return;
|
||||
}
|
||||
|
||||
ServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
|
||||
ServiceStatus.dwCurrentState = SERVICE_START_PENDING;
|
||||
ServiceStatus.dwControlsAccepted = 0;
|
||||
ServiceStatus.dwWin32ExitCode = NO_ERROR;
|
||||
ServiceStatus.dwServiceSpecificExitCode = 0;
|
||||
ServiceStatus.dwCheckPoint = 0;
|
||||
ServiceStatus.dwWaitHint = 1000;
|
||||
SetServiceStatus(ServiceStatusHandle, &ServiceStatus);
|
||||
|
||||
if (RPCSS_Initialize())
|
||||
{
|
||||
ServiceStatus.dwCurrentState = SERVICE_RUNNING;
|
||||
ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
|
||||
SetServiceStatus(ServiceStatusHandle, &ServiceStatus);
|
||||
|
||||
WaitForSingleObject(exit_event, INFINITE);
|
||||
|
||||
RPCSS_Shutdown();
|
||||
|
||||
ServiceStatus.dwCurrentState = SERVICE_STOPPED;
|
||||
SetServiceStatus(ServiceStatusHandle, &ServiceStatus);
|
||||
}
|
||||
}
|
||||
|
||||
int wmain(int argc, LPWSTR argv[])
|
||||
{
|
||||
if (!StartServiceCtrlDispatcherW(ServiceTable))
|
||||
{
|
||||
DPRINT1("StartServiceCtrlDispatcherW() failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -241,7 +241,7 @@ reactos/base/applications/regedit # Out of sync
|
|||
reactos/base/applications/winhlp32 # Synced to WineStaging-3.3
|
||||
reactos/base/applications/wordpad # Synced to WineStaging-1.9.16
|
||||
reactos/base/applications/write # Synced to WineStaging-3.3
|
||||
reactos/base/services/rpcss # Synced to WineStaging-1.9.16
|
||||
reactos/base/services/rpcss # Synced to WineStaging-3.3
|
||||
reactos/base/system/expand # Synced to WineStaging-2.9
|
||||
reactos/base/system/msiexec # Synced to WineStaging-2.16
|
||||
reactos/modules/rosapps/winfile # Autosync
|
||||
|
|
Loading…
Reference in a new issue