Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
VCL
8-Byte Alignment
Action Classes
Additional Controls
Core VCL Classes
DFM to TEXT
Dialog Controls
Docking
Drag/Drop
Emulation Classes
Exceptions
Gestures
Graphics
MAPI Support
MDI Support
Multi-Monitor Support
OnGesture event
Printing
Property/Type Editors
Registry / INI Objects
Ribbon Controls
Sample Controls
Services
Standard Controls
Styles
System Controls
Thread support
Touch Controls
Type Info
Win 3.1 Controls
Win 32 Controls
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/VCL/Services
[ Add a report in this area ]
Report #:
5728
Status:
Closed
Service Installation Failure
Project:
Delphi
Build #:
4453
Version:
7.0
Submitted By:
Daniel Wischnewski
Report Type:
Minor failure / Design problem
Date Reported:
8/26/2003 6:06:48 AM
Severity:
Serious / Highly visible problem
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All versions
Internal Tracking #:
192925
Resolution:
Cannot Reproduce
(Resolution Comments)
Resolved in Build:
:
9.0.1761.24408
Duplicate of:
None
Voting and Rating
Overall Rating:
(1 Total Rating)
5.00 out of 5
Total Votes:
None
Description
During the installation of a, with Delphi developed, service you may encounter a problem if the path/folder where the service executable resides in contains one or more spaces (#32).
The Service installs itself in the registry using the Win32 API command "CreateService". As eigth parameter the location of the service is passed "PChar(Path)".
Path ist loaded with the value of "ParamStr(0)". This value may contain spaces. This will cause the service manager to not start the service at all telling the user that the sevice is not a valid Win32 application.
Steps to Reproduce:
1. Create a new service application with the Borland Delphi 7, probably earlier versions, too.
2. Give the service a valid name and compile it.
3. Copy the executable into a directory that contains a space character (#32) somewhere along the parent folders.
4. Register the service by running the executable and pass along the parameter /INSTALL.
5. Open the service manager console and try starting the service. You should be confronted with the error message mentioned in the description.
(I am using Windows 2000 Server, German Edition, Service Pack 4 including the latest hotfixes.)
Workarounds
Following code within the "AfterServiceInstall" Eventhandler will "fix" the problem.
try
with TRegistry.Create do
try
RootKey := HKEY_LOCAL_MACHINE;
if OpenKey('\System\CurrentControlSet\Services\' + Name, True) then
try
WriteString('ImagePath', '"' + GetModuleName + '"');
finally
CloseKey;
end;
finally
Free;
end;
except
end;
either a 8.3-conform DOS-Name of the executable may be submitted.
Correctly this issue should be corrected in the SvcMgr.pas unit. The method "TServiceApplication.RegisterServices" contains the inline procedure "InstallService" that runs the Win32 API function "CreateService" that should be fixed as mentioned.
---------
Following code within the "AfterServiceInstall" Eventhandler will "fix" the problem.
try
with TRegistry.Create do
try
RootKey := HKEY_LOCAL_MACHINE;
if OpenKey('\System\CurrentControlSet\Services\' + Name, True) then
try
WriteString('ImagePath', '"' + GetModuleName + '"');
finally
CloseKey;
end;
finally
Free;
end;
except
end;
either a 8.3-conform DOS-Name of the executable may be submitted.
Correctly this issue should be corrected in the SvcMgr.pas unit. The method "TServiceApplication.RegisterServices" contains the inline procedure "InstallService" that runs the Win32 API function "CreateService" that should be fixed as mentioned.
Attachment
None
Comments
None
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us