delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/02/01/23:28:17

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <20000202043257.21298.qmail@hotmail.com>
X-Originating-IP: [4.48.168.171]
From: "david hoke" <d_hoke AT hotmail DOT com>
To: cygwin AT sourceware DOT cygnus DOT com
Subject: bug: windres: resres.c\res_align_file()
Date: Tue, 01 Feb 2000 20:32:57 PST
Mime-Version: 1.0

Using beta 20.1 under win95 and NT, but have also checked Mumit Khan's beta 
version of mingw - problem still resides there in source.  Actually using 
cygwin1.dll snapshot around Oct. 15, 1999.  (Or somewhere shortly after that 
buffer overrun fix.)

I was trying to read binary resource (.res) to produce readable output with 
command similar to

./windres ./xxx.res

where the file ./xxx.res was produced by the MS RC.

I have found the function

res_align_file()

in source module resres.c does not function properly failing in the 
following cases to force the required dword alignment: ftell(fres)==1, or 
ftell(fres)==3.  It will align properly if ftell(fres) == 2 ,  or 
ftell(fres)==4.

A suggested replacement version of the function is:

static void
res_align_file(void)
{
  int rem = ftell(fres) % 4 ;
  if (rem)
  if (fseek (fres, 4 - rem, SEEK_CUR) != 0)
    fatal ("%s: %s: unable to align file", program_name, filename) ;
}

Someone in a position to do so may wish to examine this and make this 
correction or a similar one before a new release.

I will also note that the function is used for alignment on output. From my 
reading of the spec., I didn't think ANSI required the fseek seek beyond the 
current end-of-file, but it appears this function counts on that (and it 
apparently does work that way with cygwin.)

Even after I have made this change (and I'll check back to see if someone 
thinks this is incorrect), I am still having a problem, apparently trying to 
read a versioninfo structure, with a failure from the module resbin.c on the 
error message containing the substring "%d != %d + %d".  The values it shows 
are indeed not equal, and I have not had sufficient time to chase this down. 
  I did recently take another look, and am now suspicious of code elsewhere, 
as this .RES file does not appear to actually have a versioninfo item in 
it...  I think that's what the code around that error message was trying to 
read.

David Hoke
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019