English
Assembler Forum

ASM: StdCall with discretionary many Parameters

 
- Page 1 -



Uwe
''Pascal''
Niemeier
Hi people!

in the hope, that here the a or others ASM-Kenner mitliest, place I time 'ne question:

I Search a Possibility, a StdCall-function with discretionary many Parameters aufzurufen.
the the fundamentally possible is, shows this Snippet:
TestX proc ;----------------------------------------------------
push ebp
mov eax,ebp
sub eax,esp
sub eax,64
pop ebp

.IF eax==4

    ret 4

.ELSEIF eax==8

    ret 8

.ELSEIF eax==12

    ret 12

.ELSEIF eax==16

    ret 16

.ENDIF

TestX endp;-----------------------------------------------------

the works sowohl as function in a dll as well as as "Embedded ASM" directly in Profan:
window 800,600
declare a#:dim a#,48
long a#,0=734366549,1088979908,83395421,79824245
long a#,16=-2095256832,91556088,-352319294,217613074
long a#,32=214041973,-2096567552,58003704,4290
print call(a#,1)
print call(a#,1,2)
print call(a#,1,2,3)
print call(a#,1,2,3,4)
waitinput

now think I but, it ought to too plainer and universeller weg, because one through verbiegen of Pointern with a einfachen RET auskommt and itself whom Bandwurm of IF-inquire save can (RET accepted Yes no tab as Parameter).
stand there though something on the Hose, what Stack-Manipulationen concerns.

can someone help?

[OFFTOPIC]BTW: @ iF: Hab's somehow not hingekriegt, this Posting under "Assembler" to take off [/OFFTOPIC]


SeeYou
Pascal
 
11/05/10  
 



« this Posting watts as Solution marked. »

Hello Uwe, is been successful...

or.

or.

term fehlerfrei tested under 32bit WinXP XProfan 11.

one must hold The Rücksprungandresse secure and these to künstlichem reduce the Stacks on the new Stackposition take off.

would be me forward if you so something begin can.
 
11/05/10  
 



I faith I know already How to the ... I teste the today evening same time and report. (without Ifs, creep and jmp eax*anything else)

[OFFTOPIC]Have whom Topic by DB to Assembler moved. as i even probierte here in under Assembler Topics To produce (too gleichnamige) funktionierte the free from problems. What exactly was happens the itself the Topic not take off let?[/OFFTOPIC]
 
11/05/10  
 



Hello Uwe, is been successful...

or.

or.

term fehlerfrei tested under 32bit WinXP XProfan 11.

one must hold The Rücksprungandresse secure and these to künstlichem reduce the Stacks on the new Stackposition take off.

would be me forward if you so something begin can.
 
11/05/10  
 




Uwe
''Pascal''
Niemeier
Hi iF!

class! skin there!

The function should always only a konstanten worth give back, but even with discretionary many Parameters, independent of its Content.

i will from it a universelle Dummy-function for OLE-Interfaces basteln (was Yes clear )
unfortunately works even the still not, probably because straight there my Berechnung the Rücksprungadresse/Parameterzahl not is correct. but the wars I out...

thanks for your Help!

PS: If you this reads has the Posting worked

SeeYou
Pascal
 
11/07/10  
 



Juhu ^^

Stumpf said reichts apparently if on the Funktionkopf
standing around the Stack for ret 0 To präparieren with alike How many Params.
 
11/07/10  
 




Uwe
''Pascal''
Niemeier
Nachtrag @ iF:

withal your Solution I will these engineering well not use can
apparently can it vorkommen, that the Aufrufer ( in my case Windows itself, the The modes of my Interfaces aufruft ) to the Funktionsaufruf values for Eigenbedarf on the Stack pusht, The none as Parameter for function vorgesehen are.
and so is the Parameterberechnung through ebp less esp  frail
means is it furthermore necessary, for each Parameterzahl a Own Dummy-function bereitzustellen. but whom attempt war's worth!

SeeYou
Pascal
 
11/10/10  
 



Sorry, there have I ad hoc too no idea - particularly if The Aufruferfunktion too with the Stack werkelt.

I could me yet present the "Win" The difference in such drop in a tab mitliefert or by Stack - there a dependence herauszufummeln is certainly quite "irre".
 
11/10/10  
 



though...

If you time lauter Longs of Stack simply impudent in a Debugviewer puschst ...

vlt. works Yes if one More as only 1 Long zurücksichert.
 
11/10/10  
 




Uwe
''Pascal''
Niemeier
Hi iF!

I faith meanwhile not any more, that the whole machbar is:
Each method has now time a solid amount Parameter, and derjenige, the The modes provides (and therefore goes it Yes), has even for worry To carry, that these Parameter correctly machine go. Why ought to itself M$ The to give trouble, these amount somewhere incorporate? And if, would it even undokumentiert and so seeeehr tipsily...The Idea with the MultiParameter-method is Yes on my Mist grown
Also holds itself the hoisted with the recent engineering too in Grenzen; here a Version the OLE-RTF-Controls:
window 800,600
 $H windows.ph
 $H RichEdit.ph
usermessages 16'--WM_CLOSE
def StgCreateDocfileOnILockBytes(4) !"ole32","StgCreateDocfileOnILockBytes"
def CreateILockBytesOnHGlobal(3) !"ole32","CreateILockBytesOnHGlobal"
def &NI $80004001'--hardship Implemented
def &OK 0'----------OK

proc CreateIMD'---------------------------------------InterfaceMethodDummy

    var a&=~GlobalAlloc(0,8)
    byte a&,0=$B8'-------mov eax,&(2)
    long a&,1=&(2)'------Return: pretended Constant
    byte a&,5=$C2'-------ret &(1)*4+4
    word a&,6=&(1)*4+4'--amount Parameter * 4 + "This"-Pointer
    return a&'-----------finished function in memory
    '--PS: with a couple NOP's to that move the Placeholder fits everything in 1 row with 4 LongInts

endproc'------------------------------------------------------------------

proc GetNewStorage'------------------------------------------GetNewStorage

    parameters IFace&,IStorage&
    declare ILockBytes&
    CreateILockBytesOnHGlobal(0,1,addr(ILockBytes&))
    StgCreateDocfileOnILockBytes(ILockBytes&,$1012,0,IStorage&)
    call(long(long(ILockBytes&,0),8),ILockBytes&)'--ILockBytes::Release
    return &OK

endproc'------------------------------------------------------------------

declare VTable#:dim VTable#,60'-----------------------IRichEditOleCallback-interface
long VTable#, 0=CreateIMD(1,&NI)'-------------QueryInterface
long VTable#, 4=CreateIMD(0,&NI)'-------------AddRef
long VTable#, 8=CreateIMD(0,&NI)'-------------Release
long VTable#,12=procaddr("GetNewStorage",2)'--GetNewStorage
long VTable#,16=CreateIMD(3,&NI)'-------------GetInPlaceContext
long VTable#,20=CreateIMD(1,&NI)'-------------ShowContainerUI
long VTable#,24=CreateIMD(3,&OK)'-------------QueryInsertObject
long VTable#,28=CreateIMD(1,&NI)'-------------DeleteObject
long VTable#,32=CreateIMD(5,&OK)'-------------QueryAcceptData
long VTable#,36=CreateIMD(1,&NI)'-------------ContextSensitiveHelp
long VTable#,40=CreateIMD(3,&NI)'-------------GetClipboardData
long VTable#,44=CreateIMD(3,&NI)'-------------GetDragDropEffect
long VTable#,48=CreateIMD(4,&NI)'-------------GetContextMenu
long VTable#,52=VTable#
var IFace&=VTable#+52
var Edit&=create("richedit",%hwnd,"",20,20,500,500)
sendmessage(Edit&,~EM_SETOLECALLBACK,0,IFace&)'---EM_SETOLECALLBACK
var File$=loadfile$("RTF with Objects wählen","*.rtf")
Rtf("LoadRTF",Edit&,File$)

while 1

    waitinput
    case %umessage=16:break

endwhile

sendmessage(Edit&,~EM_SETOLECALLBACK,0,0)
destroywindow(Edit&)
dispose VTable#
'--here müßten eigendlich any modes-Dummys with ~GlobalFree() released go

was but well, time again little ASM To exercise

SeeYou
Pascal
 
11/12/10  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

8.990 Views

Untitledvor 0 min.
Jens-Arne Reumschüssel01/06/24
funkheld12/30/21
RudiB.11/13/21
p.specht05/27/20
More...

Themeninformationen

this Topic has 2 subscriber:

iF (5x)
Uwe ''Pascal'' Niemeier (4x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie