comparison src/libpst.c @ 167:40e9de445038

improve consistency checking when fetching items from the pst file. avoid putting mixed item types into the same output folder.
author Carl Byington <carl@five-ten-sg.com>
date Wed, 18 Mar 2009 22:31:18 -0700
parents ab384fed78c5
children c1a2fd06ffe6
comparison
equal deleted inserted replaced
166:55d4f17a35f2 167:40e9de445038
415 size = pst_ff_getID2data(pf, ptr, &h); 415 size = pst_ff_getID2data(pf, ptr, &h);
416 } else { 416 } else {
417 DEBUG_WARN(("Couldn't find ID pointer. Cannot handle attachment\n")); 417 DEBUG_WARN(("Couldn't find ID pointer. Cannot handle attachment\n"));
418 size = 0; 418 size = 0;
419 } 419 }
420 attach->size = size; 420 attach->data.size = size;
421 } else { 421 } else {
422 size = attach->size; 422 size = attach->data.size;
423 } 423 }
424 DEBUG_RET(); 424 DEBUG_RET();
425 return size; 425 return size;
426 } 426 }
427 427
436 if (ptr) { 436 if (ptr) {
437 size = pst_ff_getID2data(pf, ptr, &h); 437 size = pst_ff_getID2data(pf, ptr, &h);
438 } else { 438 } else {
439 DEBUG_WARN(("Couldn't find ID pointer. Cannot save attachment to file\n")); 439 DEBUG_WARN(("Couldn't find ID pointer. Cannot save attachment to file\n"));
440 } 440 }
441 attach->size = size; 441 attach->data.size = size;
442 } else { 442 } else {
443 // save the attachment to the file 443 // save the attachment to the file
444 size = attach->size; 444 size = attach->data.size;
445 (void)pst_fwrite(attach->data, (size_t)1, size, fp); 445 (void)pst_fwrite(attach->data.data, (size_t)1, size, fp);
446 } 446 }
447 DEBUG_RET(); 447 DEBUG_RET();
448 return size; 448 return size;
449 } 449 }
450 450
459 if (ptr) { 459 if (ptr) {
460 size = pst_ff_getID2data(pf, ptr, &h); 460 size = pst_ff_getID2data(pf, ptr, &h);
461 } else { 461 } else {
462 DEBUG_WARN(("Couldn't find ID pointer. Cannot save attachment to Base64\n")); 462 DEBUG_WARN(("Couldn't find ID pointer. Cannot save attachment to Base64\n"));
463 } 463 }
464 attach->size = size; 464 attach->data.size = size;
465 } else { 465 } else {
466 // encode the attachment to the file 466 // encode the attachment to the file
467 char *c = base64_encode(attach->data, attach->size); 467 char *c = base64_encode(attach->data.data, attach->data.size);
468 if (c) { 468 if (c) {
469 (void)pst_fwrite(c, (size_t)1, strlen(c), fp); 469 (void)pst_fwrite(c, (size_t)1, strlen(c), fp);
470 free(c); // caught by valgrind 470 free(c); // caught by valgrind
471 } 471 }
472 size = attach->size; 472 size = attach->data.size;
473 } 473 }
474 DEBUG_RET(); 474 DEBUG_RET();
475 return size; 475 return size;
476 } 476 }
477 477
1709 1709
1710 1710
1711 // This version of free does NULL check first 1711 // This version of free does NULL check first
1712 #define SAFE_FREE(x) {if (x) free(x);} 1712 #define SAFE_FREE(x) {if (x) free(x);}
1713 #define SAFE_FREE_STR(x) SAFE_FREE(x.str) 1713 #define SAFE_FREE_STR(x) SAFE_FREE(x.str)
1714 #define SAFE_FREE_BIN(x) SAFE_FREE(x.data)
1714 1715
1715 // check if item->email is NULL, and init if so 1716 // check if item->email is NULL, and init if so
1716 #define MALLOC_EMAIL(x) { if (!x->email) { x->email = (pst_item_email*) xmalloc(sizeof(pst_item_email)); memset(x->email, 0, sizeof(pst_item_email) );} } 1717 #define MALLOC_EMAIL(x) { if (!x->email) { x->email = (pst_item_email*) xmalloc(sizeof(pst_item_email)); memset(x->email, 0, sizeof(pst_item_email) );} }
1717 #define MALLOC_FOLDER(x) { if (!x->folder) { x->folder = (pst_item_folder*) xmalloc(sizeof(pst_item_folder)); memset(x->folder, 0, sizeof(pst_item_folder) );} } 1718 #define MALLOC_FOLDER(x) { if (!x->folder) { x->folder = (pst_item_folder*) xmalloc(sizeof(pst_item_folder)); memset(x->folder, 0, sizeof(pst_item_folder) );} }
1718 #define MALLOC_CONTACT(x) { if (!x->contact) { x->contact = (pst_item_contact*) xmalloc(sizeof(pst_item_contact)); memset(x->contact, 0, sizeof(pst_item_contact) );} } 1719 #define MALLOC_CONTACT(x) { if (!x->contact) { x->contact = (pst_item_contact*) xmalloc(sizeof(pst_item_contact)); memset(x->contact, 0, sizeof(pst_item_contact) );} }
1719 #define MALLOC_MESSAGESTORE(x) { if (!x->message_store) { x->message_store = (pst_item_message_store*) xmalloc(sizeof(pst_item_message_store)); memset(x->message_store, 0, sizeof(pst_item_message_store));} } 1720 #define MALLOC_MESSAGESTORE(x) { if (!x->message_store) { x->message_store = (pst_item_message_store*) xmalloc(sizeof(pst_item_message_store)); memset(x->message_store, 0, sizeof(pst_item_message_store));} }
1720 #define MALLOC_JOURNAL(x) { if (!x->journal) { x->journal = (pst_item_journal*) xmalloc(sizeof(pst_item_journal)); memset(x->journal, 0, sizeof(pst_item_journal) );} } 1721 #define MALLOC_JOURNAL(x) { if (!x->journal) { x->journal = (pst_item_journal*) xmalloc(sizeof(pst_item_journal)); memset(x->journal, 0, sizeof(pst_item_journal) );} }
1721 #define MALLOC_APPOINTMENT(x) { if (!x->appointment) { x->appointment = (pst_item_appointment*) xmalloc(sizeof(pst_item_appointment)); memset(x->appointment, 0, sizeof(pst_item_appointment) );} } 1722 #define MALLOC_APPOINTMENT(x) { if (!x->appointment) { x->appointment = (pst_item_appointment*) xmalloc(sizeof(pst_item_appointment)); memset(x->appointment, 0, sizeof(pst_item_appointment) );} }
1722 1723
1723 // malloc space and copy the current item's data null terminated 1724 // malloc space and copy the current item's data null terminated
1724 #define LIST_COPY(targ, type) { \ 1725 #define LIST_COPY(targ, type) { \
1725 targ = type realloc(targ, list->elements[x]->size+1); \ 1726 targ = type realloc(targ, list->elements[x]->size+1); \
1726 memcpy(targ, list->elements[x]->data, list->elements[x]->size); \ 1727 memcpy(targ, list->elements[x]->data, list->elements[x]->size);\
1727 memset(((char*)targ)+list->elements[x]->size, 0, (size_t)1); \ 1728 memset(((char*)targ)+list->elements[x]->size, 0, (size_t)1); \
1728 } 1729 }
1729 1730
1730 #define LIST_COPY_BOOL(label, targ) { \ 1731 #define LIST_COPY_CSTR(targ) { \
1731 if (*(int16_t*)list->elements[x]->data) { \ 1732 if ((list->elements[x]->type == 0x1f) || \
1732 DEBUG_EMAIL((label" - True\n")); \ 1733 (list->elements[x]->type == 0x1e) || \
1733 targ = 1; \ 1734 (list->elements[x]->type == 0x102)) { \
1734 } else { \ 1735 LIST_COPY(targ, (char*)) \
1735 DEBUG_EMAIL((label" - False\n")); \ 1736 } \
1736 targ = 0; \ 1737 else { \
1737 } \ 1738 DEBUG_EMAIL(("src not 0x1e or 0x1f or 0x102 for string dst\n")); \
1739 DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); \
1740 SAFE_FREE(targ); \
1741 targ = NULL; \
1742 } \
1743 }
1744
1745 #define LIST_COPY_BOOL(label, targ) { \
1746 if (list->elements[x]->type != 0x0b) { \
1747 DEBUG_EMAIL(("src not 0x0b for boolean dst\n")); \
1748 DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); \
1749 } \
1750 if (*(int16_t*)list->elements[x]->data) { \
1751 DEBUG_EMAIL((label" - True\n")); \
1752 targ = 1; \
1753 } else { \
1754 DEBUG_EMAIL((label" - False\n")); \
1755 targ = 0; \
1756 } \
1738 } 1757 }
1739 1758
1740 #define LIST_COPY_EMAIL_BOOL(label, targ) { \ 1759 #define LIST_COPY_EMAIL_BOOL(label, targ) { \
1741 MALLOC_EMAIL(item); \ 1760 MALLOC_EMAIL(item); \
1742 LIST_COPY_BOOL(label, targ) \ 1761 LIST_COPY_BOOL(label, targ) \
1750 #define LIST_COPY_APPT_BOOL(label, targ) { \ 1769 #define LIST_COPY_APPT_BOOL(label, targ) { \
1751 MALLOC_APPOINTMENT(item); \ 1770 MALLOC_APPOINTMENT(item); \
1752 LIST_COPY_BOOL(label, targ) \ 1771 LIST_COPY_BOOL(label, targ) \
1753 } 1772 }
1754 1773
1755 #define LIST_COPY_INT16_N(label, targ) { \ 1774 #define LIST_COPY_INT16_N(targ) { \
1756 memcpy(&(targ), list->elements[x]->data, sizeof(targ)); \ 1775 if (list->elements[x]->type != 0x02) { \
1757 LE16_CPU(targ); \ 1776 DEBUG_EMAIL(("src not 0x02 for int16 dst\n")); \
1777 DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); \
1778 } \
1779 memcpy(&(targ), list->elements[x]->data, sizeof(targ)); \
1780 LE16_CPU(targ); \
1758 } 1781 }
1759 1782
1760 #define LIST_COPY_INT16(label, targ) { \ 1783 #define LIST_COPY_INT16(label, targ) { \
1761 LIST_COPY_INT16_N(label, targ); \ 1784 LIST_COPY_INT16_N(targ); \
1762 DEBUG_EMAIL((label" - %i %#x\n", (int)targ, (int)targ)); \ 1785 DEBUG_EMAIL((label" - %i %#x\n", (int)targ, (int)targ)); \
1763 } 1786 }
1764 1787
1765 #define LIST_COPY_INT32_N(label, targ) { \ 1788 #define LIST_COPY_INT32_N(targ) { \
1766 memcpy(&(targ), list->elements[x]->data, sizeof(targ)); \ 1789 if (list->elements[x]->type != 0x03) { \
1767 LE32_CPU(targ); \ 1790 DEBUG_EMAIL(("src not 0x03 for int32 dst\n")); \
1791 DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); \
1792 } \
1793 memcpy(&(targ), list->elements[x]->data, sizeof(targ)); \
1794 LE32_CPU(targ); \
1768 } 1795 }
1769 1796
1770 #define LIST_COPY_INT32(label, targ) { \ 1797 #define LIST_COPY_INT32(label, targ) { \
1771 LIST_COPY_INT32_N(label, targ); \ 1798 LIST_COPY_INT32_N(targ); \
1772 DEBUG_EMAIL((label" - %i %#x\n", (int)targ, (int)targ)); \ 1799 DEBUG_EMAIL((label" - %i %#x\n", (int)targ, (int)targ)); \
1773 } 1800 }
1774 1801
1775 #define LIST_COPY_EMAIL_INT32(label, targ) { \ 1802 #define LIST_COPY_EMAIL_INT32(label, targ) { \
1776 MALLOC_EMAIL(item); \ 1803 MALLOC_EMAIL(item); \
1792 LIST_COPY_INT32(label, targ); \ 1819 LIST_COPY_INT32(label, targ); \
1793 } 1820 }
1794 1821
1795 #define LIST_COPY_ENUM(label, targ, delta, count, ...) { \ 1822 #define LIST_COPY_ENUM(label, targ, delta, count, ...) { \
1796 char *tlabels[] = {__VA_ARGS__}; \ 1823 char *tlabels[] = {__VA_ARGS__}; \
1797 LIST_COPY_INT32_N(label, targ); \ 1824 LIST_COPY_INT32_N(targ); \
1798 targ += delta; \ 1825 targ += delta; \
1799 DEBUG_EMAIL((label" - %s [%i]\n", \ 1826 DEBUG_EMAIL((label" - %s [%i]\n", \
1800 (((int)targ < 0) || ((int)targ >= count)) \ 1827 (((int)targ < 0) || ((int)targ >= count)) \
1801 ? "**invalid" \ 1828 ? "**invalid" \
1802 : tlabels[(int)targ], (int)targ)); \ 1829 : tlabels[(int)targ], (int)targ)); \
1812 LIST_COPY_ENUM(label, targ, delta, count, __VA_ARGS__); \ 1839 LIST_COPY_ENUM(label, targ, delta, count, __VA_ARGS__); \
1813 } 1840 }
1814 1841
1815 #define LIST_COPY_ENUM16(label, targ, delta, count, ...) { \ 1842 #define LIST_COPY_ENUM16(label, targ, delta, count, ...) { \
1816 char *tlabels[] = {__VA_ARGS__}; \ 1843 char *tlabels[] = {__VA_ARGS__}; \
1817 LIST_COPY_INT16_N(label, targ); \ 1844 LIST_COPY_INT16_N(targ); \
1818 targ += delta; \ 1845 targ += delta; \
1819 DEBUG_EMAIL((label" - %s [%i]\n", \ 1846 DEBUG_EMAIL((label" - %s [%i]\n", \
1820 (((int)targ < 0) || ((int)targ >= count)) \ 1847 (((int)targ < 0) || ((int)targ >= count)) \
1821 ? "**invalid" \ 1848 ? "**invalid" \
1822 : tlabels[(int)targ], (int)targ)); \ 1849 : tlabels[(int)targ], (int)targ)); \
1826 MALLOC_CONTACT(item); \ 1853 MALLOC_CONTACT(item); \
1827 LIST_COPY_ENUM16(label, targ, delta, count, __VA_ARGS__); \ 1854 LIST_COPY_ENUM16(label, targ, delta, count, __VA_ARGS__); \
1828 } 1855 }
1829 1856
1830 #define LIST_COPY_ENTRYID(label, targ) { \ 1857 #define LIST_COPY_ENTRYID(label, targ) { \
1831 MALLOC_MESSAGESTORE(item); \
1832 LIST_COPY(targ, (pst_entryid*)); \ 1858 LIST_COPY(targ, (pst_entryid*)); \
1833 LE32_CPU(targ->u1); \ 1859 LE32_CPU(targ->u1); \
1834 LE32_CPU(targ->id); \ 1860 LE32_CPU(targ->id); \
1835 DEBUG_EMAIL((label" u1=%#x, id=%#x\n", targ->u1, targ->id));\ 1861 DEBUG_EMAIL((label" u1=%#x, id=%#x\n", targ->u1, targ->id));\
1836 } 1862 }
1847 1873
1848 1874
1849 // malloc space and copy the current item's data null terminated 1875 // malloc space and copy the current item's data null terminated
1850 // including the utf8 flag 1876 // including the utf8 flag
1851 #define LIST_COPY_STR(label, targ) { \ 1877 #define LIST_COPY_STR(label, targ) { \
1852 LIST_COPY(targ.str, (char*)); \ 1878 LIST_COPY_CSTR(targ.str); \
1853 targ.is_utf8 = (list->elements[x]->type == 0x1f) ? 1 : 0; \ 1879 targ.is_utf8 = (list->elements[x]->type == 0x1f) ? 1 : 0; \
1854 DEBUG_EMAIL((label" - unicode %d - %s\n", targ.is_utf8, targ.str)); \ 1880 DEBUG_EMAIL((label" - unicode %d - %s\n", targ.is_utf8, targ.str)); \
1855 } 1881 }
1856 1882
1857 #define LIST_COPY_EMAIL_STR(label, targ) { \ 1883 #define LIST_COPY_EMAIL_STR(label, targ) { \
1858 MALLOC_EMAIL(item); \ 1884 MALLOC_EMAIL(item); \
1873 MALLOC_JOURNAL(item); \ 1899 MALLOC_JOURNAL(item); \
1874 LIST_COPY_STR(label, targ); \ 1900 LIST_COPY_STR(label, targ); \
1875 } 1901 }
1876 1902
1877 // malloc space and copy the item filetime 1903 // malloc space and copy the item filetime
1878 #define LIST_COPY_TIME(label, targ) { \ 1904 #define LIST_COPY_TIME(label, targ) { \
1879 targ = (FILETIME*) realloc(targ, sizeof(FILETIME)); \ 1905 if (list->elements[x]->type != 0x40) { \
1880 memcpy(targ, list->elements[x]->data, list->elements[x]->size); \ 1906 DEBUG_EMAIL(("src not 0x40 for filetime dst\n")); \
1881 LE32_CPU(targ->dwLowDateTime); \ 1907 DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); \
1882 LE32_CPU(targ->dwHighDateTime); \ 1908 } \
1883 DEBUG_EMAIL((label" - %s", fileTimeToAscii(targ))); \ 1909 targ = (FILETIME*) realloc(targ, sizeof(FILETIME)); \
1910 memcpy(targ, list->elements[x]->data, list->elements[x]->size); \
1911 LE32_CPU(targ->dwLowDateTime); \
1912 LE32_CPU(targ->dwHighDateTime); \
1913 DEBUG_EMAIL((label" - %s", fileTimeToAscii(targ))); \
1884 } 1914 }
1885 1915
1886 #define LIST_COPY_EMAIL_TIME(label, targ) { \ 1916 #define LIST_COPY_EMAIL_TIME(label, targ) { \
1887 MALLOC_EMAIL(item); \ 1917 MALLOC_EMAIL(item); \
1888 LIST_COPY_TIME(label, targ); \ 1918 LIST_COPY_TIME(label, targ); \
1902 MALLOC_JOURNAL(item); \ 1932 MALLOC_JOURNAL(item); \
1903 LIST_COPY_TIME(label, targ); \ 1933 LIST_COPY_TIME(label, targ); \
1904 } 1934 }
1905 1935
1906 // malloc space and copy the current item's data and size 1936 // malloc space and copy the current item's data and size
1907 #define LIST_COPY_SIZE(targ, type, mysize) { \ 1937 #define LIST_COPY_BIN(targ) { \
1908 mysize = list->elements[x]->size; \ 1938 targ.size = list->elements[x]->size; \
1909 if (mysize) { \ 1939 if (targ.size) { \
1910 targ = type realloc(targ, mysize); \ 1940 targ.data = (char*)realloc(targ.data, targ.size); \
1911 memcpy(targ, list->elements[x]->data, mysize); \ 1941 memcpy(targ.data, list->elements[x]->data, targ.size); \
1912 } \ 1942 } \
1913 else { \ 1943 else { \
1914 SAFE_FREE(targ); \ 1944 SAFE_FREE_BIN(targ); \
1915 targ = NULL; \ 1945 targ.data = NULL; \
1916 } \ 1946 } \
1917 } 1947 }
1918 1948
1919 #define LIST_COPY_EMAIL_SIZE(label, targ, mysize) { \ 1949 #define LIST_COPY_EMAIL_BIN(label, targ) { \
1920 MALLOC_EMAIL(item); \ 1950 MALLOC_EMAIL(item); \
1921 LIST_COPY_SIZE(targ, (char*), mysize); \ 1951 LIST_COPY_BIN(targ); \
1922 DEBUG_EMAIL((label"\n")); \ 1952 DEBUG_EMAIL((label"\n")); \
1923 } 1953 }
1924 1954
1925 #define NULL_CHECK(x) { if (!x) { DEBUG_EMAIL(("NULL_CHECK: Null Found\n")); break;} } 1955 #define NULL_CHECK(x) { if (!x) { DEBUG_EMAIL(("NULL_CHECK: Null Found\n")); break;} }
1926 1956
1955 // check here to see if the id is one that is mapped. 1985 // check here to see if the id is one that is mapped.
1956 DEBUG_EMAIL(("#%d - mapi-id: %#x type: %#x length: %#x\n", x, list->elements[x]->mapi_id, list->elements[x]->type, list->elements[x]->size)); 1986 DEBUG_EMAIL(("#%d - mapi-id: %#x type: %#x length: %#x\n", x, list->elements[x]->mapi_id, list->elements[x]->type, list->elements[x]->size));
1957 1987
1958 switch (list->elements[x]->mapi_id) { 1988 switch (list->elements[x]->mapi_id) {
1959 case PST_ATTRIB_HEADER: // CUSTOM attribute for saying the Extra Headers 1989 case PST_ATTRIB_HEADER: // CUSTOM attribute for saying the Extra Headers
1960 if (list->elements[x]->extra) { 1990 if ((list->elements[x]->extra) &&
1991 ((list->elements[x]->type == 0x1f) ||
1992 (list->elements[x]->type == 0x1e))) {
1961 ef = (pst_item_extra_field*) xmalloc(sizeof(pst_item_extra_field)); 1993 ef = (pst_item_extra_field*) xmalloc(sizeof(pst_item_extra_field));
1962 memset(ef, 0, sizeof(pst_item_extra_field)); 1994 memset(ef, 0, sizeof(pst_item_extra_field));
1963 ef->field_name = (char*) xmalloc(strlen(list->elements[x]->extra)+1); 1995 ef->field_name = (char*) xmalloc(strlen(list->elements[x]->extra)+1);
1964 strcpy(ef->field_name, list->elements[x]->extra); 1996 strcpy(ef->field_name, list->elements[x]->extra);
1965 LIST_COPY(ef->value, (char*)); 1997 LIST_COPY_CSTR(ef->value);
1966 ef->next = item->extra_fields; 1998 ef->next = item->extra_fields;
1967 item->extra_fields = ef; 1999 item->extra_fields = ef;
1968 DEBUG_EMAIL(("Extra Field - \"%s\" = \"%s\"\n", ef->field_name, ef->value)); 2000 DEBUG_EMAIL(("Extra Field - \"%s\" = \"%s\"\n", ef->field_name, ef->value));
1969 if (strcmp(ef->field_name, "content-type") == 0) { 2001 if (strcmp(ef->field_name, "content-type") == 0) {
1970 char *p = strstr(ef->value, "charset=\""); 2002 char *p = strstr(ef->value, "charset=\"");
1982 } 2014 }
1983 } 2015 }
1984 } 2016 }
1985 } 2017 }
1986 else { 2018 else {
1987 DEBUG_EMAIL(("NULL extra field\n")); 2019 DEBUG_EMAIL(("What does this mean?\n"));
2020 DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size);
1988 } 2021 }
1989 break; 2022 break;
1990 case 0x0002: // PR_ALTERNATE_RECIPIENT_ALLOWED 2023 case 0x0002: // PR_ALTERNATE_RECIPIENT_ALLOWED
1991 // If set to true, the sender allows this email to be autoforwarded 2024 if (list->elements[x]->type == 0x0b) {
1992 LIST_COPY_EMAIL_BOOL("AutoForward allowed", item->email->autoforward); 2025 // If set to true, the sender allows this email to be autoforwarded
1993 if (!item->email->autoforward) item->email->autoforward = -1; 2026 LIST_COPY_EMAIL_BOOL("AutoForward allowed", item->email->autoforward);
2027 if (!item->email->autoforward) item->email->autoforward = -1;
2028 } else {
2029 DEBUG_EMAIL(("What does this mean?\n"));
2030 DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size);
2031 }
1994 break; 2032 break;
1995 case 0x0003: // Extended Attributes table 2033 case 0x0003: // Extended Attributes table
1996 DEBUG_EMAIL(("Extended Attributes Table - NOT PROCESSED\n")); 2034 DEBUG_EMAIL(("Extended Attributes Table - NOT PROCESSED\n"));
1997 break; 2035 break;
1998 case 0x0017: // PR_IMPORTANCE - How important the sender deems it to be 2036 case 0x0017: // PR_IMPORTANCE - How important the sender deems it to be
1999 LIST_COPY_EMAIL_ENUM("Importance Level", item->email->importance, 0, 3, "Low", "Normal", "High"); 2037 LIST_COPY_EMAIL_ENUM("Importance Level", item->email->importance, 0, 3, "Low", "Normal", "High");
2000 break; 2038 break;
2001 case 0x001A: // PR_MESSAGE_CLASS IPM.x 2039 case 0x001A: // PR_MESSAGE_CLASS IPM.x
2002 LIST_COPY(item->ascii_type, (char*)); 2040 if ((list->elements[x]->type == 0x1e) ||
2003 if (pst_strincmp("IPM.Note", item->ascii_type, 8) == 0) 2041 (list->elements[x]->type == 0x1e)) {
2004 item->type = PST_TYPE_NOTE; 2042 LIST_COPY_CSTR(item->ascii_type);
2005 else if (pst_stricmp("IPM", item->ascii_type) == 0) 2043 if (!item->ascii_type) item->ascii_type = strdup("unknown");
2006 item->type = PST_TYPE_NOTE; 2044 if (pst_strincmp("IPM.Note", item->ascii_type, 8) == 0)
2007 else if (pst_strincmp("IPM.Contact", item->ascii_type, 11) == 0) 2045 item->type = PST_TYPE_NOTE;
2008 item->type = PST_TYPE_CONTACT; 2046 else if (pst_stricmp("IPM", item->ascii_type) == 0)
2009 else if (pst_strincmp("REPORT.IPM.Note", item->ascii_type, 15) == 0) 2047 item->type = PST_TYPE_NOTE;
2010 item->type = PST_TYPE_REPORT; 2048 else if (pst_strincmp("IPM.Contact", item->ascii_type, 11) == 0)
2011 else if (pst_strincmp("IPM.Activity", item->ascii_type, 12) == 0) 2049 item->type = PST_TYPE_CONTACT;
2012 item->type = PST_TYPE_JOURNAL; 2050 else if (pst_strincmp("REPORT.IPM.Note", item->ascii_type, 15) == 0)
2013 else if (pst_strincmp("IPM.Appointment", item->ascii_type, 15) == 0) 2051 item->type = PST_TYPE_REPORT;
2014 item->type = PST_TYPE_APPOINTMENT; 2052 else if (pst_strincmp("IPM.Activity", item->ascii_type, 12) == 0)
2015 else if (pst_strincmp("IPM.Task", item->ascii_type, 8) == 0) 2053 item->type = PST_TYPE_JOURNAL;
2016 item->type = PST_TYPE_TASK; 2054 else if (pst_strincmp("IPM.Appointment", item->ascii_type, 15) == 0)
2017 else 2055 item->type = PST_TYPE_APPOINTMENT;
2018 item->type = PST_TYPE_OTHER; 2056 //else if (pst_strincmp("IPM.Schedule.Meeting", item->ascii_type, 20) == 0)
2019 DEBUG_EMAIL(("Message class %s [%"PRIi32"] \n", item->ascii_type, item->type)); 2057 // item->type = PST_TYPE_APPOINTMENT;
2058 // these seem to be appointments, but they are inside the email folder,
2059 // and unless we are in separate mode, we would dump an appointment
2060 // into the middle of a mailbox file.
2061 else if (pst_strincmp("IPM.StickyNote", item->ascii_type, 14) == 0)
2062 item->type = PST_TYPE_STICKYNOTE;
2063 else if (pst_strincmp("IPM.Task", item->ascii_type, 8) == 0)
2064 item->type = PST_TYPE_TASK;
2065 else
2066 item->type = PST_TYPE_OTHER;
2067 DEBUG_EMAIL(("Message class %s [%"PRIi32"] \n", item->ascii_type, item->type));
2068 }
2069 else {
2070 DEBUG_EMAIL(("What does this mean?\n"));
2071 DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size);
2072 }
2020 break; 2073 break;
2021 case 0x0023: // PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED 2074 case 0x0023: // PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED
2022 // set if the sender wants a delivery report from all recipients 2075 if (list->elements[x]->type == 0x0b) {
2023 LIST_COPY_EMAIL_BOOL("Global Delivery Report", item->email->delivery_report); 2076 // set if the sender wants a delivery report from all recipients
2077 LIST_COPY_EMAIL_BOOL("Global Delivery Report", item->email->delivery_report);
2078 }
2079 else {
2080 DEBUG_EMAIL(("What does this mean?\n"));
2081 DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size);
2082 }
2024 break; 2083 break;
2025 case 0x0026: // PR_PRIORITY 2084 case 0x0026: // PR_PRIORITY
2026 LIST_COPY_EMAIL_ENUM("Priority", item->email->priority, 1, 3, "NonUrgent", "Normal", "Urgent"); 2085 LIST_COPY_EMAIL_ENUM("Priority", item->email->priority, 1, 3, "NonUrgent", "Normal", "Urgent");
2027 break; 2086 break;
2028 case 0x0029: // PR_READ_RECEIPT_REQUESTED 2087 case 0x0029: // PR_READ_RECEIPT_REQUESTED
2114 break; 2173 break;
2115 case 0x0070: // PR_CONVERSATION_TOPIC Processed Subject 2174 case 0x0070: // PR_CONVERSATION_TOPIC Processed Subject
2116 LIST_COPY_EMAIL_STR("Processed Subject (Conversation Topic)", item->email->processed_subject); 2175 LIST_COPY_EMAIL_STR("Processed Subject (Conversation Topic)", item->email->processed_subject);
2117 break; 2176 break;
2118 case 0x0071: // PR_CONVERSATION_INDEX 2177 case 0x0071: // PR_CONVERSATION_INDEX
2119 LIST_COPY_EMAIL_INT32("Conversation Index", item->email->conversation_index); 2178 LIST_COPY_EMAIL_BIN("Conversation Index", item->email->conversation_index);
2120 break; 2179 break;
2121 case 0x0072: // PR_ORIGINAL_DISPLAY_BCC 2180 case 0x0072: // PR_ORIGINAL_DISPLAY_BCC
2122 LIST_COPY_EMAIL_STR("Original display bcc", item->email->original_bcc); 2181 LIST_COPY_EMAIL_STR("Original display bcc", item->email->original_bcc);
2123 break; 2182 break;
2124 case 0x0073: // PR_ORIGINAL_DISPLAY_CC 2183 case 0x0073: // PR_ORIGINAL_DISPLAY_CC
2206 // if this value doesn't exist, text body is more up-to-date than rtf and 2265 // if this value doesn't exist, text body is more up-to-date than rtf and
2207 // cannot update to the rtf 2266 // cannot update to the rtf
2208 LIST_COPY_EMAIL_BOOL("Compressed RTF in Sync", item->email->rtf_in_sync); 2267 LIST_COPY_EMAIL_BOOL("Compressed RTF in Sync", item->email->rtf_in_sync);
2209 break; 2268 break;
2210 case 0x0E20: // PR_ATTACH_SIZE binary Attachment data in record 2269 case 0x0E20: // PR_ATTACH_SIZE binary Attachment data in record
2211 DEBUG_EMAIL(("Attachment Size - "));
2212 NULL_CHECK(attach); 2270 NULL_CHECK(attach);
2213 LIST_COPY_INT32("Attachment Size", t); 2271 LIST_COPY_INT32("Attachment Size", t);
2214 attach->size = (size_t)t; 2272 attach->data.size = (size_t)t;
2215 break; 2273 break;
2216 case 0x0FF9: // PR_RECORD_KEY Record Header 1 2274 case 0x0FF9: // PR_RECORD_KEY Record Header 1
2217 DEBUG_EMAIL(("Record Key 1 - ")); 2275 LIST_COPY_BIN(item->record_key);
2218 LIST_COPY(item->record_key, (char*)); 2276 DEBUG_EMAIL(("Record Key\n"));
2219 item->record_key_size = list->elements[x]->size; 2277 DEBUG_EMAIL_HEXPRINT(item->record_key.data, item->record_key.size);
2220 DEBUG_EMAIL_HEXPRINT(item->record_key, item->record_key_size);
2221 DEBUG_EMAIL(("\n"));
2222 break; 2278 break;
2223 case 0x1000: // PR_BODY 2279 case 0x1000: // PR_BODY
2224 LIST_COPY_STR("Plain Text body", item->body); 2280 LIST_COPY_STR("Plain Text body", item->body);
2225 break; 2281 break;
2226 case 0x1001: // PR_REPORT_TEXT 2282 case 0x1001: // PR_REPORT_TEXT
2238 // the first couple of lines of RTF body so that after modification, then beginning can 2294 // the first couple of lines of RTF body so that after modification, then beginning can
2239 // once again be found 2295 // once again be found
2240 LIST_COPY_EMAIL_STR("RTF Sync body tag", item->email->rtf_body_tag); 2296 LIST_COPY_EMAIL_STR("RTF Sync body tag", item->email->rtf_body_tag);
2241 break; 2297 break;
2242 case 0x1009: // PR_RTF_COMPRESSED - rtf data is lzw compressed 2298 case 0x1009: // PR_RTF_COMPRESSED - rtf data is lzw compressed
2243 LIST_COPY_EMAIL_SIZE("RTF Compressed body", item->email->rtf_compressed, item->email->rtf_compressed_size); 2299 LIST_COPY_EMAIL_BIN("RTF Compressed body", item->email->rtf_compressed);
2244 break; 2300 break;
2245 case 0x1010: // PR_RTF_SYNC_PREFIX_COUNT 2301 case 0x1010: // PR_RTF_SYNC_PREFIX_COUNT
2246 // a count of the ignored characters before the first significant character 2302 // a count of the ignored characters before the first significant character
2247 LIST_COPY_EMAIL_INT32("RTF whitespace prefix count", item->email->rtf_ws_prefix_count); 2303 LIST_COPY_EMAIL_INT32("RTF whitespace prefix count", item->email->rtf_ws_prefix_count);
2248 break; 2304 break;
2306 break; 2362 break;
2307 case 0x35E7: // PR_FINDER_ENTRYID 2363 case 0x35E7: // PR_FINDER_ENTRYID
2308 LIST_COPY_STORE_ENTRYID("Search Root Folder record", item->message_store->search_root_folder); 2364 LIST_COPY_STORE_ENTRYID("Search Root Folder record", item->message_store->search_root_folder);
2309 break; 2365 break;
2310 case 0x3602: // PR_CONTENT_COUNT Number of emails stored in a folder 2366 case 0x3602: // PR_CONTENT_COUNT Number of emails stored in a folder
2311 LIST_COPY_FOLDER_INT32("Folder Email Count", item->folder->email_count); 2367 LIST_COPY_FOLDER_INT32("Folder Email Count", item->folder->item_count);
2312 break; 2368 break;
2313 case 0x3603: // PR_CONTENT_UNREAD Number of unread emails 2369 case 0x3603: // PR_CONTENT_UNREAD Number of unread emails
2314 LIST_COPY_FOLDER_INT32("Unread Email Count", item->folder->unseen_email_count); 2370 LIST_COPY_FOLDER_INT32("Unread Email Count", item->folder->unseen_item_count);
2315 break; 2371 break;
2316 case 0x360A: // PR_SUBFOLDERS Has children 2372 case 0x360A: // PR_SUBFOLDERS Has children
2317 MALLOC_FOLDER(item); 2373 MALLOC_FOLDER(item);
2318 LIST_COPY_BOOL("Has Subfolders", item->folder->subfolder); 2374 LIST_COPY_BOOL("Has Subfolders", item->folder->subfolder);
2319 break; 2375 break;
2320 case 0x3613: // PR_CONTAINER_CLASS IPF.x 2376 case 0x3613: // PR_CONTAINER_CLASS IPF.x
2321 LIST_COPY(item->ascii_type, (char*)); 2377 LIST_COPY_CSTR(item->ascii_type);
2322 if (pst_strincmp("IPF.Note", item->ascii_type, 8) == 0) 2378 if (pst_strincmp("IPF.Note", item->ascii_type, 8) == 0)
2323 item->type = PST_TYPE_NOTE; 2379 item->type = PST_TYPE_NOTE;
2324 else if (pst_stricmp("IPF", item->ascii_type) == 0) 2380 else if (pst_stricmp("IPF", item->ascii_type) == 0)
2325 item->type = PST_TYPE_NOTE; 2381 item->type = PST_TYPE_NOTE;
2326 else if (pst_strincmp("IPF.Contact", item->ascii_type, 11) == 0) 2382 else if (pst_strincmp("IPF.Contact", item->ascii_type, 11) == 0)
2346 case 0x3701: // PR_ATTACH_DATA_OBJ binary data of attachment 2402 case 0x3701: // PR_ATTACH_DATA_OBJ binary data of attachment
2347 DEBUG_EMAIL(("Binary Data [Size %i] - ", list->elements[x]->size)); 2403 DEBUG_EMAIL(("Binary Data [Size %i] - ", list->elements[x]->size));
2348 NULL_CHECK(attach); 2404 NULL_CHECK(attach);
2349 if (!list->elements[x]->data) { //special case 2405 if (!list->elements[x]->data) { //special case
2350 attach->id2_val = list->elements[x]->type; 2406 attach->id2_val = list->elements[x]->type;
2351 DEBUG_EMAIL(("Seen a Reference. The data hasn't been loaded yet. [%#"PRIx64"][%#x]\n", 2407 DEBUG_EMAIL(("Seen a Reference. The data hasn't been loaded yet. [%#"PRIx64"]\n", attach->id2_val));
2352 attach->id2_val, list->elements[x]->type));
2353 } else { 2408 } else {
2354 LIST_COPY(attach->data, (char*)); 2409 LIST_COPY_BIN(attach->data);
2355 attach->size = list->elements[x]->size;
2356 DEBUG_EMAIL(("NOT PRINTED\n"));
2357 } 2410 }
2358 break; 2411 break;
2359 case 0x3704: // PR_ATTACH_FILENAME Attachment filename (8.3) 2412 case 0x3704: // PR_ATTACH_FILENAME Attachment filename (8.3)
2360 NULL_CHECK(attach); 2413 NULL_CHECK(attach);
2361 LIST_COPY_STR("Attachment Filename", attach->filename1); 2414 LIST_COPY_STR("Attachment Filename", attach->filename1);
2633 LIST_COPY_INT32("Internet code page", item->internet_cpid); 2686 LIST_COPY_INT32("Internet code page", item->internet_cpid);
2634 break; 2687 break;
2635 case 0x3FFD: // PR_MESSAGE_CODEPAGE 2688 case 0x3FFD: // PR_MESSAGE_CODEPAGE
2636 LIST_COPY_INT32("Message code page", item->message_codepage); 2689 LIST_COPY_INT32("Message code page", item->message_codepage);
2637 break; 2690 break;
2638 case 0x65E3: // Entry ID? 2691 case 0x65E3: // PR_PREDECESSOR_CHANGE_LIST
2639 DEBUG_EMAIL(("Entry ID - ")); 2692 LIST_COPY_BIN(item->predecessor_change);
2640 item->record_key = (char*) xmalloc(16+1); 2693 DEBUG_EMAIL(("Predecessor Change\n"));
2641 memcpy(item->record_key, &(list->elements[x]->data[1]), 16); //skip first byte 2694 DEBUG_EMAIL_HEXPRINT(item->predecessor_change.data, item->predecessor_change.size);
2642 item->record_key[16]='\0';
2643 item->record_key_size=16;
2644 DEBUG_EMAIL_HEXPRINT((char*)item->record_key, 16);
2645 break; 2695 break;
2646 case 0x67F2: // ID2 value of the attachments proper record 2696 case 0x67F2: // ID2 value of the attachments proper record
2647 DEBUG_EMAIL(("Attachment ID2 value - ")); 2697 DEBUG_EMAIL(("Attachment ID2 value - "));
2648 if (attach) { 2698 if (attach) {
2649 uint32_t tempid; 2699 uint32_t tempid;
2657 break; 2707 break;
2658 case 0x67FF: // Extra Property Identifier (Password CheckSum) 2708 case 0x67FF: // Extra Property Identifier (Password CheckSum)
2659 LIST_COPY_STORE_INT32("Password checksum", item->message_store->pwd_chksum); 2709 LIST_COPY_STORE_INT32("Password checksum", item->message_store->pwd_chksum);
2660 break; 2710 break;
2661 case 0x6F02: // Secure HTML Body 2711 case 0x6F02: // Secure HTML Body
2662 LIST_COPY_EMAIL_SIZE("Secure HTML Body", item->email->encrypted_htmlbody, item->email->encrypted_htmlbody_size); 2712 LIST_COPY_EMAIL_BIN("Secure HTML Body", item->email->encrypted_htmlbody);
2663 break; 2713 break;
2664 case 0x6F04: // Secure Text Body 2714 case 0x6F04: // Secure Text Body
2665 LIST_COPY_EMAIL_SIZE("Secure Text Body", item->email->encrypted_body, item->email->encrypted_body_size); 2715 LIST_COPY_EMAIL_BIN("Secure Text Body", item->email->encrypted_body);
2666 break; 2716 break;
2667 case 0x7C07: // top of folders ENTRYID 2717 case 0x7C07: // top of folders ENTRYID
2668 LIST_COPY_ENTRYID("Top of folders RecID", item->message_store->top_of_folder); 2718 LIST_COPY_STORE_ENTRYID("Top of folders RecID", item->message_store->top_of_folder);
2669 break; 2719 break;
2670 case 0x8005: // Contact's Fullname 2720 case 0x8005: // Contact's Fullname
2671 LIST_COPY_CONTACT_STR("Contact Fullname", item->contact->fullname); 2721 LIST_COPY_CONTACT_STR("Contact Fullname", item->contact->fullname);
2672 break; 2722 break;
2673 case 0x801A: // Full Home Address 2723 case 0x801A: // Full Home Address
2907 } else if (list->elements[x]->type == (uint32_t)0x1014) { 2957 } else if (list->elements[x]->type == (uint32_t)0x1014) {
2908 DEBUG_EMAIL(("Unknown type %#x Array of 64 bit values [siize = %#x]\n", list->elements[x]->mapi_id, 2958 DEBUG_EMAIL(("Unknown type %#x Array of 64 bit values [siize = %#x]\n", list->elements[x]->mapi_id,
2909 list->elements[x]->size)); 2959 list->elements[x]->size));
2910 DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); 2960 DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size);
2911 2961
2912 } else if (list->elements[x]->type == (uint32_t)0x101E) { 2962 } else if (list->elements[x]->type == (uint32_t)0x101e) {
2913 DEBUG_EMAIL(("Unknown type %#x Array of Strings [size = %#x]\n", list->elements[x]->mapi_id, 2963 DEBUG_EMAIL(("Unknown type %#x Array of Strings [size = %#x]\n", list->elements[x]->mapi_id,
2914 list->elements[x]->size)); 2964 list->elements[x]->size));
2915 DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); 2965 DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size);
2916 2966
2917 } else if (list->elements[x]->type == (uint32_t)0x101F) { 2967 } else if (list->elements[x]->type == (uint32_t)0x101f) {
2918 DEBUG_EMAIL(("Unknown type %#x Array of Unicode Strings [size = %#x]\n", list->elements[x]->mapi_id, 2968 DEBUG_EMAIL(("Unknown type %#x Array of Unicode Strings [size = %#x]\n", list->elements[x]->mapi_id,
2919 list->elements[x]->size)); 2969 list->elements[x]->size));
2920 DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); 2970 DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size);
2921 2971
2922 } else if (list->elements[x]->type == (uint32_t)0x1102) { 2972 } else if (list->elements[x]->type == (uint32_t)0x1102) {
3101 while (attach) { 3151 while (attach) {
3102 pst_item_attach *t; 3152 pst_item_attach *t;
3103 SAFE_FREE_STR(attach->filename1); 3153 SAFE_FREE_STR(attach->filename1);
3104 SAFE_FREE_STR(attach->filename2); 3154 SAFE_FREE_STR(attach->filename2);
3105 SAFE_FREE_STR(attach->mimetype); 3155 SAFE_FREE_STR(attach->mimetype);
3106 SAFE_FREE(attach->data); 3156 SAFE_FREE_BIN(attach->data);
3107 pst_free_id2(attach->id2_head); 3157 pst_free_id2(attach->id2_head);
3108 t = attach->next; 3158 t = attach->next;
3109 free(attach); 3159 free(attach);
3110 attach = t; 3160 attach = t;
3111 } 3161 }
3119 if (item) { 3169 if (item) {
3120 if (item->email) { 3170 if (item->email) {
3121 SAFE_FREE(item->email->arrival_date); 3171 SAFE_FREE(item->email->arrival_date);
3122 SAFE_FREE_STR(item->email->cc_address); 3172 SAFE_FREE_STR(item->email->cc_address);
3123 SAFE_FREE_STR(item->email->bcc_address); 3173 SAFE_FREE_STR(item->email->bcc_address);
3124 SAFE_FREE(item->email->encrypted_body); 3174 SAFE_FREE_BIN(item->email->conversation_index);
3125 SAFE_FREE(item->email->encrypted_htmlbody); 3175 SAFE_FREE_BIN(item->email->encrypted_body);
3176 SAFE_FREE_BIN(item->email->encrypted_htmlbody);
3126 SAFE_FREE_STR(item->email->header); 3177 SAFE_FREE_STR(item->email->header);
3127 SAFE_FREE_STR(item->email->htmlbody); 3178 SAFE_FREE_STR(item->email->htmlbody);
3128 SAFE_FREE_STR(item->email->in_reply_to); 3179 SAFE_FREE_STR(item->email->in_reply_to);
3129 SAFE_FREE_STR(item->email->messageid); 3180 SAFE_FREE_STR(item->email->messageid);
3130 SAFE_FREE_STR(item->email->original_bcc); 3181 SAFE_FREE_STR(item->email->original_bcc);
3141 SAFE_FREE_STR(item->email->recip_address); 3192 SAFE_FREE_STR(item->email->recip_address);
3142 SAFE_FREE_STR(item->email->recip2_access); 3193 SAFE_FREE_STR(item->email->recip2_access);
3143 SAFE_FREE_STR(item->email->recip2_address); 3194 SAFE_FREE_STR(item->email->recip2_address);
3144 SAFE_FREE_STR(item->email->reply_to); 3195 SAFE_FREE_STR(item->email->reply_to);
3145 SAFE_FREE_STR(item->email->rtf_body_tag); 3196 SAFE_FREE_STR(item->email->rtf_body_tag);
3146 SAFE_FREE(item->email->rtf_compressed); 3197 SAFE_FREE_BIN(item->email->rtf_compressed);
3147 SAFE_FREE_STR(item->email->return_path_address); 3198 SAFE_FREE_STR(item->email->return_path_address);
3148 SAFE_FREE_STR(item->email->sender_access); 3199 SAFE_FREE_STR(item->email->sender_access);
3149 SAFE_FREE_STR(item->email->sender_address); 3200 SAFE_FREE_STR(item->email->sender_address);
3150 SAFE_FREE_STR(item->email->sender2_access); 3201 SAFE_FREE_STR(item->email->sender2_access);
3151 SAFE_FREE_STR(item->email->sender2_address); 3202 SAFE_FREE_STR(item->email->sender2_address);
3306 SAFE_FREE_STR(item->comment); 3357 SAFE_FREE_STR(item->comment);
3307 SAFE_FREE(item->create_date); 3358 SAFE_FREE(item->create_date);
3308 SAFE_FREE_STR(item->file_as); 3359 SAFE_FREE_STR(item->file_as);
3309 SAFE_FREE(item->modify_date); 3360 SAFE_FREE(item->modify_date);
3310 SAFE_FREE_STR(item->outlook_version); 3361 SAFE_FREE_STR(item->outlook_version);
3311 SAFE_FREE(item->record_key); 3362 SAFE_FREE_BIN(item->record_key);
3363 SAFE_FREE_BIN(item->predecessor_change);
3312 free(item); 3364 free(item);
3313 } 3365 }
3314 DEBUG_RET(); 3366 DEBUG_RET();
3315 } 3367 }
3316 3368
3782 if (!a) { 3834 if (!a) {
3783 if (buf3) free(buf3); 3835 if (buf3) free(buf3);
3784 DEBUG_RET(); 3836 DEBUG_RET();
3785 return 0; 3837 return 0;
3786 } 3838 }
3787 DEBUG_HEXDUMPC(buf3, a, 0x10); 3839 DEBUG_HEXDUMPC(buf3, a, 16);
3788 memcpy(&block_hdr, buf3, sizeof(block_hdr)); 3840 memcpy(&block_hdr, buf3, sizeof(block_hdr));
3789 LE16_CPU(block_hdr.index_offset); 3841 LE16_CPU(block_hdr.index_offset);
3790 LE16_CPU(block_hdr.type); 3842 LE16_CPU(block_hdr.type);
3791 LE32_CPU(block_hdr.offset); 3843 LE32_CPU(block_hdr.offset);
3792 DEBUG_EMAIL(("block header (index_offset=%#hx, type=%#hx, offset=%#x)\n", block_hdr.index_offset, block_hdr.type, block_hdr.offset)); 3844 DEBUG_EMAIL(("block header (index_offset=%#hx, type=%#hx, offset=%#x)\n", block_hdr.index_offset, block_hdr.type, block_hdr.offset));