Changeset 1559


Ignore:
Timestamp:
1/18/2010 5:59:07 AM (5 years ago)
Author:
lowjoel
Message:

Move Get/SetFileTimes? together with the FileTimeToDateTime/DateTimeToFileTime? functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/CodeReview/Eraser.Util/KernelApi.cs

    r1543 r1559  
    5959        /// are created as detached processes (by calling the CreateProcess function 
    6060        /// with the DETACHED_PROCESS flag).</remarks> 
     61        [Obsolete] 
    6162        public static bool AllocConsole() 
    6263        { 
     
    8182        /// After a process calls FreeConsole, it can call the AllocConsole function to 
    8283        /// create a new console or AttachConsole to attach to another console.</remarks> 
     84        [Obsolete] 
    8385        public static bool FreeConsole() 
    8486        { 
     
    103105 
    104106            return result; 
    105         } 
    106  
    107         /// <summary> 
    108         /// Converts a Win32 Error code to a HRESULT. 
    109         /// </summary> 
    110         /// <param name="errorCode">The error code to convert.</param> 
    111         /// <returns>A HRESULT value representing the error code.</returns> 
    112         internal static int GetHRForWin32Error(int errorCode) 
    113         { 
    114             const uint FACILITY_WIN32 = 7; 
    115             return errorCode <= 0 ? errorCode : 
    116                 (int)((((uint)errorCode) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000); 
    117         } 
    118  
    119         /// <summary> 
    120         /// Gets a Exception for the given Win32 error code. 
    121         /// </summary> 
    122         /// <param name="errorCode">The error code.</param> 
    123         /// <returns>An exception object representing the error code.</returns> 
    124         internal static Exception GetExceptionForWin32Error(int errorCode) 
    125         { 
    126             int HR = GetHRForWin32Error(errorCode); 
    127             return Marshal.GetExceptionForHR(HR); 
    128107        } 
    129108 
     
    177156                throw KernelApi.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 
    178157            } 
     158        } 
     159 
     160        /// <summary> 
     161        /// Converts a Win32 Error code to a HRESULT. 
     162        /// </summary> 
     163        /// <param name="errorCode">The error code to convert.</param> 
     164        /// <returns>A HRESULT value representing the error code.</returns> 
     165        internal static int GetHRForWin32Error(int errorCode) 
     166        { 
     167            const uint FACILITY_WIN32 = 7; 
     168            return errorCode <= 0 ? errorCode : 
     169                (int)((((uint)errorCode) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000); 
     170        } 
     171 
     172        /// <summary> 
     173        /// Gets a Exception for the given Win32 error code. 
     174        /// </summary> 
     175        /// <param name="errorCode">The error code.</param> 
     176        /// <returns>An exception object representing the error code.</returns> 
     177        internal static Exception GetExceptionForWin32Error(int errorCode) 
     178        { 
     179            int HR = GetHRForWin32Error(errorCode); 
     180            return Marshal.GetExceptionForHR(HR); 
    179181        } 
    180182 
Note: See TracChangeset for help on using the changeset viewer.