{"id":159,"date":"2009-11-20T16:35:47","date_gmt":"2009-11-20T18:35:47","guid":{"rendered":"http:\/\/www.ragestorm.net\/blogs\/?p=159"},"modified":"2009-11-20T23:44:49","modified_gmt":"2009-11-21T01:44:49","slug":"getting-pid-of-csrss","status":"publish","type":"post","link":"https:\/\/www.ragestorm.net\/blogs\/?p=159","title":{"rendered":"Getting PID of CSRSS"},"content":{"rendered":"<p>I thought this one might help some people out there&#8230; Instead of scanning all processes, or getting special exports in ntdll.dll or similar ideas. There&#8217;s a two-lines code to do it. The trick is to get the desktop&#8217;s handle to window, which really belongs to CSRSS and then get its process.<\/p>\n<pre lang=\"c\">\r\nDWORD pid, tid;\r\ntid = GetWindowThreadProcessId(GetDesktopWindow(), &pid);<\/pre>\n<p>Also you get the thread id by product, and this code is compatible since 95. I guess it might be handy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I thought this one might help some people out there&#8230; Instead of scanning all processes, or getting special exports in ntdll.dll or similar ideas. There&#8217;s a two-lines code to do it. The trick is to get the desktop&#8217;s handle to window, which really belongs to CSRSS and then get its process. DWORD pid, tid; tid [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":""},"categories":[7],"tags":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pbWKd-2z","_links":{"self":[{"href":"https:\/\/www.ragestorm.net\/blogs\/index.php?rest_route=\/wp\/v2\/posts\/159"}],"collection":[{"href":"https:\/\/www.ragestorm.net\/blogs\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ragestorm.net\/blogs\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ragestorm.net\/blogs\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ragestorm.net\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=159"}],"version-history":[{"count":4,"href":"https:\/\/www.ragestorm.net\/blogs\/index.php?rest_route=\/wp\/v2\/posts\/159\/revisions"}],"predecessor-version":[{"id":169,"href":"https:\/\/www.ragestorm.net\/blogs\/index.php?rest_route=\/wp\/v2\/posts\/159\/revisions\/169"}],"wp:attachment":[{"href":"https:\/\/www.ragestorm.net\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ragestorm.net\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ragestorm.net\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}