https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d9864ca6c54dc9bb25eb8…
commit d9864ca6c54dc9bb25eb89fe447919a421753e28
Author: Victor Perevertkin <victor.perevertkin(a)reactos.org>
AuthorDate: Sat Aug 29 05:44:34 2020 +0300
Commit: Victor Perevertkin <victor.perevertkin(a)reactos.org>
CommitDate: Sat Aug 29 05:44:34 2020 +0300
[NTOSKRNL_VISTA][XDK] Implement IoSetMasterIrpStatus
---
sdk/include/xdk/iofuncs.h | 24 +++++++++++++-----------
sdk/lib/drivers/ntoskrnl_vista/io.c | 23 ++++++++++++++++++++++-
2 files changed, 35 insertions(+), 12 deletions(-)
diff --git a/sdk/include/xdk/iofuncs.h b/sdk/include/xdk/iofuncs.h
index fc1c10cdb03..271455eca81 100644
--- a/sdk/include/xdk/iofuncs.h
+++ b/sdk/include/xdk/iofuncs.h
@@ -2332,19 +2332,16 @@ IoSetShareAccessEx(
_Out_ PSHARE_ACCESS ShareAccess,
_In_ PBOOLEAN WritePermission);
-NTKERNELAPI
ULONG
NTAPI
IoSizeofWorkItem(VOID);
-NTKERNELAPI
VOID
NTAPI
IoInitializeWorkItem(
_In_ PVOID IoObject,
_Out_ PIO_WORKITEM IoWorkItem);
-NTKERNELAPI
VOID
NTAPI
IoUninitializeWorkItem(
@@ -2360,20 +2357,18 @@ IoQueueWorkItemEx(
_In_ WORK_QUEUE_TYPE QueueType,
_In_opt_ __drv_aliasesMem PVOID Context);
-NTKERNELAPI
+// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
IO_PRIORITY_HINT
NTAPI
IoGetIoPriorityHint(
_In_ PIRP Irp);
-// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
NTSTATUS
NTAPI
IoSetIoPriorityHint(
_In_ PIRP Irp,
_In_ IO_PRIORITY_HINT PriorityHint);
-NTKERNELAPI
NTSTATUS
NTAPI
IoAllocateSfioStreamIdentifier(
@@ -2388,7 +2383,6 @@ IoGetSfioStreamIdentifier(
_In_ PFILE_OBJECT FileObject,
_In_ PVOID Signature);
-NTKERNELAPI
NTSTATUS
NTAPI
IoFreeSfioStreamIdentifier(
@@ -2445,7 +2439,6 @@ IoUpdateDiskGeometry(
_In_ struct _DISK_GEOMETRY_EX* OldDiskGeometry,
_In_ struct _DISK_GEOMETRY_EX* NewDiskGeometry);
-NTKERNELAPI
PTXN_PARAMETER_BLOCK
NTAPI
IoGetTransactionParameterBlock(
@@ -2471,14 +2464,12 @@ IoCreateFileEx(
_In_ ULONG Options,
_In_opt_ PIO_DRIVER_CREATE_CONTEXT DriverContext);
-NTKERNELAPI
NTSTATUS
NTAPI
IoSetIrpExtraCreateParameter(
_Inout_ PIRP Irp,
_In_ struct _ECP_LIST *ExtraCreateParameter);
-NTKERNELAPI
VOID
NTAPI
IoClearIrpExtraCreateParameter(
@@ -2491,7 +2482,6 @@ IoGetIrpExtraCreateParameter(
_In_ PIRP Irp,
_Outptr_result_maybenull_ struct _ECP_LIST **ExtraCreateParameter);
-NTKERNELAPI
BOOLEAN
NTAPI
IoIsFileObjectIgnoringSharing(
@@ -2608,6 +2598,8 @@ $endif (_NTIFS_)
#endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
#if (NTDDI_VERSION >= NTDDI_WIN8)
+
+$if (_WDMDDK_)
_IRQL_requires_max_(PASSIVE_LEVEL)
_Must_inspect_result_
// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
@@ -2634,6 +2626,16 @@ IoGetDeviceInterfacePropertyData (
_Out_writes_bytes_to_(Size, *RequiredSize) PVOID Data,
_Out_ PULONG RequiredSize,
_Out_ PDEVPROPTYPE Type);
+$endif (_WDMDDK_)
+$if (_NTDDK_)
+
+// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
+VOID
+IoSetMasterIrpStatus(
+ _Inout_ PIRP MasterIrp,
+ _In_ NTSTATUS Status);
+$endif (_NTDDK_)
+
#endif /* (NTDDI_VERSION >= NTDDI_WIN8) */
$if (_WDMDDK_)
diff --git a/sdk/lib/drivers/ntoskrnl_vista/io.c b/sdk/lib/drivers/ntoskrnl_vista/io.c
index 3f58ce9574c..5008f7a981d 100644
--- a/sdk/lib/drivers/ntoskrnl_vista/io.c
+++ b/sdk/lib/drivers/ntoskrnl_vista/io.c
@@ -107,4 +107,25 @@ IoGetIoPriorityHint(
_In_ PIRP Irp)
{
return IoPriorityNormal;
-}
\ No newline at end of file
+}
+
+NTKERNELAPI
+VOID
+IoSetMasterIrpStatus(
+ _Inout_ PIRP MasterIrp,
+ _In_ NTSTATUS Status)
+{
+ NTSTATUS MasterStatus = MasterIrp->IoStatus.Status;
+
+ if (Status == STATUS_FT_READ_FROM_COPY)
+ {
+ return;
+ }
+
+ if ((Status == STATUS_VERIFY_REQUIRED) ||
+ (MasterStatus == STATUS_SUCCESS && !NT_SUCCESS(Status)) ||
+ (!NT_SUCCESS(MasterStatus) && !NT_SUCCESS(Status) && Status >
MasterStatus))
+ {
+ MasterIrp->IoStatus.Status = Status;
+ }
+}