The following workaround works with 64-bit (and I assume 32-bit) pythons:
...
VSS_ID = GUID
...
COMMETHOD([], HRESULT,
'AddToSnapshotSet',(['in'],VSS_PWSZ,'pwszVolumeName'),(['in'],POINTER(VSS_ID),'ProviderId'),(['in'],POINTER(VSS_ID),'pidSnapshot')),
...
snapshot_id = GUID()
guid_null = GUID()
vss.AddToSnapshotSet(u"c:\\", byref(guid_null), byref(snapshot_id))
...
The following (original code) only works with 32-bit python (and seems to
cause a memory stomp with 64-bit python) [here guid_null is passed by
value]:
...
VSS_ID = GUID
...
COMMETHOD([], HRESULT,
'AddToSnapshotSet',(['in'],VSS_PWSZ,'pwszVolumeName'),(['in'],VSS_ID,'ProviderId'),(['in'],POINTER(VSS_ID),'pidSnapshot')),
...
snapshot_id = GUID()
guid_null = GUID()
vss.AddToSnapshotSet(u"c:\\", guid_null, byref(snapshot_id))
...
The original code was auto-generated from a header file. Note that the
actual calling sequence for AddToSnapshotSet is the same in both cases (at
the machine level a pointer to the guid_null value is passed).
Technically, for the work around to have the same effect I should first
copy guid_null to a temporary and pass a pointer to that instead.
Peter
[EMAIL PROTECTED] schrieb:
[passing GUIDs by value works on 32-bit python but not 64-bit python (on
Vista 64)]
> Seems to stomp memory.
I'm not a native english speaker and do not understand what you mean.
Also, can you give a description or a code sample to illustrate the
problem?
Best would be if you can submit a test case.
> A work around is to declare the parameter as a POINTER(GUID) instead
> of GUID and pass a copy of the GUID instance byref [this should be
> what happens under the covers]. I'm not sure if this is a comtypes
> or ctypes issue; it likely applies to other "large" datatypes as
> well. I'm using python-2.5.2.amd64.msi,
> ctypes-1.0.2.win32-py2.5-AMD64.msi and comtypes-0.4.2.zip.
>
> Peter
--
Thanks,
Thomas
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users