Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mounting a non-FAT VHD image #4941

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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