1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
|
/*
* Property identifier functions
*
* Copyright (C) 2013-2016, Joachim Metz <joachim.metz@gmail.com>
*
* Refer to AUTHORS for acknowledgements.
*
* This software is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include <common.h>
#include <memory.h>
#include <types.h>
#include "libfwps_format_class_identifier.h"
#include "libfwps_property_identifier.h"
#if defined( HAVE_DEBUG_OUTPUT )
/* The document summary information property identifiers
* Format class identifier: d5cdd502-2e9c-101b-9397-08002b2cf9ae
*/
libfwps_property_identifier_t libfwps_document_summary_information_properties[ ] = {
{ 0x0001, 0x0002, "PIDDSI_CODEPAGE", "Codepage" },
{ 0x0002, 0x001e, "PIDDSI_CATEGORY", "Category" },
{ 0x0003, 0x001e, "PIDDSI_PRESFORMAT", "Presentation format" },
{ 0x0004, 0x0003, "PIDDSI_BYTECOUNT", "Number of bytes" },
{ 0x0005, 0x0003, "PIDDSI_LINECOUNT", "Number of lines" },
{ 0x0006, 0x0003, "PIDDSI_PARCOUNT", "Number of paragraphs" },
{ 0x0007, 0x0003, "PIDDSI_SLIDECOUNT", "Number of slides" },
{ 0x0008, 0x0003, "PIDDSI_NOTECOUNT", "Number of notes" },
{ 0x0009, 0x0003, "PIDDSI_HIDDENCOUNT", "Number of hidden slides" },
{ 0x000a, 0x0003, "PIDDSI_MMCLIPCOUNT", "Number of multimedia clips" },
{ 0x000b, 0x000b, "PIDDSI_SCALE", "Scale crop" },
{ 0x000c, 0x100c, "PIDDSI_HEADINGPAIR", "Heading pair" },
{ 0x000d, 0x101e, "PIDDSI_DOCPARTS", "Document parts" },
{ 0x000e, 0x001e, "PIDDSI_MANAGER", "Manager" },
{ 0x000f, 0x001e, "PIDDSI_COMPANY", "Company" },
{ 0x0010, 0x000b, "PIDDSI_LINKSDIRTY", "Links dirty" },
{ 0x0011, 0x0003, "PIDDSI_CCHWITHSPACES", "Number of characters with white-space" },
{ 0x0013, 0x000b, "PIDDSI_SHAREDDOC", "Shared document" },
{ 0x0016, 0x000b, "PIDDSI_HYPERLINKSCHANGED", "Hyper links changed" },
{ 0x0017, 0x0003, "PIDDSI_VERSION", "Creating application version" },
{ 0x0018, 0x0041, "PIDDSI_DIGSIG", "Digital signature" },
{ 0x001a, 0x001e, "PIDDSI_CONTENTTYPE", "Content type" },
{ 0x001b, 0x001e, "PIDDSI_CONTENTSTATUS", "Content status" },
{ 0x001c, 0x001e, "PIDDSI_LANGUAGE", "Language" },
{ 0x001d, 0x001e, "PIDDSI_DOCVERSION", "Document version" },
{ (uint32_t) -1, (uint32_t) -1, "_UNKNOWN_", "Unknown" } };
/* The summary information property identifiers
* Format class identifier: f29f85e0-4ff9-1068-ab91-08002b27b3d9
*/
libfwps_property_identifier_t libfwps_summary_information_properties[ ] = {
{ 0x0001, 0x0002, "PIDSI_CODEPAGE", "Codepage" },
{ 0x0002, 0x001e, "PIDSI_TITLE", "Title" },
{ 0x0003, 0x001e, "PIDSI_SUBJECT", "Subject" },
{ 0x0004, 0x001e, "PIDSI_AUTHOR", "Author" },
{ 0x0005, 0x001e, "PIDSI_KEYWORDS", "Keywords" },
{ 0x0006, 0x001e, "PIDSI_COMMENTS ", "Comments" },
{ 0x0007, 0x001e, "PIDSI_TEMPLATE", "Template" },
{ 0x0008, 0x001e, "PIDSI_LASTAUTHOR", "Last saved by" },
{ 0x0009, 0x001e, "PIDSI_REVNUMBER", "Revision number" },
{ 0x000a, 0x0040, "PIDSI_EDITTIME", "Total editing time" },
{ 0x000b, 0x0040, "PIDSI_LASTPRINTED", "Last printed date and time" },
{ 0x000c, 0x0040, "PIDSI_CREATE_DTM", "Creation date and time" },
{ 0x000d, 0x0040, "PIDSI_LASTSAVE_DTM", "Last saved date and time" },
{ 0x000e, 0x0003, "PIDSI_PAGECOUNT", "Number of pages" },
{ 0x000f, 0x0003, "PIDSI_WORDCOUNT", "Number of words" },
{ 0x0010, 0x0003, "PIDSI_CHARCOUNT", "Number of characters" },
{ 0x0011, 0x0047, "PIDSI_THUMBNAIL", "Thumbnail" },
{ 0x0012, 0x001e, "PIDSI_APPNAME", "Creating application name" },
{ 0x0013, 0x0003, "PIDSI_SECURITY", "Security" },
{ (uint32_t) -1, (uint32_t) -1, "_UNKNOWN_", "Unknown" } };
/* Retrieves a string containing the property identifier
*/
const char *libfwps_property_identifiers_get_identifier(
libfwps_property_identifier_t libfwps_property_identifiers[],
uint32_t entry_type,
uint32_t value_type )
{
int iterator = 0;
if( value_type == 0x001f )
{
value_type = 0x001e;
}
else if( value_type == 0x101f )
{
value_type = 0x101e;
}
while( ( libfwps_property_identifiers[ iterator ] ).entry_type != (uint32_t) -1 )
{
if( ( ( libfwps_property_identifiers[ iterator ] ).entry_type == entry_type )
&& ( ( libfwps_property_identifiers[ iterator ] ).value_type == value_type ) )
{
break;
}
iterator++;
}
return(
( libfwps_property_identifiers[ iterator ] ).identifier );
}
/* Retrieves a string containing the property identifier
*/
const char *libfwps_property_identifier_get_identifier(
const uint8_t *format_class_identifier,
uint32_t entry_type,
uint32_t value_type )
{
if( format_class_identifier != NULL )
{
if( memory_compare(
format_class_identifier,
libfwps_format_class_identifier_document_summary_information,
16 ) == 0 )
{
return( libfwps_property_identifiers_get_identifier(
libfwps_document_summary_information_properties,
entry_type,
value_type ) );
}
else if( memory_compare(
format_class_identifier,
libfwps_format_class_identifier_summary_information,
16 ) == 0 )
{
return( libfwps_property_identifiers_get_identifier(
libfwps_summary_information_properties,
entry_type,
value_type ) );
}
}
return( "_UNKNOWN_" );
}
/* Retrieves a string containing the property identifier description
*/
const char *libfwps_property_identifiers_get_description(
libfwps_property_identifier_t libfwps_property_identifiers[],
uint32_t entry_type,
uint32_t value_type )
{
int iterator = 0;
if( value_type == 0x001f )
{
value_type = 0x001e;
}
else if( value_type == 0x101f )
{
value_type = 0x101e;
}
while( ( libfwps_property_identifiers[ iterator ] ).entry_type != (uint32_t) -1 )
{
if( ( ( libfwps_property_identifiers[ iterator ] ).entry_type == entry_type )
&& ( ( libfwps_property_identifiers[ iterator ] ).value_type == value_type ) )
{
break;
}
iterator++;
}
return(
( libfwps_property_identifiers[ iterator ] ).description );
}
/* Retrieves a string containing the property identifier description
*/
const char *libfwps_property_identifier_get_description(
const uint8_t *format_class_identifier,
uint32_t entry_type,
uint32_t value_type )
{
if( format_class_identifier != NULL )
{
if( memory_compare(
format_class_identifier,
libfwps_format_class_identifier_document_summary_information,
16 ) == 0 )
{
return( libfwps_property_identifiers_get_description(
libfwps_document_summary_information_properties,
entry_type,
value_type ) );
}
else if( memory_compare(
format_class_identifier,
libfwps_format_class_identifier_summary_information,
16 ) == 0 )
{
return( libfwps_property_identifiers_get_description(
libfwps_summary_information_properties,
entry_type,
value_type ) );
}
}
return( "Unknown" );
}
#endif /* defined( HAVE_DEBUG_OUTPUT ) */
|