source: trunk/include/dbgwrap.h@ 21561

Last change on this file since 21561 was 10395, checked in by sandervl, 21 years ago

KSO: Updates

File size: 32.5 KB
Line 
1#ifndef __DBBWRAP_H__
2#define __DBBWRAP_H__
3
4#include <odinwrap.h>
5
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
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);
29typedef DWORD (* WIN32API DBG_WINPROC52)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
30typedef DWORD (* WIN32API DBG_WINPROC56)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
31
32
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(); \
53 dprintf((DBGWRAP_MODULE": %s returned (void)\n", #a)); \
54}
55
56#define DEBUGWRAP4(a) \
57DWORD WIN32API Dbg##a(DWORD arg1) \
58{ \
59 DWORD ret; \
60 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x\n", DBGWRAP_CALLER_ARG #a, arg1)); \
61 dbg_ThreadPushCall(#a); \
62 ret = ((DBG_WINPROC4)a)(arg1); \
63 dbg_ThreadPopCall(); \
64 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
65 return ret; \
66}
67
68#define DEBUGWRAP4_NORET(a) \
69void WIN32API Dbg##a(DWORD arg1) \
70{ \
71 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x\n", DBGWRAP_CALLER_ARG #a, arg1)); \
72 dbg_ThreadPushCall(#a); \
73 ((DBG_WINPROC4_NORET)a)(arg1); \
74 dbg_ThreadPopCall(); \
75 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned void\n", DBGWRAP_CALLER_ARG #a)); \
76}
77
78#define DEBUGWRAP8(a) \
79DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2) \
80{ \
81 DWORD ret; \
82 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2)); \
83 dbg_ThreadPushCall(#a); \
84 ret = ((DBG_WINPROC8)a)(arg1, arg2); \
85 dbg_ThreadPopCall(); \
86 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
87 return ret; \
88}
89
90#define DEBUGWRAP8_NORET(a) \
91void WIN32API Dbg##a(DWORD arg1, DWORD arg2) \
92{ \
93 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2)); \
94 dbg_ThreadPushCall(#a); \
95 ((DBG_WINPROC8)a)(arg1, arg2); \
96 dbg_ThreadPopCall(); \
97 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned void\n", DBGWRAP_CALLER_ARG #a)); \
98}
99
100#define DEBUGWRAP12(a) \
101DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3) \
102{ \
103 DWORD ret; \
104 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3)); \
105 dbg_ThreadPushCall(#a); \
106 ret = ((DBG_WINPROC12)a)(arg1, arg2, arg3); \
107 dbg_ThreadPopCall(); \
108 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
116 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4)); \
117 dbg_ThreadPushCall(#a); \
118 ret = ((DBG_WINPROC16)a)(arg1, arg2, arg3, arg4); \
119 dbg_ThreadPopCall(); \
120 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
128 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5)); \
129 dbg_ThreadPushCall(#a); \
130 ret = ((DBG_WINPROC20)a)(arg1, arg2, arg3, arg4, arg5); \
131 dbg_ThreadPopCall(); \
132 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
141 dbg_ThreadPushCall(#a); \
142 ret = ((DBG_WINPROC24)a)(arg1, arg2, arg3, arg4, arg5, arg6); \
143 dbg_ThreadPopCall(); \
144 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
153 dbg_ThreadPushCall(#a); \
154 ret = ((DBG_WINPROC28)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
155 dbg_ThreadPopCall(); \
156 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
165 dbg_ThreadPushCall(#a); \
166 ret = ((DBG_WINPROC32)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
167 dbg_ThreadPopCall(); \
168 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
177 dbg_ThreadPushCall(#a); \
178 ret = ((DBG_WINPROC36)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
179 dbg_ThreadPopCall(); \
180 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
189 dbg_ThreadPushCall(#a); \
190 ret = ((DBG_WINPROC40)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
191 dbg_ThreadPopCall(); \
192 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
201 dbg_ThreadPushCall(#a); \
202 ret = ((DBG_WINPROC44)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
203 dbg_ThreadPopCall(); \
204 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
213 dbg_ThreadPushCall(#a); \
214 ret = ((DBG_WINPROC48)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
215 dbg_ThreadPopCall(); \
216 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
217 return ret; \
218}
219
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; \
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)); \
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(); \
228 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
229 return ret; \
230}
231
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; \
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)); \
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(); \
240 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
241 return ret; \
242}
243
244//level 2 logging
245
246#define DEBUGWRAP_LVL2_0(a) \
247DWORD WIN32API Dbg##a() \
248{ \
249 DWORD ret; \
250 dprintf2((DBGWRAP_MODULE": %s\n", #a)); \
251 dbg_ThreadPushCall(#a); \
252 ret = ((DBG_WINPROC0)a)(); \
253 dbg_ThreadPopCall(); \
254 dprintf2((DBGWRAP_MODULE": %s returned %x\n", #a, ret)); \
255 return ret; \
256}
257
258#define DEBUGWRAP_LVL2_4(a) \
259DWORD WIN32API Dbg##a(DWORD arg1) \
260{ \
261 DWORD ret; \
262 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x\n", DBGWRAP_CALLER_ARG #a, arg1)); \
263 dbg_ThreadPushCall(#a); \
264 ret = ((DBG_WINPROC4)a)(arg1); \
265 dbg_ThreadPopCall(); \
266 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
267 return ret; \
268}
269
270#define DEBUGWRAP_LVL2_8(a) \
271DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2) \
272{ \
273 DWORD ret; \
274 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2)); \
275 dbg_ThreadPushCall(#a); \
276 ret = ((DBG_WINPROC8)a)(arg1, arg2); \
277 dbg_ThreadPopCall(); \
278 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
286 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3)); \
287 dbg_ThreadPushCall(#a); \
288 ret = ((DBG_WINPROC12)a)(arg1, arg2, arg3); \
289 dbg_ThreadPopCall(); \
290 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
298 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4)); \
299 dbg_ThreadPushCall(#a); \
300 ret = ((DBG_WINPROC16)a)(arg1, arg2, arg3, arg4); \
301 dbg_ThreadPopCall(); \
302 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
310 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5)); \
311 dbg_ThreadPushCall(#a); \
312 ret = ((DBG_WINPROC20)a)(arg1, arg2, arg3, arg4, arg5); \
313 dbg_ThreadPopCall(); \
314 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
323 dbg_ThreadPushCall(#a); \
324 ret = ((DBG_WINPROC24)a)(arg1, arg2, arg3, arg4, arg5, arg6); \
325 dbg_ThreadPopCall(); \
326 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
335 dbg_ThreadPushCall(#a); \
336 ret = ((DBG_WINPROC28)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
337 dbg_ThreadPopCall(); \
338 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
347 dbg_ThreadPushCall(#a); \
348 ret = ((DBG_WINPROC32)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
349 dbg_ThreadPopCall(); \
350 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
359 dbg_ThreadPushCall(#a); \
360 ret = ((DBG_WINPROC36)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
361 dbg_ThreadPopCall(); \
362 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
371 dbg_ThreadPushCall(#a); \
372 ret = ((DBG_WINPROC40)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
373 dbg_ThreadPopCall(); \
374 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
383 dbg_ThreadPushCall(#a); \
384 ret = ((DBG_WINPROC44)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
385 dbg_ThreadPopCall(); \
386 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
395 dbg_ThreadPushCall(#a); \
396 ret = ((DBG_WINPROC48)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
397 dbg_ThreadPopCall(); \
398 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
399 return ret; \
400}
401
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; \
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)); \
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(); \
410 dprintf2((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
411 return ret; \
412}
413
414
415//level 1 logging without function definitions
416
417#define NODEF_DEBUGWRAP0(a) \
418DWORD WIN32API a(); \
419DWORD WIN32API Dbg##a() \
420{ \
421 DWORD ret; \
422 dprintf((DBGWRAP_MODULE": %s\n", #a)); \
423 dbg_ThreadPushCall(#a); \
424 ret = (DWORD)a(); \
425 dbg_ThreadPopCall(); \
426 dprintf((DBGWRAP_MODULE": %s returned %x\n", #a, ret)); \
427 return ret; \
428}
429
430#define NODEF_DEBUGWRAP0_NORET(a) \
431void WIN32API a(); \
432void WIN32API Dbg##a() \
433{ \
434 DWORD ret; \
435 dprintf((DBGWRAP_MODULE": %s\n", #a)); \
436 dbg_ThreadPushCall(#a); \
437 a(); \
438 dbg_ThreadPopCall(); \
439 dprintf((DBGWRAP_MODULE": %s returned (void)\n", #a)); \
440}
441
442#define NODEF_DEBUGWRAP4(a) \
443DWORD WIN32API a(DWORD arg1); \
444DWORD WIN32API Dbg##a(DWORD arg1) \
445{ \
446 DWORD ret; \
447 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x\n", DBGWRAP_CALLER_ARG #a, arg1)); \
448 dbg_ThreadPushCall(#a); \
449 ret = ((DBG_WINPROC4)a)(arg1); \
450 dbg_ThreadPopCall(); \
451 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
452 return ret; \
453}
454
455#define NODEF_DEBUGWRAP4_NORET(a) \
456void WIN32API a(DWORD arg1); \
457void WIN32API Dbg##a(DWORD arg1) \
458{ \
459 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x\n", DBGWRAP_CALLER_ARG #a, arg1)); \
460 dbg_ThreadPushCall(#a); \
461 ((DBG_WINPROC4_NORET)a)(arg1); \
462 dbg_ThreadPopCall(); \
463 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned (void)\n", DBGWRAP_CALLER_ARG #a)); \
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; \
471 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2)); \
472 dbg_ThreadPushCall(#a); \
473 ret = ((DBG_WINPROC8)a)(arg1, arg2); \
474 dbg_ThreadPopCall(); \
475 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
484 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3)); \
485 dbg_ThreadPushCall(#a); \
486 ret = ((DBG_WINPROC12)a)(arg1, arg2, arg3); \
487 dbg_ThreadPopCall(); \
488 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
497 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4)); \
498 dbg_ThreadPushCall(#a); \
499 ret = ((DBG_WINPROC16)a)(arg1, arg2, arg3, arg4); \
500 dbg_ThreadPopCall(); \
501 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
510 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s %x %x %x %x %x\n", DBGWRAP_CALLER_ARG #a, arg1, arg2, arg3, arg4, arg5)); \
511 dbg_ThreadPushCall(#a); \
512 ret = ((DBG_WINPROC20)a)(arg1, arg2, arg3, arg4, arg5); \
513 dbg_ThreadPopCall(); \
514 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
524 dbg_ThreadPushCall(#a); \
525 ret = ((DBG_WINPROC24)a)(arg1, arg2, arg3, arg4, arg5, arg6); \
526 dbg_ThreadPopCall(); \
527 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
537 dbg_ThreadPushCall(#a); \
538 ret = ((DBG_WINPROC28)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
539 dbg_ThreadPopCall(); \
540 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
550 dbg_ThreadPushCall(#a); \
551 ret = ((DBG_WINPROC32)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
552 dbg_ThreadPopCall(); \
553 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
563 dbg_ThreadPushCall(#a); \
564 ret = ((DBG_WINPROC36)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
565 dbg_ThreadPopCall(); \
566 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
576 dbg_ThreadPushCall(#a); \
577 ret = ((DBG_WINPROC40)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
578 dbg_ThreadPopCall(); \
579 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
589 dbg_ThreadPushCall(#a); \
590 ret = ((DBG_WINPROC44)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
591 dbg_ThreadPopCall(); \
592 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
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; \
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)); \
602 dbg_ThreadPushCall(#a); \
603 ret = ((DBG_WINPROC48)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
604 dbg_ThreadPopCall(); \
605 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
606 return ret; \
607}
608
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; \
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)); \
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(); \
618 dprintf((DBGWRAP_CALLER_FMT DBGWRAP_MODULE": %s returned %x\n", DBGWRAP_CALLER_ARG #a, ret)); \
619 return ret; \
620}
621
622#endif
623
Note: See TracBrowser for help on using the repository browser.