简体   繁体   English

如何找到InternetRegistry用户密钥或父注册表密钥

[英]How can I find the InternetRegistry User Key or Parent Registry Key

I have a BHO which on the first run is gathering activation information and storing this in the registry. 我有一个BHO,它在第一次运行时正在收集激活信息并将其存储在注册表中。

(I think) due to IE's permission's I am only able to store this in the registry branch (我认为)由于IE的允许,我只能将其存储在注册表分支中

HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\InternetRegistry\\REGISTRY\\USER\\S-0-0-00-000000000-000000000-000000000-0000\\Software\\MyBHO\\MyKey HKEY_CURRENT_USER \\ Software \\ Microsoft \\ Internet Explorer \\ InternetRegistry \\ REGISTRY \\ USER \\ S-0-0-00-000000000-000000000-000000000-0000 \\ Software \\ MyBHO \\ MyKey

Where S-0-0-00-000000000-000000000-000000000-0000 is a unique key for each user. 其中S-0-0-00-000000000-000000000-000000000-0000是每个用户的唯一密钥。

Which is fine using RegCreateKey() with "Software\\MyBHO\\MyKey" . RegCreateKey()"Software\\MyBHO\\MyKey"一起使用会很好。 It's all created and running lovely. 一切都已创建并且运行良好。 It determines where in space to store the Key with no problems. 它确定了在什么地方存储密钥没有问题。

The Problem: 问题:

When I carry out an uninstall I want to remove this key and as this is run outside of IE I have no way to determine where that key is / what the user string is. 当我执行卸载时,我想删除该密钥,并且由于它是在IE之外运行的,所以我无法确定该密钥在哪里/用户字符串是什么。

Options I have in mind: 我想到的选择:

Option 1 (Ideal) Find out this user string first to then build a new path for the key I wish to remove and remove it. 选项1 (理想)首先找到此用户字符串,然后为我希望删除的密钥建立一个新路径并删除它。 How? 怎么样?

Option 2 At the point of activation store the path to the key in another registry value that can be accessed. 选项2在激活时,将密钥的路径存储在另一个可以访问的注册表值中。 Then read, and delete both (Which seems a bit backwards and probably wont work due to the access restrictions of the BHO on the registry (Thus it being written there in the first place)) 然后读取并删除两者(这似乎有些倒退,可能由于BHO对注册表的访问限制而无法正常工作(因此,它首先被写入此处))

Do you know if there is any way to find this User key or even how to find the parent dir. 您是否知道有什么方法可以找到此用户密钥,甚至如何找到父目录。

Edit Upon continued research I've found that the thing I'm referring to as "user key" is the current Users "SID". 编辑经过不断的研究,我发现我所说的“用户密钥”是当前的用户“ SID”。 Maybe this will yield me better results. 也许这会给我带来更好的结果。

Call GetUserName to get the user name, and LookupAccountName to get his SID. 调用GetUserName获取用户名,并调用LookupAccountName获取他的SID。

ConvertSidToStringSid is a useful utility function to format a SID as a S-1-5-32-00000000-00000000-00000000-00000000-0000 string ConvertSidToStringSid是有用的实用程序函数,用于将SID格式化为S-1-5-32-00000000-00000000-00000000-00000000-0000字符串

If you really want to write per-user data to the registry, use IEGetWriteableHKCU() . 如果您确实想将每个用户的数据写入注册表,请使用IEGetWriteableHKCU()

In general there is no good way to remove per-user data at uninstall. 通常,没有很好的方法在卸载时删除每个用户的数据。 For example, what if you install as user A and the uninstall as user B? 例如,如果您以用户A的身份进行安装并以用户B的身份进行卸载,该怎么办? Are you going to go find all of them and delete them? 您要去查找所有这些并将其删除吗? Just leave the turds behind. 只是丢下粪便。

Alternatively you could consider using a different data store. 或者,您可以考虑使用其他数据存储。 Do you really need the registry? 您真的需要注册表吗? Can you store this data in a file? 您可以将这些数据存储在文件中吗? What about Web Storage ? Web存储呢?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 RegOpenKeyEx找不到注册表项 - RegOpenKeyEx can't find registry key 如何读取注册表的键值,并使用MessageBox()将其打印到屏幕上 - How can I read a key value of Registry and print it to the screen with the MessageBox() 如何使用注册表中的CurrentVersion \\ Run键为特定用户自动启动程序? - How do I auto-start a program for a specific user using the CurrentVersion\Run key in the registry? 如何显示一个对话框,可以在其中设置注册表项的权限 - How can I show an dialog in which the permissions of a registry key can be set 我可以使用RegNotifyChangeKeyValue来跟踪对注册表项值的更改吗? - Can I use RegNotifyChangeKeyValue to track changes to a value of a Registry key? 如何更改注册表项上的ACL? (C ++) - How do I change the ACLs on a registry key? (C++) 如何使用QSqlTableModel找到给定组合主键的QModelIndex - How can i find the QModelIndex for given composite primary key, with QSqlTableModel 从向量对中,如何找到C ++中的密钥? - From vector of pairs, how can I find key in C++? 无法访问注册表项 - Can't get access to registry key 在C ++中,如何在控制台应用程序中远程设置注册表项(连接工作正常,但设置不起作用!)? - In c++ how can I set registry key remotely, (connect works fine but set doesn't work!) - in a console app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM