From bcc64101562cb85de532cd03cfb19b0cfb90af8b Mon Sep 17 00:00:00 2001
From: George Hazan <george.hazan@gmail.com>
Date: Tue, 9 Apr 2024 11:13:35 +0300
Subject: =?UTF-8?q?fixes=20#4339=20(Telegram:=20=D1=81=D0=BA=D0=B0=D1=87?=
 =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D1=8B=D0=B9=20=D0=BE=D0=B1=D0=BB=D0=B0=D1=87?=
 =?UTF-8?q?=D0=BD=D1=8B=D0=B9=20=D1=84=D0=B0=D0=B9=D0=BB=20=D0=BD=D0=B5=20?=
 =?UTF-8?q?=D1=83=D0=B4=D0=B0=D0=BB=D1=8F=D0=B5=D1=82=D1=81=D1=8F,=20?=
 =?UTF-8?q?=D0=BA=D0=BE=D0=B3=D0=B4=D0=B0=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5?=
 =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B8=D0=BD=D0=B8=D1=86=D0=B8=D0=B8=D1=80?=
 =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=BE=20=D1=81=D0=B5=D1=80=D0=B2=D0=B5?=
 =?UTF-8?q?=D1=80=D0=BE=D0=BC)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 plugins/NewStory/src/webpage.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'plugins/NewStory')

diff --git a/plugins/NewStory/src/webpage.cpp b/plugins/NewStory/src/webpage.cpp
index a85d0587a9..376a59b1f0 100644
--- a/plugins/NewStory/src/webpage.cpp
+++ b/plugins/NewStory/src/webpage.cpp
@@ -663,7 +663,13 @@ uint_ptr NSWebPage::get_image(LPCWSTR url_or_path, bool)
 	if (!mir_wstrncmp(url_or_path, L"file://", 7))
 		url_or_path += 7;
 
-	auto *pImage = new Gdiplus::Bitmap(url_or_path);
+	IStream *pStream = 0;
+	HRESULT hr = SHCreateStreamOnFileEx(url_or_path, STGM_READ | STGM_SHARE_DENY_NONE, 0, FALSE, 0, &pStream);
+	if (!SUCCEEDED(hr))
+		return 0;
+
+	auto *pImage = new Gdiplus::Bitmap(pStream);
+	pStream->Release();
 	if (pImage->GetLastStatus() != Ok) {
 		delete pImage;
 		return 0;
-- 
cgit v1.2.3