Kwakkelflap: tools for the IT pro

Tuesday, April 17, 2007

HOWTO: Interactive service in Windows Vista

In previous Windows versions, all services run in the same session as the first user who logs on. This session is called session 0. Running services and user applications together in session 0 poses a security risk. In Windows Vista, only system processes and services run in session 0. Vista isolates services in session 0 and makes session 0 noninteractive. The user logs on to session 1, and runs applications in this session. Please refer to this article for a detailed explanation of services and session 0.

The result of this change is that an interactive service is not visible for a user. The service will be running, but you will not see the GUI. However, the user can switch to the session 0 desktop and interact with the service by using the following dialog:



When you click on "Show me the message" you will switch to session 0. Here you can see your interactive service:



Switch back by clicking "Return now".

Note that the "Interactive Services Detection Service" (UI0Detect) has to run before you can see this dialog, so make sure this service is running. The easiest way to do this, is to put this service in your service dependencies. Your service will not start if this service isn't running. Also, change the startup type for this service from 'Manual' to 'Automatic'.

Of course, you can't do much in session 0, so you might want to create a desktop for this session. Create a new interactive service in Service - O - Matic, and use "C:\Windows\Explorer.exe" as the program.



You might want to create a load order group for this service, so other interactive services will start this service automatically.



In your other service, change the service dependencies. Use "UI0Detect" as a service dependency, and the load order group created above as a service group dependency.



If you start your service, you can see the same message as before, but you will have a functioning desktop in session 0.

Labels: ,

Wednesday, April 04, 2007

Comparing to the competition

I was checking the most popular download sites to see if they updated our Watchdog - O - Matic program when I saw I had a new competitor. They've been selling a shareware program that tries to do the same thing as Watchdog - O - Matic since January. So I was wondering how their program performed. It's only natural that competitors check each other’s program and compare theirs with it. What's not so frequent is that someone posts test results and their thoughts about it online. Yes, I know this might help my competitors fix their problems. I'm such a helpful guy. I will try to give you an honest opinion, but I might be biased sometimes.

It's easy to see that their program is made with mine as an example. Several features in the application are named the same way. And even parts of the manual and website are copied and changed a little.

E.g. I had an option before 5.00 (removed because it's obsolete in the new version):
"Don't start if already running but watch the active process"
Their option is:
"Don't start another copy if already running"

They do have a nice looking manual though. This is a part where I still need some improvements. Personally, I think it's not necessary to spend my time writing huge manuals IF you create a GUI that's easy to use. This is why I have been adding tooltips so the user doesn't have to refer to the manual all the time.

As far as I can tell, the new program doesn't actually 'debug' the target, but is watching the CPU and Memory activity. This is similar to other competitors, and I'm expecting the same problems with regards to detecting crashes. I configured the program to check my own crash application, and these are the results.

Crash in the main thread: a crash dialog appears requiring a user action, and a 'hanging application' is detected. The crash application is freezed by windows so that's why the program detects a not responding application. The program tries to close our application, but is unable to do that due to the dialog (even with the terminate option enabled). So our crash test program just sits there. It crashed, and it stays dead while the program is waiting to restart the crashed application.



They acknowledge the problem in their forum, and suggest that the user should disable the crash dialogs (although this doesn't work with the steps they suggest). Users shouldn't change settings like these if it can be avoided. Certainly if it is a setting outside of your own application (e.g. Windows).

A crash in a different thread is not detected. Apparently the program only checks if the main thread is running. Unfortunately, this isn't enough. You need to dig a lot deeper if you want to detect problems in multithreaded applications. Otherwise, you won't even notice that there is a problem and the target application isn't running like it should.

The 'not responding check' is working. The program checks the CPU usage and the message pump of the main thread, which is sufficient. This is exactly how we check for hanging applications.

CPU usage: when an application is using 100% on a dual core, then the program measures a 50% usage so no problem is detected. I haven't tried the detection on a single core CPU, but I suspect that this will work. I do wonder what will happen if your application is using 100% for a limited time, which might be normal behaviour. It's probably an 'all or nothing' option that can't be tuned to detect normal from abnormal CPU usage.

Memory usage works, although the program seems to check the virtual memory size instead of real memory usage.

While using the program, I discovered some strange things in the user interface. E.g. viewing your application statistics displays the following screen, which is probably a debug window?



It's not all bad. They do have an interesting feature that's been on my todo list for a while. This will be an incentive to implement new features and clean up that todo list of mine.

Labels:

Tuesday, April 03, 2007

Watchdog - O - Matic 5.00 released

The new Watchdog - O - Matic release is ready. A lot has changed in the interface. It should be easier to create new software watchdogs and use the program in general. The previous version had grown completely out of proportion. I noticed many users didn't understand the system. And I have to admit, taking a step back looking at it that it was indeed confusing.

I moved some features around as well. The regular version can now watch programs automatically, and I've added a cool scheduling feature in the professional version. I also added more tooltips for different options.

I noticed the improvements when editing the manual. I was able to remove al the 'notes' and 'tips' scattered throughout the manual. These where items where a user had to pay attention, or something might have gone wrong. So it's a good thing I don't need those anymore.

The downside? The system isn't directly compatible with the older versions. Therefore, we disabled the auto-update to 5.0. If you have an older version, and you want to update to 5.0, drop me a mail at support@kwakkelflap.com with your purchase information. I will send you a new download link as soon as possible.

Labels:

Monday, April 02, 2007

Vista and Inno setup

I'm still adjusting the software to Windows Vista. I think that the clock is ticking as more and more users will be switching to the new operating system. I've made huge improvements with the previous release, but I still need a few tweaks in the setup.

The biggest problem is that my applications need administrator rights for certain functions. One can't expect to be able to debug an application without those rights. This can all be solved without too much hassle, but I want to keep it easy enough for all users.

The previous setups would always disable the User Account Control. While this does solve the problem, it is not the best solution. It would be better to keep the UAC turned on, and still run my programs with administrator rights. So I decided to include a 'manifest file' with my program. This will make sure the application is run with administrator rights. I still want to be able to disable the UAC in the setup though, but it should be something that the user chooses to do instead of disabling it automatically.

So I played with the Inno setup code, and found out how easy it was to create my own function which determines if you want to adjust a registry key or not. I'm always surprised by the power of Inno setup. You can create anything you want using the scripting. Yes, it might require some programming. But you need those programming skills when creating your application in the first place right?

Labels: ,