예제 #1
0
        private static SafeFileHandle GetFileHandle(string normalizedPath, FileMode mode, FileAccess access, FileShare share,
                                                    FileOptions options)
        {
            var handle = NativeMethods.CreateFile(normalizedPath, access.ToNative(), share.ToNative(), IntPtr.Zero,
                                                  mode.ToNative(),
                                                  options.ToNative(), IntPtr.Zero);

            if (handle.IsInvalid)
            {
                throw LongPathCommon.GetExceptionFromLastWin32Error();
            }

            return(handle);
        }
예제 #2
0
        private static SafeFileHandle GetFileHandle(string normalizedPath, FileMode mode, FileAccess access, FileShare share,
            FileOptions options)
        {
            var handle = NativeMethods.CreateFile(normalizedPath, access.ToNative(), share.ToNative(), IntPtr.Zero,
                                                  mode.ToNative(),
                                                  options.ToNative(), IntPtr.Zero);
            if (handle.IsInvalid)
                throw LongPathCommon.GetExceptionFromLastWin32Error();

            return handle;
        }