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