This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: sound support more info - kde2 porting status


> > > > On Sat, Oct 20, 2001 at 10:16:46AM +0200, Ralf Habacker wrote:
> > > > >4a. Some application (kdevelop,) couldn't be started
> > > > >   because of a runtime loader error. (Windows Error 0xc0000142)
> > > > >   I have tried to analyze this, but without success.
> > > > >
> > > > >   This error is critical for this project, which implicated to me
> > > > >   to look after another way to port kde2.
> > > > >   Currently I'm trying out if "line" the linux emulator for windows
> > > > >   is a possible way for doing this. If have got running already some
> > > > >   applications.
> > > >
> > > > Hmm.  A google search on this error doesn't unearth much interesting
> > > > besides the fact that a DLL failed to initialize properly.  Doesn't gdb
> > > > tell you which one is having problems?  I remember having similar
> > > > problems, though, and they are really tricky to track down.
> > > >
> > > As I recognized it occurs after loading the last dll. In
> > > http://sources.redhat.com/ml/cygwin-apps/2001-09/msg00135.html I have send
> > > some informations. Do you have looked into ?
> > > There are 4 threads and I'm not able to identify, which thread caused the
> > > message box. In thread 1 an execve is called and hangs in kernel32.
> > The other
> > > threads are located in kernel32 too. Currently I'm out of ideas. :-(
> > >
> > Just I have seen a topic in google under
> > http://www.iseran.com/Win32/FAQ/except.html
> > which wasn't there on the last search some weeks ago and this say the
> > following:
> >
> > "0xC0000142 DLL Initialisation Failure 	Raised when DllMain()
> > returns false (?)
> > "
> >
> Here is another link http://www.sequest.com/wpapers/dsb_wval.html in which
> this error code points to a failed dll initialisation
> ...
> STATUS_DLL_INIT_FAILED 0xc0000142
> ...

The problem is caused by dll_list:alloc() in the loop
"Search for space after the DLL". I have found that in one
app the exit after VirtualQuery() and in other app the exit
after  if (i == RETRIES) occures.
After looking around I tried to increase the RETRIES constant to 1000.
This fix the error. Hmmh, does this really fix this ???

Can anyone tell me, whats could be going wrong with this stuff ?


/* Allocate space for a dll struct contiguous with the just-loaded dll. */
dll *
dll_list::alloc (HINSTANCE h, per_process *p, dll_type type)
{
<snip>

  SYSTEM_INFO s1;
  GetSystemInfo (&s1);

  int i;
  void *s = p->bss_end;
  DWORD n;
  MEMORY_BASIC_INFORMATION m;
  /* Search for space after the DLL */
  for (i = 0; i <= RETRIES; i++, s = (char *) m.BaseAddress + m.RegionSize)
    {
      if (!VirtualQuery (s, &m, sizeof (m)))

!!!!! possible exits
	return NULL;	/* Can't do it. */
      if (m.State == MEM_FREE)
	{
	  /* Couldn't find any.  Uh oh.  FIXME: Issue an error? */
	  if (i == RETRIES) {

!!!!! possible exits
	    return NULL;	/* Oh well.  Couldn't locate free space. */
	}

	  /* Ensure that this is rounded to the nearest page boundary.
	     FIXME: Should this be ensured by VirtualQuery? */
	  n = (DWORD) m.BaseAddress;
	  DWORD r = n % s1.dwAllocationGranularity;

	  if (r)
	    n = ((n - r) + s1.dwAllocationGranularity);

	  /* First reserve the area of memory, then commit it. */
	  if (VirtualAlloc ((void *) n, sizeof (dll), MEM_RESERVE, PAGE_READWRITE))
	    d = (dll *) VirtualAlloc ((void *) n, sizeof (dll), MEM_COMMIT,
				      PAGE_READWRITE);
	  if (d)
	    break;
	}
    }

  /* Did we succeed? */
  if (d == NULL)
    {			/* Nope. */
#ifdef DEBUGGING
      system_printf ("VirtualAlloc failed, %E");
#endif
      __seterrno ();
      return NULL;
    }

  /* Now we've allocated a block of information.  Fill it in with the supplied
     info about this DLL. */
  d->count = 1;
  d->namelen = namelen;
  strcpy (d->name, name);
  d->handle = h;
  d->p = p;
  d->type = type;
  if (end == NULL)
    end = &start;	/* Point to "end" of dll chain. */
  end->next = d;	/* Standard linked list stuff. */
  d->next = NULL;
  d->prev = end;
  end = d;
  tot++;
  if (type == DLL_LOAD)
    loaded_dlls++;
#ifdef DEBUGGING
  console_printf ("%s %d finish\n", __PRETTY_FUNCTION__,__LINE__);
#endif

  return d;
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]