Vista下提升应用程序权限.doc
文本预览下载声明
Vista下提升应用程序权限
(大连外国语学院 软件学院,辽宁 大连 116044)
摘要:很多应用程序在运行的过程中,都会在系统盘下保存一些操作信息和修改的数据等信息。如果在Vista系统的不同权限的用户下运行这样的应用程序,会由于文件访问权限问题导致系统崩溃。本文从两个方面阐述了如何提升应用程序的访问权限,一是通过修改Manifest文件,二是在代码中提升。两个方法各有利弊,在使用时需要用户根据需要慎重选择。
关键词:Vista;Manifest文件;UAC;应用程序崩溃;提升访问权限
中图分类号:TP393文献标识码:A文章编号:1009-3044(2009)28-7899-02
Raise Access Authority of Application on VISTA System
LU Lin-lin,WAN Li-ying
(Software College, Dalian University of Foreign Language, Dalian 116044, China)
Abstract:Many applications store their operation information, modified data and other information at the system disk while running. In Vista, if such application runs under users with different authority, different file access authority may lead to application crush. This document tells how to raise application’s access authority in two ways. One is to modify Manifest file, and the other is to raise authority by coding. Because these two methods have their own advantages and disadvantages, users should make choices carefully according their need when using them.
Key words:VISTA;manifest file;UAC;application crash;raise access authority
目前,很多的应用程序在运行的过程中,都会在系统盘安装目录下保存一些操作信息和修改的数据,对于这样的应用程序,当使用Standard权限用户登录Vista系统,启动已经在Administrator Group权限的用户下进行编辑操作的应用程序,会因为文件操作失败,导致APP Error。查找了一些Vista方面的资料,发现是因为Vista系统的新特性UAC导致,原因是在一些特定目录下,低权限的用户无法修改由高权限用户所创建的文件。访问权限问题会使应用程序访问文件失败,进而导致程序失败。那么如何提升应用程序的权限,使得在低权限用户下运行的程序能够修改这些文件呢?
1 UAC
UAC的全称是User Account Control(用户账户控制),它是Windows Vista提供的一个安全特性。它会在用户使用计算机进行更改系统设置或者安装软件等会影响到系统安全性、稳定性的操作时弹出一个对话框,友善的提示用户他们要进行的操作。
当用户使用Windows Vista时,默认是启用UAC的。当UAC启用时,无论用户以什么身份登录Vista系统,即使他以Administrator Group的身份登录计算机,都只具有普通用户的权限。当用户右键选择应用程序的“Run as Administrator”时,Vista系统会弹出一个对话框,提示用户他们要进行的操作。在这个过程中,如果您使用的是Administrator Group用户登录Windows Vista,那么只需要点击“Continue”或者“Allow”就可以继续进行操作了。如图1所示。
如果使用的是Standard用户登录,就需要输入Administrator或Group的密码,如图2所示。
点击的时候,UAC进行了一次权限的提升,这时Group用户才真正具有了Administrator的权限。如果是以Standard用户登录计算机,当他们执行这样的操作时,Vista会弹出一个对话框,让这个Standard用户输入一个管理员的账号和密码。
显示全部