![]() |
nsSCM plugin tip
Hi,
Just wanted to share the solution to a very frustrating problem that has kept me busy for a while, I searched for old posts about this issue but found nothing, so here it is: I'm working on an installer for a small win32 service application, and using the nsSCM plugin to install/start/stop the service. So far it's all working fine on my PC system, however I did run into a problem when I tried to run the setup as an upgrade (service already installed and running) on a very slow VIA mini-ITX system. During the setup process the service should have been stopped so the service .exe can be overwritten with the new version, but appearantly this did not work properly. The main section contains code that calls nsSCM and then installs the new files: code: Sometimes I would get a "File is locked/in use" or similar dialog for the service exe, however it worked when you would press "retry". What I figured out is that the nsSCM::Stop command does not wait for the service process to fully terminate, which can take a few seconds on slow systems, depending on your application. Solution: I used the FindProcDLL plugin to wait for the process to terminate, not sure if this is the best way, but it works :) code: The same code should also be added to the uninstaller, otherwise the service exe might be locked when the uninstaller attempts to delete the file. Just thought I'd share this approach, maybe it will be of use to someone ;) |
Hi
Available commands: nsSCM::Install [name_of_service] [display_name] [service_type] [start_type] [service_commandline] [load_order_group] [dependencies] [account] [password] nsSCM::Start [name_of_service] nsSCM::Stop [name_of_service] nsSCM::QueryStatus [name_of_service] nsSCM::Remove [name_of_service]Parameters: name_of_service - the name of the service used for Start/Stop commands and all further nsSCM commands display_name - the name as shown in the service control manager applet in system control service_type - one of the following codes 1 - device driver 16 - service 272 - service with Desktop Interaction start_type - one of the following codes 0 - driver boot stage start 1 - driver sscm stage start 2 - service auto start 3 - driver/service manual start service_commandline - the path to the binary including all necessary parameters load_order_group - controls the order of service starts dependencies - needed services, controls which services have to be started before this one account - the account which should be used to run the service password - password of the aforementioned account to be able to logon as a service If you do not specify account/password, the local system account will be used to run the service. |
| All times are GMT. The time now is 04:47. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.