Archive: Service Control Library shows "Skipped: System.dll" in details... how to prevent?


Service Control Library shows "Skipped: System.dll" in details... how to prevent?
Hi everyone -

This forum has been a great resource for me as I learn the NSIS and I think it's terrific how everyone is so generous with their assistance. Hopefully somebody will be willing to spend a few minutes reading my question and helping this newbie out. :)

In my installer, I use dselkirk's Service Control Library v1.2. It really works great and does just what I need it to do, but I have a question about its operation.

I've noticed that the service lib causes the system plugin to DetailPrint a lot of messages like this in my install log:

Skipped: D:\Temp\nsk920.tmp\System.dll

I don't like these messages and want to get rid of them, so I tried to track down their source. It turns out that they're generated when I use the service lib to reference a nonexistent service. For instance, the following code calls the SERVICE macro to check if the service "myservice" is installed and delete it if it is.

!insertmacro SERVICE "installed" "myservice" "action=delete;"

The code works great so long as "myservice" exists. However, if there's no service with that name, it prints one of those "Skipped" messages.

I don't know much about how the system plugin works, but I believe the messages may be caused by the way the service lib checks if a service exists. Basically, it tries to open a handle to the service using the system plugin and assumes the service doesn't exist if it's unsuccessful. This works fine, except the system plugin basically sees:

"Open handle to service control manager"
"Open handle to service 'myservice'" ; Returns an error
"Close handle to service control manager"

I assume the "Skipped" messages are generated because there are no ControlService instructions being passed to the DLL, just OpenSCManagerA, OpenServiceA and CloseServiceHandle. It seems logical to me that the system plugin might realize it's just opening and closing a couple handles, and return the message so the user knows it's skipping that step.

Ultimately, however, my knowledge of Windows programming is severely limited and these are just educated guesses about what's going on behind the scenes. All I know for a fact is that the messages are generated when I call the SERVICE macro with a nonexistent service name, regardless of the action or parameters specified.

It's my hope that someone can offer advice as to how I can prevent/suppress/remove these messages from the install details window. Even if it's not possible without modifying and recompiling the system plugin, I'd still like to know so I can relax :). I'd be really grateful for any assistance. Thanks a lot!

-Y


Sorry to bump my thread - this is the only time I'll do it - but I'd really love to get an answer to my question. Anyone...?

Thanks,

-Y


Hi,

About your problem...I can understand that it's a “little bit” annoying to get all the text in the log window. I don’t know how to suppress it.

But I have an idea on how to bypass this problem. Maybe you should use a plugin, i.e. a dll that does the same as the NSI script does. The plugin name I’m talking about is the nsSCM.dll - see the link below.

nsSCM

I use this plugin myself in an installation and I didn’t experienced any problems in using it. You get the source code for it too, so if you need to change it you’re able to do that.
As mentioned above, the plugin have the same functionality as your nsi script. The difference is that you can control the output in another way – less annoying than the other one.

I hope this helps
Regards
/Paul


You should be able to prevent these messages from being displayed using the SetDetailsPrint setting.


Ofcourse SetDetailsPrint can be used in this case to avoid the log messages from being shown in the log window.

But in this case, this is not what we really want to do - we only want to suppress the log messages from being shown when the service is not installed or when there are problems installing it. In all other cases we want to see the messages, or don't we? This is what I understod - anyway.

But ok, maybe you should do as Joost suggests - do not show the messages in the log window while trying to install the service.

You can look in the NSIS help file, see section 4.9.14.13 SetDetailsPrint. You can use this built in function to disable and then to enable back the log messages.

/Paul


That message is not coming from the Service Library itself nor does it come from the System plug-in. It looks like NSIS tries to extract System.dll but fails because it's already there. It should never show that because right before the internal File command there an internal SetDetailsPrint command to supress that message. It is even weirder that it shows just in certain cases.

Please provide some more information such as an example script, the exact version of NSIS you are using and anything else that might help.


Thanks everybody for your assistance! I'm currently working around the problem by using SetDetailsPrint and it works okay.

kichik - I am running the release version of NSIS 2.0. The attached script reproduces the problem on my machine. Please remember it also requires the Service Control Library v1.2.

Thanks again to everyone offering advice. I hope this example script helps shed some light on the nature of the problem.

Best regards,

-Y


I too am getting this error in the details window of "Skipped ...\system.dll" when using ServiceLib.nsi when calling to get the "status" on a service that I know exists, but is not running. I put some debugging code in and discovered that the second call into the System plugin, calling OpenServiceA, is returning a zero value (failure). Calling GetLastError, I get back a value of 80, which is "The file exists."??? I tried using /NOUNLOAD on all calls, but that didn't make a difference.

Anyone have a solution to this problem?

Joe A.


In the ServiceControlLibrary (servicelib.nsh) try changing the two IntCmp instructions after the "lbl_done" label from relative jumps to ones which use a label:


lbl_done:
IntCmp $5 0 lbl_done_a
System::Call 'advapi32::CloseServiceHandle(i r5) n'
lbl_done_a:
IntCmp $4 0 lbl_done_b
System::Call 'advapi32::CloseServiceHandle(i r4) n'
lbl_done_b:


From Section 4.4 (Relative Jumps) in the NSIS manual:
"Note: relative jumps don't work with ... plug-ins (Plugin::Function)... Do not try to jump over them using relative jumps, you will not get the result you were expecting."

I tried your suggested change and have the same error. The problem is occuring well before the CloseServiceHandle() calls you suggested changing. The error is near the top of the function. The code from ServiceLib.nsi reads as follows:

[code]
StrCpy $0 "false"
System::Call 'advapi32::OpenSCManagerA(n, n, i ${SC_MANAGER_ALL_ACCESS}) i.r4'
IntCmp $4 0 lbl_done
StrCmp $3 "create" lbl_create
System::Call 'advapi32::OpenServiceA(i r4, t r2, i ${SERVICE_ALL_ACCESS}) i.r5'
IntCmp $5 0 lbl_done
[code]

The call to OpenServiceA fails, returning a zero value in $5. I put a MessageBox in and the values being passed to it seem okay. I'm not sure the message in the details window (about "Skipping ...\system.dll") is significant or not.

Any other suggestions?

Joe A.


I found my problem, actually two problems.

First, I was using the "Display Name" of the service, not the "Service Name" as I should have done (and they are different in the case of this service).

Second, I moved the location of my Section down in the script and, for some unexplained reason, the detail window message "Skipping ...\system.dll" has now disappeared.

Thanks to all who replied.

Joe A.