suppose i receive a handle to a process in a user-mode application. i dont know if it is returned from a CrateProcess or an OpenProcess call. to call GetProcessTimes with this handle i need PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access rights. the easiest approach would be to call DuplicateHandle (with PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION), but then again it needs the PROCESS_DUP_HANDLE access right. so to decrease the chance of failure, i could call GetProcessTimes on handle, if it succeeds then everything is ok, othwerwise i duplicate the handle with the needed access right and call GetProcessTimes again.
i was wondering if it is possible to check if a given process has ROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right before i make the first call to GetProcessTimes to further reduce the overhead. looking around on msdn i think i should use GetSecurityInfo? but i have found no examples that i could use.
thank you