Hello,
Elkvis
Are you familiar with C++ iostreams? Here is a brief example, in the context of your problem:
Not yet, but playing. Thanks.
Regards
Code:
int main()
{
int count = 0;
Fat32BootRecord pt2;
char buff[sizeof(Fat32BootRecord) + 1];
std::vector <int> posList = { (sizeof(pt2.jmpCode)), (sizeof(pt2.oem)) };
// and the rest of structure
std::vector <string> sType = { "Jmpcode", "OEM" };
// and the rest of structure
std::stringdrLetter = "J:"; // GET THE RIGHT DEVICE
std::stringdevice = "\\\\.\\" + drLetter;
std::ifstream infile(device, std::ios::in | std::ios::binary);
if (!infile)
{
cerr << "Device '" + drLetter + "' could not be opened!" << endl;
exit(-1);
}
infile.seekg(0); // reset to beginning of file
infile.read(buff, sizeof(Fat32BootRecord)); // read the structure
for (int j = 0; j < posList.size(); j++)
{
printf("%s - %i\n", sType[j].c_str(), posList[j]);
for(int i = count; i < posList[j] + count; i++)
{
printf("%i - %c - %d - %x\n",
i, buff[i], buff[i], buff[i]);
}
count = count + posList[j];
}
exit(0);
}
Code:
Jmp code - 3
0 - - -21 - ffffffeb
1 - X - 88 - 58
2 - - -112 - ffffff90
OEM - 8
3 - M - 77 - 4d
4 - S - 83 - 53
5 - D - 68 - 44
6 - O - 79 - 4f
7 - S - 83 - 53
8 - 5 - 53 - 35
9 - . - 46 - 2e
10 - 0 - 48 - 30