Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

204 lines
8.4 KiB

  1. /*++ BUILD Version: 0001
  2. *
  3. * WOW v1.0
  4. *
  5. * Copyright (c) 2002, Microsoft Corporation
  6. *
  7. * dpmdbg.h
  8. * WOW32 Dynamic Patch Module Debug print macros
  9. *
  10. * History:
  11. * Created 01-10-2002 by cmjones
  12. *
  13. --*/
  14. #ifndef _DPMDBG_H_
  15. #define _DPMDBG_H_
  16. #include <stdarg.h>
  17. #include <stdio.h>
  18. #ifdef DBG
  19. VOID dpmlogprintf(LPCSTR pszFmt, ...);
  20. VOID dpmlogprintfW(LPCWSTR pszFmt, ...);
  21. VOID dpmlogprintf(LPCSTR pszFmt, ...)
  22. {
  23. int len;
  24. va_list arglist;
  25. char buffer[512];
  26. if(dwLogLevel) {
  27. va_start(arglist, pszFmt);
  28. len = vsprintf(buffer, pszFmt, arglist);
  29. OutputDebugString(buffer);
  30. va_end(arglist);
  31. }
  32. }
  33. /*
  34. VOID dpmlogprintfW(LPCWSTR pszFmt, ...)
  35. {
  36. int len;
  37. va_list arglist;
  38. wchar_t buffer[512];
  39. if(dwLogLevel) {
  40. va_start(arglist, pszFmt);
  41. // this is not linked unless UNICODE is defined
  42. // len = vswprintf(buffer, pszFmt, arglist);
  43. OutputDebugStringW(buffer);
  44. va_end(arglist);
  45. }
  46. }
  47. */
  48. char szNULL[] = "NULL";
  49. #define BIF(a) ((a!=0) ? "TRUE" : "FALSE") // boolean
  50. #define PIF(a) ((a!=0) ? *a : 0) // value @pointer
  51. #define SIF(a) ((a!=NULL) ? a : szNULL) // string
  52. #define RETSTR(a) ((a==0) ? "SUCCESS" : "FAILED") // return
  53. /* Turn these off for now -- until I can make the string buffer checks safe */
  54. #ifdef _SAFE_BUFFERS_IMPLEMENTED_
  55. #define DPMDBGPRN(fmt) dpmlogprintf(fmt)
  56. #define DPMDBGPRN1(fmt,a) dpmlogprintf(fmt,a)
  57. #define DPMDBGPRN2(fmt,a,b) dpmlogprintf(fmt,a,b)
  58. #define DPMDBGPRN3(fmt,a,b,c) dpmlogprintf(fmt,a,b,c)
  59. #define DPMDBGPRN4(fmt,a,b,c,d) dpmlogprintf(fmt,a,b,c,d)
  60. #define DPMDBGPRN5(fmt,a,b,c,d,e) dpmlogprintf(fmt,a,b,c,d,e)
  61. #define DPMDBGPRN6(fmt,a,b,c,d,e,f) dpmlogprintf(fmt,a,b,c,d,e,f)
  62. #define DPMDBGPRN7(fmt,a,b,c,d,e,f,g) dpmlogprintf(fmt,a,b,c,d,e,f,g)
  63. #define DPMDBGPRN8(fmt,a,b,c,d,e,f,g,h) dpmlogprintf(fmt,a,b,c,d,e,f,g,h)
  64. #define DPMDBGPRN9(fmt,a,b,c,d,e,f,g,h,i) \
  65. dpmlogprintf(fmt,a,b,c,d,e,f,g,h,i)
  66. #define DPMDBGPRN10(fmt,a,b,c,d,e,f,g,h,i,j) \
  67. dpmlogprintf(fmt,a,b,c,d,e,f,g,h,i,j)
  68. #define DPMDBGPRN11(fmt,a,b,c,d,e,f,g,h,i,j,k) \
  69. dpmlogprintf(fmt,a,b,c,d,e,f,g,h,i,j,k)
  70. #define DPMDBGPRN12(fmt,a,b,c,d,e,f,g,h,i,j,k,l) \
  71. dpmlogprintf(fmt,a,b,c,d,e,f,g,h,i,j,k,l)
  72. #define DPMDBGPRN13(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m) \
  73. dpmlogprintf(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m)
  74. #define DPMDBGPRN14(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m,n) \
  75. dpmlogprintf(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m,n)
  76. #define DPMDBGPRN15(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) \
  77. dpmlogprintf(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)
  78. #else // _SAFE_BUFFERS_IMPLEMENTED_
  79. #define DPMDBGPRN(fmt) dpmlogprintf(fmt)
  80. #define DPMDBGPRN1(fmt,a) dpmlogprintf(fmt,a)
  81. #define DPMDBGPRN2(fmt,a,b) dpmlogprintf(fmt,a)
  82. #define DPMDBGPRN3(fmt,a,b,c) dpmlogprintf(fmt,a)
  83. #define DPMDBGPRN4(fmt,a,b,c,d) dpmlogprintf(fmt,a)
  84. #define DPMDBGPRN5(fmt,a,b,c,d,e) dpmlogprintf(fmt,a)
  85. #define DPMDBGPRN6(fmt,a,b,c,d,e,f) dpmlogprintf(fmt,a)
  86. #define DPMDBGPRN7(fmt,a,b,c,d,e,f,g) dpmlogprintf(fmt,a)
  87. #define DPMDBGPRN8(fmt,a,b,c,d,e,f,g,h) dpmlogprintf(fmt,a)
  88. #define DPMDBGPRN9(fmt,a,b,c,d,e,f,g,h,i) dpmlogprintf(fmt,a)
  89. #define DPMDBGPRN10(fmt,a,b,c,d,e,f,g,h,i,j) dpmlogprintf(fmt,a)
  90. #define DPMDBGPRN11(fmt,a,b,c,d,e,f,g,h,i,j,k) dpmlogprintf(fmt,a)
  91. #define DPMDBGPRN12(fmt,a,b,c,d,e,f,g,h,i,j,k,l) dpmlogprintf(fmt,a)
  92. #define DPMDBGPRN13(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m) dpmlogprintf(fmt,a)
  93. #define DPMDBGPRN14(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m,n) dpmlogprintf(fmt,a)
  94. #define DPMDBGPRN15(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) dpmlogprintf(fmt,a)
  95. #endif // !_SAFE_BUFFERS_IMPLEMENTED_
  96. /*
  97. wchar_t szNULLW[] = L"NULL";
  98. #define BIFW(a) ((a!=0) ? L"TRUE" : L"FALSE") // boolean
  99. #define PIF(a) ((a!=0) ? *a : 0) // value @pointer
  100. #define SIFW(a) ((a!=NULL) ? a : szNULLW) // string
  101. #define RETSTRW(a) ((a==0) ? L"SUCCESS" : L"FAILED") // return
  102. #define DPMDBGPRNW(fmt) dpmlogprintfW(fmt)
  103. #define DPMDBGPRNW1(fmt,a) dpmlogprintfW(fmt,a)
  104. #define DPMDBGPRNW2(fmt,a,b) dpmlogprintfW(fmt,a,b)
  105. #define DPMDBGPRNW3(fmt,a,b,c) dpmlogprintfW(fmt,a,b,c)
  106. #define DPMDBGPRNW4(fmt,a,b,c,d) dpmlogprintfW(fmt,a,b,c,d)
  107. #define DPMDBGPRNW5(fmt,a,b,c,d,e) dpmlogprintfW(fmt,a,b,c,d,e)
  108. #define DPMDBGPRNW6(fmt,a,b,c,d,e,f) dpmlogprintfW(fmt,a,b,c,d,e,f)
  109. #define DPMDBGPRNW7(fmt,a,b,c,d,e,f,g) dpmlogprintfW(fmt,a,b,c,d,e,f,g)
  110. #define DPMDBGPRNW8(fmt,a,b,c,d,e,f,g,h) dpmlogprintfW(fmt,a,b,c,d,e,f,g,h)
  111. #define DPMDBGPRNW9(fmt,a,b,c,d,e,f,g,h,i) \
  112. dpmlogprintfW(fmt,a,b,c,d,e,f,g,h,i)
  113. #define DPMDBGPRNW10(fmt,a,b,c,d,e,f,g,h,i,j) \
  114. dpmlogprintfW(fmt,a,b,c,d,e,f,g,h,i,j)
  115. #define DPMDBGPRNW11(fmt,a,b,c,d,e,f,g,h,i,j,k) \
  116. dpmlogprintfW(fmt,a,b,c,d,e,f,g,h,i,j,k)
  117. #define DPMDBGPRNW12(fmt,a,b,c,d,e,f,g,h,i,j,k,l) \
  118. dpmlogprintfW(fmt,a,b,c,d,e,f,g,h,i,j,k,l)
  119. #define DPMDBGPRNW13(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m) \
  120. dpmlogprintfW(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m)
  121. #define DPMDBGPRNW14(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m,n) \
  122. dpmlogprintfW(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m,n)
  123. #define DPMDBGPRNW15(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) \
  124. dpmlogprintfW(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)
  125. */
  126. // turn these off for now until we can fix vswprintf()
  127. #define DPMDBGPRNW(fmt)
  128. #define DPMDBGPRNW1(fmt,a)
  129. #define DPMDBGPRNW2(fmt,a,b)
  130. #define DPMDBGPRNW3(fmt,a,b,c)
  131. #define DPMDBGPRNW4(fmt,a,b,c,d)
  132. #define DPMDBGPRNW5(fmt,a,b,c,d,e)
  133. #define DPMDBGPRNW6(fmt,a,b,c,d,e,f)
  134. #define DPMDBGPRNW7(fmt,a,b,c,d,e,f,g)
  135. #define DPMDBGPRNW8(fmt,a,b,c,d,e,f,g,h)
  136. #define DPMDBGPRNW9(fmt,a,b,c,d,e,f,g,h,i)
  137. #define DPMDBGPRNW10(fmt,a,b,c,d,e,f,g,h,i,j)
  138. #define DPMDBGPRNW11(fmt,a,b,c,d,e,f,g,h,i,j,k)
  139. #define DPMDBGPRNW12(fmt,a,b,c,d,e,f,g,h,i,j,k,l)
  140. #define DPMDBGPRNW13(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m)
  141. #define DPMDBGPRNW14(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m,n)
  142. #define DPMDBGPRNW15(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)
  143. #else // !DBG
  144. #define DPMDBGPRN(fmt)
  145. #define DPMDBGPRN1(fmt,a)
  146. #define DPMDBGPRN2(fmt,a,b)
  147. #define DPMDBGPRN3(fmt,a,b,c)
  148. #define DPMDBGPRN4(fmt,a,b,c,d)
  149. #define DPMDBGPRN5(fmt,a,b,c,d,e)
  150. #define DPMDBGPRN6(fmt,a,b,c,d,e,f)
  151. #define DPMDBGPRN7(fmt,a,b,c,d,e,f,g)
  152. #define DPMDBGPRN8(fmt,a,b,c,d,e,f,g,h)
  153. #define DPMDBGPRN9(fmt,a,b,c,d,e,f,g,h,i)
  154. #define DPMDBGPRN10(fmt,a,b,c,d,e,f,g,h,i,j)
  155. #define DPMDBGPRN11(fmt,a,b,c,d,e,f,g,h,i,j,k)
  156. #define DPMDBGPRN12(fmt,a,b,c,d,e,f,g,h,i,j,k,l)
  157. #define DPMDBGPRN13(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m)
  158. #define DPMDBGPRN14(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m,n)
  159. #define DPMDBGPRN15(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)
  160. #define DPMDBGPRNW(fmt)
  161. #define DPMDBGPRNW1(fmt,a)
  162. #define DPMDBGPRNW2(fmt,a,b)
  163. #define DPMDBGPRNW3(fmt,a,b,c)
  164. #define DPMDBGPRNW4(fmt,a,b,c,d)
  165. #define DPMDBGPRNW5(fmt,a,b,c,d,e)
  166. #define DPMDBGPRNW6(fmt,a,b,c,d,e,f)
  167. #define DPMDBGPRNW7(fmt,a,b,c,d,e,f,g)
  168. #define DPMDBGPRNW8(fmt,a,b,c,d,e,f,g,h)
  169. #define DPMDBGPRNW9(fmt,a,b,c,d,e,f,g,h,i)
  170. #define DPMDBGPRNW10(fmt,a,b,c,d,e,f,g,h,i,j)
  171. #define DPMDBGPRNW11(fmt,a,b,c,d,e,f,g,h,i,j,k)
  172. #define DPMDBGPRNW12(fmt,a,b,c,d,e,f,g,h,i,j,k,l)
  173. #define DPMDBGPRNW13(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m)
  174. #define DPMDBGPRNW14(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m,n)
  175. #define DPMDBGPRNW15(fmt,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)
  176. #endif // !DBG
  177. #endif _DPMDBG_H_