[Patch] New VHD support... now with added dynamics

Post new patches here!
Post Reply
shermanp
Posts: 73
Joined: Sat 18 Feb, 2017 2:09 am

[Patch] New VHD support... now with added dynamics

Post by shermanp » Fri 29 Jun, 2018 6:57 am

EDIT 2018-07-09: Updated patch available with post #2
Hi all,

I wanted to see if I could extend myself, and implement sparse, or dynamic VHD support to PCem. I am happy to announce that I appear to have succeeded.

This patch replaces my earlier VHD patch, which I consider depreciated (I'll edit the previous topic to state this). It does of course still support fixed VHD images, but with this patch, PCem can create dynamic VHD's, and read/write them. PCem created VHD images can be mounted by Windows 10 (7, 8 should also work), with the caveat that the image needs a supported filesystem (FAT, FAT32, NTFS).

Because I had to write my own image read/write functions for dynamic VHD support, I consider it experimental, until it has had more testing. There are bound to be some silly bugs still waiting to be found (there were plenty of those during development!).

This patch does NOT support differential VHD images. These are not common, and the Windows Disk Management tool cannot create them either. I have no plans to implement differencing support. I have no desire to deal with strings in C thank you very much, let alone utf16 encoded strings...

The current method of choosing between fixed and dynamic VHD creation is not very elegant at the moment. It simply displays a messagebox asking the user to choose. This area could probably use a little refinement, but it works for now.

@SarahWalker I've left in the extra logging function and (commented out) code that I used during development. I will most likely want to remove some or all of this before you merge it, unless you want it to stay there.

I am an amateur with C, so if I've done something majorly silly in the code, feel free to point it out!

Finally, could I please have some vict—er—volunteers to help test this patch for performance and stability? I am NOT a hard disk expert, just a person who can follow a rather straightforward technical document.
Last edited by shermanp on Mon 09 Jul, 2018 5:36 am, edited 1 time in total.

shermanp
Posts: 73
Joined: Sat 18 Feb, 2017 2:09 am

Re: [Patch] New VHD support... now with added dynamics

Post by shermanp » Mon 09 Jul, 2018 5:29 am

MAJOR REFACTOR

I decided that projects other than PCem may find my VHD code useful. To that end, I've disentangled the VHD code from the PCem code as much as possible. I am now calling this implementation MiniVHD, or Minimalist VHD. The code is available at https://github.com/shermp/MiniVHD, released under the same license as Pcem (GPLv2).

As well as separating out the VHD code, I've also done a more general refactor, such as improving function and variable name consistency etc.

A new patch is included in this post. Barring any issues or bugs (there may still be a few!), I think I'll call this one more or less complete.

Patch is against the latest public commit (390edaf).
Attachments
newVHD_v2.patch
(203.87 KiB) Downloaded 22 times

Post Reply