fntcache: Added stub Font Cache service.

This commit is contained in:
Nikolay Sivov 2014-02-25 08:45:37 +04:00 committed by Alexandre Julliard
parent 99298f85e4
commit ee9c7dc0b6
6 changed files with 143 additions and 4 deletions

2
configure vendored
View File

@ -1028,6 +1028,7 @@ enable_explorerframe
enable_ext_ms_win_gdi_devcaps_l1_1_0
enable_faultrep
enable_fltlib
enable_fntcache
enable_fusion
enable_fwpuclnt
enable_gameux
@ -16849,6 +16850,7 @@ wine_fn_config_dll ext-ms-win-gdi-devcaps-l1-1-0 enable_ext_ms_win_gdi_devcaps_l
wine_fn_config_dll faultrep enable_faultrep implib
wine_fn_config_test dlls/faultrep/tests faultrep_test
wine_fn_config_dll fltlib enable_fltlib
wine_fn_config_dll fntcache enable_fntcache
wine_fn_config_dll fusion enable_fusion
wine_fn_config_test dlls/fusion/tests fusion_test
wine_fn_config_dll fwpuclnt enable_fwpuclnt

View File

@ -2857,6 +2857,7 @@ WINE_CONFIG_DLL(ext-ms-win-gdi-devcaps-l1-1-0)
WINE_CONFIG_DLL(faultrep,,[implib])
WINE_CONFIG_TEST(dlls/faultrep/tests)
WINE_CONFIG_DLL(fltlib)
WINE_CONFIG_DLL(fntcache)
WINE_CONFIG_DLL(fusion)
WINE_CONFIG_TEST(dlls/fusion/tests)
WINE_CONFIG_DLL(fwpuclnt)

View File

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

View File

@ -0,0 +1,3 @@
@ stub DllRegisterServer
@ stub DllUnregisterServer
@ stdcall -private ServiceMain(long ptr)

112
dlls/fntcache/main.c Normal file
View File

@ -0,0 +1,112 @@
/*
* Font Cache service
*
* Copyright 2014 Nikolay Sivov for CodeWeavers
*
* 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
*/
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "winsvc.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(fontcache);
static HINSTANCE hInst;
static SERVICE_STATUS_HANDLE service_handle;
static HANDLE stop_event;
/***********************************************************************
* DllMain (fntcache.@)
*/
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("(%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
switch (fdwReason)
{
case DLL_WINE_PREATTACH:
return FALSE; /* prefer native version */
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hinstDLL);
hInst = hinstDLL;
break;
}
return TRUE;
}
static DWORD WINAPI service_handler( DWORD ctrl, DWORD event_type, void *event_data, void *context )
{
SERVICE_STATUS status;
status.dwServiceType = SERVICE_WIN32;
status.dwControlsAccepted = SERVICE_ACCEPT_STOP;
status.dwWin32ExitCode = 0;
status.dwServiceSpecificExitCode = 0;
status.dwCheckPoint = 0;
status.dwWaitHint = 0;
switch(ctrl)
{
case SERVICE_CONTROL_STOP:
case SERVICE_CONTROL_SHUTDOWN:
WINE_TRACE( "shutting down\n" );
status.dwCurrentState = SERVICE_STOP_PENDING;
status.dwControlsAccepted = 0;
SetServiceStatus( service_handle, &status );
SetEvent( stop_event );
return NO_ERROR;
default:
WINE_FIXME( "got service ctrl %x\n", ctrl );
status.dwCurrentState = SERVICE_RUNNING;
SetServiceStatus( service_handle, &status );
return NO_ERROR;
}
}
/***********************************************************************
* ServiceMain (fntcache.@)
*/
VOID WINAPI ServiceMain(DWORD argc, LPWSTR *argv)
{
static const WCHAR fontcacheW[] = {'F','o','n','t','C','a','c','h','e',0};
SERVICE_STATUS status;
WINE_TRACE( "starting service\n" );
stop_event = CreateEventW( NULL, TRUE, FALSE, NULL );
service_handle = RegisterServiceCtrlHandlerExW( fontcacheW, 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( stop_event, INFINITE );
status.dwCurrentState = SERVICE_STOPPED;
status.dwControlsAccepted = 0;
SetServiceStatus( service_handle, &status );
WINE_TRACE( "service stopped\n" );
}

View File

@ -121,8 +121,9 @@ AddService=Spooler,0,SpoolerService
AddService=StiSvc,0,StiService
AddService=TermService,0,TerminalServices
AddService=PlugPlay,0,PlugPlayService
AddService=FontCache3.0.0.0,0,FontCacheService
AddService=FontCache3.0.0.0,0,WPFFontCacheService
AddService=LanmanServer,0,LanmanServerService
AddService=FontCache,0,FontCacheService
[DefaultInstall.NT.Services]
AddService=BITS,0,BITSService
@ -132,8 +133,9 @@ AddService=Spooler,0,SpoolerService
AddService=StiSvc,0,StiService
AddService=TermService,0,TerminalServices
AddService=PlugPlay,0,PlugPlayService
AddService=FontCache3.0.0.0,0,FontCacheService
AddService=FontCache3.0.0.0,0,WPFFontCacheService
AddService=LanmanServer,0,LanmanServerService
AddService=FontCache,0,FontCacheService
[DefaultInstall.ntamd64.Services]
AddService=BITS,0,BITSService
@ -143,8 +145,9 @@ AddService=Spooler,0,SpoolerService
AddService=StiSvc,0,StiService
AddService=TermService,0,TerminalServices
AddService=PlugPlay,0,PlugPlayService
AddService=FontCache3.0.0.0,0,FontCacheService
AddService=FontCache3.0.0.0,0,WPFFontCacheService
AddService=LanmanServer,0,LanmanServerService
AddService=FontCache,0,FontCacheService
[Strings]
MciExtStr="Software\Microsoft\Windows NT\CurrentVersion\MCI Extensions"
@ -2989,7 +2992,7 @@ ServiceType=32
StartType=2
ErrorControl=1
[FontCacheService]
[WPFFontCacheService]
Description="Windows Presentation Foundation font cache service"
DisplayName="Windows Presentation Foundation Font Cache 3.0.0.0"
ServiceBinary="%10%\Microsoft.Net\Framework\v3.0\wpf\presentationfontcache.exe"
@ -3010,6 +3013,19 @@ ErrorControl=1
HKR,Parameters,"ServiceDll",,"%11%\srvsvc.dll"
;; HKLM,%CurrentVersionNT%\SvcHost,"netsvcs",0x00010008,"lanmanserver"
[FontCacheService]
AddReg=FontCacheServiceKeys
Description="Windows Font Cache Service"
DisplayName="Windows Font Cache Service"
ServiceBinary="%11%\svchost.exe -k netsvcs"
ServiceType=32
StartType=3
ErrorControl=1
[FontCacheServiceKeys]
HKR,Parameters,"ServiceDll",,"%11%\fntcache.dll"
;; HKLM,%CurrentVersionNT%\SvcHost,"netsvcs",0x00010008,"fontcache"
[Services]
HKLM,%CurrentVersion%\RunServices,"winemenubuilder",2,"%11%\winemenubuilder.exe -a -r"
HKLM,"System\CurrentControlSet\Services\Eventlog\Application",,16