#pragma once #include "stdio.h" #include "stdlib.h" #include "string.h" #ifdef _WIN32 #include #include #include #else #include #include "unistd.h" #include "stdint.h" #include "limits.h" #include "fcntl.h" #include "dlfcn.h" #include "sys/types.h" #include "sys/socket.h" #include "sys/ioctl.h" #include "arpa/inet.h" #include "netinet/in.h" #include "netinet/tcp.h" typedef intptr_t LPARAM; typedef int BOOL, INT, LONG; typedef char CHAR; typedef const char *LPCSTR; typedef unsigned char BYTE, *PBYTE, UCHAR; typedef short SHORT; typedef unsigned short USHORT, WORD; typedef unsigned int UINT, DWORD, ULONG, UINT_PTR, DWORD_PTR, WPARAM; typedef void *LPVOID, *HWND, *HANDLE, *HINSTANCE; typedef int __int32, SOCKET; typedef long long LONGLONG; typedef unsigned long long ULONGLONG, UINT64, DWORDLONG; #define TRUE 1 #define FALSE 0 #define MAX_PATH PATH_MAX #define __stdcall #define WM_USER 0x0400 #define _countof(v) (sizeof(v) / sizeof(v[0])) #define TEXT(s) s #define _T(s) s //#define min(a, b) (((a) < (b)) ? (a) : (b)) //#define max(a, b) (((a) > (b)) ? (a) : (b)) #define _snprintf snprintf #define _vsnprintf vsnprintf #define stricmp strcasecmp #define INVALID_SOCKET (SOCKET)(~0) #define SOCKET_ERROR (-1) typedef sockaddr_in SOCKADDR_IN; #define closesocket close #define WSAGetLastError() errno #define WSAEWOULDBLOCK EAGAIN #define WSAEINVAL EAGAIN #define WSAEISCONN EISCONN #define MAKEWORD(a, b) ((WORD)(((BYTE)(((DWORD_PTR)(a)) & 0xff)) | ((WORD)((BYTE)(((DWORD_PTR)(b)) & 0xff))) << 8)) #define MAKELONG(a, b) ((LONG)(((WORD)(((DWORD_PTR)(a)) & 0xffff)) | ((DWORD)((WORD)(((DWORD_PTR)(b)) & 0xffff))) << 16)) #define MAKEWPARAM(l, h) ((WPARAM)(DWORD)MAKELONG(l, h)) #define MAKELPARAM(l, h) ((LPARAM)(DWORD)MAKELONG(l, h)) #define MAKELRESULT(l, h) ((LRESULT)(DWORD)MAKELONG(l, h)) #define LOWORD(l) ((WORD)(((DWORD_PTR)(l)) & 0xffff)) #define HIWORD(l) ((WORD)((((DWORD_PTR)(l)) >> 16) & 0xffff)) #define LOBYTE(w) ((BYTE)(((DWORD_PTR)(w)) & 0xff)) #define HIBYTE(w) ((BYTE)((((DWORD_PTR)(w)) >> 8) & 0xff)) #endif