The easiest thing is to use strongly typed pointers. Why are you trying to use IUnknown?
Also you say you are casting the IUnknown pointer. COM doesn't work this way. You have to use QueryInterface if you want to get from IUnknown to some other interface. Generally things aren't done this way in D3D, so its unclear if QueryInterface is going to do what you expect (it should, but I haven't tried it.)
You definately can't cast an IUnknown interface pointer to a CComPtr.