Programmcrash - aber wo?

04/11/2010 - 21:55 von Jens Kallup | Report spam
Hallo,

verwende nasm alink zum erstellen einer exe.
leider habe ich das problem, dass ich eine fehlermeldung(av bekomme,
wenn ich folgenden code verwende:

unit window;

interface

uses Forms,SysUtils,Dialogs;

procedure show_window(w: integer); cdecl; export;
procedure init_class (w: integer); cdecl; export;
procedure set__position(w, t, n, p, parent, wert: integer); cdecl;
export;

implementation

type
TMainWindow = class
public
FForm: TForm;
end;

var
FMainWindowArray : Array [0..2048] of TMainWindow;

procedure show_window(w: integer); cdecl; export;
begin
if (w-1 > -1) then w := w-1;
w := 0;

// hier wird nix angezeigt ??? :(
showmessage('-ßßßß');

if not assigned(FMainWindowArray[w]) then
FMainWindowArray[w] := TMainWindow.Create;
if not assigned(FMainWindowArray[w].FForm) then
FMainWindowArray[w].FForm := TForm.CreateNew(nil);


showmessage('-');
FMainWindowArray[w].FForm.ShowModal;
end;

procedure init_class(w: integer); cdecl; export;
begin
if (w-1 > -1) then w := w-1;
w := 0;
if not assigned(FMainWindowArray[w]) then
FMainWindowArray[w] := TMainWindow.Create;
FMainWindowArray[w].FForm := TForm.CreateNew(nil);
showmessage('22');
end;

procedure set__position(w, t, n, p, parent, wert: integer); cdecl; export;
begin
if (w-1 > -1) then w := w-1;
w := 0;
showmessage(inttostr(w)+': ' + inttostr(t));
if t = 65535 then
begin
if not assigned(FMainWindowArray[w]) then
FMainWindowArray[w] := TMainWindow.Create;
if not assigned(FMainWindowArray[w].FForm) then
FMainWindowArray[w].FForm := TForm.CreateNew(nil);

showmessage(inttostr(w) + ' zp');
case p of
0: FMainWindowArray[w].FForm.Top := wert;
1: FMainWindowArray[w].FForm.Left := wert;
2: FMainWindowArray[w].FForm.Width := wert;
3: FMainWindowArray[w].FForm.Height := wert;
else FMainWindowArray[w].FForm.Top := wert;
end;
showmessage(inttostr(w) + ' <<<<zp');
end;
end;

EXPORTS
show_window,
init_class,
set__position;

end.



//////////

SECTION CODE USE32 CLASS=CODE
..start:
push ebp
mov ebp, esp
call LClassName_masterforma
push dword dword [LC_WCmasterforma]
call [show_window]
add esp, 4
leave
ret
LClassName_masterforma:
push ebp
mov ebp, esp
push dword [LClassID_masterforma]
call [init_class]
add esp, 4
fld qword [ LC0]
fistp qword [esp ]
push dword 0
push dword 0
push dword 0
push dword 65535
push dword 1
call [set__position]
add esp, 24
leave
ret

LClassType_masterforma: dd 0
LC_WCmasterforma: dd 0
LClassID_masterforma: dd 0

LC0: dq 100.00

EXTERN show_window
IMPORT show_window kmicevcl.dll
EXTERN init_class
IMPORT init_class kmicevcl.dll
EXTERN set__position
IMPORT set__position kmicevcl.dll
SECTION CODE USE32 CLASS=CODE
..start:
push ebp
mov ebp, esp
call LClassName_masterforma
push dword dword [LC_WCmasterforma]
call [show_window]
add esp, 4
leave
ret
LClassName_masterforma:
push ebp
mov ebp, esp
push dword [LClassID_masterforma]
call [init_class]
add esp, 4
fld qword [ LC0]
fistp qword [esp ]
push dword 0
push dword 0
push dword 0
push dword 65535
push dword 1
call [set__position]
add esp, 24
leave
ret

LClassType_masterforma: dd 0
LC_WCmasterforma: dd 0
LClassID_masterforma: dd 0

LC0: dq 100.00

EXTERN show_window
IMPORT show_window kmicevcl.dll
EXTERN init_class
IMPORT init_class kmicevcl.dll
EXTERN set__position
IMPORT set__position kmicevcl.dll
 

Lesen sie die antworten

#1 Jens Kallup
05/11/2010 - 16:37 | Warnen spam
Problem gefunden bzw. eliminiert:

zwischen :

mov ebp, esp
push dword [LClassID_masterforma]




sub esp, 512

vergessen.

Jens

Ähnliche fragen