| 1 | #ifndef __DBBWRAP_H__ | 
|---|
| 2 | #define __DBBWRAP_H__ | 
|---|
| 3 |  | 
|---|
| 4 | #include <odinwrap.h> | 
|---|
| 5 |  | 
|---|
| 6 | typedef DWORD (* WIN32API DBG_WINPROC0)(); | 
|---|
| 7 | typedef DWORD (* WIN32API DBG_WINPROC4)(DWORD); | 
|---|
| 8 | typedef DWORD (* WIN32API DBG_WINPROC4_NORET)(DWORD); | 
|---|
| 9 | typedef DWORD (* WIN32API DBG_WINPROC8)(DWORD, DWORD); | 
|---|
| 10 | typedef DWORD (* WIN32API DBG_WINPROC12)(DWORD, DWORD, DWORD); | 
|---|
| 11 | typedef DWORD (* WIN32API DBG_WINPROC16)(DWORD, DWORD, DWORD, DWORD); | 
|---|
| 12 | typedef DWORD (* WIN32API DBG_WINPROC20)(DWORD, DWORD, DWORD, DWORD, DWORD); | 
|---|
| 13 | typedef DWORD (* WIN32API DBG_WINPROC24)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); | 
|---|
| 14 | typedef DWORD (* WIN32API DBG_WINPROC28)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); | 
|---|
| 15 | typedef DWORD (* WIN32API DBG_WINPROC32)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); | 
|---|
| 16 | typedef DWORD (* WIN32API DBG_WINPROC36)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); | 
|---|
| 17 | typedef DWORD (* WIN32API DBG_WINPROC40)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); | 
|---|
| 18 | typedef DWORD (* WIN32API DBG_WINPROC44)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); | 
|---|
| 19 | typedef DWORD (* WIN32API DBG_WINPROC48)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD); | 
|---|
| 20 |  | 
|---|
| 21 | #define DEBUGWRAP0(a) \ | 
|---|
| 22 | DWORD 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) \ | 
|---|
| 34 | void 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) \ | 
|---|
| 44 | DWORD 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) \ | 
|---|
| 56 | void 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) \ | 
|---|
| 65 | DWORD 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) \ | 
|---|
| 77 | DWORD 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) \ | 
|---|
| 89 | DWORD 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) \ | 
|---|
| 101 | DWORD 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) \ | 
|---|
| 113 | DWORD 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) \ | 
|---|
| 125 | DWORD 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) \ | 
|---|
| 137 | DWORD 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) \ | 
|---|
| 149 | DWORD 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) \ | 
|---|
| 161 | DWORD 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) \ | 
|---|
| 173 | DWORD 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) \ | 
|---|
| 185 | DWORD 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) \ | 
|---|
| 199 | DWORD 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) \ | 
|---|
| 211 | DWORD 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) \ | 
|---|
| 223 | DWORD 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) \ | 
|---|
| 235 | DWORD 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) \ | 
|---|
| 247 | DWORD 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) \ | 
|---|
| 259 | DWORD 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) \ | 
|---|
| 271 | DWORD 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) \ | 
|---|
| 283 | DWORD 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) \ | 
|---|
| 295 | DWORD 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) \ | 
|---|
| 307 | DWORD 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) \ | 
|---|
| 319 | DWORD 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) \ | 
|---|
| 331 | DWORD 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) \ | 
|---|
| 343 | DWORD 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 | //level 1 logging without function definitions | 
|---|
| 356 |  | 
|---|
| 357 | #define NODEF_DEBUGWRAP0(a) \ | 
|---|
| 358 | DWORD WIN32API a();  \ | 
|---|
| 359 | DWORD WIN32API Dbg##a()             \ | 
|---|
| 360 | {                                          \ | 
|---|
| 361 | DWORD ret;                             \ | 
|---|
| 362 | dprintf((DBGWRAP_MODULE": %s", #a));         \ | 
|---|
| 363 | dbg_ThreadPushCall(#a); \ | 
|---|
| 364 | ret = (DWORD)a();         \ | 
|---|
| 365 | dbg_ThreadPopCall(); \ | 
|---|
| 366 | dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \ | 
|---|
| 367 | return ret;                            \ | 
|---|
| 368 | } | 
|---|
| 369 |  | 
|---|
| 370 | #define NODEF_DEBUGWRAP0_NORET(a) \ | 
|---|
| 371 | void WIN32API a();  \ | 
|---|
| 372 | void WIN32API Dbg##a()             \ | 
|---|
| 373 | {                                          \ | 
|---|
| 374 | DWORD ret;                             \ | 
|---|
| 375 | dprintf((DBGWRAP_MODULE": %s", #a));         \ | 
|---|
| 376 | dbg_ThreadPushCall(#a); \ | 
|---|
| 377 | a();         \ | 
|---|
| 378 | dbg_ThreadPopCall(); \ | 
|---|
| 379 | } | 
|---|
| 380 |  | 
|---|
| 381 | #define NODEF_DEBUGWRAP4(a) \ | 
|---|
| 382 | DWORD WIN32API a(DWORD arg1);             \ | 
|---|
| 383 | DWORD WIN32API Dbg##a(DWORD arg1)             \ | 
|---|
| 384 | {                                          \ | 
|---|
| 385 | DWORD ret;                             \ | 
|---|
| 386 | dprintf((DBGWRAP_MODULE": %s %x", #a, arg1));         \ | 
|---|
| 387 | dbg_ThreadPushCall(#a); \ | 
|---|
| 388 | ret = ((DBG_WINPROC4)a)(arg1);         \ | 
|---|
| 389 | dbg_ThreadPopCall(); \ | 
|---|
| 390 | dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \ | 
|---|
| 391 | return ret;                            \ | 
|---|
| 392 | } | 
|---|
| 393 |  | 
|---|
| 394 | #define NODEF_DEBUGWRAP4_NORET(a) \ | 
|---|
| 395 | void WIN32API a(DWORD arg1);             \ | 
|---|
| 396 | void WIN32API Dbg##a(DWORD arg1)             \ | 
|---|
| 397 | {                                          \ | 
|---|
| 398 | dprintf((DBGWRAP_MODULE": %s %x", #a, arg1));         \ | 
|---|
| 399 | dbg_ThreadPushCall(#a); \ | 
|---|
| 400 | ((DBG_WINPROC4_NORET)a)(arg1);         \ | 
|---|
| 401 | dbg_ThreadPopCall(); \ | 
|---|
| 402 | } | 
|---|
| 403 |  | 
|---|
| 404 | #define NODEF_DEBUGWRAP8(a) \ | 
|---|
| 405 | DWORD WIN32API a(DWORD arg1, DWORD arg2); \ | 
|---|
| 406 | DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2) \ | 
|---|
| 407 | {                                          \ | 
|---|
| 408 | DWORD ret;                             \ | 
|---|
| 409 | dprintf((DBGWRAP_MODULE": %s %x %x", #a, arg1, arg2));         \ | 
|---|
| 410 | dbg_ThreadPushCall(#a); \ | 
|---|
| 411 | ret = ((DBG_WINPROC8)a)(arg1, arg2);         \ | 
|---|
| 412 | dbg_ThreadPopCall(); \ | 
|---|
| 413 | dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \ | 
|---|
| 414 | return ret;                            \ | 
|---|
| 415 | } | 
|---|
| 416 |  | 
|---|
| 417 | #define NODEF_DEBUGWRAP12(a) \ | 
|---|
| 418 | DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3); \ | 
|---|
| 419 | DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3) \ | 
|---|
| 420 | {                                          \ | 
|---|
| 421 | DWORD ret;                             \ | 
|---|
| 422 | dprintf((DBGWRAP_MODULE": %s %x %x %x", #a, arg1, arg2, arg3));         \ | 
|---|
| 423 | dbg_ThreadPushCall(#a); \ | 
|---|
| 424 | ret = ((DBG_WINPROC12)a)(arg1, arg2, arg3);         \ | 
|---|
| 425 | dbg_ThreadPopCall(); \ | 
|---|
| 426 | dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \ | 
|---|
| 427 | return ret;                            \ | 
|---|
| 428 | } | 
|---|
| 429 |  | 
|---|
| 430 | #define NODEF_DEBUGWRAP16(a) \ | 
|---|
| 431 | DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4); \ | 
|---|
| 432 | DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4) \ | 
|---|
| 433 | {                                          \ | 
|---|
| 434 | DWORD ret;                             \ | 
|---|
| 435 | dprintf((DBGWRAP_MODULE": %s %x %x %x %x", #a, arg1, arg2, arg3, arg4));         \ | 
|---|
| 436 | dbg_ThreadPushCall(#a); \ | 
|---|
| 437 | ret = ((DBG_WINPROC16)a)(arg1, arg2, arg3, arg4);         \ | 
|---|
| 438 | dbg_ThreadPopCall(); \ | 
|---|
| 439 | dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \ | 
|---|
| 440 | return ret;                            \ | 
|---|
| 441 | } | 
|---|
| 442 |  | 
|---|
| 443 | #define NODEF_DEBUGWRAP20(a) \ | 
|---|
| 444 | DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5); \ | 
|---|
| 445 | DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5) \ | 
|---|
| 446 | {                                          \ | 
|---|
| 447 | DWORD ret;                             \ | 
|---|
| 448 | dprintf((DBGWRAP_MODULE": %s %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5));         \ | 
|---|
| 449 | dbg_ThreadPushCall(#a); \ | 
|---|
| 450 | ret = ((DBG_WINPROC20)a)(arg1, arg2, arg3, arg4, arg5);         \ | 
|---|
| 451 | dbg_ThreadPopCall(); \ | 
|---|
| 452 | dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \ | 
|---|
| 453 | return ret;                            \ | 
|---|
| 454 | } | 
|---|
| 455 |  | 
|---|
| 456 | #define NODEF_DEBUGWRAP24(a) \ | 
|---|
| 457 | DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6); \ | 
|---|
| 458 | DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6) \ | 
|---|
| 459 | {                                          \ | 
|---|
| 460 | DWORD ret;                             \ | 
|---|
| 461 | dprintf((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg6));         \ | 
|---|
| 462 | dbg_ThreadPushCall(#a); \ | 
|---|
| 463 | ret = ((DBG_WINPROC24)a)(arg1, arg2, arg3, arg4, arg5, arg6);         \ | 
|---|
| 464 | dbg_ThreadPopCall(); \ | 
|---|
| 465 | dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \ | 
|---|
| 466 | return ret;                            \ | 
|---|
| 467 | } | 
|---|
| 468 |  | 
|---|
| 469 | #define NODEF_DEBUGWRAP28(a) \ | 
|---|
| 470 | DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7); \ | 
|---|
| 471 | DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7) \ | 
|---|
| 472 | {                                          \ | 
|---|
| 473 | DWORD ret;                             \ | 
|---|
| 474 | dprintf((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7));         \ | 
|---|
| 475 | dbg_ThreadPushCall(#a); \ | 
|---|
| 476 | ret = ((DBG_WINPROC28)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);         \ | 
|---|
| 477 | dbg_ThreadPopCall(); \ | 
|---|
| 478 | dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \ | 
|---|
| 479 | return ret;                            \ | 
|---|
| 480 | } | 
|---|
| 481 |  | 
|---|
| 482 | #define NODEF_DEBUGWRAP32(a) \ | 
|---|
| 483 | DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8); \ | 
|---|
| 484 | DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8) \ | 
|---|
| 485 | {                                          \ | 
|---|
| 486 | DWORD ret;                             \ | 
|---|
| 487 | dprintf((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7, arg8));         \ | 
|---|
| 488 | dbg_ThreadPushCall(#a); \ | 
|---|
| 489 | ret = ((DBG_WINPROC32)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);         \ | 
|---|
| 490 | dbg_ThreadPopCall(); \ | 
|---|
| 491 | dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \ | 
|---|
| 492 | return ret;                            \ | 
|---|
| 493 | } | 
|---|
| 494 |  | 
|---|
| 495 | #define NODEF_DEBUGWRAP36(a) \ | 
|---|
| 496 | DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9); \ | 
|---|
| 497 | DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9) \ | 
|---|
| 498 | {                                          \ | 
|---|
| 499 | DWORD ret;                             \ | 
|---|
| 500 | dprintf((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7, arg8, arg9));         \ | 
|---|
| 501 | dbg_ThreadPushCall(#a); \ | 
|---|
| 502 | ret = ((DBG_WINPROC36)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);         \ | 
|---|
| 503 | dbg_ThreadPopCall(); \ | 
|---|
| 504 | dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \ | 
|---|
| 505 | return ret;                            \ | 
|---|
| 506 | } | 
|---|
| 507 |  | 
|---|
| 508 | #define NODEF_DEBUGWRAP40(a) \ | 
|---|
| 509 | DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10); \ | 
|---|
| 510 | DWORD WIN32API Dbg##a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10) \ | 
|---|
| 511 | {                                          \ | 
|---|
| 512 | DWORD ret;                             \ | 
|---|
| 513 | dprintf((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7, arg8, arg9, arg10));         \ | 
|---|
| 514 | dbg_ThreadPushCall(#a); \ | 
|---|
| 515 | ret = ((DBG_WINPROC40)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);         \ | 
|---|
| 516 | dbg_ThreadPopCall(); \ | 
|---|
| 517 | dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \ | 
|---|
| 518 | return ret;                            \ | 
|---|
| 519 | } | 
|---|
| 520 |  | 
|---|
| 521 | #define NODEF_DEBUGWRAP44(a) \ | 
|---|
| 522 | DWORD WIN32API a(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5, DWORD arg6, DWORD arg7, DWORD arg8, DWORD arg9, DWORD arg10, DWORD arg11); \ | 
|---|
| 523 | DWORD 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) \ | 
|---|
| 524 | {                                          \ | 
|---|
| 525 | DWORD ret;                             \ | 
|---|
| 526 | dprintf((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7, arg8, arg9, arg10, arg11));         \ | 
|---|
| 527 | dbg_ThreadPushCall(#a); \ | 
|---|
| 528 | ret = ((DBG_WINPROC44)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11);         \ | 
|---|
| 529 | dbg_ThreadPopCall(); \ | 
|---|
| 530 | dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \ | 
|---|
| 531 | return ret;                            \ | 
|---|
| 532 | } | 
|---|
| 533 |  | 
|---|
| 534 | #define NODEF_DEBUGWRAP48(a) \ | 
|---|
| 535 | DWORD 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); \ | 
|---|
| 536 | DWORD 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) \ | 
|---|
| 537 | {                                          \ | 
|---|
| 538 | DWORD ret;                             \ | 
|---|
| 539 | dprintf((DBGWRAP_MODULE": %s %x %x %x %x %x %x", #a, arg1, arg2, arg3, arg4, arg5, arg7, arg8, arg9, arg10, arg11, arg12));         \ | 
|---|
| 540 | dbg_ThreadPushCall(#a); \ | 
|---|
| 541 | ret = ((DBG_WINPROC48)a)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);         \ | 
|---|
| 542 | dbg_ThreadPopCall(); \ | 
|---|
| 543 | dprintf((DBGWRAP_MODULE": %s returned %x", #a, ret)); \ | 
|---|
| 544 | return ret;                            \ | 
|---|
| 545 | } | 
|---|
| 546 |  | 
|---|
| 547 | #endif | 
|---|
| 548 |  | 
|---|