ReactOS 0.4.16-dev-106-g10b08aa
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{
627}
static PDB pdb
Definition: db.cpp:172
TAGID WINAPI SdbBeginWriteListTag(PDB pdb, TAG tag)
Definition: sdbwrite.c:321
Definition: ecma_167.h:138

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

◆ EndWriteListTag()

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

Definition at line 629 of file xml2sdb.cpp.

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

Referenced by toSdb(), InExclude::toSdb(), ShimRef::toSdb(), FlagRef::toSdb(), Shim::toSdb(), Flag::toSdb(), Data::toSdb(), Layer::toSdb(), MatchingFile::toSdb(), and Exe::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
Definition: name.c:39
static TAGID FindTagid(const sdbstring &name, const std::map< sdbstring, TAGID > &lookup)
Definition: xml2sdb.cpp:724

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 }
TAGID FindFlagTagid(const sdbstring &name)
Definition: xml2sdb.cpp:759
std::basic_string< WCHAR > sdbstring
Definition: xml2sdb.h:27

◆ 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

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

◆ 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

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

◆ 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
#define err(...)
bool fromXml(const char *fileName)
Definition: xml2sdb.cpp:669

Referenced by fromXml(), and 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}
XMLHandle FirstChild()
Get the first child of this handle.
Definition: tinyxml2.h:1810
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
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
GUID ID
Definition: xml2sdb.h:223
std::list< Exe > Exes
Definition: xml2sdb.h:227
std::list< Layer > Layers
Definition: xml2sdb.h:226
Definition: xml2sdb.h:80
bool fromXml(XMLHandle dbNode)
Definition: xml2sdb.cpp:244
std::list< Shim > Shims
Definition: xml2sdb.h:168
std::list< InExclude > InExcludes
Definition: xml2sdb.h:167
std::list< Flag > Flags
Definition: xml2sdb.h:169
Definition: xml2sdb.h:66
bool fromXml(XMLHandle dbNode)
Definition: xml2sdb.cpp:345
bool ReadGuidNode(XMLHandle dbNode, const char *nodeName, GUID &guid)
Definition: xml2sdb.cpp:211
void ReadGeneric(XMLHandle dbNode, std::list< T > &result, const char *nodeName)
Definition: xml2sdb.cpp:267
std::string ToNodeName(XMLHandle node)
Definition: xml2sdb.cpp:69
std::string ReadStringNode(XMLHandle dbNode, const char *nodeName)
Definition: xml2sdb.cpp:79

◆ 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

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 }
void InsertFlagTagid(const sdbstring &name, TAGID tagid)
Definition: xml2sdb.cpp:754

◆ 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}

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 }
void InsertPatchTagid(const sdbstring &name, TAGID tagid)
Definition: xml2sdb.cpp:744

◆ 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}

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 }
void InsertShimTagid(const sdbstring &name, TAGID tagid)
Definition: xml2sdb.cpp:734

◆ 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}
DWORD TAGID
#define TAG_DATABASE_ID
Definition: db.cpp:122
#define DOS_PATH
Definition: db.cpp:32
#define TAG_COMPILER_VERSION
Definition: db.cpp:116
#define TAG_OS_PLATFORM
Definition: db.cpp:76
#define TAG_DATABASE
Definition: db.cpp:85
#define TAG_TIME
Definition: db.cpp:78
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235
__u16 time
Definition: mkdosfs.c:8
NTSYSAPI VOID NTAPI RtlSecondsSince1970ToTime(_In_ ULONG SecondsSince1970, _Out_ PLARGE_INTEGER Time)
#define SHIM_WARN(fmt,...)
Definition: sdbpapi.h:77
#define TAG_LIBRARY
Definition: sdbtagid.h:164
BOOL WINAPI SdbWriteQWORDTag(PDB pdb, TAG tag, QWORD data)
Definition: sdbwrite.c:201
BOOL WINAPI SdbWriteDWORDTag(PDB pdb, TAG tag, DWORD data)
Definition: sdbwrite.c:182
PDB WINAPI SdbCreateDatabase(LPCWSTR path, PATH_TYPE type)
Definition: sdbwrite.c:104
void WINAPI SdbCloseDatabaseWrite(PDB pdb)
Definition: sdbwrite.c:129
void WriteBinary(PDB pdb, TAG tag, const GUID &guid, bool always=false)
Definition: xml2sdb.cpp:589
BOOL EndWriteListTag(PDB pdb, TAGID tagid)
Definition: xml2sdb.cpp:629
TAGID BeginWriteListTag(PDB pdb, TAG tag)
Definition: xml2sdb.cpp:624
void WriteString(PDB pdb, TAG tag, const sdbstring &str, bool always=false)
Definition: xml2sdb.cpp:601
LONGLONG QuadPart
Definition: typedefs.h:114
#define TAG_NAME
Definition: vfat.h:553
static const char szCompilerVersion[]
Definition: xml2sdb.cpp:17
void RandomGuid(GUID &g)
Definition: xml2sdb.cpp:51
bool WriteGeneric(PDB pdb, std::list< T > &data, Database &db)
Definition: xml2sdb.cpp:281
bool IsEmptyGuid(const GUID &g)
Definition: xml2sdb.cpp:46

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}
const GUID * guid
BOOL WINAPI SdbWriteBinaryTag(PDB pdb, TAG tag, const BYTE *data, DWORD size)
Definition: sdbwrite.c:273
unsigned char BYTE
Definition: xxhash.c:193

Referenced by toSdb(), Shim::toSdb(), and Exe::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}
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}
Definition: pdh_main.c:94

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}

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}
const WCHAR * str
BOOL WINAPI SdbWriteStringTag(PDB pdb, TAG tag, LPCWSTR string)
Definition: sdbwrite.c:220
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by toSdb(), InExclude::toSdb(), ShimRef::toSdb(), FlagRef::toSdb(), Shim::toSdb(), Flag::toSdb(), Data::toSdb(), Layer::toSdb(), MatchingFile::toSdb(), Exe::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}

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: