Hi Thomas,

In GUID.py, _CoTaskMemFree is defined as oledll.ole32.CoTaskMemFree. While oledll is fine for most ole32 functions (as they return HRESULT), CoTaskMemFree is an exception and has a return type of void. In Windows 7, it seems that this does matter; the return value is sometimes -65535, which raises an exception due to a non-0 HRESULT. This is similar to the issue with ITypeLib::ReleaseTLibAttr.

Btw, I saw this exception as a result of line 44 (in GUID.__unicode__):
_CoTaskMemFree(p)

I have attached a patch to fix this.

Thanks.

Jamie

--
James Teh
Email/MSN Messenger/Jabber: ja...@jantrid.net
Web site: http://www.jantrid.net/
Index: comtypes/GUID.py
===================================================================
--- comtypes/GUID.py    (revision 537)
+++ comtypes/GUID.py    (working copy)
@@ -15,7 +15,7 @@
 _ole32 = oledll.ole32
 
 _StringFromCLSID = _ole32.StringFromCLSID
-_CoTaskMemFree = _ole32.CoTaskMemFree
+_CoTaskMemFree = windll.ole32.CoTaskMemFree
 _ProgIDFromCLSID = _ole32.ProgIDFromCLSID
 _CLSIDFromString = _ole32.CLSIDFromString
 _CLSIDFromProgID = _ole32.CLSIDFromProgID
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to