0

I have seen this question multiple times posted yet a clear answer has not been given (except that it should not be possible, yet TreeSize does it..., so does a virusscanner).

I'm creating a C# application that needs to scan a drive on folders/files and see if they are changed (by creating a checksum).

By scanning the C:\Document and Settings\ (or C:\Users\), it is not fully accessible. The thing is: TreeSize (a scanning application to see where your diskspace has been used) is able to scan everything... So how do they do it?

What have I tried without success:

  1. Using app.manifest to requireAdministrator rights when starting the application.

  2. Using Directory.GetFiles(<path>) and Directory.GetDirectories(<path>) to obtain all files / directories.

  3. Add a FileSystemAuditRule to the FileSecurity (AccessControl) which did not give me access.

  4. Tried decompiling TreeSize, yet it has been made with Delphi as far I could see... So no success;

  5. Read multiple similar Stackoverflow posts, where one said: "You are running as administrator, but is your process elevated?" Which I did not understand. He never explained if there is a difference between Administrator rights and the process being elevated. Is there a difference between those? (C# Access to the path 'C:\Documents and Settings\' is denied)

Palle Due
  • 5,929
  • 4
  • 17
  • 32
Michiel
  • 67
  • 1
  • 6
  • 2
    Even an administrator account can't access _all_ files. – stuartd May 23 '22 at 10:12
  • shift right click your exe and try run as administrator – Gian Paolo May 23 '22 at 10:13
  • 1
    Your application would need read access to be able to compute the checksum. TreeSize would only need access to scan files. I don't know if that influences your solution. – Palle Due May 23 '22 at 10:53
  • @PalleDue That may be the case for TreeSize... Yet reading out all the files... I suppose a virusscanner also has permission to do this... So what is different? – Michiel May 23 '22 at 11:04
  • A virus scanner is a different beast, I think it hard to write your own. – Palle Due May 23 '22 at 12:11

0 Answers0