def CheckAdminRun():
if not appconstants.AppUACAdmin or UserIsAdmin():
# if admin not needed or already admin ... go ahead
return True, None
if not appconstants.appisfrozen() or sys.platform != 'win32':
# Manifest cannot be used if not frozen or in unix-like systems
return RunAsAdmin()
elif not appconstants.AppUACManifest:
# frozen and win32 ... and no manifest
return RunAsAdmin()
else:
# frozen win32 ... and manifest
# we "must" be running as Admin, becasue if not the application
# would not have started
# (or else ... a bug in the manifest or embedding process has acted)
return False, ('Unknown error. Manifest must request Administrator'
' permissions before launch')
评论列表
文章目录