Re: [comtypes-users] passing GUIDs by value works on 32-bit python but not 64-bit python (on Vista 64)

2008-06-19 Thread Thomas Heller
[EMAIL PROTECTED] schrieb:
> Seems to stomp memory.  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. 

It looks like a ctypes bug on Windows/AMD64, structures are not passed 
correctly by value.  I'm
looking into it but it may take a few days.

Thanks for the heads up and the nice diagnosis,
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


Re: [comtypes-users] passing GUIDs by value works on 32-bit python but not 64-bit python (on Vista 64)

2008-06-18 Thread Peter . Bumbulis
Sorry, I wasn't very clear.  With the original code, the call itself 
reports success (return code 0), but I can't verify it as attempting 
access the parameters causes an exception [eg print str(snapshot_id) 
raises "WindowsError: exception: stackoverflow" in _StringFromCLSID].  If 
I catch the exception and try to continue, I get other WindowsError 
exceptions, typically from attempting to access bad memory addresses.

Peter


[EMAIL PROTECTED] schrieb:
> The following workaround works with 64-bit (and I assume 32-bit) 
pythons:
> ...
> 
> 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]:
> ...

I understand what you mean, except I do NOT understand what 'cause a 
memory stomp' mean.
Does the code change the passed in guid_null, which you didn't expect, or 
what?

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


Re: [comtypes-users] passing GUIDs by value works on 32-bit python but not 64-bit python (on Vista 64)

2008-06-18 Thread Thomas Heller
[EMAIL PROTECTED] schrieb:
> The following workaround works with 64-bit (and I assume 32-bit) pythons:
> ...
> 
> 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]:
> ...

I understand what you mean, except I do NOT understand what 'cause a memory 
stomp' mean.
Does the code change the passed in guid_null, which you didn't expect, or what?

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


Re: [comtypes-users] passing GUIDs by value works on 32-bit python but not 64-bit python (on Vista 64)

2008-06-18 Thread Peter . Bumbulis
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


Re: [comtypes-users] passing GUIDs by value works on 32-bit python but not 64-bit python (on Vista 64)

2008-06-18 Thread Thomas Heller
[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


[comtypes-users] passing GUIDs by value works on 32-bit python but not 64-bit python (on Vista 64)

2008-06-18 Thread Peter . Bumbulis
Seems to stomp memory.  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-
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