[ros-kernel] Differences between ntdll and ntoskrnl Rtl functions

Gunnar Dalsnes hardon at online.no
Sun Jun 6 16:36:18 CEST 2004



> -----Original Message-----
> From: ros-kernel-bounces at reactos.com 
> [mailto:ros-kernel-bounces at reactos.com] On Behalf Of Eric Kohl
> Sent: Tuesday, June 01, 2004 11:38 AM
> To: ReactOS Kernel List
> Subject: Re: [ros-kernel] Differences between ntdll and 
> ntoskrnl Rtl functions
> 
> 
> Another reason against shared code is the fact that a simple 
> 'make ntdll'
> won't build the shared code even if it has been modified. 
> This requires a
> 'make rtl' and 'make ntdll'. 

It's not necesary to make rtl a static library, but all rtl files should be
in lib/rtl as now. In ntdll/ntoskrnl we could just include whatever files we
want:

Ntdll makefile: 
RTL_OBJECTS = \
	../rtl/unicode.o
Ntoskrnl makefile:
OBJECTS_RTL = \
	../lib/rtl/unicode.o

Whoever is built first of ntdll/ntoskrnl will compile unicode.c and the
object/depends files goes into the lib\rtl dir. One problem with this is
headers. Ntdll defines __NTDLL__ and ntoskrnl defines __NTOSKRNL__. I fixed
all rtl files to compile with ntoskrnl, but when if tried to compile using
ntdll some header stuff was missing. I included the missing headers but then
i got redefinition problems when building ntoskrnl. So headers needs to be
fixed before using this solution:-/ Yuck!

Another solution is to extend our build system so that it's possible to have
object/depend files go into a diectory different from the source file
directory. Then ntdll/ntoskrnl would have it's own private copy of the
object/depends files. In the source files one set of headers is included if
__NTDLL__ is defines and onother set if __NTOSKRNL__ is defines (dirty
workaround for our messy headers). Then we could also do this for memory
alloc (thou imo, wrappers in ntoskrnl/ntdll still makes cleaner code):

#ifdef __NTDLL__
    UNREFERENCED_PARAMETER(PoolType);	
    ptr = RtlAllocateHeap(GetProcessHeap(), 0, size);
#elif defined __NTOSKRNL__
    ptr = ExAllocatePool(PoolType, size);
#else
    error
#endif

What do you guys think?

-Gunnar







More information about the Ros-kernel mailing list