> + hr = IStream_Clone(image->stream, &stream); > + if (FAILED(hr))
That's odd. When does that happen? > + if (stat == Ok) > + { > + memcpy(&new_image->format, &codec->info.FormatID, sizeof(GUID)); > + free_image_data(image); > + if (image->type == ImageTypeBitmap) > + *(GpBitmap *)image = *(GpBitmap *)new_image; > + else if (image->type == ImageTypeMetafile) > + *(GpMetafile *)image = *(GpMetafile *)new_image; > + return Ok; > + } Why did you re-implement move_bitmap() ?