Source code of Windows XP (NT5)
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.

128 lines
3.1 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: dib.c
  3. *
  4. * This file is for debugging tools and extensions.
  5. *
  6. * Created: 12-Jan-1996
  7. * Author: VadimB
  8. *
  9. * History:
  10. * Jan 12 96 VadimB Created to dump a list of dib.drv support structures
  11. *
  12. *
  13. * Copyright (c) 1992 Microsoft Corporation
  14. \**************************************************************************/
  15. #include "precomp.h"
  16. #pragma hdrstop
  17. #include <wmdisp32.h>
  18. #include <wcuricon.h>
  19. #include <wucomm.h>
  20. #include <doswow.h>
  21. #include <wdib.h>
  22. #include <wowgdip.h>
  23. //
  24. // Local function prototypes
  25. //
  26. extern INT WDahtoi(LPSZ lpsz);
  27. extern INT WDParseArgStr(LPSZ lpszArgStr, CHAR **argv, INT iMax);
  28. LPVOID DumpDibInfo(PDIBINFO pdi)
  29. {
  30. DIBINFO di;
  31. READMEM_XRETV(di, pdi, NULL);
  32. pdi = &di;
  33. PRINTF(">> Structure at %08X\n", (DWORD)(LPVOID)pdi);
  34. PRINTF("di_hdc: (32)%08X (16)%04X\n", pdi->di_hdc, ((DWORD)(pdi->di_hdc))<<2);
  35. PRINTF("di_newdib: %08X\n", (DWORD)pdi->di_newdib);
  36. PRINTF("di_newIntelDib: %08X\n", (DWORD)pdi->di_newIntelDib);
  37. PRINTF("di_hbm: (32)%08X\n", (DWORD)pdi->di_hbm);
  38. PRINTF("di_dibsize: %08X\n", (DWORD)pdi->di_dibsize);
  39. PRINTF("di_originaldibsel: %08X\n", (DWORD)pdi->di_originaldibsel);
  40. PRINTF("di_originaldibflags: %08X\n", (DWORD)pdi->di_originaldibflags);
  41. PRINTF("di_lockcount: %08X\n", (DWORD)pdi->di_lockcount);
  42. PRINTF("\n");
  43. return (LPVOID)pdi->di_next;
  44. }
  45. VOID DumpDibChain(LPSTR lpszExpressionHead)
  46. {
  47. PDIBINFO pdi;
  48. GETEXPRADDR(pdi, lpszExpressionHead);
  49. READMEM_XRET(pdi, pdi);
  50. if (NULL == pdi) {
  51. PRINTF("List %s is empty!\n", lpszExpressionHead);
  52. }
  53. else {
  54. PRINTF("\nDump of the DIB.DRV support structure: %s\n", lpszExpressionHead);
  55. PRINTF("-------------------------------------------------------\n");
  56. while (NULL != pdi) {
  57. pdi = DumpDibInfo(pdi);
  58. }
  59. }
  60. }
  61. VOID
  62. dhdib(
  63. CMD_ARGLIST
  64. )
  65. {
  66. // dump dib support chain
  67. // dumps: dhdib @<address> - dump at address
  68. // dumps: dhdib - everything...
  69. CHAR* argv[3];
  70. int nArgs;
  71. BOOL fDumpDib = TRUE;
  72. static CHAR* symDibHead = "wow32!pDibInfoHead";
  73. PDIBINFO pdi;
  74. CMD_INIT();
  75. ASSERT_WOW_PRESENT;
  76. nArgs = WDParseArgStr(lpArgumentString, argv, 2);
  77. if (nArgs > 0) {
  78. CHAR* parg = argv[0];
  79. switch(toupper(*parg)) { // dump at...
  80. case '@':
  81. // recover address and dump!
  82. {
  83. CHAR* pch = *++parg ?
  84. parg :
  85. (nArgs >= 2 ? argv[1] : NULL);
  86. if (pch) {
  87. pdi = (PDIBINFO)WDahtoi(pch);
  88. fDumpDib = FALSE;
  89. }
  90. else {
  91. PRINTF("Invalid Parameter\n");
  92. }
  93. }
  94. break;
  95. default:
  96. break;
  97. }
  98. }
  99. if (fDumpDib) {
  100. DumpDibChain(symDibHead);
  101. }
  102. else {
  103. if (pdi) {
  104. DumpDibInfo(pdi);
  105. }
  106. }
  107. }