From: marten.larsson@gdpc.se (Marten Larsson)
Subject: Re: DELPHI:  addressing getmem'ed memory
Date: Fri, 02 Jun 95 18:42:42 GMT

The following should do the job (both for pointers retrieved with
GlobalAlloc/GlobalLock and GetMem):

PROCEDURE IncPtr(VAR p : Pointer) : Pointer;
  BEGIN
    IF (Ofs(p^)=$FFFF) THEN
      p:=Ptr(Seg(p^)+SelectorInc,0)
    ELSE
      p:=Ptr(Seg(p^),Ofs(p^)+1);
  END;

This handles the case when you cross a segment boundary as well. (SelectorInc
is a predefined Delphi variable.)

/Marten
