Re: EuCOM : Attn Matt : String Return Value
- Posted by Matt Lewis <matthewwalkerlewis at gmail.?o?> Oct 04, 2007
- 721 views
Rad wrote: > > Hi Matt, > > allocate_string() and w32peek_string() gave the same results as before. > Trying 2147614729 with peek_string() simply terminates the program. Yeah, I really didn't think that would work. > I tried out other string returning methods in the ocx which are: <snip> > and they worked fine returning string values as expected. > > The difference being these methods have only one parameter where as Encrypt > method has 2 parameters. > Could this difference in number of parameters causing the error? Possibly. I've found some objects which require named parameters, and others that fail if you use them. Did you try calling everything by name:
OCString = invoke( OC6, {"EncryptString", "Key", "InString"}, {pBstrAppId, pBstrOCStr}, {VT_BSTR, VT_BSTR}, DISPATCH_METHOD )
> > Following is the discussion with the developer of 1Crypt ocx: > ============================================================= > Hi Rad, > > 1Crypt uses only VT_BSTR strings. These are Unicode strings with a maximum > length > of 2GB. > > 2147614729 decimal = 80020009 hex > > I'm wondering if this value could be a pointer to a string rather the string > itself. No. It's the error code returned by the object. Basically, any COM call returns an HRESULT, which is zero on success, and non-zero when there is an error. This wiki link below does a reasonable job at explaining the meaning of the bits of an HRESULT, and you can take a look at comerr.ew to see a comprehensive list of error codes. You'll usually see them in a hex representation (i.e., #80020009). http://en.wikipedia.org/wiki/HRESULT Invoke does some work for you when you get a successful call, since usually you just want to use the result. It will automatically read a string value or a whatever-value. You're probably not interested in the details, but can look at the code if you're really interested. It will, however, return the error code when there is one. > > Unfortunately the revised ocx is giving the same result as previous one. Is OneCrypt open source? Or maybe a demo version I could take a look at? Matt