delorie.com/archives/browse.cgi | search |
Message-ID: | <354B4F06.C8B1B76@zfs.lg.ua> |
Date: | Sat, 02 May 1998 19:51:18 +0300 |
From: | "Kirpa S.I." <kirpa AT zfs DOT lg DOT ua> |
Reply-To: | kirpa AT zfs DOT lg DOT ua |
MIME-Version: | 1.0 |
To: | WT <gnatwt AT mailexcite DOT com> |
CC: | djgpp AT delorie DOT com |
Subject: | Re: Problem with integer declaration? |
References: | <354AB827 DOT 8EE19C9D AT mailexcite DOT com> |
> I am trying to write a short program to detect VESA VBE and output > information about the video card. I declared a struct of 512 bytes to be > used as a buffer for vbe_info_block. The strange thing is that when I > printed sizeof(vbe_info_block) it gave me 516 bytes instead of 512. I am > sure my struct is correct because I've checked it many times. This is > how the struct is declared : > > typedef > struct { > unsigned int vbe_signature; /* VBE Signature */ > unsigned short vbe_version; /* VBE Version */ > unsigned int oem_string_ptr; /* Pointer to OEM info */ > unsigned int capabilities; /* Capabilities of graphics controller */ > > unsigned int video_mode_ptr; /* Pointer to VideoModeList */ > unsigned short total_memory; /* Number of 64kb memory blocks */ > /* Added for VBE 2.0 */ > unsigned short oem_software_rev; /* VBE implementation Software > revision */ > unsigned int oem_vendor_name_ptr; /* Pointer to Vendor Name String > */ > unsigned int oem_product_name_ptr; /* Pointer to Product Name String > */ > unsigned int oem_product_rev_ptr; /* Pointer to Product Revision > String */ > unsigned char reserved[222]; /* Reserved for VBE implementation > scratch area */ > unsigned char oem_data[256]; /* Data Area for OEM Strings */ > } vbe_info_block; > > Could it be something wrong with the int declaration? Please help! Yes! Of course! You mast declare this structure like that: #define BYTE unsigned char #define WORD unsigned short #define DWORD unsigned long typedef struct { DWORD vbe_signature; /* VBE Signature */ WORD vbe_version; /* VBE Version */ WORD oem_string_ptr; /* Pointer to OEM info */ WORD capabilities; /* Capabilities of graphics controller */ . . . } vbe_info_block __attribute__((packed)); -----------------------^^^^^^^^^^^^^^^^^^^^^ -- ๋ษาะม ๓.้. kirpa AT zfs DOT lg DOT ua
webmaster | delorie software privacy |
Copyright ฉ 2019 by DJ Delorie | Updated Jul 2019 |