<?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[NTAPI: NtCreateFile gibt STATUS_INVALID_PARAMETER zurück, warum?]]></title><description><![CDATA[<p>Hallo,<br />
ich habe eine Problem mit der Funktion NtCreateFile (identisch zu ZwCreateFile):<br />
Ich möchte nur eine Datei öffnen, lesen, schreiben und wieder schließen (theoretisch würden fopen/fread/fwrite/fclose reichen, kann ich aber nicht verwenden für eine NT-Anwendung).</p>
<p>Hier der reduzierte Code:</p>
<pre><code class="language-cpp">#define FILENAME _T(&quot;\\??\\c:\\datei&quot;)

HANDLE datei_h;
OBJECT_ATTRIBUTES datei_a;
UNICODE_STRING datei_n;
IO_STATUS_BLOCK datei_s;
NTSTATUS status;

RtlInitUnicodeString(&amp;datei_n, FILENAME);
InitializeObjectAttributes(
	&amp;datei_a,
	&amp;datei_n,
	OBJ_CASE_INSENSITIVE,
	NULL,
	NULL
	);
status = NtCreateFile(
	&amp;datei_h,
	GENERIC_READ | GENERIC_WRITE,
	&amp;datei_a,
	&amp;datei_s,
    NULL,
    FILE_ATTRIBUTE_NORMAL,
	0,
    FILE_OPEN,
    FILE_NON_DIRECTORY_FILE | FILE_RANDOM_ACCESS | FILE_SYNCHRONOUS_IO_NONALERT,
	NULL,
	0
	);
</code></pre>
<p>Das Problem ist nun folgendes:<br />
status hat danach immer den Wert 0xC000000D (STATUS_INVALID_PARAMETER), leider weiß ich nicht welcher Parameter falsch ist. Ich habe leider auch kein Beispielcode gefunden, sondern nur diese Dokumentation: <a href="http://www.osronline.com/DDKx/kmarch/k111_9dte.htm" rel="nofollow">http://www.osronline.com/DDKx/kmarch/k111_9dte.htm</a><br />
Kann mir jemand sagen wo mein Fehler liegt?</p>
<p>Viele Grüße,<br />
S_O</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/135085/ntapi-ntcreatefile-gibt-status_invalid_parameter-zurück-warum</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Jul 2026 01:44:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/135085.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 30 Jan 2006 16:02:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to NTAPI: NtCreateFile gibt STATUS_INVALID_PARAMETER zurück, warum? on Mon, 30 Jan 2006 16:02:28 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich habe eine Problem mit der Funktion NtCreateFile (identisch zu ZwCreateFile):<br />
Ich möchte nur eine Datei öffnen, lesen, schreiben und wieder schließen (theoretisch würden fopen/fread/fwrite/fclose reichen, kann ich aber nicht verwenden für eine NT-Anwendung).</p>
<p>Hier der reduzierte Code:</p>
<pre><code class="language-cpp">#define FILENAME _T(&quot;\\??\\c:\\datei&quot;)

HANDLE datei_h;
OBJECT_ATTRIBUTES datei_a;
UNICODE_STRING datei_n;
IO_STATUS_BLOCK datei_s;
NTSTATUS status;

RtlInitUnicodeString(&amp;datei_n, FILENAME);
InitializeObjectAttributes(
	&amp;datei_a,
	&amp;datei_n,
	OBJ_CASE_INSENSITIVE,
	NULL,
	NULL
	);
status = NtCreateFile(
	&amp;datei_h,
	GENERIC_READ | GENERIC_WRITE,
	&amp;datei_a,
	&amp;datei_s,
    NULL,
    FILE_ATTRIBUTE_NORMAL,
	0,
    FILE_OPEN,
    FILE_NON_DIRECTORY_FILE | FILE_RANDOM_ACCESS | FILE_SYNCHRONOUS_IO_NONALERT,
	NULL,
	0
	);
</code></pre>
<p>Das Problem ist nun folgendes:<br />
status hat danach immer den Wert 0xC000000D (STATUS_INVALID_PARAMETER), leider weiß ich nicht welcher Parameter falsch ist. Ich habe leider auch kein Beispielcode gefunden, sondern nur diese Dokumentation: <a href="http://www.osronline.com/DDKx/kmarch/k111_9dte.htm" rel="nofollow">http://www.osronline.com/DDKx/kmarch/k111_9dte.htm</a><br />
Kann mir jemand sagen wo mein Fehler liegt?</p>
<p>Viele Grüße,<br />
S_O</p>
]]></description><link>https://www.c-plusplus.net/forum/post/981221</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/981221</guid><dc:creator><![CDATA[S_O]]></dc:creator><pubDate>Mon, 30 Jan 2006 16:02:28 GMT</pubDate></item><item><title><![CDATA[Reply to NTAPI: NtCreateFile gibt STATUS_INVALID_PARAMETER zurück, warum? on Mon, 30 Jan 2006 16:42:05 GMT]]></title><description><![CDATA[<p>Warum verwendest Du nicht dokumentierte Funktionen des User-Modes? =&gt; CreateFile</p>
]]></description><link>https://www.c-plusplus.net/forum/post/981265</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/981265</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Mon, 30 Jan 2006 16:42:05 GMT</pubDate></item><item><title><![CDATA[Reply to NTAPI: NtCreateFile gibt STATUS_INVALID_PARAMETER zurück, warum? on Mon, 30 Jan 2006 16:58:09 GMT]]></title><description><![CDATA[<blockquote>
<p>Warum verwendest Du nicht dokumentierte Funktionen des User-Modes? =&gt; CreateFile</p>
</blockquote>
<p>Das ist ein natives NT-Programm, kein win32-Programm, soweit ich weiß kann man da nichts anderes benutzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/981285</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/981285</guid><dc:creator><![CDATA[S_O]]></dc:creator><pubDate>Mon, 30 Jan 2006 16:58:09 GMT</pubDate></item><item><title><![CDATA[Reply to NTAPI: NtCreateFile gibt STATUS_INVALID_PARAMETER zurück, warum? on Mon, 30 Jan 2006 17:08:06 GMT]]></title><description><![CDATA[<p>Was ist denn ein &quot;natives&quot; NT-Programm...<br />
Es gibt halt nun mal keine offizielle Doku zu der nativen-WinAPI, somit sind alle Programme die sowas verwenden murks... (meine pers. Meinung)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/981303</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/981303</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Mon, 30 Jan 2006 17:08:06 GMT</pubDate></item><item><title><![CDATA[Reply to NTAPI: NtCreateFile gibt STATUS_INVALID_PARAMETER zurück, warum? on Mon, 30 Jan 2006 17:23:00 GMT]]></title><description><![CDATA[<blockquote>
<p>Was ist denn ein &quot;natives&quot; NT-Programm...</p>
</blockquote>
<p>Eins das direkt auf NT aufsetzt, wie Gerätetreiber, und nicht auf win32.</p>
<blockquote>
<p>Es gibt halt nun mal keine offizielle Doku zu der nativen-WinAPI, somit sind alle Programme die sowas verwenden murks... (meine pers. Meinung)</p>
</blockquote>
<p>Native NT-Programme scheinen von MS wirklich schlecht bis gar nicht dokumentiert zu sein, aber Gerätetreiber schon.<br />
Das ist im Grunde ein Programm, das man so schreiben muss wie ein Gerätetreiber.<br />
Diese Funktion ist genau die, die man auch in einem Gerätetreiber verwenden müsste, wollte man mit einem Gerätetreiber direkt auf eine Datei zugreifen.</p>
<p>Die Frage ist natürlich, warum muss es einen natives NT-Programm sein und kein win32. Es soll (muss damit es richtig funktioniert) wärend das Bootvorgangs gestartet werden, zur gleichen Zeit wie scandisk (autochk), da geht win32 noch nicht.<br />
Als win32 läuft das Programm bereits perfekt, ich muss es jetzt &quot;nur&quot; noch auf native-NT portieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/981334</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/981334</guid><dc:creator><![CDATA[S_O]]></dc:creator><pubDate>Mon, 30 Jan 2006 17:23:00 GMT</pubDate></item><item><title><![CDATA[Reply to NTAPI: NtCreateFile gibt STATUS_INVALID_PARAMETER zurück, warum? on Mon, 30 Jan 2006 17:27:32 GMT]]></title><description><![CDATA[<p>hat zwar nichts mit deinem problem zu tun, aber vielleicht findste diese seite interessant: <a href="http://www.sysinternals.com/information/nativeapplications.html" rel="nofollow">http://www.sysinternals.com/information/nativeapplications.html</a><br />
und: <a href="http://www.sysinternals.com/information/nativeapi.html" rel="nofollow">http://www.sysinternals.com/information/nativeapi.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/981344</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/981344</guid><dc:creator><![CDATA[net 0]]></dc:creator><pubDate>Mon, 30 Jan 2006 17:27:32 GMT</pubDate></item><item><title><![CDATA[Reply to NTAPI: NtCreateFile gibt STATUS_INVALID_PARAMETER zurück, warum? on Mon, 30 Jan 2006 17:29:47 GMT]]></title><description><![CDATA[<p>S_O schrieb:</p>
<blockquote>
<p>Eins das direkt auf NT aufsetzt, wie Gerätetreiber, und nicht auf win32.</p>
</blockquote>
<p>Ich dachte wir reden von User-Mode Apps und nicht von Device-Treibern (da hätte er nämlich *nicht* NtCreateFile verwendet!)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/981352</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/981352</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Mon, 30 Jan 2006 17:29:47 GMT</pubDate></item><item><title><![CDATA[Reply to NTAPI: NtCreateFile gibt STATUS_INVALID_PARAMETER zurück, warum? on Mon, 30 Jan 2006 17:30:24 GMT]]></title><description><![CDATA[<blockquote>
<p>hat zwar nichts mit deinem problem zu tun, aber vielleicht findste diese seite interessant: <a href="http://www.sysinternals.com/information/nativeapplications.html" rel="nofollow">http://www.sysinternals.com/information/nativeapplications.html</a><br />
und: <a href="http://www.sysinternals.com/information/nativeapi.html" rel="nofollow">http://www.sysinternals.com/information/nativeapi.html</a></p>
</blockquote>
<p>Von genau diesen Seiten weiß ich wie man so ein Programm überhaupt macht <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 />
Viel mehr scheint es dazu leider auch nicht zu geben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/981353</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/981353</guid><dc:creator><![CDATA[S_O]]></dc:creator><pubDate>Mon, 30 Jan 2006 17:30:24 GMT</pubDate></item><item><title><![CDATA[Reply to NTAPI: NtCreateFile gibt STATUS_INVALID_PARAMETER zurück, warum? on Mon, 30 Jan 2006 17:40:44 GMT]]></title><description><![CDATA[<blockquote>
<p>Ich dachte wir reden von User-Mode Apps und nicht von Device-Treibern (da hätte er nämlich *nicht* NtCreateFile verwendet!)</p>
</blockquote>
<p>Ich mein genau so ein Programm, wie das in den Seiten die net gepostet hat beschrieben wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/981376</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/981376</guid><dc:creator><![CDATA[S_O]]></dc:creator><pubDate>Mon, 30 Jan 2006 17:40:44 GMT</pubDate></item><item><title><![CDATA[Reply to NTAPI: NtCreateFile gibt STATUS_INVALID_PARAMETER zurück, warum? on Mon, 30 Jan 2006 17:48:50 GMT]]></title><description><![CDATA[<p>Also ein Device/Filter-Treiber. Dann lädst Du Dir das DDK runter und da sind tausende Beispiele dabei:<br />
<a href="http://www.microsoft.com/whdc/driver/wdf/KMDF_pkg.mspx" rel="nofollow">http://www.microsoft.com/whdc/driver/wdf/KMDF_pkg.mspx</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/981389</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/981389</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Mon, 30 Jan 2006 17:48:50 GMT</pubDate></item><item><title><![CDATA[Reply to NTAPI: NtCreateFile gibt STATUS_INVALID_PARAMETER zurück, warum? on Mon, 30 Jan 2006 18:54:09 GMT]]></title><description><![CDATA[<blockquote>
<p>Also ein Device/Filter-Treiber. Dann lädst Du Dir das DDK runter und da sind tausende Beispiele dabei:<br />
<a href="http://www.microsoft.com/whdc/driver/wdf/KMDF_pkg.mspx" rel="nofollow">http://www.microsoft.com/whdc/driver/wdf/KMDF_pkg.mspx</a></p>
</blockquote>
<p>Das DDK hab ich natürlich installiert, ich brauch ja die header/libs daraus um mein Programm zu kompilireren. Ich habe jetzt auch die Beispiele nachinstalliert, ich habe jetzt alles nach *CreateFile* durchsucht, aber kein Beispiel scheint ZwCreateFile oder NtCreateFile zu verwenden, nur win32-Anwendungen die CreateFile verwenden hab ich gefunden.</p>
<p>Hat irgendjemand eine Idee, wo mein Fehler liegen könnte? Es handelt sich wie gesagt nicht um eine win32-Anwendung, sondern um so was ähnliches wie ein Gerätetreiber.</p>
<p>Ist der Dateiname den so richtig? Meinchmal liegt es ja an so einfachen Sachen. Sind die Laufwerksbuchstaben da überhaupt verfügbar oder muss man da vielleicht eine andere Schreibweise mit Device\Harddisk0\Partition1, \?\Volume{08a4ee15-86cd-11d4-a06e-806d6172696f}\ oder was auch immer verwenden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/981454</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/981454</guid><dc:creator><![CDATA[S_O]]></dc:creator><pubDate>Mon, 30 Jan 2006 18:54:09 GMT</pubDate></item><item><title><![CDATA[Reply to NTAPI: NtCreateFile gibt STATUS_INVALID_PARAMETER zurück, warum? on Mon, 30 Jan 2006 19:15:26 GMT]]></title><description><![CDATA[<p><a href="http://www.osronline.com/article.cfm?id=91" rel="nofollow">http://www.osronline.com/article.cfm?id=91</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/981463</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/981463</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Mon, 30 Jan 2006 19:15:26 GMT</pubDate></item><item><title><![CDATA[Reply to NTAPI: NtCreateFile gibt STATUS_INVALID_PARAMETER zurück, warum? on Mon, 30 Jan 2006 20:47:10 GMT]]></title><description><![CDATA[<p>Ich hab es jetzt mal NtOpenFile anstelle von NtCreateFile versucht, jetzt klappt es:</p>
<pre><code class="language-cpp">status = NtOpenFile(
	&amp;datei_h,
	GENERIC_READ | GENERIC_WRITE,
	&amp;datei_a,
	&amp;datei_s,
	0,
	FILE_NON_DIRECTORY_FILE | FILE_RANDOM_ACCESS
	);
</code></pre>
<p>Vielen Dank!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/981537</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/981537</guid><dc:creator><![CDATA[S_O]]></dc:creator><pubDate>Mon, 30 Jan 2006 20:47:10 GMT</pubDate></item></channel></rss>