source: trunk/src/kernel32/dbgwrap.h@ 7854

Last change on this file since 7854 was 7854, checked in by sandervl, 24 years ago

logging updates

File size: 15.9 KB
Line 
1#ifndef __DBBWRAP_H__
2#define __DBBWRAP_H__
3
4#include <odinwrap.h>
5
6typedef DWORD (* WIN32API DBG_WINPROC0)();
7typedef DWORD (* WIN32API DBG_WINPROC4)(DWORD);
8typedef DWORD (* WIN32API DBG_WINPROC4_NORET)(DWORD);
9typedef DWORD (* WIN32API DBG_WINPROC8)(DWORD, DWORD);
10typedef DWORD (* WIN32API DBG_WINPROC12)(DWORD, DWORD, DWORD);
11typedef DWORD (* WIN32API DBG_WINPROC16)(DWORD, DWORD, DWORD, DWORD);
12typedef DWORD (* WIN32API DBG_WINPROC20)(DWORD, DWORD, DWORD, DWORD, DWORD);
13typedef DWORD (* WIN32API DBG_WINPROC24)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
14typedef DWORD (* WIN32API DBG_WINPROC28)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
15typedef DWORD (* WIN32API DBG_WINPROC32)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
16typedef DWORD (* WIN32API DBG_WINPROC36)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
17typedef DWORD (* WIN32API DBG_WINPROC40)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
18typedef DWORD (* WIN32API DBG_WINPROC44)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
19typedef DWORD (* WIN32API DBG_WINPROC48)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
20
21#define DEBUGWRAP0(a) \
22DWORD WIN32API Dbg##a() \
23{ \
24 DWORD ret; \
25 dprintf((DBGWRAP_MODULE": %s", #a)); \
26 dbg_ThreadPushCall(#a); \
27 ret = (DWORD)a(); \
28 dbg_ThreadPopCall(); \
29 dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
30 return ret; \
31}
32
33#define DEBUGWRAP0_NORET(a) \
34void WIN32API Dbg##a() \
35{ \
36 DWORD ret; \
37 dprintf((DBGWRAP_MODULE": %s", #a)); \
38 dbg_ThreadPushCall(#a); \
39 a(); \
40 dbg_ThreadPopCall(); \
41}
42
43#define DEBUGWRAP4(a) \
44DWORD WIN32API Dbg##a(DWORD arg1) \
45{ \
46 DWORD ret; \
47 dprintf((DBGWRAP_MODULE": %s %x", #a, arg1)); \
48 dbg_ThreadPushCall(#a); \
49 ret = ((DBG_WINPROC4)a)(arg1); \
50 dbg_ThreadPopCall(); \
51 dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
52 return ret; \
53}
54
55#define DEBUGWRAP4_NORET(a) \
56void WIN32API Dbg##a(DWORD arg1) \
57{ \
58 dprintf((DBGWRAP_MODULE": %s %x", #a, arg1)); \
59 dbg_ThreadPushCall(#a); \
60 ((DBG_WINPROC4_NORET)a)(arg1); \
61 dbg_ThreadPopCall(); \
62}
63
64#define DEBUGWRAP8(a) \
65DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2) \
66{ \
67 DWORD ret; \
68 dprintf((DBGWRAP_MODULE": %s %x %x", #a, arg1, arg2)); \
69 dbg_ThreadPushCall(#a); \
70 ret = ((DBG_WINPROC8)a)(arg1, arg2); \
71 dbg_ThreadPopCall(); \
72 dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
73 return ret; \
74}
75
76#define DEBUGWRAP12(a) \
77DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3) \
78{ \
79 DWORD ret; \
80 dprintf((DBGWRAP_MODULE": %s %x %x %x", #a, arg1, arg2, arg3)); \
81 dbg_ThreadPushCall(#a); \
82 ret = ((DBG_WINPROC12)a)(arg1, arg2, arg3); \
83 dbg_ThreadPopCall(); \
84 dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
85 return ret; \
86}
87
88#define DEBUGWRAP16(a) \
89DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4) \
90{ \
91 DWORD ret; \
92 dprintf((DBGWRAP_MODULE": %s %x %x %x %x", #a, arg1, arg2, arg3, arg4)); \
93 dbg_ThreadPushCall(#a); \
94 ret = ((DBG_WINPROC16)a)(arg1, arg2, arg3, arg4); \
95 dbg_ThreadPopCall(); \
96 dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
97 return ret; \
98}
99
100#define DEBUGWRAP20(a) \
101DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5) \
102{ \
103 DWORD ret; \
104 dprintf((DBGWRAP_MODULE": %s %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5)); \
105 dbg_ThreadPushCall(#a); \
106 ret = ((DBG_WINPROC20)a)(arg1, arg2, arg3, arg4, arg5); \
107 dbg_ThreadPopCall(); \
108 dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
109 return ret; \
110}
111
112#define DEBUGWRAP24(a) \
113DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6) \
114{ \
115 DWORD ret; \
116 dprintf((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg6)); \
117 dbg_ThreadPushCall(#a); \
118 ret = ((DBG_WINPROC24)a)(arg1, arg2, arg3, arg4, arg5, arg6); \
119 dbg_ThreadPopCall(); \
120 dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
121 return ret; \
122}
123
124#define DEBUGWRAP28(a) \
125DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7) \
126{ \
127 DWORD ret; \
128 dprintf((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7)); \
129 dbg_ThreadPushCall(#a); \
130 ret = ((DBG_WINPROC28)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
131 dbg_ThreadPopCall(); \
132 dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
133 return ret; \
134}
135
136#define DEBUGWRAP32(a) \
137DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8) \
138{ \
139 DWORD ret; \
140 dprintf((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7, arg8)); \
141 dbg_ThreadPushCall(#a); \
142 ret = ((DBG_WINPROC32)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
143 dbg_ThreadPopCall(); \
144 dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
145 return ret; \
146}
147
148#define DEBUGWRAP36(a) \
149DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9) \
150{ \
151 DWORD ret; \
152 dprintf((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7, arg8, arg9)); \
153 dbg_ThreadPushCall(#a); \
154 ret = ((DBG_WINPROC36)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
155 dbg_ThreadPopCall(); \
156 dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
157 return ret; \
158}
159
160#define DEBUGWRAP40(a) \
161DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10) \
162{ \
163 DWORD ret; \
164 dprintf((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7, arg8, arg9, arg10)); \
165 dbg_ThreadPushCall(#a); \
166 ret = ((DBG_WINPROC40)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
167 dbg_ThreadPopCall(); \
168 dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
169 return ret; \
170}
171
172#define DEBUGWRAP44(a) \
173DWORD 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) \
174{ \
175 DWORD ret; \
176 dprintf((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7, arg8, arg9, arg10, arg11)); \
177 dbg_ThreadPushCall(#a); \
178 ret = ((DBG_WINPROC44)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
179 dbg_ThreadPopCall(); \
180 dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
181 return ret; \
182}
183
184#define DEBUGWRAP48(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, DWORD arg11, DWORD arg12) \
186{ \
187 DWORD ret; \
188 dprintf((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7, arg8, arg9, arg10, arg11, arg12)); \
189 dbg_ThreadPushCall(#a); \
190 ret = ((DBG_WINPROC48)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
191 dbg_ThreadPopCall(); \
192 dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
193 return ret; \
194}
195
196//level 2 logging
197
198#define DEBUGWRAP_LVL2_0(a) \
199DWORD WIN32API Dbg##a() \
200{ \
201 DWORD ret; \
202 dprintf2((DBGWRAP_MODULE": %s", #a)); \
203 dbg_ThreadPushCall(#a); \
204 ret = ((DBG_WINPROC0)a)(); \
205 dbg_ThreadPopCall(); \
206 dprintf2((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
207 return ret; \
208}
209
210#define DEBUGWRAP_LVL2_4(a) \
211DWORD WIN32API Dbg##a(DWORD arg1) \
212{ \
213 DWORD ret; \
214 dprintf2((DBGWRAP_MODULE": %s %x", #a, arg1)); \
215 dbg_ThreadPushCall(#a); \
216 ret = ((DBG_WINPROC4)a)(arg1); \
217 dbg_ThreadPopCall(); \
218 dprintf2((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
219 return ret; \
220}
221
222#define DEBUGWRAP_LVL2_8(a) \
223DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2) \
224{ \
225 DWORD ret; \
226 dprintf2((DBGWRAP_MODULE": %s %x %x", #a, arg1, arg2)); \
227 dbg_ThreadPushCall(#a); \
228 ret = ((DBG_WINPROC8)a)(arg1, arg2); \
229 dbg_ThreadPopCall(); \
230 dprintf2((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
231 return ret; \
232}
233
234#define DEBUGWRAP_LVL2_12(a) \
235DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3) \
236{ \
237 DWORD ret; \
238 dprintf2((DBGWRAP_MODULE": %s %x %x %x", #a, arg1, arg2, arg3)); \
239 dbg_ThreadPushCall(#a); \
240 ret = ((DBG_WINPROC12)a)(arg1, arg2, arg3); \
241 dbg_ThreadPopCall(); \
242 dprintf2((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
243 return ret; \
244}
245
246#define DEBUGWRAP_LVL2_16(a) \
247DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4) \
248{ \
249 DWORD ret; \
250 dprintf2((DBGWRAP_MODULE": %s %x %x %x %x", #a, arg1, arg2, arg3, arg4)); \
251 dbg_ThreadPushCall(#a); \
252 ret = ((DBG_WINPROC16)a)(arg1, arg2, arg3, arg4); \
253 dbg_ThreadPopCall(); \
254 dprintf2((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
255 return ret; \
256}
257
258#define DEBUGWRAP_LVL2_20(a) \
259DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5) \
260{ \
261 DWORD ret; \
262 dprintf2((DBGWRAP_MODULE": %s %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5)); \
263 dbg_ThreadPushCall(#a); \
264 ret = ((DBG_WINPROC20)a)(arg1, arg2, arg3, arg4, arg5); \
265 dbg_ThreadPopCall(); \
266 dprintf2((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
267 return ret; \
268}
269
270#define DEBUGWRAP_LVL2_24(a) \
271DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6) \
272{ \
273 DWORD ret; \
274 dprintf2((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg6)); \
275 dbg_ThreadPushCall(#a); \
276 ret = ((DBG_WINPROC24)a)(arg1, arg2, arg3, arg4, arg5, arg6); \
277 dbg_ThreadPopCall(); \
278 dprintf2((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
279 return ret; \
280}
281
282#define DEBUGWRAP_LVL2_28(a) \
283DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7) \
284{ \
285 DWORD ret; \
286 dprintf2((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7)); \
287 dbg_ThreadPushCall(#a); \
288 ret = ((DBG_WINPROC28)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
289 dbg_ThreadPopCall(); \
290 dprintf2((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
291 return ret; \
292}
293
294#define DEBUGWRAP_LVL2_32(a) \
295DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8) \
296{ \
297 DWORD ret; \
298 dprintf2((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7, arg8)); \
299 dbg_ThreadPushCall(#a); \
300 ret = ((DBG_WINPROC32)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
301 dbg_ThreadPopCall(); \
302 dprintf2((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
303 return ret; \
304}
305
306#define DEBUGWRAP_LVL2_36(a) \
307DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9) \
308{ \
309 DWORD ret; \
310 dprintf2((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7, arg8, arg9)); \
311 dbg_ThreadPushCall(#a); \
312 ret = ((DBG_WINPROC36)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
313 dbg_ThreadPopCall(); \
314 dprintf2((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
315 return ret; \
316}
317
318#define DEBUGWRAP_LVL2_40(a) \
319DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10) \
320{ \
321 DWORD ret; \
322 dprintf2((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7, arg8, arg9, arg10)); \
323 dbg_ThreadPushCall(#a); \
324 ret = ((DBG_WINPROC40)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
325 dbg_ThreadPopCall(); \
326 dprintf2((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
327 return ret; \
328}
329
330#define DEBUGWRAP_LVL2_44(a) \
331DWORD 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) \
332{ \
333 DWORD ret; \
334 dprintf2((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7, arg8, arg9, arg10, arg11)); \
335 dbg_ThreadPushCall(#a); \
336 ret = ((DBG_WINPROC44)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
337 dbg_ThreadPopCall(); \
338 dprintf2((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
339 return ret; \
340}
341
342#define DEBUGWRAP_LVL2_48(a) \
343DWORD 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) \
344{ \
345 DWORD ret; \
346 dprintf2((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7, arg8, arg9, arg10, arg11, arg12)); \
347 dbg_ThreadPushCall(#a); \
348 ret = ((DBG_WINPROC48)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
349 dbg_ThreadPopCall(); \
350 dprintf2((DBGWRAP_MODULE": %s returned %x", #a, ret)); \
351 return ret; \
352}
353
354
355#endif
356
Note: See TracBrowser for help on using the repository browser.