Hey guys


I have just about run out of ideasi have this piece of code below which is ment to copy one buffer to another.

Code:
void CMiscFunctions::CopyValueToBuffer(BYTE *pDataToCopy, BYTE *pBuffer, DWORD *dwLengthOfBuffer, DWORD dwSizeOfData)
{
	DWORD i = *dwLengthOfBuffer;
	DWORD y;
	

	
	char sTest[10];
	_ultoa(*dwLengthOfBuffer ,sTest, 10);
	AfxMessageBox(sTest);

	char sTest2[10];
	_ultoa(i ,sTest2, 10);
	AfxMessageBox(sTest2);

	
	for(y = 0; y < dwSizeOfData; y++, i++)
	{
		pBuffer[i] = pDataToCopy[y];

		if(y == 0x00000ED85)
		{
			AfxMessageBox("full");
			break;
		}

	}

	*dwLengthOfBuffer = i;

}
But it won't copy anything bigger then 59kb. I posted this before but didn't explain it very well basically it copies from pDataToCopy to pBuffer. i is the position to start copying data to in the pBuffer and y is 0 just to increment through the pDataToCopy buffer. I also put in an if statment to see what the largest value is before it crashes which is 0x00000ED85 in hex or 60805. Which seems like a very odd number to crash on to me.

Anyway all help is appreciated peter.