什么是产品代码和产品代码升级代码&图形用户界面?如何检测用户计算机上是否已安装某个应用程序/库?

发布于 2024-08-31 04:09:36 字数 3889 浏览 11 评论 0原文

我已经经历过:

检查应用程序是否已安装

检测程序是否已安装 NSIS

http://nsis.sourceforge.net/Add_uninstall_information_to_Add/Remove_Programs

我的问题更深入,也更笼统。

所以,正如你所理解的,我的问题是我想检查是否“某些 应用程序”已安装在用户的计算机上?我正在使用 高级安装程序 生成安装程序。

首先几个问题:

  • 什么是升级代码?高级安装程序有选项,产品版本(通过升级代码识别)
  • 什么是产品代码
  • 已安装组件: GUID 是什么?

以上三个值都是这样的:

{49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3} 我不知道这些值是什么,但似乎计算机正在识别软件。 MySQL

我需要的应用程序是

  1. DBMS
  2. MySQL .NET Connector

我发现的一个事实是可以从其“msi 安装程序”中提取这些值。

MySQL Server

Installer = mysql-5.1.43-win32.msi 
Upgrade Code = {49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3}
Product Code = {0ECED7D8-FF53-4DC9-958E-C2177F528DE4}
GUID (for component Installed) = ????
Uninstall Path = HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{0ECED7D8-FF53-4DC9-958E-C2177F528DE4}

Installer = mysql-5.1.46-win32.msi
Upgrade Code = {49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3}
Product Code = {EA8FDE5A-2B33-4EDD-B7E7-8D179DF731A5}
GUID (for component Installed) = ????
Uninstall Path = HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{EA8FDE5A-2B33-4EDD-B7E7-8D179DF731A5}

Installer = mysql-essential-5.1.46-win32.msi
Upgrade Code = {49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3}
Product Code = {AD33AF2C-6485-4106-B012-1D9CDC88A454}
GUID (for component Installed) = ????
Uninstall Path = HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AD33AF2C-6485-4106-B012-1D9CDC88A454}

Installer = mysql-essential-5.0.89-win32.msi
Upgrade Code = {49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3}
Product Code = {9A4DA7EF-A7B9-4282-90AD-10976AA24E69}
GUID (for component Installed) = ????
Uninstall Path = HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9A4DA7EF-A7B9-4282-90AD-10976AA24E69}

从以上数据观察:

  • 软件的UpgradeCode是恒定的。与其版本无关。但令人惊讶的是,注册表中没有一个条目的值是 UpgradeCode
  • ProductCode 是特定于版本的&它由 MSI 内部使用,这实际上是合理的,因为。 MSI 允许并排安装不同版本的应用程序。
  • 我不知道如何找到 GUID。

MySQL ADO .NET Driver

Installer = mysql.data.5.2.5.msi
Upgrade Code = --- 
Product Code = {5FD88490-011C-4DF1-B886-F298D955171B}
GUID (for component Installed) = ????

Installer = mysql.data.6.2.2.msi
Upgrade Code = ---
Product Code = {5FD88490-011C-4DF1-B886-F298D955171B}
GUID (for component Installed) = ????
UninstallPath =HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5FD88490-011C-4DF1-B886-F298D955171B}
Installer =  mysql.data.6.2.3.msi
Upgrade Code = ---
Product Code = {5FD88490-011C-4DF1-B886-F298D955171B}
GUID (for component Installed) = ????

从以上数据观察:

  • 令人惊讶的是,它无法从 mysql.data.*.msi 的安装程序中找到 UpgradeCode。我想知道为什么?这与我的上述观察相矛盾。
  • 所有不同版本的 ProductCode 在这里都是相同的。这再次与我的上述观察相矛盾。
  • 我还是不知道如何找到GUID。

现在,

  • 这些 ProductCodeProductCode 到底是什么? 升级代码 & GUID。
  • 哪个表示什么?
  • 为什么上述观察结果相互矛盾?
  • 我不关心版本。 我不想依赖应用程序名称那么我如何检查MySQL驱动程序和应用程序名称? MySQL ADO .NET。
  • 如果它们是 .NET 程序集,检测会变得简单吗?那该怎么办呢?我不想将程序集与我部署的文件一起发送。

I've already gone through:

Check if the application is already installed

Detecting if a program is already installed with NSIS

http://nsis.sourceforge.net/Add_uninstall_information_to_Add/Remove_Programs

My questions are little more in depth and little more general.

So, as you understood my problem is that I want to check if "Certain
Applications" are already installed on the user's machine? I'm generating the installer using Advanced Installer.

First few questions:

  • What is Upgrade Code? Advanced installer has option, Product Version (identify by Upgrade Code)
  • What is Product Code? Advanced installer Product Version (identify by Product Code)
  • Component is installed : GUID. What is GUID?

All the above three has values like this:

{49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3} I don't know what these values are but it seems that computer is recognizing software using this kind of strange ID.

My required applications are

  1. MySQL DBMS
  2. MySQL .NET Connector

One fact that I discovered is Upgrade Code & Product Code can be extracted from its "msi installer". So, I extracted these values from the installers & registry.

MySQL Server

Installer = mysql-5.1.43-win32.msi 
Upgrade Code = {49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3}
Product Code = {0ECED7D8-FF53-4DC9-958E-C2177F528DE4}
GUID (for component Installed) = ????
Uninstall Path = HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{0ECED7D8-FF53-4DC9-958E-C2177F528DE4}

Installer = mysql-5.1.46-win32.msi
Upgrade Code = {49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3}
Product Code = {EA8FDE5A-2B33-4EDD-B7E7-8D179DF731A5}
GUID (for component Installed) = ????
Uninstall Path = HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{EA8FDE5A-2B33-4EDD-B7E7-8D179DF731A5}

Installer = mysql-essential-5.1.46-win32.msi
Upgrade Code = {49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3}
Product Code = {AD33AF2C-6485-4106-B012-1D9CDC88A454}
GUID (for component Installed) = ????
Uninstall Path = HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AD33AF2C-6485-4106-B012-1D9CDC88A454}

Installer = mysql-essential-5.0.89-win32.msi
Upgrade Code = {49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3}
Product Code = {9A4DA7EF-A7B9-4282-90AD-10976AA24E69}
GUID (for component Installed) = ????
Uninstall Path = HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9A4DA7EF-A7B9-4282-90AD-10976AA24E69}

Observation from above data:

  • UpgradeCode of a software is constant & is irrespective of its version. But surprisingly there is no single entry in the registry with the value of UpgradeCode
  • ProductCode is version specific & it is used by the MSI internally which is actually reasonable because. MSI allows applications of different versions to be installed side by side.
  • I don't know how to find GUID.

MySQL ADO .NET Driver

Installer = mysql.data.5.2.5.msi
Upgrade Code = --- 
Product Code = {5FD88490-011C-4DF1-B886-F298D955171B}
GUID (for component Installed) = ????

Installer = mysql.data.6.2.2.msi
Upgrade Code = ---
Product Code = {5FD88490-011C-4DF1-B886-F298D955171B}
GUID (for component Installed) = ????
UninstallPath =HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5FD88490-011C-4DF1-B886-F298D955171B}
Installer =  mysql.data.6.2.3.msi
Upgrade Code = ---
Product Code = {5FD88490-011C-4DF1-B886-F298D955171B}
GUID (for component Installed) = ????

Observations from above data:

  • surprisingly, it couldn't find UpgradeCode from installer of mysql.data.*.msi. I wonder why? This contradicts with my above observation.
  • ProductCode for all different versions is same here. This again contradicts my above observations.
  • I still don't know how to find GUID.

Now,

  • What exactly are these ProductCode & UpgradeCode & GUID.
  • Which denotes what?
  • Why are above observations contradicting?
  • I don't care about versions. I don't want to depend on Application Name then how do I check if MySQL driver & MySQL ADO .NET.
  • Does detection become simple if they are .NET assemblies? How to do then? I don't want to ship the assemblies with my deployed files.

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

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

发布评论

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

评论(2

萌逼全场 2024-09-07 04:09:36

UpgradeCode表示产品的不同版本。

ProductCode 表示产品的版本。

例如,理论上,Microsoft Word 2003 有一个 ProductCode,而 Word 2007 有一个不同的 ProductCode。但是,Word 2003 和 2007 将共享相同的 UpgradeCode,因为您可以从一种升级到另一种。

GUID 简单来说就是全局唯一标识符。这是一长串数字和字母,在地球上应该是唯一的。

UpgradeCodes 和 ProductCodes 保存在注册表中,但它们是隐藏和加密的,您需要使用工具来查询它们。例如:

MsiGetProductInfo(ProductCode, INSTALLPROPERTY_VERSIONSTRING, lpVerName, &cchVerName);
MsiEnumRelatedProducts(UpgradeCode, 0, 0, ProductCode);

要检查产品是否已安装在用户的计算机上,您可以使用上面的 MsiEnumRelatedProducts() 。我认为您提出的问题超出了 StackOverflow 答案中可以回答的范围。考虑详细了解 MSI:

Windows Installer 上的 MSDN 部分

UpgradeCode denotes a product with different versions.

ProductCode denotes a version of a product.

For example, theoretically there is one ProductCode for Microsoft Word 2003 and a different one for Word 2007. However both Word 2003 and 2007 would share the same UpgradeCode since you can upgrade from one to the other.

GUID simply means Globally Unique Identifier. It's a large string of numbers and letters that should be unique on the planet.

UpgradeCodes and ProductCodes are kept in the Registry, but they're hidden and encrypted and you'll need to use a tool to query them. For example:

MsiGetProductInfo(ProductCode, INSTALLPROPERTY_VERSIONSTRING, lpVerName, &cchVerName);
MsiEnumRelatedProducts(UpgradeCode, 0, 0, ProductCode);

To check and see if a product is already installed on a user's machine you might use MsiEnumRelatedProducts() as above. I think you're asking more than what can be answered in a StackOverflow answer. Consider studying more about MSI:

MSDN section on Windows Installer

若有似无的小暗淡 2024-09-07 04:09:36

ProductCode 和 UpgradeCode GUID 标识您的软件。与第三个代码一起,PackageCode。

除了提到的干净 API 方式之外,当然也可以在注册表中检测到这些代码。
在某些地方,它们有点“改变”,这是事实,但这不是加密,只是数字重新排序,例如在HKCR\Installer下。很容易破译,我认为网络上的任何地方都有示例代码。 10个班轮左右。

以“未加密”的方式,您可以在此处找到已安装软件的产品代码:

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
(但请注意,还有另外两个密钥用于用户特定的和 64 位计算机上的 32 位 WOW 软件)。

不建议使用其代码来检测应用程序,因为这些代码可能会在更新时发生变化。如果使用一个,UpgradeCode 更安全,因为它变化较少,但不够安全。查找包含公司名称和软件版本的注册表路径!

更多知识:
ProductCode 是 MSI 设置的主要标识。对于安装作者来说,这些代码(ProductCode、UpgradeCode)的经验规则是:

  1. 如果您通过补丁进行更新,请勿更改其中任何一个。

  2. 如果您想要执行包含所有文件的完整更新,请执行所谓的“主要升级”。
    (还有其他可能性,但这是最舒服的一种,特别是对于初学者)。
    a) 更改您的产品代码以进行重大升级。

  3. 请勿更改任何升级的 UpgradeCode,除非您希望新版本可以与旧版本并行安装。在MSI“思考”中,它是一个全新的产品(更好地理解为升级路径/树)。

  4. 如果您更改 UpgradeCode,请务必更改 ProductCode

  5. 通常不关心 PackageCode。一个好的构建工具会在每次构建时将其更改为随机的新 GUID。要使用该版本进行安装测试,可能需要先卸载旧的版本或了解有关 MSI 的更多信息(此处:小/次要升级)。

The ProductCode and UpgradeCode GUIDs identify your software. Together with a third code, the PackageCode.

Additionally to the mentioned clean API way, of course it is possible to detect these codes in the registry too.
In some places they are a little bit "changed" this is true, but this is no encryption, only number reordering, e.g. under HKCR\Installer. Quite easy to decipher and I think there is example code anywhere in the net. A 10 liner or so.

In a "unencrypted" way you can find the ProductCode of installed software here:

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
(But beware, there are two other keys for user-specific and 32 bit WOW software on 64 bit machines).

It is not recommended to detect applications using their codes, because these can change in the case of updates. If using one, UpgradeCode is safer, because it changes less, but not safe enough. Look for registry paths containing company names and versions of your software!

More knowledge:
The ProductCode is the main identity of a MSI setup. Thumb rules for these codes (ProductCode, UpgradeCode) for setup authors are:

  1. Don't change any of them if you are doing an update by a patch.

  2. If you want to do a full update containing all files, do a so-called 'Major Upgrade'.
    (There are other possibilities, but this is the most comfortable one, especially for beginners).
    a) Change your ProductCode for Major Upgrades.

  3. Don't change the UpgradeCode for ANY upgrade, except you want that the new version can be installed in parallel to the old one. In MSI "thinking" then it is a completely new product (better understandable as upgrade path/tree).

  4. If you change the UpgradeCode, always change the ProductCode

  5. Normally don't care about the PackageCode. A good build tool changes it with every build to a random new GUID. To do a an install test with that build it may be necessary to uninstall the old built version first or to know more about MSI (here: Small/Minor Upgrades).

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