Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2014-10

Trying to register a Windows Service gives error

10 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

I created a relatively simple Windows Service Application using FPC 2.6.4. The application imports CSV data from a monitored folder and updates product tables in a MS SQL Server database.

The Service Application installed and ran perfectly on my Windows 7 workstation. It also installed and ran perfectly on our Development Server (Windows 2008 R2 SP1 64-bit).

But when we deployed the application to our client's test server (also Windows 2008 R2 SP1 64-bit) we got the following error trying to register the service.

==============================================
C:\Q-Point\csvimporter>csvimporter_service
Usage: C:\Q-Point\csvimporter\csvimporter_service.exe [command] Where command is one of the following:
-i --install To install the program as a service -u --uninstall To uninstall the service
-r --run To run the service

C:\Q-Point\csvimporter>csvimporter_service -i
exception at 0042CD50:
System error, (OS Code 5):
Access is denied.
.

C:\Q-Point\csvimporter>
==============================================

Immediately I thought we don't have enough permissions on the client test server. The client came back and said the user we are using is an Administrator user. So permissions shouldn't be a problem. :-/

Any thoughts on what it could be?

More details on the application:
--------------------------------
The application is based on the daemonapp.pp unit - part of FCL-Extra. I've followed Michael van Canneyts "daemon.pdf" article to the letter. I created the application, created the daemon thread etc. As I mentioned, it works fine on my workstation and on our development test server. But doesn't install on the client's test server.

I Googled the error and came across a FPC-Pascal message from 2011. [http://lists.freepascal.org/pipermail/fpc-pascal/2011-October/030464.html]. But in that discussion the developer tried to query the Windows Services by instantiating a TServiceManager instance. In our case we are using the daemonapp unit instead.

Any help would be greatly appreciated.

Regards,
Graeme

This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions are solely those of the author and do not necessarily represent those of Quality Technology Systems Ltd. If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone. If you receive the message in error, please immediately delete it, destroy all copies of it and notify the sender. Internet email is not a totally secure medium and therefore Quality Technology Systems Ltd does not accept legal responsibility for the contents of this message. We have taken steps to ensure that this email and any attachments are free from viruses. However, we cannot accept any responsibility for any virus transmitted by us and recommend that you subject any incoming email to your own virus checking procedure. Registered in England No. 3208823

Graeme Geldenhuys
to Graeme Geldenhuys
Graeme Geldenhuys wrote
C:\Q-Point\csvimporter>csvimporter_service -i exception at 0042CD50: System error, (OS Code 5): Access is denied.

Just a quick follow-up...

I eventually found the problem (by pure luck). Windows Server is weird! Even though we logged in with an Administrator privileged account, when you open the standard Command Prompt window, it is NOT admin privileged. Thus the error. We had to right click the Command Prompt shortcut and select "Run as Administrator" - then the service registered and ran fine.

Regards,
Graeme

This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions are solely those of the author and do not necessarily represent those of Quality Technology Systems Ltd. If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone. If you receive the message in error, please immediately delete it, destroy all copies of it and notify the sender. Internet email is not a totally secure medium and therefore Quality Technology Systems Ltd does not accept legal responsibility for the contents of this message. We have taken steps to ensure that this email and any attachments are free from viruses. However, we cannot accept any responsibility for any virus transmitted by us and recommend that you subject any incoming email to your own virus checking procedure. Registered in England No. 3208823

Sven Barth
to Graeme Geldenhuys
"Graeme Geldenhuys" wrote 17 lines
On 06/10/2014 11:59, Graeme Geldenhuys wrote: > C:\Q-Point\csvimporter>csvimporter_service -i > exception at 0042CD50: > System error, (OS Code 5): > Access is denied. Just a quick follow-up... I eventually found the problem (by pure luck). Windows Server is weird! Even though we logged in with an Administrator privileged account, when you open the standard Command Prompt window, it is NOT admin privileged. Thus the error. We had to right click the Command Prompt shortcut and select "Run as Administrator" - then the service registered and ran fine.

That's the case since Windows Vista. Maybe you have disabled UAC or any involved mechanisms on the development machines?

Regards,
Sven

Graeme Geldenhuys
to Sven Barth
Sven Barth wrote
That's the case since Windows Vista. Maybe you have disabled UAC

Interesting, thanks for mentioning that. I know I've disabled UAC on my work laptop. I'm not in control of our development server, but I'll ask the admin when he is back in the office.

Regards,
Graeme

This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions are solely those of the author and do not necessarily represent those of Quality Technology Systems Ltd. If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone. If you receive the message in error, please immediately delete it, destroy all copies of it and notify the sender. Internet email is not a totally secure medium and therefore Quality Technology Systems Ltd does not accept legal responsibility for the contents of this message. We have taken steps to ensure that this email and any attachments are free from viruses. However, we cannot accept any responsibility for any virus transmitted by us and recommend that you subject any incoming email to your own virus checking procedure. Registered in England No. 3208823

Sven Barth
to Graeme Geldenhuys
"Graeme Geldenhuys" wrote 9 lines
On 06/10/2014 16:36, Sven Barth wrote: > That's the case since Windows Vista. Maybe you have disabled UAC Interesting, thanks for mentioning that. I know I've disabled UAC on my work laptop. I'm not in control of our development server, but I'll ask the admin when he is back in the office.

It's one of the reasons why I keep UAC enabled on my Windows systems: I catch such problems immediately ;)

Regards,
Sven

Michael Van Canneyt
to Sven Barth
Sven Barth wrote 13 lines
Am 06.10.2014 17:45 schrieb "Graeme Geldenhuys" : > > > > On 06/10/2014 16:36, Sven Barth wrote: > > That's the case since Windows Vista. Maybe you have disabled UAC > > Interesting, thanks for mentioning that. I know I've disabled UAC on my > work laptop. I'm not in control of our development server, but I'll ask > the admin when he is back in the office. It's one of the reasons why I keep UAC enabled on my Windows systems: I catch such problems immediately ;)

I stopped doing that, because the constant messages are a real PITA.

Michael.

Sven Barth
to Michael Van Canneyt
"Michael Van Canneyt" wrote 18 lines
On Mon, 6 Oct 2014, Sven Barth wrote: > > Am 06.10.2014 17:45 schrieb "Graeme Geldenhuys" : > > > > > > > > On 06/10/2014 16:36, Sven Barth wrote: > > > That's the case since Windows Vista. Maybe you have disabled UAC > > > > Interesting, thanks for mentioning that. I know I've disabled UAC on my > > work laptop. I'm not in control of our development server, but I'll ask > > the admin when he is back in the office. > > It's one of the reasons why I keep UAC enabled on my Windows systems: I

catch such problems immediately ;)

I stopped doing that, because the constant messages are a real PITA.

Our main application requires admin rights as well, but quite quickly my muscle memory has taken over so that I can just dismiss the UAC dialog without thinking much about it. (I did disable the "use secure desktop" option though so that I don't get a black screen for some seconds...)

Regards,
Sven

Graeme Geldenhuys
to Michael Schnell

Hi Michael,

Michael Schnell wrote
Please don't use such excessive multi-line "declaimers" in a forum.

I did notice those (and don't like it either), but unfortunately nothing I can do about it. It is my work address and our mail server injects those "disclaimers" _after_ we sent the messages from our computers.

I'll try and limit posts from my work address to this mailing list.

Regards,
Graeme

This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions are solely those of the author and do not necessarily represent those of Quality Technology Systems Ltd. If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone. If you receive the message in error, please immediately delete it, destroy all copies of it and notify the sender. Internet email is not a totally secure medium and therefore Quality Technology Systems Ltd does not accept legal responsibility for the contents of this message. We have taken steps to ensure that this email and any attachments are free from viruses. However, we cannot accept any responsibility for any virus transmitted by us and recommend that you subject any incoming email to your own virus checking procedure. Registered in England No. 3208823

Giuliano Colla
to Graeme Geldenhuys

Il 07/10/2014 13:31, Graeme Geldenhuys ha scritto:

Show quoted text 7 lines
Hi Michael, On 07/10/2014 12:12, Michael Schnell wrote: > Please don't use such excessive multi-line "declaimers" in a forum. I did notice those (and don't like it either), but unfortunately nothing I can do about it. It is my work address and our mail server injects those "disclaimers" _after_ we sent the messages from our computers.

It's the way lawyers try to appear indispensable: annoying everybody with useless lengthy legal stuff. Decent people, when receiving an e-mail not meant for them, just trash it. Marauders will try to take advantage from it, no matter how long is the disclaimer.

Giuliano

Giuliano Colla Project planning question: when it's 90% done, are we halfway or not yet?