ok, it's vbasic again, but i really mean it. the following program tries to load "msvbvm60.dll" (should work), get the address for "rtcInputBox" (should work too), and then call that function with parameters. !but: when i call it, the programs exits with a page fault. i guess this is due to false parameters passing. does anybody know how to solve this problem? is there something with the number of parameters or the type of them?
PLEASE help!!!!! i want to get it.
.386

.model flat, stdcall
option casemap: none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib

.data
hMsg HINSTANCE 0 ; contains handle of library
iProc dd 0 ; address of function
;
szDll db "msvbvm60", 0 ; name of library
szProc db "rtcMsgBox", 0 ; name of function
szTText db "Text", 0 ; message prompt
szTCapt db "Caption", 0 ; message caption
;

.code

main:

push offset szDll ;
call LoadLibrary ; try to load "MSVBVM60.DLL"
cmp eax, 0 ;
jz @error ; if eax==0 -> fail
mov hMsg, eax ; else store handle

push offset szProc ; function
push hMsg ; handle to library
call GetProcAddress ; get address
cmp eax, 0 ;
jz @error ; if eax==0 -> fail
mov iProc, eax ; store address

push 0 ; msg-type
push offset szTCapt ; msg-caption
push offset szTText ; msg-prompt
push 0 ; owner handle
call MessageBoxA ; success confirmation thru user32.dll

;; ---------------------------------------------------
;; the following piece of code causes an error and brings
;; up the debug window: page fault in msvbvm60.dll
;;
push offset szTCapt ; message caption
push 48 ; message type
push offset szTText ; message prompt
call [iProc] ; call rtcMsgBox
;;
;; ---------------------------------------------------

push hMsg ;
call FreeLibrary ; free handle to "MSVBVM60.DLL"

jmp @end

@error:
jmp @end

@end:
push 0
call ExitProcess ; exit program

end main
Posted on 2002-09-12 12:44:59 by ploptor
I see more errors than sense in your code. :rolleyes:
Posted on 2002-09-12 13:09:31 by bazik
name them!!! for god's sake .... i don't need to be told there are errors -- tell me where they are!
Posted on 2002-09-12 13:21:51 by ploptor
Afternoon, ploptor.

Shouldn't ...
szDll db "msvbvm60", 0 ; name of library

be...
szDll db "msvbvm60.dll", 0 ; name of library

?

Also...can VB dlls actually be called just like normal dlls? I was under the impression that they're only used be the VB virtual machine? (note: I really wouldn't have a clue regarding this :grin: ).

Cheers,
Scronty
Posted on 2002-09-12 16:43:44 by Scronty
vb6 runtime dlls do export just like any other dll. I once saw a C program that was written almost entirely against the vbm6 dll to handle it's memory allocation and pointers and some of it's internal COM memory as well. not a very easy to understand program but it was internesting. I've used a utility to intercept thec ompile process for VB only to see it actually uses the C3 and ML compiler that exports to assembly and compiled by masm. The c3 compiler with the /basic command line option. However, this isn't a feat I'd have interst in to use the vbm6.dll in my own applications.


Thanks,
_Shawn
Posted on 2002-09-12 16:53:33 by _Shawn
Scronty,
If no file name extension is specified in the lpFileName parameter, the default library extension .dll is appended.
Posted on 2002-09-12 17:11:58 by bitRAKE
Afternoon, ploptor.

Sorry. It seems this messageboard has decided to become "elitist", and members would rather ridicule and insult other members' comments, rather than actually help someone (yourself) learn to use win32 assembly programming.

Cheers,
Scronty
Posted on 2002-09-12 17:25:16 by Scronty
Scronty, I don't think there was any ridicule ment by bitRAKE, but, eh, bazik that was a bit uncalled for. :( .

Ploptor, I'm only sorry I haven't played with VB to help you, but perhaps if the routines are stdcall then by looking at the number following the procedure name you could figure out how many parameters to pass, i.e. the number divided by 4. :)
Posted on 2002-09-12 18:22:01 by Eóin
Im making a wild guess here but the VB function might be expecting unicode strings?


Bazik - I see more errors than sense in this statement. In fact I see very few errors in the code.
Posted on 2002-09-12 22:48:05 by huh

Scronty, I don't think there was any ridicule ment by bitRAKE.
Nothing negive intended by my post Scronty. Guess it didn't really contribute anything to the topic - sorry.
Posted on 2002-09-13 00:37:08 by bitRAKE
@_Shawn:
I once saw a C program that was written almost entirely against the vbm6 dll to handle it's memory allocation and pointers and some of it's internal COM memory as well. not a very easy to understand program but it was internesting


do you still have that program? or could you tell me where i can find it?
Posted on 2002-09-13 04:04:43 by ploptor
ploptor,

using the VB runtime is probably more complex than you think, I have never seen a published set of functions and it is not an open interface so you may be stuck with searching for stuff that is just not generally available.

There is no problem using LoadLibrary(), GetProcAddress(), FreeLibrary() but having a documented interface to reliably call the functions is necessary to be able to use the DLL.

Is there some particular reason why you want to use the VB runtime DLL ?

Regards,

hutch@movsd.com
Posted on 2002-09-13 04:45:02 by hutch--

Is there some particular reason why you want to use the VB runtime DLL ?


Thats why I posted my reply above :)
Posted on 2002-09-13 10:02:54 by bazik
to bazik:

I see more errors than sense in your code.


Would you please tell us the many errors of ploptors code, bazik?
Posted on 2002-09-13 12:22:03 by japheth
I admit I discovered the same as Scronty which was not a real error :)
Anyway, IMHO its senseless to use MSVBVM60.dll from assembly :)
Posted on 2002-09-13 12:31:40 by bazik

Anyway, IMHO its senseless to use MSVBVM60.dll from assembly :)
In a sense that is an error. :) But if that is what he really wants to do, I am sure there is a way.
Posted on 2002-09-13 15:02:32 by bitRAKE
bazik, as I have already told you: you should be more reserved in your responses. If you cant help you should consider to resign as mod.
Posted on 2002-09-14 02:30:11 by japheth
somebody should start h4xoring MSVBVM60.dll or maybe ask help with SysInternals(they have a good job on "documenting" undocumented functions) or send billions of emails to Microsoft to create a documentation for this. :)

/me I don't have the time to do this. I have a job, school...
Posted on 2002-09-14 02:37:42 by stryker
What does the VB Library provide that this community can't?
Posted on 2002-09-14 04:32:03 by eet_1024

What does the VB Library provide that this community can't?


bloat.
Posted on 2002-09-14 04:53:25 by bazik