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.

132 lines
3.8 KiB

  1. #include "ulib.hxx"
  2. #include "ofs.hxx"
  3. #include "ofsbedit.hxx"
  4. extern "C" {
  5. #include <stdio.h>
  6. }
  7. VOID
  8. OFS_BOOT_EDIT::SetBuf(
  9. IN HWND WindowHandle,
  10. IN OUT PVOID Buffer,
  11. IN ULONG Size
  12. )
  13. {
  14. _buffer = Buffer;
  15. _size = Size;
  16. SetScrollRange(WindowHandle, SB_VERT, 0, 0, FALSE);
  17. InvalidateRect(WindowHandle, NULL, TRUE);
  18. }
  19. VOID
  20. OFS_BOOT_EDIT::Paint(
  21. IN HDC DeviceContext,
  22. IN RECT InvalidRect,
  23. IN HWND WindowHandle
  24. )
  25. {
  26. DSKPACKEDBOOTSECT *p;
  27. DSKBPB bpb;
  28. TEXTMETRIC textmetric;
  29. INT ch, current;
  30. TCHAR buf[1024];
  31. SetScrollRange(WindowHandle, SB_VERT, 0, 0, FALSE);
  32. if (!_buffer || _size < 128) {
  33. return;
  34. }
  35. p = (DSKPACKEDBOOTSECT *) _buffer;
  36. UnpackOfsBios(&bpb, &(p->PackedBpb));
  37. GetTextMetrics(DeviceContext, &textmetric);
  38. ch = textmetric.tmExternalLeading + textmetric.tmHeight;
  39. current = 0;
  40. swprintf(buf, TEXT("OEM String: %c%c%c%c%c%c%c%c"),
  41. p->Oem[0],
  42. p->Oem[1],
  43. p->Oem[2],
  44. p->Oem[3],
  45. p->Oem[4],
  46. p->Oem[5],
  47. p->Oem[6],
  48. p->Oem[7]);
  49. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  50. current += ch;
  51. swprintf(buf, TEXT("Bytes per sector: %x"), bpb.BytesPerSector);
  52. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  53. current += ch;
  54. swprintf(buf, TEXT("Sectors per cluster: %x"), bpb.SectorsPerCluster);
  55. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  56. current += ch;
  57. swprintf(buf, TEXT("Reserved Sectors: %x"), bpb.ReservedSectors);
  58. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  59. current += ch;
  60. swprintf(buf, TEXT("Number of fats: %x"), bpb.Fats);
  61. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  62. current += ch;
  63. swprintf(buf, TEXT("Root entries: %x"), bpb.RootEntries);
  64. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  65. current += ch;
  66. swprintf(buf, TEXT("Small sector count: %x"), bpb.Sectors16);
  67. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  68. current += ch;
  69. swprintf(buf, TEXT("Media byte: %x"), bpb.Media);
  70. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  71. current += ch;
  72. swprintf(buf, TEXT("Sectors per fat: %x"), bpb.SectorsPerFat);
  73. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  74. current += ch;
  75. swprintf(buf, TEXT("Sectors per track: %x"), bpb.SectorsPerTrack);
  76. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  77. current += ch;
  78. swprintf(buf, TEXT("Number of heads: %x"), bpb.Heads);
  79. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  80. current += ch;
  81. swprintf(buf, TEXT("Number of hidden sectors: %x"), bpb.HiddenSectors);
  82. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  83. current += ch;
  84. swprintf(buf, TEXT("Large number of sectors: %x"), bpb.Sectors32);
  85. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  86. current += ch;
  87. swprintf(buf, TEXT("Volume Id: <%x,%x>"), (ULONG)(p->VolumeId >> 32),
  88. (ULONG)(p->VolumeId));
  89. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  90. current += ch;
  91. swprintf(buf, TEXT("OFS number of sectors: <%x,%x>"), (ULONG)(p->Sectors >> 32),
  92. (ULONG)(p->Sectors));
  93. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  94. current += ch;
  95. swprintf(buf, TEXT("OfsVolCatExtent: %x for %x"), ExtentAddr(p->OfsVolCatExtent),
  96. ExtentSize(p->OfsVolCatExtent));
  97. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  98. current += ch;
  99. swprintf(buf, TEXT("CheckSum: %x"), p->CheckSum);
  100. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  101. current += ch;
  102. swprintf(buf, TEXT("Flags: %x"), p->Flags);
  103. TextOut(DeviceContext, 0, current, buf, wcslen(buf));
  104. current += ch;
  105. }