... | ... |
@@ -30,7 +30,7 @@ |
30 | 30 |
#define CL_THREAD_SAFE 1 |
31 | 31 |
|
32 | 32 |
/* where to look for the config file */ |
33 |
-#define CONFDIR "C:\\ClamAV" |
|
33 |
+/* #undef CONFDIR */ |
|
34 | 34 |
|
35 | 35 |
/* curses header location */ |
36 | 36 |
/* #undef CURSES_INCLUDE */ |
... | ... |
@@ -81,7 +81,7 @@ |
81 | 81 |
/* #undef C_SOLARIS */ |
82 | 82 |
|
83 | 83 |
/* Path to virus database directory. */ |
84 |
-#define DATADIR "C:\\ClamAV\\db" |
|
84 |
+/* #undef DATADIR */ |
|
85 | 85 |
|
86 | 86 |
/* "default FD_SETSIZE value" */ |
87 | 87 |
#define DEFAULT_FD_SETSIZE 1024 |
... | ... |
@@ -62,26 +62,36 @@ BOOL APIENTRY DllMain(HMODULE hm, DWORD why, LPVOID rsrv) { |
62 | 62 |
|
63 | 63 |
/* |
64 | 64 |
The trick is: |
65 |
- 1 - Reinclude clamav-config.h which is not guarded against multiple inclusions. |
|
66 |
- In platform.h we do undef them and re-export as extern pointers, however, since |
|
67 |
- platform.h is guarded, the undef won't trigger. |
|
68 |
- This gives back to us the original CONFDIR and DATADIR macroes. |
|
65 |
+ 1 - Define BACKUP_DATADIR and BACKUP_CONFDIR macros directly, rather than |
|
66 |
+ defining them in clamav-config.h, because it is not guarded against multiple inclusions. |
|
69 | 67 |
2 - We define _static_ buffers to contain those strings. |
70 | 68 |
3 - We undef the macroes, which re-turns them back into extern pointers and we set them |
71 |
- to point to the above defined buffer. |
|
72 |
- 4 - We now give the original macros the names of the above buffers and include optparser.c |
|
73 |
- This result in clam_options struct in optparser be defined with proper pointers. |
|
69 |
+ to point to the above defined buffer. |
|
70 |
+ 4 - We now give the original macros the names of the above buffers and include optparser.c. |
|
71 |
+ This result in clam_options struct in optparser be defined with proper pointers. |
|
72 |
+ |
|
73 |
+ In platform.h, we export DATADIR and CONFDIR as extern pointers so they are available |
|
74 |
+ directly to libclamav users. |
|
74 | 75 |
*/ |
75 | 76 |
|
76 |
-#include "clamav-config.h" |
|
77 |
-char _DATADIR[MAX_PATH] = DATADIR; |
|
78 |
-char _CONFDIR[MAX_PATH] = CONFDIR; |
|
79 |
-char _CONFDIR_CLAMD[MAX_PATH] = CONFDIR"\\clamd.conf"; |
|
80 |
-char _CONFDIR_FRESHCLAM[MAX_PATH] = CONFDIR"\\freshclam.conf"; |
|
81 |
-char _CONFDIR_MILTER[MAX_PATH] = CONFDIR"\\clamav-milter.conf"; |
|
77 |
+#ifndef BACKUP_DATADIR |
|
78 |
+#define BACKUP_DATADIR "C:\\ClamAV\\db" |
|
79 |
+#endif |
|
80 |
+#ifndef BACKUP_CONFDIR |
|
81 |
+#define BACKUP_CONFDIR "C:\\ClamAV" |
|
82 |
+#endif |
|
83 |
+char _DATADIR[MAX_PATH] = BACKUP_DATADIR; |
|
84 |
+char _CONFDIR[MAX_PATH] = BACKUP_CONFDIR; |
|
85 |
+char _CONFDIR_CLAMD[MAX_PATH] = BACKUP_CONFDIR"\\clamd.conf"; |
|
86 |
+char _CONFDIR_FRESHCLAM[MAX_PATH] = BACKUP_CONFDIR"\\freshclam.conf"; |
|
87 |
+char _CONFDIR_MILTER[MAX_PATH] = BACKUP_CONFDIR"\\clamav-milter.conf"; |
|
82 | 88 |
|
89 |
+#ifdef DATADIR |
|
83 | 90 |
#undef DATADIR |
91 |
+#endif |
|
92 |
+#ifdef DATADIR |
|
84 | 93 |
#undef CONFDIR |
94 |
+#endif |
|
85 | 95 |
const char *DATADIR = _DATADIR; |
86 | 96 |
const char *CONFDIR = _CONFDIR; |
87 | 97 |
const char *CONFDIR_CLAMD = _CONFDIR_CLAMD; |