[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

ReadMultiple OLE Structured Storage interop fails under 64-bit

John Levin

4/23/2007 5:37:00 AM

I'm trying to port Edanmo's OLE Storage class
(http://www.mvps.org/emorcillo/en/code/grl/sto...) to x64. After my
modifications, it still works fine under x86. However, I'm getting a
mysterious error when I try to call ReadMultiple on my IPropertyStorage
object under x64: "No mapping for the Unicode character exists in the target
multi-byte code page. (Exception from HRESULT: 0x80070459)".

Here's the calling code:
Dim PROP As PROPSPEC
Dim value As Edanmo.OleStorage.ComDefs.Variant

PROP.ulKind = PRPSPEC.PRSPEC_PROPID
PROP.ID = propertyID

' Get the property
m_IPropStgObj.ReadMultiple(1, PROP, value)

And here are the platform declarations I'm using:
Sub ReadMultiple( _
<[In]()> ByVal cpspec As Integer, _
<[In](), Out(), MarshalAs(Struct)> ByRef rgpspec As PROPSPEC, _
<Out(), MarshalAs(Struct)> ByRef rgpropvar As
Edanmo.OleStorage.ComDefs.Variant)

< StructLayout(LayoutKind.Explicit, CharSet:=CharSet.Unicode) > _
Friend Structure PROPSPEC
<FieldOffset(0)> Public ulKind As PRPSPEC
<FieldOffset(4)> Public ID As Integer
<FieldOffset(4)> Public Name As IntPtr
End Structure

Friend Enum PRPSPEC As Integer
PRSPEC_LPWSTR = 0
PRSPEC_PROPID = 1
PRSPEC_INVALID = &HFFFFFFFF
End Enum

< StructLayout(LayoutKind.Explicit) > _
Friend Structure [Variant]
<FieldOffset(0)> Dim vt As Short
<FieldOffset(8)> Dim Ptr As IntPtr
<FieldOffset(8)> Dim [Byte] As Byte
<FieldOffset(8)> Dim [Long] As Long
'...(support functions for this struct omitted)
End Structure


I've tested and double-checked against Microsoft's docs every which way I
can think of without any luck. As I said, it works fine under x86 and as
far as I can tell it should work under x64 too. If someone has a solution
or any thoughts, please post them.

Thanks,

John