• Welcome to Valhalla Legends Archive.
 

pBuffer Help

Started by Spilled, June 23, 2005, 12:46 PM

Previous topic - Next topic

shout

The void *data parameter is a pointer; not a type. What you are doing is passing a pointer to address 0, which is protected memory. To something like that, you need to make a DWORD with a value of 0, then pass the address of the DWORD to the function. Or you could make a method like this:


void pBuffer::insertDWORD(DWORD n)
{
void *tmp = _alloca(sizeof(n) + bufferlen)
CopyMemory(tmp, buffer, bufferlen);
((LPDWORD)tmp)[(bufferlen / sizeof(n))]  = n;
}


Or something like that.

I don't want to hold your hand through your entire packetbuffer making experince. Don't copy & paste my code, try to learn from it. To be honest, I haven't made a packetbuffer in C++ yet, so I don't know how trustworthy my code really is.