Você está na página 1de 3

Creating OpenOffice.

org Service on Legacy Windows



IMPORTANT: This article contains information about editing the registry. Before you edit the
registry, make sure you understand how to restore it if a problem occurs. For information on how to
do this, view the "Restoring the Registry" or the "Restoring a Registry Key" online Help topics in
Registry Editor.
INTRODUCTION: This is what we want to do on a server machine creating a Windows
Service for an OpenOffice.org instance which will always run and listen for connections.
Here we see how to create a Windows Service: using the SRVANY utility that you can
download for free as part of the Resource Kit. (Context of Win2K3/XP-SP2.)
1. Install OpenOffice.org normally, and start at least once under the current user.
2. Download and install the Windows Server 2003 Resource Kit Tools
a) If the Beta version of Resouce Kit Tools is installed, it needs to be removed first.
b) Click the Download button on this page to start the download. Do one of the
following:
i) To start the installation immediately, click Open or Run this program from its
current location
ii) To copy the download to your computer for installation at a later time, click
Saveor Save this program to disk.
c) To install the Resource Kit tools, run the rktools.exe package. After you accept the
End User License Agreement (EULA), all necessary files are installed to the
%Program Files%\Windows Resource Kits\Tools folder.
d) Prior to starting and using the Resource Kit tools, please be sure to read the
readme.htm file, which is located in the %Program Files%\Windows Resource
Kits\Tools folder.
3. Next: How To Create a User-Defined Service
1) At a MS-DOS command prompt(running CMD.EXE), type the following
command:

path\INSTSRV.EXE My Service path\SRVANY.EXE

where path is the drive and directory of the Windows NT Resource Kit (i.e.,
C:\RESKIT) and My Service is the name of the service you are creating.

Example:
(1) C:\Program Files\Resource Kit\Instsrv.exe Notepad C:\Program
Files\Resource Kit\Srvany.exe
(2) NOTE: To verify that the service was created correctly, check the
registry to verify that the ImagePath value under
(3) HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic
es\service name
(4) is set to point to SRVANY.EXE. If this is not set correctly, the service
will stop shortly after it starts and return an Event ID 7000 "The
service name failed to start."

WARNING: Using Registry Editor incorrectly can cause serious
problems that may require you to reinstall your operating system.
Microsoft cannot guarantee that problems resulting from the incorrect
use of Registry Editor can be solved. Use Registry Editor at your own
risk.

For information about how to edit the registry, view the "Changing
Keys And Values" online Help topic or the "Add and Delete
Information in the Registry" and "Edit Registry Data" online Help
topics in Registry Editor.

NOTE: You should back up the registry before you edit it.
2) Run Registry Editor (Regedt32.exe)and locate the following subkey:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<My
Service>
3) From the Edit menu, click Add Key. Type the following and click OK:

Key Name: Parameters
Class : <leave blank>
4) Select the Parameters key.
5) From the Edit menu, click Add Value. Type the following and click OK:

Value Name: Application
Data Type : REG_SZ
String : <path>\<application.ext>

where <path>\<application.ext> is the drive and full path to the application
executable including the extension (i.e., C:\WinNT\Notepad.exe)
6) Close Registry Editor.
a) By default, a newly created service it configured to run Automatically when
the system is restarted. To change this setting to Manual, run the Services
applet from Control Panel and change the Startup value to Manual. A service
set to Manual can be started in one of several ways:
(1) From the Services applet in Control Panel

- From a MS-DOS command prompt, type the following:

NET START <My Service>

- Use the Sc.exe utility from the Resource Kit. Type the following
from a MS-DOS command prompt:

<path>\Sc.exe start <My Service>

where <path> is the drive and directory of the Windows NT Resource
Kit (i.e., C:\Reskit).
4. Create a service named OpenOfficeUnoServer following the instructions above; as
the Application registry value use C:\Program Files\OpenOffice.org
2.0\program\soffice.exe
5. Add another value to the Parameters key named AppParameters and set it to -
headless -accept=socket,port=8100;urp;
6. From Control Panel / Administrative Tools / Services open the Properties for the new
service and change the Log On account to be Local Service which is a more secure
option than SYSTEM
7. If we stop here the service will start but not actually work. That's because the service
runs as a special account and OpenOffice.org will try to show the license agreement
dialog as if it was a new user instead of starting the application. To avoid this, you
need to edit share\registry\data\org\openoffice\Setup.xcu (it's an XML file)
inside the OpenOffice.org installation directory and replace this bit
8. <prop oor:name="ooSetupInstCompleted">
9. <value>false</value>
10. </prop>
11. <prop oor:name="ooSetupShowIntro">
12. <value>true</value>
</prop>
with this other one (replace the date with today's date; it must be later than the OOo
installation time)
<prop oor:name="ooSetupInstCompleted" oor:type="xs:boolean">
<value>true</value>
</prop>
<prop oor:name="LicenseAcceptDate" oor:type="xs:string">
<value>2006-07-25T17:34:04</value>
</prop>
<prop oor:name="FirstStartWizardCompleted" oor:type="xs:boolean">
<value>true</value>
</prop>
13. Start your new service (e.g. from Control Panel / Administrative Tools / Services)
14. You may need to unblock the new service at the firewall level
15. From a command prompt do
> netstat -anp tcp
This will show a listening on port 8100. Chances are that the service will only listen on the
127.0.0.1 interface; this means you can only connect from the same machine and it's good
from a security point of view. However, if you want to be able to connect from other
machines as well you need to change the accept string to
"socket,host=0.0.0.0,port=8100;urp;" in the AppParameters registry value

Você também pode gostar