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.

139 lines
3.7 KiB

  1. #include "ulib.hxx"
  2. #include "drive.hxx"
  3. #include "untfs.hxx"
  4. #include "recordpg.hxx"
  5. extern "C" {
  6. #include <stdio.h>
  7. }
  8. BOOLEAN
  9. RECORD_PAGE_EDIT::Initialize(
  10. IN HWND WindowHandle,
  11. IN INT ClientHeight,
  12. IN INT ClientWidth,
  13. IN PLOG_IO_DP_DRIVE Drive
  14. )
  15. {
  16. TEXTMETRIC tm;
  17. HDC hdc;
  18. hdc = GetDC(WindowHandle);
  19. if (hdc == NULL)
  20. return FALSE;
  21. GetTextMetrics(hdc, &tm);
  22. ReleaseDC(WindowHandle, hdc);
  23. if (!VERTICAL_TEXT_SCROLL::Initialize(
  24. WindowHandle,
  25. 0,
  26. ClientHeight,
  27. ClientWidth,
  28. tm.tmExternalLeading + tm.tmHeight,
  29. tm.tmMaxCharWidth
  30. )) {
  31. return FALSE;
  32. }
  33. return TRUE;
  34. }
  35. VOID
  36. RECORD_PAGE_EDIT::SetBuf(
  37. IN HWND WindowHandle,
  38. IN OUT PVOID Buffer,
  39. IN ULONG Size
  40. )
  41. {
  42. _buffer = Buffer;
  43. _size = Size;
  44. SetRange(WindowHandle, _size/2);
  45. InvalidateRect(WindowHandle, NULL, TRUE);
  46. }
  47. VOID
  48. RECORD_PAGE_EDIT::Paint(
  49. IN HDC DeviceContext,
  50. IN RECT InvalidRect,
  51. IN HWND WindowHandle
  52. )
  53. {
  54. PLFS_RECORD_PAGE_HEADER pRecordPageHeader;
  55. TEXTMETRIC tm;
  56. INT ch, CurrentLine;
  57. TCHAR buf[1024];
  58. SetScrollRange(WindowHandle, SB_VERT, 0, _size/2, FALSE);
  59. SetScrollPos(WindowHandle, SB_VERT, QueryScrollPosition(), TRUE);
  60. if (!_buffer || _size < 512) {
  61. return;
  62. }
  63. GetTextMetrics(DeviceContext, &tm);
  64. ch = tm.tmExternalLeading + tm.tmHeight;
  65. CurrentLine = 0;
  66. pRecordPageHeader = (PLFS_RECORD_PAGE_HEADER)_buffer;
  67. swprintf(buf, TEXT("MultiSectorHeader.Signature: %c%c%c%c"),
  68. pRecordPageHeader->MultiSectorHeader.Signature[0],
  69. pRecordPageHeader->MultiSectorHeader.Signature[1],
  70. pRecordPageHeader->MultiSectorHeader.Signature[2],
  71. pRecordPageHeader->MultiSectorHeader.Signature[3]);
  72. WriteLine(DeviceContext, CurrentLine++, buf);
  73. swprintf(buf, TEXT("MultiSectorHeader.UpdateSequenceArrayOffset: %ul"),
  74. pRecordPageHeader->MultiSectorHeader.UpdateSequenceArrayOffset);
  75. WriteLine(DeviceContext, CurrentLine++, buf);
  76. swprintf(buf, TEXT("MultiSectorHeader.UpdateSequenceArraySize: %x"),
  77. pRecordPageHeader->MultiSectorHeader.UpdateSequenceArraySize);
  78. WriteLine(DeviceContext, CurrentLine++, buf);
  79. swprintf(buf, TEXT("Copy.LastLsn: %x:%x"),
  80. pRecordPageHeader->Copy.LastLsn.HighPart,
  81. pRecordPageHeader->Copy.LastLsn.LowPart);
  82. WriteLine(DeviceContext, CurrentLine++, buf);
  83. swprintf(buf, TEXT("Copy.FileOffset: %x"), pRecordPageHeader->Copy.FileOffset);
  84. WriteLine(DeviceContext, CurrentLine++, buf);
  85. swprintf(buf, TEXT("Flags: %x"), pRecordPageHeader->Flags);
  86. WriteLine(DeviceContext, CurrentLine++, buf);
  87. swprintf(buf, TEXT("PageCount: %x"), pRecordPageHeader->PageCount);
  88. WriteLine(DeviceContext, CurrentLine++, buf);
  89. swprintf(buf, TEXT("PagePosition: %x"), pRecordPageHeader->PagePosition);
  90. WriteLine(DeviceContext, CurrentLine++, buf);
  91. swprintf(buf, TEXT("Header.Packed.NextRecordOffset: %x"),
  92. pRecordPageHeader->Header.Packed.NextRecordOffset);
  93. WriteLine(DeviceContext, CurrentLine++, buf);
  94. swprintf(buf, TEXT("Header.Packed.LastEndLsn: %x:%x"),
  95. pRecordPageHeader->Header.Packed.LastEndLsn.HighPart,
  96. pRecordPageHeader->Header.Packed.LastEndLsn.LowPart);
  97. WriteLine(DeviceContext, CurrentLine++, buf);
  98. // then Header.Packed.UpdateSequenceArray
  99. }
  100. VOID
  101. RECORD_PAGE_EDIT::KeyUp(
  102. IN HWND WindowHandle
  103. )
  104. {
  105. ScrollUp(WindowHandle);
  106. }
  107. VOID
  108. RECORD_PAGE_EDIT::KeyDown(
  109. IN HWND WindowHandle
  110. )
  111. {
  112. ScrollDown(WindowHandle);
  113. }