Retrieves the security ID of the external process that called the currently executing method.
Provided By
HRESULT ISecurityProperty::GetDirectCallerSID (
PSID* ppSid
);
Parameters
ppSid
[out] A reference to the security ID of the process from which the current method was invoked.
Return Values
S_OK
The security ID of the process that called the current method is returned in the parameter ppSid.
E_INVALIDARG
The argument passed in the ppSid parameter is a NULL pointer.
E_UNEXPECTED
An unexpected error occurred.
Remarks
You use the GetDirectCallerSID method to determine the security ID of the process that called the object's currently executing method. The following scenarios illustrate the functionality of the GetDirectCallerSID method.
A base process running on server A, as user A, calls into object X on server B, running as user B. Then object X calls into object Y, running on server C. If object Y calls GetDirectCallerSID, the the security ID of user B is returned.
Security can only be enforced across process boundaries. This means that the the security ID returned by GetDirectCallerSID is the the security ID associated with the process that called into the process in which the current object is running, not necessarily the immediate caller into the object itself. If an object calls into another object within the same process, when the second object calls GetDirectCallerSID, it will get the the security ID of the most immediate caller outside its own process boundary, not the the security ID of the object that directly called into it.
A base process, running on server A as user A, calls into object X on server B, running as user B. Then object X calls into object Y, running in the same process as object X, also on server B. When object Y calls GetDirectCallerSID, the the security ID of user A is returned , not the the security ID of user B.
You must call ReleaseSID on a security ID when you finish using it.
See Also
Programmatic Security, Advanced Security Methods, IObjectContext Interface