예제 #1
0
        public static unsafe NativeFileObject Open(string fileName, FileObjectAccessRights accessRights, FileShareMode shareMode, FileDisposition disposition, FileAttributes attributes)
        {
            SafeFileObjectHandle handle = CreateFileW(fileName, (uint)accessRights, (uint)shareMode, null, (uint)disposition, (uint)attributes, SafeFileObjectHandle.InvalidHandle);

            if (handle.IsInvalid)
            {
                throw new Win32Exception();
            }
            return(new NativeFileObject(handle));
        }
예제 #2
0
 internal static unsafe extern SafeFileMappingHandle CreateFileMappingA(SafeFileObjectHandle fileHandle, [Optional] SecurityAttributes *securityAttributes, UInt32 flProtect, UInt32 dwMaximumSizeHigh, UInt32 dwMaximumSizeLow, [MarshalAs(UnmanagedType.LPStr)] string name);
예제 #3
0
 internal static extern bool UnlockFileNative(SafeFileObjectHandle handle, UInt32 offsetLow, UInt32 offsetHigh, UInt32 sizeLow, UInt32 sizeHigh);
예제 #4
0
 internal static extern FileObjectType GetFileType(SafeFileObjectHandle handle);
예제 #5
0
 internal static extern unsafe SafeFileObjectHandle CreateFileW([MarshalAs(UnmanagedType.LPWStr)] string fileName, UInt32 desiredAccess, UInt32 shareMode, SecurityAttributes *securityAttributes, UInt32 creationDisposition, UInt32 flagsAndAttributes, SafeFileObjectHandle template);
예제 #6
0
 internal static extern unsafe bool DeviceIoControl(SafeFileObjectHandle handle, DeviceIoControlCode controlCode, void *inBuffer, uint inBufferLength, void *outBuffer, uint outBufferLength, out uint returnSize, void *lpOverlapped);
예제 #7
0
 public NativeFileObject(FileStream stream)
 {
     this.handle = new SafeFileObjectHandle(stream.SafeFileHandle);
 }
예제 #8
0
 internal NativeFileObject(SafeFileObjectHandle handle)
 {
     this.handle = handle;
 }