-> [Go to the download page] -> [Download Now]
@rem = ('--*-Perl-*-- @echo off if exist "%~dp0\perl.exe" "%~dp0\perl.exe" "%~dpn0.bat" %* if not exist "%~dp0\perl.exe" "perl.exe" "%~dpn0.bat" %* goto exit ') if 0; #!/usr/local/bin/perl # # File Name: "bpbf.bat" - "BPB" display tool text Filtering wrapper # # Copyright: Public Domain Software (NOT TO BE SHAREWARE OR FREEWARE) # # Version (??: secondary series; can be revised by somebodies) # *.*?? by *** May be revised for something # # Version (ps: primary series; reserved for S. ) # 1.0ps by S. Created for perl4 or later version. # # Related Softwares (required): # # - perl 5, version 16, subversion 3 (v5.16.3) built for MSWin32-x86-multi-thread (freeware, 32bit) etc. # http://www.activestate.com/activeperl/downloads # http://downloads.activestate.com/ActivePerl/releases/5.16.3.1603/ActivePerl-5.16.3.1603-MSWin32-x86-296746.msi # (used: "perl.exe" and "perl516.dll") # # - bpb: displays information about a drive and the BPB on the volume (freeware, 32bit) # http://www.vector.co.jp/download/file/winnt/util/fh328130.html # http://ftp.vector.co.jp/pack/winnt/util/disk/status/bpb.zip # (used: "bpb.exe") sub which { local(@_) = grep(-f "$_\\$_[0]" && ($_ = "$_\\$_[0]"), split(/\\*;/, $ENV{PATH})); return $_[0]; } $_ = 'bpb.exe'; $bpb = $0; $bpb =~ s/([^\\]*)$/$_/; $bpb = &which($_) if !-f "$bpb"; die "Can't find \"$_\": $!\a\n" if !-f "$bpb"; #print STDERR "used: \"$0\"\n"; #print STDERR "used: \"$^X\"\n"; #print STDERR "used: \"$bpb\"\n"; $mode = shift(@ARGV) if $ARGV[0] eq '-t'; # option -t: transparent mode $mode = shift(@ARGV) if $ARGV[0] eq '-f'; # option -f: filtering mode (default) open(BPB, "\"$bpb\" @ARGV|") || die "Can't open \"$bpb\": $!\a\n"; if ($mode eq '-t') { while (<BPB>) { print; } } else { while (<BPB>) { # print if /^Volume:/; #;; print if /^StartingOffset:/; if (1 & /^(StartingOffset:\s*)(\S+)\s+(\d+)/) { $N = $3; $U4KB = $N / 4096; # 4KB $U1MB = $N / 2**20; # 1MB $U1GB = $N / 2**30; # 1GB printf("$1$2=${N}B $U4KB/4KB %.3fMB %.3fGB\n", $U1MB, $U1GB); } #;; print if /^PartitionLength:/; if (1 & /^(PartitionLength:\s*)(\S+)\s+(\d+)/) { $N = $3; $U4KB = $N / 4096; # 4KB $U1MB = $N / 2**20; # 1MB $U1GB = $N / 2**30; # 1GB printf("$1$2=${N}B $U4KB/4KB %.3fMB %.3fGB\n", $U1MB, $U1GB); } #;; print if /^HiddenSectors:/; if (1 & /^(HiddenSectors:\s*)(\S+)\s+(\d+)/) { $N = $3; $U4KB = $N / 8; # 8 Sectors = 4KB printf("MBR/EPBR $1$2 $N $U4KB/4KB; $2 %% 8 = %u\n", $N % 8); } # print if /^PartitionNumber:/; print if /^PartitionType:/; # print if /^BootIndicator:/; # print if /^RecognizedPartition:/; # print if /^RewritePartition:/; # print if /^00h-02h Jump Instruction:/; # print if /^03h-0ah OEM ID:/; # print if /^BIOS Parameter Block/; # print if /^0bh-0ch Bytes Per Sector:/; #;; print if /^0dh Sectors Per Cluster:/; if (1 & /^(0dh Sectors Per Cluster:\s*)(\S+)\s+(\d+)/) { $N = $3; $U1B = $N * 512; # 1/512 Sectors = 1B $U1KB = $N / 2; # 2 Sectors = 1KB $U4KB = $N / 8; # 8 Sectors = 4KB printf("$1$2 $N %uB ${U1KB}KB $U4KB/4KB\n", $U1B); } #;; print if /^0eh-0fh Reserved Sectors:/; if (1 & /^(0eh-0fh Reserved Sectors:\s*)(\S+)\s+(\d+)/) { $N = $3; $U4KB = $N / 8; # 8 Sectors = 4KB printf("$1$2 $N $U4KB/4KB; $2 %% 8 = %u\n", $N % 8); } #;; print if /^10h Number of FATs:/; if (1 & /^(10h Number of FATs:\s*)(\S+)\s+(\d+)/) { $NOF = $3; print; } # print if /^11h-12h Root Entries:/; # print if /^13h-14h Small Sectors:/; # print if /^15h Media Descriptor:/; # print if /^16h-17h Sectors Per FAT:/; # print if /^18h-19h Sectors Per Track:/; # print if /^1ah-1bh Number Of Heads:/; #;; print if /^1ch-1fh Hidden Sectors:/; if (1 & /^(1ch-1fh Hidden Sectors:\s*)(\S+)\s+(\d+)/) { $N = $3; $U4KB = $N / 8; # 8 Sectors = 4KB printf("$1$2 $N $U4KB/4KB; $2 %% 8 = %u\n", $N % 8); } #;; print if /^20h-23h Large Sectors:/; if (0 & /^(20h-23h Large Sectors:\s*)(\S+)\s+(\d+)/) { $N = $3; $U4KB = $N / 8; # 8 Sectors = 4KB $U1MB = $N / 2048; # 2048 Sectors = 1MB $U1GB = $N / 2**21; # 2**21 Sectors = 1GB printf("$1$2 $N $U4KB/4KB %.3fMB %.3fGB\n", $U1MB, $U1GB); } #;; print if /^24h-27h Sectors Per FAT:/; if (1 & /^(24h-27h Sectors Per FAT:\s*)(\S+)/) { $N = hex($2); $U4KB = $N * $NOF / 8; # 8 Sectors = 4KB printf("$1$2 $N $U4KB/4KB; ($2 * $NOF) %% 8 = %u\n", ($N * $NOF) % 8); } # print if /^28h-29h Extended Flags:/; # print if /^2ah-2bh File System Version:/; # print if /^2ch-2fh Root Cluster Number:/; # print if /^30h-31h File System Information Sector Number:/; # print if /^32h-33h Backup Boot Sector :/; # print if /^34h-3fh Reserved:/; # print if /^Extended BIOS Parameter Block/; # print if /^40h Physical Drive Number:/; # print if /^41h Reserved:/; # print if /^42h Extended Boot Signature:/; # print if /^43h-46h Volume Serial Number:/; print if /^47h-51h Volume Label:/; # print if /^52h-59h System ID:/; } } close(); @rem = (' :exit ') if 0;