#include "xml2sdb.h"
#include "sdbpapi.h"
#include "tinyxml2.h"
#include <time.h>
#include <algorithm>
#include <sstream>
Go to the source code of this file.
|
| | C_ASSERT (sizeof(GUID)==16) |
| |
| | C_ASSERT (sizeof(ULONG)==4) |
| |
| | C_ASSERT (sizeof(LARGE_INTEGER)==8) |
| |
| | C_ASSERT (sizeof(WCHAR)==2) |
| |
| | C_ASSERT (sizeof(wchar_t)==2) |
| |
| | C_ASSERT (sizeof(TAG)==2) |
| |
| | C_ASSERT (sizeof(TAGID)==4) |
| |
| VOID NTAPI | RtlSecondsSince1970ToTime (IN ULONG SecondsSince1970, OUT PLARGE_INTEGER Time) |
| |
| DWORD | str_to_enum (const std::string &str, const str_to_flag *table) |
| |
| bool | IsEmptyGuid (const GUID &g) |
| |
| void | RandomGuid (GUID &g) |
| |
| std::string | ToString (XMLHandle node) |
| |
| std::string | ToNodeName (XMLHandle node) |
| |
| std::string | ReadStringNode (XMLHandle dbNode, const char *nodeName) |
| |
| QWORD | ReadQWordNode (XMLHandle dbNode, const char *nodeName) |
| |
| DWORD | ReadDWordNode (XMLHandle dbNode, const char *nodeName) |
| |
| PlatformType | ReadPlatformNode (XMLHandle dbNode, const char *nodeName) |
| |
| unsigned char | char2byte (char hexChar, bool *success=NULL) |
| |
| static bool | StringToGuid (const std::string &str, GUID &guid) |
| |
| bool | ReadGuidNode (XMLHandle dbNode, const char *nodeName, GUID &guid) |
| |
| bool | ReadBinaryNode (XMLHandle dbNode, const char *nodeName, std::vector< BYTE > &data) |
| |
| template<typename T > |
| void | ReadGeneric (XMLHandle dbNode, std::list< T > &result, const char *nodeName) |
| |
| template<typename T > |
| void | ReadGeneric (XMLHandle dbNode, std::list< T > &result, const char *nodeName, PlatformType platform) |
| |
| template<typename T > |
| bool | WriteGeneric (std::list< T > &data, Database &db) |
| |
| static void | InsertTagid (const sdbstring &name, TAGID tagid, std::map< sdbstring, TAGID > &lookup, const char *type) |
| |
| static TAGID | FindTagid (const sdbstring &name, const std::map< sdbstring, TAGID > &lookup) |
| |
◆ C_ASSERT
◆ REG_DWORD
◆ REG_QWORD
◆ REG_SZ
◆ C_ASSERT() [1/7]
◆ C_ASSERT() [2/7]
◆ C_ASSERT() [3/7]
◆ C_ASSERT() [4/7]
◆ C_ASSERT() [5/7]
◆ C_ASSERT() [6/7]
◆ C_ASSERT() [7/7]
◆ char2byte()
◆ FindTagid()
◆ InsertTagid()
◆ IsEmptyGuid()
◆ RandomGuid()
◆ ReadBinaryNode()
Definition at line 262 of file xml2sdb.cpp.
263{
266
269 return false;
270
273 {
275 }
276 return true;
277}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLuint GLsizei GLsizei * length
unsigned char char2byte(char hexChar, bool *success=NULL)
std::string ReadStringNode(XMLHandle dbNode, const char *nodeName)
◆ ReadDWordNode()
◆ ReadGeneric() [1/2]
◆ ReadGeneric() [2/2]
Definition at line 321 of file xml2sdb.cpp.
322{
324 while (
node.ToNode())
325 {
329
330 node =
node.NextSiblingElement(nodeName);
331 }
332}
◆ ReadGuidNode()
◆ ReadPlatformNode()
Definition at line 139 of file xml2sdb.cpp.
140{
146}
DWORD str_to_enum(const std::string &str, const str_to_flag *table)
str_to_flag platform_to_flag[]
Referenced by Exe::fromXml().
◆ ReadQWordNode()
◆ ReadStringNode()
Definition at line 110 of file xml2sdb.cpp.
111{
114 {
115 const char* rawVal =
elem->Attribute(nodeName);
116 if (rawVal)
117 return std::string(rawVal);
118 }
120}
XMLElement * ToElement()
Safe cast to XMLElement. This can return null.
std::string ToString(XMLHandle node)
Referenced by InExclude::fromXml(), ShimRef::fromXml(), FlagRef::fromXml(), Shim::fromXml(), Flag::fromXml(), Data::fromXml(), Layer::fromXml(), MatchingFile::fromXml(), Exe::fromXml(), Database::fromXml(), ReadBinaryNode(), ReadGuidNode(), ReadPlatformNode(), and ReadQWordNode().
◆ RtlSecondsSince1970ToTime()
Definition at line 406 of file time.c.
408{
410}
static PLARGE_INTEGER Time
◆ str_to_enum()
Definition at line 51 of file xml2sdb.cpp.
52{
54 std::istringstream iss(
str);
56 while (std::getline(iss,
item,
','))
57 {
58 std::string trimmedItem =
item;
59 trimmedItem.erase(
remove_if(trimmedItem.begin(), trimmedItem.end(),
isspace), trimmedItem.end());
60 std::transform(trimmedItem.begin(), trimmedItem.end(), trimmedItem.begin(),
::toupper);
62 {
63 if (trimmedItem ==
p->name)
64 {
66 break;
67 }
68 }
69 }
71}
_STLP_INLINE_LOOP _ForwardIter remove_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred)
Referenced by parse_platform(), and ReadPlatformNode().
◆ StringToGuid()
| static bool StringToGuid |
( |
const std::string & |
str, |
|
|
GUID & |
guid |
|
) |
| |
|
static |
Definition at line 163 of file xml2sdb.cpp.
164{
165 const char *lpszGUID =
str.c_str();
168 bool expectBrace = true;
170 {
172 {
173 case 0:
174 if (*lpszGUID != '{')
175 {
177 expectBrace = false;
178 continue;
179 }
180 break;
181
182 case 9:
183 case 14:
184 case 19:
185 case 24:
186 if (*lpszGUID != '-')
187 return false;
188 break;
189
190 case 37:
191 return expectBrace == (*lpszGUID == '}');
192
193 default:
194 {
195 CHAR ch = *lpszGUID, ch2 = lpszGUID[1];
197 bool converted = true;
198
200 if (!converted)
201 return false;
202
204 {
205#ifndef WORDS_BIGENDIAN
206
207
208
209 case 1:
211 break;
212 case 3:
214 break;
215 case 5:
217 break;
218 case 7:
220 lpOut += 4;
221 break;
222
223 case 10:
224 case 15:
226 break;
227 case 12:
228 case 17:
230 lpOut += 2;
231 break;
232#endif
233
234 default:
236 lpOut++;
237 break;
238 }
239
240 lpszGUID++;
242 }
243 }
244
245 lpszGUID++;
247 }
248 return false;
249}
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 const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Referenced by ReadGuidNode().
◆ ToNodeName()
◆ ToString()
◆ WriteGeneric()
◆ GUID_NULL
◆ platform_to_flag
◆ szCompilerVersion