How do I uninstall related products in Inno Setup using an InstallShield Upgrade Code GUID

后端 未结 1 1613
情歌与酒
情歌与酒 2021-01-14 22:00

Our company has switched from using InstallShield Express to using Inno Setup (5.5.2 version). We\'ve got years of old installs utilizing InstallShield, but have always rel

1条回答
  •  执念已碎
    2021-01-14 22:28

    Here's an untested translation, which should just print out the related product GUIDs in message boxes. The code should work with ANSI as well as with Unicode versions of InnoSetup:

    [Code]
    #ifdef UNICODE
      #define AW "W"
    #else
      #define AW "A"
    #endif
    
    #define UPGRADE_CODE ""
    
    const
      ERROR_SUCCESS = $00000000;
      ERROR_NOT_ENOUGH_MEMORY = $00000008;
      ERROR_INVALID_PARAMETER = $00000057;
      ERROR_NO_MORE_ITEMS = $00000103;
      ERROR_BAD_CONFIGURATION = $0000064A;
    
    function MsiEnumRelatedProducts(lpUpgradeCode: string; dwReserved: DWORD;
      iProductIndex: DWORD; lpProductBuf: string): UINT;
      external 'MsiEnumRelatedProducts{#AW}@msi.dll stdcall';
    
    function InitializeSetup: Boolean;
    var
      I: Integer;
      ProductBuf: string;
    begin
      Result := True;
    
      I := 0;
      SetLength(ProductBuf, 39);
    
      while MsiEnumRelatedProducts('{#UPGRADE_CODE}', 0, I, ProductBuf) = ERROR_SUCCESS do
      begin
        MsgBox(ProductBuf, mbInformation, MB_OK);
        I := I + 1;
        SetLength(ProductBuf, 39);
      end;
    end;
    

    0 讨论(0)
提交回复
热议问题