2000-12-28 03:38:08 +00:00
|
|
|
/*
|
|
|
|
* ReactOS kernel
|
|
|
|
* Copyright (C) 2000 David Welch <welch@cwcom.net>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
2002-06-10 23:04:48 +00:00
|
|
|
/* $Id: io.h,v 1.21 2002/06/10 23:02:44 ekohl Exp $
|
2000-03-05 19:17:43 +00:00
|
|
|
*
|
1998-09-13 15:55:36 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
2000-03-26 19:38:32 +00:00
|
|
|
* FILE: include/internal/io.h
|
1998-09-13 15:55:36 +00:00
|
|
|
* PURPOSE: Internal io manager declarations
|
|
|
|
* PROGRAMMER: David Welch (welch@mcmail.com)
|
|
|
|
* UPDATE HISTORY:
|
|
|
|
* 28/05/97: Created
|
|
|
|
*/
|
|
|
|
|
2000-12-28 03:38:08 +00:00
|
|
|
#ifndef __NTOSKRNL_INCLUDE_INTERNAL_IO_H
|
|
|
|
#define __NTOSKRNL_INCLUDE_INTERNAL_IO_H
|
1998-09-13 15:55:36 +00:00
|
|
|
|
|
|
|
#include <ddk/ntddk.h>
|
|
|
|
#include <internal/ob.h>
|
|
|
|
|
2001-05-01 23:08:21 +00:00
|
|
|
typedef struct _DEVICE_NODE
|
|
|
|
{
|
|
|
|
struct _DEVICE_NODE *Parent;
|
|
|
|
struct _DEVICE_NODE *PrevSibling;
|
|
|
|
struct _DEVICE_NODE *NextSibling;
|
|
|
|
struct _DEVICE_NODE *Child;
|
2001-09-01 15:36:45 +00:00
|
|
|
PDRIVER_OBJECT DriverObject;
|
2001-05-01 23:08:21 +00:00
|
|
|
PDEVICE_OBJECT Pdo;
|
|
|
|
UNICODE_STRING InstancePath;
|
|
|
|
UNICODE_STRING ServiceName;
|
|
|
|
//TargetDeviceNotifyList?
|
2001-09-16 13:19:32 +00:00
|
|
|
PDEVICE_CAPABILITIES CapabilityFlags;
|
2001-05-01 23:08:21 +00:00
|
|
|
ULONG Flags;
|
|
|
|
ULONG UserFlags;
|
|
|
|
ULONG DisableableDepends;
|
|
|
|
ULONG Problem;
|
|
|
|
PCM_RESOURCE_LIST CmResourceList;
|
|
|
|
PCM_RESOURCE_LIST BootResourcesList;
|
|
|
|
PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirementsList;
|
2001-09-16 13:19:32 +00:00
|
|
|
/* Not NT's */
|
|
|
|
UNICODE_STRING DeviceID;
|
|
|
|
UNICODE_STRING InstanceID;
|
|
|
|
UNICODE_STRING HardwareIDs;
|
|
|
|
UNICODE_STRING CompatibleIDs;
|
|
|
|
UNICODE_STRING DeviceText;
|
|
|
|
UNICODE_STRING DeviceTextLocation;
|
|
|
|
PPNP_BUS_INFORMATION BusInformation;
|
2001-05-01 23:08:21 +00:00
|
|
|
} DEVICE_NODE, *PDEVICE_NODE;
|
1998-10-05 04:01:30 +00:00
|
|
|
|
2001-05-01 23:08:21 +00:00
|
|
|
/* For Flags field */
|
2001-09-01 15:36:45 +00:00
|
|
|
#define DNF_PROCESSED 0x00000001
|
|
|
|
#define DNF_STARTED 0x00000002
|
|
|
|
#define DNF_START_FAILED 0x00000004
|
|
|
|
#define DNF_ENUMERATED 0x00000008
|
|
|
|
#define DNF_DELETED 0x00000010
|
|
|
|
#define DNF_MADEUP 0x00000020
|
|
|
|
#define DNF_START_REQUEST_PENDING 0x00000040
|
|
|
|
#define DNF_NO_RESOURCE_REQUIRED 0x00000080
|
|
|
|
#define DNF_INSUFFICIENT_RESOURCES 0x00000100
|
|
|
|
#define DNF_RESOURCE_ASSIGNED 0x00000200
|
|
|
|
#define DNF_RESOURCE_REPORTED 0x00000400
|
|
|
|
#define DNF_HAL_NODE 0x00000800 // ???
|
|
|
|
#define DNF_ADDED 0x00001000
|
|
|
|
#define DNF_ADD_FAILED 0x00002000
|
|
|
|
#define DNF_LEGACY_DRIVER 0x00004000
|
|
|
|
#define DNF_STOPPED 0x00008000
|
|
|
|
#define DNF_WILL_BE_REMOVED 0x00010000
|
|
|
|
#define DNF_NEED_TO_ENUM 0x00020000
|
|
|
|
#define DNF_NOT_CONFIGURED 0x00040000
|
|
|
|
#define DNF_REINSTALL 0x00080000
|
|
|
|
#define DNF_RESOURCE_REQUIREMENTS_NEED_FILTERED 0x00100000 // ???
|
|
|
|
#define DNF_DISABLED 0x00200000
|
|
|
|
#define DNF_RESTART_OK 0x00400000
|
|
|
|
#define DNF_NEED_RESTART 0x00800000
|
|
|
|
#define DNF_VISITED 0x01000000
|
|
|
|
#define DNF_ASSIGNING_RESOURCES 0x02000000
|
|
|
|
#define DNF_BEEING_ENUMERATED 0x04000000
|
|
|
|
#define DNF_NEED_ENUMERATION_ONLY 0x08000000
|
|
|
|
#define DNF_LOCKED 0x10000000
|
|
|
|
#define DNF_HAS_BOOT_CONFIG 0x20000000
|
|
|
|
#define DNF_BOOT_CONFIG_RESERVED 0x40000000
|
|
|
|
#define DNF_HAS_PROBLEM 0x80000000 // ???
|
2001-05-01 23:08:21 +00:00
|
|
|
|
|
|
|
/* For UserFlags field */
|
|
|
|
#define DNUF_DONT_SHOW_IN_UI 0x0002
|
|
|
|
#define DNUF_NOT_DISABLEABLE 0x0008
|
|
|
|
|
|
|
|
/* For Problem field */
|
2001-09-01 15:36:45 +00:00
|
|
|
#define CM_PROB_NOT_CONFIGURED 1
|
|
|
|
#define CM_PROB_FAILED_START 10
|
|
|
|
#define CM_PROB_NORMAL_CONFLICT 12
|
|
|
|
#define CM_PROB_NEED_RESTART 14
|
|
|
|
#define CM_PROB_REINSTALL 18
|
|
|
|
#define CM_PROB_WILL_BE_REMOVED 21
|
|
|
|
#define CM_PROB_DISABLED 22
|
|
|
|
#define CM_PROB_FAILED_INSTALL 28
|
|
|
|
#define CM_PROB_FAILED_ADD 31
|
2001-05-01 23:08:21 +00:00
|
|
|
|
2001-09-16 13:19:32 +00:00
|
|
|
/*
|
|
|
|
* VOID
|
|
|
|
* IopDeviceNodeSetFlag(
|
|
|
|
* PDEVICE_NODE DeviceNode,
|
|
|
|
* ULONG Flag);
|
|
|
|
*/
|
|
|
|
#define IopDeviceNodeSetFlag(DeviceNode, Flag)((DeviceNode)->Flags |= (Flag))
|
|
|
|
|
|
|
|
/*
|
|
|
|
* VOID
|
|
|
|
* IopDeviceNodeClearFlag(
|
|
|
|
* PDEVICE_NODE DeviceNode,
|
|
|
|
* ULONG Flag);
|
|
|
|
*/
|
|
|
|
#define IopDeviceNodeClearFlag(DeviceNode, Flag)((DeviceNode)->Flags &= ~(Flag))
|
|
|
|
|
|
|
|
/*
|
|
|
|
* BOOLEAN
|
|
|
|
* IopDeviceNodeHasFlag(
|
|
|
|
* PDEVICE_NODE DeviceNode,
|
|
|
|
* ULONG Flag);
|
|
|
|
*/
|
|
|
|
#define IopDeviceNodeHasFlag(DeviceNode, Flag)(((DeviceNode)->Flags & (Flag)) > 0)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* VOID
|
|
|
|
* IopDeviceNodeSetUserFlag(
|
|
|
|
* PDEVICE_NODE DeviceNode,
|
|
|
|
* ULONG UserFlag);
|
|
|
|
*/
|
|
|
|
#define IopDeviceNodeSetUserFlag(DeviceNode, UserFlag)((DeviceNode)->UserFlags |= (UserFlag))
|
|
|
|
|
|
|
|
/*
|
|
|
|
* VOID
|
|
|
|
* IopDeviceNodeClearUserFlag(
|
|
|
|
* PDEVICE_NODE DeviceNode,
|
|
|
|
* ULONG UserFlag);
|
|
|
|
*/
|
|
|
|
#define IopDeviceNodeClearUserFlag(DeviceNode, UserFlag)((DeviceNode)->UserFlags &= ~(UserFlag))
|
|
|
|
|
|
|
|
/*
|
|
|
|
* BOOLEAN
|
|
|
|
* IopDeviceNodeHasUserFlag(
|
|
|
|
* PDEVICE_NODE DeviceNode,
|
|
|
|
* ULONG UserFlag);
|
|
|
|
*/
|
|
|
|
#define IopDeviceNodeHasUserFlag(DeviceNode, UserFlag)(((DeviceNode)->UserFlags & (UserFlag)) > 0)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* VOID
|
|
|
|
* IopDeviceNodeSetProblem(
|
|
|
|
* PDEVICE_NODE DeviceNode,
|
|
|
|
* ULONG Problem);
|
|
|
|
*/
|
|
|
|
#define IopDeviceNodeSetProblem(DeviceNode, Problem)((DeviceNode)->Problem |= (Problem))
|
|
|
|
|
|
|
|
/*
|
|
|
|
* VOID
|
|
|
|
* IopDeviceNodeClearProblem(
|
|
|
|
* PDEVICE_NODE DeviceNode,
|
|
|
|
* ULONG Problem);
|
|
|
|
*/
|
|
|
|
#define IopDeviceNodeClearProblem(DeviceNode, Problem)((DeviceNode)->Problem &= ~(Problem))
|
|
|
|
|
|
|
|
/*
|
|
|
|
* BOOLEAN
|
|
|
|
* IopDeviceNodeHasProblem(
|
|
|
|
* PDEVICE_NODE DeviceNode,
|
|
|
|
* ULONG Problem);
|
|
|
|
*/
|
|
|
|
#define IopDeviceNodeHasProblem(DeviceNode, Problem)(((DeviceNode)->Problem & (Problem)) > 0)
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Called on every visit of a node during a preorder-traversal of the device
|
|
|
|
node tree.
|
|
|
|
If the routine returns STATUS_UNSUCCESSFUL the traversal will stop and
|
|
|
|
STATUS_SUCCESS is returned to the caller who initiated the tree traversal.
|
|
|
|
Any other returned status code will be returned to the caller. If a status
|
|
|
|
code that indicates an error (other than STATUS_UNSUCCESSFUL) is returned,
|
|
|
|
the traversal is stopped immediately and the status code is returned to
|
|
|
|
the caller.
|
|
|
|
*/
|
|
|
|
typedef NTSTATUS (*DEVICETREE_TRAVERSE_ROUTINE)(
|
|
|
|
PDEVICE_NODE DeviceNode,
|
|
|
|
PVOID Context);
|
|
|
|
|
|
|
|
/* Context information for traversing the device tree */
|
|
|
|
typedef struct _DEVICETREE_TRAVERSE_CONTEXT
|
|
|
|
{
|
|
|
|
/* Current device node during a traversal */
|
|
|
|
PDEVICE_NODE DeviceNode;
|
|
|
|
/* Initial device node where we start the traversal */
|
|
|
|
PDEVICE_NODE FirstDeviceNode;
|
|
|
|
/* Action routine to be called for every device node */
|
|
|
|
DEVICETREE_TRAVERSE_ROUTINE Action;
|
|
|
|
/* Context passed to the action routine */
|
|
|
|
PVOID Context;
|
|
|
|
} DEVICETREE_TRAVERSE_CONTEXT, *PDEVICETREE_TRAVERSE_CONTEXT;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* VOID
|
|
|
|
* IopInitDeviceTreeTraverseContext(
|
|
|
|
* PDEVICETREE_TRAVERSE_CONTEXT DeviceTreeTraverseContext,
|
|
|
|
* PDEVICE_NODE DeviceNode,
|
|
|
|
* DEVICETREE_TRAVERSE_ROUTINE Action,
|
|
|
|
* PVOID Context);
|
|
|
|
*/
|
|
|
|
#define IopInitDeviceTreeTraverseContext( \
|
|
|
|
_DeviceTreeTraverseContext, _DeviceNode, _Action, _Context) { \
|
|
|
|
(_DeviceTreeTraverseContext)->FirstDeviceNode = (_DeviceNode); \
|
|
|
|
(_DeviceTreeTraverseContext)->Action = (_Action); \
|
|
|
|
(_DeviceTreeTraverseContext)->Context = (_Context); }
|
|
|
|
|
|
|
|
|
2001-05-01 23:08:21 +00:00
|
|
|
extern PDEVICE_NODE IopRootDeviceNode;
|
|
|
|
|
|
|
|
extern POBJECT_TYPE IoSymbolicLinkType;
|
|
|
|
|
|
|
|
VOID
|
|
|
|
PnpInit(VOID);
|
|
|
|
|
2002-06-10 08:50:55 +00:00
|
|
|
VOID
|
|
|
|
IopInitDriverImplementation(VOID);
|
|
|
|
|
2001-05-01 23:08:21 +00:00
|
|
|
NTSTATUS
|
|
|
|
IopGetSystemPowerDeviceObject(PDEVICE_OBJECT *DeviceObject);
|
|
|
|
NTSTATUS
|
|
|
|
IopCreateDeviceNode(PDEVICE_NODE ParentNode,
|
|
|
|
PDEVICE_OBJECT PhysicalDeviceObject,
|
|
|
|
PDEVICE_NODE *DeviceNode);
|
|
|
|
NTSTATUS
|
|
|
|
IopFreeDeviceNode(PDEVICE_NODE DeviceNode);
|
|
|
|
NTSTATUS
|
|
|
|
IopInterrogateBusExtender(PDEVICE_NODE DeviceNode,
|
2001-09-16 13:19:32 +00:00
|
|
|
PDEVICE_OBJECT Pdo,
|
2001-05-01 23:08:21 +00:00
|
|
|
BOOLEAN BootDriversOnly);
|
|
|
|
VOID
|
|
|
|
IopLoadBootStartDrivers(VOID);
|
|
|
|
NTSTATUS
|
2002-06-10 23:04:48 +00:00
|
|
|
IopCreateDriverObject(PDRIVER_OBJECT *DriverObject,
|
|
|
|
PUNICODE_STRING ServiceName,
|
|
|
|
BOOLEAN FileSystem);
|
2001-05-01 23:08:21 +00:00
|
|
|
NTSTATUS
|
2001-09-01 15:36:45 +00:00
|
|
|
IopInitializeDeviceNodeService(PDEVICE_NODE DeviceNode);
|
|
|
|
NTSTATUS
|
2001-05-01 23:08:21 +00:00
|
|
|
IopInitializeDriver(PDRIVER_INITIALIZE DriverEntry,
|
2002-04-10 09:58:45 +00:00
|
|
|
PDEVICE_NODE DeviceNode);
|
|
|
|
VOID
|
2000-12-28 03:38:08 +00:00
|
|
|
IoInitCancelHandling(VOID);
|
2002-04-10 09:58:45 +00:00
|
|
|
VOID
|
2000-12-28 03:38:08 +00:00
|
|
|
IoInitSymbolicLinkImplementation(VOID);
|
2002-04-10 09:58:45 +00:00
|
|
|
VOID
|
2000-12-28 03:38:08 +00:00
|
|
|
IoInitFileSystemImplementation(VOID);
|
2002-04-10 09:58:45 +00:00
|
|
|
VOID
|
2000-12-28 03:38:08 +00:00
|
|
|
IoInitVpbImplementation (VOID);
|
1998-09-13 15:55:36 +00:00
|
|
|
|
2002-04-10 09:58:45 +00:00
|
|
|
NTSTATUS
|
2002-05-15 09:42:19 +00:00
|
|
|
IoMountVolume(IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN BOOLEAN AllowRawMount);
|
1998-09-13 15:55:36 +00:00
|
|
|
POBJECT IoOpenSymlink(POBJECT SymbolicLink);
|
|
|
|
POBJECT IoOpenFileOnDevice(POBJECT SymbolicLink, PWCHAR Name);
|
|
|
|
|
1998-10-05 04:01:30 +00:00
|
|
|
VOID IoSecondStageCompletion(PIRP Irp, CCHAR PriorityBoost);
|
1999-02-01 20:58:37 +00:00
|
|
|
|
2001-08-26 17:30:21 +00:00
|
|
|
NTSTATUS STDCALL
|
|
|
|
IopCreateFile(PVOID ObjectBody,
|
|
|
|
PVOID Parent,
|
|
|
|
PWSTR RemainingPath,
|
|
|
|
POBJECT_ATTRIBUTES ObjectAttributes);
|
|
|
|
NTSTATUS STDCALL
|
|
|
|
IopCreateDevice(PVOID ObjectBody,
|
|
|
|
PVOID Parent,
|
|
|
|
PWSTR RemainingPath,
|
|
|
|
POBJECT_ATTRIBUTES ObjectAttributes);
|
1999-03-25 00:37:06 +00:00
|
|
|
NTSTATUS IoAttachVpb(PDEVICE_OBJECT DeviceObject);
|
1999-02-01 20:58:37 +00:00
|
|
|
|
1999-11-12 12:01:17 +00:00
|
|
|
PIRP IoBuildSynchronousFsdRequestWithMdl(ULONG MajorFunction,
|
|
|
|
PDEVICE_OBJECT DeviceObject,
|
|
|
|
PMDL Mdl,
|
|
|
|
PLARGE_INTEGER StartingOffset,
|
|
|
|
PKEVENT Event,
|
2001-01-13 18:38:09 +00:00
|
|
|
PIO_STATUS_BLOCK IoStatusBlock,
|
|
|
|
ULONG PagingIo);
|
2000-10-05 19:15:50 +00:00
|
|
|
|
2000-09-10 13:54:01 +00:00
|
|
|
VOID IoInitShutdownNotification(VOID);
|
|
|
|
VOID IoShutdownRegisteredDevices(VOID);
|
2000-10-05 19:15:50 +00:00
|
|
|
VOID IoShutdownRegisteredFileSystems(VOID);
|
2000-09-10 13:54:01 +00:00
|
|
|
|
2002-04-10 09:58:45 +00:00
|
|
|
NTSTATUS STDCALL
|
|
|
|
IoPageRead(PFILE_OBJECT FileObject,
|
|
|
|
PMDL Mdl,
|
|
|
|
PLARGE_INTEGER Offset,
|
|
|
|
PIO_STATUS_BLOCK StatusBlock,
|
|
|
|
BOOLEAN PagingIo);
|
|
|
|
NTSTATUS STDCALL
|
|
|
|
IoPageWrite(PFILE_OBJECT FileObject,
|
2001-04-03 17:25:50 +00:00
|
|
|
PMDL Mdl,
|
|
|
|
PLARGE_INTEGER Offset,
|
|
|
|
PIO_STATUS_BLOCK StatusBlock,
|
|
|
|
BOOLEAN PagingIo);
|
1999-11-12 12:01:17 +00:00
|
|
|
|
2002-03-13 01:30:34 +00:00
|
|
|
NTSTATUS
|
|
|
|
IoCreateArcNames(VOID);
|
|
|
|
|
2002-03-16 00:00:13 +00:00
|
|
|
NTSTATUS
|
|
|
|
IoCreateSystemRootLink(PCHAR ParameterLine);
|
|
|
|
|
2001-09-01 15:36:45 +00:00
|
|
|
NTSTATUS
|
|
|
|
IopInitiatePnpIrp(
|
|
|
|
PDEVICE_OBJECT DeviceObject,
|
|
|
|
PIO_STATUS_BLOCK IoStatusBlock,
|
|
|
|
ULONG MinorFunction,
|
|
|
|
PIO_STACK_LOCATION Stack);
|
|
|
|
|
2001-09-16 13:19:32 +00:00
|
|
|
BOOLEAN
|
|
|
|
IopCreateUnicodeString(
|
|
|
|
PUNICODE_STRING Destination,
|
|
|
|
PWSTR Source,
|
|
|
|
POOL_TYPE PoolType);
|
|
|
|
|
|
|
|
|
|
|
|
/* pnproot.c */
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
STDCALL
|
|
|
|
PnpRootDriverEntry(
|
|
|
|
IN PDRIVER_OBJECT DriverObject,
|
|
|
|
IN PUNICODE_STRING RegistryPath);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
PnpRootCreateDevice(
|
|
|
|
PDEVICE_OBJECT *PhysicalDeviceObject);
|
|
|
|
|
1998-09-13 15:55:36 +00:00
|
|
|
#endif
|