卸载程序不删除注册表(uninstaller not deleting registry)
Function Check32or64BitWindows
${If} ${RunningX64}
strcpy $INSTDIR "$PROGRAMFILES64\${APP_FULL_PATH}"
SetRegView 64
${Else}
SetRegView 32
strcpy $INSTDIR "$PROGRAMFILES32\${APP_FULL_PATH}"
${EndIf}
FunctionEnd
如果检测到旧版本,则执行
ExecWait '"$INSTDIR\uninst.exe" /S' $0
我的卸载部分:
Section uninstall
!define APP_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_VENDOR} ${APP_NAME}"
!define APP_UNINST_ROOT_KEY "HKLM"
DeleteRegKey ${APP_UNINST_ROOT_KEY} "${APP_UNINST_KEY}"
SectionEnd
Section -Post
WriteRegStr ${APP_UNINST_ROOT_KEY} "${APP_UNINST_KEY}" "DisplayName" "${APP_FULL_NAME}"
SectionEnd
Post部分在Windows 64位注册表视图中创建注册表项,但卸载程序不会删除注册表项。
如果我删除了对64位操作系统的检查,那么在Wow6432Node中创建和删除注册表就能正常工作。
Function Check32or64BitWindows
${If} ${RunningX64}
strcpy $INSTDIR "$PROGRAMFILES64\${APP_FULL_PATH}"
SetRegView 64
${Else}
SetRegView 32
strcpy $INSTDIR "$PROGRAMFILES32\${APP_FULL_PATH}"
${EndIf}
FunctionEnd
If an older version is detected then I execute
ExecWait '"$INSTDIR\uninst.exe" /S' $0
My uninstall section:
Section uninstall
!define APP_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_VENDOR} ${APP_NAME}"
!define APP_UNINST_ROOT_KEY "HKLM"
DeleteRegKey ${APP_UNINST_ROOT_KEY} "${APP_UNINST_KEY}"
SectionEnd
Section -Post
WriteRegStr ${APP_UNINST_ROOT_KEY} "${APP_UNINST_KEY}" "DisplayName" "${APP_FULL_NAME}"
SectionEnd
Post section creates the registry entry in the windows 64bit registry view but uninstaller is not deleting the registry entry.
If I remove the check for 64bit OS, then creation and deletion of registry in Wow6432Node works correctly.
原文:https://stackoverflow.com/questions/8571900
更新时间:2020-03-02 06:21
最满意答案
如果您未安装x64应用程序,则根本不应使用SetRegView / $ PROGRAMFILES64。
如果您安装的是x64应用程序,并且在安装过程中调用SetRegView 64 ,则还必须在卸载程序中调用SetRegView 64 。
使用Process Monitor调查其他注册表问题......
If you are not installing a x64 application you should not use SetRegView/$PROGRAMFILES64 at all.
If you are installing a x64 application and you called SetRegView 64 during install you also have to call SetRegView 64 in the uninstaller.
Use Process Monitor to investigate other registry issues...
相关问答
听起来就像你想要RegFlushKey功能。 RegFlushKey函数仅在包含指定键的配置单元的所有数据已写入磁盘上的注册表存储时RegFlushKey返回。 RegFlushKey函数写出自上次延迟刷新或系统启动以来已修改的配置单元中其他键的数据。 Sounds like you want the RegFlushKey function. The RegFlushKey function returns only when all the data for the hive that con
...
您可以使用以下列方式定义的registry.DeleteKey : func DeleteKey(k Key, path string) error
DeleteKey删除键k的子键路径及其值。 k, err := registry.OpenKey(registry.LOCAL_MACHINE, `SYSTEM\CurrentControlSet\services`, registry.ALL_ACCESS)
if err != nil {
log.Fatal(err)
}
defer
...
这可能是一个关键值,而不是关键。 也许试试 REG DELETE HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run /v myProgramm
This may be a key value, not a key. maybe try REG DELETE HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run /v myProgramm
您的代码中存在一些错误: RegEnumValue的第4个参数( namesize )是输入输出参数。 所以你必须在每次调用 RegEnumValue 之前,在while循环namesize重置为sizeof(name)/sizeof(name[0]) (在使用char类型的情况下,它只是sizeof(name) )。 这是程序中的主要错误。 如果您不希望在缓冲区具有32,767个字符时出现ERROR_MORE_DATA错误。 它是regitry值的最大名称大小(参见RegEnumValue的文档
...
我认为您正在寻找的是通过使用基本的MSI组件规则来实现的: 设置此共享注册表值的所有MSI都需要将值设置为组件的KeyPath。 组件需要具有相同的组件引导。 如果这些在所有MSI中都是通用的,那么注册表值应仅减少其refcount,而不是在卸载一个产品时删除的整个值。 I think that what you're looking for is achieved by using basic MSI component rules: All MSIs that set this shared
...
删除注册表文件造成了问题。 Filebeat管理文件的状态以及使用探勘器(在内存中)和注册表文件(保存在磁盘中)的事件的确认。 请阅读文档在这里 您可以自己管理每个事件的_id字段,以便任何重复的事件(出于任何原因,即使在生产环境中)在elasticsearch中都不会有两个事件,但会更新事件。 在logstash管道配置文件中创建以下配置。 #if your logs don't have a unique ID, use the following to generate one
finger
...
你的代码中有两个错误: UnauthorizedAccessException异常 - '无法写入注册表项'表示您没有以writable模式打开RegistryKey 。 相反,您应该在尝试删除之前以写入模式打开它。 确保你传递true的第二个参数,如下所示: RegistryKey reg = Registry.CurrentUser.OpenSubKey("SOFTWARE\\..", true);
reg.DeleteValue("MyApp");
最初你的KeyName和条件检查HKEY
...
DeleteRegKey删除键,但我猜你的运行条目实际上是一个值 。 使用DeleteRegValue删除值: DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "electron.app my app"
你为什么使用SHCTX? 如果您知道它总是写入HKEY_CURRENT_USER,请使用HKCU。 DeleteRegKey deletes keys but I'm guessing your run en
...
如果您未安装x64应用程序,则根本不应使用SetRegView / $ PROGRAMFILES64。 如果您安装的是x64应用程序,并且在安装过程中调用SetRegView 64 ,则还必须在卸载程序中调用SetRegView 64 。 使用Process Monitor调查其他注册表问题...... If you are not installing a x64 application you should not use SetRegView/$PROGRAMFILES64 at all.
...
注册表表格是为此设计的: http://msdn.microsoft.com/en-us/library/aa371168(VS.85).aspx 特别参见“名称”的描述: 如果“值”列为空,则名称列中的下表中显示的字符串具有特殊意义。 - 当组件被卸载时,密钥将被删除(如果存在)及其所有值和子密钥。 The Registry table is designed for this: http://msdn.microsoft.com/en-us/library/aa371168(VS.85).as
...