Skip to content

Commit

Permalink
Merge pull request #4941 from maxpat78/master
Browse files Browse the repository at this point in the history
Fix mounting a non-FAT VHD image
  • Loading branch information
joncampbell123 authored Apr 2, 2024
2 parents d9007bd + 76fb6f8 commit 4518f62
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/ints/bios_vhd.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2018 Shane Krueger. Fixes and upgrades (c) 2023 maxpat78.
* Copyright (c) 2018 Shane Krueger. Fixes and upgrades (c) 2023-24 maxpat78.
*
* 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
Expand Down Expand Up @@ -970,20 +970,17 @@ uint64_t imageDiskVHD::scanMBR(uint8_t* mbr, Bitu sizes[], uint64_t disksize) {
LOG_MSG("Invalid MBR, no signature");
return 0;
}

//search for the first DOS partition
//search for the first non-empty partition
for(part = mbr + 0x1BE; part < mbr + 0x1FE; part += 16) {
uint8_t partType = *((uint8_t*)(part + 4));
if(partType != 1 && partType != 4 && partType != 6 &&
partType != 11 && partType != 12 && partType != 14) continue;
if(partType == 0) continue;
partFound = true;
break;
}
if(!partFound) {
LOG_MSG("No DOS partition in MBR");
LOG_MSG("No partition in use in MBR");
return 0;
}

//partition end
h = (unsigned)*(part + 5);
s = (unsigned)*(part + 6) & 0x3F;
Expand Down

0 comments on commit 4518f62

Please sign in to comment.