Accessing MSVBVM60 API [TUT]
Im reposting this here cause Ive been asked many times for this document.
This is a small tuto Ive made to explain a basic way to add some APIs and constants to your VB.
Hope you understand the basic concept and find this at least funny if not useful.
Have Funk!
Categories: Code
Thanks a lot Cobein.
I really appreciate that.
So following this GREAT tutorial instructions, one can "add" __vbaCopyBytes to VBA6.DLL and get rid of this declaration :
Private Declare Sub CopyBytes Lib "MSVBVM60" Alias "__vbaCopyBytes" (ByVal Size As Long, Dest As Any, Source As Any)
My question is :
Can we do the same with DLL's other than MSVBVM60, like kernel32 or user32
Thanks again Cobein and sorry if any of my questions appear evident to you, i am one of your beginners students :)
The problem adding something from for instance "user32" is that the compiler is gonna ignore the library, is gonna work on the IDE but after compiled is gonna fail. I strongly suggest you to learn about type libraries, thats the way to go if you want to avoid the declarations in the IDE or have a standard IAT in the final exe.
Thanks for your advices Cobein
i have some problems using your TUT with "__vbaCopyBytes" , i will prepare a document with screenshots and will uploade it, just to be clear and of course you will find some time for that
Thank s
Edit..
… and of course IF you can find some time for that …
Thanks again
Hi Cobein, Can u explain more please, we have to remod the dll or compile another way ?
Hey cobein thankz for this TUT seems pretty helpful adding constants will make a good improve while im coding btw the API's seccion of the tut is better
Hey nice tutorial Cobein,
Private Declare Sub CopyBytes Lib "MSVBVM60" Alias "__vbaCopyBytes" (ByVal Size As Long, Dest As Any, Source As Any)
In this declatarion we habe Dest as ANY and Source as ANY. Could you point me how to change parameter type to ANY in PowerVB Type Library Editor? They don't have it in Parameter Type window.
Thanks,
Astral.
oh and, how to set Parameter Types to be ByVal (as for __vbaCopyBytes we have ByVal Size as Long..)
Thanks again,
Astral.
As Any = Void
Byval is the default type of var, so don't worry about that, just set it as LONG/DWORD =P
Thanks Karcrack,
In a simple project VB Ide crashes unexpectedly. Same for RunPE…
I think I'm doing something wrong:
http://img716.imageshack.us/img716/9436/67099305….
http://img651.imageshack.us/img651/7954/71222628….
http://img220.imageshack.us/img220/7360/25884772….
Project is standard RunPE modified by you Karcrack, with only difference – CopyBytes API changed to new CoByte (as on pics)
Look at it if you'll have some spare time.
Thanks,
Astral.
Dest & Source must be same Parameter Type… [OUT] or [IN] i'm not sure, but i think is [IN]
I've put —>[in]long, [in] void *,[in] void *
i ve also create own tlb with this function but exe don't load..
What is the next point ? should i pass parameter to Link to take my function ?
The compils is good but as cobein say we have to learn more, i've read the section of Type Library in the Book "Advanced…..for everyday programing" u know but i can't understand what i do wrong….
Thank u to put me in the right way :)
Cobein and Karcrack are just my BOSS ;)
How are you call CopyBytes? Paste a call…
CopyBytes Len(Pish), Pish, lpBuffer(Pidh.e_lfn + Len(Pinh) + Len(Pish) * i)
I've also try a callAPiByName but i can't pass Pish to params….
Thx
Try this:
CopyBytes Len(Pish), byref Pish, byval varptr(lpBuffer(Pidh.e_lfn + Len(Pinh) + Len(Pish) * i))
Or:
CopyBytes Len(Pish), varptr(Pish.FIRST_ENTRY_OF_PISH), varptr(lpBuffer(Pidh.e_lfn + Len(Pinh) + Len(Pish) * i))
Good luck
Oki thank u, my first test are wrong but i will continue in ur way ;)
I'm trying to save the modified dll file but PowerVB Type Library Editor is in trial version, i can't find a full version anywhere….if someone can help me please because i need this method (avira have tagg __vbaCopyBytes). Thanks for the help and great tuto Cobein !
ok a friend have found it for me :) but now i have problem with the API, the compiled file with tlb modified is ok but when i try to run it nothing appear : what i'm doing wrong ? thanks for the help
Hey oijkn, i have found it as well, seems we missed each other :)
I am having an issue with this, perhaps someone could find my error. I modify the constants of vba6.dll, and add the vbQuote constant. I click update, and then i click save (note that it is saving to the vba6.tlb file on my desktop). I then go into peexplore and i locate my original vba6.dll file, i then replace the resource with my modified (vba6.tlb file). After saving and closing pe explore i open up VB6 and go into object Browser. Under "constants", vbQuote is not there. I have tried this many times with the same result.
Ps, i made sure that no VB6 was open while i made the changes. Any ideas?
I really need help with this, for some reason, the runpe doesnt run correctly if i use the tlb. Can anyone please help me with this?
I still cannot get this to work with your RunPE which is, cRunPE_PTR
Using __VbaCopyBytes.
It just crashes the executeable file. Is there any way you could make a working runPE for it and post it up here or Email it to me please?? It would mean alot, I look up to you.