+ if (idx > -1) + { + VariantInit(pvarValue+i); + res = VariantCopy(pvarValue+i, This->values+idx); + phrError[i] = res; + if (FAILED(res)) + break; + }
This looks wrong to me. We have an array of error values to set for each read attempt, so it seems like each read should be independent - one failure shouldn't cause us to give up on the others, nor to free the values we already read successfully.
If this is really how Windows works, we need a test for it.