clamav/win32/platform.h

126 lines
2.7 KiB
C
Raw Normal View History

#ifndef __PLATFORM_H
#define __PLATFORM_H
#include <winsock2.h>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
2009-10-12 23:34:17 +02:00
#include <io.h>
2010-03-18 01:43:53 +01:00
#include <fcntl.h>
2009-10-12 23:34:17 +02:00
#include <direct.h>
2009-10-14 18:59:38 +02:00
#include <Ws2tcpip.h>
#include <process.h>
2009-10-12 23:34:17 +02:00
2010-03-23 00:09:52 +01:00
#ifdef __cplusplus
extern "C"
{
#endif
2009-10-13 20:14:52 +02:00
#include "gettimeofday.h"
2009-10-13 00:54:49 +02:00
#include "snprintf.h"
2009-10-14 18:59:38 +02:00
#include "net.h"
2009-10-15 02:39:29 +02:00
#include "w32_errno.h"
2009-10-16 20:10:34 +02:00
#include "w32_stat.h"
#include "random.h"
2011-04-18 17:25:23 +02:00
#include "utf8_util.h"
2009-10-13 00:54:49 +02:00
2010-03-23 00:09:52 +01:00
#ifdef __cplusplus
}
#else
2009-10-13 20:14:52 +02:00
typedef unsigned short mode_t;
#endif
2009-10-15 02:39:29 +02:00
2010-05-15 22:46:08 +02:00
#ifdef _WIN64
#define SIZEOF_VOID_P 8
#else
#define SIZEOF_VOID_P 4
#endif
2009-10-12 23:34:17 +02:00
#define strcasecmp lstrcmpi
#define strncasecmp strnicmp
2009-10-12 23:36:13 +02:00
#define mkdir(path, mode) mkdir(path)
2010-03-09 02:44:47 +01:00
#define sleep(sex) Sleep(1000*(sex))
2009-10-15 02:39:29 +02:00
#define getuid() 0
#define getgid() 0
char *strptime(const char *s, const char *format, struct tm *tm);
2009-10-12 23:35:32 +02:00
#define srand w32_srand
#define rand w32_rand
2009-10-14 18:59:38 +02:00
#define socket w32_socket
2009-10-15 02:39:29 +02:00
#define getsockopt w32_getsockopt
#define setsockopt w32_setsockopt
#define bind w32_bind
2010-01-28 23:36:37 +01:00
#define listen w32_listen
#define accept w32_accept
2009-10-14 18:59:38 +02:00
#define connect w32_connect
2010-01-28 23:36:37 +01:00
#define shutdown w32_shutdown
2009-10-14 18:59:38 +02:00
#define send w32_send
2009-10-15 02:39:29 +02:00
#define recv w32_recv
#define closesocket w32_closesocket
#define getservbyname w32_getservbyname
#define getaddrinfo w32_getaddrinfo
2010-06-25 23:29:57 +02:00
#ifdef gai_strerror
#undef gai_strerror
#endif
2010-05-10 14:12:23 +02:00
#define gai_strerror w32_strerror
2009-10-15 02:39:29 +02:00
#define freeaddrinfo w32_freeaddrinfo
#define inet_ntop w32_inet_ntop
2011-05-06 21:26:55 +03:00
#define inet_ntoa w32_inet_ntoa
#define getpeername w32_getpeername
2009-10-15 02:39:29 +02:00
#define gethostbyname w32_gethostbyname
#define select w32_select
2010-01-29 14:44:55 +01:00
#define poll w32_poll
2010-01-28 23:36:37 +01:00
#define strerror w32_strerror
#define strerror_r w32_strerror_r
#define ftruncate _chsize
2009-10-15 02:39:29 +02:00
#define getpid GetCurrentProcessId
2009-10-13 20:14:52 +02:00
2009-10-12 23:35:32 +02:00
#define PATH_MAX 32767
2009-10-12 23:36:13 +02:00
#define SEARCH_LIBDIR ""
2010-05-10 14:12:23 +02:00
#define WORDS_BIGENDIAN 0
#define EAI_SYSTEM 0
2009-10-12 23:35:32 +02:00
2009-10-12 23:34:17 +02:00
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef HAVE_IN_PORT_T
typedef unsigned short in_port_t;
#endif
#ifndef HAVE_IN_ADDR_T
typedef unsigned int in_addr_t;
#endif
#define PATHSEP "\\"
2010-03-18 01:43:53 +01:00
void w32_glob(int *argc_ptr, char ***argv_ptr);
2009-10-20 19:44:45 +02:00
#undef DATADIR
#undef CONFDIR
2009-10-31 19:12:50 +01:00
#if !defined(THIS_IS_LIBCLAMAV) && defined(_MSC_VER)
#define LIBCLAMAV_EXPORT __declspec(dllimport)
#else
#define LIBCLAMAV_EXPORT
#endif
LIBCLAMAV_EXPORT extern const char *DATADIR;
LIBCLAMAV_EXPORT extern const char *CONFDIR;
LIBCLAMAV_EXPORT extern const char *CONFDIR_CLAMD;
LIBCLAMAV_EXPORT extern const char *CONFDIR_FRESHCLAM;
LIBCLAMAV_EXPORT extern const char *CONFDIR_MILTER;
2009-10-20 19:44:45 +02:00
#undef HAVE_CONFIG_H
2009-11-01 21:27:15 +01:00
#ifdef OUT
#undef OUT
#endif
2010-03-18 01:43:53 +01:00
int real_main(int, char**);
#define main main(int argc, char **argv) { _setmode(_fileno(stdin), _O_BINARY); w32_glob(&argc, &argv); return real_main(argc, argv); }; int real_main
2009-11-01 21:27:15 +01:00
#endif /* __PLATFORM_H */
2010-05-10 14:12:23 +02:00