17 instantiations of SafeFileHandle
mscorlib (3)
system\console.cs (2)
185SafeFileHandle safeIOHandle = new SafeFileHandle(ioHandle, false); 484SafeFileHandle sh = new SafeFileHandle(handle, false);
system\io\filestream.cs (1)
986: this(new SafeFileHandle(handle, ownsHandle), access, bufferSize, isAsync) {
System (9)
compmod\microsoft\win32\NativeMethods.cs (3)
124public SafeFileHandle hStdInput = new SafeFileHandle(IntPtr.Zero, false); 125public SafeFileHandle hStdOutput = new SafeFileHandle(IntPtr.Zero, false); 126public SafeFileHandle hStdError = new SafeFileHandle(IntPtr.Zero, false);
compmod\system\codedom\compiler\Executor.cs (1)
185si.hStdInput = new SafeFileHandle(UnsafeNativeMethods.GetStdHandle(NativeMethods.STD_INPUT_HANDLE), false);
services\io\system\io\FileSystemWatcher.cs (1)
988new SafeFileHandle(IntPtr.Zero, false) // file with attributes to copy
services\monitoring\system\diagnosticts\Process.cs (4)
134private static SafeFileHandle InvalidPipeHandle = new SafeFileHandle(IntPtr.Zero, false); 2013startupInfo.hStdInput = new SafeFileHandle(NativeMethods.GetStdHandle(NativeMethods.STD_INPUT_HANDLE), false); 2019startupInfo.hStdOutput = new SafeFileHandle(NativeMethods.GetStdHandle(NativeMethods.STD_OUTPUT_HANDLE), false); 2025startupInfo.hStdError = new SafeFileHandle(NativeMethods.GetStdHandle(NativeMethods.STD_ERROR_HANDLE), false);
System.Core (2)
System\IO\MemoryMappedFiles\MemoryMappedFile.cs (2)
300SafeMemoryMappedFileHandle handle = CreateCore(new SafeFileHandle(new IntPtr(-1), true), mapName, inheritability, 368handle = CreateOrOpenCore(new SafeFileHandle(new IntPtr(-1), true), mapName, inheritability,
System.Web (3)
Hosting\IIS7WorkerRequest.cs (1)
1076new Microsoft.Win32.SafeHandles.SafeFileHandle(
Hosting\ISAPIWorkerRequest.cs (1)
1440f = new FileStream(new Microsoft.Win32.SafeHandles.SafeFileHandle(handle,false), FileAccess.Read);
HttpResponse.cs (1)
2924f = new FileStream(new Microsoft.Win32.SafeHandles.SafeFileHandle(fileHandle,false), FileAccess.Read);
204 references to SafeFileHandle
mscorlib (54)
microsoft\win32\win32native.cs (22)
969internal static SafeFileHandle SafeCreateFile(String lpFileName, 974SafeFileHandle handle = CreateFile( lpFileName, dwDesiredAccess, dwShareMode, 993internal static SafeFileHandle UnsafeCreateFile(String lpFileName, 998SafeFileHandle handle = CreateFile( lpFileName, dwDesiredAccess, dwShareMode, 1011private static extern SafeFileHandle CreateFile(String lpFileName, 1018internal static extern SafeFileMappingHandle CreateFileMapping(SafeFileHandle hFile, IntPtr lpAttributes, uint fProtect, uint dwMaximumSizeHigh, uint dwMaximumSizeLow, String lpName); 1037internal static extern int GetFileType(SafeFileHandle handle); 1041internal static extern bool SetEndOfFile(SafeFileHandle hFile); 1046internal static extern bool FlushFileBuffers(SafeFileHandle hFile); 1050private unsafe static extern int SetFilePointerWin32(SafeFileHandle handle, int lo, int * hi, int origin); 1054internal unsafe static long SetFilePointer(SafeFileHandle handle, long offset, System.IO.SeekOrigin origin, out int hr) { 1075unsafe internal static extern int ReadFile(SafeFileHandle handle, byte* bytes, int numBytesToRead, IntPtr numBytesRead_mustBeZero, NativeOverlapped* overlapped); 1079unsafe internal static extern int ReadFile(SafeFileHandle handle, byte* bytes, int numBytesToRead, out int numBytesRead, IntPtr mustBeZero); 1091internal static unsafe extern int WriteFile(SafeFileHandle handle, byte* bytes, int numBytesToWrite, IntPtr numBytesWritten_mustBeZero, NativeOverlapped* lpOverlapped); 1095internal static unsafe extern int WriteFile(SafeFileHandle handle, byte* bytes, int numBytesToWrite, out int numBytesWritten, IntPtr mustBeZero); 1100internal static unsafe extern bool CancelIoEx(SafeFileHandle handle, NativeOverlapped* lpOverlapped); 1181internal unsafe static extern bool SetFileTime(SafeFileHandle hFile, FILE_TIME* creationTime, 1186internal static extern int GetFileSize(SafeFileHandle hFile, out int highSize); 1190internal static extern bool LockFile(SafeFileHandle handle, int offsetLow, int offsetHigh, int countLow, int countHigh); 1194internal static extern bool UnlockFile(SafeFileHandle handle, int offsetLow, int offsetHigh, int countLow, int countHigh); 1734internal static unsafe extern bool ReadConsoleW(SafeFileHandle hConsoleInput, Byte* lpBuffer, Int32 nNumberOfCharsToRead, out Int32 lpNumberOfCharsRead, IntPtr pInputControl); 1743internal static unsafe extern bool WriteConsoleW(SafeFileHandle hConsoleOutput, Byte* lpBuffer, Int32 nNumberOfCharsToWrite, out Int32 lpNumberOfCharsWritten, IntPtr lpReservedMustBeNull);
system\console.cs (3)
185SafeFileHandle safeIOHandle = new SafeFileHandle(ioHandle, false); 484SafeFileHandle sh = new SafeFileHandle(handle, false); 524private static unsafe bool ConsoleHandleIsWritable(SafeFileHandle outErrHandle) {
system\io\__consolestream.cs (5)
41private SafeFileHandle _handle; 50internal __ConsoleStream(SafeFileHandle handle, FileAccess access, bool useFileAPIs) 174private unsafe static int ReadFileNative(SafeFileHandle hFile, byte[] bytes, int offset, int count, bool useFileAPIs, bool isPipe, out int bytesRead) { 236private static unsafe int WriteFileNative(SafeFileHandle hFile, byte[] bytes, int offset, int count, bool useFileAPIs) { 289private static extern void WaitForAvailableConsoleInput(SafeFileHandle file, bool isPipe);
system\io\directory.cs (5)
463using (SafeFileHandle handle = Directory.OpenHandle(path)) { 500using (SafeFileHandle handle = Directory.OpenHandle(path)) { 537using (SafeFileHandle handle = Directory.OpenHandle(path)) { 1497private static SafeFileHandle OpenHandle(String path) 1508SafeFileHandle handle = Win32Native.SafeCreateFile (
system\io\file.cs (5)
178using(SafeFileHandle handle = Win32Native.UnsafeCreateFile(fullSourceFileName, FileStream.GENERIC_READ, FileShare.Read, null, FileMode.Open, 0, IntPtr.Zero)) { 495SafeFileHandle handle; 559SafeFileHandle handle; 623SafeFileHandle handle; 1455private static FileStream OpenFile(String path, FileAccess access, out SafeFileHandle handle)
system\io\filestream.cs (9)
90private SafeFileHandle _handle; // For cancellation support. 131SafeFileHandle handle, 421private SafeFileHandle _handle; 992public FileStream(SafeFileHandle handle, FileAccess access) 999public FileStream(SafeFileHandle handle, FileAccess access, int bufferSize) 1009public FileStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) { 1424public virtual SafeFileHandle SafeFileHandle { 2486private unsafe int ReadFileNative(SafeFileHandle handle, byte[] bytes, int offset, int count, NativeOverlapped* overlapped, out int hr) 2542private unsafe int WriteFileNative(SafeFileHandle handle, byte[] bytes, int offset, int count, NativeOverlapped* overlapped, out int hr) {
system\io\isolatedstorage\isolatedstoragefilestream.cs (1)
401public override SafeFileHandle SafeFileHandle {
system\io\longpath.cs (1)
226using(SafeFileHandle handle = Win32Native.UnsafeCreateFile(fullSourceFileName, FileStream.GENERIC_READ, FileShare.Read, null, FileMode.Open, 0, IntPtr.Zero)) {
system\security\accesscontrol\filesecurity.cs (3)
338internal FileSystemSecurity( bool isContainer, SafeFileHandle handle, AccessControlSections includeSections, bool isDirectory ) 458internal void Persist(SafeFileHandle handle, string fullPath) 655internal FileSecurity(SafeFileHandle handle, string fullPath, AccessControlSections includeSections)
PresentationCore (15)
Core\CSharp\MS\Internal\FontCache\FontCacheUtil.cs (1)
1041using (SafeFileHandle fileHandle = UnsafeNativeMethods.CreateFile(
Core\CSharp\System\Windows\Media\Imaging\BitmapDecoder.cs (4)
213SafeFileHandle safeFilehandle 301SafeFileHandle safeFilehandle = null; 1153out SafeFileHandle safeFilehandle 1999private SafeFileHandle _safeFilehandle;
Core\CSharp\System\Windows\Media\Imaging\BitmapDownload.cs (1)
161SafeFileHandle fileHandle = MS.Win32.UnsafeNativeMethods.CreateFile(
Core\CSharp\System\Windows\Media\Imaging\BmpBitmapDecoder.cs (1)
98SafeFileHandle safeFilehandle
Core\CSharp\System\Windows\Media\Imaging\GifBitmapDecoder.cs (1)
98SafeFileHandle safeFilehandle
Core\CSharp\System\Windows\Media\Imaging\IconBitmapDecoder.cs (1)
98SafeFileHandle safeFilehandle
Core\CSharp\System\Windows\Media\Imaging\JpegBitmapDecoder.cs (1)
98SafeFileHandle safeFilehandle
Core\CSharp\System\Windows\Media\Imaging\PngBitmapDecoder.cs (1)
98SafeFileHandle safeFilehandle
Core\CSharp\System\Windows\Media\Imaging\TiffBitmapDecoder.cs (1)
98SafeFileHandle safeFilehandle
Core\CSharp\System\Windows\Media\Imaging\UnknownBitmapDecoder.cs (1)
89SafeFileHandle safeFilehandle
Core\CSharp\System\Windows\Media\Imaging\WmpBitmapDecoder.cs (1)
98SafeFileHandle safeFilehandle
Core\CSharp\System\Windows\Media\UnsafeNativeMethodsMilCoreApi.cs (1)
1045Microsoft.Win32.SafeHandles.SafeFileHandle /*ULONG_PTR*/ hFileHandle,
System (46)
compmod\microsoft\win32\NativeMethods.cs (8)
124public SafeFileHandle hStdInput = new SafeFileHandle(IntPtr.Zero, false); 125public SafeFileHandle hStdOutput = new SafeFileHandle(IntPtr.Zero, false); 126public SafeFileHandle hStdError = new SafeFileHandle(IntPtr.Zero, false); 185public static extern bool CreatePipe(out SafeFileHandle hReadPipe, out SafeFileHandle hWritePipe, SECURITY_ATTRIBUTES lpPipeAttributes, int nSize); 1307public static extern SafeFileHandle CreateFile(string lpFileName,int dwDesiredAccess,int dwShareMode, SECURITY_ATTRIBUTES lpSecurityAttributes, int dwCreationDisposition,int dwFlagsAndAttributes, SafeFileHandle hTemplateFile); 1320out SafeFileHandle targetHandle,
compmod\microsoft\win32\UnsafeNativeMethods.cs (25)
86public static extern int WldpSetDynamicCodeTrust([In] SafeFileHandle fileHandle); 90public static extern int WldpQueryDynamicCodeTrust([In] SafeFileHandle fileHandle, [In] IntPtr image, [In] uint imageSize); 400public unsafe static extern bool ReadDirectoryChangesW(SafeFileHandle hDirectory, HandleRef lpBuffer, 484internal static extern SafeFileHandle CreateFile(String lpFileName, 492SafeFileHandle hFile, // handle to communications device 499SafeFileHandle hFile, // handle to communications device 507SafeFileHandle hFile, // handle to communications device 514SafeFileHandle hFile, // handle to communications device 522SafeFileHandle hFile, // handle to comm device 529SafeFileHandle hFile // handle to comm device 535SafeFileHandle hFile // handle to comm device 541SafeFileHandle hFile, // handle to comm device 549SafeFileHandle hFile, // handle to comm device 557SafeFileHandle hFile, // handle to communications resource 563internal static extern bool FlushFileBuffers(SafeFileHandle hFile); 568SafeFileHandle hFile, // handle to comm device 575unsafe internal static extern int ReadFile(SafeFileHandle handle, byte* bytes, int numBytesToRead, IntPtr numBytesRead, NativeOverlapped* overlapped); 579unsafe internal static extern int ReadFile(SafeFileHandle handle, byte* bytes, int numBytesToRead, out int numBytesRead, IntPtr overlapped); 583unsafe internal static extern int WriteFile(SafeFileHandle handle, byte* bytes, int numBytesToWrite, IntPtr numBytesWritten, NativeOverlapped* lpOverlapped); 587unsafe internal static extern int WriteFile(SafeFileHandle handle, byte* bytes, int numBytesToWrite, out int numBytesWritten, IntPtr lpOverlapped); 592SafeFileHandle hFile // handle to file 597SafeFileHandle hFile, // handle to communications device 604SafeFileHandle hFile, // handle to comm device 612SafeFileHandle hFile, 619SafeFileHandle hFile,
services\io\system\io\FileSystemWatcher.cs (1)
43private SafeFileHandle directoryHandle;
services\monitoring\system\diagnosticts\Process.cs (9)
134private static SafeFileHandle InvalidPipeHandle = new SafeFileHandle(IntPtr.Zero, false); 1891private static void CreatePipeWithSecurityAttributes(out SafeFileHandle hReadPipe, out SafeFileHandle hWritePipe, NativeMethods.SECURITY_ATTRIBUTES lpPipeAttributes, int nSize) { 1907private void CreatePipe(out SafeFileHandle parentHandle, out SafeFileHandle childHandle, bool parentInputs) { 1911SafeFileHandle hTmp = null; 2002SafeFileHandle standardInputWritePipeHandle = null; 2003SafeFileHandle standardOutputReadPipeHandle = null; 2004SafeFileHandle standardErrorReadPipeHandle = null;
sys\system\io\ports\SerialStream.cs (3)
82internal SafeFileHandle _handle = null; 654SafeFileHandle tempHandle = UnsafeNativeMethods.CreateFile("\\\\.\\" + portName, 1674private SafeFileHandle handle = null;
System.Core (12)
Microsoft\Win32\UnsafeNativeMethods.cs (8)
165internal static extern int GetFileType(SafeFileHandle handle); 169internal static unsafe extern int WriteFile(SafeFileHandle handle, byte* bytes, int numBytesToWrite, 179private static extern SafeFileHandle CreateFile(String lpFileName, 187internal static SafeFileHandle SafeCreateFile(String lpFileName, 191SafeFileHandle handle = CreateFile(lpFileName, dwDesiredAccess, dwShareMode, 217private unsafe static extern int SetFilePointerWin32(SafeFileHandle handle, int lo, int* hi, int origin); 221internal unsafe static long SetFilePointer(SafeFileHandle handle, long offset, System.IO.SeekOrigin origin, out int hr) { 1433SafeFileHandle hFile,
System\IO\LogStream.cs (2)
49private SafeFileHandle _handle; 366private void EnforceRetentionPolicy(SafeFileHandle handle, long lastPos)
System\IO\MemoryMappedFiles\MemoryMappedFile.cs (2)
379private static SafeMemoryMappedFileHandle CreateCore(SafeFileHandle fileHandle, String mapName, 454private static SafeMemoryMappedFileHandle CreateOrOpenCore(SafeFileHandle fileHandle, String mapName,
System.Data (4)
fx\src\data\System\Data\SQLTypes\SQLFileStream.cs (1)
615Microsoft.Win32.SafeHandles.SafeFileHandle hFile = null;
fx\src\data\System\Data\SQLTypes\UnsafeNativeMethods.cs (3)
31out Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle, 48Microsoft.Win32.SafeHandles.SafeFileHandle hFile 161Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle,
System.IO.Log (70)
System\IO\Log\LogExtentCollection.cs (1)
159SafeFileHandle logHandle = this.collection.Store.Handle;
System\IO\Log\LogStore.cs (3)
35SafeFileHandle logFile; 165public LogStore(SafeFileHandle handle) 300public SafeFileHandle Handle
System\IO\Log\UnsafeNativeMethods.cs (66)
94public string GetActualFileName(SafeFileHandle hLog) 470public static SafeFileHandle CreateLogFile( 478SafeFileHandle ret = _CreateLogFile( 542SafeFileHandle hLog, 631SafeFileHandle hLog, 1060public static void AddLogContainerSync(SafeFileHandle hLog, 1100SafeFileHandle hLog, 1139public static void RemoveLogContainerSync(SafeFileHandle hLog, 1181SafeFileHandle hLog, 1232public static void SetLogArchiveTailSync(SafeFileHandle hLog, 1257public static void SetEndOfLogSync(SafeFileHandle hLog, 1323SafeFileHandle hLog, 1429SafeFileHandle hLog, 1456public static void SetLogArchiveMode(SafeFileHandle hLog, 1476SafeFileHandle hLog, 1492SafeFileHandle hLog, 1508SafeFileHandle hLog, 1524SafeFileHandle hLog, 1540SafeFileHandle hLog, 1556SafeFileHandle hLog, 1572SafeFileHandle hLog, 1588SafeFileHandle hLog, 1604SafeFileHandle hLog, 1615SafeFileHandle hLog, 1626SafeFileHandle hLog, 1637SafeFileHandle hLog, 1648SafeFileHandle hLog, 1659SafeFileHandle hLog, 1670SafeFileHandle hLog, 1681SafeFileHandle hLog, 1691public static uint HandleLogFull(SafeFileHandle hLog) 1727SafeFileHandle hLog, 1748SafeFileHandle hLog, 1789SafeFileHandle hLog, 1863extern static SafeFileHandle _CreateLogFile( 1888SafeFileHandle hLog, 1920SafeFileHandle hLog, 2071extern static bool _AddLogContainer(SafeFileHandle hLog, 2083SafeFileHandle hLog, 2094extern static bool _RemoveLogContainer(SafeFileHandle hLog, 2105SafeFileHandle hLog, 2126extern static bool _SetLogArchiveTail(SafeFileHandle hLog, 2135extern static bool _SetEndOfLog(SafeFileHandle hLog, 2155SafeFileHandle hLog, 2199SafeFileHandle hLog, 2211SafeFileHandle hLog, 2225SafeFileHandle hLog, 2236SafeFileHandle hLog, 2247SafeFileHandle hLog, 2258SafeFileHandle hLog, 2269SafeFileHandle hLog, 2280SafeFileHandle hLog, 2291SafeFileHandle hLog, 2302SafeFileHandle hLog, 2313SafeFileHandle hLog, 2322SafeFileHandle hLog, 2331SafeFileHandle hLog, 2340SafeFileHandle hLog, 2349SafeFileHandle hLog, 2358SafeFileHandle hLog, 2367SafeFileHandle hLog, 2376SafeFileHandle hLog, 2388extern static bool _HandleLogFull(SafeFileHandle hLog); 2396SafeFileHandle hLog, 2406SafeFileHandle hLog, 2426SafeFileHandle hLog,
WindowsBase (3)
Shared\MS\Win32\UnsafeNativeMethodsOther.cs (3)
260internal unsafe static extern SafeFileHandle CreateFile( 637internal unsafe static extern SafeFileMappingHandle CreateFileMapping(SafeFileHandle hFile, NativeMethods.SECURITY_ATTRIBUTES lpFileMappingAttributes, int flProtect, uint dwMaximumSizeHigh, uint dwMaximumSizeLow, string lpName); 1221SafeFileHandle hFile,