Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
1` DF
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "SafeFileHandle" in [All]

wintrust

.

     SafeFileHandle hFile,

.

For .NET versions prior to 2.0, replace SafeFileHandle with IntPtr

.

SafeFileHandle invalidHandle = new SafeFileHandle(new IntPtr(-1), true);

.

     if (IsCatalogFile(fs.SafeFileHandle, null))

winusb

.

static extern int WinUsb_Initialize(SafeFileHandle DeviceHandle, out IntPtr InterfaceHandle);

.

     SafeFileHandle InterfaceHandle,

ntdll

.

public static extern int NtCreateFile(out SafeFileHandle handle, FileAccess access, OBJECT_ATTRIBUTES* objectAttributes, IO_STATUS_BLOCK* ioStatus, ref long allocSize, uint fileAttributes, FileShare share, uint createDisposition, uint createOptions, IntPtr eaBuffer, uint eaLength);

.

        out  Microsoft.Win32.SafeHandles.SafeFileHandle handle,

.

Microsoft.Win32.SafeHandles.SafeFileHandle hFile;

.

   out SafeFileHandle DirectoryHandle,

.

   SafeFileHandle h;

.

   out SafeFileHandle LinkHandle,

.

   SafeFileHandle h;

.

   SafeFileHandle DirectoryHandle,

.

    static extern IntPtr NtQueryInformationFile(SafeFileHandle fileHandle, ref IO_STATUS_BLOCK IoStatusBlock, IntPtr pInfoBlock, uint length, FILE_INFORMATION_CLASS fileInformation);

.

                IntPtr iprc = NtQueryInformationFile(fs.SafeFileHandle, ref iosb, p_fbi, (uint)Marshal.SizeOf(fbi), FILE_INFORMATION_CLASS.FileBasicInformation);

.

   SafeFileHandle LinkHandle,

dbghelp

.

    MiniDumpWriteDump( GetCurrentProcess(), GetCurrentProcessId(), file.SafeFileHandle.DangerousGetHandle(),

hid

.

static extern Boolean HidD_FlushQueue(SafeFileHandle HidDeviceObject);

.

Declare Function HidD_FlushQueue Lib "hid.dll" (SafeFileHandle HidDeviceObject) As Boolean

.

    internal HIDP_CAPS GetDeviceCapabilities( SafeFileHandle hidHandle )

.

        SafeFileHandle HidDeviceObject,

.

static extern Boolean HidD_GetFeature(SafeFileHandle HidDeviceObject, ref Byte lpReportBuffer, Int32 ReportBufferLength);

.

Declare Function HidD_GetFeature Lib "hid.dll" (ByVal HidDeviceObject As SafeFileHandle, out lpReportBuffer As Byte, ReportBufferLength As Int32) As Boolean

.

Public Shared Function HidD_GetFeature(hidDeviceObject As SafeFileHandle, ByVal reportBuffer As Byte(), ByVal reportBufferLength As UInt32) As Boolean

.

private static extern bool HidD_GetIndexedString(SafeFileHandle HidDeviceObject, uint StringIndex, StringBuilder Buffer, uint BufferLength);

.

private static extern bool HidD_GetInputReport(SafeFileHandle HidDeviceObject, StringBuilder Buffer, uint BufferLength);

.

            SafeFileHandle HidDeviceObject,

.

        ByVal HidDeviceObject As SafeFileHandle, _

.

private static extern bool HidD_GetNumInputBuffers(SafeFileHandle HidDeviceObject, ref uint NumberBuffers);

.

private static extern bool HidD_GetPhysicalDescriptor(SafeFileHandle HidDeviceObject, StringBuilder Buffer, uint BufferLength);

.

public static extern bool HidD_GetPreparsedData(SafeFileHandle HidDeviceObject, ref IntPtr PreparsedData);

.

private static extern bool HidD_GetProductString(SafeFileHandle HidDeviceObject, StringBuilder Buffer, uint BufferLength);

.

private static extern bool HidD_SetFeature(SafeFileHandle HidDeviceObject, ref byte[] Buffer, uint BufferLength);

.

private static extern bool HidD_SetNumInputBuffers(SafeFileHandle HidDeviceObject, uint BufferLength);

msvcrt

.

static extern SafeFileHandle _get_osfhandle(int fd);

kernel32

.

For .NET 2.0, consider using Microsoft.Win32.SafeHandles.SafeFileHandle instead. It can be used where IntPtr is used. If you use a SafeFileHandle, do not call CloseHandle as the CLR will close it for you (even if it's already closed).

.

static extern SafeFileHandle CreateFile(

.

public static extern SafeFileHandle CreateFile(

.

    ByVal hTemplateFile As IntPtr) As Microsoft.Win32.SafeHandles.SafeFileHandle

.

unless the hDrv is of the new SafeFileHandle type.

.

Simply replace the IntPtr's with SafeFileHandle - the updated signature is:

.

    static extern SafeFileHandle CreateFile(

.

    SafeFileHandle handle = CreateFile(Path,GENERIC_WRITE,0,

.

    static extern SafeFileHandle CreateFile(

.

        SafeFileHandle drive = CreateFile( fileName: FileName,

.

    SafeFileHandle drive = CreateFile( fileName: FileName,

.

    ByVal hDevice As Microsoft.Win32.SafeHandles.SafeFileHandle, _

.

    SafeFileHandle hDevice,

.

   IntPtr fileHandle=f.SafeFileHandle.DangerousGetHandle();

.

static extern bool FlushFileBuffers(SafeFileHandle hFile);

.

static extern bool GetCommModemStatus(SafeFileHandle hFile, out uint lpModemStat);

.

Get the SafeFileHandle from call to CreateFile

.

    SafeFileHandle hFile,      // handle to file

.

    ByVal File As SafeFileHandle, _

.

    ByRef Overlapped As System.Threading.NativeOverlapped) As SafeFileHandle

.

NET 2.0 use SafeFileHandle instead of IntPtr

.

    static extern SafeFileHandle CreateFile(string lpFileName, uint dwDesiredAccess,

.

    Private Shared Function CreateFile(ByVal lpFileName As String, ByVal dwDesiredAccess As System.UInt32, ByVal dwShareMode As System.UInt32, ByVal lpSecurityAttributes As IntPtr, ByVal dwCreationDisposition As System.UInt32, ByVal dwFlagsAndAttributes As System.UInt32, ByVal hTemplateFile As IntPtr) As Microsoft.Win32.SafeHandles.SafeFileHandle

.

static extern bool SetCommBreak([InAttribute] SafeFileHandle fileHandle);

.

            SetFileInformationByHandle(fileStream.SafeFileHandle, FileInformationClass.FileDispositionInfo, ref FileInformation, Marshal.SizeOf(FileInformation.FILE_DISPOSITION_INFO));

.

            SetFileInformationByHandle(fileStream.SafeFileHandle, FileInformationClass.FileEndOfFileInfo, ref FileInformation, Marshal.SizeOf(FileInformation.FILE_END_OF_FILE_INFO));

.

        [In] SafeFileHandle hFile,

.

        [In] SafeFileHandle hFile,

.

     SafeFileHandle hFile, long liDistanceToMove,

.

In the Microsoft .NET Framework version 2.0, you should use a SafeFileHandle instead of an IntPtr to refer to hNamedPipe.

.

  static extern bool SetNamedPipeHandleState(SafeFileHandle hNamedPipe, IntPtr lpMode,

.

    ByVal hNamedPipe As SafeFileHandle, _

.

  "File" = The SafeFileHandle to the file to write to. The file must have at least write-level access.

.

    ByVal File As SafeFileHandle, _

.

NET 2.0 use the SafeFileHandle version


 
Access PInvoke.net directly from VS: