<?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[GetExtendedTcpTable Runtime-Check-Failure #0]]></title><description><![CDATA[<p>Hi,</p>
<p>wenn ich das Programm compilieren will, erscheint ein Runtime-Check-Failure #0. Was mich wundert: Lasse ich es weiterlaufen, also nicht break sonders continue, kann ich in der pTcpTable einen meiner SVHosts sehen mit zugehöriger richtiger PID. Es scheint also zu funktionieren.</p>
<p>Ich hab schon das halbe Netz durchgeguckt und auch Delphi und VB sourcen angeguckt, aber ich finde den Fehler nicht.</p>
<p>Bei jedem GetExtendedTcpTable Aufruf kommt übrigens der Abbruch (Zeile 52 und 59).</p>
<p>Vielleicht weiß ja einer von euch Rat.</p>
<p>Danke</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;Iphlpapi.h&gt;
#include &lt;stdio.h&gt;
#include &lt;conio.h&gt;

typedef enum
{
	TCP_TABLE_BASIC_LISTENER,
	TCP_TABLE_BASIC_CONNECTIONS,
	TCP_TABLE_BASIC_ALL,
	TCP_TABLE_OWNER_PID_LISTENER,
	TCP_TABLE_OWNER_PID_CONNECTIONS,
	TCP_TABLE_OWNER_PID_ALL,
	TCP_TABLE_OWNER_MODULE_LISTENER,
	TCP_TABLE_OWNER_MODULE_CONNECTIONS,
	TCP_TABLE_OWNER_MODULE_ALL
}TCP_TABLE_CLASS,*PTCP_TABLE_CLASS;

typedef DWORD (*DLLPROC) (PVOID,PDWORD,BOOL,ULONG,TCP_TABLE_CLASS,ULONG);

int main()
{
	HINSTANCE hinstDLL;
	DLLPROC GetExtendedTcpTable;
	BOOL fFreeDLL;

	DWORD dwRetVal=0;

	PMIB_TCPTABLE_OWNER_PID pTcpTable;

	hinstDLL = LoadLibraryA(&quot;Iphlpapi.dll&quot;);
	GetExtendedTcpTable = (DLLPROC) GetProcAddress(hinstDLL, &quot;GetExtendedTcpTable&quot;);

	pTcpTable=(MIB_TCPTABLE_OWNER_PID*) HeapAlloc(GetProcessHeap(),0,sizeof(MIB_TCPTABLE_OWNER_PID));
	if(pTcpTable==NULL){
		printf(&quot;NO_MEM\n&quot;);
	}

	DWORD dwSize=0;

	if((dwRetVal=GetExtendedTcpTable(pTcpTable,&amp;dwSize,false,AF_INET,TCP_TABLE_OWNER_PID_ALL,0))==ERROR_INSUFFICIENT_BUFFER){
			printf(&quot;BUFFER_LOW\n&quot;);
			HeapFree(GetProcessHeap(),0,pTcpTable);
			pTcpTable=(MIB_TCPTABLE_OWNER_PID*)HeapAlloc(GetProcessHeap(),0,(UINT)dwSize);
	}

	GetExtendedTcpTable(pTcpTable,&amp;dwSize,TRUE,AF_INET,TCP_TABLE_OWNER_PID_ALL,0);
	fFreeDLL = FreeLibrary(hinstDLL);

	while(_getch()!='q')
	{
	}
	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/178819/getextendedtcptable-runtime-check-failure-0</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Jul 2026 03:34:09 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/178819.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 15 Apr 2007 13:13:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to GetExtendedTcpTable Runtime-Check-Failure #0 on Sun, 15 Apr 2007 13:13:26 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>wenn ich das Programm compilieren will, erscheint ein Runtime-Check-Failure #0. Was mich wundert: Lasse ich es weiterlaufen, also nicht break sonders continue, kann ich in der pTcpTable einen meiner SVHosts sehen mit zugehöriger richtiger PID. Es scheint also zu funktionieren.</p>
<p>Ich hab schon das halbe Netz durchgeguckt und auch Delphi und VB sourcen angeguckt, aber ich finde den Fehler nicht.</p>
<p>Bei jedem GetExtendedTcpTable Aufruf kommt übrigens der Abbruch (Zeile 52 und 59).</p>
<p>Vielleicht weiß ja einer von euch Rat.</p>
<p>Danke</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;Iphlpapi.h&gt;
#include &lt;stdio.h&gt;
#include &lt;conio.h&gt;

typedef enum
{
	TCP_TABLE_BASIC_LISTENER,
	TCP_TABLE_BASIC_CONNECTIONS,
	TCP_TABLE_BASIC_ALL,
	TCP_TABLE_OWNER_PID_LISTENER,
	TCP_TABLE_OWNER_PID_CONNECTIONS,
	TCP_TABLE_OWNER_PID_ALL,
	TCP_TABLE_OWNER_MODULE_LISTENER,
	TCP_TABLE_OWNER_MODULE_CONNECTIONS,
	TCP_TABLE_OWNER_MODULE_ALL
}TCP_TABLE_CLASS,*PTCP_TABLE_CLASS;

typedef DWORD (*DLLPROC) (PVOID,PDWORD,BOOL,ULONG,TCP_TABLE_CLASS,ULONG);

int main()
{
	HINSTANCE hinstDLL;
	DLLPROC GetExtendedTcpTable;
	BOOL fFreeDLL;

	DWORD dwRetVal=0;

	PMIB_TCPTABLE_OWNER_PID pTcpTable;

	hinstDLL = LoadLibraryA(&quot;Iphlpapi.dll&quot;);
	GetExtendedTcpTable = (DLLPROC) GetProcAddress(hinstDLL, &quot;GetExtendedTcpTable&quot;);

	pTcpTable=(MIB_TCPTABLE_OWNER_PID*) HeapAlloc(GetProcessHeap(),0,sizeof(MIB_TCPTABLE_OWNER_PID));
	if(pTcpTable==NULL){
		printf(&quot;NO_MEM\n&quot;);
	}

	DWORD dwSize=0;

	if((dwRetVal=GetExtendedTcpTable(pTcpTable,&amp;dwSize,false,AF_INET,TCP_TABLE_OWNER_PID_ALL,0))==ERROR_INSUFFICIENT_BUFFER){
			printf(&quot;BUFFER_LOW\n&quot;);
			HeapFree(GetProcessHeap(),0,pTcpTable);
			pTcpTable=(MIB_TCPTABLE_OWNER_PID*)HeapAlloc(GetProcessHeap(),0,(UINT)dwSize);
	}

	GetExtendedTcpTable(pTcpTable,&amp;dwSize,TRUE,AF_INET,TCP_TABLE_OWNER_PID_ALL,0);
	fFreeDLL = FreeLibrary(hinstDLL);

	while(_getch()!='q')
	{
	}
	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1266457</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1266457</guid><dc:creator><![CDATA[Fettmops]]></dc:creator><pubDate>Sun, 15 Apr 2007 13:13:26 GMT</pubDate></item><item><title><![CDATA[Reply to GetExtendedTcpTable Runtime-Check-Failure #0 on Sun, 15 Apr 2007 13:18:52 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">typedef DWORD (__stdcall *DLLPROC) (PVOID,PDWORD,BOOL,ULONG,TCP_TABLE_CLASS,ULONG);
</code></pre>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/27a1.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--right_arrow"
      title=":arrow_right:"
      alt="➡"
    /> __stdcall fehlte bei dir</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1266460</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1266460</guid><dc:creator><![CDATA[--------]]></dc:creator><pubDate>Sun, 15 Apr 2007 13:18:52 GMT</pubDate></item><item><title><![CDATA[Reply to GetExtendedTcpTable Runtime-Check-Failure #0 on Sun, 15 Apr 2007 13:22:09 GMT]]></title><description><![CDATA[<p>danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1266464</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1266464</guid><dc:creator><![CDATA[Fettmops]]></dc:creator><pubDate>Sun, 15 Apr 2007 13:22:09 GMT</pubDate></item></channel></rss>