<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=469989&amp;view=findpost&amp;p=3932421</guid>
        <pubDate>Sun, 30 Nov 2025 08:03:45 +0000</pubDate>
        <title>Почему OpenProcess не позволяет читать информацию некотрых процессов</title>
        <link>https://forum.sources.ru/index.php?showtopic=469989&amp;view=findpost&amp;p=3932421</link>
        <description><![CDATA[Lun2: <strong class='tag-b'>Thinker</strong>, спасибо за помощь&#33;]]></description>
        <author>Lun2</author>
        <category>C/C++: Системное программирование и WinAPI</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=469989&amp;view=findpost&amp;p=3932417</guid>
        <pubDate>Sun, 30 Nov 2025 01:43:13 +0000</pubDate>
        <title>Почему OpenProcess не позволяет читать информацию некотрых процессов</title>
        <link>https://forum.sources.ru/index.php?showtopic=469989&amp;view=findpost&amp;p=3932417</link>
        <description><![CDATA[B.V.: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=469989&view=findpost&p=3932414'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Lun2 &#064; <time class="tag-quote__quoted-time" datetime="2025-11-29T17:17:57+00:00">29.11.25, 17:17</time></span><div class='quote '>GetLastError() возвращает = ERROR_ACCESS_DENIED.</div></div><br>
У нас лапки, мы документацию не читаем, где английским по фону написано<br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>If the specified process is the System Idle Process (0x00000000), the function fails and the last error code is ERROR_INVALID_PARAMETER. <strong class='tag-b'>If the specified process is the System process or one of the Client Server Run-Time Subsystem (CSRSS) processes, this function fails and the last error code is ERROR_ACCESS_DENIED because their access restrictions prevent user-level code from opening them</strong>.</div></div><br>
<br>
Используй PROCESS_QUERY_LIMITED_INFORMATION и права System для своего exe, может быть этого хватит в большинстве случаев для преодоления <a class='tag-url' href='https://learn.microsoft.com/en-us/windows/win32/services/protecting-anti-malware-services-#introduction' target='_blank'>PP</a>]]></description>
        <author>B.V.</author>
        <category>C/C++: Системное программирование и WinAPI</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=469989&amp;view=findpost&amp;p=3932414</guid>
        <pubDate>Sat, 29 Nov 2025 17:17:57 +0000</pubDate>
        <title>Почему OpenProcess не позволяет читать информацию некотрых процессов</title>
        <link>https://forum.sources.ru/index.php?showtopic=469989&amp;view=findpost&amp;p=3932414</link>
        <description><![CDATA[Lun2: Добрый вечер&#33;<br>
Моя программа перечисляет процессы и получает имена файлов процесса (exe, ...)<br>
Запускаю под админом и OpenProcess работает нормально почти по всем процессам, но кроме (например)<br>
csrss.exe, services.exe и некоторых других.<br>
Выдает ошибку = 5 (отказано в доступе).<br>
Но диспетчер задач все же показывает их файлы.<br>
<br>
<strong class='tag-b'>Вопрос</strong>: как сделать, чтобы моя программа также смогла получить имена файлов.<br>
<br>
Открываю процесс так:<br>
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION |<br>
                PROCESS_VM_READ, FALSE, ProcessId);<br>
<br>
GetLastError() возвращает = ERROR_ACCESS_DENIED.<br>
<br>
Далее получаю имя файл так (но до этого не доходит):<br>
DWORD r = GetModuleBaseName(hProcess, hModule, ModuleNamePtr, ModuleNameSize);]]></description>
        <author>Lun2</author>
        <category>C/C++: Системное программирование и WinAPI</category>
      </item>
	
      </channel>
      </rss>
	