* Nasm support
* Hal, rosrtl, pseh, string modules
* Build ntoskrnl
Modified: branches/xmlbuildsystem/reactos/ReactOS.xml
Added: branches/xmlbuildsystem/reactos/hal/directory.xml
Added: branches/xmlbuildsystem/reactos/hal/hal/hal.xml
Modified: branches/xmlbuildsystem/reactos/lib/directory.xml
Added: branches/xmlbuildsystem/reactos/lib/kjs/kjs.xml
Deleted: branches/xmlbuildsystem/reactos/lib/kjs/module.xml
Added: branches/xmlbuildsystem/reactos/lib/pseh/pseh.xml
Added: branches/xmlbuildsystem/reactos/lib/rosrtl/rosrtl.xml
Added: branches/xmlbuildsystem/reactos/lib/rtl/rtl.xml
Added: branches/xmlbuildsystem/reactos/lib/string/string.xml
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ntoskrnl.xml
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h

Modified: branches/xmlbuildsystem/reactos/ReactOS.xml
--- branches/xmlbuildsystem/reactos/ReactOS.xml	2005-01-09 19:40:08 UTC (rev 12912)
+++ branches/xmlbuildsystem/reactos/ReactOS.xml	2005-01-09 21:26:16 UTC (rev 12913)
@@ -12,6 +12,9 @@
 	<directory name="tools">
 		<xi:include href="tools/tools.xml" />
 	</directory>
+	<directory name="hal">
+		<xi:include href="hal/directory.xml" />
+	</directory>
 	<directory name="iface">
 		<directory name="native">
 			<xi:include href="iface/native/module.xml" />

Added: branches/xmlbuildsystem/reactos/hal/directory.xml
--- branches/xmlbuildsystem/reactos/hal/directory.xml	2005-01-09 19:40:08 UTC (rev 12912)
+++ branches/xmlbuildsystem/reactos/hal/directory.xml	2005-01-09 21:26:16 UTC (rev 12913)
@@ -0,0 +1,3 @@
+<directory name="hal">
+	<xi:include href="hal/hal.xml" />
+</directory>

Added: branches/xmlbuildsystem/reactos/hal/hal/hal.xml
--- branches/xmlbuildsystem/reactos/hal/hal/hal.xml	2005-01-09 19:40:08 UTC (rev 12912)
+++ branches/xmlbuildsystem/reactos/hal/hal/hal.xml	2005-01-09 21:26:16 UTC (rev 12913)
@@ -0,0 +1,3 @@
+<module name="hal" type="kernelmodedll">
+	<importlibrary basename="hal" definition="hal.def" />
+</module>

Modified: branches/xmlbuildsystem/reactos/lib/directory.xml
--- branches/xmlbuildsystem/reactos/lib/directory.xml	2005-01-09 19:40:08 UTC (rev 12912)
+++ branches/xmlbuildsystem/reactos/lib/directory.xml	2005-01-09 21:26:16 UTC (rev 12913)
@@ -1,3 +1,15 @@
 <directory name="kjs">
-	<xi:include href="kjs/module.xml" />
+	<xi:include href="kjs/kjs.xml" />
 </directory>
+<directory name="pseh">
+	<xi:include href="pseh/pseh.xml" />
+</directory>
+<directory name="rosrtl">
+	<xi:include href="rosrtl/rosrtl.xml" />
+</directory>
+<directory name="rtl">
+	<xi:include href="rtl/rtl.xml" />
+</directory>
+<directory name="string">
+	<xi:include href="string/string.xml" />
+</directory>

Copied: branches/xmlbuildsystem/reactos/lib/kjs/kjs.xml (from rev 12911, branches/xmlbuildsystem/reactos/lib/kjs/module.xml)

Deleted: branches/xmlbuildsystem/reactos/lib/kjs/module.xml
--- branches/xmlbuildsystem/reactos/lib/kjs/module.xml	2005-01-09 19:40:08 UTC (rev 12912)
+++ branches/xmlbuildsystem/reactos/lib/kjs/module.xml	2005-01-09 21:26:16 UTC (rev 12913)
@@ -1,41 +0,0 @@
-<module name="kjs" type="staticlibrary">
-	<include base="kjs">.</include>
-	<include base="kjs">src</include>
-	<include base="kjs">include</include>
-	<directory name="ksrc">
-		<file>setjmp.S</file>
-		<file>longjmp.S</file>
-		<file>alloc.c</file>
-		<file>bc.c</file>
-		<file>b_core.c</file>
-		<file>b_file.c</file>
-		<file>b_func.c</file>
-		<file>b_regexp.c</file>
-		<file>b_system.c</file>
-		<file>compat.c</file>
-		<file>debug.c</file>
-		<file>iostream.c</file>
-		<file>js.c</file>
-		<file>kjs.c</file>
-		<file>mrgsort.c</file>
-		<file>object.c</file>
-		<file>regex.c</file>
-		<file>vm.c</file>
-		<file>vmjumps.c</file>
-		<file>vmswitch.c</file>
-		<file>vmswt0.c</file>
-	</directory>
-	<directory name="src">
-		<file>b_array.c</file>
-		<file>b_bool.c</file>
-		<file>b_object.c</file>
-		<file>b_number.c</file>
-		<file>b_string.c</file>
-		<file>b_vm.c</file>
-		<file>compiler.c</file>
-		<file>crc32.c</file>
-		<file>dl_dummy.c</file>
-		<file>heap.c</file>
-		<file>utils.c</file>
-	</directory>
-</module>

Added: branches/xmlbuildsystem/reactos/lib/pseh/pseh.xml
--- branches/xmlbuildsystem/reactos/lib/pseh/pseh.xml	2005-01-09 19:40:08 UTC (rev 12912)
+++ branches/xmlbuildsystem/reactos/lib/pseh/pseh.xml	2005-01-09 21:26:16 UTC (rev 12913)
@@ -0,0 +1,8 @@
+<module name="pseh" type="staticlibrary">
+	<define name="__USE_W32API" />
+	<directory name="i386">
+		<file>framebased.asm</file>
+		<file>setjmp.asm</file>
+	</directory>
+	<file>framebased.c</file>
+</module>

Added: branches/xmlbuildsystem/reactos/lib/rosrtl/rosrtl.xml
--- branches/xmlbuildsystem/reactos/lib/rosrtl/rosrtl.xml	2005-01-09 19:40:08 UTC (rev 12912)
+++ branches/xmlbuildsystem/reactos/lib/rosrtl/rosrtl.xml	2005-01-09 21:26:16 UTC (rev 12913)
@@ -0,0 +1,33 @@
+<module name="rosrtl" type="staticlibrary">
+	<define name="__USE_W32API" />
+	<directory name="file">
+		<file>sparse.c</file>
+	</directory>
+	<directory name="misc">
+		<file>devmode.c</file>
+		<file>intrlck.c</file>
+		<file>logfont.c</file>
+		<file>qsort.c</file>
+ 	</directory>
+	<directory name="recmutex">
+		<file>recmutex.c</file>
+	</directory>
+	<directory name="registry">
+		<file>registry.c</file>
+ 	</directory>
+	<directory name="string">
+		<file>append.c</file>
+		<file>resstr.c</file>
+	</directory>
+	<directory name="thread">
+		<directory name="i386">
+			<file>context.c</file>
+			<file>stackexit.S</file>
+		</directory>
+		<file>create.c</file>
+		<file>exit.c</file>
+		<file>linearstack.c</file>
+		<file>priv.c</file>
+		<file>stack.c</file>
+	</directory>
+</module>

Added: branches/xmlbuildsystem/reactos/lib/rtl/rtl.xml
--- branches/xmlbuildsystem/reactos/lib/rtl/rtl.xml	2005-01-09 19:40:08 UTC (rev 12912)
+++ branches/xmlbuildsystem/reactos/lib/rtl/rtl.xml	2005-01-09 21:26:16 UTC (rev 12913)
@@ -0,0 +1,34 @@
+<module name="rtl" type="staticlibrary">
+	<directory name="i386">
+		<file>except.s</file>
+		<file>exception.c</file>
+	</directory>
+	<file>acl.c</file>
+	<file>bit.c</file>
+	<file>bitmap.c</file>
+	<file>bootdata.c</file>
+	<file>compress.c</file>
+	<file>dos8dot3.c</file>
+	<file>encode.c</file>
+	<file>env.c</file>
+	<file>error.c</file>
+	<file>exception.c</file>
+	<file>generictable.c</file>
+	<file>heap.c</file>
+	<file>image.c</file>
+	<file>largeint.c</file>
+	<file>luid.c</file>
+	<file>mem.c</file>
+	<file>network.c</file>
+	<file>nls.c</file>
+	<file>random.c</file>
+	<file>sd.c</file>
+	<file>security.c</file>
+	<file>sid.c</file>
+	<file>splaytree.c</file>
+	<file>time.c</file>
+	<file>timezone.c</file>
+	<file>unicode.c</file>
+	<file>unicodeprefix.c</file>
+	<file>version.c</file>
+</module>

Added: branches/xmlbuildsystem/reactos/lib/string/string.xml
--- branches/xmlbuildsystem/reactos/lib/string/string.xml	2005-01-09 19:40:08 UTC (rev 12912)
+++ branches/xmlbuildsystem/reactos/lib/string/string.xml	2005-01-09 21:26:16 UTC (rev 12913)
@@ -0,0 +1,30 @@
+<module name="string" type="staticlibrary">
+	<file>memccpy.c</file>
+	<file>memchr.c</file>
+	<file>memcmp.c</file>
+	<file>memcpy.c</file>
+	<file>memmove.c</file>
+	<file>memset.c</file>
+	<file>strcat.c</file>
+	<file>strchr.c</file>
+	<file>strcmp.c</file>
+	<file>strcpy.c</file>
+	<file>strcspn.c</file>
+	<file>strlen.c</file>
+	<file>strncat.c</file>
+	<file>strncmp.c</file>
+	<file>strncpy.c</file>
+	<file>strnlen.c</file>
+	<file>strrchr.c</file>
+	<file>strspn.c</file>
+	<file>wcscat.c</file>
+	<file>wcschr.c</file>
+	<file>wcscmp.c</file>
+	<file>wcscpy.c</file>
+	<file>wcslen.c</file>
+	<file>wcsncat.c</file>
+	<file>wcsncmp.c</file>
+	<file>wcsncpy.c</file>
+	<file>wcsnlen.c</file>
+	<file>wcsrchr.c</file>
+</module>

Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ntoskrnl.xml
--- branches/xmlbuildsystem/reactos/ntoskrnl/ntoskrnl.xml	2005-01-09 19:40:08 UTC (rev 12912)
+++ branches/xmlbuildsystem/reactos/ntoskrnl/ntoskrnl.xml	2005-01-09 21:26:16 UTC (rev 12913)
@@ -1,4 +1,4 @@
-<module name="ntoskrnl" type="kernelmodedll" extension=".exe">
+<module name="ntoskrnl" type="kernel">
 	<dependency>buildno</dependency>
 	<dependency>genntdll</dependency>
 	<dependency>wmc</dependency>
@@ -9,7 +9,12 @@
 	<define name="__ELF_WORD_SIZE">32</define>
 	<include base="kjs">include</include>
 	<include base="ntoskrnl">include</include>
+	<library>hal</library>
 	<library>kjs</library>
+	<library>pseh</library>
+	<library>rosrtl</library>
+	<library>rtl</library>
+	<library>string</library>
 	<invoke module="wmc">
 		<input>
 			<inputfile>ntoskrnl.mc</inputfile>
@@ -83,13 +88,11 @@
 		<file>user.c</file>
 	</directory>
 	<directory name="ex">
-		<!--
 		<if property="arch" value="i386">
 			<directory name="i386">
 				<file>interlck.c</file>
 			</directory>
 		</if>
-		-->
 		<file>btree.c</file>
 		<file>callback.c</file>
 		<file>fmutex.c</file>
@@ -315,6 +318,7 @@
 		<file>plugplay.c</file>
 		<file>profile.c</file>
 		<file>vdm.c</file>
+		<file>zw.c</file>
 	</directory>
 	<directory name="ob">
 		<file>dirobj.c</file>

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-01-09 19:40:08 UTC (rev 12912)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-01-09 21:26:16 UTC (rev 12913)
@@ -65,7 +65,7 @@
 	fprintf ( fMakefile, "host_gcc = gcc\n" );
 	fprintf ( fMakefile, "host_ar = ar\n" );
 	fprintf ( fMakefile, "host_ld = ld\n" );
-	fprintf ( fMakefile, "rm = del /y\n" );
+	fprintf ( fMakefile, "rm = del /f /q\n" );
 	fprintf ( fMakefile, "gcc = gcc\n" );
 	fprintf ( fMakefile, "ld = ld\n" );
 	fprintf ( fMakefile, "ar = ar\n" );
@@ -82,7 +82,7 @@
 		Module& module = *ProjectNode.modules[i];
 		fprintf ( fMakefile,
 		          " %s",
-		          FixupTargetFilename(module.GetPath ()).c_str () );
+		          FixupTargetFilename( module.GetPath () ).c_str () );
 	}
 	fprintf ( fMakefile, "\n\t\n\n" );
 }

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-01-09 19:40:08 UTC (rev 12912)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-01-09 21:26:16 UTC (rev 12913)
@@ -100,7 +100,7 @@
 			dependencies += " ";
 		const Module* importedModule = module.project.LocateModule ( module.libraries[i]->name );
 		assert ( importedModule != NULL );
-		dependencies += FixupTargetFilename ( importedModule->GetPath () ).c_str ();
+		dependencies += FixupTargetFilename ( importedModule->GetDependencyPath () ).c_str ();
 	}
 	return dependencies;
 }
@@ -261,11 +261,17 @@
 MingwModuleHandler::GenerateGccParameters ( const Module& module ) const
 {
 	string parameters = GenerateGccDefineParameters ( module );
-	parameters += ssprintf(" $(%s_INCLUDES)",module.name.c_str());
+	parameters += ssprintf(" $(%s_INCLUDES)", module.name.c_str());
 	return parameters;
 }
 
 string
+MingwModuleHandler::GenerateNasmParameters ( const Module& module ) const
+{
+	return "";
+}
+
+string
 MingwModuleHandler::GenerateGccCommand ( const Module& module,
 	                                     const string& sourceFilename,
 	                                     const string& cc ) const
@@ -292,6 +298,18 @@
 }
 
 string
+MingwModuleHandler::GenerateNasmCommand ( const Module& module,
+	                                      const string& sourceFilename ) const
+{
+	string objectFilename = GetObjectFilename ( sourceFilename );
+	return ssprintf ( "%s -f win32 %s -o %s %s\n",
+		              "nasm",
+		              sourceFilename.c_str (),
+		              objectFilename.c_str (),
+		              GenerateNasmParameters ( module ).c_str () );
+}
+
+string
 MingwModuleHandler::GenerateCommand ( const Module& module,
 	                                  const string& sourceFilename,
 	                                  const string& cc ) const
@@ -305,6 +323,9 @@
 		return GenerateGccAssemblerCommand ( module,
 		                                     sourceFilename,
 		                                     cc );
+	else if ( extension == ".asm" || extension == ".ASM" )
+		return GenerateNasmCommand ( module,
+		                             sourceFilename );
 
 	throw InvalidOperationException ( __FILE__,
 	                                  __LINE__,
@@ -506,6 +527,7 @@
 	          preconditionDependenciesName.c_str () );
 }
 
+
 static MingwBuildToolModuleHandler buildtool_handler;
 
 MingwBuildToolModuleHandler::MingwBuildToolModuleHandler()
@@ -540,7 +562,7 @@
 static MingwKernelModuleHandler kernelmodule_handler;
 
 MingwKernelModuleHandler::MingwKernelModuleHandler ()
-	: MingwModuleHandler ( KernelModeDLL )
+	: MingwModuleHandler ( Kernel )
 {
 }
 
@@ -564,13 +586,15 @@
 	string base_tmp = ros_junk + module.name + ".base.tmp";
 	string junk_tmp = ros_junk + module.name + ".junk.tmp";
 	string temp_exp = ros_junk + module.name + ".temp.exp";
+	string gccOptions = ssprintf ("-Wl,-T,%s" SSEP "ntoskrnl.lnk -Wl,--subsystem,native -Wl,--entry,_NtProcessStartup -Wl,--image-base,0xC0000000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll",
+	                              module.GetBasePath ().c_str () );
 	fprintf ( fMakefile, "%s: %s %s\n",
 	          target.c_str (),
 	          archiveFilename.c_str (),
 	          importLibraryDependencies.c_str () );
 	fprintf ( fMakefile,
-	          "\t${gcc} -Wl,--entry,_NtProcessStartup -Wl,-T,%s" SSEP "ntoskrnl.lnk -Wl,--subsystem,native -Wl,--image-base,0xC0000000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -Wl,--base-file,%s -nostartfiles -o %s %s %s\n",
-	          module.GetBasePath ().c_str (),
+	          "\t${gcc} %s -Wl,--base-file,%s -o %s %s %s\n",
+	          gccOptions.c_str (),
 	          base_tmp.c_str (),
 	          junk_tmp.c_str (),
 	          archiveFilename.c_str (),
@@ -587,7 +611,8 @@
 	          "\t${rm} %s\n",
 	          base_tmp.c_str () );
 	fprintf ( fMakefile,
-	          "\t${ld} -Wl,%s -o %s %s %s\n",
+	          "\t${gcc} %s -Wl,%s -o %s %s %s\n",
+	          gccOptions.c_str (),
 	          temp_exp.c_str (),
 	          target.c_str (),
 	          archiveFilename.c_str (),
@@ -600,6 +625,7 @@
 	GenerateObjectFileTargetsTarget ( module );
 }
 
+
 static MingwStaticLibraryModuleHandler staticlibrary_handler;
 
 MingwStaticLibraryModuleHandler::MingwStaticLibraryModuleHandler ()
@@ -621,3 +647,65 @@
 	GenerateArchiveTargetTarget ( module );
 	GenerateObjectFileTargetsTarget ( module );
 }
+
+
+static MingwKernelModeDLLModuleHandler kernelmodedll_handler;
+
+MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler ()
+	: MingwModuleHandler ( KernelModeDLL )
+{
+}
+
+void
+MingwKernelModeDLLModuleHandler::Process ( const Module& module )
+{
+	GeneratePreconditionDependencies ( module );
+	GenerateKernelModeDLLModuleTarget ( module );
+	GenerateInvocations ( module );
+}
+
+void
+MingwKernelModeDLLModuleHandler::GenerateKernelModeDLLModuleTarget ( const Module& module )
+{
+	static string ros_junk ( "$(ROS_TEMPORARY)" );
+	string target ( FixupTargetFilename ( module.GetPath () ) );
+	string workingDirectory = GetWorkingDirectory ( );
+	string archiveFilename = GetModuleArchiveFilename ( module );
+	string importLibraryDependencies = GetImportLibraryDependencies ( module );
+
+	if (module.importLibrary != NULL)
+	{
+		fprintf ( fMakefile, "%s:\n",
+		          module.GetDependencyPath ().c_str () );
+
+		fprintf ( fMakefile,
+		          "\t${dlltool} --dllname %s --def %s --output-lib %s --kill-at\n\n",
+		          module.GetTargetName ().c_str (),
+		          FixupTargetFilename ( module.GetBasePath () + SSEP + module.importLibrary->definition ).c_str (),
+		          FixupTargetFilename ( module.GetDependencyPath () ).c_str () );
+	}
+
+	if (module.files.size () > 0)
+	{
+		fprintf ( fMakefile, "%s: %s %s\n",
+		          target.c_str (),
+		          archiveFilename.c_str (),
+		          importLibraryDependencies.c_str () );
+	
+		fprintf ( fMakefile,
+		          "\t${gcc} -Wl,--subsystem,native -Wl,--entry,_DriverEntry@8 -Wl,--image-base,0x10000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll -o %s %s %s\n",
+		          target.c_str (),
+		          archiveFilename.c_str (),
+		          importLibraryDependencies.c_str () );
+		
+		GenerateArchiveTargetTarget ( module );
+		GenerateObjectFileTargetsTarget ( module );
+	}
+	else
+	{
+		fprintf ( fMakefile, "%s:\n\n",
+		          target.c_str ());
+		fprintf ( fMakefile, ".PHONY: %s\n\n",
+		          target.c_str ());
+	}
+}

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-01-09 19:40:08 UTC (rev 12912)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-01-09 21:26:16 UTC (rev 12913)
@@ -48,12 +48,15 @@
 	void GenerateGccModuleIncludeVariable ( const Module& module ) const;
 	std::string GenerateGccIncludeParameters ( const Module& module ) const;
 	std::string GenerateGccParameters ( const Module& module ) const;
+	std::string GenerateNasmParameters ( const Module& module ) const;
 	std::string GenerateGccCommand ( const Module& module,
 	                                 const std::string& sourceFilename,
 	                                 const std::string& cc ) const;
 	std::string GenerateGccAssemblerCommand ( const Module& module,
 	                                          const std::string& sourceFilename,
 	                                          const std::string& cc ) const;
+	std::string GenerateNasmCommand ( const Module& module,
+	                                  const std::string& sourceFilename ) const;
 	std::string GenerateCommand ( const Module& module,
 	                              const std::string& sourceFilename,
 	                              const std::string& cc ) const;
@@ -94,4 +97,14 @@
 	void GenerateStaticLibraryModuleTarget ( const Module& module );
 };
 
+
+class MingwKernelModeDLLModuleHandler : public MingwModuleHandler
+{
+public:
+	MingwKernelModeDLLModuleHandler ();
+	virtual void Process ( const Module& module );
+private:
+	void GenerateKernelModeDLLModuleTarget ( const Module& module );
+};
+
 #endif /* MINGW_MODULEHANDLER_H */

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-01-09 19:40:08 UTC (rev 12912)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-01-09 21:26:16 UTC (rev 12913)
@@ -24,8 +24,9 @@
 Module::Module ( const Project& project,
                  const XMLElement& moduleNode,
                  const string& modulePath )
-	: project(project),
-	  node(moduleNode)
+	: project (project),
+	  node (moduleNode),
+	  importLibrary (NULL)
 {
 	if ( node.name != "module" )
 		throw Exception ( "internal tool error: Module created with non-<module> node" );
@@ -126,6 +127,11 @@
 		dependencies.push_back ( new Dependency ( e, *this ) );
 		subs_invalid = true;
 	}
+	else if ( e.name == "importlibrary" )
+	{
+		importLibrary = new ImportLibrary ( e, *this );
+		subs_invalid = true;
+	}
 	if ( subs_invalid && e.subElements.size() > 0 )
 		throw InvalidBuildFileException (
 			e.location,
@@ -142,6 +148,8 @@
 		return BuildTool;
 	if ( attribute.value == "staticlibrary" )
 		return StaticLibrary;
+	if ( attribute.value == "kernel" )
+		return Kernel;
 	if ( attribute.value == "kernelmodedll" )
 		return KernelModeDLL;
 	throw InvalidAttributeValueException ( location,
@@ -158,6 +166,8 @@
 			return EXEPOSTFIX;
 		case StaticLibrary:
 			return ".a";
+		case Kernel:
+			return ".exe";
 		case KernelModeDLL:
 			return ".dll";
 	}
@@ -166,18 +176,43 @@
 }
 
 string
-Module::GetBasePath() const
+Module::GetTargetName () const
 {
+	return name + extension;
+}
+
+string
+Module::GetDependencyPath () const
+{
+	if ( type == KernelModeDLL )
+		return ssprintf ( "dk%snkm%slib%slib%s.a",
+		                  SSEP,
+		                  SSEP,
+		                  SSEP,
+		                  name.c_str () );
+	else
+		return GetPath ();
+}
+
+string
+Module::GetBasePath () const
+{
 	return path;
 }
 
 string
 Module::GetPath () const
 {
-	return path + CSEP + name + extension;
+	return path + CSEP + GetTargetName ();
 }
 
 string
+Module::GetPathWithPrefix ( const string& prefix ) const
+{
+	return path + CSEP + prefix + GetTargetName ();
+}
+
+string
 Module::GetTargets () const
 {
 	if ( invocations.size () > 0 )
@@ -371,3 +406,20 @@
 		                                  module.name.c_str(),
 		                                  node.value.c_str() );
 }
+
+
+ImportLibrary::ImportLibrary ( const XMLElement& _node,
+                               const Module& _module )
+	: node (_node),
+	  module (_module)
+{
+	const XMLAttribute* att = _node.GetAttribute ( "basename", false );
+	if (att != NULL)
+		basename = att->value;
+	else
+		basename = module.name;
+
+	att = _node.GetAttribute ( "definition", true );
+	assert (att);
+	definition = att->value;
+}

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-01-09 19:40:08 UTC (rev 12912)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-01-09 21:26:16 UTC (rev 12913)
@@ -30,6 +30,7 @@
 class Invoke;
 class InvokeFile;
 class Dependency;
+class ImportLibrary;
 
 class Project
 {
@@ -63,6 +64,7 @@
 {
 	BuildTool,
 	StaticLibrary,
+	Kernel,
 	KernelModeDLL
 };
 
@@ -76,6 +78,7 @@
 	std::string extension;
 	std::string path;
 	ModuleType type;
+	ImportLibrary* importLibrary;
 	std::vector<File*> files;
 	std::vector<Library*> libraries;
 	std::vector<Include*> includes;
@@ -89,8 +92,11 @@
 	~Module ();
 	ModuleType GetModuleType ( const std::string& location,
 	                           const XMLAttribute& attribute );
+	std::string GetTargetName () const;
+	std::string GetDependencyPath () const;
 	std::string GetBasePath() const;
 	std::string GetPath () const;
+	std::string GetPathWithPrefix ( const std::string& prefix ) const;
 	std::string GetTargets () const;
 	std::string GetInvocationTarget ( const int index ) const;
 	void ProcessXML();
@@ -217,6 +223,21 @@
 	void ProcessXML();
 };
 
+
+class ImportLibrary
+{
+public:
+	const XMLElement& node;
+	const Module& module;
+	std::string basename;
+	std::string definition;
+
+	ImportLibrary ( const XMLElement& _node,
+	                const Module& module );
+
+	void ProcessXML ();
+};
+
 extern std::string
 FixSeparator ( const std::string& s );