<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK:  Команда Process - узнать приоритет процесса по PID]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=12637&amp;type=atom" />
	<updated>2017-04-26T04:40:55Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=12637</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK:  Команда Process - узнать приоритет процесса по PID]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115334#p115334" />
			<content type="html"><![CDATA[<p><span style="color: green"><strong>Indomito</strong><br />Замечание за избыточное цитирование. Убрано.</span></p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2017-04-26T04:40:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115334#p115334</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:  Команда Process - узнать приоритет процесса по PID]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115333#p115333" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong><br />1. Понятно, так и делаю.<br />2. Тоже понятно, просто забыл что DllCall пишет в A_LastError.<br />3. Это тоже понятно.</p><p>Спасибо за развёрнутый ответ.</p>]]></content>
			<author>
				<name><![CDATA[Indomito]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27285</uri>
			</author>
			<updated>2017-04-26T04:35:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115333#p115333</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:  Команда Process - узнать приоритет процесса по PID]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115330#p115330" />
			<content type="html"><![CDATA[<p>Проверяйте наличие процесса перед OpenProcess.<br />Либо проверяйте A_LastError после OpenProcess.<br />Если обращение к GetPriorityClass возвращает 0, значит что-то пошло не так и надо смотреть A_LastError.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-04-26T02:57:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115330#p115330</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:  Команда Process - узнать приоритет процесса по PID]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115328#p115328" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong><br />А если процесса не существует/ ошибочный PID, ну всякое бывает, то какой код возврата в коде. </p><div class="codebox"><pre><code>PROCESS_QUERY_INFORMATION := 0x400
PID := 360
hProc := DllCall(&quot;OpenProcess&quot;, &quot;Uint&quot;, PROCESS_QUERY_INFORMATION, &quot;Int&quot;, 0, &quot;UInt&quot;, PID, &quot;Ptr&quot;)
Priority := DllCall(&quot;GetPriorityClass&quot;, &quot;Ptr&quot;, hProc)
DllCall(&quot;CloseHandle&quot;, &quot;Ptr&quot;, hProc)
msgbox % Priority</code></pre></div><p> Я про гарантированный код возврата, т.е. всегда <strong>False</strong>, т.е. <strong>0x0</strong>?</p>]]></content>
			<author>
				<name><![CDATA[Indomito]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27285</uri>
			</author>
			<updated>2017-04-26T02:20:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115328#p115328</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:  Команда Process - узнать приоритет процесса по PID]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115325#p115325" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>;0x100 - realtime
;0x80 - high
;0x8000 - above normal
;0x20 - normal
;0x4000 - below normal
;0x40 - low</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-04-25T21:01:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115325#p115325</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:  Команда Process - узнать приоритет процесса по PID]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115321#p115321" />
			<content type="html"><![CDATA[<p>Коды возврата, словами не трудно расписать?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2017-04-25T20:27:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115321#p115321</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:  Команда Process - узнать приоритет процесса по PID]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115320#p115320" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>PROCESS_QUERY_INFORMATION := 0x400
PID := 360
hProc := DllCall(&quot;OpenProcess&quot;, &quot;Uint&quot;, PROCESS_QUERY_INFORMATION, &quot;Int&quot;, 0, &quot;UInt&quot;, PID, &quot;Ptr&quot;)
Priority := DllCall(&quot;GetPriorityClass&quot;, &quot;Ptr&quot;, hProc)
DllCall(&quot;CloseHandle&quot;, &quot;Ptr&quot;, hProc)
msgbox % Priority</code></pre></div><p>Но если требуется процессы других пользователей открывать, то надо сперва повысить привилегии скрипта:<br /></p><div class="codebox"><pre><code>Process, Exist  ; sets ErrorLevel to the PID of this running script
; Get the handle of this script with PROCESS_QUERY_INFORMATION (0x0400)
h := DllCall(&quot;OpenProcess&quot;, &quot;UInt&quot;, 0x0400, &quot;Int&quot;, false, &quot;UInt&quot;, ErrorLevel, &quot;Ptr&quot;)
; Open an adjustable access token with this process (TOKEN_ADJUST_PRIVILEGES = 32)
DllCall(&quot;Advapi32.dll\OpenProcessToken&quot;, &quot;Ptr&quot;, h, &quot;UInt&quot;, 32, &quot;PtrP&quot;, t)
VarSetCapacity(ti, 16, 0)  ; structure of privileges
NumPut(1, ti, 0, &quot;UInt&quot;)  ; one entry in the privileges array...
; Retrieves the locally unique identifier of the debug privilege:
DllCall(&quot;Advapi32.dll\LookupPrivilegeValue&quot;, &quot;Ptr&quot;, 0, &quot;Str&quot;, &quot;SeDebugPrivilege&quot;, &quot;Int64P&quot;, luid)
NumPut(luid, ti, 4, &quot;Int64&quot;)
NumPut(2, ti, 12, &quot;UInt&quot;)  ; enable this privilege: SE_PRIVILEGE_ENABLED = 2
; Update the privileges of this process with the new access token:
r := DllCall(&quot;Advapi32.dll\AdjustTokenPrivileges&quot;, &quot;Ptr&quot;, t, &quot;Int&quot;, false, &quot;Ptr&quot;, &amp;ti, &quot;UInt&quot;, 0, &quot;Ptr&quot;, 0, &quot;Ptr&quot;, 0)
DllCall(&quot;CloseHandle&quot;, &quot;Ptr&quot;, t)  ; close this access token handle to save memory
DllCall(&quot;CloseHandle&quot;, &quot;Ptr&quot;, h)  ; close this process handle to save memory</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-04-25T20:18:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115320#p115320</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:  Команда Process - узнать приоритет процесса по PID]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115318#p115318" />
			<content type="html"><![CDATA[<p>Примерчиком не поделишься?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2017-04-25T20:02:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115318#p115318</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:  Команда Process - узнать приоритет процесса по PID]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115309#p115309" />
			<content type="html"><![CDATA[<p><a href="https://msdn.microsoft.com/ru-ru/library/windows/desktop/ms683211(v=vs.85).aspx">https://msdn.microsoft.com/ru-ru/librar … s.85).aspx</a></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-04-25T18:35:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115309#p115309</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK:  Команда Process - узнать приоритет процесса по PID]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115305#p115305" />
			<content type="html"><![CDATA[<p>Приветствую. </p><p>И так сабж.<br />Мне нужно узнать, а не поменять приоритет процесса по PID.</p><p>Команды <strong>Process</strong> и <strong>WinGet</strong> не выдают такой информации. Поиском пользовался.</p>]]></content>
			<author>
				<name><![CDATA[Indomito]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27285</uri>
			</author>
			<updated>2017-04-25T17:49:07Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115305#p115305</id>
		</entry>
</feed>
