Einzelnen Beitrag anzeigen

Apollonius

Registriert seit: 16. Apr 2007
2.325 Beiträge
 
Turbo Delphi für Win32
 
#18

Re: Error: Inkompatible Typen Reguläre Prozedur u Methodenze

  Alt 31. Aug 2007, 16:23
Fertig.
Delphi-Quellcode:
function MakeListSortMethodProc(Method:TListSortMethod): TListSortCompare;
begin
Pointer(result):=VirtualAlloc(0, $0F, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
asm
//mov ecx, edx
mov [eax], $D189
//mov edx, eax
mov [eax+$02], $C289
//mov eax, Method.Data
mov [eax+$04], $B8
mov ecx, [ebp+$0C]
mov [eax+$05], ecx
//push Method.Code
mov [eax+$09], $68
mov ecx, [ebp+$08]
mov [eax+$0A], ecx
//ret
mov [eax+$0E], $C3
end;
end;

procedure FreeListSortProc(Proc: TListSortCompare);
begin
VirtualFree(Pointer(@Proc), 0, MEM_RELEASE);
end;
Ihr Assemblerkundigen da draußen, nehmt es mal kritisch unter die Lupe.

[Edit] Zusätzlich zu Sirius' Korrektur nocheinmal 6 Bytes Assemblercode gespart. [/edit]
Wer erweist der Welt einen Dienst und findet ein gutes Synonym für "Pointer"?
"An interface pointer is a pointer to a pointer. This pointer points to an array of pointers, each of which points to an interface function."
  Mit Zitat antworten Zitat