php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
readcdf.c
Go to the documentation of this file.
1/*-
2 * Copyright (c) 2008, 2016 Christos Zoulas
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
15 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
16 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 */
26#include "file.h"
27
28#ifndef lint
29FILE_RCSID("@(#)$File: readcdf.c,v 1.80 2023/01/24 20:13:40 christos Exp $")
30#endif
31
32#include <assert.h>
33#include <stdlib.h>
34#ifdef HAVE_UNISTD_H
35#include <unistd.h>
36#endif
37#include <string.h>
38#include <time.h>
39#include <ctype.h>
40
41#include "cdf.h"
42#include "magic.h"
43
44#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
45
46static const struct nv {
47 const char *pattern;
48 const char *mime;
49} app2mime[] = {
50 { "Word", "msword", },
51 { "Excel", "vnd.ms-excel", },
52 { "Powerpoint", "vnd.ms-powerpoint", },
53 { "Crystal Reports", "x-rpt", },
54 { "Advanced Installer", "vnd.ms-msi", },
55 { "InstallShield", "vnd.ms-msi", },
56 { "Microsoft Patch Compiler", "vnd.ms-msi", },
57 { "NAnt", "vnd.ms-msi", },
58 { "Windows Installer", "vnd.ms-msi", },
59 { NULL, NULL, },
60}, name2mime[] = {
61 { "Book", "vnd.ms-excel", },
62 { "Workbook", "vnd.ms-excel", },
63 { "WordDocument", "msword", },
64 { "PowerPoint", "vnd.ms-powerpoint", },
65 { "DigitalSignature", "vnd.ms-msi", },
66 { NULL, NULL, },
67}, name2desc[] = {
68 { "Book", "Microsoft Excel", },
69 { "Workbook", "Microsoft Excel", },
70 { "WordDocument", "Microsoft Word", },
71 { "PowerPoint", "Microsoft PowerPoint", },
72 { "DigitalSignature", "Microsoft Installer", },
73 { NULL, NULL, },
74};
75
76static const struct cv {
77 uint64_t clsid[2];
78 const char *mime;
79} clsid2mime[] = {
80 {
81 { 0x00000000000c1084ULL, 0x46000000000000c0ULL },
82 "x-msi",
83 },
84 { { 0, 0 },
85 NULL,
86 },
87}, clsid2desc[] = {
88 {
89 { 0x00000000000c1084ULL, 0x46000000000000c0ULL },
90 "MSI Installer",
91 },
92 { { 0, 0 },
93 NULL,
94 },
95};
96
97file_private const char *
98cdf_clsid_to_mime(const uint64_t clsid[2], const struct cv *cv)
99{
100 size_t i;
101 for (i = 0; cv[i].mime != NULL; i++) {
102 if (clsid[0] == cv[i].clsid[0] && clsid[1] == cv[i].clsid[1])
103 return cv[i].mime;
104 }
105 return NULL;
106}
107
108file_private const char *
109cdf_app_to_mime(const char *vbuf, const struct nv *nv)
110{
111 size_t i;
112 const char *rv = NULL;
113 char *vbuf_lower;
114
115 vbuf_lower = zend_str_tolower_dup(vbuf, strlen(vbuf));
116 for (i = 0; nv[i].pattern != NULL; i++) {
117 char *pattern_lower;
118 int found;
119
120 pattern_lower = zend_str_tolower_dup(nv[i].pattern, strlen(nv[i].pattern));
121 found = (strstr(vbuf_lower, pattern_lower) != NULL);
122 efree(pattern_lower);
123
124 if (found) {
125 rv = nv[i].mime;
126 break;
127 }
128 }
129
130 efree(vbuf_lower);
131 return rv;
132}
133
134file_private int
136 size_t count, const cdf_directory_t *root_storage)
137{
138 size_t i;
140 struct timespec ts;
141 char buf[64];
142 const char *str = NULL;
143 const char *s, *e;
144 int len;
145
146 memset(&ts, 0, sizeof(ts));
147
148 if (!NOTMIME(ms) && root_storage)
149 str = cdf_clsid_to_mime(root_storage->d_storage_uuid,
150 clsid2mime);
151
152 for (i = 0; i < count; i++) {
153 cdf_print_property_name(buf, sizeof(buf), info[i].pi_id);
154 switch (info[i].pi_type) {
155 case CDF_NULL:
156 break;
157 case CDF_SIGNED16:
158 if (NOTMIME(ms) && file_printf(ms, ", %s: %hd", buf,
159 info[i].pi_s16) == -1)
160 return -1;
161 break;
162 case CDF_SIGNED32:
163 if (NOTMIME(ms) && file_printf(ms, ", %s: %d", buf,
164 info[i].pi_s32) == -1)
165 return -1;
166 break;
167 case CDF_UNSIGNED32:
168 if (NOTMIME(ms) && file_printf(ms, ", %s: %u", buf,
169 info[i].pi_u32) == -1)
170 return -1;
171 break;
172 case CDF_FLOAT:
173 if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
174 info[i].pi_f) == -1)
175 return -1;
176 break;
177 case CDF_DOUBLE:
178 if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
179 info[i].pi_d) == -1)
180 return -1;
181 break;
184 len = info[i].pi_str.s_len;
185 if (len > 1) {
186 char vbuf[1024];
187 size_t j, k = 1;
188
189 if (info[i].pi_type == CDF_LENGTH32_WSTRING)
190 k++;
191 s = info[i].pi_str.s_buf;
192 e = info[i].pi_str.s_buf + len;
193 for (j = 0; s < e && j < sizeof(vbuf)
194 && len--; s += k) {
195 if (*s == '\0')
196 break;
197 if (isprint(CAST(unsigned char, *s)))
198 vbuf[j++] = *s;
199 }
200 if (j == sizeof(vbuf))
201 --j;
202 vbuf[j] = '\0';
203 if (NOTMIME(ms)) {
204 if (vbuf[0]) {
205 if (file_printf(ms, ", %s: %s",
206 buf, vbuf) == -1)
207 return -1;
208 }
209 } else if (str == NULL && info[i].pi_id ==
211 str = cdf_app_to_mime(vbuf, app2mime);
212 }
213 }
214 break;
215 case CDF_FILETIME:
216 tp = info[i].pi_tp;
217 if (tp != 0) {
218 char tbuf[64];
219 if (tp < 1000000000000000LL) {
221 sizeof(tbuf), tp);
222 if (NOTMIME(ms) && file_printf(ms,
223 ", %s: %s", buf, tbuf) == -1)
224 return -1;
225 } else {
226 char *c, *ec;
228 c = cdf_ctime(&ts.tv_sec, tbuf);
229 if (c != NULL &&
230 (ec = strchr(c, '\n')) != NULL)
231 *ec = '\0';
232
233 if (NOTMIME(ms) && file_printf(ms,
234 ", %s: %s", buf, c) == -1)
235 return -1;
236 }
237 }
238 break;
239 case CDF_CLIPBOARD:
240 break;
241 default:
242 return -1;
243 }
244 }
245 if (ms->flags & MAGIC_MIME_TYPE) {
246 if (str == NULL)
247 return 0;
248 if (file_printf(ms, "application/%s", str) == -1)
249 return -1;
250 }
251 return 1;
252}
253
254file_private int
256 const cdf_stream_t *sst)
257{
258 cdf_catalog_t *cat;
259 size_t i;
260 char buf[256];
262
263 if (NOTMIME(ms)) {
264 if (file_printf(ms, "Microsoft Thumbs.db [") == -1)
265 return -1;
266 if (cdf_unpack_catalog(h, sst, &cat) == -1)
267 return -1;
268 ce = cat->cat_e;
269 /* skip first entry since it has a , or paren */
270 for (i = 1; i < cat->cat_num; i++)
271 if (file_printf(ms, "%s%s",
272 cdf_u16tos8(buf, ce[i].ce_namlen, ce[i].ce_name),
273 i == cat->cat_num - 1 ? "]" : ", ") == -1) {
274 efree(cat);
275 return -1;
276 }
277 efree(cat);
278 } else if (ms->flags & MAGIC_MIME_TYPE) {
279 if (file_printf(ms, "application/CDFV2") == -1)
280 return -1;
281 }
282 return 1;
283}
284
285file_private int
287 const cdf_stream_t *sst, const cdf_directory_t *root_storage)
288{
291 size_t count;
292 int m;
293
294 if (cdf_unpack_summary_info(sst, h, &si, &info, &count) == -1)
295 return -1;
296
297 if (NOTMIME(ms)) {
298 const char *str;
299
300 if (file_printf(ms, "Composite Document File V2 Document")
301 == -1)
302 return -1;
303
304 if (file_printf(ms, ", %s Endian",
305 si.si_byte_order == 0xfffe ? "Little" : "Big") == -1)
306 return -2;
307 switch (si.si_os) {
308 case 2:
309 if (file_printf(ms, ", Os: Windows, Version %d.%d",
310 si.si_os_version & 0xff,
311 CAST(uint32_t, si.si_os_version) >> 8) == -1)
312 return -2;
313 break;
314 case 1:
315 if (file_printf(ms, ", Os: MacOS, Version %d.%d",
316 CAST(uint32_t, si.si_os_version) >> 8,
317 si.si_os_version & 0xff) == -1)
318 return -2;
319 break;
320 default:
321 if (file_printf(ms, ", Os %d, Version: %d.%d", si.si_os,
322 si.si_os_version & 0xff,
323 CAST(uint32_t, si.si_os_version) >> 8) == -1)
324 return -2;
325 break;
326 }
327 if (root_storage) {
328 str = cdf_clsid_to_mime(root_storage->d_storage_uuid,
329 clsid2desc);
330 if (str) {
331 if (file_printf(ms, ", %s", str) == -1)
332 return -2;
333 }
334 }
335 }
336
337 m = cdf_file_property_info(ms, info, count, root_storage);
338 efree(info);
339
340 return m == -1 ? -2 : m;
341}
342
343#ifdef notdef
344file_private char *
345format_clsid(char *buf, size_t len, const uint64_t uuid[2]) {
346 snprintf(buf, len, "%.8" PRIx64 "-%.4" PRIx64 "-%.4" PRIx64 "-%.4"
347 PRIx64 "-%.12" PRIx64,
348 (uuid[0] >> 32) & (uint64_t)0x000000000ffffffffULL,
349 (uuid[0] >> 16) & (uint64_t)0x0000000000000ffffULL,
350 (uuid[0] >> 0) & (uint64_t)0x0000000000000ffffULL,
351 (uuid[1] >> 48) & (uint64_t)0x0000000000000ffffULL,
352 (uuid[1] >> 0) & (uint64_t)0x0000fffffffffffffULL);
353 return buf;
354}
355#endif
356
357file_private int
359 const cdf_header_t *h, const cdf_sat_t *sat, const cdf_sat_t *ssat,
360 const cdf_stream_t *sst, const cdf_dir_t *dir, cdf_stream_t *scn)
361{
362 int i;
363
364 if ((i = cdf_read_user_stream(info, h, sat, ssat, sst,
365 dir, "Catalog", scn)) == -1)
366 return i;
367#ifdef CDF_DEBUG
368 cdf_dump_catalog(h, scn);
369#endif
370 if ((i = cdf_file_catalog(ms, h, scn)) == -1)
371 return -1;
372 return i;
373}
374
375file_private int
377 const cdf_header_t *h, const cdf_sat_t *sat, const cdf_sat_t *ssat,
378 const cdf_stream_t *sst, const cdf_dir_t *dir, cdf_stream_t *scn,
379 const cdf_directory_t *root_storage, const char **expn)
380{
381 int i;
382 const char *str = NULL;
384 char name[__arraycount(d->d_name)];
385 size_t j, k;
386
387#ifdef CDF_DEBUG
388 cdf_dump_summary_info(h, scn);
389#endif
390 if ((i = cdf_file_summary_info(ms, h, scn, root_storage)) < 0) {
391 *expn = "Can't expand summary_info";
392 return i;
393 }
394 if (i == 1)
395 return i;
396 for (j = 0; str == NULL && j < dir->dir_len; j++) {
397 d = &dir->dir_tab[j];
398 for (k = 0; k < sizeof(name); k++)
399 name[k] = CAST(char, cdf_tole2(d->d_name[k]));
400 str = cdf_app_to_mime(name,
401 NOTMIME(ms) ? name2desc : name2mime);
402 }
403 if (NOTMIME(ms)) {
404 if (str != NULL) {
405 if (file_printf(ms, "%s", str) == -1)
406 return -1;
407 i = 1;
408 }
409 } else if (ms->flags & MAGIC_MIME_TYPE) {
410 if (str == NULL)
411 str = "vnd.ms-office";
412 if (file_printf(ms, "application/%s", str) == -1)
413 return -1;
414 i = 1;
415 }
416 if (i <= 0) {
417 i = cdf_file_catalog_info(ms, info, h, sat, ssat, sst,
418 dir, scn);
419 }
420 return i;
421}
422
424 const char *name;
425 const char *mime;
426 const char *sections[5];
427 const int types[5];
428} sectioninfo[] = {
429 { "Encrypted", "encrypted",
430 {
431 "EncryptedPackage", "EncryptedSummary",
432 NULL, NULL, NULL,
433 },
434 {
437 0, 0, 0,
438
439 },
440 },
441 { "QuickBooks", "quickbooks",
442 {
443#if 0
444 "TaxForms", "PDFTaxForms", "modulesInBackup",
445#endif
446 "mfbu_header", NULL, NULL, NULL, NULL,
447 },
448 {
449#if 0
453#endif
455 0, 0, 0, 0
456 },
457 },
458 { "Microsoft Excel", "vnd.ms-excel",
459 {
460 "Book", "Workbook", NULL, NULL, NULL,
461 },
462 {
465 0, 0, 0,
466 },
467 },
468 { "Microsoft Word", "msword",
469 {
470 "WordDocument", NULL, NULL, NULL, NULL,
471 },
472 {
474 0, 0, 0, 0,
475 },
476 },
477 { "Microsoft PowerPoint", "vnd.ms-powerpoint",
478 {
479 "PowerPoint", NULL, NULL, NULL, NULL,
480 },
481 {
483 0, 0, 0, 0,
484 },
485 },
486 { "Microsoft Outlook Message", "vnd.ms-outlook",
487 {
488 "__properties_version1.0",
489 "__recip_version1.0_#00000000",
490 NULL, NULL, NULL,
491 },
492 {
495 0, 0, 0,
496 },
497 },
499
500file_private int
502{
503 size_t sd, j;
504
505 for (sd = 0; sd < __arraycount(sectioninfo); sd++) {
506 const struct sinfo *si = &sectioninfo[sd];
507 for (j = 0; si->sections[j]; j++) {
508 if (cdf_find_stream(dir, si->sections[j], si->types[j])
509 > 0)
510 break;
511#ifdef CDF_DEBUG
512 fprintf(stderr, "Can't read %s\n", si->sections[j]);
513#endif
514 }
515 if (si->sections[j] == NULL)
516 continue;
517 if (NOTMIME(ms)) {
518 if (file_printf(ms, "CDFV2 %s", si->name) == -1)
519 return -1;
520 } else if (ms->flags & MAGIC_MIME_TYPE) {
521 if (file_printf(ms, "application/%s", si->mime) == -1)
522 return -1;
523 }
524 return 1;
525 }
526 return -1;
527}
528
530file_trycdf(struct magic_set *ms, const struct buffer *b)
531{
532 int fd = b->fd;
533 const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
534 size_t nbytes = b->flen;
535 cdf_info_t info;
536 cdf_header_t h;
537 cdf_sat_t sat, ssat;
538 cdf_stream_t sst, scn;
540 int i;
541 const char *expn = "";
542 const cdf_directory_t *root_storage;
543
544 scn.sst_tab = NULL;
545 info.i_fd = fd;
546 info.i_buf = buf;
547 info.i_len = nbytes;
549 return 0;
550 if (cdf_read_header(&info, &h) == -1)
551 return 0;
552#ifdef CDF_DEBUG
553 cdf_dump_header(&h);
554#endif
555
556 if ((i = cdf_read_sat(&info, &h, &sat)) == -1) {
557 expn = "Can't read SAT";
558 goto out0;
559 }
560#ifdef CDF_DEBUG
561 cdf_dump_sat("SAT", &sat, CDF_SEC_SIZE(&h));
562#endif
563
564 if ((i = cdf_read_ssat(&info, &h, &sat, &ssat)) == -1) {
565 expn = "Can't read SSAT";
566 goto out1;
567 }
568#ifdef CDF_DEBUG
569 cdf_dump_sat("SSAT", &ssat, CDF_SHORT_SEC_SIZE(&h));
570#endif
571
572 if ((i = cdf_read_dir(&info, &h, &sat, &dir)) == -1) {
573 expn = "Can't read directory";
574 goto out2;
575 }
576
577 if ((i = cdf_read_short_stream(&info, &h, &sat, &dir, &sst,
578 &root_storage)) == -1) {
579 expn = "Cannot read short stream";
580 goto out3;
581 }
582#ifdef CDF_DEBUG
583 cdf_dump_dir(&info, &h, &sat, &ssat, &sst, &dir);
584#endif
585#ifdef notdef
586 if (root_storage) {
587 if (NOTMIME(ms)) {
588 char clsbuf[128];
589 if (file_printf(ms, "CLSID %s, ",
590 format_clsid(clsbuf, sizeof(clsbuf),
591 root_storage->d_storage_uuid)) == -1)
592 return -1;
593 }
594 }
595#endif
596
597 if (cdf_read_user_stream(&info, &h, &sat, &ssat, &sst, &dir,
598 "FileHeader", &scn) != -1) {
599#define HWP5_SIGNATURE "HWP Document File"
600 if (scn.sst_len * scn.sst_ss >= sizeof(HWP5_SIGNATURE) - 1
601 && memcmp(scn.sst_tab, HWP5_SIGNATURE,
602 sizeof(HWP5_SIGNATURE) - 1) == 0) {
603 if (NOTMIME(ms)) {
604 if (file_printf(ms,
605 "Hancom HWP (Hangul Word Processor) file, version 5.0") == -1)
606 return -1;
607 } else if (ms->flags & MAGIC_MIME_TYPE) {
608 if (file_printf(ms, "application/x-hwp") == -1)
609 return -1;
610 }
611 i = 1;
612 goto out5;
613 } else {
614 cdf_zero_stream(&scn);
615 }
616 }
617
618 if ((i = cdf_read_summary_info(&info, &h, &sat, &ssat, &sst, &dir,
619 &scn)) == -1) {
620 if (errno != ESRCH) {
621 expn = "Cannot read summary info";
622 }
623 } else {
624 i = cdf_check_summary_info(ms, &info, &h,
625 &sat, &ssat, &sst, &dir, &scn, root_storage, &expn);
626 cdf_zero_stream(&scn);
627 }
628 if (i <= 0) {
629 if ((i = cdf_read_doc_summary_info(&info, &h, &sat, &ssat,
630 &sst, &dir, &scn)) == -1) {
631 if (errno != ESRCH) {
632 expn = "Cannot read summary info";
633 }
634 } else {
635 i = cdf_check_summary_info(ms, &info, &h, &sat, &ssat,
636 &sst, &dir, &scn, root_storage, &expn);
637 }
638 }
639 if (i <= 0) {
640 i = cdf_file_dir_info(ms, &dir);
641 if (i < 0)
642 expn = "Cannot read section info";
643 }
644out5:
645 cdf_zero_stream(&scn);
646 cdf_zero_stream(&sst);
647out3:
648 efree(dir.dir_tab);
649out2:
650 efree(ssat.sat_tab);
651out1:
652 efree(sat.sat_tab);
653out0:
654 /* If we handled it already, return */
655 if (i != -1)
656 return i;
657 /* Provide a default handler */
658 if (NOTMIME(ms)) {
659 if (file_printf(ms,
660 "Composite Document File V2 Document") == -1)
661 return -1;
662 if (*expn)
663 if (file_printf(ms, ", %s", expn) == -1)
664 return -1;
665 } else if (ms->flags & MAGIC_MIME_TYPE) {
666 /* https://reposcope.com/mimetype/application/x-ole-storage */
667 if (file_printf(ms, "application/x-ole-storage") == -1)
668 return -1;
669 }
670 return 1;
671}
size_t len
Definition apprentice.c:174
fprintf($stream, string $format, mixed ... $values)
dir(string $directory, $context=null)
count(Countable|array $value, int $mode=COUNT_NORMAL)
strstr(string $haystack, string $needle, bool $before_needle=false)
strchr(string $haystack, string $needle, bool $before_needle=false)
int cdf_print_property_name(char *buf, size_t bufsiz, uint32_t p)
Definition cdf.c:1263
int cdf_zero_stream(cdf_stream_t *scn)
Definition cdf.c:299
int cdf_unpack_catalog(const cdf_header_t *h, const cdf_stream_t *sst, cdf_catalog_t **cat)
Definition cdf.c:1159
char * cdf_u16tos8(char *buf, size_t len, const uint16_t *p)
Definition cdf.c:1309
int cdf_read_summary_info(const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst, const cdf_dir_t *dir, cdf_stream_t *scn)
Definition cdf.c:824
int cdf_read_doc_summary_info(const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst, const cdf_dir_t *dir, cdf_stream_t *scn)
Definition cdf.c:815
int cdf_find_stream(const cdf_dir_t *dir, const char *name, int type)
Definition cdf.c:851
int cdf_read_dir(const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, cdf_dir_t *dir)
Definition cdf.c:673
int cdf_read_short_stream(const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, const cdf_dir_t *dir, cdf_stream_t *scn, const cdf_directory_t **root)
Definition cdf.c:771
int cdf_read_user_stream(const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst, const cdf_dir_t *dir, const char *name, cdf_stream_t *scn)
Definition cdf.c:833
int cdf_read_ssat(const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, cdf_sat_t *ssat)
Definition cdf.c:728
char s[4]
Definition cdf.c:77
int cdf_unpack_summary_info(const cdf_stream_t *sst, const cdf_header_t *h, cdf_summary_info_header_t *ssi, cdf_property_info_t **info, size_t *count)
Definition cdf.c:1120
int cdf_print_elapsed_time(char *buf, size_t bufsiz, cdf_timestamp_t ts)
Definition cdf.c:1274
int cdf_read_header(const cdf_info_t *info, cdf_header_t *h)
Definition cdf.c:367
uint16_t cdf_tole2(uint16_t sv)
Definition cdf.c:178
int cdf_read_sat(const cdf_info_t *info, cdf_header_t *h, cdf_sat_t *sat)
Definition cdf.c:444
#define CDF_DIR_TYPE_USER_STREAM
Definition cdf.h:96
int64_t cdf_timestamp_t
Definition cdf.h:86
#define pi_u32
Definition cdf.h:182
int cdf_timestamp_to_timespec(struct timespec *, cdf_timestamp_t)
Definition cdf_time.c:99
#define CDF_FLOAT
Definition cdf.h:199
#define CDF_DIR_TYPE_USER_STORAGE
Definition cdf.h:95
#define pi_s32
Definition cdf.h:183
#define CDF_FILETIME
Definition cdf.h:226
#define CDF_SIGNED32
Definition cdf.h:198
#define CDF_DOUBLE
Definition cdf.h:200
#define CDF_PROPERTY_NAME_OF_APPLICATION
Definition cdf.h:260
#define CDF_UNSIGNED32
Definition cdf.h:213
#define pi_f
Definition cdf.h:186
#define CDF_SEC_SIZE(h)
Definition cdf.h:78
#define pi_s16
Definition cdf.h:185
#define CDF_LENGTH32_STRING
Definition cdf.h:224
#define pi_d
Definition cdf.h:187
char * cdf_ctime(const time_t *, char *)
Definition cdf_time.c:169
#define CDF_CLIPBOARD
Definition cdf.h:233
#define CDF_SIGNED16
Definition cdf.h:197
#define CDF_SHORT_SEC_SIZE(h)
Definition cdf.h:80
#define CDF_NULL
Definition cdf.h:196
#define CDF_LENGTH32_WSTRING
Definition cdf.h:225
memset(ptr, 0, type->size)
zend_ffi_ctype_name_buf buf
Definition ffi.c:4685
#define file_protected
Definition file.h:111
file_protected int file_printf(struct magic_set *, const char *,...) __attribute__((__format__(__printf__
#define FILE_RCSID(id)
Definition file.h:654
#define __arraycount(a)
Definition file.h:116
#define file_private
Definition file.h:101
#define CAST(T, b)
Definition file.h:425
#define NULL
Definition gdcache.h:45
again j
#define MAGIC_EXTENSION
Definition magic.h:46
#define MAGIC_APPLE
Definition magic.h:45
#define MAGIC_MIME_TYPE
Definition magic.h:37
int fd
Definition phpdbg.h:282
file_private int cdf_file_summary_info(struct magic_set *ms, const cdf_header_t *h, const cdf_stream_t *sst, const cdf_directory_t *root_storage)
Definition readcdf.c:286
file_protected int file_trycdf(struct magic_set *ms, const struct buffer *b)
Definition readcdf.c:530
file_private int cdf_file_catalog(struct magic_set *ms, const cdf_header_t *h, const cdf_stream_t *sst)
Definition readcdf.c:255
#define HWP5_SIGNATURE
#define NOTMIME(ms)
Definition readcdf.c:44
file_private int cdf_check_summary_info(struct magic_set *ms, const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst, const cdf_dir_t *dir, cdf_stream_t *scn, const cdf_directory_t *root_storage, const char **expn)
Definition readcdf.c:376
file_private const char * cdf_app_to_mime(const char *vbuf, const struct nv *nv)
Definition readcdf.c:109
file_private struct sinfo sectioninfo[]
file_private int cdf_file_dir_info(struct magic_set *ms, const cdf_dir_t *dir)
Definition readcdf.c:501
file_private const char * cdf_clsid_to_mime(const uint64_t clsid[2], const struct cv *cv)
Definition readcdf.c:98
file_private int cdf_file_catalog_info(struct magic_set *ms, const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst, const cdf_dir_t *dir, cdf_stream_t *scn)
Definition readcdf.c:358
file_private int cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info, size_t count, const cdf_directory_t *root_storage)
Definition readcdf.c:135
zval rv
Definition session.c:1024
Definition file.h:177
const void * fbuf
Definition file.h:180
int fd
Definition file.h:178
size_t flen
Definition file.h:181
Definition cdf.h:271
cdf_catalog_entry_t cat_e[1]
Definition cdf.h:280
size_t cat_num
Definition cdf.h:279
uint16_t d_name[32]
Definition cdf.h:91
uint64_t d_storage_uuid[2]
Definition cdf.h:106
size_t i_len
Definition cdf.h:267
const unsigned char * i_buf
Definition cdf.h:266
int i_fd
Definition cdf.h:265
uint32_t s_len
Definition cdf.h:176
const char * s_buf
Definition cdf.h:177
cdf_secid_t * sat_tab
Definition cdf.h:118
size_t sst_len
Definition cdf.h:129
size_t sst_ss
Definition cdf.h:131
void * sst_tab
Definition cdf.h:128
uint16_t si_byte_order
Definition cdf.h:142
uint16_t si_os_version
Definition cdf.h:144
int flags
Definition file.h:458
const char * name
Definition readcdf.c:424
const int types[5]
Definition readcdf.c:427
const char * sections[5]
Definition readcdf.c:426
const char * mime
Definition readcdf.c:425
time_t tv_sec
Definition time.h:34
#define errno
#define efree(ptr)
Definition zend_alloc.h:155
strlen(string $string)
#define snprintf
ZEND_API char *ZEND_FASTCALL zend_str_tolower_dup(const char *source, size_t length)
zend_string * name