Autor Beitrag
goose
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 93



BeitragVerfasst: Mi 07.09.05 02:03 
Hallo,

jetzt hats mich so richtig erwischt.
Soweit gehts ein bischen voran mit eurer Hilfe und viel viel Zeit und ausprobieren.

Aber damit komm ich nu wirklich nicht klar :

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
// send the request 
   __asm 
   {      push eax 
         call next 
      next: pop eax 
         mov dwError,eax 
         pop eax 
   } 
   *((DWORD *) m_pView) = dwError;  // DWORD


Also wie ich das nach Delphi bekomme hab ich schon rausbekommen,
aber da kommt ne Fehlermeldung das "next" ein undefinierter Bezeichner is ???

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
  asm
      push eax
      call next
    next: pop eax
      mov dwError,eax
      pop eax
  end;
DWORD(m_pView) := dwError;


Oder mach ich da irgendwas falsch ?
Ob die letzte Zeile so hundertprozentig richtig ist weiss ich auch noch nicht.
Jedenfalls meckert da Delphi erst mal nicht.

Kann mir hier mal jemand helfen ?
Hoffe Ihr seit nicht auch so Ratlos wie ich ?

Danke
Matthias

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
Moderiert von user profile iconraziel: Topic aus Sonstiges verschoben am Mi 07.09.2005 um 09:57
Allesquarks
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 510

Win XP Prof
Delphi 7 E
BeitragVerfasst: Mi 07.09.05 10:52 
So wie ich das sehe ist, ist das next ein Label also eine Sprungaddresse. In Delphi wird das glaube ich über ein @@next: gemacht. Was mich wundert ist, dass das Label über call aufgerufen wird und dann auch direkt dahinter steht.
DBR
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 46



BeitragVerfasst: Mi 07.09.05 21:08 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
asm  
      push eax  
      call @next  
    @next: pop eax  
      mov dwError,eax  
      pop eax  
  end;  
DWORD(m_pView) := dwError;


aber den praktischen Nährwert sehe ich nicht, denn

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
asm  
      mov dwError,eax  
      pop eax  
  end;  
DWORD(m_pView) := dwError

wäre doch das gleiche
SMO
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 120
Erhaltene Danke: 18


D2005 Personal
BeitragVerfasst: Do 08.09.05 00:58 
Nein. So ist es korrekt, man beachte die Kommentare:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
  asm
    push eax           // ursprünglichen Wert von eax sichern
    call @next         // Rücksprungadresse, hier gleich Adresse von @next
                       // wird auf den Stack gelegt
  @next:
    pop eax            // Adresse von @next vom Stack holen
    mov dwError,eax    // und in der Variable dwError speichern
    pop eax            // ursprünglichen Wert von eax wiederherstellen
  end;
PDWORD(m_pView)^ := dwError;


Über den Sinn dieses Codeschnipsels lässt sich streiten. In Delphi muss man den ursprünglichen Wert von eax gar nicht sichern, und die Adresse von @next bekommt man auch anschaulicher mit "mov eax,offset @next".
goose Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 93



BeitragVerfasst: Do 08.09.05 01:07 
Hallo zusammen,

ich danke Euch allen für Eure Hilfe !!!

Ich habs jetzt so und es geht. Ob das nun Sinnvoll oder ob da irgendwelche anweisungen doppelt oder sinnlos sind kann ich nicht sagen. Bin ja froh das das geht.
mov, pop, push, keine Ahnung was das ganze bewirkt.
Ich hab mit Delphi erst vor etwa 1- 1/5 Jahren angefangen und bin schon froh das ich damit ein bischen zurecht komme. Wie man sieht hab ich auch die ganze Zeigersache noch nicht so richtig begriffen, aber ich lerne es irgendwann, da bin ich sicher !
Ich geb einfach nicht auf bis ich ein Lösung für ein Problem gefunden habe und damit bin ich bisher immer gut gefahren :-)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
  asm
    push eax
    call @next
  @next:
    pop eax
    mov dwError,eax
    pop eax
  end;
  PDWORD(m_pView)^ := dwError;


Also so geht es jetzt. Warum auch immer :-)

DANK EUCH NOCHMAL !!!
Matthias
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Do 08.09.05 01:31 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
  asm  
    call @next  
    @next:
    pop dword ptr [dwerror]  
  end;


das ist bisl kürzer

und @SMO das wird schon seinen sinn haben

denn ein

ausblenden Delphi-Quelltext
1:
mov eax, offset @next					


ist statisch, die funktion kann dynamisch aufgerufen werden, denk e mal das ist für einen execrypter oder packer oder sowas

das ganze in asm:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
  asm  
    push ecx
    push eax
    call @next  
    @next:
    pop eax    
    mov dword ptr [dwerror], eax 
    mov ecx, dword ptr [m_pView]
    mov [ecx], eax
    pop eax
    pop ecx
  end;

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit