X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A29D3858410
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1674848397;
	bh=M0WhyHTDnJ7HG+WvFjvin4BTpENwe+eeymqOPJ4mL5s=;
	h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
	 From;
	b=gGjCgd20lM5YPpq7wE8X2M0qpOI5xXbDQn9OhRnpLjxulljIlvW8yU/bCACuTrx3U
	 FrRuXfB6bn7JeqbaH7od6qtcHml2w9bQw4JrzgcrM6cC0Y6wxGIXatI53E96CM3Ff8
	 q7F3a1jUTwwCEb9Y8hbigcwZCSDbQiinAbeZHqzM=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B38983858D20
X-Authority-Analysis: v=2.4 cv=e5oV9Il/ c=1 sm=1 tr=0 ts=63d42864
 a=oHm12aVswOWz6TMtn9zYKg==:117 a=oHm12aVswOWz6TMtn9zYKg==:17
 a=IkcTkHD0fZMA:10 a=b5rm1lYdzqVmvSi9MQUA:9 a=QEXdDO2ut3YA:10
Message-ID: <3bafc985-e382-5b31-bca5-3556ca6e4e40@Shaw.ca>
Date: Fri, 27 Jan 2023 12:39:15 -0700
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
 Thunderbird/102.6.1
Subject: Re: BUG: Log on Scheduled Task invisible/empty window blocks input
Content-Language: en-CA
To: cygwin@cygwin.com
References: <CAGJ7yHC1UxsYeV9dM03+CJiHYyj85opu8yt7tzCzQ9qE8OL4GA@mail.gmail.com>
Organization: Inglis
In-Reply-To: <CAGJ7yHC1UxsYeV9dM03+CJiHYyj85opu8yt7tzCzQ9qE8OL4GA@mail.gmail.com>
X-CMAE-Envelope: MS4xfOMZ3d8RJ5ETjswpc1Lf04GLpm6th+WLOriLv08q4oaFYVPtLCcJmeC6yRsZYnua1v8/xA0br/p3zgWPK6m7kWAPPxdw05+dm3Fqj6YB/lpU63jHaezR
 DcOeJEtrp7Dmn+NI8QIE9z1322AyQPfPGbg3OjDe64c9aFkHh3Q8LFWJ9fxeZHtte+2sOsTnRxwUkg==
X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW,
 RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS,
 TXREP autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Brian Inglis via Cygwin <cygwin@cygwin.com>
Reply-To: cygwin@cygwin.com
Cc: Brian Inglis <Brian.Inglis@Shaw.ca>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 30RJeNeQ005823

On 2023-01-26 19:43, Ross Patterson via Cygwin wrote:
> TL;DR: I needed to run a Cygwin process at user log on with highest
> privileges to perform some operations that are not allowed any other
> way without requiring a UAC prompt.  This results in a window without
> any border, close button or any other decoration that is most often
> invisible/transparent, sometimes opaque white, and most rarely with
> black unusable left/bottom scroll bars.  The window is always on top,
> accepts no inputs at all, and blocks input to windows below.  The only
> way to get rid of the windows is to kill the scheduled task process or
> trigger a UAC prompt.  More details below.
> 
> It seems like this probably is a bug, so feel free to consider this a
> bug report, but I'm mostly writing this up so others can find it and
> my workarounds and hopefully save them some hassle and I probably
> won't be doing much followup.  Both the edge cases and observed
> results are numerous and each test iteration is time consuming, but
> I've done my best to get as complete coverage as I could and to
> tightly control conditions for reliable results.
> 
> There are a few things I want to do through Cygwin that require
> privileges that cannot be attained through a service or a scheduled
> task with an "At startup" trigger.  The only way I've found to run the
> process with the required privileges without a UAC prompt and without
> disabling UAC completely is a scheduled task with these settings:
> 
> 1. "General" tab: "Run only when user is logged on" = SELECTED
> 2. "General" tab: "Run with highest priveleges" = CHECKED
> 3. "Triggers" tab: Add an "At log on" trigger for a "Specific user"
> 
> As such I've not tested this behavior with different settings on the
> "General" tab.

I use scheduled tasks with actions running scripts from /usr/local/bin/ under 
dash (or bash if required) native path with WD /var/log/ native path e.g.

%CYGWIN_ROOT%\bin\dash /usr/local/bin/....sh WD %CYGWIN_ROOT%\var\log

with various options (mainly user SYSTEM, logged in or not, highest privileges), 
and triggers.

I never see any windows appearing as the scripts log everything under /var/log/.

The scripts run as tasks start and stop Cygwin services, init and run smart 
reporting, clean up cron job remnants before smart reporting, terminate all 
processes before running setup.

For normal scripts and schedules, I use cron job commands or scripts which log 
everything under /var/log/.

-- 
Take care. Thanks, Brian Inglis			Calgary, Alberta, Canada

La perfection est atteinte			Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter	not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer	but when there is no more to cut
			-- Antoine de Saint-Exupéry

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

