dll/return value(not working) help!
ok i made a a dll, works but when i call it it does not return any values.my code is below
btw im calling it from vb
PHP Code:
.Code
dllmain Proc xcompielr:DWORD, xdamn:DWORD, xwarning:DWORD
ret
dllmain EndP
Testspeed Proc Ftime1:DWORD, Ftime2:DWORD, FtimeDIFF:DWORD
Local Ticks1 :DWORD
Local Ticks2 :DWORD
Invoke GetTickCount
mov Ticks1, eax
mov eax, 00h
loop1:
inc eax
cmp eax, 00FFFFFFh
jne loop1
Invoke GetTickCount
mov Ticks2, eax
mov eax, Ticks1
mov Ftime1, eax
mov eax, Ticks2
mov Ftime2, eax
sub Ticks1, eax
mov eax, Ticks1
mov FtimeDIFF, eax
ret
Testspeed EndP
End dllmain
Re: dll/return value(not working) help!
Okay I will do a minor re-write of the code.
The VB Declare:
Code:
Public Declare Sub Testspeed Lib "dllname" (ByRef Ftime1 As Long, ByRef Ftime2 As Long, ByRef FtimeDIFF As Long)
Note they are ByRef so that the ASM function receives a pointer to the data.
Here is the ASM code you should use:
Code:
.Code
dllmain Proc xcompielr:DWORD, xdamn:DWORD, xwarning:DWORD
ret
dllmain EndP
Testspeed Proc Ftime1:DWORD, Ftime2:DWORD, FtimeDIFF:DWORD
Local Ticks1 :DWORD
Local Ticks2 :DWORD
Invoke GetTickCount
mov Ticks1, eax
mov eax, 00h
loop1:
inc eax
cmp eax, 00FFFFFFh
jne loop1
Invoke GetTickCount
mov Ticks2, eax
mov eax, Ticks1
mov DWORD PTR [Ftime1], eax
mov eax, Ticks2
mov DWORD PTR [Ftime2], eax
sub Ticks1, eax
mov eax, Ticks1
mov DWORD PTR [FtimeDIFF], eax
xor eax, eax
ret
Testspeed EndP
End dllmain