Detecting an invalid handle in setupapi

Daniel Santos javatroubadour at yahoo.com
Tue May 19 17:00:03 CDT 2009


oops, I meant to reply-all on this.

--- On Mon, 5/18/09, Daniel Santos <javatroubadour at yahoo.com> wrote:

From: Daniel Santos <javatroubadour at yahoo.com>
Subject: Re: Detecting an invalid handle in setupapi
To: "Paul Vriens" <paul.vriens.wine at gmail.com>
Date: Monday, May 18, 2009, 5:43 PM

I'm so very glad you brought this up Paul.  I'm new to wine development
and I've been working on Lord of the Rings Online issues and I have
discovered and validated that the root cause of two of my problems are
related (http://bugs.winehq.org/show_bug.cgi?id=18371).  There are numerous places in Wine where the validity of
handles are not checked.  If the handle turns out to be invalid, then a NULL pointer is simply passed instead (which sometimes has an alternate meaning).  Worse yet, in the code I was working with
(dlls/kernel32/global16.c) the type of object the handle refers to is
not stored!  I see this as a critical flaw in Wine and I hope I can come up with a viable solution.  I'm planning on setting up some test programs to examine the bit-data of some windows objects (starting with user32 -- where my issue lies) as any solution will have to be bit-compatibile with windows since apps like paint shop pro de-reference handles and examine the data of the underlying objects.

In truth, if the LOTRO app didn't destroy objects it was still using and then try to use them, the problem wouldn't exist -- this part of wine will work perfectly if the app behaved responsibly.  But development timelines and pressures frequently lead to code that works, but is incorrect and is a part of reality.

Daniel

--- On Sat, 5/16/09, Paul Vriens <paul.vriens.wine at gmail.com> wrote:

From: Paul
 Vriens <paul.vriens.wine at gmail.com>
Subject: Detecting an invalid handle in setupapi
To: "wine-devel at winehq.org" <wine-devel at winehq.org>
Date: Saturday, May 16, 2009, 12:18 PM

Hi,

I'm trying to install Microsoft's MMC (W2K3) and it crashes every now and then with different symptoms.

I've tracked it down to what I think is a fault in the application that triggers a bug in Wine. All inf files that are read are closed with SetupCloseInfFile but the app is still trying to use the handle in a call to SetupFindFirstLineA.

On Windows (tested on W2K3) this will lead to a failure of SetupFindFirstLineA with a last error of ERROR_INVALID_HANDLE. On Wine we don't check the handle and thus the outcome cannot be predicted (mostly crash).

What ways do we have to detect invalid handles or better yet how can this be solved?

--
 Cheers,

Paul.





      


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20090519/e80b7833/attachment.htm>


More information about the wine-devel mailing list