Re: crfaker fix

Brian Paul <[email protected]>
Newsgroups gmane.comp.graphics.chromium.devel
Message-ID <[email protected]>
There must be _some_ WGL function being called before glViewport.  At 
least wglMakeCurrent() must be called to bind a rendering context. 
Otherwise, the glViewport call is invalid.

We can call stubInit() from all the wgl/glx functions in the faker. 
It returns immediately if it's been called before.

-Brian


Ricky Uy wrote:
> You're right, I found the article you mentioned on MSDN. But if that is 
> the case, then are applications like Celestia doomed to be able to work 
> on Chromium in their original, unmodified state? In it's unmodified 
> state, stubInit() is never going to be called before the glViewport() 
> call, and I don't see any other areas of the crfaker dll where the call 
> to stubInit() would make sense. Celestia will just call glViewport and 
> it will immediately get intercepted by windows_exports.c and try to jmp 
> to an invalid location. I suppose checks could be made in the 
> windows_exports file to see if stubInit has already been called or not, 
> but it wouldn't be good to make function calls like that inside of NAKED 
> functions. Do you know any other places that might be okay for it?
> 
> */Greg Humphreys <[email protected]>/* wrote:
> 
>     If I recall correctly, this is (was?) explicitly documented in MSDN as
>     being illegal (manual loading of other DLL's within DLLMain). It USED
>     to be there, and then I discovered this, and moved it.
> 
>     --
>     Greg Humphreys, Assistant Professor
>     Department of Computer Science, University of Virginia
>     http://www.cs.virginia.edu/~humper/
> 
> 
>     On Jun 23, 2004, at 11:37 AM, Ricky Uy wrote:
> 
>      > Hi,
>      >
>      > For the Windows version of this library, there should be a call to
>      > stubInit() just before the return in DLLMain() in load.c, and all
>     the
>      > calls to stubInit() should be removed from the wgl functions in
>     wgl.c.
>      > There were several applications that would bail out because of this,
>      > including Celestia for Windows. However with this patch, they all
>      > work.
>      >
>      > The problem was that some applications d on't call wgl functions
>     before
>      > trying to do other things. For example, especially in direct
>     response
>      > to Alicia's post, Celestia would try to call ShowWindow() before
>      > calling ChoosePixelFormat(). This caused a crash because ShowWindow
>      > makes a call to glViewport, and because stubInit() had not yet been
>      > called, the glim dispatch table was nulled out. So there was a
>     crash.
>      > By having stubInit() in DLLMain, issues like these are resolved.
>      >
>      > Now there was a comment above DLLMain saying that Windows didn't
>     allow
>      > the loading of other libraries in DLLMain, and I'm not sure what has
>      > happened since, but it works fine. Hope this helps some people with
>      > their applications.
>      >
>      > Ricky
>      >
>      > Do you Yahoo!?
>      > New and Improved Yahoo! Mail - Send 10MB messages!
> 
> 
> 
>     -------------------------------------------------------
>     This SF.Net email sponsored by Black Hat Brief ings & Training.
>     Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
>     digital self defense, top technical experts, no vendor pitches,
>     unmatched networking opportunities. Visit www.blackhat.com
>     _______________________________________________
>     Chromium-dev mailing list
>     [email protected]
>     https://lists.sourceforge.net/lists/listinfo/chromium-dev
> 
> ------------------------------------------------------------------------
> Do you Yahoo!?
> New and Improved Yahoo! Mail 
> <http://us.rd.yahoo.com/mail_us/taglines/10/*http://promotions.yahoo.com/new_mail/static/efficiency.html> 
> - Send 10MB messages!



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.