File: libfole_value_type.c

package info (click to toggle)
libolecf 20161113-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 12,096 kB
  • ctags: 5,217
  • sloc: ansic: 169,907; sh: 5,808; makefile: 1,380; python: 497; sed: 16
file content (111 lines) | stat: -rw-r--r-- 3,795 bytes parent folder | download | duplicates (3)
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
/*
 * Value type functions
 *
 * Copyright (C) 2008-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 <types.h>

#include "libfole_value_type.h"

libfole_value_type_t libfole_value_types[ ] = {
	{ 0x0000, "VT_EMPTY",			"Empty" },
	{ 0x0001, "VT_NULL",			"NULL" },
	{ 0x0002, "VT_I2",			"Integer 16-bit signed" },
	{ 0x0003, "VT_I4",			"Integer 32-bit signed" },
	{ 0x0004, "VT_R4",			"Floating point single precision (32-bit)" },
	{ 0x0005, "VT_R8",			"Floating point double precision (64-bit)" },
	{ 0x0006, "VT_CY",			"Currency (64-bit)" },
	{ 0x0007, "VT_DATE",			"Application time (64-bit)" },
	{ 0x0008, "VT_BSTR",			"OLE automation string" },
	{ 0x0009, "VT_DISPATCH",		"IDispatch reference" },
	{ 0x000a, "VT_ERROR",			"Error value (32-bit)" },
	{ 0x000b, "VT_BOOLEAN",			"Boolean" },
	{ 0x000c, "VT_VARIANT",			"VARIANT reference" },
	{ 0x000d, "VT_UNKNOWN",			"IUnknown reference" },

	{ 0x0010, "VT_I1",			"Integer 8-bit signed" },
	{ 0x0011, "VT_UI1",			"Integer 8-bit unsigned" },
	{ 0x0012, "VT_UI2",			"Integer 16-bit unsigned" },
	{ 0x0013, "VT_UI4",			"Integer 32-bit unsigned" },
	{ 0x0014, "VT_I8",			"Integer 64-bit signed" },
	{ 0x0015, "VT_UI8",			"Integer 64-bit unsigned" },
	{ 0x0016, "VT_INT",			"Integer signed" },
	{ 0x0017, "VT_UINT",			"Integer unsigned" },
	{ 0x0018, "VT_VOID",			"Void reference" },
	{ 0x0019, "VT_HRESULT",			"HRESULT reference" },
	{ 0x001a, "VT_PTR",			"pointer reference" },
	{ 0x001b, "VT_SAFEARRAY",		"safe array" },
	{ 0x001c, "VT_CARRAY",			"C-type array" },
	{ 0x001d, "VT_USERDEFINED",		"user defined" },
	{ 0x001e, "VT_LPSTR",			"Extended ASCII string" },
	{ 0x001f, "VT_LPWSTR",			"UTF-16 Unicode string" },

	{ 0x0040, "VT_FILETIME",		"Windows Filetime (64-bit)" },
	{ 0x0041, "VT_BLOB",			"Binary large object" },
	{ 0x0042, "VT_STREAM",			"OLE stream" },
	{ 0x0043, "VT_STORAGE",			"OLE storage" },
	{ 0x0044, "VT_STREAMED_OBJECT",		"OLE streamed object" },
	{ 0x0045, "VT_STORED_OBJECT",		"OLE stored object" },
	{ 0x0046, "VT_BLOB_OBJECT",		"Binary large object" },
	{ 0x0047, "VT_CF",			"Clipboard format" },

	{ 0x0048, "VT_CLSID",			"GUID (128-bit)" },
	{ 0x0049, "VT_VERSIONED_STREAM",	"OLE versioned stream" },

	{ (uint32_t) -1, "_UNKNOWN_", "Unknown" } };

/* Retrieves a string containing the value type identifier
 */
const char *libfole_value_type_get_identifier(
             uint32_t value_type )
{
	int iterator = 0;

	while( ( libfole_value_types[ iterator ] ).value_type != (uint32_t) -1 )
	{
		if( ( libfole_value_types[ iterator ] ).value_type == value_type )
		{
			break;
		}
		iterator++;
	}
	return(
	 ( libfole_value_types[ iterator ] ).identifier );
}

/* Retrieves a string containing the value type description
 */
const char *libfole_value_type_get_description(
             uint32_t value_type )
{
	int iterator = 0;

	while( ( libfole_value_types[ iterator ] ).value_type != (uint32_t) -1 )
	{
		if( ( libfole_value_types[ iterator ] ).value_type == value_type )
		{
			break;
		}
		iterator++;
	}
	return(
	 ( libfole_value_types[ iterator ] ).description );
}