How does Total Commander handle the RestrictInterface value collisions?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
beb
Power Member
Power Member
Posts: 592
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

How does Total Commander handle the RestrictInterface value collisions?

Post by *beb »

Inspired by the discussion over there:
viewtopic.php?t=85851
Dalai wrote: 2025-05-20, 12:08 UTC Set

Code: Select all

[Configuration]
RestrictInterface=8192
(or add 8192 to its value if already present).
TC help, section 4.b), part 2 wrote:RestrictInterface=
Disable parts of the user interface. Just build the sum of the following options:
[...]
8192: Do not redirect plugin ini files to user profile
The full help citation:
RestrictInterface= Disable parts of the user interface. Just build the sum of the following options:
1=Start menu
2=Command line
4=Buttonbar change
8=Drive right click menu
16=File right click menu
32=Directory hotlist change
64=FTP (CTRL+N, CTRL+F)
128=ENTER key (run programs, open files)
256=File system plugins
512=Port connection (via USB or LPT)
1024=Disable update checks (manual and automatic)
2048: Disallow plugins except if signed by us (ghisler)
4096: Disallow plugins without a valid digital signature
6144: Disallow all plugins
8192: Do not redirect plugin ini files to user profile
Following the instructions from the help, I have made a script to automate the RestrictInterface parameter setup.
The script (depending on conditions) does (at least, was intended to do) something like that:
- if no RestrictInterface in the ini, it creates one with the predefined $value in question (8192)
- if RestrictInterface is there, and is non-zero, it adds the predefined $value to the current value if needed.
- if the predefined $value is there (as a standalone, or as a summand of the current value) it does nothing.

Long story short, working on the script, something interesting turns out.

As you can see, the RestrictInterface's option list is a progression that is 'nearly' a perfect binary sequence (a.k.a. powers of two; see: https://oeis.org/A000079):
1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 6144, 8192
or
2^0,2^1,2^2,2^3,2^4,2^5,2^6,2^7,2^8,2^9,2^10,2^11,2^12,3*2^11,2^13

Upon summation of its elements within the sets of valid combinations/permutations/subsets (name it), the genuine binary sequence is fully collision-proof.
That 'nearly' makes the difference, because the '6144' element is an alien here, since it doesn't fall under the rules.
With the '6144' element, the sequence just becomes collision-prone.
That is because 6144 = 2048 + 4096, and 2048 + 6144 = 8192.

As a result:
- being on the top of the sequence* the '6144' element gives us something as follows:
1, ..., 6144 sequence renders 16384 combinations [including zero/null] of which 4096 are the collisions.
- as soon as the '8192' comes to the top**, the '6144' gives us something as follows:
1, ..., 6144, 8192 sequence renders 32768 combinations [including zero/null] of which now 20480 (2/3!) are the collisions.

*,** notes from history:
12.02.21 Added: Disable redirection of plugins: Add 8192 to RestrictInterface in wincmd.ini or registry (32/64)
17.02.19 Added: RestrictInterface=6144: Disallow all plugins (for companies with highest security requirements) (32/64)
Luckily, Ctr+F in the history doesn't show any '6144' occurrences outside of 2, related to the RestrictInterface.

How does Total Commander handle this?
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 16
User avatar
white
Power Member
Power Member
Posts: 5964
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: How does Total Commander handle the RestrictInterface value collisions?

Post by *white »

Would the following text be clearer?
2048: Only allow plugins with a valid digital signature from Ghisler Software (Total Commander author)
4096: Only allow plugins with a valid digital signature
6144: Disallow all plugins (cannot be combined with the two options above)
User avatar
beb
Power Member
Power Member
Posts: 592
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: How does Total Commander handle the RestrictInterface value collisions?

Post by *beb »

2white
That tracks.
However, they (2048,4096,6144,8192) are so different (compared to the 1,...,1024 ones, even by naming, not to mention the essence) to the extent that they might deserve their dedicated options entry (like RestrictPlugins, or something).
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 16
User avatar
Dalai
Power Member
Power Member
Posts: 10013
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: How does Total Commander handle the RestrictInterface value collisions?

Post by *Dalai »

Well, they're not really collisions. I'm pretty sure that TC checks if a specific bit is set. But it's probably correct that 6144 cannot be combined with 4096 and 2048.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
beb
Power Member
Power Member
Posts: 592
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: How does Total Commander handle the RestrictInterface value collisions?

Post by *beb »

2Dalai
Actually, bits were the very first step to figuring out the algorithm to deal with that, even before I met the collisions. It makes no difference whether they are decimals or binaries.

Code: Select all

    1 :              1
    2 :             10
    4 :            100
    8 :           1000
   16 :          10000
   32 :         100000
   64 :        1000000
  128 :       10000000
  256 :      100000000
  512 :     1000000000
 1024 :    10000000000
 2048 :   100000000000
 4096 :  1000000000000
 6144 :  1100000000000
 8192 : 10000000000000
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 16
User avatar
Gral
Power Member
Power Member
Posts: 1609
Joined: 2005-01-26, 15:12 UTC

Re: How does Total Commander handle the RestrictInterface value collisions?

Post by *Gral »

Dalai wrote: 2025-05-23, 20:33 UTC But it's probably correct that 6144 cannot be combined with 4096 and 2048.
There's no need to combine 6144 with 2048 and 4096 - 6144 fully covers functionality of both latter.
User avatar
Dalai
Power Member
Power Member
Posts: 10013
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: How does Total Commander handle the RestrictInterface value collisions?

Post by *Dalai »

Yes, I'm aware of that. But combining 6144 and 2048 (or adding them just as the help states) results in 8192, a completely different flag. And it nullifies the bits set by 2048 and 4096 at the same time. That's why it would be a good idea to explicitely state that 6144 shouldn't be combined with 2048 and 4096, similarly to what white already suggested.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3381
Joined: 2003-05-06, 11:46 UTC

Re: How does Total Commander handle the RestrictInterface value collisions?

Post by *Sir_SiLvA »

Dalai wrote: 2025-05-23, 22:58 UTC That's why it would be a good idea to explicitely state that 6144 shouldn't be combined with 2048 and 4096, similarly to what white already suggested.
Sorry if you have to explicitely state this you are handling a user that clearly should NOT be using TC or even a PC :D
Hoecker sie sind raus!
User avatar
Dalai
Power Member
Power Member
Posts: 10013
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: How does Total Commander handle the RestrictInterface value collisions?

Post by *Dalai »

2Sir_SiLvA
That's just nonsense.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Post Reply