[Oberon] PlugIn Oberon for Windows

Alexander Iljin ajsoft at yandex.ru
Fri Nov 26 05:36:10 CET 2010


Hello!

EZ> I implemented a fix for the Windows Vista und Windows 7 problems last year
EZ> but did never make a new release.

  I looked at the diff for Win32.Threads.Mod and saw the fix in
  CheckStacks:

  ...
  res := Kernel32.GetThreadContext(t.handle, cont);
  IF res = Kernel32.False THEN (* hack for Windows 7 Beta *)
    cont.Esp := t.stackBottom
  END;
  Kernel.Candidate(cont.Edi); Kernel.Candidate(cont.Esi);
  Kernel.Candidate(cont.Ebx); Kernel.Candidate(cont.Edx);
  Kernel.Candidate(cont.Ecx); Kernel.Candidate(cont.Eax);
  sp := cont.Esp
  ...

  Turns out I was right about the sp = 0 and GetThreadContext failure.

  My question is: if GetThreadContext fails, is there a point in
  calling Kernel.Candidate for the register values? I think there is
  no point, and it can result in invalid memory access if the
  contents of 'cont' aren't properly initialized (and they are not
  initialized in the CheckStacks procedure).

  Is there a way to ensure that GetThreadContext call won't result in
  error? Is the problem in the lack of the THREAD_GET_CONTEXT
  permission for the thread handle?

  http://msdn.microsoft.com/en-us/library/ms679362(VS.85).aspx

---=====---
 Alexander




More information about the Oberon mailing list