Subject | Dump blobs from GDB File - Part II |
---|---|
Author | Pierre Y. |
Post date | 2003-09-12T07:28:30Z |
Hello all,
Now I can dump the blobs that are in BLOB Pages even if they are fragmented in two or more pages. But when I look the database file using IB Surgeon, I see that most of my blobs are lesser than the pagefile size so they are stored in "standard" data pages. How can I read a blob stored in a data page ?
I found in the dmp.c file an algorithm to read the data pages but there are no indication on to get the blob datas :
static void dmp_data (register DPG page)
{
/* .... */
for (i = 0, index = page->dpg_rpt; i < page->dpg_count; i++, index++)
{
if (index->dpg_length == 0)
{
ib_fprintf (dbg_file, "\n\t%d - (empty)\n", i);
continue;
}
header = (RHD) ((SCHAR*) page + index->dpg_offset);
fragment = (RHDF) header;
if (header->rhd_flags & rhd_blob)
{
blob = (BLH) header;
ib_fprintf (dbg_file, "\n\t%d - (blob) offset: %d, length: %d, flags: %x\n",
i, index->dpg_offset, index->dpg_length, header->rhd_flags);
ib_fprintf (dbg_file, "\tlevel: %d, lead page: %d, length: %d, count %d\n",
blob->blh_level, blob->blh_lead_page, blob->blh_length,
blob->blh_count);
ib_fprintf (dbg_file, "\tmaxseq: %d, maxseg: %d, flags: %X, sub_type %d\n",
blob->blh_max_sequence, blob->blh_max_segment, blob->blh_flags,
blob->blh_sub_type);
}
/* .... */
}
and when I take a look at blh struct in ods.h I saw :
typedef struct blh {
SLONG blh_lead_page; /* First data page number */
SLONG blh_max_sequence; /* Number of data pages */
USHORT blh_max_segment;/* Longest segment */
USHORT blh_flags;
UCHAR blh_level; /* Number of address levels */
#if (defined PC_PLATFORM && !defined NETWARE_386)
SCHAR blh_fill [3]; /* IMPORTANT! THE SOLE PURPOSE OF THIS FIELD
IS TO INSURE THAT THE SUCCEEDING FIELD IS ALIGNED ON A
4 BYTE BOUNDARY. IT IS NECESSARY BECAUSE THE 16-BIT
COMPILER CANNOT DO THIS ALIGNMENT FOR US. HAVING
THIS FIELD INSURES THAT A PC_PLATFORM DATABASE IS
IDENTICAL TO ONE ON Windows/NT. */
#endif
SLONG blh_count; /* Total number of segments */
SLONG blh_length; /* Total length of data */
USHORT blh_sub_type; /* Blob sub-type */
USHORT blh_unused;
SLONG blh_page [1]; /* Page vector for blob pages */
} *BLH;
but the blh_page array gives a SLONG vector on blobs pages but what mean this vector ?
Can you help me again ?
Really thanks, regards
Pierre Y.
Now I can dump the blobs that are in BLOB Pages even if they are fragmented in two or more pages. But when I look the database file using IB Surgeon, I see that most of my blobs are lesser than the pagefile size so they are stored in "standard" data pages. How can I read a blob stored in a data page ?
I found in the dmp.c file an algorithm to read the data pages but there are no indication on to get the blob datas :
static void dmp_data (register DPG page)
{
/* .... */
for (i = 0, index = page->dpg_rpt; i < page->dpg_count; i++, index++)
{
if (index->dpg_length == 0)
{
ib_fprintf (dbg_file, "\n\t%d - (empty)\n", i);
continue;
}
header = (RHD) ((SCHAR*) page + index->dpg_offset);
fragment = (RHDF) header;
if (header->rhd_flags & rhd_blob)
{
blob = (BLH) header;
ib_fprintf (dbg_file, "\n\t%d - (blob) offset: %d, length: %d, flags: %x\n",
i, index->dpg_offset, index->dpg_length, header->rhd_flags);
ib_fprintf (dbg_file, "\tlevel: %d, lead page: %d, length: %d, count %d\n",
blob->blh_level, blob->blh_lead_page, blob->blh_length,
blob->blh_count);
ib_fprintf (dbg_file, "\tmaxseq: %d, maxseg: %d, flags: %X, sub_type %d\n",
blob->blh_max_sequence, blob->blh_max_segment, blob->blh_flags,
blob->blh_sub_type);
}
/* .... */
}
and when I take a look at blh struct in ods.h I saw :
typedef struct blh {
SLONG blh_lead_page; /* First data page number */
SLONG blh_max_sequence; /* Number of data pages */
USHORT blh_max_segment;/* Longest segment */
USHORT blh_flags;
UCHAR blh_level; /* Number of address levels */
#if (defined PC_PLATFORM && !defined NETWARE_386)
SCHAR blh_fill [3]; /* IMPORTANT! THE SOLE PURPOSE OF THIS FIELD
IS TO INSURE THAT THE SUCCEEDING FIELD IS ALIGNED ON A
4 BYTE BOUNDARY. IT IS NECESSARY BECAUSE THE 16-BIT
COMPILER CANNOT DO THIS ALIGNMENT FOR US. HAVING
THIS FIELD INSURES THAT A PC_PLATFORM DATABASE IS
IDENTICAL TO ONE ON Windows/NT. */
#endif
SLONG blh_count; /* Total number of segments */
SLONG blh_length; /* Total length of data */
USHORT blh_sub_type; /* Blob sub-type */
USHORT blh_unused;
SLONG blh_page [1]; /* Page vector for blob pages */
} *BLH;
but the blh_page array gives a SLONG vector on blobs pages but what mean this vector ?
Can you help me again ?
Really thanks, regards
Pierre Y.