Elmore
Posts: 6
Joined: Sun Aug 16, 2020 10:59 am

Prevent installation in the system folder

Hello.

How can I check for system folders at the stage of choosing the installation directory? And prohibit installation in them.

So that if user chooses to install in the folders: "Program Files" "Program Files (x86)" "Program Data" "Windows" - he will be warned that these folders cannot be installed and the "continue installation" button was inactive.
Catalin
Posts: 6586
Joined: Wed Jun 13, 2018 7:49 am

Re: Prevent installation in the system folder

Hello,

In order to achieve that, please have a look over the following forum thread in which I have explained to another user how to prevent the installation in a path containing whitespace characters:

Restrict users not to add spaces in the installation path

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Elmore
Posts: 6
Joined: Sun Aug 16, 2020 10:59 am

Re: Prevent installation in the system folder

It helped, Thank you.

But here's another problem. My program doesn't work if there are Cyrillic characters in the path.
I also need to prohibit the installation if the path contains Cyrillic.

How can this be done correctly?
Elmore
Posts: 6
Joined: Sun Aug 16, 2020 10:59 am

Re: Prevent installation in the system folder

I need to make it so that the installer allows you to continue if there are only English letters and numbers in the path. If something else - block (with a warning, as for a folder).
But in that method, as with folders, there is a problem: "in English - COP" and "in Russian - COP" the installer does NOT distinguish between. These are different languages!
And my program does not work if it is written in Russian (the word was coined for an example). So the installer must be sure to check.
Catalin
Posts: 6586
Joined: Wed Jun 13, 2018 7:49 am

Re: Prevent installation in the system folder

Hello,

You are always welcome!

I am glad it helped.
But here's another problem. My program doesn't work if there are Cyrillic characters in the path.
I also need to prohibit the installation if the path contains Cyrillic.

How can this be done correctly?
I believe that here you can use pretty much the same approach as above. However, please note that I have not tested this and I am not quite sure how PowerShell will react to Cyrillic characters (if you are using the PowerShell approach, of course).
But in that method, as with folders, there is a problem: "in English - COP" and "in Russian - COP" the installer does NOT distinguish between. These are different languages!
And my program does not work if it is written in Russian (the word was coined for an example). So the installer must be sure to check.
I am not quite sure I understand this. Could you please give me some more details so I can better understand?

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Elmore
Posts: 6
Joined: Sun Aug 16, 2020 10:59 am

Re: Prevent installation in the system folder

Catalin wrote: Tue Dec 08, 2020 6:10 pm
But in that method, as with folders, there is a problem: "in English - COP" and "in Russian - СОР" the installer does NOT distinguish between. These are different languages!
And my program does not work if it is written in Russian (the word was coined for an example). So the installer must be sure to check.
I am not quite sure I understand this. Could you please give me some more details so I can better understand?
The symbols look the same in two different languages. I even wrote them in different languages.
And the installer does not distinguish between them as different, but believes that they are one and the same. But:
in English - COP - means police officer
in Russian - СОР - means garbage
And for defining characters in path (character-blocking) is a problem.
Made it a "rough" method by blocking all non-matching characters from these languages. But I was hoping for a nicer solution.

I would allow installation if the path contains only English letters and numbers. But the problem with the "cop" example, I'm afraid it won't let me do that.
Catalin
Posts: 6586
Joined: Wed Jun 13, 2018 7:49 am

Re: Prevent installation in the system folder

Hello,

Thank you for your followup on this. The scenario is more clear to me now.
I would allow installation if the path contains only English letters and numbers. But the problem with the "cop" example, I'm afraid it won't let me do that.
I have done some research on this and it looks like this is no easy task - if possible at all.

I have also checked the translation and the characters look indeed the same as the latin characters.

Unfortunately, I am not aware of any method to achieve this rather than exlcluding every Russian character. I believe this should work unless the path will look something like this: C:\cop (or a combination of the same letters, either uppercase or lowercase), which I would think of as a rare corner-case.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”