• Welcome to Valhalla Legends Archive.
 

VB6 DLL Caller without Declares

Started by l2k-Shadow, June 17, 2007, 03:13 PM

Previous topic - Next topic

l2k-Shadow

This is a little project I put together based off of the idea and code from TheMinistered's ExtraWork marshaller class.  Basically it allows you to call C/C++ dlls without the need to declare them and their functions first... it is very useful for plugins written in C but being called from VB. Thorough documentation on exactly how to call functions is included in the project, as well as example C dll to work with. Have fun. Comments/suggestions are appreciated.

http://www.instimul.com/fjaros/VB%20DLL%20Caller.zip
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

brew

neat but....

Public Sub CallRaw(ByVal LibraryPath As String, ByVal FunctionName As String, Args() As Long)
Dim hLib As Long, hFunc As Long, i As Integer
    hLib = LoadLibrary(LibraryPath)
    If hLib Then
        hFunc = GetProcAddress(hLib, FunctionName)
        If hFunc Then
            ArgsAmount = UBound(Args)
            StackConst = ((ArgsAmount + 3) * 4)
            Call DllCall(hFunc)
            [b]CallRaw = DllCall(hFunc, Args(0), Args(1), Args(2), Args(3), Args(4), Args(5), Args(6), Args(7), Args(8), Args(9), Args(10), Args(11))[/b]
        End If
        Call FreeLibrary(hLib)
        Call CopyMemory(ByVal ptrMe + 28, ptrOld, 4)
        Call GlobalFree(hMem)
    End If
End Sub

isn't this supposed to be a function..? and same with DllCall... so i tried compiling, and it even errored (thanks to option explicit). uh... also why even use option base 0/option compare binary, they're already the compiler  defaults...  ::)
good job anyways, but for some reason i think you just made this to show people how sloppy vb6 gets when trying to make something useful.... then again you have to think about how nobody on these forums use vb6. personally I think you should stop trying to port things to vb6 that were obviously ment for C/C++... you have to move on sometime, you know.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

l2k-Shadow

Change that to Call DllCall(hFunc, ..)
No it's not supposed to be a function because the asm code doesn't handle return values. It was when I was first working on it but then the returns got to be a pain in the ass so I just changed it, and forgot to change that line.

I think pushing VB6 to do things it's not meant to do is fun... also I program in C++ and understand asm, which is why I was able to write this.. this has nothing to do with me trying to not move on from VB6, although it should help out VB6 developers.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

rabbit

Quote from: brew on June 17, 2007, 04:14 PM
good job anyways, but for some reason i think you just made this to show people how sloppy vb6 gets when trying to make something useful.... then again you have to think about how nobody on these forums use vb6. personally I think you should stop trying to port things to vb6 that were obviously ment for C/C++... you have to move on sometime, you know.
Coming from someone who ONLY knows VB6, that doesn't mean much.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

brew

#4
I know more then just vb6, thank you.

And shadow, while looking at the source a little closer i noticed

    For i = 0 To ArgsAmount
        If i = 0 Then
            Call FillCode(&H8B, &H44, &H24, StackConst, &H50)
        Else
            Call FillCode(&H8B, &H44, &H24, StackConst, &H50)
        End If
    Next i

er... is there a catch here or something?
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

rabbit

Quote from: brew on June 17, 2007, 05:48 PM
I know more then just vb6, thank you.
Likely story.  You've no evidence that this is so.  Stop picking apart someone else's work like you're some kind of guru when that person is already better than you at everything.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

brew

Quote from: rabbit on June 17, 2007, 06:03 PM
Quote from: brew on June 17, 2007, 05:48 PM
I know more then just vb6, thank you.
Likely story.  You've no evidence that this is so.  Stop picking apart someone else's work like you're some kind of guru when that person is already better than you at everything.
Why don't you go fuck yourself, rabbit. I don't need "evidence" that I know more then just vb6, and whoever said that I am better then l2k-shadow and/or l2k-shadow is better then i am, to be honest, i think we're both better than you at everything. Start practicing what you preach? Mod recomendation: Scrap his posts.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

l2k-Shadow

Quote from: brew on June 17, 2007, 05:48 PM
I know more then just vb6, thank you.

And shadow, while looking at the source a little closer i noticed

    For i = 0 To ArgsAmount
        If i = 0 Then
            Call FillCode(&H8B, &H44, &H24, StackConst, &H50)
        Else
            Call FillCode(&H8B, &H44, &H24, StackConst, &H50)
        End If
    Next i

er... is there a catch here or something?

no, again a thing i forgot to remove, i also changed the determining of the stackconst, re-dl the source if you wish.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

brew

<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

rabbit

Quote from: brew on June 17, 2007, 06:31 PM
Quote from: rabbit on June 17, 2007, 06:03 PM
Quote from: brew on June 17, 2007, 05:48 PM
I know more then just vb6, thank you.
Likely story.  You've no evidence that this is so.  Stop picking apart someone else's work like you're some kind of guru when that person is already better than you at everything.
Why don't you go fuck yourself, rabbit. I don't need "evidence" that I know more then just vb6, and whoever said that I am better then l2k-shadow and/or l2k-shadow is better then i am, to be honest, i think we're both better than you at everything. Start practicing what you preach? Mod recomendation: Scrap his posts.
rofl :P
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

l2k-Shadow

#10
nvm thought i made the function results return properly but it only works when ran out of the compiler. i'll work on it more tomorrow.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

l2k-Shadow

Ok it's fixed, however, you must use different asm code to get the proper function result when running it inside the compiler and when actually compiled. I included both ways to do this in the project, the in-compiler way is commented out. Further instruction/explanation is included in DllCall() function inside clsDLLHandler.

http://www.instimul.com/fjaros/VB%20DLL%20Caller.zip
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

FuKaS

Quote from: brew on June 17, 2007, 05:48 PM
I know more then just vb6, thank you.

Just like Smarter knows "C#.NET"

Smarter

Quote from: FuKaS on June 18, 2007, 11:32 PM
Quote from: brew on June 17, 2007, 05:48 PM
I know more then just vb6, thank you.

Just like Smarter knows "C#.NET"

Can a moderator/admin please ban him? He has 1 posts (2 actually 1 is in the trash), and they've both been flaming towards myself, he's obviously only here to attempt to talk shit about me.
Since '99

BrutalNet.Net

FuKaS

Quote from: Smarter on June 19, 2007, 02:08 PM
Quote from: FuKaS on June 18, 2007, 11:32 PM
Quote from: brew on June 17, 2007, 05:48 PM
I know more then just vb6, thank you.

Just like Smarter knows "C#.NET"

Can a moderator/admin please ban him? He has 1 posts (2 actually 1 is in the trash), and they've both been flaming towards myself, he's obviously only here to attempt to talk shit about me.

And your only attempt here is to try and gain help in something you have no knowledge in doing yourself.