MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / IsElevated

Function IsElevated

src/Helpers.c:199–219  ·  view source on GitHub ↗

============================================================================= IsElevated()

Source from the content-addressed store, hash-verified

197// IsElevated()
198//
199BOOL IsElevated()
200{
201 BOOL bIsElevated = FALSE;
202 HANDLE hToken = NULL;
203 if ( !IsVista() ) {
204 return ( FALSE );
205 }
206 if ( OpenProcessToken ( GetCurrentProcess(), TOKEN_QUERY, &hToken ) ) {
207 struct {
208 DWORD TokenIsElevated;
209 } /*TOKEN_ELEVATION*/te;
210 DWORD dwReturnLength = 0;
211 if ( GetTokenInformation ( hToken,/*TokenElevation*/20, &te, sizeof ( te ), &dwReturnLength ) ) {
212 if ( dwReturnLength == sizeof ( te ) ) {
213 bIsElevated = te.TokenIsElevated;
214 }
215 }
216 CloseHandle ( hToken );
217 }
218 return bIsElevated;
219}
220
221
222//=============================================================================

Callers 1

WinMainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected