Using Service install msi, is there a way to get the installer to re-request the user if the credentials were entered incorrectly

During the installation of a Windows service (using the MyServiceInstaller: Installer and ServiceInstaller and ServiceProcessInstaller class), there is a way to force the installer to re-request the user for user account information if they enter it incorrectly.

When incorrect information is provided, the installation displays an error message 1001 with the wrong username or password, and then the installation is not performed. I want to re-call the user until he returns it, or they are canceled from the credential input prompt.

Can I override OnBeforeRollback and try again?

    private ServiceInstaller _ServiceInstaller;
    private ServiceProcessInstaller _ProcessInstaller;

    public GBServiceInstaller()
    {
        InitializeComponent();
        _ServiceInstaller = new ServiceInstaller();
        _ProcessInstaller = new ServiceProcessInstaller();
        _ServiceInstaller.ServiceName = MyService.SERVICENAME;
        _ServiceInstaller.Description = MyService.SERVICEDESCRIPTION;
        _ServiceInstaller.StartType = ServiceStartMode.Manual;
        Installers.Add(_ServiceInstaller);
        Installers.Add(_ProcessInstaller);
+3
1

, , , . , , , .

, API LogonUser, , - , PInvoke #.

+2

Source: https://habr.com/ru/post/1739631/


All Articles