delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-apps/2002/03/27/09:07:55

Mailing-List: contact cygwin-apps-help AT cygwin DOT com; run by ezmlm
Sender: cygwin-apps-owner AT cygwin DOT com
List-Subscribe: <mailto:cygwin-apps-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-apps/>
List-Post: <mailto:cygwin-apps AT cygwin DOT com>
List-Help: <mailto:cygwin-apps-help AT cygwin DOT com>, <http://sources.redhat.com/lists.html#faqs>
Mail-Followup-To: cygwin-apps AT cygwin DOT com
Delivered-To: mailing list cygwin-apps AT cygwin DOT com
Message-ID: <3CA1D10E.E672E081@cistron.nl>
Date: Wed, 27 Mar 2002 15:02:54 +0100
From: Ton van Overbeek <tvoverbe AT cistron DOT nl>
X-Accept-Language: en, en-US, en-GB, nl, sv
MIME-Version: 1.0
To: cygwin-apps AT cygwin DOT com, cygwin-patches AT cygwin DOT com
CC: jonas_eriksson AT home DOT se
Subject: Patch for Setup.exe problem and for mklink2.cc

This is a multi-part message in MIME format.
--------------4E10E38C83FCB4712E588E7C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Found the problem causing the segment violation and probably causing
Jonas Eriksson's problem. It is a typical case of 'off by 1'.
In PickView::set_headers the loop filling the window header does one
iteration too much, resulting in a call to DoInsertItem with a NULL
string pointer and hence a crash following.
While debugging this I could not compile the new mklink2.cc ( the
c++ version of the original mklink2.c). It seems three & (address of operator)
have disappeared in the transition. Putting them back made the compiler
happy. Is this OK Robert ?

Changelog
2002-03-27  Ton van Overbeek (tvoverbe AT cistron DOT nl)
* Pickview.cc (PickView::set_headers) Correct loop count for DoInsertItem.

* mklink2.cc (make_link_2) Reinsert three & operators which got lost in the
  c -> c++ transition.

Patch in attached file.

Ton van Overbeek
--------------4E10E38C83FCB4712E588E7C
Content-Type: text/plain; charset=us-ascii;
 name="patch.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch.txt"

--- mklink2.cc-orig	Wed Mar 27 12:18:34 2002
+++ mklink2.cc	Wed Mar 27 12:41:16 2002
@@ -20,9 +20,9 @@ make_link_2 (char const *exepath, char c
   IPersistFile *pf;
   WCHAR widepath[_MAX_PATH];
 
-  CoCreateInstance (CLSID_ShellLink, NULL,
-		    CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID *) & sl);
-  sl->lpVtbl->QueryInterface (sl, IID_IPersistFile, (void **) &pf);
+  CoCreateInstance (&CLSID_ShellLink, NULL,
+		    CLSCTX_INPROC_SERVER, &IID_IShellLink, (LPVOID *) & sl);
+  sl->lpVtbl->QueryInterface (sl, &IID_IPersistFile, (void **) &pf);
 
   sl->lpVtbl->SetPath (sl, exepath);
   sl->lpVtbl->SetArguments (sl, args);
--- PickView.cc-orig	Wed Mar 27 12:18:26 2002
+++ PickView.cc	Wed Mar 27 12:20:16 2002
@@ -110,7 +110,7 @@ PickView::set_headers ()
       SendMessage (listheader, HDM_DELETEITEM, n - 1, 0);
     }
   int i;
-  for (i = 0; i <= last_col; i++)
+  for (i = 0; i < last_col; i++)
     DoInsertItem (listheader, i, headers[i].width, (char *) headers[i].text);
 }
 

--------------4E10E38C83FCB4712E588E7C--

- Raw text -


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