Return value GetStockObject

Fabian Cenedese Cenedese at indel.ch
Thu Aug 29 04:25:00 CDT 2002


> > In my app I try to get a handle to a system font with following call:
> > HGDIOBJ hobj=GetStockObject(ANSI_FIXED_FONT);
> > If the call succeeds it should return a handle to the requested object,
> > otherwise zero. In Windows I get something like 0x018A000E (looks ok),
> > but in Wine I get 0x0000009E. Even not zero I can't imagine that this is
> > a valid handle (address). ANSI_FIXED_FONT is never really used in Wine,
> > only SYSTEM_FONT.
> > Is this an error or am I barking up the wrong tree?
>
>In Wine, handles are not (yet) all void * (see bug #90). Even then, it
>doesn't mean a handle is a valid heap address; I know there are a couple
>places in Wine where they are used as an index in an array locating all
>objects of a kind. It doesn't exactly follow the Windows convention, but
>I think handles are supposed to be passed back to APIs, not handled
>(dereferenced) directly by apps.
>
>So 0x0000009E doesn't strike me as bad. If you use it in calls to font
>APIs, does it work correctly?

With this returned handle I try to fill a structure with GetObject:

HGDIOBJ hobj=GetStockObject(ANSI_FIXED_FONT);
LOGFONT lfSys;
int ret=GetObject(hobj, sizeof(lfSys), &lfSys);
(Windows returns 36)

After that lfSys has all the info about this font. In Windows the members are
filled nicely, lfSys.lfFaceName is "Courier".

In Wine GetObject returns 60 (for whatever reason), and lfSys.lfFaceName
is empty. Now this could mean that the handles are invalid or that there
is something wrong with my fonts.

Thanks

Fabi





More information about the wine-devel mailing list