Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Code läuft in VCL aber nicht in Console (GetThreadContext) (https://www.delphipraxis.net/147577-code-laeuft-vcl-aber-nicht-console-getthreadcontext.html)

himitsu 29. Mai 2010 15:37

Re: Code läuft in VCL aber nicht in Console (GetThreadContex
 
Wenn der Speicher 8-Byte-Alligned vorliegt, dann paßt da nicht nur 8-Byte, sondern auch alle kleineren Zweierpotenzen aligned dort rein. :roll:


Aber vielleicht sollte man nicht nur den Zugriffsfehler beim Speicher, sondern beim Kontext suchen?

http://msdn.microsoft.com/en-us/library/ms679362.aspx
Zitat:

hThread [in]

A handle to the thread whose context is to be retrieved. The handle must have THREAD_GET_CONTEXT access to the thread. For more information, see Thread Security and Access Rights.

WOW64: The handle must also have THREAD_QUERY_INFORMATION access.
Und der Beispielcode dort unten könnte ebenfalls helfen.

Win32.API 29. Mai 2010 15:45

Re: Code läuft in VCL aber nicht in Console (GetThreadContex
 
Zitat:

Zitat von himitsu
Aber vielleicht sollte man nicht nur den Zugriffsfehler beim Speicher, sondern beim Kontext suchen?

http://msdn.microsoft.com/en-us/library/ms679362.aspx
Zitat:

hThread [in]

A handle to the thread whose context is to be retrieved. The handle must have THREAD_GET_CONTEXT access to the thread. For more information, see Thread Security and Access Rights.

WOW64: The handle must also have THREAD_QUERY_INFORMATION access.
Und der Beispielcode dort unten könnte ebenfalls helfen.

Ich verwende GetCurrentThread(), welches mir ein pseudo Handle mit THREAD_ALL_ACCESS zurueck gibt.

Edith meinte noch, dass es nicht am Alignment liegt, da in der Subfunktion der Speicher auch passend Aligned ist.

Remko 6. Jun 2010 15:49

AW: Code läuft in VCL aber nicht in Console (GetThreadContext)
 
Please look back to Dezipaitor's answer on page 1, I agree with him that the error is likely to be caused because you are specifying a constant value and CreateProcess writes to it.

I wrote a while back about this on the Jedi Blog: http://blog.delphi-jedi.net/2009/11/...s-declaration/

It also explains why it works well in Delphi 2007 and not in 2010 (because 2010 uses CreateProcessW and 2007 will use CreateProcessA).

Zacherl 6. Jun 2010 16:17

AW: Code läuft in VCL aber nicht in Console (GetThreadContext)
 
I think it could be one of the problems, but not all of them. I tried to call CreateProcessW with a variable parameter and without. Both calls were successfully completed, but GetThreadContext() still fails.


Alle Zeitangaben in WEZ +1. Es ist jetzt 03:36 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz