<?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[Explorer - Welche Funktion um Ordner aufzulisten?]]></title><description><![CDATA[<p>Hi,<br />
wie der Titel schon verrät ist meine Frage welche Funktion die explorer.exe benutz um den Inhalt eines Ordners anzuzeigen?</p>
<p>Ich habe gedacht es wäre FindFirstFile &amp; FindNextFile, dem ist aber nicht so kann das sein?</p>
<p>Meine Vermutung kommt daher, da ich ne DLL geschrieben hab die die Funktion FindNextFile hook und wenn das gefundene File z.B. &quot;geheim.txt&quot; heisst einfach an den anfang von MEMORY_BASIC_INFORMATION-&gt;cFileName eine '\0' hinschreibt.</p>
<p>Hab ich auch mit einem Programm getestet:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

int main()
{
	BOOL bAgain = TRUE;
	HANDLE hFile = INVALID_HANDLE_VALUE;
	TCHAR szPath[] = TEXT(&quot;C:\\test\\*&quot;);
	WIN32_FIND_DATA findData;
	char question = 0;

	int i = 0;

	while(bAgain == TRUE)
	{
	    hFile = FindFirstFile(szPath, &amp;findData);

	    if(hFile != INVALID_HANDLE_VALUE)
	    {
	        printf(&quot;%s\n&quot;, findData.cFileName);

	        while(FindNextFile(hFile, &amp;findData) != 0)
                printf(&quot;%s\n&quot;, findData.cFileName);

            if( (i = GetLastError()) != ERROR_NO_MORE_FILES)
                printf(&quot;Last error nr: %i\n&quot;, i);

            FindClose(hFile);
	    }
	    else
	    {
	        printf(&quot;hFile = Invalid handle value!\n&quot;);
	        printf(&quot;GetLastError() = %ui&quot;, GetLastError());
	        bAgain = FALSE;
	    }

	    printf(&quot;\n\nAgain&quot;);
	    scanf(&quot;%c&quot;, &amp;question);

	    if(question != 'j')
            bAgain = FALSE;
	}
	return 0;
}
</code></pre>
<p>Einmal auflisten lassen, meine DLL injiziert, nochmal auflisten lassen und tada geheim.txt wird nicht angezeigt.</p>
<p>Wenn ich aber jetzt meine DLL in explorer.exe injiziere wir die Datei trotzdem noch angezeigt.</p>
<p>Wäre dankbar für jede Antwort<br />
Gruß Pingu-Group</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/219590/explorer-welche-funktion-um-ordner-aufzulisten</link><generator>RSS for Node</generator><lastBuildDate>Wed, 26 Aug 2026 20:06:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/219590.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 05 Aug 2008 09:56:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Explorer - Welche Funktion um Ordner aufzulisten? on Tue, 05 Aug 2008 09:56:34 GMT]]></title><description><![CDATA[<p>Hi,<br />
wie der Titel schon verrät ist meine Frage welche Funktion die explorer.exe benutz um den Inhalt eines Ordners anzuzeigen?</p>
<p>Ich habe gedacht es wäre FindFirstFile &amp; FindNextFile, dem ist aber nicht so kann das sein?</p>
<p>Meine Vermutung kommt daher, da ich ne DLL geschrieben hab die die Funktion FindNextFile hook und wenn das gefundene File z.B. &quot;geheim.txt&quot; heisst einfach an den anfang von MEMORY_BASIC_INFORMATION-&gt;cFileName eine '\0' hinschreibt.</p>
<p>Hab ich auch mit einem Programm getestet:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

int main()
{
	BOOL bAgain = TRUE;
	HANDLE hFile = INVALID_HANDLE_VALUE;
	TCHAR szPath[] = TEXT(&quot;C:\\test\\*&quot;);
	WIN32_FIND_DATA findData;
	char question = 0;

	int i = 0;

	while(bAgain == TRUE)
	{
	    hFile = FindFirstFile(szPath, &amp;findData);

	    if(hFile != INVALID_HANDLE_VALUE)
	    {
	        printf(&quot;%s\n&quot;, findData.cFileName);

	        while(FindNextFile(hFile, &amp;findData) != 0)
                printf(&quot;%s\n&quot;, findData.cFileName);

            if( (i = GetLastError()) != ERROR_NO_MORE_FILES)
                printf(&quot;Last error nr: %i\n&quot;, i);

            FindClose(hFile);
	    }
	    else
	    {
	        printf(&quot;hFile = Invalid handle value!\n&quot;);
	        printf(&quot;GetLastError() = %ui&quot;, GetLastError());
	        bAgain = FALSE;
	    }

	    printf(&quot;\n\nAgain&quot;);
	    scanf(&quot;%c&quot;, &amp;question);

	    if(question != 'j')
            bAgain = FALSE;
	}
	return 0;
}
</code></pre>
<p>Einmal auflisten lassen, meine DLL injiziert, nochmal auflisten lassen und tada geheim.txt wird nicht angezeigt.</p>
<p>Wenn ich aber jetzt meine DLL in explorer.exe injiziere wir die Datei trotzdem noch angezeigt.</p>
<p>Wäre dankbar für jede Antwort<br />
Gruß Pingu-Group</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1559501</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1559501</guid><dc:creator><![CDATA[Pingu-Group]]></dc:creator><pubDate>Tue, 05 Aug 2008 09:56:34 GMT</pubDate></item><item><title><![CDATA[Reply to Explorer - Welche Funktion um Ordner aufzulisten? on Tue, 05 Aug 2008 14:05:12 GMT]]></title><description><![CDATA[<p>Ich behaupte mal, Explorer verwendet offensichtlich andere Funktionen.</p>
<p>z.B. mit IOCTLs? (Das ist nur so ein Gedanke von mir, wie es wirklich funktioniert weiß ich nicht)</p>
<p>Martin</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1559674</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1559674</guid><dc:creator><![CDATA[Mmacher]]></dc:creator><pubDate>Tue, 05 Aug 2008 14:05:12 GMT</pubDate></item><item><title><![CDATA[Reply to Explorer - Welche Funktion um Ordner aufzulisten? on Wed, 06 Aug 2008 08:30:07 GMT]]></title><description><![CDATA[<p>Mmacher schrieb:</p>
<blockquote>
<p>Ich behaupte mal, Explorer verwendet offensichtlich andere Funktionen.</p>
</blockquote>
<p>Und ich bin mir ziemlich sicher, dass er dies nicht tut. Eher vermute ich dass der Fehler im Code des Hooks liegt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1560008</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1560008</guid><dc:creator><![CDATA[_Luckie]]></dc:creator><pubDate>Wed, 06 Aug 2008 08:30:07 GMT</pubDate></item><item><title><![CDATA[Reply to Explorer - Welche Funktion um Ordner aufzulisten? on Wed, 06 Aug 2008 08:56:29 GMT]]></title><description><![CDATA[<p>_Luckie schrieb:</p>
<blockquote>
<p>Und ich bin mir ziemlich sicher, dass er dies nicht tut. Eher vermute ich dass der Fehler im Code des Hooks liegt.</p>
</blockquote>
<p>ACK!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1560021</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1560021</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Wed, 06 Aug 2008 08:56:29 GMT</pubDate></item><item><title><![CDATA[Reply to Explorer - Welche Funktion um Ordner aufzulisten? on Wed, 06 Aug 2008 12:41:54 GMT]]></title><description><![CDATA[<p>Zeig mal deinen Hook <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="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1560200</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1560200</guid><dc:creator><![CDATA[KapnHook]]></dc:creator><pubDate>Wed, 06 Aug 2008 12:41:54 GMT</pubDate></item><item><title><![CDATA[Reply to Explorer - Welche Funktion um Ordner aufzulisten? on Tue, 12 Aug 2008 15:51:23 GMT]]></title><description><![CDATA[<p>Hey sorry das ich erst jetzt wieder schreib, aber ich war jetzt 5Tage aufn Taubertal Festival :D.</p>
<p>hab jetzt das problem mal ein bissle eingeschränkt.<br />
Irgendwie liegt es dran, dass die Funktion WriteProcessMemory immer ein byte weiter hinten anfängt zu schreiben.<br />
Bspl:</p>
<pre><code>Orginal FindNextFileW

7C80EF5A k&gt;  6A 2C               PUSH 2C                                          ; FindNextFileW
7C80EF5C     68 58F0807C         PUSH kernel32.7C80F058
7C80EF61     E8 6035FFFF         CALL kernel32.7C8024C6
</code></pre>
<p>als Argument für WriteProcess Memory wird &quot;7C80EF5A&quot; übergeben aber nach dem Aufruf steht das da:</p>
<pre><code>7C80EF5A k&gt;  6A 90               PUSH -70                                         ; FindNextFileW
7C80EF5C     90                  NOP
7C80EF5D     90                  NOP
7C80EF5E     90                  NOP
7C80EF5F     90                  NOP
7C80EF60     90                  NOP
</code></pre>
<p>Obwohl ich ja ab &quot;7C80EF5A&quot; &quot;NOPen&quot; wollte <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=":confused:"
      alt="😕"
    />.</p>
<p>Und in mein Array liest er au ned die ersten 7bytes von FindNextFileW sondern:</p>
<pre><code>CC 2C 68 58 F0 80 7C
</code></pre>
<p>Hier mal der Hook:</p>
<pre><code class="language-cpp">void DLL_EXPORT func_hook(unsigned source_addr, unsigned bytes_to_save, unsigned new_addr, unsigned instead_call, DWORD proc_id)
{
    unsigned char byte = 0;

    DWORD rw = 0;

    HANDLE hproc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proc_id);

    unsigned temp_addr[10];

    unsigned char* ar_to_save = malloc(bytes_to_save);

    temp_addr[0] = source_addr;
    temp_addr[1] = new_addr;

    if(hproc != NULL)
    {
//OPs von Source_Func lesen
        if(ReadProcessMemory( hproc, (LPVOID) source_addr, ar_to_save, bytes_to_save, &amp;rw) == 0)
            MessageBox(NULL, TEXT(&quot;Error while readind OPs from source&quot;), TEXT(&quot;Error&quot;), MB_OK);
//OPs von Source_func an new_func schreiben
        if(WriteProcessMemory( hproc, (LPVOID) new_addr, ar_to_save, bytes_to_save, &amp;rw) == 0)
            MessageBox(NULL, TEXT(&quot;Error while writing OPs to new_addr&quot;), TEXT(&quot;Error&quot;), MB_OK);

        memset(ar_to_save, NOP, bytes_to_save);
//save_bytes von source mit NOPs füllen
        if(WriteProcessMemory( hproc, (LPVOID) source_addr, ar_to_save, bytes_to_save, &amp;rw) == 0)
            MessageBox(NULL, TEXT(&quot;Error while writing NOPs to source&quot;), TEXT(&quot;Error&quot;), MB_OK);
        source_addr = temp_addr[0];

        byte = JUMP;
//an anfang von source nen jump schreiben
        WriteProcessMemory( hproc, (LPVOID) source_addr, &amp;byte, sizeof(byte), &amp;rw);

        temp_addr[2] = sprungoffset(source_addr, instead_call);

        source_addr += 1;
//an source sprungweite schreiben
        WriteProcessMemory( hproc, (LPVOID) source_addr, &amp;temp_addr[2], sizeof(temp_addr[2]), &amp;rw);

        byte = JUMP;

        new_addr = temp_addr[1];
        new_addr += bytes_to_save;
//an new_addr + bytes_to_save ein jump schrieben
        WriteProcessMemory( hproc, (LPVOID) new_addr, &amp;byte, sizeof(byte), &amp;rw);

        temp_addr[3] = sprungoffset( temp_addr[1] + bytes_to_save, temp_addr[0] + 5);

        new_addr += 1;
//sprungoffset an new_addr schrieben
        WriteProcessMemory( hproc, (LPVOID) new_addr, &amp;temp_addr[3], sizeof(temp_addr[3]), &amp;rw);

        CloseHandle( hproc );
    }
    else
        intprintf(&quot;coudl not open the process with id: %i\n&quot;,proc_id);
}
</code></pre>
<p>Wenn so noch iwelche Infos nötig sind sagt bescheid.<br />
Gruß Pingu-Group</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1563475</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1563475</guid><dc:creator><![CDATA[Pingu-Group]]></dc:creator><pubDate>Tue, 12 Aug 2008 15:51:23 GMT</pubDate></item></channel></rss>