从RemoveRegistry表中删除记录

发布于 2024-10-31 09:19:01 字数 648 浏览 1 评论 0原文

我有一些注册表资源需要在安装时删除,但如果目标上有其他组件需要它们,则不需要删除。 [理想情况下,我可以通过将资源与共享组件相关联来做到这一点,但我这里没有这个选项]。

我有一些共享代码来运行 SQL 命令(包括 DELETE 语句),它在其他地方都可以正常工作,但在本例中,DELETE 语句似乎运行良好,但记录不会被删除。我编写了一个查询来实际检查 DELETE 命令运行后表的状态,看起来只有数据库记录的第一个元素实际上被删除,记录中的其余字段保持不变。 当我打印出表记录时,我得到这样的结果,其中第一个字段为空

,2,软件\xxxxxxx安装,版本,yyyyyyy,,,

MSI (s) (A8!5C) [16:49:19:628]:数据库字符串池已损坏。

我改变了策略,而不是仅仅执行 DELETE 命令,而是使用 MSIMODIFY_DELETE 对每条记录执行了 MsiViewModify,但我遇到了同样的问题。

最后,我不得不编辑记录,以便它们引用我知道不会存在的不同值,但由于显而易见的原因,我不喜欢这样。

有人对此有什么建议吗? MSI 1.0 中有一个与字符串池相关的非常古老的错误,但该错误与需要提交的 MSI 数据库文件相关,这不适用于通过调用 GetActiveDatabase() 获取句柄的自定义操作的上下文。

I've got some registry resources that need deleting on install, but not if there are other components on the target that need them. [Ideally I'd do this by associating the resources with shared components, but I don't have that option here].

I have some shared code to run SQL commands (including DELETE statements), which works fine everywhere else, but in the present case the DELETE statement appears to go through fine, but the records just don't get dropped. I've written a query to actually check the state of the table after the DELETE command runs and it looks like only the first element of the database record is actually getting deleted, with the rest of the fields in the record left intact.
When I print out the table records, I get things like this, where the first field is empty

,2,SOFTWARE\xxxxxxxInstall,Version,yyyyyyy,,,

MSI (s) (A8!5C) [16:49:19:628]: Database string pool is corrupted.

I changed tack and rather than just executing a DELETE command, I did an MsiViewModify on each record with MSIMODIFY_DELETE, but I get the same issue.

In the end I've had to go with just editing the records so that they refer to a different value that I know won't exist, but I don't like that, for obvious reasons.

Anyone got any suggestions about this? There was a very old bug in MSI 1.0 related to string pools, but that related to MSI database files needing to be committed, which doesn't apply in the context of a custom action where you get the handle by calling GetActiveDatabase().

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

[浮城] 2024-11-07 09:19:01

我很确定我记得在某处读过,MSI SQL 对临时表和行的支持是加法而不是减法。您会注意到,在 SDK doco 中,只有 INSERT INTO 命令具有 TEMPORARY 选项,而 DELETE FROM 则没有。

您确实需要考虑更好地组织组件,以便您的注册表资源可以与组件的所有各种功能相关联,这些组件的资源依赖于注册表项。

SQL 语法

I'm pretty sure I recall reading somewhere that MSI SQL support for temp tables and rows is additive not subtractive. You'll notice in the SDK doco that only the INSERT INTO command has the TEMPORARY option, DELETE FROM does not.

You really need to look into organizing your components better so that your registry resources can be associated to all of the various features that have components with resources that have dependencies on the registry keys.

SQL Syntax

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文