<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[NtQuerySystemInformation -- Speicherzugriffsfehler]]></title><description><![CDATA[<p>Hi ich bins wieder <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /><br />
Da heute das Wochenende angefangen hat hatte ich wieder Zeit zum coden,<br />
und wollte NtQuerySystemInformation benutzen,nur leider klappt das nicht so<br />
richtig.</p>
<p>In google hab ich verschiedene _SYSTEM_PROCESS_INFORMATION Strukturen gefunden,ich verwende die von der MSDN.</p>
<p>Auch den Rest des Codes hab ich ausm Netz/selbst gecodet.</p>
<p>Und hier ist der Output:</p>
<p>33032 &lt;&lt; Return von NtQuerySystemInformation benutzen<br />
Ÿ &lt;&lt; Name des 1. Prozesses (schaut nachm Idle Prozess aus)<br />
312 &lt;&lt; der 1. NextEntryOffset<br />
Ÿ &lt;&lt; Name des 2. Prozesses (schaut nachm Idle Prozess aus)<br />
1698929696 &lt;&lt; der 2. NextEntryOffset,viel zu groß</p>
<p>Naja und danach stürzts ab,wie solls auch anders sein,der Prozess will bei<br />
info+1698929696+312 lesen o.O</p>
<p>Naja hier noch der Code,und schon mal<br />
vielen Dank für jeden Tipp,<br />
Xalon</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;iostream&gt;
#include &lt;psapi.h&gt;

#define SystemProcessInformation 5

using namespace std;

typedef struct _SYSTEM_PROCESS_INFORMATION {
    ULONG NextEntryOffset;
    ULONG NumberOfThreads;
    BYTE Reserved1[48];
    PVOID Reserved2[3];
    HANDLE UniqueProcessId;
    PVOID Reserved3;
    ULONG HandleCount;
    BYTE Reserved4[4];
    PVOID Reserved5[11];
    SIZE_T PeakPagefileUsage;
    SIZE_T PrivatePageCount;
    LARGE_INTEGER Reserved6[6];
} SYSTEM_PROCESS_INFORMATION;

int main(void)
{
 ULONG needed;

 typedef DWORD (CALLBACK* NTQUERYSYSTEMINFORMATION)(  DWORD, void*, ULONG, PULONG   );
 char buf[50000];

 HINSTANCE hDLL = LoadLibrary(&quot;Ntdll.dll&quot;);
 NTQUERYSYSTEMINFORMATION NtQuerySystemInformation = (NTQUERYSYSTEMINFORMATION)GetProcAddress(hDLL,&quot;NtQuerySystemInformation&quot;);   

 NtQuerySystemInformation(SystemProcessInformation,buf,sizeof(buf),&amp;needed);
 SYSTEM_PROCESS_INFORMATION* info;
 info = (SYSTEM_PROCESS_INFORMATION*)buf;

 cout &lt;&lt; needed &lt;&lt; endl; 
 char exename[1024];
 HMODULE hMod;
 DWORD cbNeeded;

 while(1)
 {
 HANDLE victim = info-&gt;UniqueProcessId;
 EnumProcessModules( victim, &amp;hMod, sizeof(hMod),&amp;cbNeeded);
 GetModuleBaseName( victim, hMod, exename,sizeof(exename));
 cout &lt;&lt; exename &lt;&lt; endl;
 cout &lt;&lt; info-&gt;NextEntryOffset &lt;&lt; endl;
 if (info-&gt;NextEntryOffset == 0)
  break;
 sizeof(BYTE)*48 + sizeof(PVOID)*3 + sizeof(HANDLE);
 info += info-&gt;NextEntryOffset;
 }
 system(&quot;pause&quot;);
 return 0;    
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/180042/ntquerysysteminformation-speicherzugriffsfehler</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Jul 2026 10:08:01 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/180042.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 27 Apr 2007 21:47:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to NtQuerySystemInformation -- Speicherzugriffsfehler on Fri, 27 Apr 2007 21:47:43 GMT]]></title><description><![CDATA[<p>Hi ich bins wieder <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /><br />
Da heute das Wochenende angefangen hat hatte ich wieder Zeit zum coden,<br />
und wollte NtQuerySystemInformation benutzen,nur leider klappt das nicht so<br />
richtig.</p>
<p>In google hab ich verschiedene _SYSTEM_PROCESS_INFORMATION Strukturen gefunden,ich verwende die von der MSDN.</p>
<p>Auch den Rest des Codes hab ich ausm Netz/selbst gecodet.</p>
<p>Und hier ist der Output:</p>
<p>33032 &lt;&lt; Return von NtQuerySystemInformation benutzen<br />
Ÿ &lt;&lt; Name des 1. Prozesses (schaut nachm Idle Prozess aus)<br />
312 &lt;&lt; der 1. NextEntryOffset<br />
Ÿ &lt;&lt; Name des 2. Prozesses (schaut nachm Idle Prozess aus)<br />
1698929696 &lt;&lt; der 2. NextEntryOffset,viel zu groß</p>
<p>Naja und danach stürzts ab,wie solls auch anders sein,der Prozess will bei<br />
info+1698929696+312 lesen o.O</p>
<p>Naja hier noch der Code,und schon mal<br />
vielen Dank für jeden Tipp,<br />
Xalon</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;iostream&gt;
#include &lt;psapi.h&gt;

#define SystemProcessInformation 5

using namespace std;

typedef struct _SYSTEM_PROCESS_INFORMATION {
    ULONG NextEntryOffset;
    ULONG NumberOfThreads;
    BYTE Reserved1[48];
    PVOID Reserved2[3];
    HANDLE UniqueProcessId;
    PVOID Reserved3;
    ULONG HandleCount;
    BYTE Reserved4[4];
    PVOID Reserved5[11];
    SIZE_T PeakPagefileUsage;
    SIZE_T PrivatePageCount;
    LARGE_INTEGER Reserved6[6];
} SYSTEM_PROCESS_INFORMATION;

int main(void)
{
 ULONG needed;

 typedef DWORD (CALLBACK* NTQUERYSYSTEMINFORMATION)(  DWORD, void*, ULONG, PULONG   );
 char buf[50000];

 HINSTANCE hDLL = LoadLibrary(&quot;Ntdll.dll&quot;);
 NTQUERYSYSTEMINFORMATION NtQuerySystemInformation = (NTQUERYSYSTEMINFORMATION)GetProcAddress(hDLL,&quot;NtQuerySystemInformation&quot;);   

 NtQuerySystemInformation(SystemProcessInformation,buf,sizeof(buf),&amp;needed);
 SYSTEM_PROCESS_INFORMATION* info;
 info = (SYSTEM_PROCESS_INFORMATION*)buf;

 cout &lt;&lt; needed &lt;&lt; endl; 
 char exename[1024];
 HMODULE hMod;
 DWORD cbNeeded;

 while(1)
 {
 HANDLE victim = info-&gt;UniqueProcessId;
 EnumProcessModules( victim, &amp;hMod, sizeof(hMod),&amp;cbNeeded);
 GetModuleBaseName( victim, hMod, exename,sizeof(exename));
 cout &lt;&lt; exename &lt;&lt; endl;
 cout &lt;&lt; info-&gt;NextEntryOffset &lt;&lt; endl;
 if (info-&gt;NextEntryOffset == 0)
  break;
 sizeof(BYTE)*48 + sizeof(PVOID)*3 + sizeof(HANDLE);
 info += info-&gt;NextEntryOffset;
 }
 system(&quot;pause&quot;);
 return 0;    
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1274890</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1274890</guid><dc:creator><![CDATA[Xalon_]]></dc:creator><pubDate>Fri, 27 Apr 2007 21:47:43 GMT</pubDate></item><item><title><![CDATA[Reply to NtQuerySystemInformation -- Speicherzugriffsfehler on Fri, 27 Apr 2007 23:32:59 GMT]]></title><description><![CDATA[<p>Pointerarithmetik ! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /></p>
<p>&quot;info += info -&gt; NextEntryOffset&quot; erhöht &quot;info&quot; um ( (info -&gt; NextEntryOffset) * sizeof (SYSTEM_PROCESS_INFORMATION) ).</p>
<p>Vorschlag :</p>
<pre><code class="language-cpp">unsigned int index = 0;
 ...
 while (1) {
  ...
  info = (SYSTEM_PROCESS_INFORMATION *) &amp;buf [index];
  ...
  if ( info -&gt; NextEntryOffset == 0 ) { break; }
  index += info -&gt; NextEntryOffset;
 }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1274908</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1274908</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Fri, 27 Apr 2007 23:32:59 GMT</pubDate></item><item><title><![CDATA[Reply to NtQuerySystemInformation -- Speicherzugriffsfehler on Sat, 28 Apr 2007 09:15:37 GMT]]></title><description><![CDATA[<p>Ahh Danke,scheint zu klappen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title="=)"
      alt="🙂"
    /><br />
Jetzt hab ich nur noch ein Problem:<br />
Wie komm ich an den .exe Name?</p>
<pre><code class="language-cpp">EnumProcessModules( info-&gt;UniqueProcessId, &amp;hMod, sizeof(hMod),&amp;cbNeeded);
 GetModuleBaseName( info-&gt;UniqueProcessId, hMod, exename,sizeof(exename));
</code></pre>
<p>gibt immmer Ÿ zurück.</p>
<p>Und bei</p>
<pre><code class="language-cpp">HANDLE hndl =  OpenProcess( PROCESS_QUERY_INFORMATION |PROCESS_VM_READ, FALSE, info-&gt;UniqueProcessId);
 EnumProcessModules( hndl, &amp;hMod, sizeof(hMod),&amp;cbNeeded);
 GetModuleBaseName( hndl, hMod, exename,sizeof(exename));
</code></pre>
<p>mekert er immmer das ihm der Typ nicht passt <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":/"
      alt="😕"
    /></p>
<p>Benutz ich überhaupt die richtige _SYSTEM_PROCESS_INFORMATION wenn ich<br />
NtQuerySystemInformation mit SystemProcessInformation (#defined als 5) aufrufe?</p>
<p>Schon mal vielen Dank <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title="=)"
      alt="🙂"
    /></p>
<p>Xalon</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1275011</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1275011</guid><dc:creator><![CDATA[Xalon_]]></dc:creator><pubDate>Sat, 28 Apr 2007 09:15:37 GMT</pubDate></item><item><title><![CDATA[Reply to NtQuerySystemInformation -- Speicherzugriffsfehler on Sat, 28 Apr 2007 13:10:29 GMT]]></title><description><![CDATA[<p>Die &quot;SYSTEM_PROCESS_INFORMATION&quot; enthält einen Fehler :</p>
<p>Member &quot;<strong>HANDLE</strong> UniqueProcessId&quot; ist in &quot;Wirklichkeit&quot; ein &quot;<strong>DWORD</strong> UniqueProcessId&quot;. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1275137</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1275137</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 28 Apr 2007 13:10:29 GMT</pubDate></item><item><title><![CDATA[Reply to NtQuerySystemInformation -- Speicherzugriffsfehler on Sat, 28 Apr 2007 14:12:16 GMT]]></title><description><![CDATA[<p>Tatsächlich,Danke <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title="=)"
      alt="🙂"
    /></p>
<p>Das Microsoft nicht mal sowas auf die Reihe bekommt? Ich mein ich hab das 1:1 aus<br />
der msdn ...</p>
<p>Xalon</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1275183</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1275183</guid><dc:creator><![CDATA[Xalon_]]></dc:creator><pubDate>Sat, 28 Apr 2007 14:12:16 GMT</pubDate></item></channel></rss>