mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 23:45:42 +00:00
- Begin attempt at usage of the OPEN_PACKET for I/O Create operations. Currently we only build it and verify it, and I've fixed up IopCreateFile.
svn path=/trunk/; revision=22871
This commit is contained in:
parent
0e84e0e3c1
commit
9307b5a3b7
2 changed files with 56 additions and 5 deletions
|
@ -76,3 +76,19 @@ IopUpdateOperationCount(IN IOP_TRANSFER_TYPE Type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
static __inline
|
||||||
|
IopValidateOpenPacket(IN POPEN_PACKET OpenPacket)
|
||||||
|
{
|
||||||
|
/* Validate the packet */
|
||||||
|
if (!(OpenPacket) ||
|
||||||
|
(OpenPacket->Type != IO_TYPE_OPEN_PACKET) ||
|
||||||
|
(OpenPacket->Size != sizeof(OPEN_PACKET)))
|
||||||
|
{
|
||||||
|
/* Fail */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Good packet */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
|
@ -43,6 +43,9 @@ IopParseDevice(IN PVOID ParseObject,
|
||||||
CompleteName,
|
CompleteName,
|
||||||
RemainingName);
|
RemainingName);
|
||||||
|
|
||||||
|
/* Validate the open packet */
|
||||||
|
if (!IopValidateOpenPacket(OpenPacket)) return STATUS_OBJECT_TYPE_MISMATCH;
|
||||||
|
|
||||||
/* Create the actual file object */
|
/* Create the actual file object */
|
||||||
Status = ObCreateObject(AccessMode,
|
Status = ObCreateObject(AccessMode,
|
||||||
IoFileObjectType,
|
IoFileObjectType,
|
||||||
|
@ -67,7 +70,7 @@ IopParseDevice(IN PVOID ParseObject,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Check if we don't have a related file object */
|
/* Check if we don't have a related file object */
|
||||||
if (!Context)
|
if (!OpenPacket->RelatedFileObject)
|
||||||
{
|
{
|
||||||
/* Check if it has a VPB */
|
/* Check if it has a VPB */
|
||||||
if (DeviceObject->Vpb)
|
if (DeviceObject->Vpb)
|
||||||
|
@ -128,11 +131,14 @@ IopParseFile(IN PVOID ParseObject,
|
||||||
OUT PVOID *Object)
|
OUT PVOID *Object)
|
||||||
{
|
{
|
||||||
PVOID DeviceObject;
|
PVOID DeviceObject;
|
||||||
OPEN_PACKET OpenPacket;
|
POPEN_PACKET OpenPacket = (POPEN_PACKET)Context;
|
||||||
|
|
||||||
|
/* Validate the open packet */
|
||||||
|
if (!IopValidateOpenPacket(OpenPacket)) return STATUS_OBJECT_TYPE_MISMATCH;
|
||||||
|
|
||||||
/* Get the device object */
|
/* Get the device object */
|
||||||
DeviceObject = IoGetRelatedDeviceObject(ParseObject);
|
DeviceObject = IoGetRelatedDeviceObject(ParseObject);
|
||||||
OpenPacket.RelatedFileObject = ParseObject;
|
OpenPacket->RelatedFileObject = ParseObject;
|
||||||
|
|
||||||
/* Call the main routine */
|
/* Call the main routine */
|
||||||
return IopParseDevice(DeviceObject,
|
return IopParseDevice(DeviceObject,
|
||||||
|
@ -142,7 +148,7 @@ IopParseFile(IN PVOID ParseObject,
|
||||||
Attributes,
|
Attributes,
|
||||||
CompleteName,
|
CompleteName,
|
||||||
RemainingName,
|
RemainingName,
|
||||||
&OpenPacket,
|
OpenPacket,
|
||||||
SecurityQos,
|
SecurityQos,
|
||||||
Object);
|
Object);
|
||||||
}
|
}
|
||||||
|
@ -812,6 +818,7 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
PKNORMAL_ROUTINE NormalRoutine;
|
PKNORMAL_ROUTINE NormalRoutine;
|
||||||
PVOID NormalContext;
|
PVOID NormalContext;
|
||||||
|
OPEN_PACKET OpenPacket;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
if(Options & IO_NO_PARAMETER_CHECKING)
|
if(Options & IO_NO_PARAMETER_CHECKING)
|
||||||
|
@ -884,13 +891,41 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
||||||
DPRINT1("FIXME: IO_CHECK_CREATE_PARAMETERS not yet supported!\n");
|
DPRINT1("FIXME: IO_CHECK_CREATE_PARAMETERS not yet supported!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Setup the Open Packet */
|
||||||
|
OpenPacket.Type = IO_TYPE_OPEN_PACKET;
|
||||||
|
OpenPacket.Size = sizeof(OPEN_PACKET);
|
||||||
|
OpenPacket.FileObject = NULL;
|
||||||
|
OpenPacket.FinalStatus = STATUS_SUCCESS;
|
||||||
|
OpenPacket.Information = 0;
|
||||||
|
OpenPacket.ParseCheck = 0;
|
||||||
|
OpenPacket.RelatedFileObject = NULL;
|
||||||
|
OpenPacket.OriginalAttributes = *ObjectAttributes;
|
||||||
|
OpenPacket.AllocationSize = SafeAllocationSize;
|
||||||
|
OpenPacket.CreateOptions = CreateOptions;
|
||||||
|
OpenPacket.FileAttributes = FileAttributes;
|
||||||
|
OpenPacket.ShareAccess = ShareAccess;
|
||||||
|
OpenPacket.EaBuffer = SystemEaBuffer;
|
||||||
|
OpenPacket.EaLength = EaLength;
|
||||||
|
OpenPacket.Options = Options;
|
||||||
|
OpenPacket.Disposition = CreateDisposition;
|
||||||
|
OpenPacket.BasicInformation = NULL;
|
||||||
|
OpenPacket.NetworkInformation = NULL;
|
||||||
|
OpenPacket.CreateFileType = CreateFileType;
|
||||||
|
OpenPacket.MailslotOrPipeParameters = ExtraCreateParameters;
|
||||||
|
OpenPacket.Override = FALSE;
|
||||||
|
OpenPacket.QueryOnly = FALSE;
|
||||||
|
OpenPacket.DeleteOnly = FALSE;
|
||||||
|
OpenPacket.FullAttributes = FALSE;
|
||||||
|
OpenPacket.DummyFileObject = NULL;
|
||||||
|
OpenPacket.InternalFlags = 0;
|
||||||
|
|
||||||
/* First try to open an existing named object */
|
/* First try to open an existing named object */
|
||||||
Status = ObOpenObjectByName(ObjectAttributes,
|
Status = ObOpenObjectByName(ObjectAttributes,
|
||||||
NULL,
|
NULL,
|
||||||
AccessMode,
|
AccessMode,
|
||||||
NULL,
|
NULL,
|
||||||
DesiredAccess,
|
DesiredAccess,
|
||||||
NULL,
|
&OpenPacket,
|
||||||
&LocalHandle);
|
&LocalHandle);
|
||||||
|
|
||||||
RtlMapGenericMask(&DesiredAccess, &IoFileObjectType->TypeInfo.GenericMapping);
|
RtlMapGenericMask(&DesiredAccess, &IoFileObjectType->TypeInfo.GenericMapping);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue