diff --git a/reactos/ReactOS.xml b/reactos/ReactOS.xml
index 672d03fd17a..6a77afb6e5d 100644
--- a/reactos/ReactOS.xml
+++ b/reactos/ReactOS.xml
@@ -19,6 +19,7 @@
include
w32api/include
+ w32api/include/ddk
diff --git a/reactos/drivers/directory.xml b/reactos/drivers/directory.xml
index ab6afcca8dd..c34ffa06214 100644
--- a/reactos/drivers/directory.xml
+++ b/reactos/drivers/directory.xml
@@ -1,3 +1,6 @@
-
\ No newline at end of file
+
+
+
+
diff --git a/reactos/drivers/net/afd/afd.xml b/reactos/drivers/net/afd/afd.xml
new file mode 100644
index 00000000000..5161b224fa3
--- /dev/null
+++ b/reactos/drivers/net/afd/afd.xml
@@ -0,0 +1,24 @@
+
+
+ include
+ include/afd
+
+ ntoskrnl
+ hal
+ pseh
+
+ bind.c
+ connect.c
+ context.c
+ info.c
+ listen.c
+ lock.c
+ main.c
+ read.c
+ select.c
+ tdi.c
+ tdiconn.c
+ write.c
+
+ afd.rc
+
diff --git a/reactos/drivers/net/directory.xml b/reactos/drivers/net/directory.xml
new file mode 100644
index 00000000000..87b1b495e5a
--- /dev/null
+++ b/reactos/drivers/net/directory.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/reactos/include/ndis.h b/reactos/include/ndis.h
index 622fb757dcc..8d86430f54e 100644
--- a/reactos/include/ndis.h
+++ b/reactos/include/ndis.h
@@ -1 +1,5 @@
+#ifdef __USE_W32API
+#include_next
+#else
#include "net/ndis.h"
+#endif
diff --git a/reactos/ntoskrnl/ntoskrnl.xml b/reactos/ntoskrnl/ntoskrnl.xml
index da4dd142f5e..53672a8528c 100644
--- a/reactos/ntoskrnl/ntoskrnl.xml
+++ b/reactos/ntoskrnl/ntoskrnl.xml
@@ -1,4 +1,5 @@
+
buildno
genntdll
wmc
diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
index b9195b5487e..9187a64bbc4 100644
--- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
+++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
@@ -640,6 +640,13 @@ MingwModuleHandler::GenerateArchiveTarget ( const Module& module,
return archiveFilename;
}
+string
+MingwModuleHandler::GetCFlagsMacro ( const Module& module ) const
+{
+ return ssprintf ( "$(%s_CFLAGS)",
+ module.name.c_str () );
+}
+
string
MingwModuleHandler::GetObjectsMacro ( const Module& module ) const
{
@@ -658,7 +665,8 @@ void
MingwModuleHandler::GenerateMacrosAndTargets (
const Module& module,
const string& cc,
- const string& ar ) const
+ const string& ar,
+ const string* cflags ) const
{
string cflagsMacro = ssprintf ("%s_CFLAGS", module.name.c_str ());
string nasmflagsMacro = ssprintf ("%s_NASMFLAGS", module.name.c_str ());
@@ -673,12 +681,20 @@ MingwModuleHandler::GenerateMacrosAndTargets (
linkerFlagsMacro,
objectsMacro );
+ if ( cflags != NULL )
+ {
+ fprintf ( fMakefile,
+ "%s += %s\n\n",
+ cflagsMacro.c_str (),
+ cflags->c_str () );
+ }
+
// generate phony target for module name
fprintf ( fMakefile, ".PHONY: %s\n",
- module.name.c_str() );
+ module.name.c_str () );
fprintf ( fMakefile, "%s: %s\n\n",
- module.name.c_str(),
- module.GetPath().c_str() );
+ module.name.c_str (),
+ module.GetPath ().c_str () );
// future references to the macros will be to get their values
cflagsMacro = ssprintf ("$(%s)", cflagsMacro.c_str ());
@@ -710,13 +726,21 @@ MingwModuleHandler::GenerateMacrosAndTargets (
void
MingwModuleHandler::GenerateMacrosAndTargetsHost ( const Module& module ) const
{
- GenerateMacrosAndTargets ( module, "${host_gcc}", "${host_ar}" );
+ GenerateMacrosAndTargets ( module, "${host_gcc}", "${host_ar}", NULL );
}
void
MingwModuleHandler::GenerateMacrosAndTargetsTarget ( const Module& module ) const
{
- GenerateMacrosAndTargets ( module, "${gcc}", "${ar}" );
+ GenerateMacrosAndTargetsTarget ( module,
+ NULL );
+}
+
+void
+MingwModuleHandler::GenerateMacrosAndTargetsTarget ( const Module& module,
+ const string* clags ) const
+{
+ GenerateMacrosAndTargets ( module, "${gcc}", "${ar}", clags );
}
string
@@ -857,6 +881,22 @@ MingwModuleHandler::GeneratePreconditionDependencies ( const Module& module ) co
fprintf ( fMakefile, "\n" );
}
+void
+MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ( const Module& module ) const
+{
+ 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 () );
+ }
+}
+
static MingwBuildToolModuleHandler buildtool_handler;
@@ -922,6 +962,8 @@ MingwKernelModuleHandler::GenerateKernelModuleTarget ( const Module& module )
GenerateMacrosAndTargetsTarget ( module );
+ GenerateImportLibraryTargetIfNeeded ( module );
+
fprintf ( fMakefile, "%s: %s %s\n",
target.c_str (),
objectsMacro.c_str (),
@@ -1005,19 +1047,9 @@ MingwKernelModeDLLModuleHandler::GenerateKernelModeDLLModuleTarget ( const Modul
string archiveFilename = GetModuleArchiveFilename ( module );
string importLibraryDependencies = GetImportLibraryDependencies ( module );
- if (module.importLibrary != NULL)
- {
- fprintf ( fMakefile, "%s:\n",
- module.GetDependencyPath ().c_str () );
+ GenerateImportLibraryTargetIfNeeded ( module );
- 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)
+ if ( module.files.size () > 0 )
{
GenerateMacrosAndTargetsTarget ( module );
@@ -1045,6 +1077,63 @@ MingwKernelModeDLLModuleHandler::GenerateKernelModeDLLModuleTarget ( const Modul
}
+static MingwKernelModeDriverModuleHandler kernelmodedriver_handler;
+
+MingwKernelModeDriverModuleHandler::MingwKernelModeDriverModuleHandler ()
+ : MingwModuleHandler ( KernelModeDriver )
+{
+}
+
+void
+MingwKernelModeDriverModuleHandler::Process ( const Module& module )
+{
+ GeneratePreconditionDependencies ( module );
+ GenerateKernelModeDriverModuleTarget ( module );
+ GenerateInvocations ( module );
+}
+
+void
+MingwKernelModeDriverModuleHandler::GenerateKernelModeDriverModuleTarget ( 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 );
+
+ GenerateImportLibraryTargetIfNeeded ( module );
+
+ if ( module.files.size () > 0 )
+ {
+ string* cflags = new string ( "-D__NTDRIVER__" );
+ GenerateMacrosAndTargetsTarget ( module,
+ cflags );
+ delete cflags;
+
+ fprintf ( fMakefile, "%s: %s %s\n",
+ target.c_str (),
+ archiveFilename.c_str (),
+ importLibraryDependencies.c_str () );
+
+ string linkerParameters ( "-Wl,--subsystem,native -Wl,--entry,_DriverEntry@8 -Wl,--image-base,0x10000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll" );
+ string linkerCommand = GenerateLinkerCommand ( module,
+ "${gcc}",
+ linkerParameters,
+ archiveFilename );
+ fprintf ( fMakefile,
+ "\t%s\n\n",
+ linkerCommand.c_str () );
+ }
+ else
+ {
+ fprintf ( fMakefile, "%s:\n",
+ target.c_str ());
+ fprintf ( fMakefile, ".PHONY: %s\n\n",
+ target.c_str ());
+ }
+}
+
+
static MingwNativeDLLModuleHandler nativedll_handler;
MingwNativeDLLModuleHandler::MingwNativeDLLModuleHandler ()
@@ -1068,20 +1157,10 @@ MingwNativeDLLModuleHandler::GenerateNativeDLLModuleTarget ( const Module& modul
string workingDirectory = GetWorkingDirectory ( );
string archiveFilename = GetModuleArchiveFilename ( module );
string importLibraryDependencies = GetImportLibraryDependencies ( module );
+
+ GenerateImportLibraryTargetIfNeeded ( 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)
+ if ( module.files.size () > 0 )
{
GenerateMacrosAndTargetsTarget ( module );
@@ -1133,19 +1212,9 @@ MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget ( const Module& module
string archiveFilename = GetModuleArchiveFilename ( module );
string importLibraryDependencies = GetImportLibraryDependencies ( module );
- if (module.importLibrary != NULL)
- {
- fprintf ( fMakefile, "%s:\n",
- module.GetDependencyPath ().c_str () );
+ GenerateImportLibraryTargetIfNeeded ( module );
- 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)
+ if ( module.files.size () > 0 )
{
GenerateMacrosAndTargetsTarget ( module );
@@ -1197,7 +1266,9 @@ MingwWin32GUIModuleHandler::GenerateWin32GUIModuleTarget ( const Module& module
string objectFilenames = GetObjectFilenames ( module );
string importLibraryDependencies = GetImportLibraryDependencies ( module );
- if (module.files.size () > 0)
+ GenerateImportLibraryTargetIfNeeded ( module );
+
+ if ( module.files.size () > 0 )
{
GenerateMacrosAndTargetsTarget ( module );
diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.h b/reactos/tools/rbuild/backend/mingw/modulehandler.h
index ae9032098fd..5456bb925b4 100644
--- a/reactos/tools/rbuild/backend/mingw/modulehandler.h
+++ b/reactos/tools/rbuild/backend/mingw/modulehandler.h
@@ -32,16 +32,20 @@ protected:
std::string GetObjectFilenames ( const Module& module ) const;
void GenerateMacrosAndTargetsHost ( const Module& module ) const;
void GenerateMacrosAndTargetsTarget ( const Module& module ) const;
+ void GenerateMacrosAndTargetsTarget ( const Module& module,
+ const std::string* clags ) const;
std::string GetInvocationDependencies ( const Module& module ) const;
std::string GetInvocationParameters ( const Invoke& invoke ) const;
void GenerateInvocations ( const Module& module ) const;
void GeneratePreconditionDependencies ( const Module& module ) const;
+ std::string GetCFlagsMacro ( const Module& module ) const;
std::string GetObjectsMacro ( const Module& module ) const;
std::string GetLinkerMacro ( const Module& module ) const;
std::string GenerateLinkerCommand ( const Module& module,
const std::string& linker,
const std::string& linkerParameters,
const std::string& objectFilenames ) const;
+ void GenerateImportLibraryTargetIfNeeded ( const Module& module ) const;
static FILE* fMakefile;
private:
std::string ConcatenatePaths ( const std::string& path1,
@@ -115,7 +119,8 @@ private:
const std::string& objs_macro ) const;
void GenerateMacrosAndTargets ( const Module& module,
const std::string& cc,
- const std::string& ar ) const;
+ const std::string& ar,
+ const std::string* clags ) const;
std::string GetPreconditionDependenciesName ( const Module& module ) const;
};
@@ -160,6 +165,16 @@ private:
};
+class MingwKernelModeDriverModuleHandler : public MingwModuleHandler
+{
+public:
+ MingwKernelModeDriverModuleHandler ();
+ virtual void Process ( const Module& module );
+private:
+ void GenerateKernelModeDriverModuleTarget ( const Module& module );
+};
+
+
class MingwNativeDLLModuleHandler : public MingwModuleHandler
{
public:
diff --git a/reactos/tools/rbuild/include.cpp b/reactos/tools/rbuild/include.cpp
index 1111efe9981..9713457bb37 100644
--- a/reactos/tools/rbuild/include.cpp
+++ b/reactos/tools/rbuild/include.cpp
@@ -8,10 +8,9 @@ using std::vector;
Include::Include ( const Project& project_,
const XMLElement& includeNode )
- : project(project_),
- module(NULL),
- node(includeNode),
- base(NULL)
+ : project (project_),
+ module (NULL),
+ node (includeNode)
{
Initialize();
}
@@ -19,10 +18,9 @@ Include::Include ( const Project& project_,
Include::Include ( const Project& project_,
const Module* module_,
const XMLElement& includeNode )
- : project(project_),
- module(module_),
- node(includeNode),
- base(NULL)
+ : project (project_),
+ module (module_),
+ node (includeNode)
{
Initialize();
}
@@ -48,13 +46,27 @@ Include::ProcessXML()
throw InvalidBuildFileException (
node.location,
"'base' attribute illegal from global " );
- base = project.LocateModule ( att->value );
- if ( !base )
+ bool referenceResolved = false;
+ if ( att->value == project.name )
+ {
+ basePath = ".";
+ referenceResolved = true;
+ }
+ else
+ {
+ const Module* base = project.LocateModule ( att->value );
+ if ( base != NULL )
+ {
+ basePath = base->GetBasePath ();
+ referenceResolved = true;
+ }
+ }
+ if ( !referenceResolved )
throw InvalidBuildFileException (
node.location,
- " attribute 'base' references non-existant module '%s'",
+ " attribute 'base' references non-existant project or module '%s'",
att->value.c_str() );
- directory = FixSeparator ( base->GetBasePath() + "/" + node.value );
+ directory = FixSeparator ( basePath + "/" + node.value );
}
else
directory = FixSeparator ( node.value );
diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp
index d91f6541c13..0481f32586d 100644
--- a/reactos/tools/rbuild/module.cpp
+++ b/reactos/tools/rbuild/module.cpp
@@ -214,6 +214,8 @@ Module::GetModuleType ( const string& location, const XMLAttribute& attribute )
return Kernel;
if ( attribute.value == "kernelmodedll" )
return KernelModeDLL;
+ if ( attribute.value == "kernelmodedriver" )
+ return KernelModeDriver;
if ( attribute.value == "nativedll" )
return NativeDLL;
if ( attribute.value == "win32dll" )
@@ -241,6 +243,8 @@ Module::GetDefaultModuleExtension () const
case NativeDLL:
case Win32DLL:
return ".dll";
+ case KernelModeDriver:
+ return ".sys";
}
throw InvalidOperationException ( __FILE__,
__LINE__ );
diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h
index 89f4415d1d1..6e04168a131 100644
--- a/reactos/tools/rbuild/rbuild.h
+++ b/reactos/tools/rbuild/rbuild.h
@@ -73,6 +73,7 @@ enum ModuleType
StaticLibrary,
Kernel,
KernelModeDLL,
+ KernelModeDriver,
NativeDLL,
Win32DLL,
Win32GUI
@@ -128,7 +129,7 @@ public:
const Module* module;
const XMLElement& node;
std::string directory;
- const Module* base;
+ std::string basePath;
Include ( const Project& project,
const XMLElement& includeNode );