diff -ur t:\pub\qtservice/qtservice.cpp c:\software\msvc32\ite\Tools\EventServer\qtservice-2.6-commercial_/qtservice.cpp
--- t:\pub\qtservice/qtservice.cpp	2009-08-18 10:42:41.000000000 +0200
+++ c:\software\msvc32\ite\Tools\EventServer\qtservice-2.6-commercial_/qtservice.cpp	2010-02-03 11:20:28.930826700 +0100
@@ -935,6 +935,17 @@
 }
 
 /*!
+    Reimplement this function to perform special handling when the
+    computer is about to be shutdown. 
+
+    This function is called hen the computer is being shutdown. The
+    default implementation does nothing.
+*/
+void QtServiceBase::shutdown()
+{
+}
+
+/*!
     Reimplement this function to process the user command \a code.
 
 
diff -ur t:\pub\qtservice/qtservice.h c:\software\msvc32\ite\Tools\EventServer\qtservice-2.6-commercial_/qtservice.h
--- t:\pub\qtservice/qtservice.h	2009-08-18 10:42:41.000000000 +0200
+++ c:\software\msvc32\ite\Tools\EventServer\qtservice-2.6-commercial_/qtservice.h	2010-02-03 11:20:28.946452300 +0100
@@ -151,6 +151,7 @@
     virtual void stop();
     virtual void pause();
     virtual void resume();
+    virtual void shutdown();
     virtual void processCommand(int code);
 
     virtual void createApplication(int &argc, char **argv) = 0;
diff -ur t:\pub\qtservice/qtservice_win.cpp c:\software\msvc32\ite\Tools\EventServer\qtservice-2.6-commercial_/qtservice_win.cpp
--- t:\pub\qtservice/qtservice_win.cpp	2009-08-18 10:42:41.000000000 +0200
+++ c:\software\msvc32\ite\Tools\EventServer\qtservice-2.6-commercial_/qtservice_win.cpp	2010-02-03 14:00:26.442854300 +0100
@@ -1,17 +1,17 @@
 /****************************************************************************
 **
 ** This file is part of a Qt Solutions component.
-** 
+**
 ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** 
+**
 ** Contact:  Qt Software Information (qt-info@nokia.com)
-** 
-** Commercial Usage  
+**
+** Commercial Usage
 ** Licensees holding valid Qt Commercial licenses may use this file in
 ** accordance with the Qt Solutions Commercial License Agreement provided
 ** with the Software or, alternatively, in accordance with the terms
 ** contained in a written agreement between you and Nokia.
-** 
+**
 ** GNU Lesser General Public License Usage
 ** Alternatively, this file may be used under the terms of the GNU Lesser
 ** General Public License version 2.1 as published by the Free Software
@@ -19,29 +19,29 @@
 ** packaging of this file.  Please review the following information to
 ** ensure the GNU Lesser General Public License version 2.1 requirements
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-** 
+**
 ** In addition, as a special exception, Nokia gives you certain
 ** additional rights. These rights are described in the Nokia Qt LGPL
 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
 ** package.
-** 
-** GNU General Public License Usage 
+**
+** GNU General Public License Usage
 ** Alternatively, this file may be used under the terms of the GNU
 ** General Public License version 3.0 as published by the Free Software
 ** Foundation and appearing in the file LICENSE.GPL included in the
 ** packaging of this file.  Please review the following information to
 ** ensure the GNU General Public License version 3.0 requirements will be
 ** met: http://www.gnu.org/copyleft/gpl.html.
-** 
+**
 ** Please note Third Party Software included with Qt Solutions may impose
 ** additional restrictions and it is the user's responsibility to ensure
 ** that they have met the licensing requirements of the GPL, LGPL, or Qt
 ** Solutions Commercial license and the relevant license of the Third
 ** Party Software they are using.
-** 
+**
 ** If you are unsure which license is appropriate for your use, please
 ** contact the sales department at qt-sales@nokia.com.
-** 
+**
 ****************************************************************************/
 
 #include "qtservice.h"
@@ -581,6 +581,9 @@
     case SERVICE_CONTROL_CONTINUE:
         QtServiceBase::instance()->resume();
         break;
+    case SERVICE_CONTROL_SHUTDOWN:
+        QtServiceBase::instance()->shutdown();
+        break;
     default:
 	if (code >= 128 && code <= 255)
 	    QtServiceBase::instance()->processCommand(code - 128);
@@ -629,6 +632,11 @@
     case SERVICE_CONTROL_INTERROGATE: // 4
         break;
 
+    case SERVICE_CONTROL_SHUTDOWN: // 3
+        QCoreApplication::postEvent(instance->controllerHandler, new QEvent(QEvent::Type(QEvent::User + code)));
+        instance->condition.wait(&instance->mutex);
+        break;
+
     default:
         if ( code >= 128 && code <= 255 ) {
             QCoreApplication::postEvent(instance->controllerHandler, new QEvent(QEvent::Type(QEvent::User + code)));
@@ -667,6 +675,7 @@
         control |= SERVICE_ACCEPT_PAUSE_CONTINUE;
     if (!(flags & QtServiceBase::CannotBeStopped))
         control |= SERVICE_ACCEPT_STOP;
+   control |= SERVICE_ACCEPT_SHUTDOWN;
     return control;
 }
 
@@ -678,7 +687,9 @@
 public:
     HandlerThread()
         : success(true), console(false), QThread()
-        {}
+        {
+            setObjectName("QtService Handler Thread for " + QtServiceBase::instance()->serviceName());
+        }
 
     bool calledOk() { return success; }
     bool runningAsConsole() { return console; }
