Process Hacker
iosup.c File Reference
#include <ph.h>
#include <iosupp.h>

Go to the source code of this file.

Macros

#define _PH_IOSUP_PRIVATE
 

Functions

BOOLEAN PhIoSupportInitialization (VOID)
 
NTSTATUS PhCreateFileWin32 (_Out_ PHANDLE FileHandle, _In_ PWSTR FileName, _In_ ACCESS_MASK DesiredAccess, _In_opt_ ULONG FileAttributes, _In_ ULONG ShareAccess, _In_ ULONG CreateDisposition, _In_ ULONG CreateOptions)
 Creates or opens a file.
 
NTSTATUS PhCreateFileWin32Ex (_Out_ PHANDLE FileHandle, _In_ PWSTR FileName, _In_ ACCESS_MASK DesiredAccess, _In_opt_ ULONG FileAttributes, _In_ ULONG ShareAccess, _In_ ULONG CreateDisposition, _In_ ULONG CreateOptions, _Out_opt_ PULONG CreateStatus)
 Creates or opens a file.
 
NTSTATUS PhQueryFullAttributesFileWin32 (_In_ PWSTR FileName, _Out_ PFILE_NETWORK_OPEN_INFORMATION FileInformation)
 Queries file attributes.
 
NTSTATUS PhDeleteFileWin32 (_In_ PWSTR FileName)
 Deletes a file.
 
NTSTATUS PhListenNamedPipe (_In_ HANDLE FileHandle, _In_opt_ HANDLE Event, _In_opt_ PIO_APC_ROUTINE ApcRoutine, _In_opt_ PVOID ApcContext, _Out_ PIO_STATUS_BLOCK IoStatusBlock)
 
NTSTATUS PhDisconnectNamedPipe (_In_ HANDLE FileHandle)
 
NTSTATUS PhPeekNamedPipe (_In_ HANDLE FileHandle, _Out_writes_bytes_opt_(Length) PVOID Buffer, _In_ ULONG Length, _Out_opt_ PULONG NumberOfBytesRead, _Out_opt_ PULONG NumberOfBytesAvailable, _Out_opt_ PULONG NumberOfBytesLeftInMessage)
 
NTSTATUS PhTransceiveNamedPipe (_In_ HANDLE FileHandle, _In_opt_ HANDLE Event, _In_opt_ PIO_APC_ROUTINE ApcRoutine, _In_opt_ PVOID ApcContext, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _In_reads_bytes_(InputBufferLength) PVOID InputBuffer, _In_ ULONG InputBufferLength, _Out_writes_bytes_(OutputBufferLength) PVOID OutputBuffer, _In_ ULONG OutputBufferLength)
 
NTSTATUS PhWaitForNamedPipe (_In_opt_ PUNICODE_STRING FileSystemName, _In_ PUNICODE_STRING Name, _In_opt_ PLARGE_INTEGER Timeout, _In_ BOOLEAN UseDefaultTimeout)
 
NTSTATUS PhImpersonateClientOfNamedPipe (_In_ HANDLE FileHandle)
 
NTSTATUS PhCreateFileStream (_Out_ PPH_FILE_STREAM *FileStream, _In_ PWSTR FileName, _In_ ACCESS_MASK DesiredAccess, _In_ ULONG ShareAccess, _In_ ULONG CreateDisposition, _In_ ULONG Flags)
 
NTSTATUS PhCreateFileStream2 (_Out_ PPH_FILE_STREAM *FileStream, _In_ HANDLE FileHandle, _In_ ULONG Flags, _In_ ULONG BufferLength)
 
VOID NTAPI PhpFileStreamDeleteProcedure (_In_ PVOID Object, _In_ ULONG Flags)
 
VOID PhVerifyFileStream (_In_ PPH_FILE_STREAM FileStream)
 Verifies that a file stream's position matches the position held by the file object.
 
NTSTATUS PhpAllocateBufferFileStream (_Inout_ PPH_FILE_STREAM FileStream)
 
NTSTATUS PhpReadFileStream (_Inout_ PPH_FILE_STREAM FileStream, _Out_writes_bytes_(Length) PVOID Buffer, _In_ ULONG Length, _Out_opt_ PULONG ReadLength)
 
NTSTATUS PhReadFileStream (_Inout_ PPH_FILE_STREAM FileStream, _Out_writes_bytes_(Length) PVOID Buffer, _In_ ULONG Length, _Out_opt_ PULONG ReadLength)
 
NTSTATUS PhpWriteFileStream (_Inout_ PPH_FILE_STREAM FileStream, _In_reads_bytes_(Length) PVOID Buffer, _In_ ULONG Length)
 
NTSTATUS PhWriteFileStream (_Inout_ PPH_FILE_STREAM FileStream, _In_reads_bytes_(Length) PVOID Buffer, _In_ ULONG Length)
 
NTSTATUS PhpFlushReadFileStream (_Inout_ PPH_FILE_STREAM FileStream)
 
NTSTATUS PhpFlushWriteFileStream (_Inout_ PPH_FILE_STREAM FileStream)
 
NTSTATUS PhFlushFileStream (_Inout_ PPH_FILE_STREAM FileStream, _In_ BOOLEAN Full)
 Flushes the file stream.
 
VOID PhGetPositionFileStream (_In_ PPH_FILE_STREAM FileStream, _Out_ PLARGE_INTEGER Position)
 
NTSTATUS PhpSeekFileStream (_Inout_ PPH_FILE_STREAM FileStream, _In_ PLARGE_INTEGER Offset, _In_ PH_SEEK_ORIGIN Origin)
 
NTSTATUS PhSeekFileStream (_Inout_ PPH_FILE_STREAM FileStream, _In_ PLARGE_INTEGER Offset, _In_ PH_SEEK_ORIGIN Origin)
 
NTSTATUS PhLockFileStream (_Inout_ PPH_FILE_STREAM FileStream, _In_ PLARGE_INTEGER Position, _In_ PLARGE_INTEGER Length, _In_ BOOLEAN Wait, _In_ BOOLEAN Shared)
 
NTSTATUS PhUnlockFileStream (_Inout_ PPH_FILE_STREAM FileStream, _In_ PLARGE_INTEGER Position, _In_ PLARGE_INTEGER Length)
 
NTSTATUS PhWriteStringAsUtf8FileStream (_Inout_ PPH_FILE_STREAM FileStream, _In_ PPH_STRINGREF String)
 
NTSTATUS PhWriteStringAsUtf8FileStream2 (_Inout_ PPH_FILE_STREAM FileStream, _In_ PWSTR String)
 
NTSTATUS PhWriteStringAsUtf8FileStreamEx (_Inout_ PPH_FILE_STREAM FileStream, _In_ PWSTR Buffer, _In_ SIZE_T Length)
 
NTSTATUS PhWriteStringFormatAsUtf8FileStream_V (_Inout_ PPH_FILE_STREAM FileStream, _In_ _Printf_format_string_ PWSTR Format, _In_ va_list ArgPtr)
 
NTSTATUS PhWriteStringFormatAsUtf8FileStream (_Inout_ PPH_FILE_STREAM FileStream, _In_ _Printf_format_string_ PWSTR Format,...)
 

Variables

PPH_OBJECT_TYPE PhFileStreamType
 

Macro Definition Documentation

#define _PH_IOSUP_PRIVATE

Definition at line 23 of file iosup.c.

Function Documentation

NTSTATUS PhCreateFileStream ( _Out_ PPH_FILE_STREAM FileStream,
_In_ PWSTR  FileName,
_In_ ACCESS_MASK  DesiredAccess,
_In_ ULONG  ShareAccess,
_In_ ULONG  CreateDisposition,
_In_ ULONG  Flags 
)

Definition at line 506 of file iosup.c.

NTSTATUS PhCreateFileStream2 ( _Out_ PPH_FILE_STREAM FileStream,
_In_ HANDLE  FileHandle,
_In_ ULONG  Flags,
_In_ ULONG  BufferLength 
)

Definition at line 569 of file iosup.c.

NTSTATUS PhCreateFileWin32 ( _Out_ PHANDLE  FileHandle,
_In_ PWSTR  FileName,
_In_ ACCESS_MASK  DesiredAccess,
_In_opt_ ULONG  FileAttributes,
_In_ ULONG  ShareAccess,
_In_ ULONG  CreateDisposition,
_In_ ULONG  CreateOptions 
)

Creates or opens a file.

Parameters
FileHandleA variable that receives the file handle.
FileNameThe Win32 file name.
DesiredAccessThe desired access to the file.
FileAttributesFile attributes applied if the file is created or overwritten.
ShareAccessThe file access granted to other threads.
  • FILE_SHARE_READ Allows other threads to read from the file.
  • FILE_SHARE_WRITE Allows other threads to write to the file.
  • FILE_SHARE_DELETE Allows other threads to delete the file.
CreateDispositionThe action to perform if the file does or does not exist.
  • FILE_SUPERSEDE If the file exists, replace it. Otherwise, create the file.
  • FILE_CREATE If the file exists, fail. Otherwise, create the file.
  • FILE_OPEN If the file exists, open it. Otherwise, fail.
  • FILE_OPEN_IF If the file exists, open it. Otherwise, create the file.
  • FILE_OVERWRITE If the file exists, open and overwrite it. Otherwise, fail.
  • FILE_OVERWRITE_IF If the file exists, open and overwrite it. Otherwise, create the file.
CreateOptionsThe options to apply when the file is opened or created.

Definition at line 65 of file iosup.c.

NTSTATUS PhCreateFileWin32Ex ( _Out_ PHANDLE  FileHandle,
_In_ PWSTR  FileName,
_In_ ACCESS_MASK  DesiredAccess,
_In_opt_ ULONG  FileAttributes,
_In_ ULONG  ShareAccess,
_In_ ULONG  CreateDisposition,
_In_ ULONG  CreateOptions,
_Out_opt_ PULONG  CreateStatus 
)

Creates or opens a file.

Parameters
FileHandleA variable that receives the file handle.
FileNameThe Win32 file name.
DesiredAccessThe desired access to the file.
FileAttributesFile attributes applied if the file is created or overwritten.
ShareAccessThe file access granted to other threads.
  • FILE_SHARE_READ Allows other threads to read from the file.
  • FILE_SHARE_WRITE Allows other threads to write to the file.
  • FILE_SHARE_DELETE Allows other threads to delete the file.
CreateDispositionThe action to perform if the file does or does not exist.
  • FILE_SUPERSEDE If the file exists, replace it. Otherwise, create the file.
  • FILE_CREATE If the file exists, fail. Otherwise, create the file.
  • FILE_OPEN If the file exists, open it. Otherwise, fail.
  • FILE_OPEN_IF If the file exists, open it. Otherwise, create the file.
  • FILE_OVERWRITE If the file exists, open and overwrite it. Otherwise, fail.
  • FILE_OVERWRITE_IF If the file exists, open and overwrite it. Otherwise, create the file.
CreateOptionsThe options to apply when the file is opened or created.
CreateStatusA variable that receives creation information.
  • FILE_SUPERSEDED The file was replaced because FILE_SUPERSEDE was specified in CreateDisposition.
  • FILE_OPENED The file was opened because FILE_OPEN or FILE_OPEN_IF was specified in CreateDisposition.
  • FILE_CREATED The file was created because FILE_CREATE or FILE_OPEN_IF was specified in CreateDisposition.
  • FILE_OVERWRITTEN The file was overwritten because FILE_OVERWRITE or FILE_OVERWRITE_IF was specified in CreateDisposition.
  • FILE_EXISTS The file was not opened because it already existed and FILE_CREATE was specified in CreateDisposition.
  • FILE_DOES_NOT_EXIST The file was not opened because it did not exist and FILE_OPEN or FILE_OVERWRITE was specified in CreateDisposition.

Definition at line 122 of file iosup.c.

NTSTATUS PhDeleteFileWin32 ( _In_ PWSTR  FileName)

Deletes a file.

Parameters
FileNameThe Win32 file name.

Definition at line 227 of file iosup.c.

NTSTATUS PhDisconnectNamedPipe ( _In_ HANDLE  FileHandle)

Definition at line 274 of file iosup.c.

NTSTATUS PhFlushFileStream ( _Inout_ PPH_FILE_STREAM  FileStream,
_In_ BOOLEAN  Full 
)

Flushes the file stream.

Parameters
FileStreamA file stream object.
FullTRUE to flush the file object through the operating system, otherwise FALSE to only ensure the buffer is flushed to the operating system.

Definition at line 1036 of file iosup.c.

VOID PhGetPositionFileStream ( _In_ PPH_FILE_STREAM  FileStream,
_Out_ PLARGE_INTEGER  Position 
)

Definition at line 1069 of file iosup.c.

NTSTATUS PhImpersonateClientOfNamedPipe ( _In_ HANDLE  FileHandle)

Definition at line 483 of file iosup.c.

BOOLEAN PhIoSupportInitialization ( VOID  )

Definition at line 29 of file iosup.c.

NTSTATUS PhListenNamedPipe ( _In_ HANDLE  FileHandle,
_In_opt_ HANDLE  Event,
_In_opt_ PIO_APC_ROUTINE  ApcRoutine,
_In_opt_ PVOID  ApcContext,
_Out_ PIO_STATUS_BLOCK  IoStatusBlock 
)

Definition at line 252 of file iosup.c.

NTSTATUS PhLockFileStream ( _Inout_ PPH_FILE_STREAM  FileStream,
_In_ PLARGE_INTEGER  Position,
_In_ PLARGE_INTEGER  Length,
_In_ BOOLEAN  Wait,
_In_ BOOLEAN  Shared 
)

Definition at line 1174 of file iosup.c.

NTSTATUS PhpAllocateBufferFileStream ( _Inout_ PPH_FILE_STREAM  FileStream)

Definition at line 653 of file iosup.c.

NTSTATUS PhPeekNamedPipe ( _In_ HANDLE  FileHandle,
_Out_writes_bytes_opt_(Length) PVOID  Buffer,
_In_ ULONG  Length,
_Out_opt_ PULONG  NumberOfBytesRead,
_Out_opt_ PULONG  NumberOfBytesAvailable,
_Out_opt_ PULONG  NumberOfBytesLeftInMessage 
)

Definition at line 305 of file iosup.c.

VOID NTAPI PhpFileStreamDeleteProcedure ( _In_ PVOID  Object,
_In_ ULONG  Flags 
)

Definition at line 603 of file iosup.c.

NTSTATUS PhpFlushReadFileStream ( _Inout_ PPH_FILE_STREAM  FileStream)

Definition at line 981 of file iosup.c.

NTSTATUS PhpFlushWriteFileStream ( _Inout_ PPH_FILE_STREAM  FileStream)

Definition at line 1010 of file iosup.c.

NTSTATUS PhpReadFileStream ( _Inout_ PPH_FILE_STREAM  FileStream,
_Out_writes_bytes_(Length) PVOID  Buffer,
_In_ ULONG  Length,
_Out_opt_ PULONG  ReadLength 
)

Definition at line 665 of file iosup.c.

NTSTATUS PhpSeekFileStream ( _Inout_ PPH_FILE_STREAM  FileStream,
_In_ PLARGE_INTEGER  Offset,
_In_ PH_SEEK_ORIGIN  Origin 
)

Definition at line 1080 of file iosup.c.

NTSTATUS PhpWriteFileStream ( _Inout_ PPH_FILE_STREAM  FileStream,
_In_reads_bytes_(Length) PVOID  Buffer,
_In_ ULONG  Length 
)

Definition at line 838 of file iosup.c.

NTSTATUS PhQueryFullAttributesFileWin32 ( _In_ PWSTR  FileName,
_Out_ PFILE_NETWORK_OPEN_INFORMATION  FileInformation 
)

Queries file attributes.

Parameters
FileNameThe Win32 file name.
FileInformationA variable that receives the file information.

Definition at line 191 of file iosup.c.

NTSTATUS PhReadFileStream ( _Inout_ PPH_FILE_STREAM  FileStream,
_Out_writes_bytes_(Length) PVOID  Buffer,
_In_ ULONG  Length,
_Out_opt_ PULONG  ReadLength 
)

Definition at line 714 of file iosup.c.

NTSTATUS PhSeekFileStream ( _Inout_ PPH_FILE_STREAM  FileStream,
_In_ PLARGE_INTEGER  Offset,
_In_ PH_SEEK_ORIGIN  Origin 
)

Definition at line 1133 of file iosup.c.

NTSTATUS PhTransceiveNamedPipe ( _In_ HANDLE  FileHandle,
_In_opt_ HANDLE  Event,
_In_opt_ PIO_APC_ROUTINE  ApcRoutine,
_In_opt_ PVOID  ApcContext,
_Out_ PIO_STATUS_BLOCK  IoStatusBlock,
_In_reads_bytes_(InputBufferLength) PVOID  InputBuffer,
_In_ ULONG  InputBufferLength,
_Out_writes_bytes_(OutputBufferLength) PVOID  OutputBuffer,
_In_ ULONG  OutputBufferLength 
)

Definition at line 372 of file iosup.c.

NTSTATUS PhUnlockFileStream ( _Inout_ PPH_FILE_STREAM  FileStream,
_In_ PLARGE_INTEGER  Position,
_In_ PLARGE_INTEGER  Length 
)

Definition at line 1209 of file iosup.c.

VOID PhVerifyFileStream ( _In_ PPH_FILE_STREAM  FileStream)

Verifies that a file stream's position matches the position held by the file object.

Definition at line 623 of file iosup.c.

NTSTATUS PhWaitForNamedPipe ( _In_opt_ PUNICODE_STRING  FileSystemName,
_In_ PUNICODE_STRING  Name,
_In_opt_ PLARGE_INTEGER  Timeout,
_In_ BOOLEAN  UseDefaultTimeout 
)

Definition at line 398 of file iosup.c.

NTSTATUS PhWriteFileStream ( _Inout_ PPH_FILE_STREAM  FileStream,
_In_reads_bytes_(Length) PVOID  Buffer,
_In_ ULONG  Length 
)

Definition at line 884 of file iosup.c.

NTSTATUS PhWriteStringAsUtf8FileStream ( _Inout_ PPH_FILE_STREAM  FileStream,
_In_ PPH_STRINGREF  String 
)

Definition at line 1226 of file iosup.c.

NTSTATUS PhWriteStringAsUtf8FileStream2 ( _Inout_ PPH_FILE_STREAM  FileStream,
_In_ PWSTR  String 
)

Definition at line 1234 of file iosup.c.

NTSTATUS PhWriteStringAsUtf8FileStreamEx ( _Inout_ PPH_FILE_STREAM  FileStream,
_In_ PWSTR  Buffer,
_In_ SIZE_T  Length 
)

Definition at line 1246 of file iosup.c.

NTSTATUS PhWriteStringFormatAsUtf8FileStream ( _Inout_ PPH_FILE_STREAM  FileStream,
_In_ _Printf_format_string_ PWSTR  Format,
  ... 
)

Definition at line 1335 of file iosup.c.

NTSTATUS PhWriteStringFormatAsUtf8FileStream_V ( _Inout_ PPH_FILE_STREAM  FileStream,
_In_ _Printf_format_string_ PWSTR  Format,
_In_ va_list  ArgPtr 
)

Definition at line 1319 of file iosup.c.

Variable Documentation

PPH_OBJECT_TYPE PhFileStreamType

Definition at line 27 of file iosup.c.