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.

129 lines
3.5 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. reglog.c
  5. Abstract:
  6. This module contains functions to check bin header and bin body consistency.
  7. Author:
  8. Dragos C. Sambotin (dragoss) 17-Feb-2000
  9. Revision History:
  10. --*/
  11. #include "chkreg.h"
  12. VOID
  13. ChkDumpLogFile( PHBASE_BLOCK BaseBlock,ULONG Length )
  14. /*++
  15. Routine Description:
  16. Arguments:
  17. BaseBlock - the BaseBlock in-memory mapped image.
  18. dwFileSize - the actual size of the hive file
  19. Return Value:
  20. --*/
  21. {
  22. ULONG Cluster; // for logs only
  23. PULONG DirtyVector;
  24. ULONG DirtSize;
  25. ULONG DirtyCount;
  26. ULONG i;
  27. ULONG SizeOfBitmap;
  28. ULONG DirtyBuffer;
  29. PUCHAR DirtyBufferAddr;
  30. ULONG Mask;
  31. ULONG BitsPerULONG;
  32. ULONG BitsPerBlock;
  33. char str[HBASE_NAME_ALLOC +1];
  34. fprintf(stderr, "Signature : ");
  35. if(BaseBlock->Signature != HBASE_BLOCK_SIGNATURE) {
  36. fprintf(stderr, "(0x%lx) - Invalid",BaseBlock->Signature);
  37. } else {
  38. fprintf(stderr, "HBASE_BLOCK_SIGNATURE - Valid");
  39. }
  40. fprintf(stderr, "\n");
  41. fprintf(stderr, "Sequence1 : %lx\n",BaseBlock->Sequence1);
  42. fprintf(stderr, "Sequence2 : %lx\n",BaseBlock->Sequence2);
  43. fprintf(stderr, "TimeStamp(High:Low) : (%lx:%lx)\n",BaseBlock->TimeStamp.HighPart,BaseBlock->TimeStamp.LowPart);
  44. fprintf(stderr, "Major Version : %lx\n",BaseBlock->Major);
  45. fprintf(stderr, "Minor Version : %lx\n",BaseBlock->Minor);
  46. fprintf(stderr, "Type : %lx\n",BaseBlock->Type);
  47. fprintf(stderr, "Format : %lx\n",BaseBlock->Format);
  48. fprintf(stderr, "RootCell : %lx\n",BaseBlock->RootCell);
  49. fprintf(stderr, "Length : %lx\n",BaseBlock->Length);
  50. Cluster = BaseBlock->Cluster;
  51. fprintf(stderr, "Cluster : %lx\n",Cluster);
  52. /* for(i=0;i<HBASE_NAME_ALLOC;i++) str[i] = BaseBlock->FileName[i];
  53. str[i] = 0;
  54. fprintf(stderr, "FileName: %s\n",str);
  55. */
  56. fprintf(stderr, "CheckSum : %lx\n",BaseBlock->CheckSum);
  57. DirtyVector = (PULONG)((PCHAR)BaseBlock + Cluster*HSECTOR_SIZE);
  58. fprintf(stderr, "Dirt Signature : ");
  59. if( *DirtyVector == HLOG_DV_SIGNATURE ) {
  60. fprintf(stderr, "HLOG_DV_SIGNATURE - Valid");
  61. } else {
  62. fprintf(stderr, "(0x%lx) - Invalid",*DirtyVector);
  63. }
  64. fprintf(stderr, "\n");
  65. DirtyVector++;
  66. if( Length == 0 ) Length = BaseBlock->Length;
  67. DirtSize = Length / HSECTOR_SIZE;
  68. SizeOfBitmap = DirtSize;
  69. DirtyBufferAddr = (PUCHAR)DirtyVector;
  70. BitsPerULONG = 8*sizeof(ULONG);
  71. BitsPerBlock = HBLOCK_SIZE / HSECTOR_SIZE;
  72. DirtyCount = 0;
  73. fprintf(stderr,"\n Address 32k 32k");
  74. for(i=0;i<SizeOfBitmap;i++) {
  75. if( !(i%(2*BitsPerULONG ) ) ){
  76. fprintf(stderr,"\n 0x%8lx ",i*HSECTOR_SIZE);
  77. }
  78. if( !(i%BitsPerBlock) ) {
  79. fprintf(stderr," ");
  80. }
  81. if( !(i%BitsPerULONG) ) {
  82. //
  83. // fetch in a new DWORD
  84. //
  85. DirtyBuffer = *(PULONG)DirtyBufferAddr;
  86. DirtyBufferAddr += sizeof(ULONG);
  87. fprintf(stderr,"\t");
  88. }
  89. Mask = ((DirtyBuffer >> (i%BitsPerULONG)) & 0x1);
  90. //Mask <<= (BitsPerULONG - (i%BitsPerULONG) - 1);
  91. //Mask &= DirtyBuffer;
  92. fprintf(stderr,"%s",Mask?"1":"0");
  93. if(Mask) DirtyCount++;
  94. }
  95. fprintf(stderr,"\n\n");
  96. fprintf(stderr,"DirtyCount = %lu\n",DirtyCount);
  97. }