[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: [PATCH] InitAtomTable
From:       Ulrich Weigand <weigand () informatik ! uni-erlangen ! de>
Date:       1999-12-26 23:37:13
[Download RAW message or body]


> +/***********************************************************************
> + *           InitAtomTable   (KERNEL32.471)
> + */
> +BOOL WINAPI InitAtomTable( DWORD entries )
> +{
> +    if ((entries < 4) || (entries > 0x200))
> +      entries = DEFAULT_ATOMTABLE_SIZE; /* sanity check */
> +    return ATOM_InitTable( CURRENT_DS, entries );
> +}

I'm afraid this probably won't work very well:  for 32-bit processes,
you don't really *have* a CURRENT_DS ...  Depending on the exact circumstances,
calling CURRENT_DS in a 32-bit process might either crash, return 0, or
-if called from within an upthunk from 16-bit- indeed give a valid 16-bit
data segment selector, but possibly not the one you expect ...

The core problem is that atoms are supposed to be stored on the local
heap in the DGROUP segment of the current task.  Of course, 32-bit processes
don't have any DGROUP segment :-/

I haven't completely understood how this is solved in Windows, but in
Win9x it seems to involve allocating a dummy 'data segment' that is used
only for the purpose of storing atoms; a handle to this global memory block
is stored in the TDB structure of the 32-bit process (IIRC at offset 0x58).

Note that Wine currently circumvents this by having all 32-bit *Atom routines
actually call the Global*Atom routines (which always use the USER DGROUP);
see all the FIXME comments in memory/atom.c?  As long as we have this hack
in place, InitAtomTable might as well do nothing; then it at least cannot
do harm as the version above might ;-)

A real fix would be to investigate closer how this works in Windows,
and then implement proper Win32 atom routines (not only InitAtomTable,
but also AddAtom, FindAtom, ...).

Bye,
Ulrich

-- 
  Ulrich Weigand,
  IMMD 1, Universitaet Erlangen-Nuernberg,
  Martensstr. 3, D-91058 Erlangen, Phone: +49 9131 85-7688

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic