|
-
Sep 28th, 2001, 10:59 AM
#1
Thread Starter
Lively Member
Causes Crashes
Hey Guys
Code:
void CMiscFunctions::CopyValueToBuffer(BYTE *pDataToCopy, BYTE *pBuffer, DWORD *dwLengthOfBuffer, DWORD dwSizeOfData)
{
DWORD i = *dwLengthOfBuffer;
for(DWORD y = 0; y < dwSizeOfData; y++, i++)
{
pBuffer[i] = pDataToCopy[y];
}
*dwLengthOfBuffer = i;
}
This little piece of code works fine copying one buffer to the other up to 59kb if the buffer is bigger then this the program crashes any ideas. I originally had int y not DWORD y and was convinced it was the problem but it still causes a crash.
Any Ideas
Peter
Last edited by pskyboy; Sep 29th, 2001 at 06:08 AM.
"Let's all join forces, rule with an iron hand...and prove to all the world, metal rules the land..."
-- Judas Priest
My email is [email protected]
-
Sep 28th, 2001, 12:31 PM
#2
First place I would look -
You need to use an unsigned counter & pointer datatype. Your datatype is 'rolling over'. maybe including DWORD SizeOfData.
-
Sep 29th, 2001, 08:14 AM
#3
I don't understand your usage of i. You first set it to the size of buffer, then increment it and use it as index. Or do you always supply 0 for dwLengthOfBuffer. If so, you should write i = 0; instead of i = *dwLengthOfBuffer.
I can't help you with the 59k problem. Maybe you show us the declaration of the buffers and the function call.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|