- Stub SetServiceObjectSecurity to pretend to work (return true).

- Change QueryServiceObjectSecurity so it initializes the ACL with a
  null DACL, and return as though it worked.
- Changed QueryServiceStatus to tell if the service is running by the
  presence of some named shared storage - copied from StartService when
  it checks to see if its already running.
This commit is contained in:
Jason Edmeades 2004-11-10 01:31:39 +00:00 committed by Alexandre Julliard
parent 0fec65d6a7
commit d80247ef67
2 changed files with 42 additions and 4 deletions

View File

@ -282,7 +282,7 @@
@ stdcall SetSecurityDescriptorOwner (ptr ptr long) @ stdcall SetSecurityDescriptorOwner (ptr ptr long)
@ stdcall SetSecurityDescriptorSacl(ptr long ptr long) @ stdcall SetSecurityDescriptorSacl(ptr long ptr long)
@ stub SetServiceBits @ stub SetServiceBits
@ stub SetServiceObjectSecurity @ stdcall SetServiceObjectSecurity(long long ptr)
@ stdcall SetServiceStatus(long long) @ stdcall SetServiceStatus(long long)
@ stdcall SetThreadToken (ptr ptr) @ stdcall SetThreadToken (ptr ptr)
@ stdcall SetTokenInformation (long long ptr long) @ stdcall SetTokenInformation (long long ptr long)

View File

@ -1097,6 +1097,8 @@ QueryServiceStatus( SC_HANDLE hService, LPSERVICE_STATUS lpservicestatus )
struct sc_handle *hsvc = hService; struct sc_handle *hsvc = hService;
LONG r; LONG r;
DWORD type, val, size; DWORD type, val, size;
WCHAR str[MAX_PATH];
HANDLE hServiceShmem = NULL;
FIXME("(%p,%p) partial\n",hService,lpservicestatus); FIXME("(%p,%p) partial\n",hService,lpservicestatus);
@ -1110,8 +1112,25 @@ QueryServiceStatus( SC_HANDLE hService, LPSERVICE_STATUS lpservicestatus )
} }
lpservicestatus->dwServiceType = val; lpservicestatus->dwServiceType = val;
/* FIXME: how are these determined or read from the registry? */ /* FIXME: how are these determined or read from the registry? */
/* SERVICE: unavailable=0, stopped=1, starting=2, running=3? */; /* SERVICE: unavailable=0, stopped=1, starting=2, running=3? */
lpservicestatus->dwCurrentState = 1;
/* Determine if currently running via named shared memory */
snprintfW( str, MAX_PATH, szServiceShmemNameFmtW, hsvc->u.service.name );
hServiceShmem = CreateFileMappingW( INVALID_HANDLE_VALUE,
NULL, PAGE_READWRITE, 0, size, str );
if( NULL == hServiceShmem )
{
lpservicestatus->dwCurrentState = 1;
} else {
if( GetLastError() == ERROR_ALREADY_EXISTS )
{
lpservicestatus->dwCurrentState = 3;
} else {
lpservicestatus->dwCurrentState = 1;
}
CloseHandle( hServiceShmem );
}
lpservicestatus->dwControlsAccepted = 0; lpservicestatus->dwControlsAccepted = 0;
lpservicestatus->dwWin32ExitCode = NO_ERROR; lpservicestatus->dwWin32ExitCode = NO_ERROR;
lpservicestatus->dwServiceSpecificExitCode = 0; lpservicestatus->dwServiceSpecificExitCode = 0;
@ -1557,7 +1576,26 @@ BOOL WINAPI QueryServiceObjectSecurity(SC_HANDLE hService,
PSECURITY_DESCRIPTOR lpSecurityDescriptor, PSECURITY_DESCRIPTOR lpSecurityDescriptor,
DWORD cbBufSize, LPDWORD pcbBytesNeeded) DWORD cbBufSize, LPDWORD pcbBytesNeeded)
{ {
PACL pACL = NULL;
FIXME("%p %ld %p %lu %p\n", hService, dwSecurityInformation, FIXME("%p %ld %p %lu %p\n", hService, dwSecurityInformation,
lpSecurityDescriptor, cbBufSize, pcbBytesNeeded); lpSecurityDescriptor, cbBufSize, pcbBytesNeeded);
return ERROR_CALL_NOT_IMPLEMENTED;
InitializeSecurityDescriptor(lpSecurityDescriptor, SECURITY_DESCRIPTOR_REVISION);
pACL = HeapAlloc( GetProcessHeap(), 0, sizeof(ACL) );
InitializeAcl(pACL, sizeof(ACL), ACL_REVISION);
SetSecurityDescriptorDacl(lpSecurityDescriptor, TRUE, pACL, TRUE);
return TRUE;
}
/******************************************************************************
* SetServiceObjectSecurity [ADVAPI32.@]
*/
BOOL WINAPI SetServiceObjectSecurity(SC_HANDLE hService,
SECURITY_INFORMATION dwSecurityInformation,
PSECURITY_DESCRIPTOR lpSecurityDescriptor)
{
FIXME("%p %ld %p\n", hService, dwSecurityInformation, lpSecurityDescriptor);
return TRUE;
} }