flat assembler
Message board for the users of flat assembler.
Index
> High Level Languages > ASM + VB |
Author |
|
revolution 04 Jun 2009, 02:36
Do you need to define in VB that a function is stdcall? Maybe you can try to modify your DLL functions to be ccall and see if VB is happy about that.
BTW: Why are there no endp's in your code? Are you using a custom set of macros? Also, enter and return are not used in the current fasm macros. Perhaps you can consider downloading the latest version? |
|||
04 Jun 2009, 02:36 |
|
bitRAKE 04 Jun 2009, 03:39
I don't remember what the "&" in VB means? In the first case it appears that an address is being sent to SubTest, and then FunctionTest returns an address? Since your FASM code is consistent, I believe the error lies elsewhere. Yet, try the following code to bypass possible macro problems:
Code: ; store dword value 99 at address on stack SubTest: mov eax,[esp+4] mov dword [eax], 99 retn 4 ; return dword value FunctionTest: mov eax, 99 retn |
|||
04 Jun 2009, 03:39 |
|
LocoDelAssembly 04 Jun 2009, 04:28
Shouldn't "Private Declare Sub SubTest Lib "myprocs.dll" (vLong As Long)" be "Private Declare Sub SubTest Lib "myprocs.dll" (ByRef vLong As Long)"?
|
|||
04 Jun 2009, 04:28 |
|
pal 04 Jun 2009, 08:53
LocoDelAssembly nah, in VB no predecessor to the argument means that it is ByRef.
The & at the end means the variable is a long variable. E.g. &H1000& is 0x1000 in long format. I'll install VB later if you haven't got it sorted. |
|||
04 Jun 2009, 08:53 |
|
mr_orche 10 Jun 2009, 02:51
revolution wrote: Do you need to define in VB that a function is stdcall? Maybe you can try to modify your DLL functions to be ccall and see if VB is happy about that. as far as i know, stdcall is the default calling convention for external DLL call in VB. i dont use endp, enter, and return in this code because i compiled this on previous version of FASM. when i compiled this code using the latest version of FASM, i convert this to use endp, enter and return. but the problem still persist, VB still says "Bad DLL calling convention." |
|||
10 Jun 2009, 02:51 |
|
mr_orche 10 Jun 2009, 02:55
bitRAKE wrote: I don't remember what the "&" in VB means? In the first case it appears that an address is being sent to SubTest, and then FunctionTest returns an address? Since your FASM code is consistent, I believe the error lies elsewhere. Yet, try the following code to bypass possible macro problems: the "&" suffix means a long integer data type. ok i would try this code. |
|||
10 Jun 2009, 02:55 |
|
mr_orche 10 Jun 2009, 02:58
more suggestion plz
|
|||
10 Jun 2009, 02:58 |
|
MSWarrior 10 Jun 2009, 07:06
Actually the problem comes from that you must save the edi register before changing it. Try changing this code only to test if it's working:
Code: proc SubTest, lngvalue enter mov ecx,edi mov edi, [lngvalue] mov eax, 99 mov [edi+0], eax mov edi,ecx return or use the bitRAKE's version, it is working as expected without problems. |
|||
10 Jun 2009, 07:06 |
|
pal 10 Jun 2009, 07:22
If you are gonna use enter then don't you need to use leave otherwise you screw up the stack. Plus the proc macro will do an enter for you anyway and the end of the proc bit will do the leave, so enter is not needed either way.
|
|||
10 Jun 2009, 07:22 |
|
revolution 10 Jun 2009, 07:31
pal wrote: If you are gonna use enter then don't you need to use leave otherwise you screw up the stack. Plus the proc macro will do an enter for you anyway and the end of the proc bit will do the leave, so enter is not needed either way. |
|||
10 Jun 2009, 07:31 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.