tags:

views:

112

answers:

0

I'm writing a program using c# to download photos from a digital camera attached to a PC running vista. The camera has a 2GB SD card with a small number of pictures on it.

So far I am able to detect the camera and enumerate the pictures, but when I try to download them to a user specified folder, I get the following exception

"Not enough quota is available to process this command, (Exception from HRESULT: 0x80070718)"

I've googled the error and there are some posts regarding Offline files. I've tried the program with offline files turned off and with it turned on with a 25 GB limit but I still get the exception. I've even tried clearing out my temp files.

The point in the code where the exception is raised is when I try to gather stats on the file stream (i.e. IStream.Stat() ) to create a data buffer before downloading the picture:

            photoAcquireObject = new PictureAcquisitionNative.PhotoAcquire();
            photoAcquire = (PictureAcquisitionNative.IPhotoAcquire)photoAcquireObject;

            errorResult = (APIErrors)photoAcquire.CreatePhotoSource(deviceId, out photoAcquireSource);

            if (errorResult != APIErrors.S_OK)
                throw new PictureAcquisitionException(errorResult.ToString());

            UInt32 itemCount = 0;
            errorResult = (APIErrors)photoAcquireSource.InitializeItemList(true, IntPtr.Zero, out itemCount);

            if (errorResult != APIErrors.S_OK)
                throw new PictureAcquisitionException(errorResult.ToString());

            for (int index = 0; index < itemCount; index++)
            {
                System.Runtime.InteropServices.ComTypes.IStream comStream = null;
                errorResult = (APIErrors)photoAcquireSource.GetItemAt((UInt32)index, out photoAcquireItem);

                if (errorResult != APIErrors.S_OK)
                    throw new PictureAcquisitionException(errorResult.ToString());

                // Get object of stream.
                errorResult = (APIErrors)photoAcquireItem.GetStream(out comStream);

                if (errorResult != APIErrors.S_OK)
                    throw new PictureAcquisitionException(errorResult.ToString());

                string itemName = null;
                errorResult = (APIErrors)photoAcquireItem.GetItemName(out itemName);

                if (errorResult != APIErrors.S_OK)
                    throw new PictureAcquisitionException(errorResult.ToString());

                if (!itemsToAcquire.Contains(itemName))
                    continue;                  

                System.Runtime.InteropServices.ComTypes.STATSTG comStreamInfo = new System.Runtime.InteropServices.ComTypes.STATSTG();

                //EXCEPTION IS RAISED HERE!!!!!!
                // Get information about retrieved stream object.
                comStream.Stat(out comStreamInfo, 0);

                byte[] bytes = new byte[comStreamInfo.cbSize];

Any help is greatly appreciated.

Thanks