windwos core programming process

There are up and running as an administrator in 2 ways.
1. Screening token. Means that, by default, when a process starts, the token is associated with screening, so the authority is limited, but the end user can, to run as admin to run the program by right-clicking the icon menu. Then there will be the UAC security prompt box prompts whether to continue.
2. To enhance the process privilege, VS development process.
A judgment process is elevated privileges to start, or you are using filtered token run?

GetCurrentProcess --------- get the current process handle
OpenProcessToken -------- Open token associated with the current process. (Will get a token handle)
GetTokenInformation ----------- get the process token information associated with (remember to use TokenElevationType parameter to be promoted type)

if the token has not been screened, with IsUserAnAdmin function to determine whether the process is to run as an administrator is ideal.

If the token has been screened, and then a need to get through to the unfiltered token passing GetTokenInformation TokenLinkedToken parameters, and determines if it includes a Administrator SID.

CreateWellKnowSid --------- pass WinbuiltinAministratorsSid parameters to create a consistent set of administrator SID.

CheckTokenMembership ---------- checks a permission token group.

Guess you like

Origin www.cnblogs.com/hshy/p/12302124.html