Tobias Simetsreiter пре 4 година
родитељ
комит
339ef3f3bc

+ 58 - 94
WinImager.ps1 → WinImager/LibWinImager.psm1

@@ -1,74 +1,74 @@
-if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))  
-{  
-    $arguments = "& '" +$myinvocation.mycommand.definition + "'"
-    Start-Process powershell -Verb runAs -ArgumentList $arguments
-    Break
-}
 
 [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
 
-Function Main()
-{
-    $ErrorActionPreference = "Stop"
-
-    # Get-FileName
-    $filename = Get-FileName
-    if (($filename -eq $null) -or ($filename -eq "")){
+Function BecomeAdmin($invocation){
+    if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))  
+    {  
+        $arguments = "& '" +$invocation.mycommand.definition + "'"
+        Start-Process powershell -Verb runAs -ArgumentList $arguments
         Break
     }
-    $continue = "Yes"
-
-    while ($continue -eq "Yes"){
-
-        $disk = Get-PhysDev
-        $disknum = $disk.Number
-        $diskname = $disk.FriendlyName
-        $diskserial = $disk.SerialNumber
+}
 
-        if ((-not $disknum -is [int]) -or $disknum -eq $null -or $disknum -lt 0){
-            Write-Output "No Disk Selected"
-        } else {
+Function AskContinue($text)
+{
+    [System.Windows.Forms.MessageBox]::Show($text, 'Continue','YesNo','Info')
+}
 
-            $dialog = @"
-Going to write Image:
+Function WinDD($inFileName, $outFileName, $blocksize = 5Mb) {
 
-"${filename}"
+    Write-Output ""
+    Write-Output "" "Copy $inFileName to $outFileName with blocksize: $blocksize...."
+    $block = [System.Byte[]]::CreateInstance([System.Byte], $blocksize)
 
-to Drive:
+    try{
+        $inFile = [System.IO.File]::Open($inFileName, [System.IO.FileMode]::Open)
+        $outFile = [System.IO.File]::Open($outFileName, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Write)
+        $outFile.Seek(0,0) | Out-Null
+        $inFile.Seek(0,0)  | Out-Null
 
-"${diskname} ${diskserial}" 
+        $max =          [math]::Round($inFile.Length/1Mb)
+        $starttime =    [System.DateTime]::Now
+        while ($outFile.Position -lt $inFile.Length){
 
-Would you like to contine?
-"@ 
-            $continue = Ask-Continue $dialog
+            $remains = ($inFile.Length - $outFile.Position)
 
+            if($remains -lt $blocksize){
+                $blocksize = $remains
+                $block = [System.Byte[]]::CreateInstance([System.Byte], $blocksize)
+            }
 
-            if ($continue -eq "Yes"){
+            $inFile.Read( $block, 0, $blocksize)    | Out-Null
+            $outFile.Write( $block , 0, $blocksize) | Out-Null
 
-                Reset-Disk $disknum
-                WinDD $filename ("\\.\PHYSICALDRIVE{0}" -f $disknum)
-                Fix-CHS $disknum
+            $percent = [math]::Min(100,[math]::Round(100 * $outFile.Position / $inFile.Length, 1))
+            $done    = [math]::Round($outFile.Position/1Mb)
+            $speed   = [math]::Round($done / ([System.DateTime]::Now - $startTime).TotalSeconds, 2)
+            $status  = "{0,5}% {1,6}/{2} Mb {3} Mbps " -f ($percent,$done,$max,$speed)
 
-            }
+            Write-Progress -Id 1 -Activity "Writing in Progress" -Status $status -PercentComplete $percent;
         }
+        Write-Output "Flushing...."
+        $outFile.Flush()
+        Write-Output "Done!"
+
+    } catch {
 
-        $dialog = @"
-Write image 
+        $ex = $_.Exception
 
-"${filename}"
+    } finally {
 
-to another Drive?
-"@
-        $continue = Ask-Continue $dialog
+        $inFile.Close()
 
+        try {
+            $outFile.Close()
+        } catch {
+            $_.Exception
+        }
+        if ($ex -ne $null){throw $ex}
     }
 
-}
-
-Function Ask-Continue($text)
-{
-    [System.Windows.Forms.MessageBox]::Show($text, 'Continue','YesNo','Info')
-}
+} #end function WinDD
 
 Function Reset-Disk($disknum)
 {
@@ -88,18 +88,22 @@ clean
     sleep 10
 }
 
-Function Fix-CHS($disknum){
+Function FixCHS($disknum){
     $ErrorActionPreference = "Stop"
     
     if ((-not $disknum -is [int]) -or $disknum -eq $null -or $disknum -lt 0){
         Break
     }
+    $fixparts = [System.IO.Path]::Combine($PSScriptRoot, "fixparts-windows-1.0.6","fixparts64")
+    $fixparts 
+    $args     = ("\\.\PHYSICALDRIVE{0}" -f $disknum)
+    $args
     @"
 y
 c
 w
 y
-"@  | .\fixparts-windows-1.0.6\fixparts64 ("\\.\PHYSICALDRIVE{0}" -f $disknum)
+"@  | &$fixparts $args
 
 }
 
@@ -168,7 +172,8 @@ Function SelectDiskDialog($disks){
         $number = $d.Number.toString()
         $name = $d.FriendlyName
         $serial = $d.SerialNumber
-        $label = "{0,-3} {1,-25} {2,-20} {3,8} GB" -f $number,$name,$serial,$size
+        $bustype = $d.BusType
+        $label = "{0,-3} {1,-4} {2,-22} {3,-20} {4,8} GB" -f $number,$bustype,$name,$serial,$size
         [void] $listBox.Items.Add($label)
     }
 
@@ -185,45 +190,4 @@ Function SelectDiskDialog($disks){
     }
 } #end function Get-PhysDev
 
-Function WinDD($inFileName, $outFileName, $blocksize = 5Mb) {
-
-    Write-Output ""
-    Write-Output "" "Copy $inFileName to $outFileName with blocksize: $blocksize ...."
-    $block = [System.Byte[]]::CreateInstance([System.Byte], $blocksize)
-
-    try{
-        $inFile = [System.IO.File]::Open($inFileName, [System.IO.FileMode]::Open)
-        $outFile = [System.IO.File]::Open($outFileName, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Write)
-        $outFile.Seek(0,0) | Out-Null
-        $inFile.Seek(0,0)  | Out-Null
-
-        $max =      [math]::Round($inFile.Length/1Mb)
-        while ($outFile.Position -lt $inFile.Length){
-
-            $remains = ($inFile.Length - $outFile.Position)
-
-            if($remains -lt $blocksize){
-                $blocksize = $remains
-                $block = [System.Byte[]]::CreateInstance([System.Byte], $blocksize)
-            }
-
-            $inFile.Read( $block, 0, $blocksize)    | Out-Null
-            $outFile.Write( $block , 0, $blocksize) | Out-Null
-
-            $percent = [math]::Min(100,[math]::Round(100 * $outFile.Position / $inFile.Length, 1))
-            $done    = [math]::Round($outFile.Position/1Mb)
-            $status  = "{0,5}% {1,6}/{2} Mb" -f ($percent,$done,$max)
-            Write-Progress -Id 1 -Activity "Writing in Progress" -Status $status -PercentComplete $percent;
-        }
-        Write-Output "Flushing...."
-        $outFile.Flush()
-        Write-Output "Done!"
-    } finally {
-        $inFile.Close()
-        $outFile.Close()
-    }
-
-} #end function WinDD
-
-
-Main 
+Export-ModuleMember -Function *

+ 64 - 0
WinImager/WinImager.ps1

@@ -0,0 +1,64 @@
+
+$libpath = [System.IO.Path]::Combine($MyInvocation.MyCommand.Definition, "..", "LibWinImager.psm1")
+Import-Module -Name $libpath
+
+BecomeAdmin $MyInvocation
+
+Function Main()
+{
+
+    $ErrorActionPreference = "Stop"
+
+    $filename = Get-FileName
+    if (($filename -eq $null) -or ($filename -eq "")){
+        Break
+    }
+    $continue = "Yes"
+
+    while ($continue -eq "Yes"){
+
+        $disk = Get-PhysDev
+        $disknum = $disk.Number
+        $diskname = $disk.FriendlyName
+        $diskserial = $disk.SerialNumber
+
+        if ((-not $disknum -is [int]) -or $disknum -eq $null -or $disknum -lt 0){
+            Write-Output "No Disk Selected"
+        } else {
+
+            $dialog = @"
+Going to write Image:
+
+"${filename}"
+
+to Drive:
+
+"${diskname} ${diskserial}" 
+
+Would you like to contine?
+"@ 
+            $continue = AskContinue $dialog
+
+
+            if ($continue -eq "Yes"){
+
+                Reset-Disk $disknum
+                WinDD $filename ("\\.\PHYSICALDRIVE{0}" -f $disknum)
+                FixCHS $disknum
+            }
+        }
+
+        $dialog = @"
+Write image 
+
+"${filename}"
+
+to another Drive?
+"@
+        $continue = AskContinue $dialog
+
+    }
+
+}
+
+Main 

+ 340 - 0
WinImager/fixparts-windows-1.0.6/COPYING

@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.

+ 1431 - 0
WinImager/fixparts-windows-1.0.6/NEWS

@@ -0,0 +1,1431 @@
+1.0.6 (1/13/2021):
+------------------
+
+- Fixed bug that could cause segfault if GPT header claimed partition
+  entries are oversized. See:
+  https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-0256
+
+- Fixed bug that could cause a crash if a badly-formatted MBR disk was
+  read. See:
+  https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-0308
+
+- Renamed the partition type "Freedesktop $BOOT" to "XBOOTLDR partition".
+
+- Added several more Freedesktop partition table type codes (0x8312 through
+  0x831C).
+
+- Fixed type code definition in diskio-unix.cc that prevented 32-bit builds
+  from correctly handling disks over 4 TiB in size.
+
+- Minor tweaks to get the software to compile on FreeBSD; that seems to have
+  fallen into disrepair.
+
+1.0.5 (2/17/2020):
+------------------
+
+- Fixed typos and minor formatting issues in man pages
+
+- Changed number of columns in type code output ("sgdisk -L" and equivalents
+  in gdisk and cgdisk) from 3 to 2, since some descriptions are long enough
+  that they're ambiguous with three columns.
+
+- Makefile change: Add $(LDLIBS) support to enable clean static builds (for
+  libintl).
+
+- You can now put the 0xEE partition last in a hybrid MBR using sgdisk.
+  (Previously, this was possible with gdisk but not with sgdisk.) See the
+  sgdisk man page for details.
+
+- Added numerous type codes for Container Linux, Veracrypt, and
+  Freedesktop.org's Discoverable Partitions Specification
+
+- Partition type name searches are now case-insensitive.
+
+- It's now possible to quit out of partition type name searches by typing
+  "q".
+
+- When changing a partition type code, the default is now the current
+  type code, not a platform-specific type code.
+
+- The UEFI GPT fdisk project
+  (https://sourceforge.net/projects/uefigptfdisk/) hasn't been updated since
+  2016, and is now broken; binaries don't compile with modern GCC
+  toolchains, and even when dropping back to Ubuntu 14.04, which worked for
+  GPT fdisk 1.0.4, the resulting binary hangs on launch. Therefore, I'm
+  dropping support for the EFI build of gdisk, at least unless and until
+  UEFI GPT fdisk is fixed.
+
+- Apple no longer supports building i386 or "fat" binaries in XCode (or if
+  they do, they're making it hard), so I've removed that support. GPT fdisk
+  macOS binaries are now x86-64 only. Similarly, building now seems to
+  require macOS 10.9 or later, so that's now the minimum macOS version. I've
+  also re-built my Mac build environment and tweaked Makefile.mac
+  appropriately.
+
+1.0.4 (7/5/2018):
+-----------------
+
+- Added some explicit copy constructors and made some other tweaks to avoid
+  compiler warnings.
+
+- The macOS binary for sgdisk is now a pure 64-bit build; I'm no longer
+  supporting 32-bit builds of sgdisk. The gdisk and cgdisk binaries remain
+  "fat" 32-/64-bit builds. The reason for dropping the 32-bit support from
+  sgdisk is that I've re-built my macOS development system, and I had
+  trouble building a "fat" binary with the fresh install of the popt
+  libraries upon which sgdisk relies. 32-bit support for the other binaries
+  is now officially deprecated, too.
+
+- Added search feature to partition type list functions ("L" on main menu of
+  gdisk and "L" when entered in response to the "Hex code or GUID" prompt in
+  gdisk and sgdisk). This feature filters the partition type list to those
+  which include the search term in their GPT fdisk descriptions. For
+  instance, typing "Linux" shows only partitions with "Linux" in their
+  descriptions. Note that the search/filter is case-sensitive. If <Enter> is
+  pressed, no filter is applied.
+
+- Change to Makefile.mac to use standard libncurses rather than a 3rd-party
+  version; should help with cgdisk compatibility.
+
+- Minor bug fix in alignment of internal data structures.
+
+- Minor bug fix in handling of damaged disks. Also, GPT fdisk now reports
+  more information on what data structures are damaged when a damaged disk
+  is detected.
+
+- Added type code for Apple APFS (7C3457EF-0000-11AA-AA11-00306543ECAC,
+  0xaf0a).
+
+- Added type code for Atari TOS basic data (0xa200,
+  734E5AFE-F61A-11E6-BC64-92361F002671).
+
+- Added type codes for Linux dm-crypt (0x8308,
+  7FFEC5C9-2D00-49B7-8941-3EA10A5586B7) and LUKS (0x8309,
+  CA7D7CCB-63ED-4C53-861C-1742536059CC) partitions.
+
+- Added 18 Ceph partition type codes.
+
+- Added 52 (yes, 52!) Android partition type codes.
+
+- Changed "Creating new GPT entries" message to read "Creating new
+  GPT entries in memory" because the latter is clearer, particularly when
+  using sgdisk with a non-destructive option, like "-p".
+
+1.0.3 (7/27/2017):
+------------------
+
+- Fixed a major bug that caused invalid partition tables to be generated
+  when creating a new partition table (that is, partitioning a blank disk or
+  converting from MBR).
+
+1.0.2 (7/26/2017):
+------------------
+
+- On Linux, the p/-p/--print command now shows the disk's model name, as
+  reported in /sys/block/sda/device/model (or equivalent filenames for other
+  disks). This feature does not yet work on other platforms, on which the
+  model name line is omitted from the output. This line is also not shown
+  when accessing disk image files, even on Linux.
+
+- GPT fdisk can now report both the physical and logical sector sizes of
+  disks, but only on 2.6.32 and later Linux kernels. The verify feature now
+  uses the larger of the set alignment and physical/logical block sizes for
+  testing alignment, and setting alignment to something other than an exact
+  multiple of the ratio of the physical to logical block size results in a
+  warning.
+
+- Addition of new verification checks, mostly (but not exclusively) related
+  to the new j/-j/--move-main-table option.
+
+- Added new option: 'j' on the experts' menu in gdisk;
+  '-j/--move-main-table={sector}' in sgdisk. This option enables relocating
+  the main partition table from sector 2 (the default location) to somewhere
+  else on the disk. The main reason I know of to do this is if the disk is
+  to be used with a system-on-chip (SoC) computer, some of which require the
+  boot loader to be located at sector 2. If you pass this option the default
+  value of 2, it has the effect of reducing the padding placed between the
+  main partition table and the first usable sector value created by the
+  Linux fdisk tool.
+
+- Updated man pages with new recommendations for ESP and BIOS Boot Partition
+  sizes.
+
+- Added four type codes (AF06 through AF09) for Apple SoftRAID (Status,
+  Scratch, Volume, and Cache).
+
+- Added two type codes for the Open Network Install Environment (ONIE):
+  0xe100 (7412F7D5-A156-4B13-81DC-867174929325) and 0xe101
+  (D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149).
+
+- Added thirteen type codes for Android partitions (0xa000 through
+  0xa00c).
+
+- Added type code for QNX6 (aka QNX Power-Safe) filesystem: 0xb300, for
+  CEF5A9AD-73BC-4601-89F3-CDEEEEE321A1.
+
+- Removed stray debug message ("REALLY setting name!") from sgdisk,
+  when setting new name via -c option.
+
+1.0.1 (10/18/2015):
+-------------------
+
+- Created uninstall-fixparts and uninstall-gdisk scripts for OS X. As the
+  names imply, these scripts remove the files installed by the fixparts and
+  gdisk packages, respectively.
+
+- Fixed bug that caused -N/--largest-new option to sgdisk to fail when
+  fed a "0" option.
+
+- Fixed bug that caused input glitches in EFI version of gdisk.
+
+- Fixed bug that caused sgdisk to not return an appropriate error code
+  when it encountered a write error when saving changes.
+
+- Fixed bug that caused cgdisk's "Info" display to under-report the
+  partition's size by one sector.
+
+- OS X 10.11 includes new security features that prevent GPT fdisk from
+  working unless these features are disabled. To do so, you must boot to a
+  Recovery HD system, open a Terminal, type "csrutil disable", and reboot
+  into the normal system. You can re-enable the security features by
+  repeating the process, but specify "enable" rather than "disable". I've
+  added a message pointing users to a Web page explaining how to disable
+  this feature when gdisk detects that it can't write to the disk under OS
+  X. If you know of a way around this (including code changes to gdisk),
+  please contact me.
+
+- I've updated the OS X installation location from the Unix-standard
+  /usr/sbin (and related locations for documentation) to /usr/local/bin
+  (and related locations for documentation). This is Just Plain Crazy from
+  a Unix point of view, but Apple has to be Apple and do things just a
+  little bit differently.
+
+- I've updated my OS X environment to OS X 10.11 and LLVM 7.0.0. This has
+  also meant installing fresh versions of popt and ncurses from MacPorts,
+  which may require upgrading popt to get sgdisk working on some systems.
+  (gdisk, cgdisk, and fixparts should continue to work normally on all
+  systems.) The OS X binaries are now "fat" (32- and 64-bit) versions,
+  which should have no noticeable effect unless you have a Mac with broken
+  32-bit support, in which case the binaries will now work.
+
+- Changed the default name of 0xab00 partitions from "Apple boot" to
+  "Recovery HD", since the latter is the name that Apple gives these
+  partitions. Also, I discovered through painful experience that OS X
+  flakes out and won't boot if the name is something other than "Recovery
+  HD", so it really has to have the right name!
+
+- Changed the OpenBSD type codes (0xa600 and 0xa601): 0xa600 is now
+  824CC7A0-36A8-11E3-890A-952519AD3F61 (OpenBSD disklabel) and 0xa601 is
+  now gone. Previously, 0xa600 was 516E7CB4-6ECF-11D6-8FF8-00022D09712B, a
+  duplicate of the FreeBSD disklabel, and 0xa601 was
+  824CC7A0-36A8-11E3-890A-952519AD3F61. OpenBSD is now officially
+  supporting 824CC7A0-36A8-11E3-890A-952519AD3F61 as a disklabel type,
+  though. It's unclear what, if anything, OpenBSD will use for
+  non-disklabel type codes at the moment.
+
+- Added GUID 0311FC50-01CA-4725-AD77-9ADBB20ACE98 (0xbc00) for
+  Acronis Secure Zone backup partitions.
+
+- Fixed bug that caused random crashes on ppc64el systems (and perhaps
+  others).
+
+- Added GUID C91818F9-8025-47AF-89D2-F030D7000C2C (0x3900) for Plan 9.
+
+- Added GUID 69DAD710-2CE4-4E3C-B16C-21A1D49ABED3 (0x8307) for 32-bit ARM
+  Linux root (/) partition, as per the Freedesktop.org Discoverable
+  Partition Spec
+  (http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/).
+
+- Edited man pages to clarify that default alignment is to 1MiB boundaries;
+  this translates to 2048 sectors on disks with 512-byte sectors, but it
+  will be something else on disks with other sector sizes.
+
+- Changed behavior of -z/--zap and -Z/--zap-all options to sgdisk so that
+  if a subsequent command causes changes, they'll be written to disk.
+  Previously, doing something like "sgdisk --zap-all --clear /dev/sdd"
+  would wipe the disk but not create a partition table; to create a blank
+  table you'd need to do "sgdisk --zap-all --clear --mbrtogpt /dev/sdd",
+  which is a bit odd and counter-intuitive, to the point of arguably being
+  a bug.
+
+1.0.0 (3/16/2015):
+------------------
+
+- I'm now building a binary package of gdisk_x64.efi, using the UEFI GPT
+  fdisk package.
+
+- Added partition type for OpenBSD data
+  (824CC7A0-36A8-11E3-890A-952519AD3F61/0xa601). Also mapped 0xa600 to the
+  FreeBSD disklabel type code (516E7CB4-6ECF-11D6-8FF8-00022D09712B). I'm
+  not sure that's 100% correct, but since I can't find references to an
+  OpenBSD disklabel GPT type code, it seems the best choice at the moment.
+
+- Added partition type for Windows Storage Spaces
+  (E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D/0x4202)
+
+- Added -O/--print-mbr option to sgdisk, enabling easier display of MBR
+  data structures without invoking gdisk.
+
+- Updated warning message: "EBR describes a logical partition" now reads
+  "EBR points to an EBR," which is more technically correct.
+
+- Altered warning displayed when run from Windows on non-GPT disk, because
+  Windows on UEFI-based systems is becoming more common.
+
+- Fixed spurious "1" return value in gdisk.
+
+- Small code changes to support compilation as EFI application with the
+  UEFI GPT fdisk library
+  (http://sourceforge.net/projects/uefigptfdisk/?source=directory)
+
+- Added new partition type codes for Ceph
+  (https://github.com/ceph/ceph/blob/9bcc42a3e6b08521694b5c0228b2c6ed7b3d312e/src/ceph-disk#L76-L81):
+  4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D/0xf800 (Ceph OSD),
+  4FBD7E29-9D25-41B8-AFD0-5EC00CEFF05D/0xf801 (Ceph dm-crypt OSD),
+  45B0969E-9B03-4F30-B4C6-B4B80CEFF106/0xf802 (Ceph journal),
+  45B0969E-9B03-4F30-B4C6-5EC00CEFF106/0xf803 (Ceph dm-crypt journal),
+  89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE/0xf804 (Ceph disk in creation), and
+  89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE/0xf805 (Ceph dm-crypt disk in
+  creation)
+
+- Added new partition type codes from
+  http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/:
+  44479540-F297-41B2-9AF7-D131D5F0458A/0x8303 (Linux / on x86),
+  4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709/0x8304 (Linux / on x86-64),
+  B921B045-1DF0-41C3-AF44-4C6F280D3FAE/0x8305 (Linux / on 64-bit ARM),
+  3B8F8425-20E0-4F3B-907F-1A25A76F98E8/0x8306 (Linux /srv).
+
+0.8.10 (3/2/2014):
+------------------
+
+- Added feature to sgdisk's -A/--attributes, -c/--change-name,
+  -t/--typecode, and -u/--partition-guid commands: If a -n/--new option
+  with "0" as the partition number precedes these options on the command
+  line, passin "0" as the partition number to the following options causes
+  them to use the newly-created partition. For instance, "sgdisk -n
+  0:0:+550M -t 0:EF00 /dev/sda" creates a new partition with a type code of
+  EF00. (Previous versions would ignore the "-t 0:EF00" option.)
+
+- Fixed bug that caused incorrect partition number to be displayed by
+  sgdisk in error messages when the user specified a non-existent partition
+  for inclusion in a hybrid MBR or conversion to a conventional MBR.
+
+- Fixed new (in 0.8.9) bug that caused a failure to create more than one
+  hybridized partition when creating a hybrid MBR.
+
+- Fixed bug that caused gdisk and sgdisk to create hybridized partitions
+  that ended at or above the 2^32 sector point with incorrect end values.
+  The behavior now varies between gdisk and sgdisk: gdisk now creates
+  hybrid partitions that begin below 2^32 sectors and that are smaller than
+  2^32 sectors, since this is technically legal; but gdisk displays a
+  warning, because some OSes (such as DOS, Windows XP, OS/2, and BeOS)
+  misbehave with such partitions. AFAIK, only Linux, FreeBSD, and Windows 7
+  work properly with such partitions. Because of this fact and because
+  sgdisk is a more automated tool, it's stricter in how it handles things:
+  It refuses to create a hybrid partition if the original ends at or above
+  the 2^32 sector mark.
+
+0.8.9 (2/17/2014):
+------------------
+
+- Removed dependency on libicu for UTF-16 support.
+
+- Fixed spurious "0xEE partition doesn't start on sector 1" warning in
+  FixParts (and perhaps in other programs under some circumstances).
+
+- Added GPT regeneration command to GPT-destruction options ('z' in gdisk,
+  -z and -Z options to sgdisk). This is done to avoid wiping out data
+  mid-disk that might not be backup GPT data structures, which could
+  otherwise occur if a RAID array was resized in certain ways.
+
+- Added check for an oversized 0xEE protective partition. The program now
+  auto-repairs this condition on loading if the GPT data seem otherwise
+  valid. This is done because I've been receiving reports of some disks
+  (possibly from some OEM Windows 8 loads) that violate the GPT spec in
+  this way, and gdisk was reporting write errors when saving data.
+
+- If the GPT data seem to be damaged in some way or if the disk seems to
+  be a hybrid MBR and if the MBR partition(s) don't fit on the disk, the
+  verify (v) function now warns of this condition, and writing the disk if
+  it exists also displays a more specific error message about the problem.
+
+- Added new type codes (3000, 7412F7D5-A156-4B13-81DC-867174929325 and
+  3001, D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149) for Open Network Install
+  Environment (ONIE) boot and config partitions, respectively.
+
+- Added new type ccde (ED01, BFBFAFE7-A34F-448A-9A5B-6213EB736C22), for
+  Lenovo's ESP-like partition.
+
+0.8.8 (10/14/2013):
+-------------------
+
+- Fixed bug that could cause segfault when passing an invalid partition
+  number to sgdisk's -i/--info command.
+
+- Added new type code: 933AC7E1-2EB4-4F13-B844-0E14E2AEF915, or gdisk code
+  8302, for Linux /home partitions. This type code is used by recent
+  versions of systemd to permit /home to be auto-mounted; see
+  http://www.freedesktop.org/software/systemd/man/systemd-gpt-auto-generator.html
+  for details.
+
+- Added new type code: 9E1A2D38-C612-4316-AA26-8B49521E5A8B, or gdisk code
+  4100, for PowerPC PReP (PowerPC reference platform) boot.
+
+- The number of partition type codes has grown large enough that it fills
+  an 80x24 display. I've therefore added a pause (with a prompt to hit
+  <Enter>) to display more items after showing 21 lines in gdisk or after
+  the screen has nearly filled with entries in cgdisk. There's no such
+  pause/prompt in sgdisk, though.
+
+- Fine-tuned verification ('v') check for 0xEE partition that doesn't begin
+  on sector 1: Previously, a disk with multiple 0xEE partitions would
+  always trigger this warning. Now, the warning occurs only if NONE of the
+  0xEE partitions begins on sector 1.
+
+- Fixed hybrid MBR creation on disks larger than 2TiB: Previously, if one
+  opted to create an extra partition to cover unused space following
+  hybridized partitions, gdisk would hang.
+
+- Added check for an active/bootable 0xEE protective partition to the
+  verify ('v') function. If found, this is not counted as an error, but
+  it is called out to the user, since it can cause some EFIs (such as
+  VirtualBox's EFI) to ignore the disk.
+
+0.8.7 (7/8/2013):
+-----------------
+
+- Modified Mac version so that it can work on /dev/rdisk* devices as well
+  as /dev/disk* devices. The result is that, when using the /dev/rdisk*
+  devices, the partition table can sometimes be re-read without removing
+  the disk or rebooting.
+
+- Added "-a" option to cgdisk to use a ">" symbol to the left of the
+  selected partition rather than ncurses highlighting.
+
+- Modified "converting MBR to GPT" message to clarify that the conversion
+  is being held in memory, since some people have mistakenly assumed that a
+  "gdisk -l" operation will change an MBR disk to a GPT disk without
+  prompting.
+
+- Added partition type code for freedesktop.org's proposed $BOOT partition
+  (bc13c2ff-59e6-4262-a352-b275fd6f7172; GPT fdisk type code EA00)
+
+- Adjusted alignment code when using -n or -N in sgdisk to keep the
+  requested partition size (if specified using +###{MGT} terminology)
+  as the requested value rather than relative to the requested start
+  point. This gives you the requested partition size rather than be
+  slightly smaller if sgdisk needs to adjust the start point up a bit and
+  it prevents gaps from appearing between partitions if several are created
+  in succession using automatic placement of the start point.
+
+- Fixed small bugs in gdisk_test.sh script.
+
+- Removed stray debug message that would appear when reading MBR disks.
+
+- Added partition type code for Intel Rapid Start partition (GUID
+  D3BFE2DE-3DAF-11DF-BA40-E3A556D89593, code 8400), used by systems that
+  implement Intel's Rapid Start technology. See
+  http://blog.adios.tw/2012/10/funtoo-linux-and-intel-rapid-start.html or
+  http://mjg59.dreamwidth.org/26022.html.
+
+- Added partition type code for Haiku BFS (GUID
+  42465331-3BA3-10F1-802A-4861696B7521; code EB00).
+
+0.8.6 (1/9/2013):
+-----------------
+
+- Fixed a bug that could cause sgdisk to crash when passing a partition
+  number of 0 to the -t option.
+
+- Added support for building under Solaris.
+
+- Added a new check to the verification code.
+
+- Added partition type code for Sony system partition
+  (F4019732-066E-4E12-8273-346C5641494F). I'm not entirely clear what this
+  is used for, but it's appearing on some new Sony computers.
+
+- Tweaked hybrid MBR creation options to fix a problem that caused the main
+  0xEE MBR partition to NOT be created if the user told gdisk to NOT place
+  it at the start of the disk AND IF fewer than three partitions are
+  hybridize AND IF the user opted to create a second protective partition.
+
+- Changed default build options for Mac OS X to *NOT* use libicu,
+  since it seems to have broken somewhere along the line. It still
+  works on Linux, though.
+
+- Added partition type codes for VMWare ESX (FB00, FB01, and FC00).
+
+0.8.5 (5/30/2012):
+------------------
+
+- Changed code that writes the partition table so that a disk sync
+  operation occurs even if one or more write operations failed (but not if
+  they all failed). This is intended to work around a bug that a user
+  reported on a Windows system on which the write of the protective MBR
+  failed, although everything else worked. (I suspect anti-virus software
+  may have been blocking write access to the MBR.)
+
+- Added type codes for Midnight BSD (0xA580 - 0xA585). I used these codes
+  because Midnight BSD uses the same 0xA5 type code as FreeBSD on MBR
+  disks, so I'm starting Midnight BSD's numbering halfway through the
+  0xA5## range.
+
+0.8.4 (3/25/2012):
+------------------
+
+- REALLY fixed Ctrl+D problems! Now gdisk terminates upon receiving a
+  Ctrl+D. In all previous versions, it could lock itself into a CPU-hogging
+  loop if launched via "sudo" from a terminal window that was then closed
+  or if Ctrl+D was pressed at certain input prompts (for a partition name
+  or sector number, for instance).
+
+0.8.3 (3/23/2012):
+------------------
+
+- Fixed compilation problem on GCC 4.7.
+
+- Improved handling of Ctrl+D on some systems.
+
+- Added disk's name to message stating that a disk write was successful.
+
+- Fixed bug that caused creation of >2TiB partitions on 32-bit systems to
+  be truncated in sgdisk.
+
+0.8.2 (1/22/2012):
+------------------
+
+- Adjusted the code to support a number of partitions that's not a multiple
+  of the number of partition table entries that fits in a sector (normally
+  4 per sector). The program still rounds up, when necessary, when resizing
+  the partition table manually, but not when loading a partition table that
+  contains a peculiar number of partitions. This helps prevent spurious
+  error messages about CRC problems when loading some Solaris partition
+  tables.
+
+- Fixed bugs relating to the handling of empty partitions; Solaris's ZFS
+  tools create weird empty partitions that are legal but that gdisk wasn't
+  handling properly. (Specifically, they sometimes have non-zero end
+  points; gdisk assumed empty partitions had end points of 0.)
+
+- Fixed a bug that caused an infinite loop of input prompts if the user
+  pressed Ctrl+D.
+
+- Changed gdisk's first-sector input operation to specify a sector number
+  that's properly aligned as the default value. This eliminates the need
+  to alter that value and notify the user of the change when the user
+  hits "Enter" for the default value as the first partition on an empty
+  disk (as well as in some other situations).
+
+0.8.1 (10/1/2011):
+------------------
+
+- Fixed bug that could cause FixParts to keep a partition's assignment
+  as logical when FixPart could not actually do so. This could happen
+  when there are no gaps between two logical partitions. Some partitioning
+  tools can create such configurations, but FixParts can't. Such
+  configurations are extremely rare. I've only encountered them when
+  logical partitions are out of order.
+
+- Added code to detect infinite loops of logical partitions when reading
+  MBR data. When detected, the program now stops reading after the first
+  loop, so no duplicates appear in the partition list.
+
+- Fixed bug in partition overlap detection in MBR code.
+
+- Changed GPT reading code to use the size encoded in GPT headers to
+  determine how much of the header to use in computing a CRC, with the
+  restriction that the size be equal to or less than the disk's sector
+  size. This should work around problems with libefi in ZFS, which sets the
+  header size to 512 rather than the more common 92. A caveat: If the
+  disk's sector size is larger than the GPTHeader data structure size (512
+  bytes), then the rest of the sector's contents are ignored and replaced
+  with 0 values. This could produce false positives on CRC checks on disks
+  with over-512-byte sector sizes if the header sector is padded with
+  something other than 0 values.
+
+- Fixed bug in new (as of 0.8.0) check that main and backup partition
+  tables are identical on big-endian (PowerPC, etc.) hardware.
+
+0.8.0 (9/10/2011):
+------------------
+
+- Added new return option for sgdisk: 8, which means that a replication
+  operation (-R or --replicate) failed. Note that other operations on
+  the same command line might still have succeeded.
+
+- Added gdisk_test.sh shell script, contributed by Guillaume Delacour.
+  This script tests some common gdisk and sgdisk operations to be sure
+  they're working correctly.
+
+- Enable sgdisk's -l (--load-backup) and -o (--clear) options to work
+  even on disks that are damaged. Most other options will still be ignored,
+  though, so if you suspect a disk may be bad and want to use one of these
+  options, you should do so on a line by itself, followed by a separate
+  command to perform other actions (such as adding new partitions).
+
+- Added check for mis-matched primary and backup partition tables.
+  A mismatch is reported as a CRC error.
+
+- Added Apple Core Storage partition type code (hex code AF05, GUID
+  53746F72-6167-11AA-AA11-00306543ECAC).
+
+- Added cgdisk program to the family. This program is a rough workalike
+  to cfdisk, much as gdisk is a rough workalike to fdisk. See the cgdisk
+  man page or http://www.rodsbooks.com/gdisk/cgdisk-walkthrough.html for
+  details about its operation.
+
+- Fixed bug that caused CHS end point for protective MBR to be set to
+  0xfeffff rather than the spec-mandated 0xffffff on disks over ~8GB. This
+  is a very minor bug, since not much cares about this, and most other GPT
+  tools get it wrong in the same way, too.
+
+0.7.2 (6/26/2011):
+------------------
+
+- The Windows version now (finally!) generates proper GUIDs rather than a
+  purely random number. This fixes a bug that caused Windows 7 to crash
+  when converting a disk from MBR format (but, oddly, not when creating a
+  fresh partition table or doing various other things).
+
+- Added a warning when an MBR partition is discarded because it's too
+  big for the disk.
+
+- Changed warning to Windows users about the dangers of converting to GPT
+  so that it appears only on disks that aren't already in GPT form.
+
+- Fixed bug that caused bogus "3" values to pad the ends of partition names
+  on some disks (particularly those created by Microsoft's disk
+  partitioning tools).
+
+- Made compilation without Unicode support possible (see README file)
+
+- Made default filesystem type code OS-dependent (based on the compilation
+  platform).
+
+- Added new Linux-only filesystem partition type GUID code,
+  0FC63DAF-8483-4772-8E79-3D69D8477DE4 (8300 entry code). Also changed name
+  of the EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 (0700 entry code) to
+  "Microsoft basic data").
+
+- Fixed a bug that caused an incorrect code to be set for active/bootable
+  partitions when generating a hybrid MBR.
+
+- Enable entry of hex codes that begin with "0x" for both GPT and MBR
+  partitions.
+
+- Fixed bug that caused the boot loader code to be lost when creating a
+  hybrid MBR.
+
+- Fixed bug in sector input code that could produce improper values
+  if the user inputs ridiculously large "+" values.
+
+0.7.1 (3/21/2011):
+------------------
+
+- Added support for proper UTF-16LE partition names rather than the
+  "shortcut" that properly encoded only ASCII names. This support works
+  only in Linux, FreeBSD, and OS X, though, at least for the moment.
+  Although it's possible to compile this support into Windows when using
+  Visual C++, it doesn't seem to work properly. Since using this feature
+  would require distributing the ICU libraries with the Windows binary,
+  thus bloating the binary package's size to no effect, I've disabled it in
+  my standard Windows build, at least for now.
+
+- Added check to fixparts to keep it from operating on devices that
+  lack an existing MBR signature. (In 0.7.0, it could write an empty
+  MBR data structure to a device on which it was mistakenly launched.)
+
+- Fixed bug that caused the protective MBR to not be written when
+  restoring a backup of the GPT data.
+
+- Fixed bug that caused second protective MBR partition, when created
+  as part of a hybrid MBR, to always be of type 0xEE, even when the
+  user specified something else.
+
+- Integrated a number of code cleanups contributed by Florian Zumbiehl.
+
+0.7.0 (3/11/2011):
+------------------
+
+- Fixed bug that caused some types of logical partitions to be misread.
+
+- Created FixParts program, to fix problems on MBR-partitioned disks.
+  Although this program is part of the GPT fdisk family, it is NOT used on
+  GPT disks.
+
+- Completely redid the GPT-to-MBR code, used both for converting to MBR
+  form and for creating hybrid MBRs.
+
+- Fixed a bug that caused gdisk to "forget" some partitions if there were
+  numbering gaps when a conversion to MBR was aborted.
+
+- Improved CHS value creation on small (<~8GB) disks for protective MBR
+  and when creating hybrid MBRs or converting to MBR format. Linux-only,
+  for the moment; other platforms still produce bad CHS values on sub-~8GB
+  disks (but few OSes care these days).
+
+- Enhanced disk replication features ('u' on the experts' menu in gdisk; -R
+  or --replicate in sgdisk). It's now possible to replicate the partition
+  table from a larger to a smaller disk, so long as all the partitions fit
+  on the smaller disk. In sgdisk, the secondary GPT data are moved
+  automatically if disk sizes don't match. In gdisk, the secondary GPT data
+  are moved automatically if the target disk is smaller than the source
+  disk; if the target disk is larger than the source disk, the user is
+  given the option of making this adjustment.
+
+- Fixed --load-backup (-l) option to sgdisk, which was broken.
+
+- Changed largest drive that's not given a minimum 4 KiB alignment even
+  when smaller alignment is detected on the disk to 300 GB.
+
+- Fixed bug that prevented aborting a partition table backup ('u' on the
+  experts' menu) by hitting the Enter key for the device filename.
+
+- Implemented a number of code cleanups provided by Florian Zumbiehl.
+
+0.6.14 (1/8/2011):
+------------------
+
+- Made small change to the way the start sector is interpreted if you use a
+  "+" specification, as in "+2G" to locate a partition 2 GiB into the
+  default range. This change makes adjustments for sector alignment less
+  likely.
+
+- Modified sgdisk's -n (--new) option to work with relative start and end
+  values (which the man page incorrectly stated it already did). Values of
+  0 for the start and end sectors refer to the first and last available
+  sectors in the largest free block, and a partition number of 0 refers to
+  the first available partition.
+
+- Added ChromeOS GUID values to list of recognized partition type GUIDs.
+  7F00 = ChromeOS kernel, 7501 = ChromeOS root, 7502 = ChromeOS reserved.
+  Untested on actual ChromeOS system.
+
+- Tweaked APM detection to look for APM signature even if an MBR
+  signature has already been found. Helps in diagnosis of cases
+  in which an MBR has overwritten an APM disk.
+
+0.6.13 (10/12/2010):
+--------------------
+
+- Added notification about nonexistent partitions to hybrid MBR creation
+  in gdisk.
+
+- Fixed bug in GPT-to-MBR conversion that could sometimes enable creation
+  of an extended partition that overlaps a preceding partition.
+
+- Fixed bug in GPT-to-MBR conversion that prevented creation of an MBR
+  table with logical partitions if there were four or fewer partitions.
+
+0.6.12 (10/7/2010):
+-------------------
+
+- Adjusted alignment code to use 1 MiB alignment by default for drives with
+  other than 512-byte sector sizes. (Previous versions increased this --
+  for instance, to 4 MiB for drives with 2048-byte logical sector size.)
+
+- Entry of non-hexadecimal value for partition type code now causes
+  re-prompting for a new value, fixing a recently-introduced minor bug.
+
+- Fixed bug in sector entry using K/M/G/T/P suffixes on disks with
+  other-than-512-byte sector numbers.
+
+- Added "P" (PiB, pebibyte) suffix to suffixes accepted in entering
+  partition sizes.
+
+- Fixed bug that caused sgdisk to segfault if fed the (invalid)
+  "-A show" parameter. Now it terminates with a complaint about an invalid
+  partition number 0.
+
+- Removed warning when running on big-endian hardware, since this
+  support has been present for quite a while with no bug reports.
+
+0.6.11 (9/25/2010):
+-------------------
+
+- Added -F (--first-aligned-in-largest) option to sgdisk. This option is a
+  variant on -f (--first-in-largest); it returns the number of the first
+  sector that will be used in the largest free area, given the current
+  alignment value (set via -a/--set-alignment).
+
+- Streamlined GUID code entry in gdisk; it no longer offers the option
+  to enter GUIDs in separate segments.
+
+- The -t option to sgdisk now accepts GUID values as well as the
+  sgdisk/gdisk-specific two-byte hex codes.
+
+- Added check that the protective 0xEE MBR partition begins on sector 1
+  to the verify function. If it doesn't, a warning message is displayed,
+  but it doesn't count as an error.
+
+- Added check for overlapping MBR partitions to verify function (gdisk "v"
+  function on all menus; sgdisk -v/--verify function). Also warns about
+  multiple MBR 0xEE partitions (causes problems in some OSes).
+
+- Added check to GPT-to-MBR and hybrid MBR creation options to prevent
+  creation of disks with duplicate partitions. When told to create a disk
+  with duplicates, sgdisk now aborts with the error message "Problem
+  creating MBR!" When attempting to create a hybrid MBR with duplicates,
+  gdisk silently drops duplicate partitions, leaving fewer than requested.
+  Creating duplicates should not be possible in sgdisk when converting to
+  MBR form.
+
+0.6.10 (8/22/2010):
+-------------------
+
+- Enable disk-wipe (-z and -Z) and verification (-v) operations in
+  sgdisk even if the disk is badly damaged.
+
+- Added support for setting attributes in sgdisk (-A/--attributes option)
+  in sgdisk.
+
+- Fixed bug that created backwards attribute field values (bit #2 was
+  entered as bit #61, etc.).
+
+- Fixed bug that caused creation of hybrid MBR to wipe out the MBR's boot
+  code.
+
+- Added ability to save partition table from one device to another (gdisk:
+  'u' on experts' menu; sgdisk: -R or --replicate option).
+
+- Fixed inaccessible -C/--recompute-chs option in sgdisk.
+
+0.6.9 (7/4/2010):
+------------------
+
+- Fixed minor error in sgdisk man page (--largest-new option requires
+  a partition number).
+
+- Fixed major bug in hybrid MBR creation, which caused incorrect
+  protective partition end point settings and occasionally other
+  problems.
+
+0.6.8 (5/23/2010):
+------------------
+
+- Added tests to see if the file to be opened is a directory, character
+  device, FIFO, or socket; program now terminates if any of these
+  conditions is met. (Linux/FreeBSD/OS X only.) Thanks to  Justin Maggard
+  for this patch.
+
+- Added 'f' option on gdisk's experts' menu (-G/--randomize-guids in
+  sgdisk). This option randomizes the disk's GUID and all partitions'
+  GUIDs. Intended for use after cloning a disk with a utility that copies
+  the GUIDs intact (such as a raw dd copy) if you want each disk copy to
+  have its own set of GUIDs.
+
+- Added -u/--partition-guid and -U/--disk-guid options to sgdisk. These are
+  the equivalents of the 'g' and 'c' options, respectively, on the gdisk
+  experts' menu: They enable adjusting an individual partition's GUID or a
+  disk's GUID. The GUID may be either a fully specified GUID value or 'R'
+  or 'r' to set a random GUID value.
+
+- Fixed compile problem for FreeBSD (its math library lacks a log2()
+  function). Also created separate Makefile.freebsd with a couple of
+  FreeBSD-specific options.
+
+- Added -N (--largest-new) command to sgdisk. This command creates a single
+  partition that fills the largest single unpartitioned block of space on
+  the disk.
+
+- Fixed sgdisk man page error: the --change-name option was incorrectly
+  listed as --change.
+
+- Added 'h' option to gdisk experts' menu (-C or --recompute-chs in sgdisk)
+  to recompute all protective/hybrid MBR CHS values. This option is
+  intended to work around a bug in at least one BIOS that prevents the
+  computer from booting when the GPT-mandated (but technically illegal)
+  0xFFFFFF CHS value is used as the end point for a protective MBR. The
+  recomputed values will be legal (e.g., 0xFEFFFF instead of 0xFFFFFF),
+  but incorrect in GPT terms, and will therefore enable at least one
+  BIOS to boot with a GPT disk. See http://www.rodsbooks.com/gdisk/bios.html
+  for all I know about BIOS/GPT incompatibilities.
+
+0.6.7 (5/1/2010):
+-----------------
+
+- Undid earlier change, with version 0.6.4, that wiped the MBR boot loader
+  when doing MBR-to-GPT conversions. I've now become skeptical that MBR
+  boot loaders were causing any real problems on GPT disks, so I'm going
+  back to the philosophy of leaving as much alone as possible.
+
+- Fixed bug that caused incorrect reporting of free space on 0-size disks
+  (e.g., files of 0 length passed as disk images).
+
+- Fixed bug that caused segfault on some invalid disks
+
+- Fixed bug that caused incorrect partition numbers to be displayed for
+  some verify problems.
+
+
+0.6.6 (3/21/2010):
+-----------------
+
+- Added support for the "no block IO protocol" (referred to as "hide from
+  EFI" in GPT fdisk) and "legacy BIOS bootable" attribute bits. See Table
+  19 of the UEFI 2.3 specification (p. 153) for details.
+
+- Changed the sequence in which GPT data structures are written to disk;
+  backups are now written first, followed by the main structures. This is
+  as recommended in the UEFI 2.3 specification, since it's safer in the
+  extremely unlikely event that a RAID array's size is increased and
+  there's a power outage mid-write. (If the main structures are written
+  first in this case, they'll point to data that's not yet been written;
+  but by writing the backups first, the old main structures will still
+  point to the valid old backup structures.)
+
+- Protective MBRs now have disk signatures of 0x00000000, to better
+  conform with GPT as described in the UEFI 2.3 specification.
+
+- Added alignment information to the summary data produced by the
+  'p' main-menu option in gdisk or the -p option to sgdisk.
+
+- More alignment changes: GPT fdisk now attempts to determine the alignment
+  value based on alignment of current partitions, if any are defined. If no
+  partitions are defined, a default value of 2048 is set. If the computed
+  value is less than 8 on drives over about 596GiB, it's reset to 8, since
+  the drive might be a WD Advanced Format unit that requires an 8-sector
+  (or larger power-of-2) alignment value for best performance. The
+  2048-sector default provides better alignment in some RAID
+  configurations.
+
+- Changed behavior when a backup restore fails. Previously, GPT fdisk
+  would create a fresh blank set of partitions. Now it does so only
+  if the failure occurs when interpreting the backup's contents; if the
+  user typed the wrong filename, the in-memory data structures aren't
+  touched.
+
+
+0.6.5 (3/7/2010):
+-----------------
+
+- Added tests to verify ('v') function and to pre-save checks to look for
+  partitions that end before they begin or that are too big for their
+  disks.
+
+- Fixed a bug that could cause spurious data to appear in a grown partition
+  table.
+
+- Added ability to convert some or all partitions to logical partitions in
+  GPT-to-MBR conversion. This feature is limited by the fact that at least
+  one free sector must exist immediately prior to each logical partition,
+  so it won't do much good if partitions are crammed together. It should be
+  possible to convert back to MBR any disk that started that way, provided
+  no partitions were added or resized when the disk was in GPT form; and
+  disks that were partitioned with Apple's Disk Utility or other tools that
+  insert unpartitioned space should also be convertible. CAUTION: THE
+  LOGICAL PARTITION CREATION FEATURE DOESN'T TRY TO ALIGN PARTITIONS OR
+  PARTITION HEADER DATA TO CYLINDER BOUNDARIES! It's conceivable that some
+  older OSes or utilities will object to these disks, although Linux, OS X,
+  Windows Vista, and Windows 7 all seem happy with them.
+
+- Fixed bug that caused creation of 0-length file if an incorrect device
+  filename was typed.
+
+- The gdisk program now prompts for a device filename if it's called with
+  no options. This enables gdisk to do something useful if it's launched by
+  double-clicking its icon in a GUI environment.
+
+- Added workaround for bug in some versions of MinGW that caused the
+  program to garble input sector numbers.
+
+- The Windows version now works on disks with over-512-byte sectors.
+  Tested on a magneto-optical (MO) drive with 2048-byte sectors.
+
+- Added -D (--display-alignment) option to sgdisk, to display sector
+  alignment value (by default, 1 for sub-800GiB disks and 8 for disks
+  over that size).
+
+- Fixed bug in computation of CHS geometries for protective MBR. This is
+  non-critical, since most modern utilities ignore the CHS geometries.
+  Concerned users can use the 'n' option on the experts' menu to build new
+  protective MBRs with the new algorithm, if desired. (Note that GNU
+  Parted, at least, gets this wrong, too.)
+
+- Fixed memory-allocation bug when reading GPT disks with partition tables
+  with over 128 entries; could cause program to crash on startup.
+
+0.6.4-2 (2/20/2010):
+--------------------
+
+Note: Neither of the following changes affects actual program code, so I've
+left the version number in the program at 0.6.4.
+
+- Altered Makefile to pass user's compiler and linker environment
+  variables through.
+
+- Added #include to gpttext.cc to enable it to compile on the latest
+  GCC versions (it was failing on at least some 4.4.x compilers).
+
+0.6.4 (2/19/2010):
+-------------------
+
+- Added -m (--gpttombr) option to sgdisk, enabling conversion of GPT
+  disks to MBR format, with a limit of four partitions total, and of course
+  without overcoming the 2TiB limit.
+
+- Added -h (--hybrid) option to sgdisk, enabling creation of hybrid
+  MBRs. Fewer options are available in sgdisk than in gdisk, though,
+  in order to keep the user interface manageable.
+
+- Fixed off-by-one bug in specification of partition when using the
+  -T (--transform-bsd) option in sgdisk.
+
+- Changed the code to create a new MBR unique disk signature whenever a new
+  protective MBR is generated (when doing an MBR-to-GPT conversion, when
+  using the 'n' option on the experts' menu, or when using the 'o' option
+  on the main menu, for example). Previous versions attempted to preserve
+  the existing MBR disk signature in most cases, but this resulted in
+  values of 0x00000000 whenever an empty disk was partitioned, and often in
+  other cases, too. Better to risk changing this value too often than to
+  leave multiple disks with 0x00000000 values, I think.
+
+- Added transpose ('t' on experts' menu in gdisk; or -r or --transpose in
+  sgdisk) command to enable fine-tuning partition order without doing a
+  full sort.
+
+- Added code to clear the MBR boot loader when doing an MBR-to-GPT
+  conversion. (This was already done in full-disk BSD-to-GPT conversions.)
+  This is done because I've seen a few problem reports that make me think
+  some MBR boot loaders freak out and hang the system when they encounter
+  GPT disks, and/or they attempt to load a second-stage boot loader stored
+  in what is now GPT territory, causing a system hang. Since MBR boot
+  loaders don't work on GPT disks anyhow (even GRUB needs to be
+  reinstalled), this new wiping behavior shouldn't cause any problems, and
+  may prevent a few.
+
+- Fixed bug in Windows version that prevented saving backup files.
+
+- Fixed bug that caused second and subsequent partition numbers in
+  prompts in hybrid MBR conversion procedure to be displayed in
+  hexadecimal.
+
+- Fixed very obscure potential bug in hybrid MBR/GPT synchronization when
+  deleting partitions; code wasn't matching partition lengths correctly,
+  which would only affect partitions that start at the same point but have
+  different lengths in MBR vs. GPT.
+
+- Fixed bug in the -E option to sgdisk; it was actually returning the
+  last free sector, not the last free sector in the largest free block.
+
+- Fixed bug in -t option to sgdisk; it was corrupting partition type
+  codes.
+
+- Fixed minor alignment bug in partition summary list ('p' from any menu)
+  when partition sizes are between 1000 and 1024 units.
+
+- Backup restore function ('l' on recovery & transformation menu) now
+  accepts both backups generated by GPT fdisk and backups created by a
+  direct copy (via dd, etc.) of the MBR, main GPT header, and main GPT
+  partition table, in that order. ("dd if=/dev/sda of=backup.gpt bs=512
+  count=34" will do this on Linux for a disk with a typical-sized GPT table
+  of 128 entries.)
+
+0.6.3 (2/3/2010):
+------------------
+
+- Fixed serious data corruption bug on big-endian (PowerPC and similar)
+  systems.
+
+- Changed several GPT fdisk Solaris type codes to correct a duplicate
+
+- Corrected error in GPT fdisk type codes for NetBSD LFS and NetBSD RAID;
+  they were identical, but I've now changed NetBSD RAID to A906, which
+  is unique.
+
+- Added GUID for IBM General Parallel File System (GPFS) partition type
+  code. Somewhat arbitrarily set it to use the 7501 number (MBR code 0x75
+  is used by IBM PC/IX, so it's at least the right company, by my loose
+  numbering rules....).
+
+- Improved GUID generation. Prior versions generated completely random
+  numbers for GUIDs. This works, but is technically a violation of the
+  spec. Unix versions now employ libuuid to generate GUIDs in a more
+  correct way. The Windows version still generates random numbers, though.
+
+- Turned PartTypes class into a derived class of GUIDData, and renamed
+  it to PartType.
+
+- Created new GUIDData class, to replace the original GUIDData struct.
+
+0.6.2 (1/29/2010):
+------------------
+
+- The change-type ('t' on main menu) option now changes the partition's
+  name *IF* the current name is the generic one for the partition type.
+  If the current name is not the generic name, it is NOT changed.
+
+- Fixed bug that caused new protective MBR to not be created when the
+  MBR was invalid and the GPT was damaged and the user opts to try to
+  use the GPT data.
+
+- Enabled default partition type code of 0700 when creating partitions
+  or changing their type codes. (Type 0700, Linux/Windows data, is set if
+  the user hits the Enter key alone.)
+
+- Fixed bug in sort ('s' on main menu) option that caused partition
+  numbers to begin at more than 1 if the original partition list had
+  too many empty partitions before the last one defined.
+
+- Improved code to determine which partition table to load in case of
+  CRC mismatches between the partition tables and the stored CRC values
+  in the headers.
+
+- Compiles using MinGW (http://www.mingw.org) to create a Windows binary.
+
+- Moved all disk I/O functions to the new DiskIO class. This helps with the
+  Windows port; it uses diskio-windows.cc for Windows-specific code,
+  diskio-unix.cc for the Linux, FreeBSD, and OS X code, and diskio.cc for
+  cross-platform disk I/O code.
+
+- Changed BSD disklabel detection code to be more correct (I think).
+  This change has no effect on my test disks, but I hope it'll work
+  better on disks with sector sizes other than 512 or 2048.
+
+0.6.1 (1/20/2010):
+------------------
+
+- Fixed bug that returned incorrect disk size on 32-bit versions of
+  FreeBSD.
+
+- Fixed bug that prevented FreeBSD version from working on disk image
+  files.
+
+- Fixed bug that caused BSD disklabel conversion to fail.
+
+0.6.0 (1/15/2010):
+------------------
+
+- Fixed bug that caused the convert to MBR function to fail.
+
+- Added support for disks with other than 512-byte sectors.
+
+- Created embryonic sgdisk program.
+
+- Fixed bug that caused relative sector numbers entered by users (e.g,
+  "+128M") to be misinterpreted as from the start of the range rather than
+  from the default value.
+
+0.5.3 (1/4/2010):
+-----------------
+
+- Fixed bug in display of GUIDs when compiled with some versions of GCC.
+
+- Eliminated warnings caused by additional checks in latest versions of
+  GCC. These warnings were harmless, but to eliminate them I've added
+  more error checking on disk I/O.
+
+- Eliminated unnecessary warnings about potential data loss if the program
+  was launched with the -l option or if writes aren't possible.
+
+- Added code to set the partition boundary value based on the physical
+  sector size. (FindAlignment() function.) This function, however, works
+  only on Linux, and then only if the BLKPBSZGET ioctl is defined. This
+  ioctl is new in kernel 2.6.32 or thereabouts.
+
+0.5.2 (12/31/2009):
+-------------------
+
+- Modified partition creation function to begin partitions on 8-sector
+  boundaries by default. This improves performance on the new Western
+  Digital Advanced Format drives. The new 'd' and 'l' options on the
+  experts' menu display and change, respectively, the boundary size.
+
+- Tweaked code to produce fewer warnings on the latest versions of
+  GCC.
+
+0.5.1:
+------
+
+- Made some minor edits to the man page.
+
+- Incorporated RPM .spec file changes contributed by Scott Collier
+  (boodle11@gmail.com).
+
+- Changed method of locating and loading backup GPT data, to use the
+  main header's pointer, if it's valid, rather than seeking to the
+  end of the disk.
+
+- Added 'e' option (relocate backup GPT data structures) to the experts'
+  menu.
+
+- Fixed bug that prevented recovery of partitions in case of partially
+  damaged GPT data (bad main and good backup or bad backup and good
+  main header, for instance).
+
+0.5.0:
+------
+
+- Added GPT-to-MBR conversion function. It's very limited, but potentially
+  useful in some cases.
+
+- Fixed bug that caused incorrect file sizes to be reported on 32-bit
+  Linux, thus causing problems when editing partition tables in disk images
+  or when loading GPT backup files.
+
+- Fixed bug that caused bogus CRC error reports when loading backup GPT
+  data.
+
+- Reorganized menus. There are now three: the main menu, the experts' menu,
+  and the recovery & transformation menu. The last of these has most of the
+  items that had been on the earlier versions' experts' menu.
+
+- Added ability to re-load the MBR and generate a fresh GPT from it. This
+  is normally identical to quitting and re-running the program, but it
+  could be handy if, say, the GPT partitions on a hybrid configuration are
+  badly messed up; this will enable using the hybridized partitions as the
+  starting point for a new GPT setup.
+
+- The program now generates CHS values for hybrid and GPT-to-MBR conversion
+  MBRs. For the moment, the assumption is the maximum number of heads and
+  sectors per track (255 and 63, respectively), although the bulk of the
+  code supports other values -- it'd just be awkward to enter the data in
+  the user interface.
+
+- Fixed minor display bug that caused number of sectors on the disk to be
+  shown as 0 on large disks when running 32-bit binaries.
+
+- Reverted 0.4.2's zap (destroy GPT) changes, since I don't want to wipe
+  out a valid MBR if the user created that MBR over an older GPT without
+  first properly wiping out the GPT, and the user now wants to wipe out
+  the GPT.
+
+- Reformatted and edited the man page. Aside from edits related to the
+  preceding program changes, I've altered the markup slightly and trimmed
+  much of the more tutorial information from the man page to better
+  conform to typical terse man page style.
+
+0.4.2:
+------
+
+- Code cleanup.
+
+- Fixed very small formatting bug in display of hex code when a match isn't
+  found when converting from an MBR/gdisk hex code to a GUID type code.
+
+- Added the ability to work on disk image files (raw files for virtual
+  machines, backup images, etc.). The program assumes that all such disk
+  image files have 512-byte sectors.
+
+- Added verification prompt to 'o' main-menu option to avoid accidental
+  erasures of all partitions.
+
+- The "destroy GPT data structures" option ('z' on the experts' menu) now
+  also destroys all EFI GPT (0xEE) partitions in the MBR.
+
+- Added an extra warning to the "destroy GPT data structures" option if an APM
+  or BSD disklabel was detected on the disk.
+
+- Added a buffer flush after destroying GPT data structures, to get the OS
+  to read the new (empty or MBR-only) partition table.
+
+- Fixed bug that allowed entry of nonexistent partition numbers when creating
+  a hybrid MBR.
+
+0.4.1:
+------
+
+- Code cleanup/re-organization
+
+- Partition creation function ('n' on main menu) now uses the start of the
+  largest available chunk of free space rather than the first available
+  sector as the default starting sector number. This should enable easier
+  partition creation if there are small bits of free space on the disk.
+
+- You can now specify the end point of a partition by using a minus sign,
+  in which case the end point is the default value minus the specified
+  size. For instance, "-200M" creates a partition that ends 200MiB before
+  the default end point.
+
+- You can now specify the start point of a partition by using a plus or
+  minus sign, in which case the start point is the specified distance from
+  the start (+) or end (-) of free space. This is exactly the same as the
+  new rules for entry of the end point, except that the default value is
+  set differently.
+
+- Deleting a partition now checks for a matching hybrid MBR partition, and
+  if one is found, it's deleted. Any empty space that then surrounds the
+  0xEE (EFI GPT) MBR partitions is then added to the nearby 0xEE partition.
+  If no non-0xEE partitions are left, a fresh protective MBR is generated.
+
+- Added hybrid MBR consistency check to the verify ('v') option and to
+  pre-write checks. If non-0xEE/non-0x00 MBR partitions without
+  corresponding GPT partitions are found, the user is warned. This finding
+  does NOT prevent writing the partition table, though.
+
+- Added non-destructive write test when opening the device file, in order
+  to detect the problem with FreeBSD being unable to write to disks with
+  mounted partitions (or other potential problems).
+
+0.4.0:
+------
+
+- Added support for BSD disklabels. The program can now convert disks that
+  use "raw" disklabels, with the caveat that the first partition will
+  almost certainly need to be deleted because it'll overlap the main GPT
+  header; and convert disklabels contained within a GPT (or a former MBR,
+  converted to GPT) partition. In the latter case, the 'b' main menu option
+  is used.
+
+- Added support for compiling on FreeBSD.
+
+- Fixed bug that could cause crashes or incomplete sorts when sorting
+  the partition table.
+
+- New partitions, including converted ones, now take on the name of the
+  partition type as a default name.
+
+- Reorganized some code; created a separate C++ class for GPT partitions
+  (GPTPart), which replaced a struct and enabled moving code from the
+  bloated GPTData class into GPTPart.
+
+- Fixed a bug that produced spurious warnings about unknown sector sizes
+  when loading a backup file.
+
+0.3.5:
+------
+
+Note: This version was not officially publicly released; I wanted to test
+the big-endian support while developing 0.4.0.
+
+- Tweaked the disk type identification code to warn users to re-sync their
+  hybrid MBRs when one is detected.
+
+- Tweaked MBR-reading code to ignore 0xEE (EFI GPT) partitions. This will
+  only have an effect on a poorly partitioned MBR disk that contains an
+  inappropriate EFI GPT partition, or when attempting to recover a
+  corrupted disk by using the hybrid MBR for data recovery.
+
+- Added big-endian (PowerPC, etc.) support!
+
+- Added code to identify and warn of the presence of an Apple Partition
+  Map (APM) on the disk.
+
+- Enabled MBR conversion code to handle multiple logical partitions.
+
+0.3.4:
+------
+
+- Fixed bug that enabled (possibly accidental) entry of MBR type codes of
+  0x00 in GPTData::MakeHybrid(). The fix also enables entry of default
+  type code by pressing the Enter key when prompted. Applied a similar
+  fix to the entry of the type code for the second protective partition,
+  if one is used.
+
+- Fixed a typo: "sectors" was spelled "sectprs" in one spot!
+
+- Fixed bug that caused default entry for end sector to be refused if an
+  initial value using a plus sign (e.g., "+20G") was also refused.
+
+0.3.3:
+------
+
+- Gave users control over the way MBR partitions are assigned to slots in a
+  hybrid MBR setup; the original method (putting the 0xEE partition after
+  the real partitions) works well for non-boot disks, but both GRUB and
+  GRUB2 become confused by this type of setup, so it needs changing.
+
+- Changed "blocks" to "sectors" in GPT and MBR table displays.
+
+- Added "Boot" column to MBR table display; shows an asterisk (*) when the
+  partition's status is bootable.
+
+0.3.2:
+------
+
+- Changed __DARWIN_UNIX03 to __APPLE__ as code to enable MacOS X support.
+
+- Added the ability to create a hybrid MBR ('h' on experts' menu). This was
+  motivated by my discovery that Windows 7 remains brain-dead when it comes
+  to the ability to boot from a GPT disk, at least on BIOS-based machines.
+
+- Added 'z' option to experts' menu, to destroy GPT data structures and
+  exit. The intent is to use this feature to enable subsequent partitioning
+  of the disk using fdisk or other GPT-unaware tools. (GNU Parted will wipe
+  the GPT data structures itself when you create a new MBR ["msdos
+  disklabel," in Parted parlance], so using Parted is another option.)
+
+- Slightly altered the effect of the 'o' command on the main menu. It now
+  blanks out the protective MBR, as well as the GPT data.
+
+0.3.1:
+------
+
+- Added Mac OS X support, provided as a patch by David Hubbard
+  (david.c.hubbard@gmail.com).
+
+- Fixed bug in disksize() function on Mac OS. (Possibly dependent on the
+  kernel and/or GCC version.) The disk size, of type uint64_t, was not
+  being passed correctly, so I reorganized the function to return it as
+  the function's return value rather than as a parameter. This seems to
+  work OK on my Mac OS test system and on both 32- and 64-bit Linux
+  systems.
+
+- Fixed off-by-one bug in GPTData::FindLastAvailable().
+
+- Fixed bug that caused display of options after a disk-write error.
+
+- Fixed several incorrect MacOS X partition type GUIDs, thanks to Yves
+  Blusseau (1otnwmz02@sneakemail.com).
+
+0.3.0:
+------
+
+- Changed version number to 0.3.0, reflecting the fact that I've received
+  no significant bug reports and so am elevating the program to "beta"
+  status. This change also entailed altering the warning the program
+  displays when saving partition table changes.
+
+- Fixed minor bug in CHS geometry of the protective MBR's type EE partition
+  (was producing 0x000200 as the start value, but should be 0x000100).
+  Should be a non-critical bug since the protective MBR partition
+  definition is only there to keep MBR-only disk utilities from messing
+  with the disk.
+
+- Added ability to enter GUIDs as single massive strings rather than in
+  chunks.
+
+0.2.2:
+------
+
+- Added #include directives required to compile the program using GCC
+  4.4.0.
+
+0.2.1:
+------
+
+- Fixed partition numbering problem in reports of partition overlaps in
+  verification function.
+
+- Fixed 1-sector partition size problem when creating new partitions
+  (partitions were 1 sector too big when using the +size option).
+
+- Changed BytesToSI() to display values in bytes without decimal points
+  (e.g., "512 bytes" rather than "512.0 bytes").
+
+- Added GPTData class member functions to retrieve GPT data structure
+  locations on disk; used in my internal-use-only GPT-wiping program.
+
+- Eliminated the "a reboot is recommended" notice after writing the
+  partition table.
+
+- Added notice after sorting the partition table to the effect that
+  editing /etc/fstab and/or the boot loader files may be required.
+
+- Fixed bug in MBR-reading function that caused 0x0f (Win95 LBA) and 0x85
+  (Linux extended) extended partitions to not be read.
+
+- Fixed bug in GetLastSector() (in support.cc) that would have prevented
+  correct user entry of over-32-bit sector numbers on 32-bit systems.
+
+- Made some changes/corrections to the partition type list in
+  parttypes.cc. Most of these were based on newly-discovered MBR type
+  codes for Apple (Mac OS X) filesystems.
+
+- General code cleanup (setting explicit casts, etc.)
+
+0.2.0:
+------
+
+- Initial semi-public release

+ 277 - 0
WinImager/fixparts-windows-1.0.6/README

@@ -0,0 +1,277 @@
+GPT fdisk (aka gdisk, cgdisk, and sgdisk) and FixParts
+by Roderick W. Smith, rodsmith@rodsbooks.com
+
+Introduction
+------------
+
+This package includes the source code for four related disk partitioning
+programs:
+
+- gdisk -- This program is modeled after Linux fdisk, but it operates on
+  GUID Partition Table (GPT) disks rather than the Master Boot Record (MBR)
+  disks that fdisk modifies. As such, gdisk is an interactive text-mode
+  tool for manipulating partitions, but it does nothing to the contents of
+  those partitions (usually filesystems, but sometimes swap space or other
+  data).
+
+- cgdisk -- This program is modeled after Linux cfdisk, but it operates on
+  GPT disks rather than the MBR disks that cfdisk modifies. As such, cgdisk
+  is a curses-based text-mode tool for manipulating partitions, which is to
+  say that it uses an interface that relies on arrow keys and a dynamic
+  display rather than the command letters and a scrolling display like
+  gdisk uses.
+
+- sgdisk -- This program is conceptually similar to the Linux sfdisk and
+  FreeBSD gpt programs, but its operational details differ. It enables
+  manipulation of GPT disks using command-line options, so it's suitable
+  for use in scripts or by experts to perform specific tasks that might
+  take several commands in gdisk to accomplish.
+
+- fixparts -- This program, unlike the preceding three, operates on MBR
+  disks. It's intended to fix certain problems that can be created by
+  various utilities. Specifically, it can fix mis-sized extended partitions
+  and primary partitions located in the middle of extended partitions. It
+  also enables changing primary vs. logical partition status (within limits
+  of what's legal in the MBR scheme) and making a few other minor changes.
+  It does NOT support creating new partitions; for that, you should use
+  fdisk, parted, or some other tool.
+
+More details about the abilities of these tools follows.
+
+All four programs rely on the same set of underlying code base; they differ
+only in their control interfaces (defined in gdisk.cc, cgdisk.cc,
+sgdisk.cc, and fixparts.cc, respectively) and in which support code they
+use.
+
+GPT fdisk (gdisk, cgdisk, and sgdisk) Details
+---------------------------------------------
+
+The gdisk program is intended as a (somewhat) fdisk-workalike program for
+GPT-partitioned disks, cgdisk is similarly a workalike for fdisk, and
+sgdisk provides most of gdisk's functionality in a more script-friendly
+program. Although libparted and programs that use it (GNU Parted, gparted,
+etc.) provide the ability to handle GPT disks, they have certain
+limitations that gdisk overcomes. Specific advantages of gdisk, cgdisk, and
+sgdisk include:
+
+* The ability to convert MBR-partitioned disks in-place to GPT format,
+  without losing data
+
+* The ability to convert BSD disklabels in-place to create GPT
+  partitions, without losing data
+
+* The ability to convert from GPT format to MBR format without data loss
+  (gdisk and sgdisk only)
+
+* More flexible specification of filesystem type code GUIDs, which
+  GNU Parted tends to corrupt
+
+* Clear identification of the number of unallocated sectors on a
+  disk
+
+* A user interface that's familiar to long-time users of Linux
+  fdisk and cfdisk (gdisk and cgdisk only)
+
+* The MBR boot loader code is left alone
+
+* The ability to create a hybrid MBR, which permits GPT-unaware OSes to
+  access up to three GPT partitions on the disk (gdisk and sgdisk only)
+
+Of course, GPT fdisk isn't without its limitations. Most notably, it lacks
+the filesystem awareness and filesystem-related features of GParted. You
+can't resize a partition's filesystem or create a partition with a
+filesystem already in place with gdisk, for instance. There's no GUI
+version of gdisk.
+
+The GPT fdisk package provides three program files: the interactive
+text-mode gdisk, the curses-based interactive cgdisk, and the
+command-line-driven sgdisk. The first two are intended for use in manually
+partitioning disks or changing partitioning details; sgdisk is intended for
+use in scripts to help automate tasks such as disk cloning or preparing
+multiple disks for Linux installation.
+
+FixParts Details
+----------------
+
+This program's creation was motivated by cries for help I've seen in online
+forums from users who have found their partition tables to be corrupted by
+various buggy partitioning tools. Although most OSes can handle the
+afflicted disks fine, libparted-based tools (GParted, parted, most Linux
+installers, etc.) tend to flake out when presented with these disks.
+Typically, the symptom is a disk that appears to hold no partitions;
+however, sometimes the libparted tool presents partitions other than those
+that the OS sees.
+
+I've observed four causes of these symptoms, three of which FixParts can
+correct:
+
+* Old GPT data -- If a disk is used as a GPT disk and then re-used as an
+  MBR disk, the GPT data may be incompletely erased. This happens if the
+  disk is repartitioned with fdisk or the Microsoft Windows installer, for
+  instance. (Tools based on libparted correctly remove the old GPT data
+  when converting from GPT to MBR format.) FixParts checks for this problem
+  when it starts and offers to correct it. If you opt to erase the GPT
+  data, this erasure occurs immediately, unlike other changes the program
+  makes.
+
+* Mis-sized extended partitions -- Some tools create an extended partition
+  that's too large, typically ending after the last sector of the disk.
+  FixParts automatically corrects this problem (if you use the 'w' option
+  to save the partition table).
+
+* Primary partitions inside an extended partition -- Some utilities create
+  or move primary partitions to within the range covered by the extended
+  partition. FixParts can usually correct this problem by turning the
+  primary partition into a logical partition or by changing one or more
+  other logical partitions into primaries. Such corrections aren't always
+  possible, though, at least not without deleting or resizing other
+  partitions.
+
+* Leftover RAID data -- If a disk is used in a RAID array and then re-used
+  as a non-RAID disk, some utilities can become confused and fail to see
+  the disk. FixParts can NOT correct this problem. You must destroy the old
+  RAID data, or possibly remove the dmraid package from the system, to fix
+  this problem.
+
+When run, FixParts presents an fdisk-like interface, enabling you to adjust
+partition types (primary, logical, or omitted), change type codes, change
+the bootable flag, and so on. Although you can delete a partition (by
+omitting it), you can't create new partitions with the program. If you're
+used to partitioning disks, particularly with Linux fdisk, two unusual
+features of FixParts require elaboration:
+
+* No extended partitions -- Internally, FixParts reads the partition table
+  and discards data on any extended partition(s) it finds. When you save
+  the partition table, the program generates a new extended partition. This
+  design means that the program automatically corrects many problems
+  related to the extended partition. It also means that you'll see no
+  evidence of extended partitions in the FixParts user interface, although
+  it keeps track of the requirements and prevents you from creating illegal
+  layouts, such as a primary between two logicals.
+
+* Partition numbering -- In most Linux tools, partitions 1-4 are primaries
+  and partitions 5 and up are logicals. Although a legal partition table
+  loaded into FixParts will initially conform to this convention, some
+  types of damaged table might not, and various changes you make can also
+  cause deviations. When FixParts writes the partition table, its numbering
+  will be altered to conform to the standard MBR conventions, but you
+  should use the explicit labeling of partitions as primary or logical
+  rather than the partition numbers to determine a partition's status.
+
+Installing
+----------
+
+To compile GPT fdisk, you must have appropriate development tools
+installed, most notably the GNU Compiler Collection (GCC) and its g++
+compiler for C++. I've also tested compilation with Clang, which seems to
+work; however, I've not done extensive testing of the resulting binaries,
+beyond checking a few basics. Under Windows, Microsoft Visual C++ 2008 can
+be used instead. In addition, note these requirements:
+
+* On Linux, FreeBSD, OS X, and Solaris, libuuid must be installed. This is
+  the standard for Linux and OS X, although you may need to install a
+  package called uuid-dev or something similar to get the headers. On
+  FreeBSD, the e2fsprogs-libuuid port must be installed.
+
+* The ICU library (http://site.icu-project.org), which provides support for
+  Unicode partition names, is optional on all platforms except Windows, on
+  which it's not supported. Using this library was required to get proper
+  UTF-16 partition name support in GPT fdisk versions prior to 0.8.9, but
+  as of that version it should not longer be required. Nonetheless, you can
+  use it if you're having problems with the new UTF-16 support. This
+  library is normally installed in Linux and OS X, but you may need to
+  install the development headers (libicu-dev or something similar in
+  Linux; or the libicu36-dev Fink package in OS X). To compile with ICU
+  support, you must modify the Makefile: Look for commented-out lines that
+  refer to USE_UTF16, -licuuc, -licudata, or -licucore. Uncomment them and
+  comment out the equivalents that lack these lines.
+
+* The cgdisk program requires the ncurses library and its development files
+  (headers). Most Linux distributions install ncurses by default, but you
+  may need to install a package called libncurses5-dev, ncurses-devel, or
+  something similar to obtain the header files. These files were installed
+  already on my Mac OS X development system; however, they may have been
+  installed as dependencies of other programs I've installed. If you're
+  having problems installing ncurses, you can compile gdisk and/or sgdisk
+  without cgdisk by specifying only the targets you want to compile to
+  make.
+
+* The sgdisk program requires the popt library and its development files
+  (headers). Most Linux distributions install popt by default, but you may
+  need to install a package called popt-dev, popt-devel, or something
+  similar to obtain the header files. Mac OS users can find a version of
+  popt for Mac OS from Darwin Ports (http://popt.darwinports.com), MacPorts
+  (https://trac.macports.org/browser/trunk/dports/devel/popt/Portfile), Fink
+  (http://www.finkproject.org), or brew (http://macappstore.org/popt/); 
+  however, you'll first need to install the relevant environment
+  (instructions exist on the relevant projects' pages). When I re-built my
+  Mac build environment in February of 2020, I found that brew was, by far,
+  the easiest of these to install. Some of the others seem to have been
+  abandoned, but I didn't investigate thoroughly. I'm leaving the references
+  in case they might be useful in the future. Instead of installing one of
+  These ports, you can compile gdisk and/or cgdisk alone, without sgdisk;
+  gdisk and cgdisk don't require popt.
+
+When all the necessary development tools and libraries are installed, you
+can uncompress the package and type "make" at the command prompt in the
+resulting directory. (You may need to type "make -f Makefile.mac" on Mac OS
+X, "make -f Makefile.freebsd" on FreeBSD, "make -f Makefile.solaris" on
+Solaris, or "make -f Makefile.mingw" to compile using MinGW for Windows.)
+You may also need to add header (include) directories or library
+directories by setting the CXXFLAGS environment variable or by editing the
+Makefile. The result should be program files called gdisk, cgdisk, sgdisk,
+and fixparts. Typing "make gdisk", "make cgdisk", "make sgdisk", or "make
+fixparts" will compile only the requested programs. You can use these
+programs in place or copy the files to a suitable directory, such as
+/usr/local/sbin. You can copy the man pages (gdisk.8, cgdisk.8, sgdisk.8,
+and fixparts.8) to /usr/local/man/man8 to make them available.
+
+Caveats
+-------
+
+THIS SOFTWARE IS BETA SOFTWARE! IF IT WIPES OUT YOUR HARD DISK OR EATS YOUR
+CAT, DON'T BLAME ME! To date, I've tested the software on several USB flash
+drives, physical hard disks, and virtual disks in the QEMU and VirtualBox
+environments. Many others have now used the software on their computers, as
+well. I believe all data-corruption bugs to be squashed, but I know full well
+that the odds of my missing something are high. This is particularly true for
+large (over-2TiB) drives; my only direct testing with such disks is with
+virtual QEMU and VirtualBox disks. I've received user reports of success with
+RAID arrays over 2TiB in size, though.
+
+My main development platform is a system running the 64-bit version of
+Ubuntu Linux. I've also tested on several other 32- and 64-bit Linux
+distributions, Intel-based Mac OS X 10.6 and several later versions, 64-bit
+FreeBSD 7.1, and Windows 7 and 10.
+
+Redistribution
+--------------
+
+This program is licensed under terms of the GNU GPL (see the file COPYING).
+
+Acknowledgements
+----------------
+
+This code is mostly my own; however, I've used three functions from two
+other GPLed programs:
+
+- The code used to generate CRCs is taken from the efone program by
+  Krzysztof Dabrowski and ElysiuM deeZine. (See the crc32.h and
+  crc32.cc source code files.)
+
+- A function to find the disk size is taken from Linux fdisk by A. V. Le
+  Blanc. This code has subsequently been heavily modified.
+
+Additional code contributors include:
+
+- Yves Blusseau (1otnwmz02@sneakemail.com)
+
+- David Hubbard (david.c.hubbard@gmail.com)
+
+- Justin Maggard (justin.maggard@netgear.com)
+
+- Dwight Schauer (dschauer@ti.com)
+
+- Florian Zumbiehl (florz@florz.de)
+
+- Guillaume Delacour (contributed the gdisk_test.sh script)

+ 136 - 0
WinImager/fixparts-windows-1.0.6/README.Windows

@@ -0,0 +1,136 @@
+GPT fdisk (aka gdisk) and FixParts
+
+by Roderick W. Smith, rodsmith@rodsbooks.com
+
+******************************** IMPORTANT ********************************
+Most versions of Windows cannot boot from a GPT disk on BIOS-based
+computers, and most varieties prior to Vista cannot read GPT disks. GPT
+fdisk is a partition editor for GPT disks, and it will *AUTOMATICALLY
+CONVERT* MBR disks to GPT form. Therefore, you should **NOT** use GPT fdisk
+on a Windows system unless you fully understand what you're doing or are
+certain that your computer boots in EFI/UEFI mode! If you accidentally use
+GPT fdisk on a BIOS-mode boot disk, or perhaps even on a data disk, you may
+find recovery to be very difficult! Pre-installed Windows 8 and later
+systems almost always use GPT disks and boot in EFI/UEFI mode, but
+self-installed Windows 8 systems sometimes use BIOS mode. This caveat does
+not apply to FixParts, though; that tool works only on MBR disks.
+***************************************************************************
+
+Read the main README file for general information on the program, and read
+the gdisk.html or fixparts.html documents (the Linux man pages converted to
+HTML format) for detailed use information. My GPT fdisk Web page,
+http://www.rodsbooks.com/gdisk/, provides a more tutorial introduction to
+the software. I originally wrote GPT fdisk on Linux, and some Linux- and
+Unix-centric language remains in the documentation.
+
+Windows Use Notes
+-----------------
+
+The Windows version of GPT fdisk was added with version 0.6.2 of the
+package. The Windows binary package includes the gdisk.exe interactive
+text-mode program file but no equivalent to the sgdisk program that's
+available with Linux, FreeBSD, and OS X builds. In theory, an sgdisk.exe
+for Windows could be built if the popt library were installed. I've not
+attempted to do this myself, though. If you care to try, check
+http://gnuwin32.sourceforge.net/packages/popt.htm for information on popt
+for Windows.
+
+Beginning with version 0.8.10, I'm distributing both 32-bit and 64-bit
+binaries, which include the strings "32" or "64" in their names. The 32-bit
+binaries work fine on most versions of Windows, but some 64-bit
+installations of Windows 8 lack 32-bit support libraries and so may need
+the 64-bit binaries.
+
+The FixParts program (fixparts32.exe and fixparts64.exe) is new with GPT
+fdisk 0.7.0. As described in the main README file, this program fixes
+certain partition table problems that can be created by buggy partitioning
+software. Windows seems to be unfazed by most such problems, but I've not
+done an extensive survey of Windows partitioning tools on this score.
+
+To install the programs, copy the gdisk32.exe and fixparts32.exe (or
+gdisk64.exe and fixparts64.exe) program files to any directory on your
+path, such as C:\Windows. Alternatively, you can change to the program's
+directory or type its complete path whenever you use it.
+
+To use the programs, first launch a Command Prompt as the Administrator. To
+do this, locate the Command Prompt program icon, right-click it, and select
+"Run as Administrator." If you use a non-Administrator Command Prompt, you
+won't be able to edit hard disk partition tables, although you will be able
+to edit raw disk image files.
+
+The program requires a hard disk identifier as an option. You can specify
+this in either of two forms. The first way is as a number followed by a
+colon, as in:
+
+gdisk 0:
+
+Disks are numbered starting from 0, so the preceding command launches gdisk
+on the first disk. The second way to specify a disk device is via a
+harder-to-remember name:
+
+gdisk32 \\.\physicaldrive0
+
+This command is equivalent to the earlier one -- it edits the partition
+table on the first physical disk. Change the number at the end of the
+device name to change the disk edited.
+
+If you pass the "-l" option to gdisk.exe in addition to the disk
+identifier, the program displays the current partition table information
+and then exits. This use entails no risk to MBR disks, since the program
+never writes data back to the disk when used in this way.
+
+As noted above, editing the first disk with GPT fdisk is usually a Bad
+Idea. An exception would be if your system uses an Extensible Firmware
+Interface (EFI) and already boots from a GPT disk. It's safer to edit
+non-boot disks, which usually have numbers of 1 and above, but only if you
+run a version of Windows with GPT support. For more information on Windows'
+support of GPT, see Microsoft's Web page on the topic:
+
+http://www.microsoft.com/whdc/device/storage/GPT_FAQ.mspx
+
+The Windows binaries I've compiled do not support Unicode UTF-16LE GPT
+partition names. This feature was added to version 0.7.1 of the software
+for Linux, FreeBSD, and OS X, and with changes to some #ifndef lines in the
+source files, it can be compiled for Windows; however, it seems to do
+little good in Windows because of Command Prompt window and/or ICU library
+limitations. Thus, I've omitted this support in the interests of
+simplifying the binary distribution, since including it would mean
+distributing the ICU libraries.
+
+Source Code and Compilation Issues
+----------------------------------
+
+I have successfully compiled GPT fdisk using three different Windows
+compilers:
+
+- MinGW (http://www.mingw.org), and in particular its Linux-hosted
+  cross-compiler -- Under Ubuntu Linux, the Makefile.mingw and
+  Makefile.mingw64 files enable compilation of the software via MinGW.
+  (Type "make -f Makefile.mingw" to compile 32-bit binaries, and "make -f
+  Makefile.mingw64" to compile 64-bit binaries.) If you try to compile
+  using another compiler or even using MinGW under Windows or another Linux
+  variety, you may need to adjust the Makefile.mingw options.
+
+- Microsoft Visual C++ 2008 Express
+  (http://www.microsoft.com/express/Windows/) -- This compiler requires a
+  third-party stdint.h file (I used the one from
+  http://msinttypes.googlecode.com/svn/trunk/stdint.h), but it otherwise
+  works fine. A project is easily created by adding all the *.h files and
+  all the *.cc files except diskio-unix.cc, sgdisk.cc, and whichever
+  program file you intend to NOT build (gdisk.cc or fixparts.cc).
+
+- Microsoft Visual C++ 2010 Express -- This compiler works much like the
+  2008 version, although I didn't need to add a third-party stdint.h file.
+
+The MinGW compiler produces much larger executables than do the MS
+compilers. The resulting binaries seem to work equally well, but my testing
+has been minimal.
+
+I've also attempted to compile the code with OpenWatcom 1.8, but this
+attempt failed, mostly because the compiler can't yet handle iostream
+output on standard C++ strings. OpenWatcom also seems to have incorrectly
+set the value of UINT32_MAX as if uint32_t values were 64-bit integers.
+This alone won't cause the compile to fail, but it would create bugs.
+
+If you modify GPT fdisk to get it to compile under another compiler, I
+welcome submission of patches.

BIN
WinImager/fixparts-windows-1.0.6/drive.txt


+ 370 - 0
WinImager/fixparts-windows-1.0.6/fixparts.html

@@ -0,0 +1,370 @@
+Content-type: text/html; charset=UTF-8
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML><HEAD><TITLE>Man page of FIXPARTS</TITLE>
+</HEAD><BODY>
+<H1>FIXPARTS</H1>
+Section: FixParts Manual (8)<BR>Updated: 1.0.6<BR><A HREF="#index">Index</A>
+<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
+
+<A NAME="lbAB">&nbsp;</A>
+<H2>NAME</H2>
+
+fixparts - MBR partition table repair utility
+<A NAME="lbAC">&nbsp;</A>
+<H2>SYNOPSIS</H2>
+
+<B>fixparts </B>
+
+<I>device</I>
+
+<P>
+<A NAME="lbAD">&nbsp;</A>
+<H2>DESCRIPTION</H2>
+
+<P>
+FixParts (aka <B>fixparts</B>) is a text-mode menu-driven program for
+repairing certain types of problems with Master Boot Record (MBR) partition
+tables. The program has three design goals, although a few additional
+features are supported, as well:
+<P>
+<DL COMPACT>
+<DT><B>*</B>
+
+<DD>
+It can remove stray GUID Partition Table (GPT) data, which can be left
+behind on a disk that was once used as a GPT disk but then incompletely
+converted to the more common (as of 2011) MBR form.
+<P>
+<DT><B>*</B>
+
+<DD>
+It can repair mis-sized extended partitions -- either partitions that
+extend beyond the physical end of the disk or that overlap with nearby
+primary partitions. FixParts is designed in such a way that this type of
+repair occurs automatically, so if it's the only problem with your disk,
+you can launch the program and then immediately save the partition table,
+making no manual changes, and the program will fix the problem.
+<P>
+<DT><B>*</B>
+
+<DD>
+You can change primary partitions into logical partitions or vice-versa,
+within constraints imposed by the MBR data structures.
+<P>
+</DL>
+<P>
+
+<P>
+Additional features include the ability to change partition type codes or
+boot/active flags, to delete partitions, and to recompute CHS values. With
+the possible exception of recomputing CHS values, these secondary features
+are better performed with <B>fdisk</B>, because <B>fixparts</B>' design means
+that it's likely to alter partition numbering even when such changes are
+not requested.
+<P>
+The <B>fixparts</B> program employs a user interface similar to that of
+Linux's <B>fdisk</B>, but <B>fixparts</B> is much more specialized. Most
+importantly, you can't create new partitions with <B>fixparts</B>, although
+you can change primary/logical assignment.
+<P>
+In the MBR scheme, partitions come in three varieties:
+<P>
+<DL COMPACT>
+<DT><B>primary</B>
+
+<DD>
+These partitions are defined in the first sector of the hard disk and
+are limited in number to four. Some OSes, such as Windows and FreeBSD, must
+boot from a primary partition.
+<P>
+<DT><B>extended</B>
+
+<DD>
+Extended partitions are specialized primary partitions. They serve as
+holding areas for logical partitions.
+<P>
+<DT><B>logical</B>
+
+<DD>
+A disk can contain an arbitrary number of logical partitions
+(<B>fixparts</B>, however, imposes a limit of 124 logical partitions). All
+the logical partitions reside inside a single extended partition, and are
+defined using a linked-list data structure. This fact means that every
+logical partition must be preceded by at least one sector of unallocated space
+to hold its defining data structure (an Extended Boot Record, or EBR).
+<P>
+</DL>
+<P>
+
+<P>
+These distinctions mean that primary and logical partitions cannot be
+arbitrarily interspersed. A disk can contain one to three primary
+partitions, a block of one or more logical partitions, and one to three
+more primary partitions (for a total of three primary partitions, not
+counting the extended partition). Primary partitions may not be sandwiched
+between logical partitions, since this would mean placing a primary
+partition within an extended partition (which is just a specific type of
+primary partition).
+<P>
+Unlike most disk utilities, <B>fixparts</B>' user interface ignores extended
+partitions. Internally, the program discards the information on the
+original extended partition and, when you tell it to save its changes, it
+generates a new extended partition to contain the then-defined logical
+partitions. This is done because most of the repairs and manipulations the
+tool performs require generating a fresh extended partition, so keeping the
+original in the user interface would only be a complication.
+<P>
+Another unusual feature of <B>fixparts</B>' user interface is that partition
+numbers do not necessarily correlate with primary/logical status. In most
+utilities, partitions 1-4 correspond to primary partitions, whereas
+partitions 5 and up are logical partitions. In <B>fixparts</B>, any partition
+number may be assigned primary or logical status, so long as the rules for
+layout described earlier are obeyed. When the partition table is saved,
+partitions will be assigned appropriately and then tools such as the Linux
+kernel and <B>fdisk</B> will give them conventional numbers.
+<P>
+When it first starts, <B>fixparts</B> performs a scan for GPT data. If the
+disk looks like a conventional GPT disk, <B>fixparts</B> refuses to run. If
+the disk appears to be a conventional MBR disk but GPT signatures are
+present in the GPT primary or secondary header areas, <B>fixparts</B>
+offers to delete this extraneous data. If you tell it to do so, the program
+immediately wipes the GPT header or headers. (If only one header was found,
+only that one header will be erased, to minimize the risk of damaging a
+boot loader or other data that might have overwritten just one of the GPT
+headers.)
+<P>
+With the exception of optionally erasing leftover GPT data when it first
+starts, <B>fixparts</B> keeps all changes in memory until the user writes
+changes with the <B>w</B> command. Thus, you can adjust your partitions in
+the user interface and abort those changes by typing <B>q</B> to quit
+without saving changes.
+<P>
+<A NAME="lbAE">&nbsp;</A>
+<H2>OPTIONS</H2>
+
+<P>
+The <B>fixparts</B> utility supports no command-line options, except for
+specification of the target device.
+<P>
+Most interactions with <B>fixparts</B> occur with its interactive text-mode
+menu. Specific functions are:
+<P>
+<DL COMPACT>
+<DT><B>a</B>
+
+<DD>
+Toggle the active/boot flag. This flag is required by some boot loaders and
+OSes.
+<P>
+<P>
+<DT><B>c</B>
+
+<DD>
+Recompute the cylinder/head/sector (CHS) values for all partitions. CHS
+addressing mode is largely obsolete, but some OSes and utilities complain
+if they don't like the CHS values. Note that <B>fixparts</B>' CHS values are
+likely to be incorrect on disks smaller than about 8 GiB except on Linux.
+<P>
+<DT><B>l</B>
+
+<DD>
+Change a partition's status to logical. This option will only work if the
+current partition layout supports such a change. Note that if changing a
+partition's status in this way is not currently possible, making some other
+change may make it possible. For instance, omitting a partition that
+precedes the target partition may enable converting a partition to logical
+form if there had been no free sectors between the two partitions.
+<P>
+<DT><B>o</B>
+
+<DD>
+Omit a partition. Once omitted, the partition will still appear in the
+<B>fixparts</B> partition list, but it will be flagged as omitted. You can
+subsequently convert it to primary or logical form with the <B>r</B> or
+<B>l</B> commands, respectively. When you save your changes with <B>w</B>,
+though, the partition will be lost.
+<P>
+<DT><B>p</B>
+
+<DD>
+Display basic partition summary data. This includes partition's number, the
+boot/active flag's status, starting and ending sector numbers,
+primary/logical/omitted status, whether or not the partition may be
+converted to logical form, and the partition's MBR types code.
+<P>
+<DT><B>q</B>
+
+<DD>
+Quit from the program <I>without saving your changes</I>.
+Use this option if you just wanted to view information or if you make a
+mistake and want to back out of all your changes.
+<P>
+<DT><B>r</B>
+
+<DD>
+Change a partition's status to primary. This option will only work if the
+current partition layout supports such a change. Note that every partition
+can theoretically become a primary partition, although in some
+configurations, making this change will require omitting some partitions.
+If <B>fixparts</B> refuses to allow changing a partition to primary, you may
+need to convert other partitions to logical form or omit them entirely.
+<P>
+<DT><B>s</B>
+
+<DD>
+Sort partition entries. This option orders partitions in the display to
+match their on-disk positions, which can make understanding the disk layout
+easier in some cases. This option has no effect on the ultimate ordering of
+logical partitions, which are sorted before being saved. The order of
+primary partitions in the final saved partition table may be affected by
+this option. In both cases, as already noted, the partition numbers
+displayed by <B>fixparts</B> may not be the same as those used by the kernel
+or displayed by other partitioning tools.
+<P>
+<DT><B>t</B>
+
+<DD>
+Change a partition's type code. You enter the type code using a one-byte
+hexadecimal number.
+<P>
+<DT><B>w</B>
+
+<DD>
+Write data. Use this command to save your changes and exit from the program.
+<P>
+<DT><B>?</B>
+
+<DD>
+Print the menu. Type this command (or any other unrecognized command) to
+see a summary of available options.
+<P>
+</DL>
+<P>
+
+<P>
+<A NAME="lbAF">&nbsp;</A>
+<H2>BUGS</H2>
+
+Known bugs and limitations include:
+<P>
+<DL COMPACT>
+<DT><B>*</B>
+
+<DD>
+The program compiles correctly only on Linux, FreeBSD, Mac OS X, and Windows.
+Linux versions for x86-64 (64-bit), x86 (32-bit), and PowerPC (32-bit) have been
+tested, with the x86-64 version having seen the most testing. Under FreeBSD,
+32-bit (x86) and 64-bit (x86-64) versions have been tested. Only 32-bit
+versions for Mac OS X and Windows have been tested.
+<P>
+<DT><B>*</B>
+
+<DD>
+The FreeBSD version of the program can't write changes to the partition
+table to a disk when existing partitions on that disk are mounted. (The
+same problem exists with many other FreeBSD utilities, such as
+<B>gpt</B>, <B>fdisk</B>, and <B>dd</B>.) This limitation can be overcome
+by typing <B>sysctl kern.geom.debugflags=16</B> at a shell prompt.
+<P>
+<DT><B>*</B>
+
+<DD>
+The program can load only up to 128 partitions (4 primary partitions and
+124 logical partitions). This limit can be raised by changing the
+<I>#define MAX_MBR_PARTS</I> line in the <I>basicmbr.h</I> source code file
+and recompiling.
+<P>
+<DT><B>*</B>
+
+<DD>
+The program can read partitions only if the disk has correct LBA partition
+descriptors. These descriptors should be present on any disk over 8 GiB in
+size or on smaller disks partitioned with any but very ancient software.
+<P>
+<DT><B>*</B>
+
+<DD>
+The program makes no effort to preserve partition numbers. This can have
+consequences for boot loaders and for mounting filesystems via
+<B>/etc/fstab</B>. It may be necessary to edit configuration files or even
+to re-install your boot loader.
+<P>
+<DT><B>*</B>
+
+<DD>
+<P>
+The program may change the order of partitions in the partition table.
+<P>
+</DL>
+<P>
+
+<P>
+<A NAME="lbAG">&nbsp;</A>
+<H2>AUTHORS</H2>
+
+Primary author: Roderick W. Smith (<A HREF="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</A>)
+<P>
+Contributors:
+<P>
+* Yves Blusseau (<A HREF="mailto:1otnwmz02@sneakemail.com">1otnwmz02@sneakemail.com</A>)
+<P>
+* David Hubbard (<A HREF="mailto:david.c.hubbard@gmail.com">david.c.hubbard@gmail.com</A>)
+<P>
+* Justin Maggard (<A HREF="mailto:justin.maggard@netgear.com">justin.maggard@netgear.com</A>)
+<P>
+* Dwight Schauer (<A HREF="mailto:dschauer@gmail.com">dschauer@gmail.com</A>)
+<P>
+* Florian Zumbiehl (<A HREF="mailto:florz@florz.de">florz@florz.de</A>)
+<P>
+<P>
+<A NAME="lbAH">&nbsp;</A>
+<H2>SEE ALSO</H2>
+
+<B><A HREF="/cgi-bin/man/man2html?8+cfdisk">cfdisk</A></B>(8),
+
+<B><A HREF="/cgi-bin/man/man2html?8+cgdisk">cgdisk</A></B>(8),
+
+<B><A HREF="/cgi-bin/man/man2html?8+fdisk">fdisk</A></B>(8),
+
+<B><A HREF="/cgi-bin/man/man2html?8+mkfs">mkfs</A></B>(8),
+
+<B><A HREF="/cgi-bin/man/man2html?8+parted">parted</A></B>(8),
+
+<B><A HREF="/cgi-bin/man/man2html?8+sfdisk">sfdisk</A></B>(8),
+
+<B><A HREF="/cgi-bin/man/man2html?8+gdisk">gdisk</A></B>(8),
+
+<B><A HREF="/cgi-bin/man/man2html?8+sgdisk">sgdisk</A></B>(8).
+
+<P>
+<I><A HREF="http://en.wikipedia.org/wiki/Master_boot_record">http://en.wikipedia.org/wiki/Master_boot_record</A></I>
+<P>
+<I><A HREF="http://www.rodsbooks.com/fixparts/">http://www.rodsbooks.com/fixparts/</A></I>
+<P>
+<A NAME="lbAI">&nbsp;</A>
+<H2>AVAILABILITY</H2>
+
+The <B>fixparts</B> command is part of the <I>GPT fdisk</I> package and is
+available from Rod Smith.
+<P>
+
+<HR>
+<A NAME="index">&nbsp;</A><H2>Index</H2>
+<DL>
+<DT><A HREF="#lbAB">NAME</A><DD>
+<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
+<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
+<DT><A HREF="#lbAE">OPTIONS</A><DD>
+<DT><A HREF="#lbAF">BUGS</A><DD>
+<DT><A HREF="#lbAG">AUTHORS</A><DD>
+<DT><A HREF="#lbAH">SEE ALSO</A><DD>
+<DT><A HREF="#lbAI">AVAILABILITY</A><DD>
+</DL>
+<HR>
+This document was created by
+<A HREF="/cgi-bin/man/man2html">man2html</A>,
+using the manual pages.<BR>
+Time: 22:10:51 GMT, January 13, 2021
+</BODY>
+</HTML>

BIN
WinImager/fixparts-windows-1.0.6/fixparts32.exe


BIN
WinImager/fixparts-windows-1.0.6/fixparts64.exe