https://git.reactos.org/?p=reactos.git;a=commitdiff;h=36a35ee203e1121a07b89…
commit 36a35ee203e1121a07b8960c3566b01882b0d423
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sat Aug 5 21:23:21 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sat Aug 5 21:23:21 2023 +0900
[ATL] CImage: Hack fix for getting filter string (#5528)
- Fix the crash on opening/saving file.
- To get the filename extension info from CODECs, we have to keep gdiplus.dll loaded.
- The perfect fix will take time.
CORE-19093, CORE-19094
---
sdk/lib/atl/atlimage.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sdk/lib/atl/atlimage.h b/sdk/lib/atl/atlimage.h
index 236defea834..bbf7dc6a115 100644
--- a/sdk/lib/atl/atlimage.h
+++ b/sdk/lib/atl/atlimage.h
@@ -811,6 +811,7 @@ public:
DWORD dwExclude = excludeDefaultLoad,
TCHAR chSeparator = TEXT('|'))
{
+ CImage dummy; // HACK: Initialize common
UINT cDecoders = 0;
Gdiplus::ImageCodecInfo* pDecoders = _getAllDecoders(cDecoders);
HRESULT hr = BuildCodecFilterString(pDecoders,
@@ -831,6 +832,7 @@ public:
DWORD dwExclude = excludeDefaultSave,
TCHAR chSeparator = TEXT('|'))
{
+ CImage dummy; // HACK: Initialize common
UINT cEncoders = 0;
Gdiplus::ImageCodecInfo* pEncoders = _getAllEncoders(cEncoders);
HRESULT hr = BuildCodecFilterString(pEncoders,
@@ -1057,6 +1059,7 @@ protected:
// Deprecated. Don't use this
static const GUID *FileTypeFromExtension(LPCTSTR dotext)
{
+ CImage dummy; // HACK: Initialize common
UINT cEncoders = 0;
Gdiplus::ImageCodecInfo* pEncoders = _getAllEncoders(cEncoders);
@@ -1111,6 +1114,7 @@ protected:
// Deprecated. Don't use this
static bool GetClsidFromFileType(CLSID *clsid, const GUID *guid)
{
+ CImage dummy; // HACK: Initialize common
UINT cEncoders = 0;
Gdiplus::ImageCodecInfo* pEncoders = _getAllEncoders(cEncoders);
*clsid = FindCodecForFileType(*guid, pEncoders, cEncoders);
@@ -1120,8 +1124,6 @@ protected:
static Gdiplus::ImageCodecInfo* _getAllEncoders(UINT& cEncoders)
{
- CImage image; // Initialize common
-
UINT total_size = 0;
GetCommon().GetImageEncodersSize(&cEncoders, &total_size);
if (total_size == 0)
@@ -1141,8 +1143,6 @@ protected:
static Gdiplus::ImageCodecInfo* _getAllDecoders(UINT& cDecoders)
{
- CImage image; // Initialize common
-
UINT total_size = 0;
GetCommon().GetImageDecodersSize(&cDecoders, &total_size);
if (total_size == 0)