A customer noted that
updates a pointer provided by the
Since it may allocate a new security descriptor,
that means that it needs to deallocate the old one.
But what function does it use to free the old one?
the allocation function must match the deallocation function.
Similarly, how should the new security descriptor be freed?
(I say "similarly" because the two answers had better be the same!)
The system allocates and frees the security descriptor from the
as reported by the
The allocation function is
and the deallication function is
That means that the security descriptor you pass in must have
been allocated with
SecurityDescriptor = HeapAlloc(GetProcessHeap(), flags, size);
and then you pass the pointer like this:
SetPrivateObjectSecurity(..., &SecurityDescriptor, ...); // or SetPrivateObjectSecurityEx(..., &SecurityDescriptor, ...);
and after the
function is done, you must free the memory with
I wrote this post the same day that I submitted the change request to add this essential information to the documentation. We'll see who wins.