Esempio n. 1
0
        public FileWriter(string fileName)
        {
            var handle = UnmanagedMethods.CreateFile(
                fileName,
                DesiredAccess.Write,
                ShareMode.None,
                IntPtr.Zero,
                CreationDisposition.CreateAlways,
                FlagsAndAttributes.Normal,
                IntPtr.Zero);

            _fileHandle = new FileHandle(handle);

            if (_fileHandle.IsInvalid)
            {
                ThrowLastWin32Err();
            }
        }
Esempio n. 2
0
 internal static extern bool WriteFile(FileHandle hFile, Byte[] aBuffer, UInt32 cbToWrite, ref UInt32 cbThatWereWritten, IntPtr pOverlapped);