ReactOS  0.4.14-dev-337-gf981a68
Database Struct Reference

#include <xml2sdb.h>

Collaboration diagram for Database:

Public Member Functions

bool fromXml (const char *fileName)
 
bool fromXml (XMLHandle dbNode)
 
bool toSdb (LPCWSTR path)
 
void WriteString (PDB pdb, TAG tag, const sdbstring &str, bool always=false)
 
void WriteString (PDB pdb, TAG tag, const std::string &str, bool always=false)
 
void WriteBinary (PDB pdb, TAG tag, const GUID &guid, bool always=false)
 
void WriteBinary (PDB pdb, TAG tag, const std::vector< BYTE > &data, bool always=false)
 
void WriteDWord (PDB pdb, TAG tag, DWORD value, bool always=false)
 
void WriteQWord (PDB pdb, TAG tag, QWORD value, bool always=false)
 
TAGID BeginWriteListTag (PDB pdb, TAG tag)
 
BOOL EndWriteListTag (PDB pdb, TAGID tagid)
 
void InsertShimTagid (const sdbstring &name, TAGID tagid)
 
void InsertShimTagid (const std::string &name, TAGID tagid)
 
TAGID FindShimTagid (const sdbstring &name)
 
TAGID FindShimTagid (const std::string &name)
 
void InsertPatchTagid (const sdbstring &name, TAGID tagid)
 
void InsertPatchTagid (const std::string &name, TAGID tagid)
 
TAGID FindPatchTagid (const sdbstring &name)
 
TAGID FindPatchTagid (const std::string &name)
 
void InsertFlagTagid (const sdbstring &name, TAGID tagid)
 
void InsertFlagTagid (const std::string &name, TAGID tagid)
 
TAGID FindFlagTagid (const sdbstring &name)
 
TAGID FindFlagTagid (const std::string &name)
 

Public Attributes

std::string Name
 
GUID ID
 
struct Library Library
 
std::list< LayerLayers
 
std::list< ExeExes
 

Private Attributes

std::map< sdbstring, TAGIDKnownShims
 
std::map< sdbstring, TAGIDKnownPatches
 
std::map< sdbstring, TAGIDKnownFlags
 

Detailed Description

Definition at line 172 of file xml2sdb.h.

Member Function Documentation

◆ BeginWriteListTag()

TAGID Database::BeginWriteListTag ( PDB  pdb,
TAG  tag 
)

Definition at line 624 of file xml2sdb.cpp.

625 {
626  return SdbBeginWriteListTag(pdb, tag);
627 }
static PDB pdb
Definition: db.cpp:170
Definition: ecma_167.h:138
TAGID WINAPI SdbBeginWriteListTag(PDB pdb, TAG tag)
Definition: sdbwrite.c:321

Referenced by InExclude::toSdb(), ShimRef::toSdb(), FlagRef::toSdb(), Shim::toSdb(), Flag::toSdb(), Data::toSdb(), Layer::toSdb(), MatchingFile::toSdb(), Exe::toSdb(), and toSdb().

◆ EndWriteListTag()

BOOL Database::EndWriteListTag ( PDB  pdb,
TAGID  tagid 
)

Definition at line 629 of file xml2sdb.cpp.

630 {
631  return SdbEndWriteListTag(pdb, tagid);
632 }
static PDB pdb
Definition: db.cpp:170
BOOL WINAPI SdbEndWriteListTag(PDB pdb, TAGID tagid)
Definition: sdbwrite.c:343

Referenced by InExclude::toSdb(), ShimRef::toSdb(), FlagRef::toSdb(), Shim::toSdb(), Flag::toSdb(), Data::toSdb(), Layer::toSdb(), MatchingFile::toSdb(), Exe::toSdb(), and toSdb().

◆ FindFlagTagid() [1/2]

TAGID Database::FindFlagTagid ( const sdbstring name)

Definition at line 759 of file xml2sdb.cpp.

760 {
761  return FindTagid(name, KnownFlags);
762 }
std::map< sdbstring, TAGID > KnownFlags
Definition: xml2sdb.h:232
static TAGID FindTagid(const sdbstring &name, const std::map< sdbstring, TAGID > &lookup)
Definition: xml2sdb.cpp:724
Definition: name.c:36

Referenced by FindFlagTagid(), and FlagRef::toSdb().

◆ FindFlagTagid() [2/2]

TAGID Database::FindFlagTagid ( const std::string name)
inline

Definition at line 217 of file xml2sdb.h.

218  {
219  return FindFlagTagid(sdbstring(name.begin(), name.end()));
220  }
std::basic_string< WCHAR > sdbstring
Definition: xml2sdb.h:27
TAGID FindFlagTagid(const sdbstring &name)
Definition: xml2sdb.cpp:759
Definition: name.c:36

◆ FindPatchTagid() [1/2]

TAGID Database::FindPatchTagid ( const sdbstring name)

Definition at line 749 of file xml2sdb.cpp.

750 {
751  return FindTagid(name, KnownPatches);
752 }
std::map< sdbstring, TAGID > KnownPatches
Definition: xml2sdb.h:231
static TAGID FindTagid(const sdbstring &name, const std::map< sdbstring, TAGID > &lookup)
Definition: xml2sdb.cpp:724
Definition: name.c:36

Referenced by FindPatchTagid().

◆ FindPatchTagid() [2/2]

TAGID Database::FindPatchTagid ( const std::string name)
inline

Definition at line 206 of file xml2sdb.h.

207  {
208  return FindPatchTagid(sdbstring(name.begin(), name.end()));
209  }
TAGID FindPatchTagid(const sdbstring &name)
Definition: xml2sdb.cpp:749
std::basic_string< WCHAR > sdbstring
Definition: xml2sdb.h:27
Definition: name.c:36

◆ FindShimTagid() [1/2]

TAGID Database::FindShimTagid ( const sdbstring name)

Definition at line 739 of file xml2sdb.cpp.

740 {
741  return FindTagid(name, KnownShims);
742 }
std::map< sdbstring, TAGID > KnownShims
Definition: xml2sdb.h:230
static TAGID FindTagid(const sdbstring &name, const std::map< sdbstring, TAGID > &lookup)
Definition: xml2sdb.cpp:724
Definition: name.c:36

Referenced by FindShimTagid(), and ShimRef::toSdb().

◆ FindShimTagid() [2/2]

TAGID Database::FindShimTagid ( const std::string name)
inline

Definition at line 194 of file xml2sdb.h.

195  {
196  return FindShimTagid(sdbstring(name.begin(), name.end()));
197  }
TAGID FindShimTagid(const sdbstring &name)
Definition: xml2sdb.cpp:739
std::basic_string< WCHAR > sdbstring
Definition: xml2sdb.h:27
Definition: name.c:36

◆ fromXml() [1/2]

bool Database::fromXml ( const char fileName)

Definition at line 669 of file xml2sdb.cpp.

670 {
672  tinyxml2::XMLError err = doc.LoadFile(fileName);
673  XMLHandle dbHandle = tinyxml2::XMLHandle(&doc).FirstChildElement("SDB").FirstChildElement("DATABASE");
674  return fromXml(dbHandle);
675 }
XMLError LoadFile(const char *filename)
Definition: tinyxml2.cpp:1906
XMLHandle FirstChildElement(const char *name=0)
Get the first child element of this handle.
Definition: tinyxml2.h:1814
bool fromXml(const char *fileName)
Definition: xml2sdb.cpp:669
#define err(...)

Referenced by xml_2_db().

◆ fromXml() [2/2]

bool Database::fromXml ( XMLHandle  dbNode)

Definition at line 634 of file xml2sdb.cpp.

635 {
636  Name = ReadStringNode(dbNode, "NAME");
637  ReadGuidNode(dbNode, "DATABASE_ID", ID);
638 
639  XMLHandle libChild = dbNode.FirstChildElement("LIBRARY").FirstChild();
640  while (libChild.ToNode())
641  {
642  std::string NodeName = ToNodeName(libChild);
643  if (NodeName == "SHIM")
644  {
645  Shim shim;
646  if (shim.fromXml(libChild))
647  Library.Shims.push_back(shim);
648  }
649  else if (NodeName == "FLAG")
650  {
651  Flag flag;
652  if (flag.fromXml(libChild))
653  Library.Flags.push_back(flag);
654  }
655  else if (NodeName == "INCLUDE" || NodeName == "EXCLUDE")
656  {
657  InExclude inex;
658  if (inex.fromXml(libChild))
659  Library.InExcludes.push_back(inex);
660  }
661  libChild = libChild.NextSibling();
662  }
663 
664  ReadGeneric(dbNode, Layers, "LAYER");
665  ReadGeneric(dbNode, Exes, "EXE");
666  return true;
667 }
std::string ToNodeName(XMLHandle node)
Definition: xml2sdb.cpp:69
std::list< InExclude > InExcludes
Definition: xml2sdb.h:167
std::string ReadStringNode(XMLHandle dbNode, const char *nodeName)
Definition: xml2sdb.cpp:79
XMLHandle FirstChildElement(const char *name=0)
Get the first child element of this handle.
Definition: tinyxml2.h:1814
bool fromXml(XMLHandle dbNode)
Definition: xml2sdb.cpp:244
bool ReadGuidNode(XMLHandle dbNode, const char *nodeName, GUID &guid)
Definition: xml2sdb.cpp:211
std::list< Exe > Exes
Definition: xml2sdb.h:227
Definition: xml2sdb.h:79
GUID ID
Definition: xml2sdb.h:223
Definition: xml2sdb.h:65
bool fromXml(XMLHandle dbNode)
Definition: xml2sdb.cpp:345
static const char * NodeName(const NOTIFICATIONLIST *item)
Definition: changenotify.c:145
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
char string[160]
Definition: util.h:11
XMLNode * ToNode()
Safe cast to XMLNode. This can return null.
Definition: tinyxml2.h:1843
XMLHandle NextSibling()
Get the next sibling of this handle.
Definition: tinyxml2.h:1834
std::list< Shim > Shims
Definition: xml2sdb.h:168
void ReadGeneric(XMLHandle dbNode, std::list< T > &result, const char *nodeName)
Definition: xml2sdb.cpp:267
XMLHandle FirstChild()
Get the first child of this handle.
Definition: tinyxml2.h:1810
std::list< Flag > Flags
Definition: xml2sdb.h:169
std::list< Layer > Layers
Definition: xml2sdb.h:226

◆ InsertFlagTagid() [1/2]

void Database::InsertFlagTagid ( const sdbstring name,
TAGID  tagid 
)

Definition at line 754 of file xml2sdb.cpp.

755 {
756  InsertTagid(name, tagid, KnownFlags, "Flag");
757 }
static void InsertTagid(const sdbstring &name, TAGID tagid, std::map< sdbstring, TAGID > &lookup, const char *type)
Definition: xml2sdb.cpp:711
std::map< sdbstring, TAGID > KnownFlags
Definition: xml2sdb.h:232
Definition: name.c:36

Referenced by InsertFlagTagid(), and Flag::toSdb().

◆ InsertFlagTagid() [2/2]

void Database::InsertFlagTagid ( const std::string name,
TAGID  tagid 
)
inline

Definition at line 212 of file xml2sdb.h.

213  {
214  InsertFlagTagid(sdbstring(name.begin(), name.end()), tagid);
215  }
std::basic_string< WCHAR > sdbstring
Definition: xml2sdb.h:27
void InsertFlagTagid(const sdbstring &name, TAGID tagid)
Definition: xml2sdb.cpp:754
Definition: name.c:36

◆ InsertPatchTagid() [1/2]

void Database::InsertPatchTagid ( const sdbstring name,
TAGID  tagid 
)

Definition at line 744 of file xml2sdb.cpp.

745 {
746  InsertTagid(name, tagid, KnownPatches, "Patch");
747 }
static void InsertTagid(const sdbstring &name, TAGID tagid, std::map< sdbstring, TAGID > &lookup, const char *type)
Definition: xml2sdb.cpp:711
std::map< sdbstring, TAGID > KnownPatches
Definition: xml2sdb.h:231
Definition: name.c:36

Referenced by InsertPatchTagid().

◆ InsertPatchTagid() [2/2]

void Database::InsertPatchTagid ( const std::string name,
TAGID  tagid 
)
inline

Definition at line 201 of file xml2sdb.h.

202  {
203  InsertPatchTagid(sdbstring(name.begin(), name.end()), tagid);
204  }
std::basic_string< WCHAR > sdbstring
Definition: xml2sdb.h:27
void InsertPatchTagid(const sdbstring &name, TAGID tagid)
Definition: xml2sdb.cpp:744
Definition: name.c:36

◆ InsertShimTagid() [1/2]

void Database::InsertShimTagid ( const sdbstring name,
TAGID  tagid 
)

Definition at line 734 of file xml2sdb.cpp.

735 {
736  InsertTagid(name, tagid, KnownShims, "Shim");
737 }
std::map< sdbstring, TAGID > KnownShims
Definition: xml2sdb.h:230
static void InsertTagid(const sdbstring &name, TAGID tagid, std::map< sdbstring, TAGID > &lookup, const char *type)
Definition: xml2sdb.cpp:711
Definition: name.c:36

Referenced by InsertShimTagid(), and Shim::toSdb().

◆ InsertShimTagid() [2/2]

void Database::InsertShimTagid ( const std::string name,
TAGID  tagid 
)
inline

Definition at line 189 of file xml2sdb.h.

190  {
191  InsertShimTagid(sdbstring(name.begin(), name.end()), tagid);
192  }
std::basic_string< WCHAR > sdbstring
Definition: xml2sdb.h:27
void InsertShimTagid(const sdbstring &name, TAGID tagid)
Definition: xml2sdb.cpp:734
Definition: name.c:36

◆ toSdb()

bool Database::toSdb ( LPCWSTR  path)

Definition at line 677 of file xml2sdb.cpp.

678 {
680  TAGID tidDatabase = BeginWriteListTag(pdb, TAG_DATABASE);
681  LARGE_INTEGER li = { 0 };
686  WriteString(pdb, TAG_NAME, Name, true);
687  if (IsEmptyGuid(ID))
688  {
689  SHIM_WARN("DB has empty ID!\n");
690  RandomGuid(ID);
691  }
693  TAGID tidLibrary = BeginWriteListTag(pdb, TAG_LIBRARY);
694  if (!WriteGeneric(pdb, Library.InExcludes, *this))
695  return false;
696  if (!WriteGeneric(pdb, Library.Shims, *this))
697  return false;
698  if (!WriteGeneric(pdb, Library.Flags, *this))
699  return false;
700  EndWriteListTag(pdb, tidLibrary);
701  if (!WriteGeneric(pdb, Layers, *this))
702  return false;
703  if (!WriteGeneric(pdb, Exes, *this))
704  return false;
705  EndWriteListTag(pdb, tidDatabase);
706 
708  return true;
709 }
bool WriteGeneric(PDB pdb, std::list< T > &data, Database &db)
Definition: xml2sdb.cpp:281
VOID NTAPI RtlSecondsSince1970ToTime(IN ULONG SecondsSince1970, OUT PLARGE_INTEGER Time)
Definition: time.c:406
#define TAG_OS_PLATFORM
Definition: db.cpp:74
#define TAG_NAME
Definition: vfat.h:547
std::list< InExclude > InExcludes
Definition: xml2sdb.h:167
static PDB pdb
Definition: db.cpp:170
TAGID BeginWriteListTag(PDB pdb, TAG tag)
Definition: xml2sdb.cpp:624
#define TAG_LIBRARY
Definition: sdbtagid.h:164
#define TAG_DATABASE
Definition: db.cpp:83
BOOL WINAPI SdbWriteDWORDTag(PDB pdb, TAG tag, DWORD data)
Definition: sdbwrite.c:182
__u16 time
Definition: mkdosfs.c:366
void WriteString(PDB pdb, TAG tag, const sdbstring &str, bool always=false)
Definition: xml2sdb.cpp:601
bool IsEmptyGuid(const GUID &g)
Definition: xml2sdb.cpp:46
BOOL EndWriteListTag(PDB pdb, TAGID tagid)
Definition: xml2sdb.cpp:629
std::list< Exe > Exes
Definition: xml2sdb.h:227
void WINAPI SdbCloseDatabaseWrite(PDB pdb)
Definition: sdbwrite.c:129
GUID ID
Definition: xml2sdb.h:223
BOOL WINAPI SdbWriteQWORDTag(PDB pdb, TAG tag, QWORD data)
Definition: sdbwrite.c:201
void RandomGuid(GUID &g)
Definition: xml2sdb.cpp:51
void WriteBinary(PDB pdb, TAG tag, const GUID &guid, bool always=false)
Definition: xml2sdb.cpp:589
std::list< Shim > Shims
Definition: xml2sdb.h:168
Definition: services.c:325
#define TAG_TIME
Definition: db.cpp:76
#define TAG_COMPILER_VERSION
Definition: db.cpp:114
static const char szCompilerVersion[]
Definition: xml2sdb.cpp:17
#define TAG_DATABASE_ID
Definition: db.cpp:120
DWORD TAGID
std::list< Flag > Flags
Definition: xml2sdb.h:169
LONGLONG QuadPart
Definition: typedefs.h:112
std::list< Layer > Layers
Definition: xml2sdb.h:226
PDB WINAPI SdbCreateDatabase(LPCWSTR path, PATH_TYPE type)
Definition: sdbwrite.c:104

Referenced by xml_2_db().

◆ WriteBinary() [1/2]

void Database::WriteBinary ( PDB  pdb,
TAG  tag,
const GUID guid,
bool  always = false 
)

Definition at line 589 of file xml2sdb.cpp.

590 {
591  if (always || !IsEmptyGuid(guid))
592  SdbWriteBinaryTag(pdb, tag, (BYTE*)&guid, sizeof(GUID));
593 }
static PDB pdb
Definition: db.cpp:170
BOOL WINAPI SdbWriteBinaryTag(PDB pdb, TAG tag, const BYTE *data, DWORD size)
Definition: sdbwrite.c:273
Definition: ecma_167.h:138
bool IsEmptyGuid(const GUID &g)
Definition: xml2sdb.cpp:46
const GUID * guid
unsigned char BYTE
Definition: mem.h:68

Referenced by Shim::toSdb(), Exe::toSdb(), and toSdb().

◆ WriteBinary() [2/2]

void Database::WriteBinary ( PDB  pdb,
TAG  tag,
const std::vector< BYTE > &  data,
bool  always = false 
)

Definition at line 595 of file xml2sdb.cpp.

596 {
597  if (always || !data.empty())
598  SdbWriteBinaryTag(pdb, tag, data.data(), data.size());
599 }
static PDB pdb
Definition: db.cpp:170
BOOL WINAPI SdbWriteBinaryTag(PDB pdb, TAG tag, const BYTE *data, DWORD size)
Definition: sdbwrite.c:273
Definition: ecma_167.h:138
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ WriteDWord()

void Database::WriteDWord ( PDB  pdb,
TAG  tag,
DWORD  value,
bool  always = false 
)

Definition at line 612 of file xml2sdb.cpp.

613 {
614  if (always || value)
616 }
static PDB pdb
Definition: db.cpp:170
Definition: ecma_167.h:138
BOOL WINAPI SdbWriteDWORDTag(PDB pdb, TAG tag, DWORD data)
Definition: sdbwrite.c:182

Referenced by Data::toSdb(), and MatchingFile::toSdb().

◆ WriteQWord()

void Database::WriteQWord ( PDB  pdb,
TAG  tag,
QWORD  value,
bool  always = false 
)

Definition at line 618 of file xml2sdb.cpp.

619 {
620  if (always || value)
622 }
static PDB pdb
Definition: db.cpp:170
Definition: ecma_167.h:138
BOOL WINAPI SdbWriteQWORDTag(PDB pdb, TAG tag, QWORD data)
Definition: sdbwrite.c:201

Referenced by Flag::toSdb(), and Data::toSdb().

◆ WriteString() [1/2]

void Database::WriteString ( PDB  pdb,
TAG  tag,
const sdbstring str,
bool  always = false 
)

Definition at line 601 of file xml2sdb.cpp.

602 {
603  if (always || !str.empty())
604  SdbWriteStringTag(pdb, tag, (LPCWSTR)str.c_str());
605 }
static PDB pdb
Definition: db.cpp:170
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
Definition: ecma_167.h:138
const WCHAR * str
BOOL WINAPI SdbWriteStringTag(PDB pdb, TAG tag, LPCWSTR string)
Definition: sdbwrite.c:220

Referenced by InExclude::toSdb(), ShimRef::toSdb(), FlagRef::toSdb(), Shim::toSdb(), Flag::toSdb(), Data::toSdb(), Layer::toSdb(), MatchingFile::toSdb(), Exe::toSdb(), toSdb(), and WriteString().

◆ WriteString() [2/2]

void Database::WriteString ( PDB  pdb,
TAG  tag,
const std::string str,
bool  always = false 
)

Definition at line 607 of file xml2sdb.cpp.

608 {
609  WriteString(pdb, tag, sdbstring(str.begin(), str.end()), always);
610 }
static PDB pdb
Definition: db.cpp:170
std::basic_string< WCHAR > sdbstring
Definition: xml2sdb.h:27
Definition: ecma_167.h:138
void WriteString(PDB pdb, TAG tag, const sdbstring &str, bool always=false)
Definition: xml2sdb.cpp:601
const WCHAR * str

Member Data Documentation

◆ Exes

std::list<Exe> Database::Exes

Definition at line 227 of file xml2sdb.h.

Referenced by fromXml(), and toSdb().

◆ ID

GUID Database::ID

Definition at line 223 of file xml2sdb.h.

Referenced by fromXml(), and toSdb().

◆ KnownFlags

std::map<sdbstring, TAGID> Database::KnownFlags
private

Definition at line 232 of file xml2sdb.h.

Referenced by FindFlagTagid(), and InsertFlagTagid().

◆ KnownPatches

std::map<sdbstring, TAGID> Database::KnownPatches
private

Definition at line 231 of file xml2sdb.h.

Referenced by FindPatchTagid(), and InsertPatchTagid().

◆ KnownShims

std::map<sdbstring, TAGID> Database::KnownShims
private

Definition at line 230 of file xml2sdb.h.

Referenced by FindShimTagid(), and InsertShimTagid().

◆ Layers

std::list<Layer> Database::Layers

Definition at line 226 of file xml2sdb.h.

Referenced by fromXml(), and toSdb().

◆ Library

struct Library Database::Library

Definition at line 225 of file xml2sdb.h.

◆ Name

std::string Database::Name

Definition at line 222 of file xml2sdb.h.


The documentation for this struct was generated from the following files: