overwolf / jar-infection-scanner

Scan jar files for known infections
MIT License
115 stars 13 forks source link

System.UnauthorizedAccessException: Access to the path 'C:\Documents and Settings' is denied. #9

Open kangarko opened 1 year ago

kangarko commented 1 year ago

Please make it possible to scan the entire disk such as C:\ because right now it gets stuck on accessing protected folders, can you just make it skip those folders?

a

kangarko commented 1 year ago

Same if I selectivelly pick a folder containing protected folders:

a

ketrab2004 commented 1 year ago

This should be fixed when #4 is merged

PhattyOgre commented 1 year ago

Seems that 1.0.1 has less rights than 1.0.0 did. With 1.0.0 I was able to scan locations like 'Program Files' and likewise x86 folder. Using 1.0.1 leaves me now unable to scan these locations. Seems that introduced code in the updated version leaves it unable to scan certain locations.

Using elevated permissions changes this to allow it to scan these locations that 1.0.0 used to scan just fine. But, as was the same case with 1.0.0, elevated permissions in version 1.0.1 is still unable to scan protected Windows locations (C:\Users\ABC123\AppData\Local\Application Data), so no overall loss there.

Still weird that there has been a downgrade in permissions and now requires users to elevate before launch in order to scan some common directories (might need to be included in new documentation if it's not already - it currently isn't as far as I see).

coldReactive commented 1 year ago

I still get this today, even if I elevate it to admin:

Searching for files (this may take a while) ...
System.UnauthorizedAccessException: Access to the path 'C:\Documents and Settings' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.AddSearchableDirsToStack(SearchData localSearchData)
   at System.IO.FileSystemEnumerableIterator`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption)
   at JarInfectionScanner.Form1.<>c__DisplayClass3_0.<buttonScan_Click>b__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at JarInfectionScanner.Form1.<buttonScan_Click>d__3.MoveNext()

For those using curseforge, the folder you should scan is in C:\Users\<username>\curseforge by default and doesn't require anything special.

SKRecreated commented 1 year ago

The issue is resolved if you make the program's searching directory more specific. For example instead of C:\Users\\Appdata use C:\Users\\AppData\Roaming and then proceed to try it with local by changing 'Roaming' to local.

Bluscream commented 1 year ago

Please make it possible to scan the entire disk such as C:\ because right now it gets stuck on accessing protected folders, can you just make it skip those folders?

a

This is fixed in my fork aswell, which has a download: https://github.com/overwolf/jar-infection-scanner/pull/20#issuecomment-1664857031