Ignore:
Timestamp:
06/18/10 15:14:57 (4 years ago)
Author:
lowjoel
Message:

Change all internal OpenHandle? functions to private, since they should not be callable from outside the class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser/Eraser.Util/ExtensionMethods/IO.cs

    r2155 r2194  
    8282            DateTime createdTime, DateTime lastModifiedTime, DateTime lastAccessedTime) 
    8383        { 
    84             using (SafeFileHandle streamHandle = new StreamInfo(info.FullName). 
    85                 OpenHandle(FileMode.Open, NativeMethods.FILE_WRITE_ATTRIBUTES, 
    86                     FileShare.ReadWrite, FileOptions.None)) 
    87             { 
    88                 SetTimes(streamHandle, updateTime, createdTime, lastModifiedTime, lastAccessedTime); 
     84            using (SafeFileHandle handle = NativeMethods.CreateFile(info.FullName, 
     85                NativeMethods.FILE_WRITE_ATTRIBUTES, 0, IntPtr.Zero, 
     86                NativeMethods.OPEN_EXISTING, 0, IntPtr.Zero)) 
     87            { 
     88                SetTimes(handle, updateTime, createdTime, lastModifiedTime, lastAccessedTime); 
    8989            } 
    9090        } 
     
    101101            DateTime createdTime, DateTime lastModifiedTime, DateTime lastAccessedTime) 
    102102        { 
    103             using (SafeFileHandle streamHandle = new StreamInfo(info.FullName). 
    104                 OpenHandle(FileMode.Open, NativeMethods.FILE_WRITE_ATTRIBUTES, 
    105                     FileShare.ReadWrite, (FileOptions)NativeMethods.FILE_FLAG_BACKUP_SEMANTICS)) 
    106             { 
    107                 SetTimes(streamHandle, updateTime, createdTime, lastModifiedTime, lastAccessedTime); 
     103            using (SafeFileHandle handle = NativeMethods.CreateFile(info.FullName, 
     104                NativeMethods.FILE_WRITE_ATTRIBUTES, (uint)FileShare.ReadWrite, IntPtr.Zero, 
     105                NativeMethods.OPEN_EXISTING, NativeMethods.FILE_FLAG_BACKUP_SEMANTICS, IntPtr.Zero)) 
     106            { 
     107                SetTimes(handle, updateTime, createdTime, lastModifiedTime, lastAccessedTime); 
    108108            } 
    109109        } 
     
    424424        { 
    425425            List<StreamInfo> result = new List<StreamInfo>(); 
    426             using (FileStream stream = new StreamInfo(info.FullName).Open(FileMode.Open, 
    427                 FileAccess.Read, FileShare.ReadWrite)) 
    428             using (SafeFileHandle streamHandle = stream.SafeFileHandle) 
    429             { 
     426            using (SafeFileHandle streamHandle = NativeMethods.CreateFile(info.FullName, 
     427                NativeMethods.GENERIC_READ, (uint)FileShare.ReadWrite, IntPtr.Zero, 
     428                (uint)FileMode.Open, (uint)FileOptions.None, IntPtr.Zero)) 
     429            { 
     430                if (streamHandle.IsInvalid) 
     431                    throw Win32ErrorCode.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 
     432 
    430433                //Allocate the structures 
    431434                NativeMethods.FILE_STREAM_INFORMATION[] streams = GetADSes(streamHandle); 
Note: See TracChangeset for help on using the changeset viewer.