Browse code

various fixes for windows build

Kevin Lin authored on 2015/06/02 03:32:04
Showing 8 changed files
... ...
@@ -35,6 +35,7 @@
35 35
 #include "matcher-ac.h"
36 36
 #include "matcher-pcre.h"
37 37
 #include "mpool.h"
38
+#include "readdb.h"
38 39
 #include "regex_pcre.h"
39 40
 
40 41
 #if HAVE_PCRE
... ...
@@ -77,7 +78,7 @@ static void pcre_perf_events_init(struct cli_pcre_meta *pm, const char *virname)
77 77
         virname = "(null)";
78 78
 
79 79
     /* set the name */
80
-    pm->statname = cli_calloc(1, namelen);
80
+    pm->statname = (char*)cli_calloc(1, namelen);
81 81
     if (!pm->statname) {
82 82
         return;
83 83
     }
... ...
@@ -113,8 +114,8 @@ struct sigperf_elem {
113 113
 
114 114
 static int sigelem_comp(const void * a, const void * b)
115 115
 {
116
-    const struct sigperf_elem *ela = a;
117
-    const struct sigperf_elem *elb = b;
116
+    const struct sigperf_elem *ela = (const struct sigperf_elem *)a;
117
+    const struct sigperf_elem *elb = (const struct sigperf_elem *)b;
118 118
     return elb->usecs/elb->run_count - ela->usecs/ela->run_count;
119 119
 }
120 120
 
... ...
@@ -56,6 +56,7 @@
56 56
 #include "bytecode_priv.h"
57 57
 #include "bytecode_api_impl.h"
58 58
 #include "yara_clam.h"
59
+#include "yara_exec.h"
59 60
 
60 61
 #ifdef CLI_PERF_LOGGING
61 62
 
... ...
@@ -76,6 +76,7 @@
76 76
 #include "bytecode.h"
77 77
 #include "bytecode_api_impl.h"
78 78
 #include "cache.h"
79
+#include "readdb.h"
79 80
 #include "stats.h"
80 81
 
81 82
 int (*cli_unrar_open)(int fd, const char *dirname, unrar_state_t *state);
... ...
@@ -23,6 +23,7 @@
23 23
 #endif
24 24
 
25 25
 #include <stdio.h>
26
+#include <stdint.h>
26 27
 #include <stdlib.h>
27 28
 #include <string.h>
28 29
 #include <ctype.h>
... ...
@@ -83,6 +84,8 @@ static pthread_mutex_t cli_ref_mutex = PTHREAD_MUTEX_INITIALIZER;
83 83
 #endif
84 84
 #include "yara_clam.h"
85 85
 #include "yara_compiler.h"
86
+#include "yara_grammar.h"
87
+#include "yara_lexer.h"
86 88
 
87 89
 
88 90
 #define MAX_LDB_SUBSIGS 64
... ...
@@ -18,6 +18,10 @@ limitations under the License.
18 18
 #include <stdio.h>
19 19
 #include <string.h>
20 20
 
21
+#ifdef _WIN32
22
+#include <stdint.h>
23
+#endif
24
+
21 25
 #ifdef REAL_YARA
22 26
 #include <yara/utils.h>
23 27
 #include <yara/compiler.h>
... ...
@@ -55,6 +55,8 @@ typedef unsigned char flex_uint8_t;
55 55
 typedef unsigned short int flex_uint16_t;
56 56
 typedef unsigned int flex_uint32_t;
57 57
 
58
+/* Windows' <stdint.h> does not wrap its macro definitions */
59
+#ifndef _WIN32
58 60
 /* Limits of integral types. */
59 61
 #ifndef INT8_MIN
60 62
 #define INT8_MIN               (-128)
... ...
@@ -84,6 +86,8 @@ typedef unsigned int flex_uint32_t;
84 84
 #define UINT32_MAX             (4294967295U)
85 85
 #endif
86 86
 
87
+#endif /* ! _WIN32 */
88
+
87 89
 #endif /* ! C99 */
88 90
 
89 91
 #endif /* ! FLEXINT_H */
... ...
@@ -145,6 +145,9 @@ struct qm_trace {
145 145
 #define	TRASHIT(x)
146 146
 #endif	/* QUEUE_MACRO_DEBUG */
147 147
 
148
+/* SLIST_ENTRY macro collides with winnt.h definition */
149
+#ifndef _WIN32
150
+
148 151
 /*
149 152
  * Singly-linked List declarations.
150 153
  */
... ...
@@ -238,6 +241,8 @@ struct {								\
238 238
 	SLIST_FIRST(head2) = swap_first;				\
239 239
 } while (0)
240 240
 
241
+#endif /* ! _WIN32 */
242
+
241 243
 /*
242 244
  * Singly-linked Tail queue declarations.
243 245
  */
... ...
@@ -1998,7 +1998,7 @@ static void matchsig(const char *sig, const char *offset, int fd)
1998 1998
 	return;
1999 1999
     }
2000 2000
 
2001
-    if(cli_parse_add(engine->root[0], "test", sig, NULL, 0, 0, "*", 0, NULL, 0) != CL_SUCCESS) {
2001
+    if(cli_parse_add(engine->root[0], "test", sig, 0, 0, 0, "*", 0, NULL, 0) != CL_SUCCESS) {
2002 2002
 	mprintf("!matchsig: Can't parse signature\n");
2003 2003
 	cl_engine_free(engine);
2004 2004
 	return;
... ...
@@ -2907,7 +2907,7 @@ static int dumpcerts(const struct optstruct *opts)
2907 2907
 	return -1;
2908 2908
     }
2909 2909
 
2910
-    if(cli_parse_add(engine->root[0], "test", "deadbeef", NULL, 0, 0, "*", 0, NULL, 0) != CL_SUCCESS) {
2910
+    if(cli_parse_add(engine->root[0], "test", "deadbeef", 0, 0, 0, "*", 0, NULL, 0) != CL_SUCCESS) {
2911 2911
 	mprintf("!dumpcerts: Can't parse signature\n");
2912 2912
 	cl_engine_free(engine);
2913 2913
 	return -1;