Page 1 of 1
INT64 (or double)
Posted: Tue Aug 03, 2004 11:36 pm
by tonnelier
Problem : the opentrace API function return a tracehandle which is an INT64 (not its adress). How can I do to get the value returned with PB?
Thanks in advance.
Posted: Wed Aug 04, 2004 12:19 am
by jack
perhaps someone with more knowledge will answer your question, but if you can
post a snipped that will show your problem, then i may be able to help.
i think an int64 would be returned in the registers eax:edx, so if that's the case
you may be able to save the registers to a PB variable right after the API call.

Posted: Wed Aug 04, 2004 9:18 am
by tonnelier
Example : very simple. in a program, i do h=callfunction(0,"OpenTraceA",@log) (the library is advapi32.dll).
No error (doesn't return -1), but h becomes 1, which is an invalid tracehandle.
Register : perhaps. Who knows?
Posted: Wed Aug 04, 2004 11:19 am
by Moonshine
Not really sure but heres a snippet that will convert a double to a float, if it's of any use:
Code: Select all
Structure dblout
p1.l
p2.l
EndStructure
Procedure.f Float(p1.l,p2.l)
Global _output.f
Global _dblin.dblout
_dblin\p1=p1
_dblin\p2=p2
!FLD qword[v__dblin]
!FST dword[v__output]
ProcedureReturn _output
EndProcedure
Posted: Wed Aug 04, 2004 3:19 pm
by NoahPhense
I'm not sur if this helps.. But with my iSED Lib.. It returns double an such,
have a look:
Code: Select all
Structure iSQPDouble
Hi.l
Lo.l
EndStructure
Procedure MakeiSQPDouble(LONG.f, ADDRESS.l)
!FLD dword [ Esp ]
!MOV dword Eax, [ Esp + 4 ]
!FSTP qword [ Eax ]
EndProcedure
; here is an example return
Procedure.l iSEDDrawImage(Left.f, Top.f, Width.f, Height.f)
dLeft.iSQPDouble
dTop.iSQPDouble
dWidth.iSQPDouble
dHeight.iSQPDouble
MakeiSQPDouble(Left.f, @dLeft)
MakeiSQPDouble(Top.f, @dTop)
MakeiSQPDouble(Width.f, @dWidth)
MakeiSQPDouble(Height.f, @dHeight)
ProcedureReturn CallFunctionFast(FPDrawImage, dLeft\Hi, dLeft\Lo, dTop\Hi, dTop\Lo, dWidth\Hi, dWidth\Lo, dHeight\Hi, dHeight\Lo)
EndProcedure
- np
Posted: Wed Aug 04, 2004 5:01 pm
by tonnelier
eventually, this type of thing work :
a.large_integer
a\lowpart=callfunction(...)
I think PB gives to the DLL the adress of the variable to fill in.
And for a DLL that requires only one variable a, which is a large_integer, it appears that callfunction(0,"function",a\lowpart,a\highpart) works.
Posted: Wed Aug 04, 2004 6:16 pm
by NoahPhense
tonnelier wrote:eventually, this type of thing work :
a.large_integer
a\lowpart=callfunction(...)
I think PB gives to the DLL the adress of the variable to fill in.
And for a DLL that requires only one variable a, which is a large_integer, it appears that callfunction(0,"function",a\lowpart,a\highpart) works.
Yeah, I have no idea..

I'm pretty clueless with the doubles thing..
Someday though, I might learn it.