From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 65480 invoked by alias); 23 Jan 2020 17:44:54 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 65138 invoked by uid 89); 23 Jan 2020 17:44:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=sessions, Manager, services, day X-HELO: mout.gmx.com Received: from mout.gmx.com (HELO mout.gmx.com) (74.208.4.200) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 Jan 2020 17:44:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.com; s=dbd5af2cbaf7; t=1579801490; bh=wzxgOPHdK2/p9D/S+zUJHoYWFyTL4Vgs7uvLtsA2PFo=; h=X-UI-Sender-Class:From:Date:Subject:To; b=Ob9zIviEMfAXC6DevX3SlWD6tT8FduBZyFX8KsothdSl2Hz9qw/H7DNAUTSJ1BHPC T3EWOnXWcWc0QV0H+gatUzj6oD4Vw7UC5xY5ay0fK5e2L5JEf9iInq6aChGFpLPIHD A+/vr7jHdu9fkfPv+5GQqDnO8YjAE/90F/IKvfX4= X-UI-Sender-Class: 214d933f-fd2f-45c7-a636-f5d79ae31a79 Received: from mail-lf1-f48.google.com ([209.85.167.48]) by mail.gmx.com (mrgmxus002 [74.208.5.15]) with ESMTPSA (Nemesis) id 0MEFZ8-1io5tq2B8i-00FUxp for ; Thu, 23 Jan 2020 18:44:50 +0100 Received: by mail-lf1-f48.google.com with SMTP id b15so2977533lfc.4 for ; Thu, 23 Jan 2020 09:44:49 -0800 (PST) MIME-Version: 1.0 From: Bill Stewart Date: Thu, 23 Jan 2020 17:44:00 -0000 Message-ID: Subject: Windows Restart Manager and cygrunsrv services To: cygwin@cygwin.com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg00214.txt.bz2 Good day, Application installers (such as Windows Installer or Inno Setup) can use the Windows Restart Manager APIs[1] it to determine if a program or service is running, and automatically stop/restart as appropriate. This is useful when reinstalling or upgrading a service from an installer, as the installer itself can stop the service, replace the binary/binaries, and restart the service automatically. However it seems that when running a service using cygrunsrv, the Restart Manager RmGetList API[2] returns RmRebootReasonSessionMismatch (2) for the lpdwRebootReasons output parameter. This parameter return value is one of the RM_REBOOT_REASON enumeration values[3]. The description for the RmRebootReasonSessionMismatch value on MSDN is as follows: "One or more processes are running in another Terminal Services session." I ran into this building an Inno Setup installer. I reproduced on Windows 10 x64 and Windows Server 2008 R2 x64. The error description is interesting, because in neither repro case were there other users logged on using TS sessions. (I'm not sure if that error description is completely accurate in describing all cases where that value gets returned, though...) Unexpected behavior: Restart Manager returns 2 (RmRebootReasonSessionMismatch) in the lpdwRebootReasons output parameter when calling the RmGetList API to detect a cygrunsrv service. Expected behavior: Restart Manager should return 0 (RmRebootReasonNone) in the lpdwRebootReasons output parameter when calling the RmGetList API to detect a cygrunsrv service. Further details (regarding Inno Setup and this problem): https://groups.google.com/d/msg/innosetup/9dAT3wB9RTQ/99Py-ZgLCgAJ Any ideas why Restart Manager doesn't work for cygrunsrv services? Thanks! Bill ____________________ [1] https://docs.microsoft.com/en-us/windows/win32/rstmgr/about-restart-manager [2] https://docs.microsoft.com/en-us/windows/win32/api/restartmanager/nf-restartmanager-rmgetlist [3] https://docs.microsoft.com/en-us/windows/win32/api/restartmanager/ne-restartmanager-rm_reboot_reason -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple