1
0
Fork 0

DBG: updated jansson + resolved issue #279 (database fixed)

This commit is contained in:
Mr. eXoDia 2015-04-17 00:16:24 +02:00
parent f99959124a
commit d70ae9e6b3
7 changed files with 47 additions and 39 deletions

View File

@ -20,6 +20,7 @@
#include <tlhelp32.h>
#include "..\x64_dbg_bridge\bridgemain.h"
#include "jansson\jansson.h"
#include "jansson\jansson_x64dbg.h"
#include "yara\yara.h"
#include "DeviceNameResolver\DeviceNameResolver.h"
#include "handle.h"

View File

@ -152,10 +152,10 @@ void CommentCacheSave(JSON Root)
void CommentCacheLoad(JSON Root)
{
EXCLUSIVE_ACQUIRE(LockBookmarks);
EXCLUSIVE_ACQUIRE(LockComments);
// Inline lambda to parse each JSON entry
auto AddBookmarks = [](const JSON Object, bool Manual)
auto AddComments = [](const JSON Object, bool Manual)
{
size_t i;
JSON value;
@ -201,11 +201,11 @@ void CommentCacheLoad(JSON Root)
// Load user-set comments
if(jsonComments)
AddBookmarks(jsonComments, true);
AddComments(jsonComments, true);
// Load auto-set comments
if(jsonAutoComments)
AddBookmarks(jsonAutoComments, false);
AddComments(jsonAutoComments, false);
}
bool CommentEnum(COMMENTSINFO* List, size_t* Size)

View File

@ -15,18 +15,17 @@
#include "jansson_config.h"
#ifdef __cplusplus
extern "C"
{
extern "C" {
#endif
/* version */
#define JANSSON_MAJOR_VERSION 2
#define JANSSON_MINOR_VERSION 6
#define JANSSON_MINOR_VERSION 7
#define JANSSON_MICRO_VERSION 0
/* Micro version is omitted if it's 0 */
#define JANSSON_VERSION "2.6"
#define JANSSON_VERSION "2.7"
/* Version as a 3-byte hex number, e.g. 0x010201 == 1.2.1. Use this
for numeric comparisons, e.g. #if JANSSON_VERSION_HEX >= ... */
@ -55,8 +54,6 @@ typedef struct json_t
size_t refcount;
} json_t;
typedef json_t* JSON;
#ifndef JANSSON_USING_CMAKE /* disabled if using cmake */
#if JSON_INTEGER_IS_LONG_LONG
#ifdef _WIN32
@ -93,17 +90,6 @@ __declspec(dllimport) json_t* json_stringn(const char* value, size_t len);
__declspec(dllimport) json_t* json_string_nocheck(const char* value);
__declspec(dllimport) json_t* json_stringn_nocheck(const char* value, size_t len);
__declspec(dllimport) json_t* json_integer(json_int_t value);
static JSON_INLINE
json_t* json_hex(json_int_t value)
{
char hexvalue[20];
#ifdef _WIN64
sprintf(hexvalue, "0x%llX", value);
#else //x64
sprintf(hexvalue, "0x%X", value);
#endif //_WIN64
return json_string(hexvalue);
}
__declspec(dllimport) json_t* json_real(double value);
__declspec(dllimport) json_t* json_true(void);
__declspec(dllimport) json_t* json_false(void);
@ -222,21 +208,6 @@ int json_array_insert(json_t* array, size_t ind, json_t* value)
__declspec(dllimport) const char* json_string_value(const json_t* string);
__declspec(dllimport) size_t json_string_length(const json_t* string);
__declspec(dllimport) json_int_t json_integer_value(const json_t* integer);
static JSON_INLINE
json_int_t json_hex_value(const json_t* hex)
{
json_int_t ret;
const char* hexvalue;
hexvalue = json_string_value(hex);
if(!hexvalue)
return 0;
#ifdef _WIN64
sscanf(hexvalue, "0x%llX", &ret);
#else //x64
sscanf(hexvalue, "0x%X", &ret);
#endif //_WIN64
return ret;
}
__declspec(dllimport) double json_real_value(const json_t* real);
__declspec(dllimport) double json_number_value(const json_t* json);
@ -291,7 +262,8 @@ __declspec(dllimport) json_t* json_load_callback(json_load_callback_t callback,
/* encoding */
#define JSON_INDENT(n) ((n) & 0x1F)
#define JSON_MAX_INDENT 0x1F
#define JSON_INDENT(n) ((n) & JSON_MAX_INDENT)
#define JSON_COMPACT 0x20
#define JSON_ENSURE_ASCII 0x40
#define JSON_SORT_KEYS 0x80

View File

@ -0,0 +1,29 @@
typedef json_t* JSON;
static JSON_INLINE
json_t* json_hex(unsigned json_int_t value)
{
char hexvalue[20];
#ifdef _WIN64
sprintf(hexvalue, "0x%llX", value);
#else //x64
sprintf(hexvalue, "0x%X", value);
#endif //_WIN64
return json_string(hexvalue);
}
static JSON_INLINE
unsigned json_int_t json_hex_value(const json_t* hex)
{
unsigned json_int_t ret;
const char* hexvalue;
hexvalue = json_string_value(hex);
if(!hexvalue)
return 0;
#ifdef _WIN64
sscanf(hexvalue, "0x%llX", &ret);
#else //x64
sscanf(hexvalue, "0x%X", &ret);
#endif //_WIN64
return ret;
}

View File

@ -32,6 +32,9 @@ bool ModLoad(uint Base, uint Size, const char* FullPath)
*fileStart = '\0';
}
//calculate module hash from full file name
info.hash = ModHashFromName(file);
// Copy the extension into the module struct
{
char* extensionPos = strrchr(file, '.');
@ -46,8 +49,7 @@ bool ModLoad(uint Base, uint Size, const char* FullPath)
// Copy the name to the module struct
strcpy_s(info.name, file);
// Module base address/size/hash index
info.hash = ModHashFromName(info.name);
// Module base address/size
info.base = Base;
info.size = Size;

View File

@ -91,6 +91,7 @@
<ClInclude Include="instruction.h" />
<ClInclude Include="jansson\jansson.h" />
<ClInclude Include="jansson\jansson_config.h" />
<ClInclude Include="jansson\jansson_x64dbg.h" />
<ClInclude Include="label.h" />
<ClInclude Include="loop.h" />
<ClInclude Include="lz4\lz4.h" />

View File

@ -473,5 +473,8 @@
<ClInclude Include="commandparser.h">
<Filter>Header Files\Core</Filter>
</ClInclude>
<ClInclude Include="jansson\jansson_x64dbg.h">
<Filter>Header Files\Third Party\jansson</Filter>
</ClInclude>
</ItemGroup>
</Project>