<?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[int (*func)();   ???]]></title><description><![CDATA[<p>Hallo eine frage was ist das hier ??</p>
<p>Eine Funktion wo ein Pointer drauf ist ??</p>
<p>int (*func)();</p>
<p>Und denn Teil hier versteh ich auch irgendwie noch nicht so wirklich.</p>
<p>Kann mir das wer plz erklären ?</p>
<p>func = (int (*) () ) code;</p>
<p>Wenn ja würde das nicht auch so gehen ?</p>
<p>int *func)();</p>
<p>Also hier ist mal das Komplette Programm</p>
<p>Der shellcode ruft einfach nur den Sleep Befehl auf.</p>
<pre><code class="language-cpp">char code[] = &quot;\x31\xc0\xbb\x42\x24\x80\x7c\x66\xb8\x88\x13\x50\xff\xd3&quot;;
int main(int argc, char **argv)
{
int (*func)();
func = (int (*)()) code;
(int)(*func)();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/253375/int-func</link><generator>RSS for Node</generator><lastBuildDate>Sun, 13 Sep 2026 18:19:52 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/253375.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 01 Nov 2009 17:28:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to int (*func)();   ??? on Sun, 01 Nov 2009 17:28:22 GMT]]></title><description><![CDATA[<p>Hallo eine frage was ist das hier ??</p>
<p>Eine Funktion wo ein Pointer drauf ist ??</p>
<p>int (*func)();</p>
<p>Und denn Teil hier versteh ich auch irgendwie noch nicht so wirklich.</p>
<p>Kann mir das wer plz erklären ?</p>
<p>func = (int (*) () ) code;</p>
<p>Wenn ja würde das nicht auch so gehen ?</p>
<p>int *func)();</p>
<p>Also hier ist mal das Komplette Programm</p>
<p>Der shellcode ruft einfach nur den Sleep Befehl auf.</p>
<pre><code class="language-cpp">char code[] = &quot;\x31\xc0\xbb\x42\x24\x80\x7c\x66\xb8\x88\x13\x50\xff\xd3&quot;;
int main(int argc, char **argv)
{
int (*func)();
func = (int (*)()) code;
(int)(*func)();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1801769</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1801769</guid><dc:creator><![CDATA[mr_point]]></dc:creator><pubDate>Sun, 01 Nov 2009 17:28:22 GMT</pubDate></item><item><title><![CDATA[Reply to int (*func)();   ??? on Sun, 01 Nov 2009 17:42:09 GMT]]></title><description><![CDATA[<p>Das ist ein Cast. Eigentlich ja genau das gleiche, wie:</p>
<pre><code class="language-cpp">float foo = 2.0f;
int b = (int) foo;
</code></pre>
<p>Darum die Klammern da.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1801775</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1801775</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sun, 01 Nov 2009 17:42:09 GMT</pubDate></item><item><title><![CDATA[Reply to int (*func)();   ??? on Sun, 01 Nov 2009 17:51:30 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">func = (int (*)()) code;
</code></pre>
<p>bedeutet man nehme den pointer von code und interpretiere ihn als eine Funktion mit Rückgabetyp int und ohne Parameter.<br />
(Rückgabetyp (*) (typ parameter, ...) zuInterpretierenderPointer.</p>
<pre><code class="language-cpp">int (*func)();
</code></pre>
<p>ist eine Funktionsdeklaration. Quasi dasselbe wie</p>
<pre><code class="language-cpp">int func();
</code></pre>
<p>Die Variable func soll ein Pointer auf eine Funktion sein, die ein int zurückgibt und keine Parameter annimmt.</p>
<p>Ich habe keine Ahnung was</p>
<pre><code class="language-cpp">(int)(*func)();
</code></pre>
<p>bedeuten soll, ein Compiler auch nicht soweit ich das überblicke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1801778</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1801778</guid><dc:creator><![CDATA[nwp2]]></dc:creator><pubDate>Sun, 01 Nov 2009 17:51:30 GMT</pubDate></item><item><title><![CDATA[Reply to int (*func)();   ??? on Sun, 01 Nov 2009 17:56:48 GMT]]></title><description><![CDATA[<p>Also ist das</p>
<pre><code class="language-cpp">float foo = 2.0f;
</code></pre>
<p>das gleich wie</p>
<pre><code class="language-cpp">int b = (int) foo;
</code></pre>
<p>Und wenn ja wieso steht dann da 1 mal int und nicht 2 mal float</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1801781</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1801781</guid><dc:creator><![CDATA[mr point]]></dc:creator><pubDate>Sun, 01 Nov 2009 17:56:48 GMT</pubDate></item><item><title><![CDATA[Reply to int (*func)();   ??? on Sun, 01 Nov 2009 17:59:04 GMT]]></title><description><![CDATA[<p>Nein, nein. Die Klammern sind da, weil es ein Cast sein soll. Das andere ist ja nur ein Beispiel von einem expliziten Cast, den man eigentlich kennen sollte.</p>
<p>Siehe auch:<br />
<a href="http://www.cplusplus.com/doc/tutorial/typecasting/" rel="nofollow">http://www.cplusplus.com/doc/tutorial/typecasting/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1801784</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1801784</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sun, 01 Nov 2009 17:59:04 GMT</pubDate></item><item><title><![CDATA[Reply to int (*func)();   ??? on Sun, 01 Nov 2009 18:28:28 GMT]]></title><description><![CDATA[<p>ok ty ich werds mal durcharbeiten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1801798</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1801798</guid><dc:creator><![CDATA[mr point]]></dc:creator><pubDate>Sun, 01 Nov 2009 18:28:28 GMT</pubDate></item><item><title><![CDATA[Reply to int (*func)();   ??? on Mon, 02 Nov 2009 08:24:15 GMT]]></title><description><![CDATA[<p>mr_point schrieb:</p>
<blockquote>
<p>int (*func)();</p>
</blockquote>
<p>func ist uninitialisierter Zeiger vom Typ &quot;Zeiger auf eine parameterlose Funktion, die int zurückgibt&quot;.</p>
<p>mr_point schrieb:</p>
<blockquote>
<p>func = (int (*) () ) code;</p>
</blockquote>
<p>C-style cast.</p>
<p>mr_point schrieb:</p>
<blockquote>
<p>Also hier ist mal das Komplette Programm<br />
Der shellcode ruft einfach nur den Sleep Befehl auf.</p>
<pre><code class="language-cpp">char code[] = &quot;\x31\xc0\xbb\x42\x24\x80\x7c\x66\xb8\x88\x13\x50\xff\xd3&quot;;
int main(int argc, char **argv)
{
  int (*func)();
  func = (int (*)()) code;
  (int)(*func)();
}
</code></pre>
</blockquote>
<p>Das ist ganz großer Käse! Laut C++ Standard &quot;undefiniertes Verhalten&quot;, weil Du einem Funktionszeiger keine Adresse einer Funktion vom richtigen Typ zuweist und versuchst die &quot;Funktion&quot; aufzurufen. Auf modernen Systemen wird das Betriebssystem den Prozess einfach abschießen, weil üblicherweise das Betriebssystem nicht das Ausführen von im Datensegment befindlichen Code erlaubt.</p>
<p>Gruß,<br />
SP</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1801994</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1801994</guid><dc:creator><![CDATA[Sebastian Pizer]]></dc:creator><pubDate>Mon, 02 Nov 2009 08:24:15 GMT</pubDate></item></channel></rss>