X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Trace-PostClient-IP: 68.147.131.211 From: Brian Inglis Newsgroups: comp.os.msdos.djgpp Subject: Re: Strange VESA problem Organization: Systematic Software Message-ID: References: <20040926152903 DOT 25170 DOT 00001483 AT mb-m04 DOT aol DOT com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 114 Date: Mon, 27 Sep 2004 01:57:49 GMT NNTP-Posting-Host: 24.71.223.147 X-Complaints-To: abuse AT shaw DOT ca X-Trace: pd7tw1no 1096250269 24.71.223.147 (Sun, 26 Sep 2004 19:57:49 MDT) NNTP-Posting-Date: Sun, 26 Sep 2004 19:57:49 MDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On 26 Sep 2004 19:29:03 GMT in comp.os.msdos.djgpp, jbs30000 AT aol DOT com (JBS30000) wrote: >>It would help if you posted all the relevant parts of the real code. ^^^^^^ ^^^^^^^^^ Perhaps I should have said pasted? >I thought I did. The method I use to get and display the other strings, such >as the OEM Vender Name, and so fourth are the same. But, if you want more >code... >Here's the struct in its entirety: >struct VBE_VgaInfo >{ > char VESA_Signature[4] __attribute__((packed)); > short VESA_Version __attribute__((packed)); > long OEM_String_PTR __attribute__((packed)); > unsigned long Capabilities __attribute__((packed)); > long Video_Mode_PTR __attribute__((packed)); > short Total_Memory __attribute__((packed)); > //VBE 2.0 > short OEM_Software_Rev __attribute__((packed)); > long OEM_Vendor_Name_PTR __attribute__((packed)); > long OEM_Product_Name_PTR __attribute__((packed)); > long OEM_Product_Rev_PTR __attribute__((packed)); > char reserved[222] __attribute__((packed)); > char OEM_Data[256] __attribute__((packed)); >}vesainfo; Good idea to declare all the OEM_*_PTR pointer variables as unsigned long. >After using functin 0 to get the information and fill the struct, I use these >variables to hold the strings: >char OEM_String[255], OEM_Vendor_Name[256], ^^^ ^^^ > OEM_Product_Name[256], OEM_Product_Rev[256]; ^^^ ^^^ Safer to keep the sizes the same and maybe define a constant symbol such as STR_LEN to set them. It might be a good idea to initialize these arrays to nul chars, or at least put a nul char in the last position, as you only copy 255 chars; this will avoid problems if a string is not nul terminated. #define STR_LEN 256 char OEM_String[STR_LEN] = ""; char OEM_Vendor_Name[STR_LEN] = ""; char OEM_Product_Name[STR_LEN] = ""; char OEM_Product_Rev[STR_LEN] = ""; >And, for the real mode offset I have: >short Real_Mode_PTR ^ ? Indication that this *may* not be a paste of the real code, or may be a selective cut/paste. >Now, to get the strings, I go: > Real_Mode_PTR = ((vesainfo.OEM_String_PTR >> 16) << 4) + >(vesainfo.OEM_String_PTR & 0xFFFF); > dosmemget(Real_Mode_PTR & 0xFFFF, 255, OEM_String); Shouldn't even look at the pointers unless the version is high enough. if(vesainfo.VESA_Version >= 0x0200) { > Real_Mode_PTR = ((vesainfo.OEM_Vendor_Name_PTR >> 16) << 4) + >(vesainfo.OEM_Vendor_Name_PTR & 0xFFFF); > dosmemget(Real_Mode_PTR & 0xFFFF, 256, OEM_Vendor_Name); > Real_Mode_PTR = ((vesainfo.OEM_Product_Name_PTR >> 16) << 4) + >(vesainfo.OEM_Product_Name_PTR & 0xFFFF); > dosmemget(Real_Mode_PTR & 0xFFFF, 256, OEM_Product_Name); > Real_Mode_PTR = ((vesainfo.OEM_Product_Rev_PTR >> 16) << 4) + >(vesainfo.OEM_Product_Rev_PTR & 0xFFFF); > dosmemget(Real_Mode_PTR & 0xFFFF, 256, OEM_Product_Rev); Below is dupe of above. > Real_Mode_PTR = ((vesainfo.OEM_Product_Rev_PTR >> 16) << 4) + >(vesainfo.OEM_Product_Rev_PTR & 0xFFFF); > dosmemget(Real_Mode_PTR & 0xFFFF, 256, OEM_Product_Rev); } else /* don't need this if initialized to all nul chars */ { OEM_Vendor_Name[0] = '\0'; OEM_Product_Name[0] = '\0'; OEM_Product_Rev[0] = '\0'; } Good idea to wrap the pointer conversion and string fetches in a macro or function, so you have only one place to change the operations, e.g. #define REAL_PTR(p) (((((p) >> 16) & 0xFFFF) << 4) + ((p) & 0xFFFF)) dosmemget( REAL_PTR( vesainfo.OEM_Product_Rev_PTR ), STR_LEN - 1, OEM_Product_Rev); >And to print them: > printf("Chipset or OEM %s \n", OEM_String); > if(vesainfo.VESA_Version >= 0x0200) > { > printf("OEM Software Revision No. %x\n", vesainfo.OEM_Software_Rev); > printf("OEM Vendor Name %s\n", OEM_Vendor_Name); > printf("OEM Product Name %s\n", OEM_Product_Name); > printf("OEM Product Revision No. %s\n", OEM_Product_Rev); >And there, that's all of the RELEVANT code. Don't see what good this did, but >anyway, I'll try your changes. Thanks. -- Thanks. Take care, Brian Inglis Calgary, Alberta, Canada Brian DOT Inglis AT CSi DOT com (Brian[dot]Inglis{at}SystematicSW[dot]ab[dot]ca) fake address use address above to reply