Changeset 810


Ignore:
Timestamp:
12/12/2008 11:20:06 AM (6 years ago)
Author:
lowjoel
Message:

Apparently SfcIsFileProtected? can return 0 as well, no idea why. But the files are usually unprotected.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/Util/File.cs

    r611 r810  
    177177            if (SfcIsFileProtected(IntPtr.Zero, filePath)) 
    178178                return true; 
    179             else if (Marshal.GetLastWin32Error() == 2) //ERROR_FILE_NOT_FOUND 
    180                 return false; 
    181  
    182             throw new Win32Exception("Unknown SfcIsFileProtected error."); 
     179 
     180            switch (Marshal.GetLastWin32Error()) 
     181            { 
     182                case 0: //ERROR_SUCCESS 
     183                case 2: //ERROR_FILE_NOT_FOUND 
     184                    return false; 
     185 
     186                default: 
     187                    throw new Win32Exception("Unknown SfcIsFileProtected error."); 
     188            } 
    183189        } 
    184190 
Note: See TracChangeset for help on using the changeset viewer.