* Build networking components
* WINE DLL support
Added: branches/xmlbuildsystem/reactos/drivers/net/dd/directory.xml
Added: branches/xmlbuildsystem/reactos/drivers/net/dd/ne2000/ne2000.xml
Added: branches/xmlbuildsystem/reactos/drivers/net/dd/pcnet/pcnet.xml
Modified: branches/xmlbuildsystem/reactos/drivers/net/directory.xml
Added: branches/xmlbuildsystem/reactos/drivers/net/ndis/ndis.xml
Added: branches/xmlbuildsystem/reactos/drivers/net/npf/npf.xml
Added: branches/xmlbuildsystem/reactos/drivers/net/tcpip/tcpip.xml
Added: branches/xmlbuildsystem/reactos/drivers/net/tdi/tdi.xml
Added: branches/xmlbuildsystem/reactos/drivers/net/wshtcpip/wshtcpip.xml
Added: branches/xmlbuildsystem/reactos/lib/adns/adns.xml
Modified: branches/xmlbuildsystem/reactos/lib/directory.xml
Added: branches/xmlbuildsystem/reactos/lib/dnsapi/dnsapi.xml
Added: branches/xmlbuildsystem/reactos/lib/iphlpapi/iphlpapi.xml
Modified: branches/xmlbuildsystem/reactos/lib/msvcrt/msvcrt.xml
Modified: branches/xmlbuildsystem/reactos/lib/msvcrt/stdlib/wcstomb.c
Added: branches/xmlbuildsystem/reactos/lib/ws2_32/ws2_32.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/rbuild.h
Modified: branches/xmlbuildsystem/reactos/tools/tools.xml
Added: branches/xmlbuildsystem/reactos/tools/winebuild/winebuild.xml

Added: branches/xmlbuildsystem/reactos/drivers/net/dd/directory.xml
--- branches/xmlbuildsystem/reactos/drivers/net/dd/directory.xml	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/drivers/net/dd/directory.xml	2005-01-16 22:26:26 UTC (rev 13086)
@@ -0,0 +1,6 @@
+<directory name="ne2000">
+	<xi:include href="ne2000/ne2000.xml" />
+</directory>
+<directory name="pcnet">
+	<xi:include href="pcnet/pcnet.xml" />
+</directory>

Added: branches/xmlbuildsystem/reactos/drivers/net/dd/ne2000/ne2000.xml
--- branches/xmlbuildsystem/reactos/drivers/net/dd/ne2000/ne2000.xml	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/drivers/net/dd/ne2000/ne2000.xml	2005-01-16 22:26:26 UTC (rev 13086)
@@ -0,0 +1,11 @@
+<module name="ne2000" type="kernelmodedriver">
+	<include base="ne2000">include</include>
+	<library>ndis</library>
+	<library>ntoskrnl</library>
+	<library>hal</library>
+	<directory name="ne2000">
+		<file>8390.c</file>
+		<file>main.c</file>
+	</directory>
+	<file>ne2000.rc</file>
+</module>

Added: branches/xmlbuildsystem/reactos/drivers/net/dd/pcnet/pcnet.xml
--- branches/xmlbuildsystem/reactos/drivers/net/dd/pcnet/pcnet.xml	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/drivers/net/dd/pcnet/pcnet.xml	2005-01-16 22:26:26 UTC (rev 13086)
@@ -0,0 +1,11 @@
+<module name="pcnet" type="kernelmodedriver">
+	<include base="pcnet">.</include>
+	<define name="NDIS50_MINIPORT" />
+	<define name="__USE_W32API" />
+	<library>ndis</library>
+	<library>ntoskrnl</library>
+	<library>hal</library>
+	<file>pcnet.c</file>
+	<file>requests.c</file>
+	<file>pcnet.rc</file>
+</module>

Modified: branches/xmlbuildsystem/reactos/drivers/net/directory.xml
--- branches/xmlbuildsystem/reactos/drivers/net/directory.xml	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/drivers/net/directory.xml	2005-01-16 22:26:26 UTC (rev 13086)
@@ -1,3 +1,21 @@
 <directory name="afd">
 	<xi:include href="afd/afd.xml" />
 </directory>
+<directory name="dd">
+	<xi:include href="dd/directory.xml" />
+</directory>
+<directory name="ndis">
+	<xi:include href="ndis/ndis.xml" />
+</directory>
+<directory name="npf">
+	<xi:include href="npf/npf.xml" />
+</directory>
+<directory name="tcpip">
+	<xi:include href="tcpip/tcpip.xml" />
+</directory>
+<directory name="tdi">
+	<xi:include href="tdi/tdi.xml" />
+</directory>
+<directory name="wshtcpip">
+	<xi:include href="wshtcpip/wshtcpip.xml" />
+</directory>

Added: branches/xmlbuildsystem/reactos/drivers/net/ndis/ndis.xml
--- branches/xmlbuildsystem/reactos/drivers/net/ndis/ndis.xml	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/drivers/net/ndis/ndis.xml	2005-01-16 22:26:26 UTC (rev 13086)
@@ -0,0 +1,32 @@
+<module name="ndis" type="kernelmodedriver">
+	<importlibrary definition="ndis.def"></importlibrary>
+	<include base="ndis">include</include>
+	<define name="NDIS_WRAPPER" />
+	<define name="NDIS50" />
+	<define name="NDIS50_MINIPORT" />
+	<define name="BINARY_COMPATIBLE" />
+	<define name="__USE_W32API" />
+	<library>ntoskrnl</library>
+	<library>hal</library>
+	<directory name="ndis">
+		<file>40gone.c</file>
+		<file>50gone.c</file>
+		<file>buffer.c</file>
+		<file>cl.c</file>
+		<file>cm.c</file>
+		<file>co.c</file>
+		<file>config.c</file>
+		<file>control.c</file>
+		<file>efilter.c</file>
+		<file>hardware.c</file>
+		<file>io.c</file>
+		<file>main.c</file>
+		<file>memory.c</file>
+		<file>miniport.c</file>
+		<file>protocol.c</file>
+		<file>string.c</file>
+		<file>stubs.c</file>
+		<file>time.c</file>
+	</directory>
+	<file>ndis.rc</file>
+</module>

Added: branches/xmlbuildsystem/reactos/drivers/net/npf/npf.xml
--- branches/xmlbuildsystem/reactos/drivers/net/npf/npf.xml	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/drivers/net/npf/npf.xml	2005-01-16 22:26:26 UTC (rev 13086)
@@ -0,0 +1,28 @@
+<module name="npf" type="kernelmodedriver">
+	<include base="npf">include</include>
+	<include base="ntoskrnl">include</include>
+	<define name="WIN_NT_DRIVER" />
+	<define name="KQPC_TS" />
+	<define name="USE_KLOCKS" />
+	<define name="BINARY_COMPATIBLE" />
+	<library>ndis</library>
+	<library>ntoskrnl</library>
+	<library>hal</library>
+	<file>bucket_lookup.c</file>
+	<file>count_packets.c</file>
+	<file>dump.c</file>
+	<file>functions.c</file>
+	<file>jitter.c</file>
+	<file>memory_t.c</file>
+	<file>normal_lookup.c</file>
+	<file>openclos.c</file>
+	<file>packet.c</file>
+	<file>read.c</file>
+	<file>tcp_session.c</file>
+	<file>time_calls.c</file>
+	<file>tme.c</file>
+	<file>win_bpf_filter.c</file>
+	<file>win_bpf_filter_init.c</file>
+	<file>write.c</file>
+	<file>npf.rc</file>
+</module>

Added: branches/xmlbuildsystem/reactos/drivers/net/tcpip/tcpip.xml
--- branches/xmlbuildsystem/reactos/drivers/net/tcpip/tcpip.xml	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/drivers/net/tcpip/tcpip.xml	2005-01-16 22:26:26 UTC (rev 13086)
@@ -0,0 +1,40 @@
+<module name="tcpip" type="kernelmodedriver">
+	<importlibrary definition="tcpip.def"></importlibrary>
+	<include base="tcpip">include</include>
+	<include base="oskittcp">include</include>
+	<define name="_SEH_NO_NATIVE_NLG" />
+	<define name="NDIS40" />
+	<define name="__USE_W32API" />
+	<library>ip</library>
+	<library>oskittcp</library>
+	<library>ndis</library>
+	<library>rosrtl</library>
+	<library>pseh</library>
+	<library>ntoskrnl</library>
+	<library>hal</library>
+	<directory name="datalink">
+		<file>lan.c</file>
+	</directory>
+	<directory name="tcpip">
+		<file>buffer.c</file>
+		<file>bug.c</file>
+		<file>dispatch.c</file>
+		<file>fileobjs.c</file>
+		<file>iinfo.c</file>
+		<file>info.c</file>
+		<file>irp.c</file>
+		<file>lock.c</file>
+		<file>main.c</file>
+		<file>mockbuffer.c</file>
+		<file>mockbug.c</file>
+		<file>mocklock.c</file>
+		<file>mockpool.c</file>
+		<file>mockwait.c</file>
+		<file>ninfo.c</file>
+		<file>pool.c</file>
+		<file>proto.c</file>
+		<file>tinfo.c</file>
+		<file>wait.c</file>
+	</directory>
+	<file>tcpip.rc</file>
+</module>

Added: branches/xmlbuildsystem/reactos/drivers/net/tdi/tdi.xml
--- branches/xmlbuildsystem/reactos/drivers/net/tdi/tdi.xml	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/drivers/net/tdi/tdi.xml	2005-01-16 22:26:26 UTC (rev 13086)
@@ -0,0 +1,19 @@
+<module name="tdi" type="kernelmodedriver">
+	<importlibrary definition="misc/tdi.def"></importlibrary>
+	<library>ntoskrnl</library>
+	<library>hal</library>
+	<directory name="cte">
+		<file>string.c</file>
+		<file>stubs.c</file>
+	</directory>
+	<directory name="misc">
+		<file>main.c</file>
+		<file>tdi.rc</file>
+	</directory>
+	<directory name="tdi">
+		<file>dereg.c</file>
+		<file>handler.c</file>
+		<file>obsolete.c</file>
+		<file>stubs.c</file>
+	</directory>
+</module>

Added: branches/xmlbuildsystem/reactos/drivers/net/wshtcpip/wshtcpip.xml
--- branches/xmlbuildsystem/reactos/drivers/net/wshtcpip/wshtcpip.xml	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/drivers/net/wshtcpip/wshtcpip.xml	2005-01-16 22:26:26 UTC (rev 13086)
@@ -0,0 +1,11 @@
+<module name="wshtcpip" type="win32dll">
+	<importlibrary definition="wshtcpip.def"></importlibrary>
+	<include base="wshtcpip">.</include>
+	<define name="UNICODE" />
+	<define name="__USE_W32API" />
+	<library>ntdll</library>
+	<library>kernel32</library>
+	<library>ws2_32</library>
+	<file>wshtcpip.c</file>
+	<file>wshtcpip.rc</file>
+</module>

Added: branches/xmlbuildsystem/reactos/lib/adns/adns.xml
--- branches/xmlbuildsystem/reactos/lib/adns/adns.xml	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/lib/adns/adns.xml	2005-01-16 22:26:26 UTC (rev 13086)
@@ -0,0 +1,20 @@
+<module name="adns" type="staticlibrary">
+	<include base="adns">src</include>
+	<include base="adns">adns_win32</include>
+	<define name="ADNS_JGAA_WIN32" />
+	<directory name="adns_win32">
+		<file>adns_unix_calls.c</file>
+	</directory>
+	<directory name="src">
+		<file>check.c</file>
+		<file>event.c</file>
+		<file>general.c</file>
+		<file>parse.c</file>
+		<file>poll.c</file>
+		<file>query.c</file>
+		<file>reply.c</file>
+		<file>setup.c</file>
+		<file>transmit.c</file>
+		<file>types.c</file>
+	</directory>
+</module>

Modified: branches/xmlbuildsystem/reactos/lib/directory.xml
--- branches/xmlbuildsystem/reactos/lib/directory.xml	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/lib/directory.xml	2005-01-16 22:26:26 UTC (rev 13086)
@@ -1,9 +1,18 @@
+<directory name="adns">
+	<xi:include href="adns/adns.xml" />
+</directory>
 <directory name="advapi32">
 	<xi:include href="advapi32/advapi32.xml" />
 </directory>
+<directory name="dnsapi">
+	<xi:include href="dnsapi/dnsapi.xml" />
+</directory>
 <directory name="gdi32">
 	<xi:include href="gdi32/gdi32.xml" />
 </directory>
+<directory name="iphlpapi">
+	<xi:include href="iphlpapi/iphlpapi.xml" />
+</directory>
 <directory name="kernel32">
 	<xi:include href="kernel32/kernel32.xml" />
 </directory>
@@ -34,3 +43,6 @@
 <directory name="user32">
 	<xi:include href="user32/user32.xml" />
 </directory>
+<directory name="ws2_32">
+	<xi:include href="ws2_32/ws2_32.xml" />
+</directory>

Added: branches/xmlbuildsystem/reactos/lib/dnsapi/dnsapi.xml
--- branches/xmlbuildsystem/reactos/lib/dnsapi/dnsapi.xml	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/lib/dnsapi/dnsapi.xml	2005-01-16 22:26:26 UTC (rev 13086)
@@ -0,0 +1,26 @@
+<module name="dnsapi" type="win32dll">
+	<importlibrary definition="dnsapi.def" />
+	<include base="dnsapi">include</include>
+	<include base="adns">src</include>
+	<include base="adns">adns_win32</include>
+	<define name="_DISABLE_TIDENTS" />
+	<define name="ADNS_JGAA_WIN32" />
+	<define name="__USE_W32API" />
+	<library>adns</library>
+	<library>rosrtl</library>
+	<library>ntdll</library>
+	<library>kernel32</library>
+	<library>user32</library>
+	<library>msvcrt</library>
+	<library>ws2_32</library>
+	<library>iphlpapi</library>
+	<directory name="dnsapi">
+		<file>adns.c</file>
+		<file>context.c</file>
+		<file>free.c</file>
+		<file>names.c</file>
+		<file>query.c</file>
+		<file>stubs.c</file>
+	</directory>
+	<file>dnsapi.rc</file>
+</module>

Added: branches/xmlbuildsystem/reactos/lib/iphlpapi/iphlpapi.xml
--- branches/xmlbuildsystem/reactos/lib/iphlpapi/iphlpapi.xml	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/lib/iphlpapi/iphlpapi.xml	2005-01-16 22:26:26 UTC (rev 13086)
@@ -0,0 +1,27 @@
+<module name="iphlpapi" type="win32dll">
+	<dependency>winebuild</dependency>
+	<importlibrary definition="iphlpapi.def" />
+	<include base="iphlpapi">include</include>
+	<include base="ReactOS">include/wine</include>
+	<define name="YDEBUG" />
+	<define name="UNICODE" />
+	<define name="_UNICODE" />
+	<define name="__REACTOS__" />
+	<define name="__USE_W32API" />
+	<library>wine</library>
+<!--	<library>wine_uuid</library> -->
+	<library>rtl</library>
+	<library>ntdll</library>
+	<library>kernel32</library>
+	<library>advapi32</library>
+	<library>ws2_32</library>
+	<file>ifenum_reactos.c</file>
+	<file>ipstats_reactos.c</file>
+	<file>iphlpapi_main.c</file>
+	<file>media.c</file>
+	<file>registry.c</file>
+	<file>resinfo_reactos.c</file>
+	<file>route_reactos.c</file>
+	<file>iphlpapi.rc</file>
+	<file>iphlpapi.spec</file>
+</module>

Modified: branches/xmlbuildsystem/reactos/lib/msvcrt/msvcrt.xml
--- branches/xmlbuildsystem/reactos/lib/msvcrt/msvcrt.xml	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/lib/msvcrt/msvcrt.xml	2005-01-16 22:26:26 UTC (rev 13086)
@@ -362,7 +362,6 @@
 		<file>swab.c</file>
 		<file>wcstod.c</file>
 		<file>wcstol.c</file>
-		<file>wcstom.c</file>
 		<file>wcstomb.c</file>
 		<file>wcstombs.c</file>
 		<file>wcstoul.c</file>

Modified: branches/xmlbuildsystem/reactos/lib/msvcrt/stdlib/wcstomb.c
--- branches/xmlbuildsystem/reactos/lib/msvcrt/stdlib/wcstomb.c	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/lib/msvcrt/stdlib/wcstomb.c	2005-01-16 22:26:26 UTC (rev 13086)
@@ -46,33 +46,7 @@
 size_t
 __wcrtomb (char *s, wchar_t wc);
 
-/*
- * Convert WCHAR into its multibyte character representation,
- * putting this in S and returning its length.
- *
- * Attention: this function should NEVER be intentionally used.
- * The interface is completely stupid.  The state is shared between
- * all conversion functions.  You should use instead the restartable
- * version `wcrtomb'.
- *
- * @implemented
- */
-int
-wctomb (char *s, wchar_t wchar)
-{
-  /* If S is NULL the function has to return null or not null
-     depending on the encoding having a state depending encoding or
-     not.  This is nonsense because any multibyte encoding has a
-     state.  The ISO C amendment 1 corrects this while introducing the
-     restartable functions.  We simply say here all encodings have a
-     state.  */
-  if (s == NULL)
-    return 1;
 
-  return __wcrtomb (s, wchar);
-}
-
-
 size_t
 __wcrtomb (char *s, wchar_t wc)
 {

Added: branches/xmlbuildsystem/reactos/lib/ws2_32/ws2_32.xml
--- branches/xmlbuildsystem/reactos/lib/ws2_32/ws2_32.xml	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/lib/ws2_32/ws2_32.xml	2005-01-16 22:26:26 UTC (rev 13086)
@@ -0,0 +1,26 @@
+<module name="ws2_32" type="win32dll">
+	<importlibrary definition="ws2_32.def" />
+	<include base="ws2_32">include</include>
+	<define name="_DISABLE_TIDENTS" />
+	<define name="UNICODE" />
+	<define name="LE" />
+	<define name="__USE_W32API" />
+	<define name="_WIN32_WINNT">0x0500</define>
+	<library>ntdll</library>
+	<library>kernel32</library>
+	<library>user32</library>
+	<library>advapi32</library>
+	<library>dnsapi</library>
+	<directory name="misc">
+		<file>bsd.c</file>
+		<file>catalog.c</file>
+		<file>dllmain.c</file>
+		<file>event.c</file>
+		<file>handle.c</file>
+		<file>ns.c</file>
+		<file>sndrcv.c</file>
+		<file>stubs.c</file>
+		<file>upcall.c</file>
+	</directory>
+	<file>ws2_32.rc</file>
+</module>

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-01-16 22:26:26 UTC (rev 13086)
@@ -166,8 +166,10 @@
 	fprintf ( fMakefile, "gcc = gcc\n" );
 	fprintf ( fMakefile, "ld = ld\n" );
 	fprintf ( fMakefile, "ar = ar\n" );
-	fprintf ( fMakefile, "dlltool = dlltool\n\n" );
-	fprintf ( fMakefile, "windres = windres\n\n" );
+	fprintf ( fMakefile, "dlltool = dlltool\n" );
+	fprintf ( fMakefile, "windres = windres\n" );
+	fprintf ( fMakefile, "winebuild = tools" SSEP "winebuild" SSEP "winebuild\n" );
+	fprintf ( fMakefile, "\n" );
 	GenerateGlobalCFlagsAndProperties (
 		"=",
 		ProjectNode.properties,

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-01-16 22:26:26 UTC (rev 13086)
@@ -71,6 +71,15 @@
 }
 
 string
+MingwModuleHandler::GetBasename ( const string& filename ) const
+{
+	size_t index = filename.find_last_of ( '.' );
+	if (index != string::npos)
+		return filename.substr ( 0, index );
+	return "";
+}
+
+string
 MingwModuleHandler::ReplaceExtension ( const string& filename,
 	                                   const string& newExtension ) const
 {
@@ -81,6 +90,19 @@
 }
 
 string
+MingwModuleHandler::GetActualSourceFilename ( const string& filename ) const
+{
+	string extension = GetExtension ( filename );
+	if ( extension == ".spec" || extension == "SPEC" )
+	{
+		string basename = GetBasename( filename );
+		return basename + ".stubs.c";
+	}
+	else
+		return filename;
+}
+
+string
 MingwModuleHandler::GetModuleArchiveFilename ( const Module& module ) const
 {
 	return ReplaceExtension ( FixupTargetFilename ( module.GetPath () ),
@@ -120,6 +142,11 @@
 		const Module* dependencyModule = dependency->dependencyModule;
 		dependencies += dependencyModule->GetTargets ();
 	}
+	string definitionDependencies = GetDefinitionDependencies ( module );
+	if ( dependencies.length () > 0 && definitionDependencies.length () > 0 )
+		dependencies += " " + definitionDependencies;
+	else if ( definitionDependencies.length () > 0 )
+		dependencies = definitionDependencies;
 	return dependencies;
 }
 
@@ -143,7 +170,7 @@
 
 	string sourceFilenames ( "" );
 	for ( i = 0; i < module.files.size (); i++ )
-		sourceFilenames += " " + module.files[i]->name;
+		sourceFilenames += " " + GetActualSourceFilename ( module.files[i]->name );
 	vector<If*> ifs = module.ifs;
 	for ( i = 0; i < ifs.size(); i++ )
 	{
@@ -152,7 +179,7 @@
 		for ( j = 0; j < rIf.ifs.size(); j++ )
 			ifs.push_back ( rIf.ifs[j] );
 		for ( j = 0; j < rIf.files.size(); j++ )
-			sourceFilenames += " " + rIf.files[j]->name;
+			sourceFilenames += " " + GetActualSourceFilename ( rIf.files[j]->name );
 	}
 	return sourceFilenames;
 }
@@ -164,6 +191,8 @@
 	string extension = GetExtension ( sourceFilename );
 	if ( extension == ".rc" || extension == ".RC" )
 		newExtension = ".coff";
+	else if ( extension == ".spec" || extension == ".SPEC" )
+		newExtension = ".stubs.o";
 	else
 		newExtension = ".o";
 	return FixupTargetFilename ( ReplaceExtension ( sourceFilename,
@@ -314,7 +343,7 @@
 	}
 	fprintf ( fMakefile, "\n" );
 }
-	
+
 void
 MingwModuleHandler::GenerateMacros (
 	const char* assignmentOperation,
@@ -366,11 +395,15 @@
 			assignmentOperation );
 		for ( i = 0; i < files.size(); i++ )
 		{
-			fprintf (
-				fMakefile,
-				"%s%s",
-				( i%10 == 9 ? "\\\n\t" : " " ),
-				GetObjectFilename(files[i]->name).c_str() );
+			string extension = GetExtension ( files[i]->name );
+			if ( extension != ".spec" && extension != ".SPEC" )
+			{
+				fprintf (
+					fMakefile,
+					"%s%s",
+					( i%10 == 9 ? "\\\n\t" : " " ),
+					GetObjectFilename(files[i]->name).c_str() );
+			}
 		}
 		fprintf ( fMakefile, "\n" );
 	}
@@ -443,87 +476,155 @@
 		module.name.c_str () );
 }
 
-string
+void
 MingwModuleHandler::GenerateGccCommand ( const Module& module,
                                          const string& sourceFilename,
                                          const string& cc,
                                          const string& cflagsMacro ) const
 {
 	string objectFilename = GetObjectFilename ( sourceFilename );
-	return ssprintf ( "%s -c %s -o %s %s\n",
-		              cc.c_str (),
-		              sourceFilename.c_str (),
-		              objectFilename.c_str (),
-		              cflagsMacro.c_str () );
+	fprintf ( fMakefile,
+	          "%s: %s\n",
+	          objectFilename.c_str (),
+	          sourceFilename.c_str () );
+	fprintf ( fMakefile,
+	         "\t%s -c %s -o %s %s\n",
+	         cc.c_str (),
+	         sourceFilename.c_str (),
+	         objectFilename.c_str (),
+	         cflagsMacro.c_str () );
 }
 
-string
+void
 MingwModuleHandler::GenerateGccAssemblerCommand ( const Module& module,
                                                   const string& sourceFilename,
                                                   const string& cc,
                                                   const string& cflagsMacro ) const
 {
 	string objectFilename = GetObjectFilename ( sourceFilename );
-	return ssprintf ( "%s -x assembler-with-cpp -c %s -o %s -D__ASM__ %s\n",
-	                  cc.c_str (),
-	                  sourceFilename.c_str (),
-	                  objectFilename.c_str (),
-	                  cflagsMacro.c_str () );
+	fprintf ( fMakefile,
+	          "%s: %s\n",
+	          objectFilename.c_str (),
+	          sourceFilename.c_str () );
+	fprintf ( fMakefile,
+	          "\t%s -x assembler-with-cpp -c %s -o %s -D__ASM__ %s\n",
+	          cc.c_str (),
+	          sourceFilename.c_str (),
+	          objectFilename.c_str (),
+	          cflagsMacro.c_str () );
 }
 
-string
+void
 MingwModuleHandler::GenerateNasmCommand ( const Module& module,
                                           const string& sourceFilename,
                                           const string& nasmflagsMacro ) const
 {
 	string objectFilename = GetObjectFilename ( sourceFilename );
-	return ssprintf ( "%s -f win32 %s -o %s %s\n",
-		              "nasm",
-		              sourceFilename.c_str (),
-		              objectFilename.c_str (),
-		              nasmflagsMacro.c_str () );
+	fprintf ( fMakefile,
+	          "%s: %s\n",
+	          objectFilename.c_str (),
+	          sourceFilename.c_str () );
+	fprintf ( fMakefile,
+	          "\t%s -f win32 %s -o %s %s\n",
+	          "nasm",
+	          sourceFilename.c_str (),
+	          objectFilename.c_str (),
+	          nasmflagsMacro.c_str () );
 }
 
-string
+void
 MingwModuleHandler::GenerateWindresCommand ( const Module& module,
                                              const string& sourceFilename,
                                              const string& windresflagsMacro ) const
 {
 	string objectFilename = GetObjectFilename ( sourceFilename );
-	return ssprintf ( "%s %s -o %s ${%s}\n",
-		              "${windres}",
-		              sourceFilename.c_str (),
-		              objectFilename.c_str (),
-		              windresflagsMacro.c_str () );
+	fprintf ( fMakefile,
+	          "%s: %s\n",
+	          objectFilename.c_str (),
+	          sourceFilename.c_str () );
+	fprintf ( fMakefile,
+	         "\t%s %s -o %s ${%s}\n",
+	         "${windres}",
+	         sourceFilename.c_str (),
+	         objectFilename.c_str (),
+	         windresflagsMacro.c_str () );
 }
 
-string
-MingwModuleHandler::GenerateCommand ( const Module& module,
-                                      const string& sourceFilename,
-                                      const string& cc,
-                                      const string& cflagsMacro,
-                                      const string& nasmflagsMacro,
-                                      const string& windresflagsMacro ) const
+void
+MingwModuleHandler::GenerateWinebuildCommands ( const Module& module,
+                                                const string& sourceFilename ) const
 {
+	string basename = GetBasename ( sourceFilename );
+	fprintf ( fMakefile,
+	          "%s.def: %s\n",
+	          basename.c_str (),
+	          sourceFilename.c_str () );
+	fprintf ( fMakefile,
+	          "\t%s --def=%s -o %s.def\n",
+	          "${winebuild}",
+	          sourceFilename.c_str (),
+	          basename.c_str () );
+
+	fprintf ( fMakefile,
+	          "%s.stubs.c: %s\n",
+	          basename.c_str (),
+	          sourceFilename.c_str () );
+	fprintf ( fMakefile,
+	          "\t%s --pedll=%s -o %s.stubs.c\n",
+	          "${winebuild}",
+	          sourceFilename.c_str (),
+	          basename.c_str () );
+}
+
+void
+MingwModuleHandler::GenerateCommands ( const Module& module,
+                                       const string& sourceFilename,
+                                       const string& cc,
+                                       const string& cflagsMacro,
+                                       const string& nasmflagsMacro,
+                                       const string& windresflagsMacro ) const
+{
 	string extension = GetExtension ( sourceFilename );
 	if ( extension == ".c" || extension == ".C" )
-		return GenerateGccCommand ( module,
-		                            sourceFilename,
-		                            cc,
-		                            cflagsMacro );
+	{
+		GenerateGccCommand ( module,
+		                     sourceFilename,
+		                     cc,
+		                     cflagsMacro );
+		return;
+	}
 	else if ( extension == ".s" || extension == ".S" )
-		return GenerateGccAssemblerCommand ( module,
-		                                     sourceFilename,
-		                                     cc,
-		                                     cflagsMacro );
+	{
+		GenerateGccAssemblerCommand ( module,
+		                              sourceFilename,
+		                              cc,
+		                              cflagsMacro );
+		return;
+	}
 	else if ( extension == ".asm" || extension == ".ASM" )
-		return GenerateNasmCommand ( module,
-		                             sourceFilename,
-		                             nasmflagsMacro );
+	{
+		GenerateNasmCommand ( module,
+		                      sourceFilename,
+		                      nasmflagsMacro );
+		return;
+	}
 	else if ( extension == ".rc" || extension == ".RC" )
-		return GenerateWindresCommand ( module,
-		                                sourceFilename,
-		                                windresflagsMacro );
+	{
+		GenerateWindresCommand ( module,
+		                         sourceFilename,
+		                         windresflagsMacro );
+		return;
+	}
+	else if ( extension == ".spec" || extension == ".SPEC" )
+	{
+		GenerateWinebuildCommands ( module,
+		                            sourceFilename );
+		GenerateGccCommand ( module,
+		                     GetActualSourceFilename ( sourceFilename ),
+		                     cc,
+		                     cflagsMacro );
+		return;
+	}
 
 	throw InvalidOperationException ( __FILE__,
 	                                  __LINE__,
@@ -614,19 +715,14 @@
 	for ( i = 0; i < files.size (); i++ )
 	{
 		string sourceFilename = files[i]->name;
-		string objectFilename = GetObjectFilename ( sourceFilename );
+		GenerateCommands ( module,
+		                   sourceFilename,
+		                   cc,
+		                   cflagsMacro,
+		                   nasmflagsMacro,
+		                   windresflagsMacro );
 		fprintf ( fMakefile,
-		          "%s: %s\n",
-		          objectFilename.c_str (),
-		          sourceFilename.c_str () );
-		fprintf ( fMakefile,
-		          "\t%s\n",
-		          GenerateCommand ( module,
-		                            sourceFilename,
-		                            cc,
-		                            cflagsMacro,
-		                            nasmflagsMacro,
-		                            windresflagsMacro ).c_str () );
+		          "\n" );
 	}
 
 	for ( i = 0; i < ifs.size(); i++ )
@@ -937,8 +1033,10 @@
 {
 	if ( module.importLibrary != NULL )
 	{
-		fprintf ( fMakefile, "%s:\n",
-		          module.GetDependencyPath ().c_str () );
+		string definitionDependencies = GetDefinitionDependencies ( module );
+		fprintf ( fMakefile, "%s: %s\n",
+		          module.GetDependencyPath ().c_str (),
+		          definitionDependencies.c_str () );
 
 		fprintf ( fMakefile,
 		          "\t${dlltool} --dllname %s --def %s --output-lib %s --kill-at\n\n",
@@ -948,7 +1046,45 @@
 	}
 }
 
+string
+MingwModuleHandler::GetSpecObjectDependencies ( const string& filename ) const
+{
+	string basename = GetBasename ( filename );
+	return basename + ".def" + " " + basename + ".stubs.c";
+}
 
+string
+MingwModuleHandler::GetDefinitionDependencies ( const Module& module ) const
+{
+	string dependencies;
+	for ( size_t i = 0; i < module.files.size (); i++ )
+	{
+		File& file = *module.files[i];
+		string extension = GetExtension ( file.name );
+		if ( extension == ".spec" || extension == ".SPEC" )
+		{
+			if ( dependencies.length () > 0 )
+				dependencies += " ";
+			dependencies += GetSpecObjectDependencies ( file.name );
+		}
+	}
+	return dependencies;
+}
+
+string
+MingwModuleHandler::GetLinkingDependencies ( const Module& module ) const
+{
+	string dependencies = GetImportLibraryDependencies ( module );
+	string s = GetDefinitionDependencies ( module );
+	if ( s.length () > 0 )
+	{
+		dependencies += " ";
+		dependencies += s;
+	}
+	return dependencies;
+}
+
+
 static MingwBuildToolModuleHandler buildtool_handler;
 
 MingwBuildToolModuleHandler::MingwBuildToolModuleHandler()
@@ -1141,6 +1277,7 @@
 	GenerateInvocations ( module );
 }
 
+
 void
 MingwKernelModeDriverModuleHandler::GenerateKernelModeDriverModuleTarget ( const Module& module )
 {
@@ -1253,8 +1390,8 @@
 	static string ros_junk ( "$(ROS_TEMPORARY)" );
 	string target ( FixupTargetFilename ( module.GetPath () ) );
 	string workingDirectory = GetWorkingDirectory ( );
-	string archiveFilename = GetModuleArchiveFilename ( module );
-	string importLibraryDependencies = GetImportLibraryDependencies ( module );
+	string objectFilenames = GetObjectFilenames ( module );
+	string linkingDependencies = GetLinkingDependencies ( module );
 
 	GenerateImportLibraryTargetIfNeeded ( module );
 
@@ -1264,14 +1401,14 @@
 
 		fprintf ( fMakefile, "%s: %s %s\n",
 		          target.c_str (),
-		          archiveFilename.c_str (),
-		          importLibraryDependencies.c_str () );
+		          objectFilenames.c_str (),
+		          linkingDependencies.c_str () );
 
 		string linkerParameters ( "-Wl,--subsystem,console -Wl,--entry,_DllMain@12 -Wl,--image-base,0x10000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -mdll" );
 		GenerateLinkerCommand ( module,
                                 "${gcc}",
                                 linkerParameters,
-                                archiveFilename );
+                                objectFilenames );
 	}
 	else
 	{

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-01-16 22:26:26 UTC (rev 13086)
@@ -20,8 +20,10 @@
 protected:
 	std::string GetWorkingDirectory () const;
 	std::string GetExtension ( const std::string& filename ) const;
+	std::string GetBasename ( const std::string& filename ) const;
 	std::string ReplaceExtension ( const std::string& filename,
 	                               const std::string& newExtension ) const;
+	std::string GetActualSourceFilename ( const std::string& filename ) const;
 	std::string GetModuleArchiveFilename ( const Module& module ) const;
 	std::string GetImportLibraryDependencies ( const Module& module ) const;
 	std::string GetModuleDependencies ( const Module& module ) const;
@@ -46,6 +48,8 @@
 	                             const std::string& linkerParameters,
 	                             const std::string& objectFilenames ) const;
 	void GenerateImportLibraryTargetIfNeeded ( const Module& module ) const;
+	std::string GetDefinitionDependencies ( const Module& module ) const;
+	std::string GetLinkingDependencies ( const Module& module ) const;
 	static FILE* fMakefile;
 private:
 	std::string ConcatenatePaths ( const std::string& path1,
@@ -79,26 +83,28 @@
 	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& cflagsMacro ) const;
-	std::string GenerateGccAssemblerCommand ( const Module& module,
-	                                          const std::string& sourceFilename,
-	                                          const std::string& cc,
-	                                          const std::string& cflagsMacro ) const;
-	std::string GenerateNasmCommand ( const Module& module,
-	                                  const std::string& sourceFilename,
-	                                  const std::string& nasmflagsMacro ) const;
-	std::string GenerateWindresCommand ( const Module& module,
-	                                     const std::string& sourceFilename,
-	                                     const std::string& windresflagsMacro ) const;
-	std::string GenerateCommand ( const Module& module,
+	void GenerateGccCommand ( const Module& module,
+	                          const std::string& sourceFilename,
+	                          const std::string& cc,
+	                          const std::string& cflagsMacro ) const;
+	void GenerateGccAssemblerCommand ( const Module& module,
+	                                   const std::string& sourceFilename,
+	                                   const std::string& cc,
+	                                   const std::string& cflagsMacro ) const;
+	void GenerateNasmCommand ( const Module& module,
+	                           const std::string& sourceFilename,
+	                           const std::string& nasmflagsMacro ) const;
+	void GenerateWindresCommand ( const Module& module,
 	                              const std::string& sourceFilename,
-	                              const std::string& cc,
-	                              const std::string& cflagsMacro,
-	                              const std::string& nasmflagsMacro,
 	                              const std::string& windresflagsMacro ) const;
+	void GenerateWinebuildCommands ( const Module& module,
+	                                 const std::string& sourceFilename ) const;
+	void GenerateCommands ( const Module& module,
+	                        const std::string& sourceFilename,
+	                        const std::string& cc,
+	                        const std::string& cflagsMacro,
+	                        const std::string& nasmflagsMacro,
+	                        const std::string& windresflagsMacro ) const;
 	void GenerateObjectFileTargets ( const Module& module,
 	                                 const std::vector<File*>& files,
 	                                 const std::vector<If*>& ifs,
@@ -122,6 +128,7 @@
 	                                const std::string& ar,
 	                                const std::string* clags ) const;
 	std::string GetPreconditionDependenciesName ( const Module& module ) const;
+	std::string GetSpecObjectDependencies ( const std::string& filename ) const;
 };
 
 

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-01-16 22:26:26 UTC (rev 13086)
@@ -108,7 +108,7 @@
 	bool HasImportLibrary () const;
 	std::string GetTargetName () const;
 	std::string GetDependencyPath () const;
-	std::string GetBasePath() const;
+	std::string GetBasePath () const;
 	std::string GetPath () const;
 	std::string GetPathWithPrefix ( const std::string& prefix ) const;
 	std::string GetTargets () const;

Modified: branches/xmlbuildsystem/reactos/tools/tools.xml
--- branches/xmlbuildsystem/reactos/tools/tools.xml	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/tools/tools.xml	2005-01-16 22:26:26 UTC (rev 13086)
@@ -10,3 +10,6 @@
 <directory name="wmc">
 	<xi:include href="wmc/wmc.xml" />
 </directory>
+<directory name="winebuild">
+	<xi:include href="winebuild/winebuild.xml" />
+</directory>

Added: branches/xmlbuildsystem/reactos/tools/winebuild/winebuild.xml
--- branches/xmlbuildsystem/reactos/tools/winebuild/winebuild.xml	2005-01-16 18:39:32 UTC (rev 13085)
+++ branches/xmlbuildsystem/reactos/tools/winebuild/winebuild.xml	2005-01-16 22:26:26 UTC (rev 13086)
@@ -0,0 +1,13 @@
+<module name="winebuild" type="buildtool">
+	<include base="winebuild">.</include>
+	<include base="ReactOS">include/wine</include>
+	<define name="__USE_W32API" />
+	<file>import.c</file>
+	<file>main.c</file>
+	<file>mkstemps.c</file>
+	<file>parser.c</file>
+	<file>res16.c</file>
+	<file>res32.c</file>
+	<file>spec32.c</file>
+	<file>utils.c</file>
+</module>