source: trunk/include/dbgwrap.h@ 10504

Last change on this file since 10504 was 10395, checked in by sandervl, 22 years ago

KSO: Updates

File size: 32.5 KB
RevLine 
[7862]1#ifndef __DBBWRAP_H__
2#define __DBBWRAP_H__
3
4#include <odinwrap.h>
5
[10395]6#define NO_CALLER
7#ifndef NO_CALLER
8#define DBGWRAP_CALLER_FMT "%08x "
9#define DBGWRAP_CALLER_ARG ((unsigned *)&(arg1))[-1],
10#else
11#define DBGWRAP_CALLER_FMT
12#define DBGWRAP_CALLER_ARG
13#endif
14
[7862]15typedef DWORD (* WIN32API DBG_WINPROC0)();
16typedef DWORD (* WIN32API DBG_WINPROC4)(DWORD);
17typedef DWORD (* WIN32API DBG_WINPROC4_NORET)(DWORD);
18typedef DWORD (* WIN32API DBG_WINPROC8)(DWORD, DWORD);
19typedef DWORD (* WIN32API DBG_WINPROC12)(DWORD, DWORD, DWORD);
20typedef DWORD (* WIN32API DBG_WINPROC16)(DWORD, DWORD, DWORD, DWORD);
21typedef DWORD (* WIN32API DBG_WINPROC20)(DWORD, DWORD, DWORD, DWORD, DWORD);
22typedef DWORD (* WIN32API DBG_WINPROC24)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
23typedef DWORD (* WIN32API DBG_WINPROC28)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
24typedef DWORD (* WIN32API DBG_WINPROC32)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
25typedef DWORD (* WIN32API DBG_WINPROC36)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
26typedef DWORD (* WIN32API DBG_WINPROC40)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
27typedef DWORD (* WIN32API DBG_WINPROC44)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
28typedef DWORD (* WIN32API DBG_WINPROC48)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
[7922]29typedef DWORD (* WIN32API DBG_WINPROC52)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
[9430]30typedef DWORD (* WIN32API DBG_WINPROC56)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
[7862]31
[9430]32
[7862]33#define DEBUGWRAP0(a) \
34DWORD WIN32API Dbg##a() \
35{ \
36 DWORD ret; \
37 dprintf((DBGWRAP_MODULE": %s", #a)); \
38 dbg_ThreadPushCall(#a); \
39 ret = (DWORD)a(); \
40 dbg_ThreadPopCall(); \
41 dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
42 return ret; \
43}
44
45#define DEBUGWRAP0_NORET(a) \
46void WIN32API Dbg##a() \
47{ \
48 DWORD ret; \
49 dprintf((DBGWRAP_MODULE": %s", #a)); \
50 dbg_ThreadPushCall(#a); \
51 a(); \
52 dbg_ThreadPopCall(); \
[10395]53 dprintf((DBGWRAP_MODULE": %s returned (void)\n", #a)); \
[7862]54}
55
56#define DEBUGWRAP4(a) \
57DWORD WIN32API Dbg##a(DWORD arg1) \
58{ \
59 DWORD ret; \
[10395]60 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x\n", DBGWRAP_CALLER_ARG #a, arg1)); \
[7862]61 dbg_ThreadPushCall(#a); \
62 ret = ((DBG_WINPROC4)a)(arg1); \
63 dbg_ThreadPopCall(); \
[10395]64 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]65 return ret; \
66}
67
68#define DEBUGWRAP4_NORET(a) \
69void WIN32API Dbg##a(DWORD arg1) \
70{ \
[10395]71 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x\n", DBGWRAP_CALLER_ARG #a, arg1)); \
[7862]72 dbg_ThreadPushCall(#a); \
73 ((DBG_WINPROC4_NORET)a)(arg1); \
74 dbg_ThreadPopCall(); \
[10395]75 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned void\n", DBGWRAP_CALLER_ARG #a)); \
[7862]76}
77
78#define DEBUGWRAP8(a) \
79DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2) \
80{ \
81 DWORD ret; \
[10395]82 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2)); \
[7862]83 dbg_ThreadPushCall(#a); \
84 ret = ((DBG_WINPROC8)a)(arg1, arg2); \
85 dbg_ThreadPopCall(); \
[10395]86 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]87 return ret; \
88}
89
[8539]90#define DEBUGWRAP8_NORET(a) \
91void WIN32API Dbg##a(DWORD arg1, DWORD arg2) \
92{ \
[10395]93 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2)); \
[8539]94 dbg_ThreadPushCall(#a); \
95 ((DBG_WINPROC8)a)(arg1, arg2); \
96 dbg_ThreadPopCall(); \
[10395]97 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned void\n", DBGWRAP_CALLER_ARG #a)); \
[8539]98}
99
[7862]100#define DEBUGWRAP12(a) \
101DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3) \
102{ \
103 DWORD ret; \
[10395]104 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3)); \
[7862]105 dbg_ThreadPushCall(#a); \
106 ret = ((DBG_WINPROC12)a)(arg1, arg2, arg3); \
107 dbg_ThreadPopCall(); \
[10395]108 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]109 return ret; \
110}
111
112#define DEBUGWRAP16(a) \
113DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4) \
114{ \
115 DWORD ret; \
[10395]116 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4)); \
[7862]117 dbg_ThreadPushCall(#a); \
118 ret = ((DBG_WINPROC16)a)(arg1, arg2, arg3, arg4); \
119 dbg_ThreadPopCall(); \
[10395]120 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]121 return ret; \
122}
123
124#define DEBUGWRAP20(a) \
125DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5) \
126{ \
127 DWORD ret; \
[10395]128 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5)); \
[7862]129 dbg_ThreadPushCall(#a); \
130 ret = ((DBG_WINPROC20)a)(arg1, arg2, arg3, arg4, arg5); \
131 dbg_ThreadPopCall(); \
[10395]132 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]133 return ret; \
134}
135
136#define DEBUGWRAP24(a) \
137DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6) \
138{ \
139 DWORD ret; \
[10395]140 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6)); \
[7862]141 dbg_ThreadPushCall(#a); \
142 ret = ((DBG_WINPROC24)a)(arg1, arg2, arg3, arg4, arg5, arg6); \
143 dbg_ThreadPopCall(); \
[10395]144 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]145 return ret; \
146}
147
148#define DEBUGWRAP28(a) \
149DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7) \
150{ \
151 DWORD ret; \
[10395]152 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7)); \
[7862]153 dbg_ThreadPushCall(#a); \
154 ret = ((DBG_WINPROC28)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
155 dbg_ThreadPopCall(); \
[10395]156 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]157 return ret; \
158}
159
160#define DEBUGWRAP32(a) \
161DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8) \
162{ \
163 DWORD ret; \
[10395]164 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)); \
[7862]165 dbg_ThreadPushCall(#a); \
166 ret = ((DBG_WINPROC32)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
167 dbg_ThreadPopCall(); \
[10395]168 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]169 return ret; \
170}
171
172#define DEBUGWRAP36(a) \
173DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9) \
174{ \
175 DWORD ret; \
[10395]176 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)); \
[7862]177 dbg_ThreadPushCall(#a); \
178 ret = ((DBG_WINPROC36)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
179 dbg_ThreadPopCall(); \
[10395]180 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]181 return ret; \
182}
183
184#define DEBUGWRAP40(a) \
185DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10) \
186{ \
187 DWORD ret; \
[10395]188 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)); \
[7862]189 dbg_ThreadPushCall(#a); \
190 ret = ((DBG_WINPROC40)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
191 dbg_ThreadPopCall(); \
[10395]192 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]193 return ret; \
194}
195
196#define DEBUGWRAP44(a) \
197DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10, DWORD arg11) \
198{ \
199 DWORD ret; \
[10395]200 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11)); \
[7862]201 dbg_ThreadPushCall(#a); \
202 ret = ((DBG_WINPROC44)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
203 dbg_ThreadPopCall(); \
[10395]204 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]205 return ret; \
206}
207
208#define DEBUGWRAP48(a) \
209DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10, DWORD arg11, DWORD arg12) \
210{ \
211 DWORD ret; \
[10395]212 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12)); \
[7862]213 dbg_ThreadPushCall(#a); \
214 ret = ((DBG_WINPROC48)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
215 dbg_ThreadPopCall(); \
[10395]216 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]217 return ret; \
218}
219
[7922]220#define DEBUGWRAP52(a) \
221DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10, DWORD arg11, DWORD arg12, DWORD arg13) \
222{ \
223 DWORD ret; \
[10395]224 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x %x %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13)); \
[7922]225 dbg_ThreadPushCall(#a); \
226 ret = ((DBG_WINPROC52)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
227 dbg_ThreadPopCall(); \
[10395]228 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7922]229 return ret; \
230}
231
[9430]232#define DEBUGWRAP56(a) \
233DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10, DWORD arg11, DWORD arg12, DWORD arg13, DWORD arg14) \
234{ \
235 DWORD ret; \
[10395]236 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x %x %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13)); \
[9430]237 dbg_ThreadPushCall(#a); \
238 ret = ((DBG_WINPROC56)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
239 dbg_ThreadPopCall(); \
[10395]240 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[9430]241 return ret; \
242}
243
[7862]244//level 2 logging
245
246#define DEBUGWRAP_LVL2_0(a) \
247DWORD WIN32API Dbg##a() \
248{ \
249 DWORD ret; \
[10395]250 dprintf2((DBGWRAP_MODULE": %s\n", #a)); \
[7862]251 dbg_ThreadPushCall(#a); \
252 ret = ((DBG_WINPROC0)a)(); \
253 dbg_ThreadPopCall(); \
[10395]254 dprintf2((DBGWRAP_MODULE": %s returned %x\n", #a, ret)); \
[7862]255 return ret; \
256}
257
258#define DEBUGWRAP_LVL2_4(a) \
259DWORD WIN32API Dbg##a(DWORD arg1) \
260{ \
261 DWORD ret; \
[10395]262 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x\n", DBGWRAP_CALLER_ARG #a, arg1)); \
[7862]263 dbg_ThreadPushCall(#a); \
264 ret = ((DBG_WINPROC4)a)(arg1); \
265 dbg_ThreadPopCall(); \
[10395]266 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]267 return ret; \
268}
269
270#define DEBUGWRAP_LVL2_8(a) \
271DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2) \
272{ \
273 DWORD ret; \
[10395]274 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2)); \
[7862]275 dbg_ThreadPushCall(#a); \
276 ret = ((DBG_WINPROC8)a)(arg1, arg2); \
277 dbg_ThreadPopCall(); \
[10395]278 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]279 return ret; \
280}
281
282#define DEBUGWRAP_LVL2_12(a) \
283DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3) \
284{ \
285 DWORD ret; \
[10395]286 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3)); \
[7862]287 dbg_ThreadPushCall(#a); \
288 ret = ((DBG_WINPROC12)a)(arg1, arg2, arg3); \
289 dbg_ThreadPopCall(); \
[10395]290 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]291 return ret; \
292}
293
294#define DEBUGWRAP_LVL2_16(a) \
295DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4) \
296{ \
297 DWORD ret; \
[10395]298 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4)); \
[7862]299 dbg_ThreadPushCall(#a); \
300 ret = ((DBG_WINPROC16)a)(arg1, arg2, arg3, arg4); \
301 dbg_ThreadPopCall(); \
[10395]302 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]303 return ret; \
304}
305
306#define DEBUGWRAP_LVL2_20(a) \
307DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5) \
308{ \
309 DWORD ret; \
[10395]310 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5)); \
[7862]311 dbg_ThreadPushCall(#a); \
312 ret = ((DBG_WINPROC20)a)(arg1, arg2, arg3, arg4, arg5); \
313 dbg_ThreadPopCall(); \
[10395]314 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]315 return ret; \
316}
317
318#define DEBUGWRAP_LVL2_24(a) \
319DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6) \
320{ \
321 DWORD ret; \
[10395]322 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6)); \
[7862]323 dbg_ThreadPushCall(#a); \
324 ret = ((DBG_WINPROC24)a)(arg1, arg2, arg3, arg4, arg5, arg6); \
325 dbg_ThreadPopCall(); \
[10395]326 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]327 return ret; \
328}
329
330#define DEBUGWRAP_LVL2_28(a) \
331DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7) \
332{ \
333 DWORD ret; \
[10395]334 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7)); \
[7862]335 dbg_ThreadPushCall(#a); \
336 ret = ((DBG_WINPROC28)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
337 dbg_ThreadPopCall(); \
[10395]338 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]339 return ret; \
340}
341
342#define DEBUGWRAP_LVL2_32(a) \
343DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8) \
344{ \
345 DWORD ret; \
[10395]346 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)); \
[7862]347 dbg_ThreadPushCall(#a); \
348 ret = ((DBG_WINPROC32)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
349 dbg_ThreadPopCall(); \
[10395]350 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]351 return ret; \
352}
353
354#define DEBUGWRAP_LVL2_36(a) \
355DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9) \
356{ \
357 DWORD ret; \
[10395]358 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)); \
[7862]359 dbg_ThreadPushCall(#a); \
360 ret = ((DBG_WINPROC36)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
361 dbg_ThreadPopCall(); \
[10395]362 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]363 return ret; \
364}
365
366#define DEBUGWRAP_LVL2_40(a) \
367DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10) \
368{ \
369 DWORD ret; \
[10395]370 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)); \
[7862]371 dbg_ThreadPushCall(#a); \
372 ret = ((DBG_WINPROC40)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
373 dbg_ThreadPopCall(); \
[10395]374 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]375 return ret; \
376}
377
378#define DEBUGWRAP_LVL2_44(a) \
379DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10, DWORD arg11) \
380{ \
381 DWORD ret; \
[10395]382 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11)); \
[7862]383 dbg_ThreadPushCall(#a); \
384 ret = ((DBG_WINPROC44)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
385 dbg_ThreadPopCall(); \
[10395]386 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]387 return ret; \
388}
389
390#define DEBUGWRAP_LVL2_48(a) \
391DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10, DWORD arg11, DWORD arg12) \
392{ \
393 DWORD ret; \
[10395]394 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12)); \
[7862]395 dbg_ThreadPushCall(#a); \
396 ret = ((DBG_WINPROC48)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
397 dbg_ThreadPopCall(); \
[10395]398 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7862]399 return ret; \
400}
401
[7922]402#define DEBUGWRAP_LVL2_52(a) \
403DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10, DWORD arg11, DWORD arg12, DWORD arg13) \
404{ \
405 DWORD ret; \
[10395]406 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x %x %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13)); \
[7922]407 dbg_ThreadPushCall(#a); \
408 ret = ((DBG_WINPROC52)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
409 dbg_ThreadPopCall(); \
[10395]410 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7922]411 return ret; \
412}
[7862]413
[7922]414
[7902]415//level 1 logging without function definitions
416
417#define NODEF_DEBUGWRAP0(a) \
418DWORD WIN32API a(); \
419DWORD WIN32API Dbg##a() \
420{ \
421 DWORD ret; \
[10395]422 dprintf((DBGWRAP_MODULE": %s\n", #a)); \
[7902]423 dbg_ThreadPushCall(#a); \
424 ret = (DWORD)a(); \
425 dbg_ThreadPopCall(); \
[10395]426 dprintf((DBGWRAP_MODULE": %s returned %x\n", #a, ret)); \
[7902]427 return ret; \
428}
429
430#define NODEF_DEBUGWRAP0_NORET(a) \
431void WIN32API a(); \
432void WIN32API Dbg##a() \
433{ \
434 DWORD ret; \
[10395]435 dprintf((DBGWRAP_MODULE": %s\n", #a)); \
[7902]436 dbg_ThreadPushCall(#a); \
437 a(); \
438 dbg_ThreadPopCall(); \
[10395]439 dprintf((DBGWRAP_MODULE": %s returned (void)\n", #a)); \
[7902]440}
441
442#define NODEF_DEBUGWRAP4(a) \
443DWORD WIN32API a(DWORD arg1); \
444DWORD WIN32API Dbg##a(DWORD arg1) \
445{ \
446 DWORD ret; \
[10395]447 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x\n", DBGWRAP_CALLER_ARG #a, arg1)); \
[7902]448 dbg_ThreadPushCall(#a); \
449 ret = ((DBG_WINPROC4)a)(arg1); \
450 dbg_ThreadPopCall(); \
[10395]451 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7902]452 return ret; \
453}
454
455#define NODEF_DEBUGWRAP4_NORET(a) \
456void WIN32API a(DWORD arg1); \
457void WIN32API Dbg##a(DWORD arg1) \
458{ \
[10395]459 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x\n", DBGWRAP_CALLER_ARG #a, arg1)); \
[7902]460 dbg_ThreadPushCall(#a); \
461 ((DBG_WINPROC4_NORET)a)(arg1); \
462 dbg_ThreadPopCall(); \
[10395]463 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned (void)\n", DBGWRAP_CALLER_ARG #a)); \
[7902]464}
465
466#define NODEF_DEBUGWRAP8(a) \
467DWORD WIN32API a(DWORD arg1, DWORD arg2); \
468DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2) \
469{ \
470 DWORD ret; \
[10395]471 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2)); \
[7902]472 dbg_ThreadPushCall(#a); \
473 ret = ((DBG_WINPROC8)a)(arg1, arg2); \
474 dbg_ThreadPopCall(); \
[10395]475 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7902]476 return ret; \
477}
478
479#define NODEF_DEBUGWRAP12(a) \
480DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3); \
481DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3) \
482{ \
483 DWORD ret; \
[10395]484 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3)); \
[7902]485 dbg_ThreadPushCall(#a); \
486 ret = ((DBG_WINPROC12)a)(arg1, arg2, arg3); \
487 dbg_ThreadPopCall(); \
[10395]488 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7902]489 return ret; \
490}
491
492#define NODEF_DEBUGWRAP16(a) \
493DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4); \
494DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4) \
495{ \
496 DWORD ret; \
[10395]497 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4)); \
[7902]498 dbg_ThreadPushCall(#a); \
499 ret = ((DBG_WINPROC16)a)(arg1, arg2, arg3, arg4); \
500 dbg_ThreadPopCall(); \
[10395]501 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7902]502 return ret; \
503}
504
505#define NODEF_DEBUGWRAP20(a) \
506DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5); \
507DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5) \
508{ \
509 DWORD ret; \
[10395]510 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5)); \
[7902]511 dbg_ThreadPushCall(#a); \
512 ret = ((DBG_WINPROC20)a)(arg1, arg2, arg3, arg4, arg5); \
513 dbg_ThreadPopCall(); \
[10395]514 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7902]515 return ret; \
516}
517
518#define NODEF_DEBUGWRAP24(a) \
519DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6); \
520DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6) \
521{ \
522 DWORD ret; \
[10395]523 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6)); \
[7902]524 dbg_ThreadPushCall(#a); \
525 ret = ((DBG_WINPROC24)a)(arg1, arg2, arg3, arg4, arg5, arg6); \
526 dbg_ThreadPopCall(); \
[10395]527 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7902]528 return ret; \
529}
530
531#define NODEF_DEBUGWRAP28(a) \
532DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7); \
533DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7) \
534{ \
535 DWORD ret; \
[10395]536 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7)); \
[7902]537 dbg_ThreadPushCall(#a); \
538 ret = ((DBG_WINPROC28)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
539 dbg_ThreadPopCall(); \
[10395]540 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7902]541 return ret; \
542}
543
544#define NODEF_DEBUGWRAP32(a) \
545DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8); \
546DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8) \
547{ \
548 DWORD ret; \
[10395]549 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)); \
[7902]550 dbg_ThreadPushCall(#a); \
551 ret = ((DBG_WINPROC32)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
552 dbg_ThreadPopCall(); \
[10395]553 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7902]554 return ret; \
555}
556
557#define NODEF_DEBUGWRAP36(a) \
558DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9); \
559DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9) \
560{ \
561 DWORD ret; \
[10395]562 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)); \
[7902]563 dbg_ThreadPushCall(#a); \
564 ret = ((DBG_WINPROC36)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
565 dbg_ThreadPopCall(); \
[10395]566 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7902]567 return ret; \
568}
569
570#define NODEF_DEBUGWRAP40(a) \
571DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10); \
572DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10) \
573{ \
574 DWORD ret; \
[10395]575 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)); \
[7902]576 dbg_ThreadPushCall(#a); \
577 ret = ((DBG_WINPROC40)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
578 dbg_ThreadPopCall(); \
[10395]579 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7902]580 return ret; \
581}
582
583#define NODEF_DEBUGWRAP44(a) \
584DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10, DWORD arg11); \
585DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10, DWORD arg11) \
586{ \
587 DWORD ret; \
[10395]588 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11)); \
[7902]589 dbg_ThreadPushCall(#a); \
590 ret = ((DBG_WINPROC44)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
591 dbg_ThreadPopCall(); \
[10395]592 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7902]593 return ret; \
594}
595
596#define NODEF_DEBUGWRAP48(a) \
597DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10, DWORD arg11, DWORD arg12); \
598DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10, DWORD arg11, DWORD arg12) \
599{ \
600 DWORD ret; \
[10395]601 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12)); \
[7902]602 dbg_ThreadPushCall(#a); \
603 ret = ((DBG_WINPROC48)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
604 dbg_ThreadPopCall(); \
[10395]605 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7902]606 return ret; \
607}
608
[7922]609#define NODEF_DEBUGWRAP52(a) \
610DWORD WIN32API #a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10, DWORD arg11, DWORD arg12, DWORD arg13); \
611DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10, DWORD arg11, DWORD arg12, DWORD arg13) \
612{ \
613 DWORD ret; \
[10395]614 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x %x %x %x %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13)); \
[7922]615 dbg_ThreadPushCall(#a); \
616 ret = ((DBG_WINPROC52)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
617 dbg_ThreadPopCall(); \
[10395]618 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
[7922]619 return ret; \
620}
621
[7862]622#endif
623
Note: See TracBrowser for help on using the repository browser.