Changeset 1841


Ignore:
Timestamp:
2/12/2010 12:56:35 PM (5 years ago)
Author:
lowjoel
Message:

Instead of hardcoding 0x80 to be passed to CreateFile?, use the named constant FILE_READ_ATTRIBUTES. Also, use this flag when querying NTFS volume information so that non-administrators can query NTFS volume information (e.g. MFT record size)

Location:
trunk/eraser6/Eraser.Util
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser6/Eraser.Util/NativeMethods/Kernel.cs

    r1802 r1841  
    298298            uint dwFlagsAndAttributes, IntPtr hTemplateFile); 
    299299 
     300        public const uint FILE_READ_ATTRIBUTES = 0x0080; 
    300301        public const uint GENERIC_READ = 0x80000000; 
    301302        public const uint GENERIC_WRITE = 0x40000000; 
  • trunk/eraser6/Eraser.Util/NtfsApi.cs

    r1802 r1841  
    6161            using (SafeFileHandle volumeHandle = NativeMethods.CreateFile( 
    6262                volume.VolumeId.Remove(volume.VolumeId.Length - 1), 
    63                 NativeMethods.GENERIC_READ, NativeMethods.FILE_SHARE_READ | 
     63                NativeMethods.FILE_READ_ATTRIBUTES, NativeMethods.FILE_SHARE_READ | 
    6464                NativeMethods.FILE_SHARE_WRITE, IntPtr.Zero, NativeMethods.OPEN_EXISTING, 
    6565                0, IntPtr.Zero)) 
  • trunk/eraser6/Eraser.Util/VolumeInfo.cs

    r1838 r1841  
    679679            get 
    680680            { 
    681                 using (SafeFileHandle handle = OpenHandle(0x80u, FileShare.ReadWrite, 
    682                     FileOptions.None)) 
     681                using (SafeFileHandle handle = OpenHandle(NativeMethods.FILE_READ_ATTRIBUTES, 
     682                    FileShare.ReadWrite, FileOptions.None)) 
    683683                { 
    684684                    //This only works if the user has turned on the disk performance 
Note: See TracChangeset for help on using the changeset viewer.