Desktop Functions: Smart Device Functions:
|
Search Results for "CreateFile" in [All]ntdll1: NtCreateFile
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);
public static extern int NtCreateFile(
Declare Function NtCreateFile Lib "ntdll.dll" (TODO) As TODO
IntPtr _RootHandle; //This will need to be initialized with the root handle, can use CreateFile from kernel32.dll
int fOk = Win32Api.NtCreateFile( setupapiPrivate Declare Function CreateFile Lib “kernel32″ Alias “CreateFileA” _ DeviceHandle = CreateFile(DeviceName, _ advapi323: Tyde
icmp6: IcmpSendEcho
private static extern IntPtr IcmpCreateFile();
IntPtr icmpHandle = IcmpCreateFile();
HANDLE WINAPI IcmpCreateFile(VOID);
HANDLE hIcmpFile = IcmpCreateFile();
printf("IcmpCreatefile returned error: %ld\n", GetLastError()); rapi7: CeCreateFile
public static extern int CeCreateFile( function info on msdn at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceactsy/html/cerefCeCreateFileRAPI.asp
CeCreateFile("\\test.txt", GENERIC_READ | GENERIC_WRITE, 0, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0); hid
deviceHandle = CreateFile(devicePath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, IntPtr.Zero); gdi32hSection is a handle to a file mapping object that the function will use to create the DIB and can be NULL. If hSection is not NULL, it must be a handle to a file mapping object created by calling the CreateFileMapping function (otherwise CreateDIBSection will fail). Moreover, the CreateDIBSection function will locate the bitmap’s bit values at offset dwOffset in the file mapping object referred to by hSection. An application can retrieve the hSection handle by calling the GetObject function with the HBITMAP returned by CreateDIBSection. Constants10: FILE_SHARE_READ
11: FILE_SHARE_WRITE
12: MAX_PATH This is the maximum number of characters, usually including a null terminator, of a standard fully-pathed filename for most Windows API functions that operate on filenames (and a few .NET ones, such as Assembly.LoadFrom). Those that fill a buffer with a filename, such as GetTempFileName, expect a buffer of exactly this length. Some functions, such as CreateFile, can be made to accept longer filenames by using the "\\?\" syntax. 13: OPEN_EXISTING
14: Win32ErrorCodes
/// <summary>The NtCreateFile API failed. This error should never be returned to an application, it is a place holder for the Windows LAN Manager Redirector to use in its internal error mapping routines.</summary> 15: WINERROR
public const int CO_E_FAILEDTOCREATEFILE = (int)(0x80010137 - 0x100000000); coredll16: CreateFile
static extern IntPtr CreateFile(String lpFileName, UInt32 dwDesiredAccess, UInt32 dwShareMode, IntPtr lpSecurityAttributes, UInt32 dwCreationDisposition, UInt32 dwFlagsAndAttributes, IntPtr hTemplateFile); Declare Function CreateFile Lib "coredll" (ByVal lpFileName As String, ByVal dwDesiredAccess As Integer, ByVal dwShareMode As Integer, ByVal lpSecurityAttributes As Integer, ByVal dwCreationDisposition As Integer, ByVal dwFLagsAndAttributes As Integer, ByVal hTemplateFile As Integer) As Integer 17: DeviceIOControl
IntPtr file = NativeMethods.CreateFile("ACS1:", 0, 0, IntPtr.Zero, ECreationDisposition.OpenExisting, 0, IntPtr.Zero); 18: WriteFile
hFile = CreateFile(txtFileName.Text, GENERIC_READ + GENERIC_WRITE, _ Structures
// See pinvoke definition for CreateFile for the various Enums.
internal static extern IntPtr CreateFile(
IntPtr hMP = CreateFile(rppFolder
public extern static IntPtr CreateFile(string FileName, uint DesiredAccess,
IntPtr h = CreateFile(DevicePath.TrimEnd('\\'), 0, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero);
IntPtr h = CreateFile(Root.HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero);
IntPtr h = CreateFile(PortHubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero);
IntPtr h = CreateFile(HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero);
IntPtr h = CreateFile(PortHubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero);
IntPtr h = CreateFile(Root.HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero);
IntPtr h = CreateFile(ControllerDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero); ole32
static extern int CreateFileMoniker([MarshalAs(UnmanagedType.LPWStr)] string Private Declare Function CreateFileMoniker Lib "ole32.dll" (ByVal lpszPathName As String, ByRef ppmk As IMoniker) As Integer misc29: Comments Dang - I think I broke kernel32.CreateFile when adding coredll.CreateFile - Ian Darling [Note from Adam: This is now fixed, and was actually unrelated to coredll.CreateFile. Thanks!] Enums30: HRESULT
public const int CO_E_FAILEDTOCREATEFILE = unchecked((int)0x80010137);
Public Const CO_E_FAILEDTOCREATEFILE As Integer = CInt(&H80010137UI) 31: OpenFile
// FILE_SHARE_READ|FILE_SHARE_WRITE flags of the CreateFile function.
// This flag is mapped to the FILE_SHARE_READ|FILE_SHARE_WRITE flags of the CreateFile function.
// This flag is mapped to the FILE_SHARE_WRITE flag of the CreateFile function.
// This flag is mapped to the FILE_SHARE_READ flag of the CreateFile function. kernel3232: ClearCommBreak
''' <param name="hFile">The handle into file, a <see cref="CreateFile"/> handle is returning the handle for this.</param> The CreateFile function will returning hFile handle. 33: CloseHandle
hMapFile = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, 4096, "mIRC") 34: CreateFile
public static extern IntPtr CreateFile(
public static extern IntPtr CreateFileA(
public static extern IntPtr CreateFileW(
static extern SafeFileHandle CreateFile(
public static extern SafeFileHandle CreateFile(
Friend Function CreateFile(ByVal lpFileName As String, _
Private Declare PtrSafe Function CreateFileA Lib "kernel32.dll" (ByVal lpFileName As String, _
# Define the CreateFile Method
$CreateFileMethod = $TypeBuilder.DefineMethod(
"CreateFile", # Method Name
$CreateFileDllImport = [System.Runtime.InteropServices.DllImportAttribute].GetConstructor(@([String]))
$CreateFileFieldArray = [System.Reflection.FieldInfo[]] @(
$CreateFileFieldValueArray = [Object[]] @(
"CreateFile",
$CreateFileCustomAttribute = New-Object System.Reflection.Emit.CustomAttributeBuilder(
$CreateFileDllImport,
$CreateFileFieldArray,
$CreateFileFieldValueArray
$CreateFileMethod.SetCustomAttribute($CreateFileCustomAttribute)
$Kernel32::CreateFile(\\.\PHYSICALDRIVE0, [System.IO.FileAccess]::Read, [System.IO.FileShare]::Read, [System.IntPtr]::Zero, [System.IO.FileMode]::Open, [System.UInt32]0x02000000 )
public static extern IntPtr CreateFileW(
$createFile = Add-Type -MemberDefinition $signature -Name 'CreateFile' -Namespace 'pinvoke' -PassThru
$createFile[0]::CreateFileW('\\?\C:\path\to\dir', [System.IO.FileAccess]::Read, [System.IO.FileShare]::Read, [System.IntPtr]::Zero, [System.IO.FileMode]::Open, [System.UInt32]0x02000000, [System.IntPtr]::Zero You can use the IntPtr from Createfile with FileStream. This is usefull for opening devices such as Com1:, Lpt1: and Prn. Unlike the FileStream ctor, CreateFile also allows you to open or create Windows 2000 sub-streams (e.g. "C:\Temp.dat:SubStream1").
IntPtr ptr = CreateFile(filename,access, share,0, mode,0, IntPtr.Zero);
static extern SafeFileHandle CreateFile(
SafeFileHandle handle = CreateFile(Path,GENERIC_WRITE,0,
static extern IntPtr CreateFile(
/// http://www.pinvoke.net/default.aspx/kernel32.CreateFile
static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess,
IntPtr ptr = CreateFile("LPT1", GENERIC_WRITE, 0,
http://stackoverflow.com/questions/4288031/createfile-in-kernel32-dll-does-not-allow-me-to-open-a-physical-disk */
static extern SafeFileHandle CreateFile(
SafeFileHandle drive = CreateFile( fileName: FileName,
SafeFileHandle drive = CreateFile( fileName: FileName, Note that on win98, mapping the parameters to FileAccess and FileShare will cause CreateFileA to fail. I found this out the hard way, banging my head against a very slow win98 machine across an even slow connection. 36: CreateNamedPipe
[DllImport("kernel32.dll", EntryPoint = "CreateFile", SetLastError = true)]
private static extern IntPtr CreateFile(String lpFileName,
IntPtr handle = CreateFile(pipename, pipemode, 37: DeviceIoControl hDevice - To retrieve a handle to a volume, call CreateFile with the lpFileName parameter set to a string of the following form: \\.\DriveLetter:. DriveLetter is not case-sensitive and does not require a colon after it.
tHandle = CreateFile(@"\\.\C:", FileAccess.Read, FileShare.ReadWrite, IntPtr.Zero, FileMode.Open, 0, IntPtr.Zero)
var handle = Win32.CreateFile(name, FileAccess.Read, FileShare.ReadWrite,
Private Declare Ansi Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Integer, ByVal dwShareMode As Integer, ByVal lpSecurityAttributes As IntPtr, ByVal dwCreationDisposition As Integer, ByVal dwFlagsAndAttributes As Integer, ByVal hTemplateFile As IntPtr) As Integer
hdrive = CreateFile(".PHYSICALDRIVE0", GENERIC_READ Or GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero) This code segment will allow you to grab the Console input buffer using CreateFileW and Flush the input using FlushConsoleInputBuffer
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true, EntryPoint="CreateFileW")] Get the SafeFileHandle from call to CreateFile
var handle = CreateFile(dir, FileAccess.Read, FileShare.Read, IntPtr.Zero, FileMode.Open, 0x02000000 | 0x00000080, IntPtr.Zero);
var handle = CreateFile(dir, FileAccess.Read, FileShare.Read, IntPtr.Zero, FileMode.Open, 0x02000000 | 0x00000080, IntPtr.Zero); 42: GetFileSize
IntPtr handle = CreateFile( 43: GetFileSizeEx
IntPtr handle = CreateFile(PathString, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, 0); //PInvoked too 44: GetFileTime
private static extern IntPtr CreateFile(
ptr = CreateFile(FileName, GENERIC_READ, FILE_SHARE_READ, IntPtr.Zero, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, IntPtr.Zero); 45: SafeFileHandle
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 46: WriteFileEx
static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess,
hfile = CreateFile(@"history.txt", (UInt32)FILE_ALL_ACCESS, FILE_SHARE_WRITE, IntPtr.Zero, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, IntPtr.Zero); |