Mike wrote:
ServiceStartName: I don't know what this does, and a string in this
place does not appear anywhere I can find.
It specifies the user account that the service runs as. If blank, the SYSTEM
account is used.
Did something change in the class naming convention for TService between
RS2010 and XE7?
The only changes that have been made to the SvcMgr unit between 2010 and
XE7 are:
- the addition of Unit Scope names.
- data type corrections (Integer -> DWORD, LPSTR -> LPWSTR, etc)
- {$IFEND} changed back to {$ENDIF} as {$IFEND} is now deprecated.
- use of MessageDlg() is disabled when TService is running in a console process.
No
logic changes have been made otherwise. And certainly nothing has changed
regarding service installation. It still uses the Win32 API CreateService()
function, and it still passes the TService.DisplayName property value as-is
to the lpDisplayName parameter.
In fact, the entire SvcMgr unit as a whole has changed very little since
it was first introduced in C++Builder/Delphi 5. Most of the updates are
to account for .NET support and compiler/RTL changes. Consequently, TService
still cannot take advantage of many of the new features that have been introduced
since Win2K.
Now, that being said, the TService::DisplayName property uses a getter method
that returns (and has always returned) the value of the TService::Name property
when a non-blank value has not been assigned to the TService::DisplayName
property beforehand. Turns out that the RTL has a bug going all the way
back to at least XE2 (when some RTTI functions used by the DFM streaming
system were re-written) which causes certain UnicodeString values stored
in a DFM to not be streamed correctly at run-time, but it only happens in
C++Builder (it works fine in Delphi). The TService::DisplayName property
is affected by this bug. Its design-time value does not get assigned to
the property at run-time, so it is blank when CreateService() is beign called,
and thus the TService::Name property value gets assigned to the SCM instead.
This problem was discussed in detail earlier this year:
TService DisplayName does not show in the Service control manager
https://forums.embarcadero.com/thread.jspa?threadID=105238
In particular, here is my analysis when I traced into the problem:
https://forums.embarcadero.com/thread.jspa?threadID=105238#656046
As a workaround, you can use the TService::BeforeInstall event to manually
assign your desired string value to the TService::DisplayName property, and
then it won't be blank anymore when CreateService() is called.
AFAIK, the bug never got reported to QualityCentral or QualityPortal yet.
--
Remy Lebeau (TeamB)
Connect with Us