public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "david hoke" <d_hoke@hotmail.com>
To: cygwin@sourceware.cygnus.com
Subject: bug: windres: resres.c\res_align_file()
Date: Tue, 01 Feb 2000 20:33:00 -0000	[thread overview]
Message-ID: <20000202043257.21298.qmail@hotmail.com> (raw)

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@sourceware.cygnus.com

                 reply	other threads:[~2000-02-01 20:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20000202043257.21298.qmail@hotmail.com \
    --to=d_hoke@hotmail.com \
    --cc=cygwin@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).