From ecc5e99b6c844c13d9312daa22a62394baf0f2c8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 29 Aug 2014 23:22:00 +0000 Subject: [PATCH] Ensure OLE is initialized in wxFileName::GetShortcutTarget(). If it isn't, the function doesn't risk to work. This is especially pernicious because OLE is initialized on startup in GUI applications, but not in the console ones only using wxBase, so this function can, completely unexpectedly, give different results in them. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77508 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/filename.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/filename.cpp b/src/common/filename.cpp index 2a91061555..d77cd25235 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -102,6 +102,7 @@ #include "wx/msw/private.h" #include // for CLSID_ShellLink #include "wx/msw/missing.h" + #include "wx/msw/ole/oleutils.h" #endif #if defined(__WXMAC__) @@ -1661,6 +1662,9 @@ bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, if (ext.CmpNoCase(wxT("lnk"))!=0) return false; + // Ensure OLE is initialized. + wxOleInitializer oleInit; + // create a ShellLink object hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*) &psl);