Add file object flags, complete DEVOBJ_EXTENSION, and implement: IoIsFileOriginRemote, IoGetLowerDeviceObject, IoGetdiskDeviceObject, IoGetRequestorSessionId, IoGetRequestorProcessId

svn path=/trunk/; revision=14639
This commit is contained in:
Alex Ionescu 2005-04-16 19:38:14 +00:00
parent 9d6033ebad
commit 39ef71436d
6 changed files with 117 additions and 69 deletions

View file

@ -645,6 +645,11 @@ typedef struct _IO_COMPLETION_CONTEXT
#define FO_OPENED_CASE_SENSITIVE 0x00020000
#define FO_HANDLE_CREATED 0x00040000
#define FO_FILE_FAST_IO_READ 0x00080000
#define FO_RANDOM_ACCESS 0x00100000
#define FO_FILE_OPEN_CANCELLED 0x00200000
#define FO_VOLUME_OPEN 0x00400000
#define FO_FILE_OBJECT_HAS_EXTENSION 0x00800000
#define FO_REMOTE_ORIGIN 0x01000000
typedef struct _FILE_OBJECT
{
@ -896,6 +901,12 @@ struct _FAST_IO_DISPATCH_TABLE
#define DRVO_BOOTREINIT_REGISTERED 0x20L
#define DRVO_LEGACY_RESOURCES 0x40L
#define DOE_UNLOAD_PENDING 0x1
#define DOE_DELETE_PENDING 0x2
#define DOE_REMOVE_PENDING 0x4
#define DOE_REMOVE_PROCESSED 0x8
#define DOE_START_PENDING 0x10
typedef struct _DRIVER_OBJECT
{
CSHORT Type;

View file

@ -41,6 +41,7 @@
#define IO_METHOD_FROM_CTL_CODE(ctlCode) (ctlCode&0x00000003)
struct _DEVICE_OBJECT_POWER_EXTENSION;
typedef struct _IO_COMPLETION_PACKET{
PVOID Key;
@ -53,8 +54,15 @@ typedef struct _DEVOBJ_EXTENSION {
CSHORT Type;
USHORT Size;
PDEVICE_OBJECT DeviceObject;
ULONG Unknown[3];
ULONG PowerFlags;
struct DEVICE_OBJECT_POWER_EXTENSION *Dope;
ULONG ExtensionFlags;
struct _DEVICE_NODE *DeviceNode;
PDEVICE_OBJECT AttachedTo;
LONG StartIoCount;
LONG StartIoKey;
ULONG StartIoFlags;
struct _VPB *Vpb;
} DEVOBJ_EXTENSION, *PDEVOBJ_EXTENSION;
typedef struct _PRIVATE_DRIVER_EXTENSIONS {

View file

@ -247,30 +247,66 @@ IoGetDeviceAttachmentBaseRef(
}
/*
* @unimplemented
* @implemented
*/
NTSTATUS
STDCALL
IoGetDiskDeviceObject(
IN PDEVICE_OBJECT FileSystemDeviceObject,
OUT PDEVICE_OBJECT *DiskDeviceObject
)
IoGetDiskDeviceObject(IN PDEVICE_OBJECT FileSystemDeviceObject,
OUT PDEVICE_OBJECT *DiskDeviceObject)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
PDEVOBJ_EXTENSION DeviceExtension;
PVPB Vpb;
KIRQL OldIrql;
/* Make sure there's a VPB */
if (!FileSystemDeviceObject->Vpb) return STATUS_INVALID_PARAMETER;
/* Acquire it */
IoAcquireVpbSpinLock(&OldIrql);
/* Get the Device Extension */
DeviceExtension = FileSystemDeviceObject->DeviceObjectExtension;
/* Make sure this one has a VPB too */
Vpb = DeviceExtension->Vpb;
if (!Vpb) return STATUS_INVALID_PARAMETER;
/* Make sure someone it's mounted */
if ((!Vpb->ReferenceCount) || (Vpb->Flags & VPB_MOUNTED)) return STATUS_VOLUME_DISMOUNTED;
/* Return the Disk Device Object */
*DiskDeviceObject = Vpb->RealDevice;
/* Release the lock */
IoReleaseVpbSpinLock(OldIrql);
return STATUS_SUCCESS;
}
/*
* @unimplemented
* @implemented
*/
PDEVICE_OBJECT
STDCALL
IoGetLowerDeviceObject(
IN PDEVICE_OBJECT DeviceObject
)
IoGetLowerDeviceObject(IN PDEVICE_OBJECT DeviceObject)
{
UNIMPLEMENTED;
return 0;
PDEVOBJ_EXTENSION DeviceExtension = DeviceObject->DeviceObjectExtension;
PDEVICE_OBJECT LowerDeviceObject = NULL;
/* Make sure it's not getting deleted */
if (DeviceExtension->ExtensionFlags & (DOE_UNLOAD_PENDING |
DOE_DELETE_PENDING |
DOE_REMOVE_PENDING |
DOE_REMOVE_PROCESSED))
{
/* Get the Lower Device Object */
LowerDeviceObject = DeviceExtension->AttachedTo;
/* Reference it */
ObReferenceObject(LowerDeviceObject);
}
/* Return it */
return LowerDeviceObject;
}
/*

View file

@ -265,16 +265,14 @@ IoCreateStreamFileObjectLite(
}
/*
* @unimplemented
* @implemented
*/
BOOLEAN
STDCALL
IoIsFileOriginRemote(
IN PFILE_OBJECT FileObject
)
IoIsFileOriginRemote(IN PFILE_OBJECT FileObject)
{
UNIMPLEMENTED;
return FALSE;
/* Return the flag status */
return (FileObject->Flags & FO_REMOTE_ORIGIN);
}
/*

View file

@ -68,34 +68,6 @@ IoFreeIrp(PIRP Irp)
ExFreePool(Irp);
}
/*
* @unimplemented
*/
ULONG
STDCALL
IoGetRequestorProcessId(
IN PIRP Irp
)
{
UNIMPLEMENTED;
return 0;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoGetRequestorSessionId(
IN PIRP Irp,
OUT PULONG pSessionId
)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/

View file

@ -18,17 +18,18 @@
/*
* @implemented
*/
PVOID STDCALL
PVOID
STDCALL
IoGetInitialStack(VOID)
{
return(PsGetCurrentThread()->Tcb.InitialStack);
}
/*
* @implemented
*/
VOID STDCALL
VOID
STDCALL
IoGetStackLimits(OUT PULONG LowLimit,
OUT PULONG HighLimit)
{
@ -37,22 +38,21 @@ IoGetStackLimits(OUT PULONG LowLimit,
}
/*
* @unimplemented
* @implemented
*/
BOOLEAN
STDCALL
IoIsSystemThread(
IN PETHREAD Thread
)
IoIsSystemThread(IN PETHREAD Thread)
{
UNIMPLEMENTED;
return FALSE;
/* Call the Ps Function */
return PsIsSystemThread(Thread);
}
/*
* @implemented
*/
PEPROCESS STDCALL
PEPROCESS
STDCALL
IoThreadToProcess(IN PETHREAD Thread)
{
return(Thread->ThreadsProcess);
@ -68,6 +68,28 @@ IoGetRequestorProcess(IN PIRP Irp)
return(Irp->Tail.Overlay.Thread->ThreadsProcess);
}
/*
* @implemented
*/
ULONG
STDCALL
IoGetRequestorProcessId(IN PIRP Irp)
{
return (ULONG)(IoGetRequestorProcess(Irp)->UniqueProcessId);
}
/*
* @implemented
*/
NTSTATUS
STDCALL
IoGetRequestorSessionId(IN PIRP Irp,
OUT PULONG pSessionId)
{
*pSessionId = IoGetRequestorProcess(Irp)->SessionId;
return STATUS_SUCCESS;
}
/**********************************************************************
* NAME EXPORTED
@ -84,7 +106,8 @@ IoGetRequestorProcess(IN PIRP Irp)
*
* @implemented
*/
BOOLEAN STDCALL
BOOLEAN
STDCALL
IoSetThreadHardErrorMode(IN BOOLEAN HardErrorEnabled)
{
BOOLEAN PreviousHEM = (BOOLEAN)(NtCurrentTeb()->HardErrorDisabled);