ReactOS  0.4.15-dev-1201-gb2cf5a4
io.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Kernel - Vista+ APIs
3  * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE: Io functions of Vista+
5  * COPYRIGHT: 2016 Pierre Schweitzer (pierre@reactos.org)
6  * 2020 Victor Perevertkin (victor.perevertkin@reactos.org)
7  */
8 
9 #include <ntdef.h>
10 #include <ntifs.h>
11 
12 typedef struct _EX_WORKITEM_CONTEXT
13 {
18 
19 #define TAG_IOWI 'IWOI'
20 
23 NTAPI
25  OUT PECP_LIST *ExtraCreateParameter)
26 {
27  /* Check we have a create operation */
29  {
31  }
32 
33  /* If so, return user buffer */
34  *ExtraCreateParameter = Irp->UserBuffer;
35  return STATUS_SUCCESS;
36 }
37 
38 _Function_class_(IO_WORKITEM_ROUTINE)
39 static
40 VOID
41 NTAPI
42 IopWorkItemExCallback(
44  PVOID Ctx)
45 {
47 
48  context->WorkItemRoutineEx(DeviceObject, context->Context, context->WorkItem);
50 }
51 
53 VOID
54 NTAPI
60 {
62  newContext->WorkItem = IoWorkItem;
63  newContext->WorkItemRoutineEx = WorkerRoutine;
64  newContext->Context = Context;
65 
66  IoQueueWorkItem(IoWorkItem, IopWorkItemExCallback, QueueType, Context);
67 }
68 
73 NTAPI
74 IoSetDevicePropertyData(
77  _In_ LCID Lcid,
80  _In_ ULONG Size,
82 {
84 }
85 
90 NTAPI
91 IoGetDevicePropertyData(
94  _In_ LCID Lcid,
96  _In_ ULONG Size,
100 {
101  return STATUS_NOT_IMPLEMENTED;
102 }
103 
107 NTSTATUS
108 IoSetDeviceInterfacePropertyData(
109  _In_ PUNICODE_STRING SymbolicLinkName,
111  _In_ LCID Lcid,
112  _In_ ULONG Flags,
114  _In_ ULONG Size,
116 {
117  return STATUS_NOT_IMPLEMENTED;
118 }
119 
122 NTAPI
124  _In_ PIRP Irp)
125 {
126  return IoPriorityNormal;
127 }
128 
130 VOID
132  _Inout_ PIRP MasterIrp,
134 {
135  NTSTATUS MasterStatus = MasterIrp->IoStatus.Status;
136 
138  {
139  return;
140  }
141 
142  if ((Status == STATUS_VERIFY_REQUIRED) ||
143  (MasterStatus == STATUS_SUCCESS && !NT_SUCCESS(Status)) ||
144  (!NT_SUCCESS(MasterStatus) && !NT_SUCCESS(Status) && Status > MasterStatus))
145  {
146  MasterIrp->IoStatus.Status = Status;
147  }
148 }
#define IN
Definition: typedefs.h:39
#define _Must_inspect_result_
Definition: no_sal2.h:314
NTKRNLVISTAAPI VOID IoSetMasterIrpStatus(_Inout_ PIRP MasterIrp, _In_ NTSTATUS Status)
Definition: io.c:131
_In_ PDEVICE_OBJECT Pdo
Definition: classpnp.h:318
Type
Definition: Type.h:6
_In_ CONST DEVPROPKEY _In_ LCID Lcid
Definition: iofuncs.h:2410
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
Definition: http.c:7094
_In_ PIRP Irp
Definition: csq.h:116
NTKRNLVISTAAPI IO_PRIORITY_HINT NTAPI IoGetIoPriorityHint(_In_ PIRP Irp)
Definition: io.c:123
PIO_WORKITEM WorkItem
Definition: io.c:14
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
struct _EX_WORKITEM_CONTEXT EX_WORKITEM_CONTEXT
#define _In_reads_bytes_opt_(size)
Definition: no_sal2.h:230
_Must_inspect_result_ _In_ PFLT_CALLBACK_DATA _In_ PFLT_DEFERRED_IO_WORKITEM_ROUTINE WorkerRoutine
Definition: fltkernel.h:1977
LONG NTSTATUS
Definition: precomp.h:26
#define NTKRNLVISTAAPI
PIO_WORKITEM_ROUTINE_EX WorkItemRoutineEx
Definition: io.c:15
_In_opt_ PVOID _In_ PIO_WORKITEM IoWorkItem
Definition: iotypes.h:503
DWORD LCID
Definition: nls.h:13
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
ULONG * PDEVPROPTYPE
Definition: devpropdef.h:24
ULONG DEVPROPTYPE
Definition: devpropdef.h:24
#define STATUS_VERIFY_REQUIRED
Definition: udferr_usr.h:130
#define _In_opt_
Definition: no_sal2.h:213
_IRQL_requires_max_(PASSIVE_LEVEL)
Definition: io.c:69
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
NTKRNLVISTAAPI VOID NTAPI IoQueueWorkItemEx(_Inout_ PIO_WORKITEM IoWorkItem, _In_ PIO_WORKITEM_ROUTINE_EX WorkerRoutine, _In_ WORK_QUEUE_TYPE QueueType, _In_opt_ __drv_aliasesMem PVOID Context)
Definition: io.c:55
#define __drv_aliasesMem
Definition: btrfs_drv.h:205
struct _EX_WORKITEM_CONTEXT * PEX_WORKITEM_CONTEXT
#define _Out_
Definition: no_sal2.h:323
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
PVOID Context
Definition: io.c:16
#define _Inout_
Definition: no_sal2.h:244
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
_Function_class_(IO_COMPLETION_ROUTINE)
Definition: io.c:74
enum _WORK_QUEUE_TYPE WORK_QUEUE_TYPE
#define _Reserved_
Definition: no_sal2.h:573
Status
Definition: gdiplustypes.h:24
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
enum _IO_PRIORITY_HINT IO_PRIORITY_HINT
VOID NTAPI IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem, IN PIO_WORKITEM_ROUTINE WorkerRoutine, IN WORK_QUEUE_TYPE QueueType, IN PVOID Context)
Definition: iowork.c:40
#define _In_
Definition: no_sal2.h:204
IO_WORKITEM_ROUTINE_EX * PIO_WORKITEM_ROUTINE_EX
Definition: iotypes.h:505
NTKRNLVISTAAPI NTSTATUS NTAPI IoGetIrpExtraCreateParameter(IN PIRP Irp, OUT PECP_LIST *ExtraCreateParameter)
Definition: io.c:24
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
#define TAG_IOWI
Definition: io.c:19
unsigned int * PULONG
Definition: retypes.h:1
#define OUT
Definition: typedefs.h:40
struct tagContext Context
Definition: acpixf.h:1034
unsigned int ULONG
Definition: retypes.h:1
#define IRP_CREATE_OPERATION
#define STATUS_FT_READ_FROM_COPY
Definition: ntstatus.h:167
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define CONST
Definition: pedump.c:81
_Must_inspect_result_ _In_ PFLT_CALLBACK_DATA _In_ PFLT_DEFERRED_IO_WORKITEM_ROUTINE _In_ WORK_QUEUE_TYPE QueueType
Definition: fltkernel.h:1977
_In_ CONST DEVPROPKEY * PropertyKey
Definition: iofuncs.h:2410