I know that SafeArrayAccessData also does locking/unlocking, but never mind that, I'm interested only to know if it ever returns a pointer different from pvData
.
For example, this code never triggers the assert (that I could see in my tests):
SafeArrayAccessData(sa, (void**) &ptr);
assert(ptr == sa->pvData);
Does anyone know of a scenario where SafeArrayAccessData
would yield a pointer that is not equal to pvData
?
The only way the out-parameter pointer set by SafeArrayAccessData()
would be other than psa->pvData
would be if the function's return value is other than S_OK
(e.g. the array could not be locked, in which case the out-parameter's value is unspecified).
If the function does return S_OK
, the out-parameter pointer must equal psa->pvData
(after all, what else could it be?).