So, I came up with this bizarre idea. I copy only the IExtractIcon{A,
W} interfaces from Wine's shlobjidl.idl file and create a dummy
shobj.idl file in mingw-w64. Then I generate the header file and
replace the generated interface to our shlobj.h file manually
**without deleting other things**. Now LRN's example code compiles
fine. I have tentatively attached the patch.
From 2195459621ed895f8bcfeb8d2a8456963a3b4ce8 Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <[email protected]>
Date: Fri, 8 Jan 2021 10:50:09 +0530
Subject: [PATCH 1/2] headers: Add shlobj.idl for IExtractIcon only.
Signed-off-by: Biswapriyo Nath <[email protected]>
---
mingw-w64-headers/include/shlobj.idl | 89 ++++++++++++++++++++++++++++
1 file changed, 89 insertions(+)
create mode 100644 mingw-w64-headers/include/shlobj.idl
diff --git a/mingw-w64-headers/include/shlobj.idl
b/mingw-w64-headers/include/shlobj.idl
new file mode 100644
index 0000000..b179691
--- /dev/null
+++ b/mingw-w64-headers/include/shlobj.idl
@@ -0,0 +1,89 @@
+cpp_quote("/**")
+cpp_quote(" * This file is part of the mingw-w64 runtime package.")
+cpp_quote(" * No warranty is given; refer to the file DISCLAIMER within this
package.")
+cpp_quote(" */")
+cpp_quote("")
+
+/*
+ * WARNING: THIS IS A DUMMY FILE, AT LEAST FOR NOW.
+ * DO NOT REGENERATE HEADER FILE FROM THIS IDL FILE.
+*/
+
+import "objidl.idl";
+import "oleidl.idl";
+import "oaidl.idl";
+import "wtypes.idl";
+
+cpp_quote("#define GIL_OPENICON 0x0001")
+cpp_quote("#define GIL_FORSHELL 0x0002")
+cpp_quote("#define GIL_ASYNC 0x0020")
+cpp_quote("#define GIL_DEFAULTICON 0x0040")
+cpp_quote("#define GIL_FORSHORTCUT 0x0080")
+cpp_quote("#define GIL_CHECKSHIELD 0x0200")
+
+cpp_quote("#define GIL_SIMULATEDOC 0x0001")
+cpp_quote("#define GIL_PERINSTANCE 0x0002")
+cpp_quote("#define GIL_PERCLASS 0x0004")
+cpp_quote("#define GIL_NOTFILENAME 0x0008")
+cpp_quote("#define GIL_DONTCACHE 0x0010")
+cpp_quote("#define GIL_SHIELD 0x0200")
+cpp_quote("#define GIL_FORCENOSHIELD 0x0400")
+
+/*****************************************************************************
+ * IExtractIconA interface
+ */
+[
+ object,
+ uuid(000214eb-0000-0000-c000-000000000046),
+ pointer_default(unique),
+ local
+]
+interface IExtractIconA : IUnknown
+{
+ HRESULT GetIconLocation(
+ [in] UINT uFlags,
+ [out, size_is(cchMax)] LPSTR szIconFile,
+ [in] UINT cchMax,
+ [out] INT *piIndex,
+ [out] UINT *pwFlags);
+
+ HRESULT Extract(
+ [in] LPCSTR pszFile,
+ [in] UINT nIconIndex,
+ [out] HICON *phiconLarge,
+ [out] HICON *phiconSmall,
+ [in] UINT nIconSize );
+}
+
+/*****************************************************************************
+ * IExtractIconW interface
+ */
+[
+ object,
+ uuid(000214fa-0000-0000-c000-000000000046),
+ pointer_default(unique),
+ local
+]
+interface IExtractIconW : IUnknown
+{
+ HRESULT GetIconLocation(
+ [in] UINT uFlags,
+ [out, size_is(cchMax)] LPWSTR szIconFile,
+ [in] UINT cchMax,
+ [out] INT *piIndex,
+ [out] UINT *pwFlags);
+
+ HRESULT Extract(
+ [in] LPCWSTR pszFile,
+ [in] UINT nIconIndex,
+ [out] HICON *phiconLarge,
+ [out] HICON *phiconSmall,
+ [in] UINT nIconSize );
+}
+
+cpp_quote("typedef IExtractIconA *LPEXTRACTICONA;")
+cpp_quote("typedef IExtractIconW *LPEXTRACTICONW;")
+
+cpp_quote("#define IExtractIcon __MINGW_NAME_AW(IExtractIcon)")
+cpp_quote("#define IExtractIconVtbl __MINGW_NAME_AW_EXT(IExtractIcon,Vtbl)")
+cpp_quote("#define LPEXTRACTICON __MINGW_NAME_AW(LPEXTRACTICON)")
--
2.30.0
From 3052196849b27d4afea735c1df2acf34670adbea Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <[email protected]>
Date: Fri, 8 Jan 2021 10:50:40 +0530
Subject: [PATCH 2/2] headers: Replace IExtractIcon with widl generated
declarations.
Signed-off-by: Biswapriyo Nath <[email protected]>
---
mingw-w64-headers/include/shlobj.h | 240 +++++++++++++++++++++++++++--
1 file changed, 226 insertions(+), 14 deletions(-)
diff --git a/mingw-w64-headers/include/shlobj.h
b/mingw-w64-headers/include/shlobj.h
index be087c4..411e954 100644
--- a/mingw-w64-headers/include/shlobj.h
+++ b/mingw-w64-headers/include/shlobj.h
@@ -129,6 +129,24 @@ extern "C" {
#include <pshpack1.h>
+/* Forward declarations */
+
+#ifndef __IExtractIconA_FWD_DEFINED__
+#define __IExtractIconA_FWD_DEFINED__
+typedef interface IExtractIconA IExtractIconA;
+#ifdef __cplusplus
+interface IExtractIconA;
+#endif /* __cplusplus */
+#endif
+
+#ifndef __IExtractIconW_FWD_DEFINED__
+#define __IExtractIconW_FWD_DEFINED__
+typedef interface IExtractIconW IExtractIconW;
+#ifdef __cplusplus
+interface IExtractIconW;
+#endif /* __cplusplus */
+#endif
+
SHSTDAPI SHGetMalloc (IMalloc **ppMalloc);
SHSTDAPI_(void *) SHAlloc (SIZE_T cb);
SHSTDAPI_(void) SHFree (void *pv);
@@ -148,22 +166,216 @@ extern "C" {
#define GIL_SHIELD 0x200
#define GIL_FORCENOSHIELD 0x400
-#undef INTERFACE
-#define INTERFACE IExtractIconA
- DECLARE_INTERFACE_IID_ (IExtractIconA, IUnknown,
"000214eb-0000-0000-c000-000000000046") {
- STDMETHOD(GetIconLocation) (THIS_ UINT uFlags, PSTR pszIconFile, UINT
cchMax, int *piIndex, UINT *pwFlags) PURE;
- STDMETHOD(Extract) (THIS_ PCSTR pszFile, UINT nIconIndex, HICON
*phiconLarge, HICON *phiconSmall, UINT nIconSize) PURE;
- };
- typedef IExtractIconA *LPEXTRACTICONA;
+/*****************************************************************************
+ * IExtractIconA interface
+ */
+#ifndef __IExtractIconA_INTERFACE_DEFINED__
+#define __IExtractIconA_INTERFACE_DEFINED__
+
+DEFINE_GUID(IID_IExtractIconA, 0x000214eb, 0x0000, 0x0000, 0xc0,0x00,
0x00,0x00,0x00,0x00,0x00,0x46);
+#if defined(__cplusplus) && !defined(CINTERFACE)
+MIDL_INTERFACE("000214eb-0000-0000-c000-000000000046")
+IExtractIconA : public IUnknown
+{
+ virtual HRESULT STDMETHODCALLTYPE GetIconLocation(
+ UINT uFlags,
+ LPSTR szIconFile,
+ UINT cchMax,
+ INT *piIndex,
+ UINT *pwFlags) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Extract(
+ LPCSTR pszFile,
+ UINT nIconIndex,
+ HICON *phiconLarge,
+ HICON *phiconSmall,
+ UINT nIconSize) = 0;
-#undef INTERFACE
-#define INTERFACE IExtractIconW
- DECLARE_INTERFACE_IID_ (IExtractIconW, IUnknown,
"000214fa-0000-0000-c000-000000000046") {
- STDMETHOD(GetIconLocation) (THIS_ UINT uFlags, PWSTR pszIconFile, UINT
cchMax, int *piIndex, UINT *pwFlags) PURE;
- STDMETHOD(Extract) (THIS_ PCWSTR pszFile, UINT nIconIndex, HICON
*phiconLarge, HICON *phiconSmall, UINT nIconSize) PURE;
- };
- typedef IExtractIconW *LPEXTRACTICONW;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(IExtractIconA, 0x000214eb, 0x0000, 0x0000, 0xc0,0x00,
0x00,0x00,0x00,0x00,0x00,0x46)
+#endif
+#else
+typedef struct IExtractIconAVtbl {
+ BEGIN_INTERFACE
+
+ /*** IUnknown methods ***/
+ HRESULT (STDMETHODCALLTYPE *QueryInterface)(
+ IExtractIconA *This,
+ REFIID riid,
+ void **ppvObject);
+
+ ULONG (STDMETHODCALLTYPE *AddRef)(
+ IExtractIconA *This);
+
+ ULONG (STDMETHODCALLTYPE *Release)(
+ IExtractIconA *This);
+
+ /*** IExtractIconA methods ***/
+ HRESULT (STDMETHODCALLTYPE *GetIconLocation)(
+ IExtractIconA *This,
+ UINT uFlags,
+ LPSTR szIconFile,
+ UINT cchMax,
+ INT *piIndex,
+ UINT *pwFlags);
+
+ HRESULT (STDMETHODCALLTYPE *Extract)(
+ IExtractIconA *This,
+ LPCSTR pszFile,
+ UINT nIconIndex,
+ HICON *phiconLarge,
+ HICON *phiconSmall,
+ UINT nIconSize);
+
+ END_INTERFACE
+} IExtractIconAVtbl;
+
+interface IExtractIconA {
+ CONST_VTBL IExtractIconAVtbl* lpVtbl;
+};
+
+#ifdef COBJMACROS
+#ifndef WIDL_C_INLINE_WRAPPERS
+/*** IUnknown methods ***/
+#define IExtractIconA_QueryInterface(This,riid,ppvObject)
(This)->lpVtbl->QueryInterface(This,riid,ppvObject)
+#define IExtractIconA_AddRef(This) (This)->lpVtbl->AddRef(This)
+#define IExtractIconA_Release(This) (This)->lpVtbl->Release(This)
+/*** IExtractIconA methods ***/
+#define
IExtractIconA_GetIconLocation(This,uFlags,szIconFile,cchMax,piIndex,pwFlags)
(This)->lpVtbl->GetIconLocation(This,uFlags,szIconFile,cchMax,piIndex,pwFlags)
+#define
IExtractIconA_Extract(This,pszFile,nIconIndex,phiconLarge,phiconSmall,nIconSize)
(This)->lpVtbl->Extract(This,pszFile,nIconIndex,phiconLarge,phiconSmall,nIconSize)
+#else
+/*** IUnknown methods ***/
+static FORCEINLINE HRESULT IExtractIconA_QueryInterface(IExtractIconA*
This,REFIID riid,void **ppvObject) {
+ return This->lpVtbl->QueryInterface(This,riid,ppvObject);
+}
+static FORCEINLINE ULONG IExtractIconA_AddRef(IExtractIconA* This) {
+ return This->lpVtbl->AddRef(This);
+}
+static FORCEINLINE ULONG IExtractIconA_Release(IExtractIconA* This) {
+ return This->lpVtbl->Release(This);
+}
+/*** IExtractIconA methods ***/
+static FORCEINLINE HRESULT IExtractIconA_GetIconLocation(IExtractIconA*
This,UINT uFlags,LPSTR szIconFile,UINT cchMax,INT *piIndex,UINT *pwFlags) {
+ return
This->lpVtbl->GetIconLocation(This,uFlags,szIconFile,cchMax,piIndex,pwFlags);
+}
+static FORCEINLINE HRESULT IExtractIconA_Extract(IExtractIconA* This,LPCSTR
pszFile,UINT nIconIndex,HICON *phiconLarge,HICON *phiconSmall,UINT nIconSize) {
+ return
This->lpVtbl->Extract(This,pszFile,nIconIndex,phiconLarge,phiconSmall,nIconSize);
+}
+#endif
+#endif
+
+#endif
+
+
+#endif /* __IExtractIconA_INTERFACE_DEFINED__ */
+
+/*****************************************************************************
+ * IExtractIconW interface
+ */
+#ifndef __IExtractIconW_INTERFACE_DEFINED__
+#define __IExtractIconW_INTERFACE_DEFINED__
+
+DEFINE_GUID(IID_IExtractIconW, 0x000214fa, 0x0000, 0x0000, 0xc0,0x00,
0x00,0x00,0x00,0x00,0x00,0x46);
+#if defined(__cplusplus) && !defined(CINTERFACE)
+MIDL_INTERFACE("000214fa-0000-0000-c000-000000000046")
+IExtractIconW : public IUnknown
+{
+ virtual HRESULT STDMETHODCALLTYPE GetIconLocation(
+ UINT uFlags,
+ LPWSTR szIconFile,
+ UINT cchMax,
+ INT *piIndex,
+ UINT *pwFlags) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Extract(
+ LPCWSTR pszFile,
+ UINT nIconIndex,
+ HICON *phiconLarge,
+ HICON *phiconSmall,
+ UINT nIconSize) = 0;
+
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(IExtractIconW, 0x000214fa, 0x0000, 0x0000, 0xc0,0x00,
0x00,0x00,0x00,0x00,0x00,0x46)
+#endif
+#else
+typedef struct IExtractIconWVtbl {
+ BEGIN_INTERFACE
+
+ /*** IUnknown methods ***/
+ HRESULT (STDMETHODCALLTYPE *QueryInterface)(
+ IExtractIconW *This,
+ REFIID riid,
+ void **ppvObject);
+
+ ULONG (STDMETHODCALLTYPE *AddRef)(
+ IExtractIconW *This);
+
+ ULONG (STDMETHODCALLTYPE *Release)(
+ IExtractIconW *This);
+
+ /*** IExtractIconW methods ***/
+ HRESULT (STDMETHODCALLTYPE *GetIconLocation)(
+ IExtractIconW *This,
+ UINT uFlags,
+ LPWSTR szIconFile,
+ UINT cchMax,
+ INT *piIndex,
+ UINT *pwFlags);
+
+ HRESULT (STDMETHODCALLTYPE *Extract)(
+ IExtractIconW *This,
+ LPCWSTR pszFile,
+ UINT nIconIndex,
+ HICON *phiconLarge,
+ HICON *phiconSmall,
+ UINT nIconSize);
+
+ END_INTERFACE
+} IExtractIconWVtbl;
+
+interface IExtractIconW {
+ CONST_VTBL IExtractIconWVtbl* lpVtbl;
+};
+
+#ifdef COBJMACROS
+#ifndef WIDL_C_INLINE_WRAPPERS
+/*** IUnknown methods ***/
+#define IExtractIconW_QueryInterface(This,riid,ppvObject)
(This)->lpVtbl->QueryInterface(This,riid,ppvObject)
+#define IExtractIconW_AddRef(This) (This)->lpVtbl->AddRef(This)
+#define IExtractIconW_Release(This) (This)->lpVtbl->Release(This)
+/*** IExtractIconW methods ***/
+#define
IExtractIconW_GetIconLocation(This,uFlags,szIconFile,cchMax,piIndex,pwFlags)
(This)->lpVtbl->GetIconLocation(This,uFlags,szIconFile,cchMax,piIndex,pwFlags)
+#define
IExtractIconW_Extract(This,pszFile,nIconIndex,phiconLarge,phiconSmall,nIconSize)
(This)->lpVtbl->Extract(This,pszFile,nIconIndex,phiconLarge,phiconSmall,nIconSize)
+#else
+/*** IUnknown methods ***/
+static FORCEINLINE HRESULT IExtractIconW_QueryInterface(IExtractIconW*
This,REFIID riid,void **ppvObject) {
+ return This->lpVtbl->QueryInterface(This,riid,ppvObject);
+}
+static FORCEINLINE ULONG IExtractIconW_AddRef(IExtractIconW* This) {
+ return This->lpVtbl->AddRef(This);
+}
+static FORCEINLINE ULONG IExtractIconW_Release(IExtractIconW* This) {
+ return This->lpVtbl->Release(This);
+}
+/*** IExtractIconW methods ***/
+static FORCEINLINE HRESULT IExtractIconW_GetIconLocation(IExtractIconW*
This,UINT uFlags,LPWSTR szIconFile,UINT cchMax,INT *piIndex,UINT *pwFlags) {
+ return
This->lpVtbl->GetIconLocation(This,uFlags,szIconFile,cchMax,piIndex,pwFlags);
+}
+static FORCEINLINE HRESULT IExtractIconW_Extract(IExtractIconW* This,LPCWSTR
pszFile,UINT nIconIndex,HICON *phiconLarge,HICON *phiconSmall,UINT nIconSize) {
+ return
This->lpVtbl->Extract(This,pszFile,nIconIndex,phiconLarge,phiconSmall,nIconSize);
+}
+#endif
+#endif
+
+#endif
+
+
+#endif /* __IExtractIconW_INTERFACE_DEFINED__ */
+typedef IExtractIconA *LPEXTRACTICONA;
+typedef IExtractIconW *LPEXTRACTICONW;
#define IExtractIcon __MINGW_NAME_AW(IExtractIcon)
#define IExtractIconVtbl __MINGW_NAME_AW_EXT(IExtractIcon,Vtbl)
#define LPEXTRACTICON __MINGW_NAME_AW(LPEXTRACTICON)
--
2.30.0
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public