<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 16, 2019 at 11:16 AM Dmitry Timoshkov <<a href="mailto:dmitry@baikal.ru">dmitry@baikal.ru</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Alistair Leslie-Hughes <<a href="mailto:leslie_alistair@hotmail.com" target="_blank">leslie_alistair@hotmail.com</a>> wrote:<br>
<br>
> > +                    if (CoCreateInstance(&clsid, 0, CLSCTX_INPROC_SERVER, &IID_IADsOpenDSObject, (void **)&adsopen) == S_OK)<br>
> > +                    {<br>
> > +                        hr = IADsOpenDSObject_OpenDSObject(adsopen, (BSTR)path, (BSTR)user, (BSTR)password, reserved, &disp);<br>
> > +                        if (hr == S_OK)<br>
> You cannot cast to a BSTR, it will corrupt the data structure.<br>
<br>
I depends wheather the callee uses SysStringLen() and friends, in this<br>
particular case it works just fine, there are many other places in the code<br>
when it's not necessary to create intermediate copies of the strings.<br></blockquote><div><br></div><div>It does not matter if it works in this case, arguments should use correct types. If we have similar violations somewhere else, those need fixing as well.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> > +                        {<br>
> > +                            hr = IDispatch_QueryInterface(disp, riid, obj);<br>
> > +                            IDispatch_Release(disp);<br>
> Now that you have found the object, shouldn't you exit the loop?<br>
<br>
Yes, thanks for spotting this. I think it could be fixed in a later patch.<br>
<br>
-- <br>
Dmitry.<br>
<br>
</blockquote></div></div>