Re: Win32 API and Kernel

From: Don Burn (burn_at_stopspam.acm.org)
Date: 02/23/04


Date: Mon, 23 Feb 2004 08:45:22 -0500

The Win32 API is the published programming interface for support user space
programming. Do you want the actual calls into the kernel from user space?
For instance the Win32 API:

BOOL ReadFile(HANDLE hFile,LPVOID lpBuffer,
                           DWORD nNumberOfBytesToRead,
                           LPDWORD lpNumberOfBytesRead,
                           LPOVERLAPPED lpOverlapped);

becomes the following native API:

NTSTATUS NtReadFile(IN HANDLE FileHandle,
                                        IN HANDLE Event OPTIONAL,
                                        IN PIO_APC_ROUTINE ApcRoutine
OPTIONAL,
                                        IN PVOID ApcContext OPTIONAL,
                                        OUT PIO_STATUS_BLOCK IoStatusBlock,
                                        OUT PVOID Buffer,
                                        IN ULONG Length,
                                        IN PLARGE_INTEGER ByteOffset
OPTIONAL,
                                        IN PULONG Key OPTIONAL);

There is no news list for native API's, there is a book "Windows NT/2000
Native API Reference" by Gary Nebbett, and questions can sometimes be
answered at microsoft.public.development.device.drivers.

Now inside the kernel, there is a set of Kernel Support Routines (KSR's)
that allow programming of device drivers, so match the Ntxxx routines that
perform the transition, and others are totally different such as:

PVOID ExAllocatePoolWithTag(IN POOL_TYPE PoolType,
                                                   IN SIZE_T NumberOfBytes,
                                                   IN ULONG Tag);

The above is the kernel memory allocation routine. This is driver
programming, since even a piece of code without a device is a driver in the
kernel. The new list for these is again:
microsoft.public.development.device.drivers

-- 
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply
"Bill Cunningham" <nospam@nspam.net> wrote in message
news:ekxFZ1e%23DHA.2664@TK2MSFTNGP09.phx.gbl...
> I see by the meaning "Application" programming interface, the API is used
to
> design applications at user layer.
>     However since this group is about kernel programming, where do you get
> the means to do it? The API calls in turn call on the kernel's system
calls
> when needed I understand. Is there a Kernel Programming Interface?
>
>     Bill
>
>


Relevant Pages