* Build ntvdm
* Add win32cui module type support
Modified: branches/xmlbuildsystem/reactos/subsys/directory.xml
Added: branches/xmlbuildsystem/reactos/subsys/ntvdm/ntvdm.xml
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/subsys/directory.xml
--- branches/xmlbuildsystem/reactos/subsys/directory.xml	2005-02-05 18:59:14 UTC (rev 13425)
+++ branches/xmlbuildsystem/reactos/subsys/directory.xml	2005-02-05 19:16:14 UTC (rev 13426)
@@ -1,6 +1,9 @@
 <directory name="csrss">
 	<xi:include href="csrss/csrss.xml" />
 </directory>
+<directory name="ntvdm">
+	<xi:include href="ntvdm/ntvdm.xml" />
+</directory>
 <directory name="system">
 	<xi:include href="system/directory.xml" />
 </directory>

Added: branches/xmlbuildsystem/reactos/subsys/ntvdm/ntvdm.xml
--- branches/xmlbuildsystem/reactos/subsys/ntvdm/ntvdm.xml	2005-02-05 18:59:14 UTC (rev 13425)
+++ branches/xmlbuildsystem/reactos/subsys/ntvdm/ntvdm.xml	2005-02-05 19:16:14 UTC (rev 13426)
@@ -0,0 +1,12 @@
+<module name="ntvdm" type="win32cui">
+	<include base="ntvdm">.</include>
+	<define name="__USE_W32API" />
+	<define name="_DISABLE_TIDENTS" />
+	<library>ntdll</library>
+	<library>kernel32</library>
+	<library>user32</library>
+	<library>gdi32</library>
+	<library>advapi32</library>
+	<file>ntvdm.c</file>
+	<file>ntvdm.rc</file>
+</module>

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-02-05 18:59:14 UTC (rev 13425)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-02-05 19:16:14 UTC (rev 13426)
@@ -1720,6 +1720,58 @@
 }
 
 
+static MingwWin32CUIModuleHandler win32cui_handler;
+
+MingwWin32CUIModuleHandler::MingwWin32CUIModuleHandler ()
+	: MingwModuleHandler ( Win32CUI )
+{
+}
+
+void
+MingwWin32CUIModuleHandler::Process ( const Module& module )
+{
+	GeneratePreconditionDependencies ( module );
+	GenerateWin32CUIModuleTarget ( module );
+	GenerateInvocations ( module );
+}
+
+void
+MingwWin32CUIModuleHandler::GenerateWin32CUIModuleTarget ( const Module& module )
+{
+	static string ros_junk ( "$(ROS_TEMPORARY)" );
+	string target ( FixupTargetFilename ( module.GetPath () ) );
+	string workingDirectory = GetWorkingDirectory ( );
+	string objectFilenames = GetObjectFilenames ( module );
+	string importLibraryDependencies = GetImportLibraryDependencies ( module );
+
+	GenerateImportLibraryTargetIfNeeded ( module );
+
+	if ( module.files.size () > 0 )
+	{
+		GenerateMacrosAndTargetsTarget ( module );
+
+		fprintf ( fMakefile, "%s: %s %s\n",
+		          target.c_str (),
+		          objectFilenames.c_str (),
+		          importLibraryDependencies.c_str () );
+
+		string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,0x00400000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",
+		                                     module.entrypoint.c_str () );
+		GenerateLinkerCommand ( module,
+		                        "${gcc}",
+		                        linkerParameters,
+		                        objectFilenames );
+	}
+	else
+	{
+		fprintf ( fMakefile, ".PHONY: %s\n\n",
+		          target.c_str ());
+		fprintf ( fMakefile, "%s:\n\n",
+		          target.c_str ());
+	}
+}
+
+
 static MingwWin32GUIModuleHandler win32gui_handler;
 
 MingwWin32GUIModuleHandler::MingwWin32GUIModuleHandler ()

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-02-05 18:59:14 UTC (rev 13425)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-02-05 19:16:14 UTC (rev 13426)
@@ -243,6 +243,16 @@
 };
 
 
+class MingwWin32CUIModuleHandler : public MingwModuleHandler
+{
+public:
+	MingwWin32CUIModuleHandler ();
+	virtual void Process ( const Module& module );
+private:
+	void GenerateWin32CUIModuleTarget ( const Module& module );
+};
+
+
 class MingwWin32GUIModuleHandler : public MingwModuleHandler
 {
 public:

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-02-05 18:59:14 UTC (rev 13425)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-02-05 19:16:14 UTC (rev 13426)
@@ -275,6 +275,8 @@
 		return NativeCUI;
 	if ( attribute.value == "win32dll" )
 		return Win32DLL;
+	if ( attribute.value == "win32cui" )
+		return Win32CUI;
 	if ( attribute.value == "win32gui" )
 		return Win32GUI;
 	if ( attribute.value == "bootloader" )
@@ -301,6 +303,7 @@
 			return ".o";
 		case Kernel:
 		case NativeCUI:
+		case Win32CUI:
 		case Win32GUI:
 			return ".exe";
 		case KernelModeDLL:
@@ -326,8 +329,6 @@
 	{
 		case Kernel:
 			return "_NtProcessStartup";
-		case Win32GUI:
-			return "_WinMainCRTStartup";
 		case KernelModeDLL:
 			return "_DriverEntry@8";
 		case NativeDLL:
@@ -336,6 +337,10 @@
 			return "_NtProcessStartup@4";
 		case Win32DLL:
 			return "_DllMain@12";
+		case Win32CUI:
+			return "_mainCRTStartup";
+		case Win32GUI:
+			return "_WinMainCRTStartup";
 		case KernelModeDriver:
 			return "_DriverEntry@8";
 		case BuildTool:

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-02-05 18:59:14 UTC (rev 13425)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-02-05 19:16:14 UTC (rev 13426)
@@ -93,6 +93,7 @@
 	NativeDLL,
 	NativeCUI,
 	Win32DLL,
+	Win32CUI,
 	Win32GUI,
 	BootLoader,
 	BootSector,