Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect when Controlled Folder Access is active

On Win10, the "anti-ransomware" feature Controlled Folder Access impedes accessing non-whitelisted softwares to certain folders.

Is there a way (API) to know if that feature is in place when you get an error in some file operation?, so far I could find none.

Specifically what I am after is adding in de Desktop a link/icon to the app during installation. As far as I know, innoSetup is not aware of this and throws an error so my idea is to create the link myself and, in case of error inform the user, but I'd like to confirm that the real cause of the problem is CFA.

like image 311
tru7 Avatar asked Oct 24 '25 09:10

tru7


2 Answers

You can find in registry if the feature is enabled or not:

In key \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Defender\Windows Defender Exploit Guard\Controlled Folder Access, there is a read-only property EnableControlledFolderAccess equals to 1 if anti-ransomware is enabled, 0 otherwise.

Subkey AllowedApplications lists full .exe path of applications already allowed.

Subkey ProtectedFolders lists folders manually added by user (Documents, Pictures, Favorites, Videos and Music directories are defacto protected).

like image 114
Thierry Avatar answered Oct 26 '25 08:10

Thierry


Try PowerShell:

Get-MpPreference | Select-Object -ExpandProperty EnableControlledFolderAccess

Also, you may check protected folders and allowed apps:

Get-MpPreference | Select-Object -ExpandProperty ControlledFolderAccessProtectedFolders
Get-MpPreference | Select-Object -ExpandProperty ControlledFolderAccessAllowedApplications

However, if you need it just for you setup, try to run the installer with the admin rights.

like image 30
xmedeko Avatar answered Oct 26 '25 07:10

xmedeko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!