Windows10 Daemon start is timing out lazarus / 34-Windows ---------------------------------------------------------------------- Michael Collier · 2018-07-10 11:21 When I start a process in windows10 services I get timeout message on the start up (it seems win10 has 3000ms timeout limit on response to start command), works ok on XP though, I don't think I'm doing anything that would delay start up, maybe response message not getting through to win services?..any ideas? ---------------------------------------------------------------------- Thaddy · 2018-07-10 11:37 Services (windows daemons if you will) likely require a proper manifest file or resource. Is that in place? ---------------------------------------------------------------------- Michael Collier · 2018-07-10 11:54 Ok thanks for the tip, will try creating and testing with manifest ---------------------------------------------------------------------- Michael Collier · 2018-07-10 14:27 More info,.. I forgot to mention that when I ran the daemon with install -i it worked on XP, but on the win10 machine it didn't show up. We tried using sc.exe on win10 to register it and then it showed up in services window, but starting it gives the error. I found a link in stack overlfow that states that the timeout error can occur if you use sc.exe to register a service that is missing ServiceMain https://stackoverflow.com/questions/3582108/create-windows-service- from-executable Any idea why the -i option didn't make the service appear in win10 servies window (I did remember to refresh) ---------------------------------------------------------------------- Remy Lebeau · 2018-07-10 22:13 Quote from: Michael Collier on July 10, 2018, 01:21:05 pmWhen I start a process in windows10 services I get timeout message on the start up (it seems win10 has 3000ms timeout limit on response to start command), works ok on XP though, I don't think I'm doing anything that would delay start up, maybe response message not getting through to win services?..any ideas? That is really hard to answer without seeing your actual service code. Quote from: Thaddy on July 10, 2018, 01:37:55 pmServices (windows daemons if you will) likely require a proper manifest file or resource. Is that in place? Services don't need or use manifests just to be able to install/run. Quote from: Michael Collier on July 10, 2018, 04:27:22 pmAny idea why the -i option didn't make the service appear in win10 servies window (I did remember to refresh) Were you running it from an elevated command prompt so it could install using admin rights? ---------------------------------------------------------------------- Michael Collier · 2018-07-11 11:19 Quote from: Remy Lebeau on July 11, 2018, 12:13:10 amThat is really hard to answer without seeing your actual service code. I'll get a copy, clean and upload.. Quote from: Michael Collier on July 10, 2018, 04:27:22 pmWere you running it from an elevated command prompt so it could install using admin rights? ..it wasn't me at the keyboard so don't know what the environment at the time was..I did notice the cmd window had the administrator title in the caption at the top so assumed admin rights..would that be ok? ---------------------------------------------------------------------- Remy Lebeau · 2018-07-11 23:07 Quote from: Michael Collier on July 11, 2018, 01:19:18 pmI did notice the cmd window had the administrator title in the caption at the top so assumed admin rights..would that be ok? Yes.  That caption appears only when the command window is started with elevated rights. ---------------------------------------------------------------------- Michael Collier · 2018-07-11 23:25 Thanks, sorry for delay getting source code uploaded, I have attached project that works on XP for me. Will try on Win10 when I can get access to machine in morning. The example is a minimum demo, it just beeps every 3 seconds.. It has readme and a couple of batch files to register/un-register If the example works and anyone suggests tidying it up for others to use then I'm happy to do that.. Mike ---------------------------------------------------------------------- Michael Collier · 2018-07-12 11:51 I have uploaded new zip with updated batch files for register/un- register (they were empty) I have had some feedback on this, 1. The service does install on Win10 2. The service does Start (shows as running, stop button becomes enabled) but no beep from the service, I'm using lazarus beep command, any reason why this might not work in a service in Win10, I get beeps on XP ---------------------------------------------------------------------- balazsszekely · 2018-07-12 12:10 Quotebut no beep from the service, I'm using lazarus beep command, any reason why this might not work in a service in Win10From vista+ services run in a different session(0). You cannot interact with the desktop(speaker included), however you can create/open/read/write file(s). If you need an interactive service, create a separate application, auto run it at startup, then do some kind of interprocess communication between the service and the regular exe:  - sockets  - memory mapped files  - pipes  - data copy etc... ---------------------------------------------------------------------- Michael Collier · 2018-07-12 12:40 Great, thanks, the beep was just there to confirm the service was running, so I'll take it out now.. I guess I could try and replace beep with a simple visit to PHP page, using indy socket. The PHP page can simply update a database to show it received signal from the service. No need to send anything back. Does that sound like something Win10 would allow, indy socket to outside URL? ---------------------------------------------------------------------- balazsszekely · 2018-07-12 12:47 QuoteGreat, thanks, the beep was just there to confirm the service was running, so I'll take it out now..Your service works fine, the worker thread is started. I tested by creating a file, so you can remove the beep if you like. QuoteDoes that sound like something Win10 would allow, indy socket to outside URL?Definitely yes. Of course it depends on the firewall settings too, but you can always add an exception to windows defender or whatever firewall you use. ---------------------------------------------------------------------- Michael Collier · 2018-07-13 03:37 Quote from: Remy Lebeau on July 12, 2018, 01:07:40 amYes.  That caption appears only when the command window is started with elevated rights. I wasn't at the computer when this was entered but I was sent the info.. net user administrator /active:yes This seemed to get service registration going, I'm not clear on the sequence that led up to this being needed, and not sure if the cmd window had been opened as admin...but thought I'd mention it in case it helps others..