Clarification on queryInterface vs createInstance

I cant include links in my post, but I have just read the section in the VST3 api documentation called Creation and Initialize from Host point of view

Is it intentional in this example that if the iEditController is retrieved via the queryInterface method, then initalize() is not called?
If so, I presume terminate() should also not be called for this case?

Secondly, according to microsoft docs queryInterface always automatically calls addRef before returning, so the client only needs to call release. However, in the microsoft docs, CreateInstance returns with ref count of 0, so the client would call both addRef and release. What about VST3 createInstance? I assume until now this returns with reference count of 1, but having read this I would appreciate confirmation of that.

Thanks in advance

The first question is for when a plug-in implements the IEditController interface in the same object as the IAudioProcessor. In this case only the initialize method of IAudioProcessor is called.
For the second question, I would really like to see the Microsoft documentation where they say that the reference count is zero for an object created via CreateInstance. I cannot find it and I think that even the objects created on Windows via CreateInstance have not the reference count of zero. But anyway, the IHostApplication::createInstance method will return objects with a reference count of minimum 1.

cant post links, so…[com]/

This was one example, but I saw the same thing mentioned on a few pages

Thanks for the clarificaiton at least i know its 1 within Steinberg

If a CComObject -derived object is successfully constructed using the new operator, the initial reference count is 0. To set the reference count to the proper value (1), make a call to the AddRef function.

This is talking about creating a COM object with new instead of the proper object creation interfaces. It is, in fact, a warning, that if you create this with new it doesn’t follow the standard custom of returning with a refcount of 1.

It is standard in COM to return objects created from CreateObject type functions as well as QueryInterface type functions with one reference count held on behalf of the caller. This is so that helper classes like CComPtr<> can work alright:

CComPtr<IMyThing> pThing;
HRESULT hr = CreateObject<CMyThing>(&pThing); // assigns with refcount 1
CComPtr<IUnknown> pOther;
hr = pThing->QueryInterface(IID_OtherThing, &pOther); // assigns with refcount 1