<?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[BYTE* zu unsigned in HEX]]></title><description><![CDATA[<p>Ich bekomme die Zahl einfach nicht als Hexadezimale Zahl in ein unsigned geschrieben..</p>
<p>Bei Fenstertitel einfach &quot;Module Leser&quot; eingeben.<br />
Ätzenderweise ist auf &quot;Str&quot; nicht die Gleiche Zahl wie vorher ausgegeben.</p>
<pre><code>#include &lt;iostream&gt; 
#include &lt;windows.h&gt; 
#include &lt;tlhelp32.h&gt; 
#include &lt;sstream&gt; 

using namespace std; 

int main() 
{ 
    SetConsoleTitle(&quot;Module Leser&quot;); 

    DWORD dwProcessId; 
    string strTitel; 
    MODULEENTRY32 lpModuleEntry; 
    HWND hWnd; 
    stringstream Str; 
    unsigned int BASIS_HIER; 

    while(1){ 
    do{ 
        cout &lt;&lt; &quot;Fenstertitel: &quot;; 
        getline(cin, strTitel); 
        hWnd = FindWindow(0, strTitel.c_str()); 

    }while(!hWnd); 
    cout &lt;&lt; endl; 

    GetWindowThreadProcessId(hWnd, &amp;dwProcessId); 
    HANDLE hproc        = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId); 
    HANDLE hSnapShot    = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwProcessId); 
    if(!hSnapShot||!hproc) 
        return 0; 

    lpModuleEntry.dwSize = sizeof(lpModuleEntry); 
    BOOL bModule = Module32First(hSnapShot, &amp;lpModuleEntry); 

    while(bModule) 
    { 
            cout &lt;&lt; lpModuleEntry.szModule &lt;&lt; &quot;\t\t&quot; &lt;&lt; hex &lt;&lt; (DWORD)lpModuleEntry.modBaseAddr &lt;&lt; endl; 

            if(lpModuleEntry.szModule == &quot;kernel32.dll&quot;) 
                Str &lt;&lt; hex &lt;&lt; (unsigned)lpModuleEntry.modBaseAddr; 

            bModule = Module32Next(hSnapShot, &amp;lpModuleEntry); 
    } 
    CloseHandle(hSnapShot); 
    cout &lt;&lt; endl &lt;&lt; Str &lt;&lt; endl &lt;&lt; endl; 
  } 

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/332395/byte-zu-unsigned-in-hex</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Apr 2026 23:22:58 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/332395.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 27 Apr 2015 19:26:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to BYTE* zu unsigned in HEX on Mon, 27 Apr 2015 19:26:02 GMT]]></title><description><![CDATA[<p>Ich bekomme die Zahl einfach nicht als Hexadezimale Zahl in ein unsigned geschrieben..</p>
<p>Bei Fenstertitel einfach &quot;Module Leser&quot; eingeben.<br />
Ätzenderweise ist auf &quot;Str&quot; nicht die Gleiche Zahl wie vorher ausgegeben.</p>
<pre><code>#include &lt;iostream&gt; 
#include &lt;windows.h&gt; 
#include &lt;tlhelp32.h&gt; 
#include &lt;sstream&gt; 

using namespace std; 

int main() 
{ 
    SetConsoleTitle(&quot;Module Leser&quot;); 

    DWORD dwProcessId; 
    string strTitel; 
    MODULEENTRY32 lpModuleEntry; 
    HWND hWnd; 
    stringstream Str; 
    unsigned int BASIS_HIER; 

    while(1){ 
    do{ 
        cout &lt;&lt; &quot;Fenstertitel: &quot;; 
        getline(cin, strTitel); 
        hWnd = FindWindow(0, strTitel.c_str()); 

    }while(!hWnd); 
    cout &lt;&lt; endl; 

    GetWindowThreadProcessId(hWnd, &amp;dwProcessId); 
    HANDLE hproc        = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId); 
    HANDLE hSnapShot    = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwProcessId); 
    if(!hSnapShot||!hproc) 
        return 0; 

    lpModuleEntry.dwSize = sizeof(lpModuleEntry); 
    BOOL bModule = Module32First(hSnapShot, &amp;lpModuleEntry); 

    while(bModule) 
    { 
            cout &lt;&lt; lpModuleEntry.szModule &lt;&lt; &quot;\t\t&quot; &lt;&lt; hex &lt;&lt; (DWORD)lpModuleEntry.modBaseAddr &lt;&lt; endl; 

            if(lpModuleEntry.szModule == &quot;kernel32.dll&quot;) 
                Str &lt;&lt; hex &lt;&lt; (unsigned)lpModuleEntry.modBaseAddr; 

            bModule = Module32Next(hSnapShot, &amp;lpModuleEntry); 
    } 
    CloseHandle(hSnapShot); 
    cout &lt;&lt; endl &lt;&lt; Str &lt;&lt; endl &lt;&lt; endl; 
  } 

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2451753</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2451753</guid><dc:creator><![CDATA[moinsen]]></dc:creator><pubDate>Mon, 27 Apr 2015 19:26:02 GMT</pubDate></item><item><title><![CDATA[Reply to BYTE* zu unsigned in HEX on Mon, 27 Apr 2015 19:36:09 GMT]]></title><description><![CDATA[<p><a href="https://www.c-plusplus.net/forum/304133">Kürze den Code aufs wesentliche</a>. Was soll das ganze Windowszeugs?</p>
<blockquote>
<pre><code>cout &lt;&lt; endl &lt;&lt; Str &lt;&lt; endl &lt;&lt; endl;
</code></pre>
</blockquote>
<p>Hier gibst du einen Stream aus. Macht vermutlich nicht das, was du denkst, was es macht.</p>
<blockquote>
<p>Ich bekomme die Zahl einfach nicht als Hexadezimale Zahl in ein unsigned geschrieben..</p>
</blockquote>
<p>Entweder drückst du dich dumm aus oder das Vorhaben ist Quatsch. Arithmetische Datentypen (wie unsigned int) speichern den Wert einer Zahl, keine spezielle Darstellung.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2451755</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2451755</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 27 Apr 2015 19:36:09 GMT</pubDate></item><item><title><![CDATA[Reply to BYTE* zu unsigned in HEX on Mon, 27 Apr 2015 20:03:31 GMT]]></title><description><![CDATA[<blockquote>
<pre><code>cout &lt;&lt; endl &lt;&lt; Str &lt;&lt; endl &lt;&lt; endl;
</code></pre>
</blockquote>
<p>Hier gibst du einen Stream aus. Macht vermutlich nicht das, was du denkst, was es macht.</p>
<p>-Ich nehme an der Stream müssten den gleichen Wert wie eine Zahl ausgeben(?)</p>
<blockquote>
<p>Ich bekomme die Zahl einfach nicht als Hexadezimale Zahl in ein unsigned geschrieben..</p>
</blockquote>
<p>Entweder drückst du dich dumm aus oder das Vorhaben ist Quatsch. Arithmetische Datentypen (wie unsigned int) speichern den Wert einer Zahl, keine spezielle Darstellung.[/quote]</p>
<p>-Gut, ich habe stringstream nur benutzt um die Zahl von Dezimal in Hexadezimal umzurechnen. Bzw ich möchte das Ergebnis von lpModuleEntry.modBaseAddr in Hexadezimal umrechnen, und dieses Ergebnis in einen unsigned packen o.O</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2451758</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2451758</guid><dc:creator><![CDATA[moinsen]]></dc:creator><pubDate>Mon, 27 Apr 2015 20:03:31 GMT</pubDate></item><item><title><![CDATA[Reply to BYTE* zu unsigned in HEX on Mon, 27 Apr 2015 20:32:20 GMT]]></title><description><![CDATA[<p>cout &lt;&lt; (unsigned)lpModuleEntry.modBaseAddr;</p>
<p>Gibt mir den richtigen Wert aus.</p>
<p>unsigned int BASIS_HIER;<br />
BASIS_HIER = (unsigned)lpModuleEntry.modBaseAddr;<br />
cout &lt;&lt; BASIS_HIER;</p>
<p>Gibt mir den falschen Wert. DWORD will auch nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2451759</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2451759</guid><dc:creator><![CDATA[moinsen]]></dc:creator><pubDate>Mon, 27 Apr 2015 20:32:20 GMT</pubDate></item><item><title><![CDATA[Reply to BYTE* zu unsigned in HEX on Mon, 27 Apr 2015 20:54:24 GMT]]></title><description><![CDATA[<p>Okay hat sich erledigt. Ich dachte mir schon die ganze Zeit daß ich einen Logik-Fehler habe. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /><br />
cout &lt;&lt; hex konvertiert auch das Zukünftige und der unsigned kann zugewiesen werden. Google wird's Danken. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2451763</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2451763</guid><dc:creator><![CDATA[moinsen]]></dc:creator><pubDate>Mon, 27 Apr 2015 20:54:24 GMT</pubDate></item><item><title><![CDATA[Reply to BYTE* zu unsigned in HEX on Mon, 27 Apr 2015 20:55:58 GMT]]></title><description><![CDATA[<p>Außerdem braucht man strcmp.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2451764</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2451764</guid><dc:creator><![CDATA[moinsen]]></dc:creator><pubDate>Mon, 27 Apr 2015 20:55:58 GMT</pubDate></item><item><title><![CDATA[Reply to BYTE* zu unsigned in HEX on Mon, 27 Apr 2015 22:35:55 GMT]]></title><description><![CDATA[<p>moinsen schrieb:</p>
<blockquote>
<blockquote>
<blockquote>
<pre><code>cout &lt;&lt; endl &lt;&lt; Str &lt;&lt; endl &lt;&lt; endl;
</code></pre>
</blockquote>
<p>Hier gibst du einen Stream aus. Macht vermutlich nicht das, was du denkst, was es macht.</p>
</blockquote>
<p>-Ich nehme an der Stream müssten den gleichen Wert wie eine Zahl ausgeben(?)</p>
</blockquote>
<p>Jetzt rate mal, warum ich wohl gesagt habe, dass es vermutlich nicht das macht, was du denkst, was es macht.</p>
<blockquote>
<blockquote>
<blockquote>
<p>Ich bekomme die Zahl einfach nicht als Hexadezimale Zahl in ein unsigned geschrieben..</p>
</blockquote>
<p>Entweder drückst du dich dumm aus oder das Vorhaben ist Quatsch. Arithmetische Datentypen (wie unsigned int) speichern den Wert einer Zahl, keine spezielle Darstellung.</p>
</blockquote>
<p>-Gut, ich habe stringstream nur benutzt um die Zahl von Dezimal in Hexadezimal umzurechnen. Bzw ich möchte das Ergebnis von lpModuleEntry.modBaseAddr in Hexadezimal umrechnen, und dieses Ergebnis in einen unsigned packen o.O</p>
</blockquote>
<p>Jetzt hast du wiederholt gesagt, dass du das machen möchtest, wovon ich dir gerade eben gesagt habe, dass es nicht geht. Das ist so, als wolltest du eine Zahl hexadezimal auf einem Rechenschieber speichern. Das macht einfach keinen Sinn! Hexadezimal ist eine <strong>Darstellung</strong>, eine Folge von Zeichen. Integer speichern Zahlen<strong>werte</strong>, unabhängig von irgendeiner Darstellung.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2451772</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2451772</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 27 Apr 2015 22:35:55 GMT</pubDate></item><item><title><![CDATA[Reply to BYTE* zu unsigned in HEX on Mon, 27 Apr 2015 22:45:27 GMT]]></title><description><![CDATA[<blockquote>
<p>Integer speichern Zahlenwerte, unabhängig von irgendeiner Darstellung.</p>
</blockquote>
<p>Das ist offenbar ungünstig formuliert, wo doch der Standard spezifisch von einer Darstellung (representation) spricht und sogar festlegt dass diese binär sein muss.</p>
<p>§3.9.1/7 schrieb:</p>
<blockquote>
<p>The representations of integral types shall define values by use of a pure binary numeration system.</p>
</blockquote>
<p>Aber hier liegt ja auch der Witz: Ein <code>int</code> wird einen Wert stets binär darstellen, und kennt daher gar keine anderen Zahlbasen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2451774</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2451774</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Mon, 27 Apr 2015 22:45:27 GMT</pubDate></item><item><title><![CDATA[Reply to BYTE* zu unsigned in HEX on Mon, 27 Apr 2015 22:51:29 GMT]]></title><description><![CDATA[<p>Arcoth schrieb:</p>
<blockquote>
<blockquote>
<p>Integer speichern Zahlenwerte, unabhängig von irgendeiner Darstellung.</p>
</blockquote>
<p>Das ist offenbar ungünstig formuliert, wo doch der Standard spezifisch von einer Darstellung (representation) spricht und sogar festlegt dass diese binär sein muss.</p>
<p>§3.9.1/7 schrieb:</p>
<blockquote>
<p>The representations of integral types shall define values by use of a pure binary numeration system.</p>
</blockquote>
<p>Aber hier liegt ja auch der Witz: Ein <code>int</code> wird einen Wert stets binär darstellen, und kennt daher gar keine anderen Zahlbasen.</p>
</blockquote>
<p>Guter Einwand! Den Absatz habe ich irgendwie vergessen, weil er nie von Belang ist. Dann formuliere ich um:<br />
Ganzzahldatentypen speichern Zahlenwerte. Intern werden diese zwar immer binär dargestellt, was aber niemals von Belang ist, außer man lässt sich tatsächlich mal eine Variable Byte für Byte ausgeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2451777</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2451777</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 27 Apr 2015 22:51:29 GMT</pubDate></item><item><title><![CDATA[Reply to BYTE* zu unsigned in HEX on Mon, 27 Apr 2015 23:03:43 GMT]]></title><description><![CDATA[<blockquote>
<p>Intern werden diese zwar immer binär dargestellt, was aber niemals von Belang ist, außer man lässt sich tatsächlich mal eine Variable Byte für Byte ausgeben.</p>
</blockquote>
<p>... oder man arbeitet auf Bitebene.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2451778</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2451778</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Mon, 27 Apr 2015 23:03:43 GMT</pubDate></item><item><title><![CDATA[Reply to BYTE* zu unsigned in HEX on Mon, 27 Apr 2015 23:18:04 GMT]]></title><description><![CDATA[<p>Nur ein kleiner Einwurf: Bitt einen <code>xxxptr_t</code> bzw. <code>XXX_PTR</code> Typen verwenden wenn man Zeiger in Integers konvertieren möchte/muss.<br />
Also z.B. <code>intptr_t</code> oder <code>uintptr_t</code> aus dem Standard oder <code>INT_PTR</code> , <code>UINT_PTR</code> oder <code>DWORD_PTR</code> vom Windows SDK.</p>
<p>Sonst stehen die Chancen schlecht wenn man mal ne 64 Bit Version laufen lassen möchte.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2451780</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2451780</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Mon, 27 Apr 2015 23:18:04 GMT</pubDate></item></channel></rss>