On 06/14/12 11:55, Yaakov (Cygwin/X) wrote:
> On 2012-06-12 03:51, Jacek Caban wrote:
>> On 06/12/12 07:06, Yaakov (Cygwin/X) wrote:
>>> On 2012-06-04 04:04, Jacek Caban wrote:
>>>> Where? I don't see any. There is one change to propkeydef.h, but and I
>>>> believe incorrect. Generally, this patch makes REFIID and similar
>>>> typedefs depend on CINTERFACE, which is not present in MSVC.
>>> According to these, it is:
>>>
>>> http://msdn.microsoft.com/en-us/library/ak5wyby1(v=vs.71).aspx
>>> http://social.msdn.microsoft.com/forums/en/vcgeneral/thread/80485378-3978-472b-ac76-a6a193cb9e47
>>> http://social.msdn.microsoft.com/Forums/en/vclanguage/thread/9e520505-5d05-4aad-83d9-a1b73042c531
>>> http://social.msdn.microsoft.com/Forums/en/vclanguage/thread/9b1b2189-c518-4cd8-80cc-2656b9c0d37f
>> If there is any source of informations more misleading than MSDN, that's
>> MSDN forums:) Why do you need that change? That's not what mingw.org
>> does
> Both mingw.org and Wine support CINTERFACE wrt the REF*ID defines.
>

Thanks for the report, I've fixed Wine [1]. About mingw.org, it's up to
them, they are aware of the bug.

I took a look at Cygwin's source to see what all this discussion is
about and the problem is easier than I expected. It's just a matter of
one CoCreateInstance call that hits the problem, so even ugly ifdefs
wouldn't hurt too much. Anyway, I don't see why you use CINTERFACE at
all. Dropping it seems like a nice clean up and will solve the problem
(C++ variants of REF*IDs are compatible in all mingw variants and MSVC,
I believe). See the attached (not even compile-tested) patch. To fix the
problem, its main.cc part is enough. mlink2.cc is just a clean up.

Cheers,
Jacek


[1]
http://source.winehq.org/git/wine.git/commitdiff/4626db2bb2a61cdceb00e0e346628062ee51aade
Index: main.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/main.cc,v
retrieving revision 2.67
diff -u -p -r2.67 main.cc
--- main.cc     3 Jun 2012 15:00:06 -0000       2.67
+++ main.cc     14 Jun 2012 21:41:14 -0000
@@ -33,7 +33,6 @@ static const char *cvsid =
 
 #undef _WIN32_WINNT
 #define _WIN32_WINNT 0x0501
-#define CINTERFACE
 #include "win32.h"
 #include <commctrl.h>
 #include "shlobj.h"
@@ -161,8 +160,8 @@ main_display ()
   // done later, in the thread which actually creates the shortcuts.
   extern IShellLink *sl;
   CoInitializeEx (NULL, COINIT_APARTMENTTHREADED);
-  HRESULT res = CoCreateInstance (&CLSID_ShellLink, NULL,
-                                 CLSCTX_INPROC_SERVER, &IID_IShellLink,
+  HRESULT res = CoCreateInstance (CLSID_ShellLink, NULL,
+                                 CLSCTX_INPROC_SERVER, IID_IShellLink,
                                  (LPVOID *) & sl);
   if (res)
     {
@@ -209,7 +208,7 @@ main_display ()
 
   // Uninitalize COM
   if (sl)
-    sl->lpVtbl->Release (sl);
+    sl->Release ();
   CoUninitialize ();
 }
 
Index: mklink2.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/mklink2.cc,v
retrieving revision 2.12
diff -u -p -r2.12 mklink2.cc
--- mklink2.cc  10 Aug 2010 20:38:00 -0000      2.12
+++ mklink2.cc  14 Jun 2012 21:41:14 -0000
@@ -1,4 +1,3 @@
-#define CINTERFACE
 #include <stdlib.h>
 #include <wchar.h>
 #include "win32.h"
@@ -29,16 +28,16 @@ make_link_2 (char const *exepath, char c
   WCHAR widepath[MAX_PATH];
   if (sl)
     {
-      sl->lpVtbl->QueryInterface (sl, &IID_IPersistFile, (void **) &pf);
+      sl->QueryInterface (IID_IPersistFile, (void **) &pf);
 
-      sl->lpVtbl->SetPath (sl, exepath);
-      sl->lpVtbl->SetArguments (sl, args);
-      sl->lpVtbl->SetIconLocation (sl, icon, 0);
+      sl->SetPath (exepath);
+      sl->SetArguments (args);
+      sl->SetIconLocation (icon, 0);
 
       MultiByteToWideChar (CP_ACP, 0, lname, -1, widepath, MAX_PATH);
-      pf->lpVtbl->Save (pf, widepath, TRUE);
+      pf->Save (pf, widepath, TRUE);
 
-      pf->lpVtbl->Release (pf);
+      pf->Release ();
     }
 }
 
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to