#include "xml2sdb.h"
#include "sdbpapi.h"
#include "sdbstringtable.h"
#include <time.h>
#include <stdio.h>
#include <stdarg.h>
Go to the source code of this file.
|
| LPVOID WINAPI | SdbpAlloc (SIZE_T size) |
| |
| LPVOID WINAPI | SdbpReAlloc (LPVOID mem, SIZE_T size, SIZE_T oldSize) |
| |
| void WINAPI | SdbpFree (LPVOID mem) |
| |
| DWORD | SdbpStrlen (PCWSTR string) |
| |
| DWORD WINAPI | SdbpStrsize (PCWSTR string) |
| |
| PDB WINAPI | SdbpCreate (LPCWSTR path, PATH_TYPE type, BOOL write) |
| |
| void WINAPI | SdbpFlush (PDB pdb) |
| |
| void WINAPI | SdbCloseDatabase (PDB pdb) |
| |
| BOOL WINAPI | SdbpCheckTagType (TAG tag, WORD type) |
| |
| BOOL WINAPI | SdbpReadData (PDB pdb, PVOID dest, DWORD offset, DWORD num) |
| |
| TAG WINAPI | SdbGetTagFromTagID (PDB pdb, TAGID tagid) |
| |
| BOOL WINAPI | SdbpCheckTagIDType (PDB pdb, TAGID tagid, WORD type) |
| |
| BOOL WINAPIV | ShimDbgPrint (SHIM_LOG_LEVEL Level, PCSTR FunctionName, PCSTR Format,...) |
| |
| VOID NTAPI | RtlSecondsSince1970ToTime (IN ULONG SecondsSince1970, OUT PLARGE_INTEGER Time) |
| |
| static bool | convert (const std::string &input, const std::string &output, PlatformType platform) |
| |
| static std::string | get_strarg (int argc, char *argv[], int &i) |
| |
| static void | update_loglevel (int argc, char *argv[], int &i) |
| |
| static PlatformType | parse_platform (const std::string &input) |
| |
| int | main (int argc, char *argv[]) |
| |
◆ TICKSPERSEC
◆ TICKSTO1970
| #define TICKSTO1970 0x019db1ded53e8000i64 |
◆ convert()
Definition at line 177 of file main.cpp.
178{
179 sdbstring outputW(output.begin(), output.end());
182 {
183 printf(
"Failed to read XML file '%s'\n",
input.c_str());
184 return false;
185 }
186 if (!db.
toSdb(outputW.c_str()))
187 {
188 printf(
"Failed to write SDB file '%s'\n", output.c_str());
189 return false;
190 }
191 return true;
192}
GLenum GLenum GLenum input
bool fromXml(const char *fileName, PlatformType platform)
std::basic_string< WCHAR > sdbstring
◆ get_strarg()
| static std::string get_strarg |
( |
int |
argc, |
|
|
char * |
argv[], |
|
|
int & |
i |
|
) |
| |
|
static |
Definition at line 194 of file main.cpp.
195{
197 return std::string(
argv[
i] + 2);
198
201 return std::string();
203}
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 main(), and update_loglevel().
◆ main()
Definition at line 217 of file main.cpp.
218{
219 std::string
input, output;
222
224 {
226 continue;
227
229 {
230 case 'i':
232 break;
233 case 'o':
235 break;
236 case 'l':
238 break;
239 case 'p':
241 break;
242 }
243 }
244 if (
input.empty() || output.empty())
245 {
246 printf(
"Usage: %s -i <input.xml> -o <output.sdb> [-l <loglevel>] [-v <version>]\n",
argv[0]);
247 printf(
" -i <input.xml> : Input XML file to convert\n");
248 printf(
" -o <output.sdb> : Output SDB file to create\n");
249 printf(
" -l <loglevel> : Set log level (1=ERR, 2=WARN, 3=INFO)\n");
250 printf(
" -p <platform> : Set the runtime platform (X86, AMD64, ANY)\n");
251 return 1;
252 }
253
255 {
256 printf(
"Failed converting '%s' to '%s'\n",
input.c_str(), output.c_str());
257 return 1;
258 }
259 return 0;
260}
void __cdecl srand(_In_ unsigned int _Seed)
static void update_loglevel(int argc, char *argv[], int &i)
static std::string get_strarg(int argc, char *argv[], int &i)
static PlatformType parse_platform(const std::string &input)
◆ parse_platform()
Definition at line 212 of file main.cpp.
213{
215}
DWORD str_to_enum(const std::string &str, const str_to_flag *table)
str_to_flag platform_to_flag[]
Referenced by main().
◆ RtlSecondsSince1970ToTime()
Definition at line 167 of file main.cpp.
169{
171}
static PLARGE_INTEGER Time
◆ SdbCloseDatabase()
◆ SdbGetTagFromTagID()
Searches shim database for the tag associated with specified tagid.
- Parameters
-
| [in] | pdb | Handle to the shim database. |
| [in] | tagid | The TAGID of the tag. |
- Returns
- Success: The tag associated with specified tagid, Failure: TAG_NULL.
Definition at line 114 of file main.cpp.
115{
120}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
BOOL WINAPI SdbpReadData(PDB pdb, PVOID dest, DWORD offset, DWORD num)
Referenced by SdbpCheckTagIDType(), and SdbpMatchFileAttributes().
◆ SdbpAlloc()
Definition at line 19 of file main.cpp.
20{
21 return ::calloc(1,
size);
22}
◆ SdbpCheckTagIDType()
Definition at line 122 of file main.cpp.
123{
128}
GLuint GLuint GLsizei GLenum type
BOOL WINAPI SdbpCheckTagType(TAG tag, WORD type)
TAG WINAPI SdbGetTagFromTagID(PDB pdb, TAGID tagid)
◆ SdbpCheckTagType()
◆ SdbpCreate()
Definition at line 52 of file main.cpp.
53{
57
61
65
67}
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
DWORD SdbpStrlen(PCWSTR string)
◆ SdbpFlush()
◆ SdbpFree()
◆ SdbpReadData()
◆ SdbpReAlloc()
Definition at line 24 of file main.cpp.
25{
27 if (newMem &&
size > oldSize)
28 {
30 }
31 return newMem;
32}
◆ SdbpStrlen()
◆ SdbpStrsize()
◆ ShimDbgPrint()
Outputs diagnostic info.
- Parameters
-
| [in] | Level | The level to log this message with, choose any of [SHIM_ERR, SHIM_WARN, SHIM_INFO]. |
| [in] | FunctionName | The function this log should be attributed to. |
| [in] | Format | The format string. |
| ... | Variable arguments providing additional information. |
- Returns
- Success: TRUE Failure: FALSE.
Definition at line 130 of file main.cpp.
131{
133 const char* LevelStr;
134
137
139 {
141 LevelStr = "Err ";
142 break;
144 LevelStr = "Warn";
145 break;
147 LevelStr = "Info";
148 break;
149 default:
150 LevelStr = "User";
151 break;
152 }
158}
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char * FunctionName
_Check_return_opt_ _CRTIMP int __cdecl vprintf(_In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
#define SHIM_INFO(fmt,...)
#define SHIM_WARN(fmt,...)
#define SHIM_ERR(fmt,...)
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
◆ update_loglevel()
Definition at line 205 of file main.cpp.
206{
209}
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
Referenced by main().
◆ g_ShimDebugLevel