Fix #2532 - PDB parsing

This commit is contained in:
Jeff Muizelaar 2015-05-09 17:43:51 +03:00 committed by pancake
parent 0697103f7d
commit 126f92b650
1 changed files with 70 additions and 0 deletions

View File

@ -135,6 +135,14 @@ static void get_sval_name(SVal *val, char **name)
// strcpy(name, scstr->name);
} else {
switch (val->value_or_type) {
case eLF_CHAR:
{
SVal_LF_CHAR *lf_char;
lf_char = (SVal_LF_CHAR *) val->name_or_val;
*name = lf_char->name.name;
// strcpy(name, lf_uchar->name.name);
break;
}
case eLF_ULONG:
{
SVal_LF_ULONG *lf_ulong;
@ -143,6 +151,14 @@ static void get_sval_name(SVal *val, char **name)
// strcpy(name, lf_ulong->name.name);
break;
}
case eLF_LONG:
{
SVal_LF_LONG *lf_long;
lf_long = (SVal_LF_LONG *) val->name_or_val;
*name = lf_long->name.name;
// strcpy(name, lf_long->name.name);
break;
}
case eLF_USHORT:
{
SVal_LF_USHORT *lf_ushort;
@ -579,6 +595,13 @@ static void get_sval_val(SVal *val, int *res)
*res = lf_ulong->value;
break;
}
case eLF_LONG:
{
SVal_LF_LONG *lf_long;
lf_long = (SVal_LF_LONG *) val->name_or_val;
*res = lf_long->value;
break;
}
case eLF_USHORT:
{
SVal_LF_USHORT *lf_ushort;
@ -586,6 +609,14 @@ static void get_sval_val(SVal *val, int *res)
*res = lf_ushort->value;
break;
}
case eLF_CHAR:
{
SVal_LF_CHAR *lf_char;
lf_char = (SVal_LF_CHAR *) val->name_or_val;
*res = lf_char->value;
break;
}
default:
*res = 0;
printf("get_sval_val::oops\n");
@ -856,6 +887,14 @@ static void free_sval(SVal *val)
R_FREE(val->name_or_val);
break;
}
case eLF_LONG:
{
SVal_LF_LONG *lf_long;
lf_long = (SVal_LF_LONG *) val->name_or_val;
R_FREE(lf_long->name.name);
R_FREE(val->name_or_val);
break;
}
case eLF_USHORT:
{
SVal_LF_USHORT *lf_ushort;
@ -864,6 +903,14 @@ static void free_sval(SVal *val)
R_FREE(val->name_or_val);
break;
}
case eLF_CHAR:
{
SVal_LF_CHAR *lf_char;
lf_char = (SVal_LF_CHAR *) val->name_or_val;
R_FREE(lf_char->name.name);
R_FREE(val->name_or_val);
break;
}
default:
printf("free_sval()::not supproted type\n");
break;
@ -1520,6 +1567,29 @@ static int parse_sval(SVal *val, unsigned char *leaf_data, unsigned int *read_by
val->name_or_val = sctr;
} else {
switch (val->value_or_type) {
case eLF_CHAR:
{
SVal_LF_CHAR lf_char;
READ(*read_bytes, 2, len, lf_char.value, leaf_data, char);
parse_sctring(&lf_char.name, leaf_data, read_bytes, len);
val->name_or_val = malloc(sizeof(SVal_LF_CHAR));
memcpy(val->name_or_val, &lf_char, sizeof(SVal_LF_CHAR));
break;
}
case eLF_LONG:
{
SVal_LF_LONG lf_long;
lf_long.value = 0;
// long = 4 bytes for Windows, but not in Linux x64,
// so here is using int instead of long when
// reading long value
READ(*read_bytes, 4, len, lf_long.value, leaf_data, int);
parse_sctring(&lf_long.name, leaf_data, read_bytes, len);
val->name_or_val = malloc(sizeof(SVal_LF_LONG));
memcpy(val->name_or_val, &lf_long, sizeof(SVal_LF_LONG));
break;
}
case eLF_ULONG:
{
SVal_LF_ULONG lf_ulong;