Re: EuCOM : Attn Matt : String Return Value
- Posted by Matt Lewis <matthewwalkerlewis at gmail?c?m> Oct 05, 2007
- 734 views
Bernie Ryan wrote: > > If you look at the docs it says returns TYPE string not BSTR ? No, this isn't the problem. When a COM object says "String" it means that it returns a variant with type VT_BSTR. It's not the return value that's the problem. Something is going wrong inside the actual execution of the function. Like I said, > Also it has a output property of either HEX or BINARY maybe this > has to be set before calling. Nope. Here's the test code I tried:
include onecrypt.ew com_err_out( 2 ) constant oc = create_com_object( OneCryptA_clsid_ix ) ? invoke( oc, {OneCryptA_p_HexEncryptStrings, DISPID_PROPERTYPUT}, {-1}, {VT_I4}, DISPATCH_PROPERTYPUT ) ? invoke( oc, {OneCryptA_m_EncryptString}, alloc_bstr("secretkey") & alloc_bstr( "hello world" ), {VT_BSTR, VT_BSTR}, DISPATCH_METHOD ) ? invoke( oc, {OneCryptA_p_HexEncryptStrings, DISPID_PROPERTYPUT}, {0}, {VT_I4}, DISPATCH_PROPERTYPUT ) ? invoke( oc, {OneCryptA_m_EncryptString}, alloc_bstr("secretkey") & alloc_bstr( "hello world" ), {VT_BSTR, VT_BSTR}, DISPATCH_METHOD ) puts(1, "Done.\n") ? getc(0)
When run (exwc onecrypt.exw), I get this output: C:\euphoria\Development\test>exwc onecrypt.exw IUnknown::QueryInterface Found implemented interface: 814C81E6-A9E4-451E-9124-63F0910279A7 IUnknown::QueryInterface Found implemented interface: 814C81E6-A9E4-451E-9124-63F0910279A7 0 80020009: Exception occurred. Exception Source: Exception Description: 2147614729 0 [at this point, it crashes from within the OneCrypt ActiveX, as confirmed by using trace(3)] But watch this: C:\euphoria\Development\test>ecw -con onecrypt.exw && emake && onecrypt.exe 17 .c files were created. To build your .exe file, type: emake compiling with WATCOM main-.c main-0.c onecrypt.c eucom.c eucom_0.c eucom__1.c get.c dll.c machine.c w32support.c misc.c fptr.c unicode.c variant.c comerr.c file.c init-.c linking you can now execute: onecrypt.exe IUnknown::QueryInterface Found implemented interface: 814C81E6-A9E4-451E-9124-63F0910279A7 IUnknown::QueryInterface Found implemented interface: 814C81E6-A9E4-451E-9124-63F0910279A7 0 {68,48,70,66,68,55,51,69,55,69,48,48,67,54,69,66,69,51,68,51,49,54} 0 {208,251,215,62,126,0,198,235,227,211,22} Done. Again, I can't explain the behavior... Matt