{"id":98035,"date":"2018-02-16T07:00:00","date_gmt":"2018-02-16T22:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/?p=98035"},"modified":"2019-03-13T01:01:17","modified_gmt":"2019-03-13T08:01:17","slug":"20180216-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20180216-00\/?p=98035","title":{"rendered":"So what is a Windows &#8220;critical process&#8221; anyway?"},"content":{"rendered":"<p>I noted some time ago that Task Manager <a HREF=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/\">applies three somewhat arbitrary criteria<\/a> for dividing processes into three categories: App, Background Process, and Windows Process. In particular, a Windows Process is one for which <code>Is&shy;Process&shy;Critical<\/code> reports <code>TRUE<\/code>. <\/p>\n<p><a HREF=\"https:\/\/social.msdn.microsoft.com\/profile\/SimonRev\">SimonRev<\/a> quite rightly <a HREF=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/#comment-1318135\">calls out the documentation for being useless due to the fact that it merely states a tautology<\/a>. <\/p>\n<blockquote CLASS=\"q\">\n<p><b>IsProcessCritical<\/b> <\/p>\n<p>Determines whether the specified process is considered critical. <\/p>\n<pre>\nBOOL WINAPI IsProcessCritical(\n  _In_  HANDLE hProcess,\n  _Out_ PBOOL  Critical\n);\n<\/pre>\n<p><i>hProcess<\/i> [in] A handle to the process to query. The process must have been opened with <code>PROCESS_<code><\/code>LIMITED_<code><\/code>QUERY<code><\/code>INFORMATION<\/code> access. <\/p>\n<p><i>Critical<\/i> [out] A pointer to the <b>BOOL<\/b> value this function will use to indicate whether the process is considered critical.  <\/p>\n<p><b>Return value<\/b>: This routine returns <b>FALSE<\/b> on failure. Any other value indicates success. Call <b>GetLastError<\/b> to query for the specific error reason on failure. <\/p>\n<\/blockquote>\n<p>Great, so we learn that the <code>Is&shy;Process&shy;Critical<\/code> function tells you whether the process is critical. But nowhere does it say what it means for a process to be critical or how a process becomes critical in the first place. <\/p>\n<p>A critical process is one that forces a system reboot if it terminates. (More precisely, it forces a bluescreen error, which captures a memory dump before rebooting, so that the cause for termination can be investigated.) <\/p>\n<p>How does a process get itself marked critical? <\/p>\n<p>A few system processes do this on their own. For example, processes related to enforcing system security do this so that if one of them crashes, it stops the system immediately before any more damage can occur. <\/p>\n<p>But most of the time, the way this happens if you create a service and <a HREF=\"https:\/\/technet.microsoft.com\/en-us\/library\/cc753662%28v=ws.11%29.aspx\">set its recovery option<\/a> to <b>Restart the Computer<\/b>. <\/p>\n<p><b>Bonus chatter<\/b>: Wait a second, there are some processes in the <i>Windows processes<\/i> list that aren&#8217;t critical system processes. Like <i>Console Window Host<\/i>. How did they get there? <\/p>\n<p>In addition to putting all critical system processes in the list, Task Manager also keeps a hard-coded list of processes that it puts in the <i>Windows processes<\/i> list whenever it sees them. That&#8217;s why you see things like <i>Console Window Host<\/i> and <i>Desktop Window Manager<\/i>. So a more accurate list of what goes into <i>Windows processes<\/i> is <\/p>\n<ul>\n<li>    A hard-coded list of specific processes, plus <\/li>\n<li>    Processes marked as critical. <\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p><CODE>Is&shy;Process&shy;Critical<\/CODE> tells you whether a process is critical, but what does that mean?<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[26],"class_list":["post-98035","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p><CODE>Is&shy;Process&shy;Critical<\/CODE> tells you whether a process is critical, but what does that mean?<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/98035","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=98035"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/98035\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=98035"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=98035"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=98035"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}