Write Memory-mapped file in application error?

Apr 17, 2008 at 1:56 PM
Dear Mr.DBoling:
I read your code and see the the comment said:" // The nice way would be to just have a buffer converted into a stream but its late and I don't have the time. Exercise left to the reader...".
I try to modify your code in order to drive my camera.Lucky!I sucess.:),However, the fps is 1 in the 640x480 on my s3c2410 platform.So I want to improve efficiency of the application. I remove the code of copying image data from the MM file to local heap.it is like this now.
In the driver:
rc = AllocMMObject(sizeof(VIDSTREAMSTRUCT) +
((pSPC.dwMaxVideoFrameSize 126) * 6+ (6-1)*sizeof(FRAMEBUFFSTRUCT)),
for (DWORD i = 0; i < 6; i++)
(*ppstrStream)->pFramei.pBuff = lpUsbDC->mmFrameBuff.p + // Start of mm object
sizeof (VIDSTREAMSTRUCT) + // Stream struct size
((6-1) * sizeof(FRAMEBUFFSTRUCT)) + // Size of ptr array after structure
((pSPC.dwMaxVideoFrameSize12) * i6); // Size of each buffer inc post buff

// Dump the buffer locations for debugging
DEBUGMSG(ZONE_INIT, (TEXT("MM buffer at 0x%0x\r\n"), (*ppstrStream)->pFramei.pBuff));
In the application:
PBYTE pLocal = pData-12-6;
memcpy (pLocal, MJPG2JPGHdr, sizeof (MJPG2JPGHdr));
hr = CreateStreamOnHGlobal(pLocal, TRUE, &pStream); //application crack while running here.
Dose the MM file cannot write ?
I can't work out this problem .Could Someone help me ?
Thanks in advance .
postscript:I'm very sorry about my bad English.