Native API - Function Groups

Function Groups

The Native API comprises many functions. They include C runtime functions that are needed for a very basic C runtime execution, such as strlen, sprintf and floor. Other common procedures like malloc, printf, scanf are missing. The vast majority of other Native API routines, by convention, have a 2 or 3 letter prefix, which is:

  • Nt or Zw are system calls declared in ntdll.dll and ntoskrnl.exe. When called from ntdll.dll in user mode, these groups are almost exactly the same; they trap into kernel mode and call the equivalent function in ntoskrnl.exe via a branch table. When calling the functions directly in ntoskrnl.exe (only possible in kernel mode), the Zw variants ensure kernel mode, whereas the Nt variants do not. The Zw prefix does not stand for anything.
  • Rtl is the second largest group of ntdll calls. These comprise the (extended) C Run-Time Library, which includes many utility functions that can be used by native applications, yet don't directly involve kernel support.
  • Csr are client-server functions that are used to communicate with the Win32 subsystem process, csrss.exe (csrss stands for client/server runtime sub-system).
  • Dbg are debugging aid functions such as a software break point.
  • Ki are upcalls from kernel-mode for things like APC dispatching.
  • Ldr are loader functions for PE file handling and starting of new processes.
  • Nls for Native Language Support (similar to code pages).
  • Pfx for prefix handling.

Gdi32.dll includes several other calls that trap into kernel-mode. These were not part of the original Windows NT design, as can be seen in Windows NT 3.5. However, due to performance issues of hardware of that age, it was decided to move the graphics subsystem into kernel mode. As such, system call in the range of 0x1000-0x1FFF are satisfied by win32k.sys (instead of ntoskrnl.exe as done for 0-0x0FFF), and are declared in gdi32.dll. These functions have the Gdi prefix.

There are also many more groups exported from ntoskrnl.exe and therefore are usable only in kernel mode. These may or may not be counted for Native API, depending on whom you ask (since the Native API is not fully officially documented, there is no one answer). Such groups include Cc (cache controller), Ex (Windows Executive), FsRtl (file system runtime), Io (I/O manager), Ke (core kernel routines), Ks (kernel streaming), Lpc (Local Procedure Call), Lsa (Local Security Authority), Mm (memory management), Ob (Object Manager), Ps (Process management), Se (security), Po (power management) and others.

Read more about this topic:  Native API

Famous quotes containing the words function and/or groups:

    To look backward for a while is to refresh the eye, to restore it, and to render it the more fit for its prime function of looking forward.
    Margaret Fairless Barber (1869–1901)

    Writers and politicians are natural rivals. Both groups try to make the world in their own images; they fight for the same territory.
    Salman Rushdie (b. 1947)