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

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

logging updates

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