注册表清洁计划 [英] Registry Cleaner Program

查看:65
本文介绍了注册表清洁计划的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

再一次,我要求一些帮助。



刚刚制作注册表清洁程序的一个好主意。

我曾经创建了一个删除Temporary Files文件夹中的文件的程序,但这很无聊。

算法如何知道需要从注册表清理什么?

-和如何触发用户帐户控制以授予管理员访问注册表的权限?



只要没有人删除我的问题,因为这个问题太模糊和这里没有什么可讨论的。



:)

解决方案

请看我对这个问题的评论。我认为这不是论坛要回答的问题。这是一项需要完成的研究和开发工作。唯一合理的答案就是完成这项工作的相当一部分,请理解,对论坛来说有点太多了。



并删除任何内容从临时文件夹并没有真正清理注册表。不幸的是,确实需要清理注册表,但这是一项非常复杂和危险的活动。如果你真的想要这样做,你必须学习很多系统内部,而不仅仅是技术,这实际上非常简单。基本上,您需要找出注册表不一致的所有可能情况以及使注册表数据自我一致的方式。



一些不一致的情况非常明显:例如,您可以轻松地获取大量指向一些物理删除文件的数据元素(例如,正式安装某些软件然后删除可执行文件目录;如何在安装之前返回到一致的注册表?)。您始终可以删除指向不存在的文件的条目,但要删除它们周围多少?这是一个需要详细了解相关注册表存储结构的问题。许多都有记录,但我相信有些不是。至少,你需要在你可以随时重建的系统上做很多实验,如果你搞砸了。我会说很多工作。



我认为唯一有意义的部分是关于行政访问的最后一个问题。你真的需要提升特权。在Windows 7及更高版本中(我是否应该提到像Vista这样破碎的东西?:-)),拥有管理帐户是不够的。您需要通过UAC向用户确认:

http:/ /en.wikipedia.org/wiki/User_Account_Control [ ^ ]。



通常情况下,如果您的帐户有足够的权限,您可以在用户级别以管理员身份运行任何内容:

< a href =http://4sysops.com/archives/vista%E2%80%99s-uac-8-ways-how-to-elevate-an-application-to-run-it-with-administrator-rights/ > http://4sysops.com/archives/vista%E2%80%99s-uac-8-ways-how-to-elevate-an-application-to-run-it-with-administrator-rights/ [ ^ ],

http://www.sevenforums.com/tutorials/11841-r un-administrator.html [ ^ ]。



但是,对于系统实用程序而言,这还不够好,因为您始终需要以管理员身份运行。因此,正确的做法是将请求权限添加到应用程序清单。请参阅:

http://msdn.microsoft.com/en-us /library/bb756929.aspx [ ^ ]。



这就是全部。



-SA


如果您只需删除临时文件,则需要使用可通过以下API访问的目录:

http://msdn.microsoft.com/en-us/library/14tx8hby.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/aa364992%28VS.85%29.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/system.io.path.gettemppath.aspx [ ^ ]。



还有 System.Environment.GetEnvironmentVariable(TEMP)



关于从C:开始搜索* .tmp的想法,这不是一个有效的想法:1)你有其他磁盘,所以你不会首先获取他们的列表,2)你可能没有磁盘C:(不要惊讶,谁告诉你应该在那里?我有一个没有C:的Windows系统,3)你不能保证所有* .tmp文件都是临时的。



< DD> -SA

Once again, i request some assistance.

A good idea floated into my head just now of making a Registry Cleaner program.
I once made a program that deletes files from the Temporary Files folder, but that was boring.
How can the algorithm know what needs cleaning from the registry?
-and how can I trigger User Account Control to give admin access to the registry?

Much appreciated as long as nobody deletes my question because "this question is too vague " and "there is nothing to discuss here" .

:)

解决方案

Please see my comment to the question. I think this is not the question to be answered in the forum. It''s rather a research and development work to be done. The only reasonable answer would be just doing a considerable part of this work, with, please understand it, would be a bit too much for a forum.

And deleting anything from temporary folder does not really clean the registry. Unfortunately, cleaning the registry is really needed, but this is quite a complex and dangerous activity. If you really want to do it, you have to learn a good deal of system internals, not just techniques, which are actually quite simple. Basically, you need to find out all potential cases of registry inconsistencies and the way of making the registry data self-consistent.

Some inconsistencies are very apparent: for example, you can easily get a lot of data elements pointing to some physically removed files (for example, formally install some software and then remove executable directory; how to return to the consistent Registry as it was before installation?). You can always remove those entries pointing to non-existing files, but how much to remove around them? This is a problem requiring detailed knowledge of relevant registry-stored structures. Many are documented, but I believe some are not. At the very least, you need to do a lot of experiments on the systems you can always rebuild if you screw up. A lot of work, I would say.

I think the only part which makes sense is the last question, about the administrative access. You will really need elevated privileges. In Windows 7 and later (should I even mention such broken thing as Vista? :-)), having administrative account is not enough. You also will need to ask a user confirmation via UAC:
http://en.wikipedia.org/wiki/User_Account_Control[^].

Normally, you can run anything "as administrator" on the user level, if your account has sufficient privileges:
http://4sysops.com/archives/vista%E2%80%99s-uac-8-ways-how-to-elevate-an-application-to-run-it-with-administrator-rights/[^],
http://www.sevenforums.com/tutorials/11841-run-administrator.html[^].

However, for a system utility this is not good enough, as you always need to "run anything as administrator". So, the right thing would be adding the request right to the application manifest. Please see:
http://msdn.microsoft.com/en-us/library/bb756929.aspx[^].

That''s all.

—SA


If you only need to remove temporary files, you need to use the directories you can access via the following API:
http://msdn.microsoft.com/en-us/library/14tx8hby.aspx[^],
http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx[^],
http://msdn.microsoft.com/en-us/library/aa364992%28VS.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.io.path.gettemppath.aspx[^].

And also System.Environment.GetEnvironmentVariable("TEMP").

As to your idea to search for "*.tmp" starting from "C:", this is not a valid idea: 1) you have other disks, so you would not to fetch their list first, 2) you may not have the disk "C:" (don''t be surprised, who told you it should be there? I have one Windows system without "C:" right now), 3) you cannot guarantee that all "*.tmp" files were meant to be temporary.

—SA


这篇关于注册表清洁计划的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆