{"id":94545,"date":"2016-10-19T07:00:00","date_gmt":"2016-10-19T21:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/?p=94545"},"modified":"2019-03-13T10:32:43","modified_gmt":"2019-03-13T17:32:43","slug":"20161019-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20161019-00\/?p=94545","title":{"rendered":"Three short questions about LogonUser (with answers!)"},"content":{"rendered":"<p>A customer had a Web service that runs processes as specific users. There may be multiple such processes running at the same time for a single user account. Here are the questions. And just to be nice, I&#8217;ve even included the answers. (Note: These are not my answers. I&#8217;m just recording them for posterity.) <\/p>\n<p>&#8220;Is there a limit to the number of <code>Logon&shy;User<\/code> sessions that can exist at a time for a particular user?&#8221; <\/p>\n<p>It is limited by available memory. <\/p>\n<p>&#8220;Once the process exits, what kind of cleanup do we need to  perform? We don&#8217;t see a <code>Logoff&shy;User<\/code> function.&#8221; <\/p>\n<p>When you are done, take the token handle that you got from <code>Logon&shy;User<\/code> and pass it to <code>Close&shy;Handle<\/code>. <\/p>\n<p>&#8220;Is there a recommended way to run multiple processes under the same user account?&#8221; <\/p>\n<p>When you get a token from <code>Logon&shy;User<\/code>, use that one token for multiple processes. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>The answers are probably the most useful part.<\/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":[25],"class_list":["post-94545","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>The answers are probably the most useful part.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/94545","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=94545"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/94545\/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=94545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=94545"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=94545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}