<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How can I extend the deadline for responding to the PBT_APMSUSPEND message?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/11/24/10241125.aspx</link><description>You can't.</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: How can I extend the deadline for responding to the PBT_APMSUSPEND message?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/11/24/10241125.aspx#10242461</link><pubDate>Tue, 29 Nov 2011 16:14:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10242461</guid><dc:creator>xpclient</dc:creator><description>&lt;p&gt;@Nick, but that same switch can be called by any app or update installer that think it&amp;#39;s cool to restart without warning. Windows cannot differentiate between automated and user-initiated shutdown, that&amp;#39;s the problem. I have lost data many times over the years before I started using ShutdownGuard.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10242461" width="1" height="1"&gt;</description></item><item><title>re: How can I extend the deadline for responding to the PBT_APMSUSPEND message?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/11/24/10241125.aspx#10242149</link><pubDate>Mon, 28 Nov 2011 20:42:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10242149</guid><dc:creator>Nick</dc:creator><description>&lt;p&gt;&amp;quot;Unfortunately, there isn&amp;#39;t a way for it to circumvent shutdown.exe&amp;#39;s -f (force) switch.&amp;quot;&lt;/p&gt;
&lt;p&gt;That sounds like it&amp;#39;s working as intended, then. &amp;nbsp;Users should have control over their computer, and that means they should be able to shut down if they want to. &amp;nbsp;Imagine if the force option was cancellable -- what then? &amp;nbsp;Should the computer be held hostage by a poorly written or broken program? &amp;nbsp;Or maybe Microsoft should add a --ok-im-serious-really-force option?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10242149" width="1" height="1"&gt;</description></item><item><title>re: How can I extend the deadline for responding to the PBT_APMSUSPEND message?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/11/24/10241125.aspx#10242015</link><pubDate>Mon, 28 Nov 2011 14:57:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10242015</guid><dc:creator>xpclient</dc:creator><description>&lt;p&gt;@Crescens2k, the app I use, ShutdownGuard blocks most automatic shutdowns, restarts and logoffs by default and lives in the tray. This way no installer or Windows can force a shutdown unless I approve of it. In those rare cases when I have to do scheduled or remote shutdowns or use scripts, a single click on the ShutdownGuard tray icon &amp;quot;unlocks&amp;quot; automated shutdowns so it won&amp;#39;t be blocked any more. Unfortunately, there isn&amp;#39;t a way for it to circumvent shutdown.exe&amp;#39;s -f (force) switch. I have also added a UAC requirement to shutdown.exe using App Compat Toolkit. Note that this just blocks those shutdowns which are initiated programmatically/without user approval. I can still force a shutdown any time. But I guess for regular users, this would be an overkill of shutdown protection.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10242015" width="1" height="1"&gt;</description></item><item><title>re: How can I extend the deadline for responding to the PBT_APMSUSPEND message?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/11/24/10241125.aspx#10241791</link><pubDate>Sun, 27 Nov 2011 14:02:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10241791</guid><dc:creator>Crescens2k</dc:creator><description>&lt;p&gt;xpclient:&lt;/p&gt;
&lt;p&gt;Adding a UAC requirement to shutdown.exe makes no sense since standard users are allowed to do all operations that it performs by default on client versions of Windows. It also would block shutdown.exe being used in scripts (and I have a few of them) so it isn&amp;#39;t a good idea.&lt;/p&gt;
&lt;p&gt;Also, while it may be possible to remove the fangs from shutdown.exe, it would still be rather trivial to write a program which is just as bad by using the ExitWindowsEx function and forcing the actions with that.&lt;/p&gt;
&lt;p&gt;I would also have to double check, but shutdown.exe has a /f parameter that causes the shutdown/logoff to be forced, so that would imply that it doesn&amp;#39;t force (and thus make it unblockable) unless you add the /f parameter. So this would mean that regular use of shutdown could be blocked.&lt;/p&gt;
&lt;p&gt;But anyway, blocking user logoff is a bad idea and should never be undertaken unless it results in nuclear meltdown or people getting killed. Would you feel happy if you shut down your system and went out, only to come home hours later to find that your shutdown had been blocked because your web browser is asking if you want to save your tabs? That is potentially data loss after all. Most of these &amp;quot;data loss&amp;quot; situations are a result of bad programming. If an application requires more than 2 seconds to save its state then it is likely that it is just keeping too much unsaved data around, or it is a server process for something and would be better as a service. If a logoff also results in data loss then it is also very likely that the application wasn&amp;#39;t written robustly, since it would pretty much mean that there would be data loss if the application crashed (or the user clicked End Process in task manager).&lt;/p&gt;
&lt;p&gt;If an application is trying to write to a slow medium (like a WebDAV share) and the user logs off (maybe they forgot that they were writing to it) then again, that isn&amp;#39;t a good reason to block logoff. What you would do in that situation is make sure your temporary files are properly up to date and then cancel the write and somehow set a flag so that the next time you start that application it tells the user that they logged of before the write was complete.&lt;/p&gt;
&lt;p&gt;To be honest though, this would end up (for me at least) in a situation where either a badly written application may lose data, or will lose data. I have a funny habit of just clicking on the force button if I logoff or shutdown my system and an application is taking too long. If it does it too often then I would most likely investigate, look for a solution or at worst just uninstall it. I have low tolerance for bad applications after all. Another thing to remember, on a laptop the battery is low and Windows starts the emergency hibernation, should it be allowed to block in this case? (Another example of a choice between possible data loss and definite data loss).&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10241791" width="1" height="1"&gt;</description></item><item><title>re: How can I extend the deadline for responding to the PBT_APMSUSPEND message?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/11/24/10241125.aspx#10241705</link><pubDate>Sat, 26 Nov 2011 17:18:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10241705</guid><dc:creator>NB</dc:creator><description>&lt;p&gt;@xpclient: If you have malware only calling shutdown.exe at startup you&amp;#39;re very lucky! Otherwise it might have decided to snoop your passwords and credit card numbers instead ;)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10241705" width="1" height="1"&gt;</description></item><item><title>re: How can I extend the deadline for responding to the PBT_APMSUSPEND message?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/11/24/10241125.aspx#10241704</link><pubDate>Sat, 26 Nov 2011 17:12:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10241704</guid><dc:creator>Joshua</dc:creator><description>&lt;p&gt;@Nawak: you don&amp;#39;t support sleep/hibernate. The code that I was imagining would block it by extending the deadline to infinity.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10241704" width="1" height="1"&gt;</description></item><item><title>re: How can I extend the deadline for responding to the PBT_APMSUSPEND message?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/11/24/10241125.aspx#10241675</link><pubDate>Sat, 26 Nov 2011 11:00:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10241675</guid><dc:creator>xpclient</dc:creator><description>&lt;p&gt;Anything that can cause data loss and which cannot be blocked by the user is flawed by design. For example, there is no way in Windows to block any of the shutdown functions if initiated using shutdown.exe. Malware can simply run a &amp;#39;shutdown -l&amp;#39; at startup to keep the computer in a log off loop as soon as it logs on. There is no UAC requirement either for shutdown.exe. None of the APIs to intercept shutdown work against shutdown.exe.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10241675" width="1" height="1"&gt;</description></item><item><title>re: How can I extend the deadline for responding to the PBT_APMSUSPEND message?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/11/24/10241125.aspx#10241627</link><pubDate>Fri, 25 Nov 2011 21:42:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10241627</guid><dc:creator>Horst Kiehl</dc:creator><description>&lt;p&gt;@xpclient: If it&amp;#39;s really a concern that the user &amp;quot;accidentally hit the sleep button&amp;quot;, you can configure the sleep button to do nothing - or cover it with a molly-guard. It&amp;#39;s much simpler, and closer to the problem, than to still allow &amp;quot;awesome&amp;quot; programs to tell the OS &amp;quot;don&amp;#39;t do what the user told you, let me continue&amp;quot;.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s similar to what Raymond has explained before, that you shouldn&amp;#39;t make global changes to solve a local problem: &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/b/oldnewthing/archive/2008/12/11/9193695.aspx"&gt;blogs.msdn.com/.../9193695.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;By the way, this reminds me of this post: &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/b/oldnewthing/archive/2007/10/16/5465592.aspx"&gt;blogs.msdn.com/.../5465592.aspx&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10241627" width="1" height="1"&gt;</description></item><item><title>re: How can I extend the deadline for responding to the PBT_APMSUSPEND message?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/11/24/10241125.aspx#10241601</link><pubDate>Fri, 25 Nov 2011 17:54:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10241601</guid><dc:creator>voo</dc:creator><description>&lt;p&gt;@xpclient You&amp;#39;re aware that as soon as there is a user configurable feature you also make it MUCH more likely for applications to programmatically set it? &lt;/p&gt;
&lt;p&gt;If you really constantly hit sleep accidentally, then a popup dialog asking &amp;quot;Are you sure?&amp;quot; would be a much more sensible solution than this feature from the past. But then I just don&amp;#39;t see this as a major concern for lots of people so -100 and so on.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10241601" width="1" height="1"&gt;</description></item><item><title>re: How can I extend the deadline for responding to the PBT_APMSUSPEND message?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/11/24/10241125.aspx#10241591</link><pubDate>Fri, 25 Nov 2011 17:17:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10241591</guid><dc:creator>Ooh</dc:creator><description>&lt;p&gt;@xpclient: Ah, you refer to Raymond&amp;#39;s &amp;quot;The checkbox: The mating call of the loser&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/b/oldnewthing/archive/2009/02/13/9416485.aspx"&gt;blogs.msdn.com/.../9416485.aspx&lt;/a&gt;&lt;/p&gt;
&lt;div class="post"&gt;[&lt;i&gt;It&amp;#39;s worse than that. Once you let the value be configured by the user, you it becomes possible for an application to configure it programmatically, and then you&amp;#39;re back where you started. -Raymond&lt;/i&gt;]&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10241591" width="1" height="1"&gt;</description></item></channel></rss>