Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#3

AW: Array of Integer und crash

  Alt 26. Sep 2018, 13:28
Muss das nochmal aufgreifen..

Habe das Projekt nach 64 Bit umgelegt bekomme aber jetzt fortlaufend "Inaccessible value"
Delphi-Quellcode:
function TAnimateGif.GetPropertyItem(GifImage: LONG_PTR; PropertyID: ULONG; PropertyItemSize: UINT;
  var PropertyItemData: PPropertyItem): GPSTATUS;
begin

  // Daten auslesen
  Result := GDIP_GetPropertyItem(GifImage, PropertyID, PropertyItemSize, PropertyItemData);
end;
Delphi-Quellcode:
function GDIP_GetPropertyItem(Img: LONG_PTR; propId: PROPID; propSize: UINT;
  var buffer: PPROPERTYITEM
): GPSTATUS; stdcall;
begin

  result := GdipGetPropertyItem(Img, propId, propSize, buffer);
end;
bevor GdipGetPropertyItem aufgerufen wird ist der Buffer gefüllt.
Nach dem Aufruf von GdipGetPropertyItem ist der buffer Inaccessible.

Wie immer tritt nur unter 64 Bit auf.

Die Funktion ist diese.
GdipGetPropertyItem: function(Image: LONG_PTR; propId: PROPID; propSize: UINT; var buffer: PPROPERTYITEM): GPSTATUS; stdcall;

Und der Record der..
Delphi-Quellcode:
  PropertyItem = record // NOT PACKED !!
    id : PROPID; // ID of this property
    length : ULONG; // Length of the property value, in bytes
    type_ : WORD; // Type of the value, as one of TAG_TYPE_XXX
    value : Pointer; // property value
  end;
  TPropertyItem = PropertyItem;
  PPropertyItem = ^TPropertyItem;
es kracht dann hier
Delphi-Quellcode:
    // Daten auslesen
    if GetPropertyItem(GifImage, PropertyTagFrameDelay, PropSize, FPropItem) = OK then
    begin
      // Bytearray dimensionieren
      SetLength(Prop, PropItem.Length);
      CopyMemory(@Prop[0], PropItem.value, PropItem.Length);
weil PropItem bzw. vorher schon PropertyItemData nicht zugänglich ist.

PS:
Es hat nichts mit dem setzen der Optimierung zu tun!

gruss
  Mit Zitat antworten Zitat