Skip to content

Instantly share code, notes, and snippets.

@bit-hack
Created June 17, 2019 14:09
Show Gist options
  • Save bit-hack/8ac19e7d7aad5508ac3aeb8e7136af63 to your computer and use it in GitHub Desktop.
Save bit-hack/8ac19e7d7aad5508ac3aeb8e7136af63 to your computer and use it in GitHub Desktop.
virtual hard drive footer format
// http://download.microsoft.com/download/f/f/e/ffef50a5-07dd-4cf8-aaa3-442c0673a029/Virtual%20Hard%20Disk%20Format%20Spec_10_18_06.doc
// footer lives at end of the file - 512/511 bytes
struct vhd_footer_t {
// "conectix"
uint64_t cookie;
// 0 - No features enabled
// 1 - Temporary
// 2 - Reserved
uint32_t features;
// should be 0x00010000
uint32_t version;
// 0xFFFFFFFF for fixed disks
uint64_t offset;
uint32_t timestamp;
// "vs  " - virtual server
// "vpc " - virtual pc
uint32_t creat_app;
uint32_t creat_ver;
uint32_t creat_os;
uint64_t orig_size;
// size of hard drive in bytes
uint64_t size;
// byte 0-1 - cylinders
// byte 2 - heads
// byte 3 - sectors
uint32_t geometry;
// 2 - fixed disk
uint32_t type;
// inverted sum of hard disk footer bytes (without checksum)
uint32_t checksum;
uint8_t uuid[16];
uint8_t state;
// should be 427 bytes reserved after this
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment