1 /*
2  *  Extract VBA source code for component MS Office Documents
3  *
4  *  Copyright (C) 2013-2022 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
5  *  Copyright (C) 2007-2013 Sourcefire, Inc.
6  *
7  *  Authors: Trog, Nigel Horne
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License version 2 as
11  *  published by the Free Software Foundation.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21  *  MA 02110-1301, USA.
22  */
23 
24 #ifndef __VBA_EXTRACT_H
25 #define __VBA_EXTRACT_H
26 
27 #include "others.h"
28 #include "clamav-types.h"
29 #include "uniq.h"
30 
31 typedef struct vba_project_tag {
32     char **name;
33     uint32_t *colls;
34     uint32_t *offset;
35     uint32_t *length;   /* for Word 6 macros */
36     unsigned char *key; /* for Word 6 macros */
37     char *dir;
38     struct uniq *U;
39     int count;
40 } vba_project_t;
41 
42 vba_project_t *cli_vba_readdir(const char *dir, struct uniq *U, uint32_t which);
43 cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, const char *hash, uint32_t which, int *tempfd, int *has_macros);
44 vba_project_t *cli_wm_readdir(int fd);
45 void cli_free_vba_project(vba_project_t *vba_project);
46 
47 unsigned char *cli_vba_inflate(int fd, off_t offset, size_t *size);
48 int cli_scan_ole10(int fd, cli_ctx *ctx);
49 char *cli_ppt_vba_read(int fd, cli_ctx *ctx);
50 unsigned char *cli_wm_decrypt_macro(int fd, off_t offset, uint32_t len,
51                                     unsigned char key);
52 #endif
53