NtCreateFile() について

NtCreateFile() の使い方についてよくまとめられたページを見つけました。

http://www.osr.com/ntinsider/1996/native.htm

'---- 一部を抜粋 ----
Using the NT API for file I/O

(C) 1997 OSR Open Systems Resources, Inc.

Did you know there’s a complete set of system services that are supported by Windows NT but are not documented? Come with us while we describe the Native Windows NT API, and even demonstrate how you can use it in your own programs.

'--中略--

Building Native NT Programs

While all this new-found knowledge might be interesting, it would all be totally academic if you couldn’t actually USE it. So how do you actually build a native NT program? Well, the list below shows how we do it at OSR:

・You’ll need to define the function prototypes. Each of the NT API functions needs to be defined as shown above.
・When you compile, you’ll need to include ntddk.h, or else redefine the many types and structures that are found only there and are required for these functions. For example, the structure OBJECT_ATTRIBUTES appears to be defined in ntddk.h and nowhere else.
・You’ll need to link against ntdll.lib, which resolves your function references to calls into ntdll.dll.
・Want to free yourself completely of subsystem control? When you link your program, define the subsystem under which it runs to be "native" (using the /Subsystem:native linker option).

And that’s all there is to it! If you’d like to grab a very simple sample application that writes "hello world" to a file using the native NT API, you can download it from our web site (native.zip).

'--後略--