-
Notifications
You must be signed in to change notification settings - Fork 0
/
compatbits.h
226 lines (158 loc) · 4.4 KB
/
compatbits.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/*
Stuff to make compiling on WINDOWS and LINUX easier
*/
#ifndef _COMPATBITS_
#define _COMPATBITS_
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <time.h>
#ifndef MACBPQ
#include <malloc.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#ifdef WIN32
#define _CRT_SECURE_NO_DEPRECATE
#define _USE_32BIT_TIME_T
#include <crtdbg.h>
#include "winstdint.h"
#include "winsock2.h"
#include "WS2tcpip.h"
#include <windowsx.h>
#include <Richedit.h>
#include "commctrl.h"
#include "Commdlg.h"
#include <shellapi.h>
#define Dll __declspec(dllexport)
#define DllExport __declspec(dllexport)
#define ioctl ioctlsocket
#define pthread_t DWORD
int pthread_equal(pthread_t T1, pthread_t T2);
#else
int Sleep(int ms);
int GetTickCount();
#define ioctlsocket ioctl
#define Dll
#define DllExport
#include <unistd.h>
#include <time.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <signal.h>
#include <sys/select.h>
#include <stdarg.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <netdb.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <termios.h>
#include <fcntl.h>
#include <syslog.h>
#include <pthread.h>
#define BOOL int
#define VOID void
#define UCHAR unsigned char
#define USHORT unsigned short
#define ULONG unsigned long
#define UINT unsigned int
#define SHORT short
#define DWORD unsigned int
#define BYTE unsigned char
#define APIENTRY
#define WINAPI
#define WINUSERAPI
#define TCHAR char
#define TRUE 1
#define FALSE 0
#define FAR
#define byte UCHAR
//#define Byte UCHAR
#define Word WORD
typedef DWORD COLORREF;
#define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((USHORT)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))
#define GetRValue(rgb) rgb & 0xFF
#define GetGValue(rgb) (rgb >> 8) & 0xFF
#define GetBValue(rgb) (rgb >> 16) & 0xFF
#define HWND unsigned int
#define HINSTANCE unsigned int
#define HKEY unsigned int
#define UINT_PTR unsigned int *
#define HANDLE UINT
#define SOCKET int
#define INVALID_SOCKET (SOCKET)(~0)
#define SOCKET_ERROR (-1)
#define HMENU UINT
#define WNDPROC UINT
#define __cdecl
#define strtok_s strtok_r
#define _memicmp memicmp
#define _stricmp stricmp
#define _strdup strdup
#define _strupr strupr
#define _strlwr strlwr
#define _snprintf snprintf
#define _gcvt gcvt
#define _fcvt fcvt
#define _atoi64 atoll
#define DeleteFile unlink
#define MoveFile rename
#define CreateDirectory mkdir
int sprintf_s(char * string, int plen, const char * format, ...);
int memicmp(unsigned char *a, unsigned char *b, int n);
int stricmp(const unsigned char * pStr1, const unsigned char *pStr2);
char * strupr(char* s);
char * strlwr(char* s);
#define WSAGetLastError() errno
#define GetLastError() errno
#define closesocket close
#define GetCurrentProcessId getpid
#define GetCurrentThreadId pthread_self
char * inet_ntoa(struct in_addr in);
#define LOBYTE(w) ((BYTE)((ULONG *)(w) & 0xff))
#define HIBYTE(w) ((BYTE)((ULONG *)(w) >> 8))
#define LOWORD(l) ((SHORT) ((l) & 0xffff))
#define WSAEWOULDBLOCK 11
#define MAX_PATH 250
typedef int (*PROC)();
typedef struct tagRECT
{
unsigned int left;
unsigned int top;
unsigned int right;
unsigned int bottom;
} RECT, *PRECT, *NPRECT, *LPRECT;
#define HBRUSH int
#define _timezone timezone
#endif
#ifdef LINBPQ
#ifndef WIN32
void SetWindowText(HWND hWnd, char * lpString);
BOOL MySetDlgItemText(HWND hWnd, int item, char * lpString);
BOOL CopyFile(char * In, char * Out, BOOL Failifexists);
int GetNumberofPorts();
int SendMsg(int stream, char * msg, int len);
int SendRaw(int port, char * msg, int len);
VOID md5(char *arg, unsigned char * checksum);
// Send Raw (KISS mode) frame to port (BPQHOST function 10)
int APIENTRY SendRaw(int port, char * msg, int len);
BOOL MySetDlgItemText();
VOID OutputDebugString(char * string);
#endif
#ifdef APIENTRY
#undef APIENTRY
#endif
#define APIENTRY
typedef struct sockaddr_in SOCKADDR_IN;
typedef struct sockaddr_in *PSOCKADDR_IN;
typedef struct sockaddr_in *LPSOCKADDR_IN;
typedef struct sockaddr SOCKADDR;
typedef struct sockaddr *PSOCKADDR;
typedef struct sockaddr *LPSOCKADDR;
#define __int16 short
#define __int32 long
#endif
#endif