1 /*
2 
3 Copyright(c) 2007. Victor M. Alvarez [plusvic@gmail.com].
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14 
15 */
16 
17 #ifdef WIN32
18 #include <windows.h>
19 #define FILE_DESCRIPTOR         HANDLE
20 #else
21 #define FILE_DESCRIPTOR         int
22 #endif
23 
24 #include "stdlib.h"
25 #include "yara.h"
26 
27 
28 typedef struct _MAPPED_FILE
29 {
30     FILE_DESCRIPTOR     file;
31     size_t			    size;
32     unsigned char*      data;
33     #ifdef WIN32
34     HANDLE              mapping;
35     #endif
36 
37 } MAPPED_FILE;
38 
39 
40 int map_file(const char* file_path, MAPPED_FILE* pmapped_file);
41 
42 void unmap_file(MAPPED_FILE* pmapped_file);
43