Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: UserLoser. on March 28, 2005, 12:40 AM

Title: Dynamic buffer
Post by: UserLoser. on March 28, 2005, 12:40 AM
...with what I think is that GNU GPL thingy
http://www.userloser.net/files/source/clsDynamicBuffer.cls

How to use -> self explanatory but I feel the need to explain anyways.

Declare an instance (which will be used throughout this example):

Dim DynBuf As New clsDynamicBuffer


Set the buffer:

Call DynBuf.ResetBuffer(NewBufferData)


Build a buffer:

DynBuf.NextByte = &HFF
DynBuf.NextByte = &HE
DynBuf.NextWord = &H8
DynBuf.NextString = "hmm"


Add data (no null terminator follows):

Call DynBuf.AddBytes(OutData)


Pick apart the buffer:

SomeVar = DynBuf.NextByte()
SomeOtherVar = DynBuf.NextString()
SomeVariable = DynBuf.NextDword()


Grab some data by length:

Signature = DynBuf.GetBytes(128)


Get the whole buffer:

BufferData = DynBuf.Buffer()


Clear the buffer:

Call DynBuf.ResetBuffer(vbNullString)


Destroy the buffer:

Set DynBuf = Nothing


Enjoy.
Title: Re: Dynamic buffer
Post by: Newby on March 28, 2005, 02:35 AM
Noodlez told me he did something like this when he coded a VB bot. He could extract DWORDs and such out of a buffer by doing recvBuff.GetNextDWord()

It sounded neat.

Anyways, good to see you release something that will benefit others. :)
Title: Re: Dynamic buffer
Post by: dxoigmn on March 28, 2005, 02:42 AM
In the get property NextString() why increase the buffer position (m_Pos) when you don't actually find a vbNullChar?
Title: Re: Dynamic buffer
Post by: Adron on March 28, 2005, 08:18 AM
Haha, neat, you're turning people's bots into GPL software!
Title: Re: Dynamic buffer
Post by: UserLoser. on March 28, 2005, 11:38 AM
Quote from: dxoigmn on March 28, 2005, 02:42 AM
In the get property NextString() why increase the buffer position (m_Pos) when you don't actually find a vbNullChar?

Hmm, oops.  Thanks.  I kept finding small things that I overlooked which I didn't find when I was testing it right before I posted this thread.
Title: Re: Dynamic buffer
Post by: dxoigmn on March 28, 2005, 12:41 PM
Quote from: UserLoser on March 28, 2005, 11:38 AM
Quote from: dxoigmn on March 28, 2005, 02:42 AM
In the get property NextString() why increase the buffer position (m_Pos) when you don't actually find a vbNullChar?

Hmm, oops.  Thanks.  I kept finding small things that I overlooked which I didn't find when I was testing it right before I posted this thread.

Hehe, the beauty of open-source :P
Title: Re: Dynamic buffer
Post by: Newby on March 29, 2005, 10:44 AM
Quote from: Adron on March 28, 2005, 08:18 AM
Haha, neat, you're turning people's bots into GPL software!

I don't think he realized (or maybe he just overlooked) that now tons of bots that utilize this are going to have to be open-source. :P
Title: Re: Dynamic buffer
Post by: UserLoser. on March 29, 2005, 01:02 PM
Quote from: Newby on March 29, 2005, 10:44 AM
Quote from: Adron on March 28, 2005, 08:18 AM
Haha, neat, you're turning people's bots into GPL software!

I don't think he realized (or maybe he just overlooked) that now tons of bots that utilize this are going to have to be open-source. :P

So what happens if I find someone who is using this without creditting/making their product open soruce or whatever?  Can I sue them and become really rich?
Title: Re: Dynamic buffer
Post by: Newby on March 29, 2005, 01:45 PM
Quote from: UserLoser on March 29, 2005, 01:02 PM
So what happens if I find someone who is using this without creditting/making their product open soruce or whatever?

Violations of the GPL, LGPL, and GFDL (http://www.gnu.org/licenses/gpl-violation.html)

Taken from the page: Licenses (http://www.gnu.org/licenses/licenses.html)