https://git.reactos.org/?p=reactos.git;a=commitdiff;h=767fc4a6ade47be16125f…
commit 767fc4a6ade47be16125f1844e61f9836543c2ae
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Tue Apr 10 22:39:29 2018 +0200
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Thu Apr 12 18:49:12 2018 +0200
[XML2SDB] Add support for DATA in Layers.
---
sdk/tools/xml2sdb/xml2sdb.cpp | 68 ++++++++++++++++++++++++++++++++++++++++++-
sdk/tools/xml2sdb/xml2sdb.h | 17 +++++++++++
2 files changed, 84 insertions(+), 1 deletion(-)
diff --git a/sdk/tools/xml2sdb/xml2sdb.cpp b/sdk/tools/xml2sdb/xml2sdb.cpp
index 091177362f..3478e0561b 100644
--- a/sdk/tools/xml2sdb/xml2sdb.cpp
+++ b/sdk/tools/xml2sdb/xml2sdb.cpp
@@ -14,7 +14,7 @@
using tinyxml2::XMLText;
static const GUID GUID_NULL = { 0 };
-static const char szCompilerVersion[] = "1.7.0.0";
+static const char szCompilerVersion[] = "1.7.0.1";
#if !defined(C_ASSERT)
#define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1]
@@ -398,6 +398,69 @@ bool Flag::toSdb(PDB pdb, Database& db)
}
+/***********************************************************************
+ * Data
+ */
+
+#ifndef REG_SZ
+#define REG_SZ 1
+//#define REG_BINARY 3
+#define REG_DWORD 4
+#define REG_QWORD 11
+#endif
+
+
+bool Data::fromXml(XMLHandle dbNode)
+{
+ Name = ReadStringNode(dbNode, "NAME");
+
+ StringData = ReadStringNode(dbNode, "DATA_STRING");
+ if (!StringData.empty())
+ {
+ DataType = REG_SZ;
+ return !Name.empty();
+ }
+ DWordData = ReadDWordNode(dbNode, "DATA_DWORD");
+ if (DWordData)
+ {
+ DataType = REG_DWORD;
+ return !Name.empty();
+ }
+ QWordData = ReadQWordNode(dbNode, "DATA_QWORD");
+ if (QWordData)
+ {
+ DataType = REG_QWORD;
+ return !Name.empty();
+ }
+
+ SHIM_ERR("Data node (%s) without value!\n", Name.c_str());
+ return false;
+}
+
+bool Data::toSdb(PDB pdb, Database& db)
+{
+ Tagid = db.BeginWriteListTag(pdb, TAG_DATA);
+ db.WriteString(pdb, TAG_NAME, Name, true);
+ db.WriteDWord(pdb, TAG_DATA_VALUETYPE, DataType, true);
+ switch (DataType)
+ {
+ case REG_SZ:
+ db.WriteString(pdb, TAG_DATA_STRING, StringData);
+ break;
+ case REG_DWORD:
+ db.WriteDWord(pdb, TAG_DATA_DWORD, DWordData);
+ break;
+ case REG_QWORD:
+ db.WriteQWord(pdb, TAG_DATA_QWORD, QWordData);
+ break;
+ default:
+ SHIM_ERR("Data node (%s) with unknown type (0x%x)\n", Name.c_str(),
DataType);
+ return false;
+ }
+
+ return !!db.EndWriteListTag(pdb, Tagid);
+}
+
/***********************************************************************
* Layer
*/
@@ -407,6 +470,7 @@ bool Layer::fromXml(XMLHandle dbNode)
Name = ReadStringNode(dbNode, "NAME");
ReadGeneric(dbNode, ShimRefs, "SHIM_REF");
ReadGeneric(dbNode, FlagRefs, "FLAG_REF");
+ ReadGeneric(dbNode, Datas, "DATA");
return true;
}
@@ -418,6 +482,8 @@ bool Layer::toSdb(PDB pdb, Database& db)
return false;
if (!WriteGeneric(pdb, FlagRefs, db))
return false;
+ if (!WriteGeneric(pdb, Datas, db))
+ return false;
return !!db.EndWriteListTag(pdb, Tagid);
}
diff --git a/sdk/tools/xml2sdb/xml2sdb.h b/sdk/tools/xml2sdb/xml2sdb.h
index 031b9ffcea..df9e391b44 100644
--- a/sdk/tools/xml2sdb/xml2sdb.h
+++ b/sdk/tools/xml2sdb/xml2sdb.h
@@ -91,6 +91,22 @@ struct Flag
};
+struct Data
+{
+ Data() : Tagid(0), DataType(0), DWordData(0), QWordData(0) { ; }
+
+ bool fromXml(XMLHandle dbNode);
+ bool toSdb(PDB pdb, Database& db);
+
+ std::string Name;
+ TAGID Tagid;
+ DWORD DataType;
+
+ std::string StringData;
+ DWORD DWordData;
+ QWORD QWordData;
+};
+
struct Layer
{
Layer() : Tagid(0) { ; }
@@ -102,6 +118,7 @@ struct Layer
TAGID Tagid;
std::list<ShimRef> ShimRefs;
std::list<FlagRef> FlagRefs;
+ std::list<Data> Datas;
};
struct MatchingFile