ReactOS 0.4.16-dev-340-g0540c21
devutils.c File Reference
#include "precomp.h"
#include "devutils.h"
Include dependency graph for devutils.c:

Go to the source code of this file.

Functions

NTSTATUS pOpenDeviceEx_UStr (_In_ PCUNICODE_STRING DevicePath, _Out_ PHANDLE DeviceHandle, _In_ ACCESS_MASK DesiredAccess, _In_ ULONG ShareAccess)
 Open an existing device given by its NT-style path, which is assumed to be for a disk device or a partition. The open is for synchronous I/O access.
 
NTSTATUS pOpenDevice_UStr (_In_ PCUNICODE_STRING DevicePath, _Out_ PHANDLE DeviceHandle)
 Open an existing device given by its NT-style path, which is assumed to be for a disk device or a partition. The open is share read/write/delete, for synchronous I/O and read access.
 
NTSTATUS pOpenDeviceEx (_In_ PCWSTR DevicePath, _Out_ PHANDLE DeviceHandle, _In_ ACCESS_MASK DesiredAccess, _In_ ULONG ShareAccess)
 Open an existing device given by its NT-style path, which is assumed to be for a disk device or a partition. The open is for synchronous I/O access.
 
NTSTATUS pOpenDevice (_In_ PCWSTR DevicePath, _Out_ PHANDLE DeviceHandle)
 Open an existing device given by its NT-style path, which is assumed to be for a disk device or a partition. The open is share read/write/delete, for synchronous I/O and read access.
 

Function Documentation

◆ pOpenDevice()

NTSTATUS pOpenDevice ( _In_ PCWSTR  DevicePath,
_Out_ PHANDLE  DeviceHandle 
)

Open an existing device given by its NT-style path, which is assumed to be for a disk device or a partition. The open is share read/write/delete, for synchronous I/O and read access.

Parameters
[in]DevicePath
[out]DeviceHandleSee the DevicePath and DeviceHandle parameters of pOpenDeviceEx_UStr().
Returns
An NTSTATUS code indicating success or failure.
See also
pOpenDeviceEx(), pOpenDevice_UStr(), pOpenDeviceEx_UStr()

Definition at line 128 of file devutils.c.

131{
133 RtlInitUnicodeString(&Name, DevicePath);
135}
struct NameRec_ * Name
Definition: cdprocs.h:460
NTSTATUS pOpenDevice_UStr(_In_ PCUNICODE_STRING DevicePath, _Out_ PHANDLE DeviceHandle)
Open an existing device given by its NT-style path, which is assumed to be for a disk device or a par...
Definition: devutils.c:76
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

Referenced by MountVolume().

◆ pOpenDevice_UStr()

NTSTATUS pOpenDevice_UStr ( _In_ PCUNICODE_STRING  DevicePath,
_Out_ PHANDLE  DeviceHandle 
)

Open an existing device given by its NT-style path, which is assumed to be for a disk device or a partition. The open is share read/write/delete, for synchronous I/O and read access.

Parameters
[in]DevicePath
[out]DeviceHandleSee the DevicePath and DeviceHandle parameters of pOpenDeviceEx_UStr().
Returns
An NTSTATUS code indicating success or failure.
See also
pOpenDevice(), pOpenDeviceEx(), pOpenDeviceEx_UStr()

Definition at line 76 of file devutils.c.

79{
80 return pOpenDeviceEx_UStr(DevicePath,
84}
NTSTATUS pOpenDeviceEx_UStr(_In_ PCUNICODE_STRING DevicePath, _Out_ PHANDLE DeviceHandle, _In_ ACCESS_MASK DesiredAccess, _In_ ULONG ShareAccess)
Open an existing device given by its NT-style path, which is assumed to be for a disk device or a par...
Definition: devutils.c:38
#define FILE_SHARE_ALL
Definition: devutils.h:12
#define FILE_READ_DATA
Definition: nt_native.h:628
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647

Referenced by pOpenDevice().

◆ pOpenDeviceEx()

NTSTATUS pOpenDeviceEx ( _In_ PCWSTR  DevicePath,
_Out_ PHANDLE  DeviceHandle,
_In_ ACCESS_MASK  DesiredAccess,
_In_ ULONG  ShareAccess 
)

Open an existing device given by its NT-style path, which is assumed to be for a disk device or a partition. The open is for synchronous I/O access.

Parameters
[in]DevicePath
[out]DeviceHandle
[in]DesiredAccess
[in]ShareAccessSee pOpenDeviceEx_UStr() parameters.
Returns
An NTSTATUS code indicating success or failure.
See also
pOpenDeviceEx_UStr()

Definition at line 102 of file devutils.c.

107{
109 RtlInitUnicodeString(&Name, DevicePath);
111}
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK _In_ USHORT ShareAccess
Definition: create.c:4147
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658

Referenced by DismountVolume().

◆ pOpenDeviceEx_UStr()

NTSTATUS pOpenDeviceEx_UStr ( _In_ PCUNICODE_STRING  DevicePath,
_Out_ PHANDLE  DeviceHandle,
_In_ ACCESS_MASK  DesiredAccess,
_In_ ULONG  ShareAccess 
)

Open an existing device given by its NT-style path, which is assumed to be for a disk device or a partition. The open is for synchronous I/O access.

Parameters
[in]DevicePathSupplies the NT-style path to the device to open.
[out]DeviceHandleIf successful, receives the NT handle of the opened device. Once the handle is no longer in use, call NtClose() to close it.
[in]DesiredAccessAn ACCESS_MASK value combination that determines the requested access to the device. Because the open is for synchronous access, SYNCHRONIZE is automatically added to the access mask.
[in]ShareAccessSpecifies the type of share access for the device.
Returns
An NTSTATUS code indicating success or failure.
See also
pOpenDeviceEx()

Definition at line 38 of file devutils.c.

43{
46
48 (PUNICODE_STRING)DevicePath,
50 NULL,
51 NULL);
57 /* FILE_NON_DIRECTORY_FILE | */
59}
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NULL
Definition: types.h:112
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3952
#define SYNCHRONIZE
Definition: nt_native.h:61

Referenced by GetDeviceInfo_UStr(), InstallBootManagerAndBootEntries(), pOpenDevice_UStr(), and pOpenDeviceEx().