AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi Code läuft in VCL aber nicht in Console (GetThreadContext)
Thema durchsuchen
Ansicht
Themen-Optionen

Code läuft in VCL aber nicht in Console (GetThreadContext)

Offene Frage von "Zacherl"
Ein Thema von Zacherl · begonnen am 11. Feb 2010 · letzter Beitrag vom 6. Jun 2010
Antwort Antwort
Seite 2 von 2     12   
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.139 Beiträge
 
Delphi 12 Athens
 
#11

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

  Alt 29. Mai 2010, 15:37
Wenn der Speicher 8-Byte-Alligned vorliegt, dann paßt da nicht nur 8-Byte, sondern auch alle kleineren Zweierpotenzen aligned dort rein.


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.
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat
Win32.API

Registriert seit: 23. Mai 2005
312 Beiträge
 
#12

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

  Alt 29. Mai 2010, 15:45
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.
  Mit Zitat antworten Zitat
Benutzerbild von Remko
Remko

Registriert seit: 10. Okt 2006
Ort: 's-Hertogenbosch, Die Niederlande
222 Beiträge
 
RAD-Studio 2010 Arc
 
#13

AW: Code läuft in VCL aber nicht in Console (GetThreadContext)

  Alt 6. Jun 2010, 15:49
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).
See my blog blog
See our Jedi blog
  Mit Zitat antworten Zitat
Benutzerbild von Zacherl
Zacherl

Registriert seit: 3. Sep 2004
4.629 Beiträge
 
Delphi 10.2 Tokyo Starter
 
#14

AW: Code läuft in VCL aber nicht in Console (GetThreadContext)

  Alt 6. Jun 2010, 16:17
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.
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 2 von 2     12   


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:47 Uhr.
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