如何防止Windows(Mobile)安装程序覆盖注册表项值

时间:2023-02-05 02:50:12

I'm wrapping up a Windows Mobile (6.1) app I've written and everything goes fine and dandy, but I've got one nasty problem: My app needs a few registry keys for settings and I can create them in the installer (using the registry editor) fine, but my problem is that every time I run the installer to update a new version of the software it overwrites those registry values.

我正在编写一个我写过的Windows Mobile(6.1)应用程序,一切都很好,花花公子,但我有一个令人讨厌的问题:我的应用程序需要一些注册表项来设置,我可以在安装程序中创建它们(使用注册表编辑器)很好,但我的问题是,每次我运行安装程序更新软件的新版本时,它会覆盖这些注册表值。

Is it possible to create a .cab installer that creates the specified registry keys if they don't exist, but leaves them alone if they do.

是否可以创建一个.cab安装程序,如果它们不存在,则创建指定的注册表项,但如果它们存在,则保留它们。

Also, am I correct if I assume the setup project automatically deletes all registry keys in uninstall that it created during install?

另外,如果我认为安装项目会自动删除安装期间创建的卸载中的所有注册表项,我是否正确?

Thanks a bunch in advance!

先谢谢了!

2 个解决方案

#1


I don't beleave you have that much control over regsitry setup in the installer INF.

我并不认为你对安装程序INF中的regsitry设置有很多控制权。

What you need to do is create a setup dll which will give you all the control that you need to do whatever you want. The problem is that you have to write it in C or C++ but it should be easy enough as all you want to do is to setup registry keys.

您需要做的是创建一个设置DLL,它将为您提供所需的所有控制权。问题是你必须用C或C ++编写它,但它应该很容易,因为你要做的就是设置注册表键。

#2


No custom DLL is necessary. Use the FLG_ADDREG_NOCLOBBER (0x00000002) in the INF entry for your reg key.

不需要自定义DLL。在REG条目的INF条目中使用FLG_ADDREG_NOCLOBBER(0x00000002)。

#1


I don't beleave you have that much control over regsitry setup in the installer INF.

我并不认为你对安装程序INF中的regsitry设置有很多控制权。

What you need to do is create a setup dll which will give you all the control that you need to do whatever you want. The problem is that you have to write it in C or C++ but it should be easy enough as all you want to do is to setup registry keys.

您需要做的是创建一个设置DLL,它将为您提供所需的所有控制权。问题是你必须用C或C ++编写它,但它应该很容易,因为你要做的就是设置注册表键。

#2


No custom DLL is necessary. Use the FLG_ADDREG_NOCLOBBER (0x00000002) in the INF entry for your reg key.

不需要自定义DLL。在REG条目的INF条目中使用FLG_ADDREG_NOCLOBBER(0x00000002)。