[SDK][XML2SDB] Simplify include / exclude node specification.
authorMark Jansen <mark.jansen@reactos.org>
Sun, 30 Jul 2017 13:37:35 +0000 (13:37 +0000)
committerMark Jansen <mark.jansen@reactos.org>
Sun, 30 Jul 2017 13:37:35 +0000 (13:37 +0000)
svn path=/trunk/; revision=75457

reactos/media/sdb/sysmain.xml
reactos/sdk/tools/xml2sdb/main.cpp
reactos/sdk/tools/xml2sdb/xml2sdb.cpp
reactos/sdk/tools/xml2sdb/xml2sdb.h

index 90410a9..9cc1332 100644 (file)
             <!-- Version lie shims -->
 
             <SHIM NAME="Win95VersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
             <SHIM NAME="Win98VersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
             <SHIM NAME="WinNT4SP5VersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
             <SHIM NAME="Win2000VersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
             <SHIM NAME="Win2000SP1VersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
             <SHIM NAME="Win2000SP2VersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
             <SHIM NAME="Win2000SP3VersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
             <SHIM NAME="WinXPVersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
             <SHIM NAME="WinXPSP1VersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
             <SHIM NAME="WinXPSP2VersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
             <SHIM NAME="WinXPSP3VersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
             <SHIM NAME="Win2k3RTMVersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
             <SHIM NAME="Win2k3SP1VersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
             <SHIM NAME="Win2k3SP2VersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
             <SHIM NAME="VistaRTMVersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
             <SHIM NAME="VistaSP1VersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
             <SHIM NAME="VistaSP2VersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
             <SHIM NAME="Win7RTMVersionLie">
+                <INCLUDE MODULE="shell32.dll" />
+                <EXCLUDE MODULE="kernel32.dll" />
+                <EXCLUDE MODULE="msvcrt.dll" />
+                <EXCLUDE MODULE="ole32.dll" />
+                <EXCLUDE MODULE="oleaut32.dll" />
                 <DLLFILE>aclayers.dll</DLLFILE>
             </SHIM>
 
index 3afcc07..68d638e 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS xml to sdb converter
- * FILE:        sdk/tools/xml2sdb/main.cpp
- * PURPOSE:     Implement platform agnostic read / write / allocation functions, parse commandline
- * PROGRAMMERS: Mark Jansen
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS xml to sdb converter
+ * FILE:            sdk/tools/xml2sdb/main.cpp
+ * PURPOSE:         Implement platform agnostic read / write / allocation functions, parse commandline
+ * PROGRAMMERS:     Mark Jansen (mark.jansen@reactos.org)
  *
  */
 
@@ -201,7 +201,6 @@ static void update_loglevel(int argc, char* argv[], int& i)
     g_ShimDebugLevel = strtoul(value.c_str(), NULL, 10);
 }
 
-// -i R:\src\apphelp\reactos\media\sdb\sysmain.xml -oR:\build\apphelp\devenv_msvc\media\sdb\ros2.sdb
 int main(int argc, char * argv[])
 {
     std::string input, output;
index 59d8724..d9ecc0a 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS xml to sdb converter
- * FILE:        sdk/tools/xml2sdb/xml2sdb.cpp
- * PURPOSE:     Conversion functions from xml -> db
- * PROGRAMMERS: Mark Jansen
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS xml to sdb converter
+ * FILE:            sdk/tools/xml2sdb/xml2sdb.cpp
+ * PURPOSE:         Conversion functions from xml -> db
+ * PROGRAMMERS:     Mark Jansen (mark.jansen@reactos.org)
  *
  */
 
@@ -16,7 +16,7 @@
 using tinyxml2::XMLText;
 
 static const GUID GUID_NULL = { 0 };
-static const char szCompilerVersion[] = "1.5.0.0";
+static const char szCompilerVersion[] = "1.6.0.0";
 
 #if !defined(C_ASSERT)
 #define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1]
@@ -241,19 +241,10 @@ bool ReadBinaryNode(XMLHandle dbNode, const char* nodeName, std::vector<BYTE>& d
 bool InExclude::fromXml(XMLHandle dbNode)
 {
     Module = ReadStringNode(dbNode, "MODULE");
+    // Special module names: '$' and '*'
     if (!Module.empty())
     {
-        Include = dbNode.FirstChildElement("INCLUDE").ToNode() != NULL;
-        if (!Include)
-        {
-            tinyxml2::XMLElement* elem = dbNode.ToElement();
-            if (elem)
-            {
-                Include |= (elem->Attribute("INCLUDE") != NULL);
-            }
-        }
-        // $ = ??
-        // *
+        Include = ToNodeName(dbNode) == "INCLUDE";
         return true;
     }
     return false;
@@ -303,7 +294,8 @@ bool ShimRef::fromXml(XMLHandle dbNode)
 {
     Name = ReadStringNode(dbNode, "NAME");
     CommandLine = ReadStringNode(dbNode, "COMMAND_LINE");
-    ReadGeneric(dbNode, InExcludes, "INEXCLUDE");
+    ReadGeneric(dbNode, InExcludes, "INCLUDE");
+    ReadGeneric(dbNode, InExcludes, "EXCLUDE");
     return !Name.empty();
 }
 
@@ -331,7 +323,8 @@ bool Shim::fromXml(XMLHandle dbNode)
     ReadGuidNode(dbNode, "FIX_ID", FixID);
     // GENERAL ?
     // DESCRIPTION_RC_ID
-    ReadGeneric(dbNode, InExcludes, "INEXCLUDE");
+    ReadGeneric(dbNode, InExcludes, "INCLUDE");
+    ReadGeneric(dbNode, InExcludes, "EXCLUDE");
     return !Name.empty() && !DllFile.empty();
 }
 
@@ -527,6 +520,12 @@ bool Database::fromXml(XMLHandle dbNode)
         {
             SHIM_ERR("Unhanled FLAG type\n");
         }
+        else if (NodeName == "INCLUDE" || NodeName == "EXCLUDE")
+        {
+            InExclude inex;
+            if (inex.fromXml(libChild))
+                Library.InExcludes.push_back(inex);
+        }
         libChild = libChild.NextSibling();
     }
 
@@ -560,6 +559,8 @@ bool Database::toSdb(LPCWSTR path)
     }
     WriteBinary(pdb, TAG_DATABASE_ID, ID);
     TAGID tidLibrary = BeginWriteListTag(pdb, TAG_LIBRARY);
+    if (!WriteGeneric(pdb, Library.InExcludes, *this))
+        return false;
     if (!WriteGeneric(pdb, Library.Shims, *this))
         return false;
     EndWriteListTag(pdb, tidLibrary);
index e2c07e2..28d0ef2 100644 (file)
@@ -112,6 +112,7 @@ struct Exe
 
 struct Library
 {
+    std::list<InExclude> InExcludes;
     std::list<Shim> Shims;
 };