Mail Archives: djgpp/1996/10/24/19:34:50
Jon Slaughter wrote:
>
> here is some code that is supose to read the boot sector and print out
> all the information in BOOT_RECORD. But for some reason, it doesn't :( I
> have no idea why. It would seem that I left some variable out of the
> structure because the first two are ok, but I've looked over it and
> couldn't find anything wrong. It also could be the strings since I have
> no idea of how c handles them(except that they are null terminated)...
> Its probably something stupid, but if anyone can help me, please!!
Under GCC, all struct members are 32-bit aligned. You have to pack the
structure by placing "__attribute__ ((packed))" between the final brace
and the terminating semicolon, like so:
struct struct BOOT_RECORD_STRUCT {
BYTE jump[3];
...
BYTE filler[500];
} __attribute__ ((packed));
For additional details, please read the v2 FAQ (v2/faq202b.zip),
sections 22.9 and 22.10, as well as the docs for gcc under C
Extensions|Type Attributes. (command line: info gcc "c ext" "type
att")
--
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I | fighteer AT cs DOT com |
| Proud owner of what might one | http://www.cs.com/fighteer |
| day be a spectacular MUD... | Plan: To make Bill Gates suffer |
---------------------------------------------------------------------
- Raw text -