Plug & Play manager improvments + few other things

ntoskrnl/ntoskrnl.edf:
   Added exports for IoGetDmaAdapter, IoIsWdmVersionAvailable,
   KefAcquireSpinLockAtDpcLevel, KefReleaseSpinLockFromDpcLevel,
   ExFreePoolWithTag.
ntoskrnl/io/driver.c:
   Implementation of NtUnloadDriver.
ntoskrnl/io/device.c:
   Added prepending "\\SystemRoot\" and displaying "PnP Loading xxx..." message
   in IopInitializeDeviceNodeService.
ntoskrnl/io/pnpmgr.c:
   Split into ntoskrnl/io/pnpmgr.c, ntoskrnl/io/deviface.c,
   ntoskrnl/io/pnpnotify.c, ntoskrnl/io/pnpmgr/pnpdma.c,
   ntoskrnl/io/pnpmgr.c, ntoskrnl/io/pnpmgr/pnproot.c,
   ntoskrnl/io/remlock.c, ntoskrnl/io/pnpmgr/pnpreport.c.
   Fixed registry handling in IopActionInterrogateDeviceStack and
   IopActionConfigureChildServices.
   Partial implementation of IoGetDeviceProperty.
ntoskrnl/io/pnpdma.c:
   Implementation of IoGetDmaAdapter.
ntoskrnl/io/wdm.c:
   New file. Contains implementation of IoIsWdmVersionAvailable.
ntoskrnl/ke/spinlock.c:
   Added KeAcquireSpinLockAtDpcLevel and KefReleaseSpinLockFromDpcLevel.
ntoskrnl/mm/pool.c:
   Partial implementation of ExFreePoolWithTag.

svn path=/trunk/; revision=6136
This commit is contained in:
Filip Navara 2003-09-25 15:54:43 +00:00
parent bf8e3b5659
commit 7ea418b4eb
16 changed files with 5181 additions and 4191 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.105 2003/08/24 12:08:16 dwelch Exp $
# $Id: Makefile,v 1.106 2003/09/25 15:54:42 navaraf Exp $
#
# ReactOS Operating System
#
@ -175,6 +175,7 @@ OBJECTS_IO = \
io/cntrller.o \
io/create.o \
io/device.o \
io/deviface.o \
io/dir.o \
io/driver.o \
io/errlog.o \
@ -194,11 +195,15 @@ OBJECTS_IO = \
io/npipe.o \
io/page.o \
io/parttab.o \
io/pnpmgr.o \
io/pnproot.o \
io/process.o \
io/pnpnotify.o \
io/pnpdma.o \
io/pnpmgr.o \
io/pnpreport.o \
io/pnproot.o \
io/queue.o \
io/rawfs.o \
io/remlock.o \
io/resource.o \
io/rw.o \
io/share.o \
@ -206,6 +211,7 @@ OBJECTS_IO = \
io/symlink.o \
io/timer.o \
io/vpb.o \
io/wdm.o \
io/xhaldisp.o \
io/xhaldrv.o

View file

@ -1,4 +1,4 @@
/* $Id: device.c,v 1.58 2003/08/24 11:35:41 dwelch Exp $
/* $Id: device.c,v 1.59 2003/09/25 15:54:42 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -366,7 +366,7 @@ NTSTATUS
IopInitializeDevice(PDEVICE_NODE DeviceNode,
BOOLEAN BootDriversOnly)
{
IO_STATUS_BLOCK IoStatusBlock;
IO_STATUS_BLOCK IoStatusBlock;
PDRIVER_OBJECT DriverObject;
IO_STACK_LOCATION Stack;
PDEVICE_OBJECT Fdo;
@ -483,7 +483,7 @@ IopInitializeService(
}
}
Status = IopInitializeDevice(DeviceNode, TRUE);
Status = IopInitializeDevice(DeviceNode, FALSE);
return(Status);
}
@ -491,6 +491,64 @@ IopInitializeService(
NTSTATUS
IopInitializeDeviceNodeService(PDEVICE_NODE DeviceNode)
{
#if 1
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
UNICODE_STRING ImagePath;
NTSTATUS Status;
WCHAR FullImagePathBuffer[MAX_PATH];
UNICODE_STRING FullImagePath;
CHAR TextBuffer [256];
ULONG x, y, cx, cy;
RtlZeroMemory(QueryTable, sizeof(QueryTable));
RtlInitUnicodeString(&ImagePath, NULL);
QueryTable[0].Name = L"ImagePath";
QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
QueryTable[0].EntryContext = &ImagePath;
Status = RtlQueryRegistryValues(RTL_REGISTRY_SERVICES,
DeviceNode->ServiceName.Buffer,
QueryTable,
NULL,
NULL);
DPRINT("RtlQueryRegistryValues() returned status %x\n", Status);
if (NT_SUCCESS(Status))
{
DPRINT("Got ImagePath %S\n", ImagePath.Buffer);
if (ImagePath.Buffer[0] != L'\\')
{
wcscpy(FullImagePathBuffer, L"\\SystemRoot\\");
wcscat(FullImagePathBuffer, ImagePath.Buffer);
}
else
{
wcscpy(FullImagePathBuffer, ImagePath.Buffer);
}
RtlFreeUnicodeString(&ImagePath);
RtlInitUnicodeString(&FullImagePath, FullImagePathBuffer);
HalQueryDisplayParameters(&x, &y, &cx, &cy);
RtlFillMemory(TextBuffer, x, ' ');
TextBuffer[x] = '\0';
HalSetDisplayParameters(0, y-1);
HalDisplayString(TextBuffer);
sprintf(TextBuffer, "PnP Loading %S...\n", DeviceNode->ServiceName.Buffer);
HalSetDisplayParameters(0, y-1);
HalDisplayString(TextBuffer);
HalSetDisplayParameters(cx, cy);
Status = IopInitializeService(DeviceNode, &FullImagePath);
}
return(Status);
#else
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
UNICODE_STRING ImagePath;
HANDLE KeyHandle;
@ -534,6 +592,7 @@ IopInitializeDeviceNodeService(PDEVICE_NODE DeviceNode)
}
return(Status);
#endif
}
NTSTATUS

View file

@ -0,0 +1,115 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/pnpmgr/devintrf.c
* PURPOSE: Device interface functions
* PROGRAMMER: Filip Navara (xnavara@volny.cz)
* UPDATE HISTORY:
* 22/09/2003 FiN Created
*/
/* INCLUDES ******************************************************************/
#include <ddk/ntddk.h>
#include <reactos/bugcodes.h>
#include <internal/io.h>
#include <internal/po.h>
#include <internal/ldr.h>
#include <internal/registry.h>
#include <internal/module.h>
//#define NDEBUG
#include <internal/debug.h>
#include <ole32/guiddef.h>
#ifdef DEFINE_GUID
DEFINE_GUID(GUID_CLASS_COMPORT, 0x86e0d1e0L, 0x8089, 0x11d0, 0x9c, 0xe4, 0x08, 0x00, 0x3e, 0x30, 0x1f, 0x73);
DEFINE_GUID(GUID_SERENUM_BUS_ENUMERATOR, 0x4D36E978L, 0xE325, 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18);
#endif // DEFINE_GUID
/* FUNCTIONS *****************************************************************/
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoOpenDeviceInterfaceRegistryKey(
IN PUNICODE_STRING SymbolicLinkName,
IN ACCESS_MASK DesiredAccess,
OUT PHANDLE DeviceInterfaceKey)
{
DPRINT("IoOpenDeviceInterfaceRegistryKey called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoGetDeviceInterfaceAlias(
IN PUNICODE_STRING SymbolicLinkName,
IN CONST GUID *AliasInterfaceClassGuid,
OUT PUNICODE_STRING AliasSymbolicLinkName)
{
DPRINT("IoGetDeviceInterfaceAlias called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoGetDeviceInterfaces(
IN CONST GUID *InterfaceClassGuid,
IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
IN ULONG Flags,
OUT PWSTR *SymbolicLinkList)
{
DPRINT("IoGetDeviceInterfaces called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoRegisterDeviceInterface(
IN PDEVICE_OBJECT PhysicalDeviceObject,
IN CONST GUID *InterfaceClassGuid,
IN PUNICODE_STRING ReferenceString OPTIONAL,
OUT PUNICODE_STRING SymbolicLinkName)
{
PWCHAR KeyNameString = L"\\Device\\Serenum";
DPRINT("IoRegisterDeviceInterface called (UNIMPLEMENTED)\n");
if (IsEqualGUID(InterfaceClassGuid, (LPGUID)&GUID_SERENUM_BUS_ENUMERATOR))
{
RtlInitUnicodeString(SymbolicLinkName, KeyNameString);
return STATUS_SUCCESS;
}
return STATUS_INVALID_DEVICE_REQUEST;
// return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoSetDeviceInterfaceState(
IN PUNICODE_STRING SymbolicLinkName,
IN BOOLEAN Enable)
{
DPRINT("IoSetDeviceInterfaceState called (UNIMPLEMENTED)\n");
return STATUS_SUCCESS;
// return STATUS_OBJECT_NAME_EXISTS;
// return STATUS_OBJECT_NAME_NOT_FOUND;
// return STATUS_NOT_IMPLEMENTED;
}
/* EOF */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,282 @@
/* $Id: pnpdma.c,v 1.1 2003/09/25 15:54:42 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/pnpmgr.c
* PURPOSE: PnP manager DMA routines
* PROGRAMMER: Filip Navara (xnavara@volny.cz)
* UPDATE HISTORY:
* 22/09/2003 FiN Created
*/
/* INCLUDES ******************************************************************/
#include <ddk/ntddk.h>
#include <ddk/pnptypes.h>
#include <ddk/pnpfuncs.h>
#include <reactos/bugcodes.h>
#include <internal/io.h>
#include <internal/po.h>
#include <internal/ldr.h>
#include <internal/registry.h>
#include <internal/module.h>
//#define NDEBUG
#include <internal/debug.h>
#ifdef __USE_W32API
#include <initguid.h>
#else
#include <ole32/guiddef.h>
#endif
DEFINE_GUID(GUID_BUS_INTERFACE_STANDARD, 0x496B8280L, 0x6F25, 0x11D0, 0xBE, 0xAF, 0x08, 0x00, 0x2B, 0xE2, 0x09, 0x2F);
typedef struct _DMA_ADAPTER_INTERNAL {
USHORT Version;
USHORT Size;
PDMA_OPERATIONS DmaOperations;
PADAPTER_OBJECT HalAdapter;
} DMA_ADAPTER_INTERNAL, *PDMA_ADAPTER_INTERNAL;
/* FUNCTIONS *****************************************************************/
VOID
IopPutDmaAdapter(
PDMA_ADAPTER DmaAdapter)
{
ExFreePool(DmaAdapter);
}
PVOID
IopAllocateCommonBuffer(
IN PDMA_ADAPTER DmaAdapter,
IN ULONG Length,
OUT PPHYSICAL_ADDRESS LogicalAddress,
IN BOOLEAN CacheEnabled)
{
return HalAllocateCommonBuffer(
((PDMA_ADAPTER_INTERNAL)DmaAdapter)->HalAdapter,
Length, LogicalAddress, CacheEnabled);
}
VOID
IopFreeCommonBuffer(
IN PDMA_ADAPTER DmaAdapter,
IN ULONG Length,
IN PHYSICAL_ADDRESS LogicalAddress,
IN PVOID VirtualAddress,
IN BOOLEAN CacheEnabled)
{
HalFreeCommonBuffer(
((PDMA_ADAPTER_INTERNAL)DmaAdapter)->HalAdapter,
Length, LogicalAddress, VirtualAddress, CacheEnabled);
}
NTSTATUS
IopAllocateAdapterChannel(
IN PDMA_ADAPTER DmaAdapter,
IN PDEVICE_OBJECT DeviceObject,
IN ULONG NumberOfMapRegisters,
IN PDRIVER_CONTROL ExecutionRoutine,
IN PVOID Context)
{
return HalAllocateAdapterChannel(
((PDMA_ADAPTER_INTERNAL)DmaAdapter)->HalAdapter,
DeviceObject, NumberOfMapRegisters, ExecutionRoutine, Context);
}
BOOLEAN
IopFlushAdapterBuffers(
IN PDMA_ADAPTER DmaAdapter,
IN PMDL Mdl,
IN PVOID MapRegisterBase,
IN PVOID CurrentVa,
IN ULONG Length,
IN BOOLEAN WriteToDevice)
{
return IoFlushAdapterBuffers(
((PDMA_ADAPTER_INTERNAL)DmaAdapter)->HalAdapter,
Mdl, MapRegisterBase, CurrentVa, Length, WriteToDevice);
}
VOID
IopFreeAdapterChannel(
IN PDMA_ADAPTER DmaAdapter)
{
IoFreeAdapterChannel(((PDMA_ADAPTER_INTERNAL)DmaAdapter)->HalAdapter);
}
VOID
IopFreeMapRegisters(
IN PDMA_ADAPTER DmaAdapter,
PVOID MapRegisterBase,
ULONG NumberOfMapRegisters)
{
IoFreeMapRegisters(
((PDMA_ADAPTER_INTERNAL)DmaAdapter)->HalAdapter,
MapRegisterBase, NumberOfMapRegisters);
}
PHYSICAL_ADDRESS
IopMapTransfer(
IN PDMA_ADAPTER DmaAdapter,
IN PMDL Mdl,
IN PVOID MapRegisterBase,
IN PVOID CurrentVa,
IN OUT PULONG Length,
IN BOOLEAN WriteToDevice)
{
return IoMapTransfer(
((PDMA_ADAPTER_INTERNAL)DmaAdapter)->HalAdapter,
Mdl, MapRegisterBase, CurrentVa, Length, WriteToDevice);
}
ULONG
IopGetDmaAlignment(
IN PDMA_ADAPTER DmaAdapter)
{
/* FIXME: This is actually true only on i386 and Amd64 */
return 1L;
}
ULONG
IopReadDmaCounter(
IN PDMA_ADAPTER DmaAdapter)
{
return HalReadDmaCounter(((PDMA_ADAPTER_INTERNAL)DmaAdapter)->HalAdapter);
}
NTSTATUS
IopGetScatterGatherList(
IN PDMA_ADAPTER DmaAdapter,
IN PDEVICE_OBJECT DeviceObject,
IN PMDL Mdl,
IN PVOID CurrentVa,
IN ULONG Length,
IN PDRIVER_LIST_CONTROL ExecutionRoutine,
IN PVOID Context,
IN BOOLEAN WriteToDevice)
{
/* FIXME */
return STATUS_UNSUCCESSFUL;
}
VOID
IopPutScatterGatherList(
IN PDMA_ADAPTER DmaAdapter,
IN PSCATTER_GATHER_LIST ScatterGather,
IN BOOLEAN WriteToDevice)
{
/* FIXME */
}
/*
* @implemented
*/
PDMA_ADAPTER
STDCALL
IoGetDmaAdapter(
IN PDEVICE_OBJECT PhysicalDeviceObject,
IN PDEVICE_DESCRIPTION DeviceDescription,
IN OUT PULONG NumberOfMapRegisters)
{
NTSTATUS Status;
ULONG ResultLength;
BUS_INTERFACE_STANDARD BusInterface;
IO_STATUS_BLOCK IoStatusBlock;
IO_STACK_LOCATION Stack;
DEVICE_DESCRIPTION PrivateDeviceDescription;
PDMA_ADAPTER Result = NULL;
PDMA_ADAPTER_INTERNAL ResultInternal = NULL;
PADAPTER_OBJECT HalAdapter;
DPRINT("IoGetDmaAdapter called\n");
/*
* Try to create DMA adapter through bus driver
*/
if (PhysicalDeviceObject != NULL)
{
if (DeviceDescription->InterfaceType == 0x0F /*PNPBus*/ ||
DeviceDescription->InterfaceType == 0xFFFFFFFF)
{
memcpy(&PrivateDeviceDescription, DeviceDescription,
sizeof(DEVICE_DESCRIPTION));
Status = IoGetDeviceProperty(PhysicalDeviceObject,
DevicePropertyLegacyBusType, sizeof(INTERFACE_TYPE),
&PrivateDeviceDescription.InterfaceType, &ResultLength);
if (!NT_SUCCESS(Status))
{
PrivateDeviceDescription.InterfaceType = Internal;
}
DeviceDescription = &PrivateDeviceDescription;
}
Stack.Parameters.QueryInterface.Size = sizeof(BUS_INTERFACE_STANDARD);
Stack.Parameters.QueryInterface.Version = 1;
Stack.Parameters.QueryInterface.Interface = (PINTERFACE)&BusInterface;
Stack.Parameters.QueryInterface.InterfaceType =
&GUID_BUS_INTERFACE_STANDARD;
Status = IopInitiatePnpIrp(PhysicalDeviceObject, &IoStatusBlock,
IRP_MN_QUERY_BUS_INFORMATION, &Stack);
if (!NT_SUCCESS(Status))
{
Result = BusInterface.GetDmaAdapter(BusInterface.Context,
DeviceDescription, NumberOfMapRegisters);
BusInterface.InterfaceDereference(BusInterface.Context);
if (Result != NULL)
return Result;
}
}
/*
* Fallback to HAL
*/
HalAdapter = HalGetAdapter(DeviceDescription, NumberOfMapRegisters);
if (HalAdapter == NULL)
{
return NULL;
}
ResultInternal = ExAllocatePool(PagedPool, sizeof(DMA_ADAPTER_INTERNAL) +
sizeof(DMA_OPERATIONS));
if (Result == NULL)
{
return NULL;
}
ResultInternal->Version = DEVICE_DESCRIPTION_VERSION;
ResultInternal->Size = sizeof(DMA_ADAPTER);
ResultInternal->DmaOperations = (PDMA_OPERATIONS)(ResultInternal + 1);
ResultInternal->DmaOperations->Size = sizeof(DMA_OPERATIONS);
ResultInternal->DmaOperations->PutDmaAdapter = IopPutDmaAdapter;
ResultInternal->DmaOperations->AllocateCommonBuffer = IopAllocateCommonBuffer;
ResultInternal->DmaOperations->FreeCommonBuffer = IopFreeCommonBuffer;
ResultInternal->DmaOperations->AllocateAdapterChannel = IopAllocateAdapterChannel;
ResultInternal->DmaOperations->FlushAdapterBuffers = IopFlushAdapterBuffers;
ResultInternal->DmaOperations->FreeAdapterChannel = IopFreeAdapterChannel;
ResultInternal->DmaOperations->FreeMapRegisters = IopFreeMapRegisters;
ResultInternal->DmaOperations->MapTransfer = IopMapTransfer;
ResultInternal->DmaOperations->GetDmaAlignment = IopGetDmaAlignment;
ResultInternal->DmaOperations->ReadDmaCounter = IopReadDmaCounter;
ResultInternal->DmaOperations->GetScatterGatherList = IopGetScatterGatherList;
ResultInternal->DmaOperations->PutScatterGatherList = IopPutScatterGatherList;
ResultInternal->HalAdapter = HalAdapter;
return (PDMA_ADAPTER)ResultInternal;
}
/* EOF */

View file

@ -1,8 +1,8 @@
/* $Id: pnpmgr.c,v 1.14 2003/08/24 11:35:41 dwelch Exp $
/* $Id: pnpmgr.c,v 1.15 2003/09/25 15:54:42 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/pnpmgr.c
* FILE: ntoskrnl/io/pnpmgr/pnpmgr.c
* PURPOSE: Initializes the PnP manager
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
* UPDATE HISTORY:
@ -26,8 +26,7 @@ DEFINE_GUID(GUID_CLASS_COMPORT, 0x86e0d1e0L, 0x8089, 0x11d0, 0x9c, 0xe4
DEFINE_GUID(GUID_SERENUM_BUS_ENUMERATOR, 0x4D36E978L, 0xE325, 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18);
#endif // DEFINE_GUID
#define NDEBUG
//#define NDEBUG
#include <internal/debug.h>
@ -45,56 +44,6 @@ PDRIVER_OBJECT IopRootDriverObject;
/*
* @unimplemented
*/
VOID
STDCALL
IoInitializeRemoveLockEx(
IN PIO_REMOVE_LOCK Lock,
IN ULONG AllocateTag,
IN ULONG MaxLockedMinutes,
IN ULONG HighWatermark,
IN ULONG RemlockSize)
{
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoAcquireRemoveLockEx(
IN PIO_REMOVE_LOCK RemoveLock,
IN OPTIONAL PVOID Tag,
IN LPCSTR File,
IN ULONG Line,
IN ULONG RemlockSize)
{
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
VOID
STDCALL
IoReleaseRemoveLockEx(
IN PIO_REMOVE_LOCK RemoveLock,
IN PVOID Tag,
IN ULONG RemlockSize)
{
}
/*
* @unimplemented
*/
VOID
STDCALL
IoReleaseRemoveLockAndWaitEx(
IN PIO_REMOVE_LOCK RemoveLock,
IN PVOID Tag,
IN ULONG RemlockSize)
{
}
VOID
STDCALL
IoAdjustPagingPathCount(
@ -103,31 +52,17 @@ IoAdjustPagingPathCount(
{
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoGetDeviceInterfaceAlias(
IN PUNICODE_STRING SymbolicLinkName,
IN CONST GUID *AliasInterfaceClassGuid,
OUT PUNICODE_STRING AliasSymbolicLinkName)
IopQueryBusInformation(
PDEVICE_OBJECT DeviceObject,
PPNP_BUS_INFORMATION BusInformation)
{
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoGetDeviceInterfaces(
IN CONST GUID *InterfaceClassGuid,
IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
IN ULONG Flags,
OUT PWSTR *SymbolicLinkList)
{
return STATUS_NOT_IMPLEMENTED;
IO_STATUS_BLOCK IoStatusBlock;
IO_STACK_LOCATION Stack;
IoStatusBlock.Information = (ULONG)BusInformation;
return IopInitiatePnpIrp(DeviceObject, &IoStatusBlock,
IRP_MN_QUERY_BUS_INFORMATION, &Stack);
}
/*
@ -142,6 +77,82 @@ IoGetDeviceProperty(
OUT PVOID PropertyBuffer,
OUT PULONG ResultLength)
{
PNP_BUS_INFORMATION BusInformation;
NTSTATUS Status;
DPRINT("IoGetDeviceProperty called");
/*
* Used IRPs:
* IRP_MN_QUERY_ID
* IRP_MN_QUERY_BUS_INFORMATION
*/
switch (DeviceProperty)
{
/* Complete, untested */
case DevicePropertyBusNumber:
*ResultLength = sizeof(ULONG);
if (BufferLength < sizeof(ULONG))
return STATUS_BUFFER_TOO_SMALL;
Status = IopQueryBusInformation(DeviceObject, &BusInformation);
if (NT_SUCCESS(Status))
*((ULONG *)PropertyBuffer) = BusInformation.BusNumber;
return Status;
/* Complete, untested */
case DevicePropertyBusTypeGuid:
*ResultLength = 39 * sizeof(WCHAR);
if (BufferLength < (39 * sizeof(WCHAR)))
return STATUS_BUFFER_TOO_SMALL;
Status = IopQueryBusInformation(DeviceObject, &BusInformation);
if (NT_SUCCESS(Status))
swprintf((PWSTR)PropertyBuffer,
L"{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
BusInformation.BusTypeGuid.Data1,
BusInformation.BusTypeGuid.Data2,
BusInformation.BusTypeGuid.Data3,
BusInformation.BusTypeGuid.Data4[0],
BusInformation.BusTypeGuid.Data4[1],
BusInformation.BusTypeGuid.Data4[2],
BusInformation.BusTypeGuid.Data4[3],
BusInformation.BusTypeGuid.Data4[4],
BusInformation.BusTypeGuid.Data4[5],
BusInformation.BusTypeGuid.Data4[6],
BusInformation.BusTypeGuid.Data4[7]);
return Status;
/* Complete, untested */
case DevicePropertyLegacyBusType:
*ResultLength = sizeof(INTERFACE_TYPE);
if (BufferLength < sizeof(INTERFACE_TYPE))
return STATUS_BUFFER_TOO_SMALL;
Status = IopQueryBusInformation(DeviceObject, &BusInformation);
if (NT_SUCCESS(Status))
memcpy(PropertyBuffer, &BusInformation.LegacyBusType,
sizeof(INTERFACE_TYPE));
return Status;
case DevicePropertyAddress:
case DevicePropertyBootConfiguration:
case DevicePropertyBootConfigurationTranslated:
case DevicePropertyClassGuid:
case DevicePropertyClassName:
case DevicePropertyCompatibleIDs:
case DevicePropertyDeviceDescription:
case DevicePropertyDriverKeyName:
case DevicePropertyEnumeratorName:
case DevicePropertyFriendlyName:
case DevicePropertyHardwareID:
case DevicePropertyLocationInformation:
case DevicePropertyManufacturer:
case DevicePropertyPhysicalDeviceObjectName:
case DevicePropertyUINumber:
break;
default:
return STATUS_INVALID_PARAMETER_2;
}
return STATUS_NOT_IMPLEMENTED;
}
@ -166,19 +177,6 @@ IoInvalidateDeviceState(
{
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoOpenDeviceInterfaceRegistryKey(
IN PUNICODE_STRING SymbolicLinkName,
IN ACCESS_MASK DesiredAccess,
OUT PHANDLE DeviceInterfaceKey)
{
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
@ -193,105 +191,6 @@ IoOpenDeviceRegistryKey(
return STATUS_NOT_IMPLEMENTED;
}
/*
* @implemented
*/
NTSTATUS
STDCALL
IoRegisterDeviceInterface(
IN PDEVICE_OBJECT PhysicalDeviceObject,
IN CONST GUID *InterfaceClassGuid,
IN PUNICODE_STRING ReferenceString OPTIONAL,
OUT PUNICODE_STRING SymbolicLinkName)
{
PWCHAR KeyNameString = L"\\Device\\Serenum";
if (IsEqualGUID(InterfaceClassGuid, (LPGUID)&GUID_SERENUM_BUS_ENUMERATOR)) {
RtlInitUnicodeString(SymbolicLinkName, KeyNameString);
return STATUS_SUCCESS;
}
return STATUS_INVALID_DEVICE_REQUEST;
// return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoRegisterPlugPlayNotification(
IN IO_NOTIFICATION_EVENT_CATEGORY EventCategory,
IN ULONG EventCategoryFlags,
IN PVOID EventCategoryData OPTIONAL,
IN PDRIVER_OBJECT DriverObject,
IN PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine,
IN PVOID Context,
OUT PVOID *NotificationEntry)
{
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoReportDetectedDevice(
IN PDRIVER_OBJECT DriverObject,
IN INTERFACE_TYPE LegacyBusType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN PCM_RESOURCE_LIST ResourceList,
IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements OPTIONAL,
IN BOOLEAN ResourceAssigned,
IN OUT PDEVICE_OBJECT *DeviceObject)
{
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoReportResourceForDetection(
IN PDRIVER_OBJECT DriverObject,
IN PCM_RESOURCE_LIST DriverList OPTIONAL,
IN ULONG DriverListSize OPTIONAL,
IN PDEVICE_OBJECT DeviceObject OPTIONAL,
IN PCM_RESOURCE_LIST DeviceList OPTIONAL,
IN ULONG DeviceListSize OPTIONAL,
OUT PBOOLEAN ConflictDetected)
{
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoReportTargetDeviceChange(
IN PDEVICE_OBJECT PhysicalDeviceObject,
IN PVOID NotificationStructure)
{
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoReportTargetDeviceChangeAsynchronous(
IN PDEVICE_OBJECT PhysicalDeviceObject,
IN PVOID NotificationStructure,
IN PDEVICE_CHANGE_COMPLETE_CALLBACK Callback OPTIONAL,
IN PVOID Context OPTIONAL)
{
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
@ -302,33 +201,6 @@ IoRequestDeviceEject(
{
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoSetDeviceInterfaceState(
IN PUNICODE_STRING SymbolicLinkName,
IN BOOLEAN Enable)
{
return STATUS_SUCCESS;
// return STATUS_OBJECT_NAME_EXISTS;
// return STATUS_OBJECT_NAME_NOT_FOUND;
// return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoUnregisterPlugPlayNotification(
IN PVOID NotificationEntry)
{
return STATUS_NOT_IMPLEMENTED;
}
BOOLEAN
IopCreateUnicodeString(
@ -721,6 +593,7 @@ IopActionInterrogateDeviceStack(
WCHAR InstancePath[MAX_PATH];
IO_STACK_LOCATION Stack;
NTSTATUS Status;
WCHAR KeyBuffer[MAX_PATH];
DPRINT("DeviceNode %x Context %x\n", DeviceNode, Context);
@ -933,6 +806,19 @@ IopActionInterrogateDeviceStack(
DPRINT("InstancePath is %S\n", DeviceNode->InstancePath.Buffer);
/*
* Create registry key for the device id, if it doesn't exist yet
*
* FIXME: This code is temporary until I figure out where these keys should
* be created. The keys are needed for installation of PnP drivers.
*
* FiN
*/
wcscpy(KeyBuffer, L"\\Registry\\Machine\\System\\CurrentControlSet\\Enum\\");
wcscat(KeyBuffer, DeviceNode->DeviceID.Buffer);
RtlpCreateRegistryKeyPath(KeyBuffer);
return STATUS_SUCCESS;
}
@ -954,6 +840,83 @@ IopActionConfigureChildServices(
* configured.
*/
{
/*
* FIXME: There are two versions of this function: one that creates registry
* and one that doesn't. The second is the right, but could not be used because
* there is not automatic parent key generation.
*
* Update: It could propably be used now, but there's no need anymore.
*
* FiN
*/
#if 1
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
PDEVICE_NODE ParentDeviceNode;
PUNICODE_STRING Service;
NTSTATUS Status;
DPRINT("DeviceNode %x Context %x\n", DeviceNode, Context);
ParentDeviceNode = (PDEVICE_NODE)Context;
/* We are called for the parent too, but we don't need to do special
handling for this node */
if (DeviceNode == ParentDeviceNode)
{
DPRINT("Success\n");
return STATUS_SUCCESS;
}
/* Make sure this device node is a direct child of the parent device node
that is given as an argument */
if (DeviceNode->Parent != ParentDeviceNode)
{
/* Stop the traversal immediately and indicate successful operation */
DPRINT("Stop\n");
return STATUS_UNSUCCESSFUL;
}
/* Retrieve configuration from Enum key */
Service = &DeviceNode->ServiceName;
RtlZeroMemory(QueryTable, sizeof(QueryTable));
RtlInitUnicodeString(Service, NULL);
QueryTable[0].Name = L"Service";
QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
QueryTable[0].EntryContext = Service;
Status = RtlQueryRegistryValues(
RTL_REGISTRY_ENUM,
DeviceNode->InstancePath.Buffer,
QueryTable,
NULL,
NULL);
DPRINT("RtlQueryRegistryValues() returned status %x\n", Status);
DPRINT("Key: %S\n", DeviceNode->InstancePath.Buffer);
if (!NT_SUCCESS(Status))
{
/* FIXME: Log the error */
CPRINT("Could not retrieve configuration for device %S (Status %x)\n",
DeviceNode->InstancePath.Buffer, Status);
IopDeviceNodeSetFlag(DeviceNode, DNF_DISABLED);
return STATUS_SUCCESS;
}
if (Service->Buffer == NULL)
{
IopDeviceNodeSetFlag(DeviceNode, DNF_DISABLED);
return STATUS_SUCCESS;
}
DPRINT("Got Service %S\n", Service->Buffer);
return STATUS_SUCCESS;
#else
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
PDEVICE_NODE ParentDeviceNode;
PUNICODE_STRING Service;
@ -1026,6 +989,7 @@ IopActionConfigureChildServices(
DPRINT("Got Service %S\n", Service->Buffer);
return STATUS_SUCCESS;
#endif
}
@ -1212,10 +1176,9 @@ IopInterrogateBusExtender(
return Status;
}
return Status;
return STATUS_SUCCESS;
}
VOID IopLoadBootStartDrivers(VOID)
{
IopInterrogateBusExtender(

View file

@ -0,0 +1,56 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/pnpmgr/remlock.c
* PURPOSE: Plug & Play notification functions
* PROGRAMMER: Filip Navara (xnavara@volny.cz)
* UPDATE HISTORY:
* 22/09/2003 FiN Created
*/
/* INCLUDES ******************************************************************/
#include <ddk/ntddk.h>
#include <reactos/bugcodes.h>
#include <internal/io.h>
#include <internal/po.h>
#include <internal/ldr.h>
#include <internal/registry.h>
#include <internal/module.h>
//#define NDEBUG
#include <internal/debug.h>
/* FUNCTIONS *****************************************************************/
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoRegisterPlugPlayNotification(
IN IO_NOTIFICATION_EVENT_CATEGORY EventCategory,
IN ULONG EventCategoryFlags,
IN PVOID EventCategoryData OPTIONAL,
IN PDRIVER_OBJECT DriverObject,
IN PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine,
IN PVOID Context,
OUT PVOID *NotificationEntry)
{
DPRINT("IoRegisterPlugPlayNotification called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoUnregisterPlugPlayNotification(
IN PVOID NotificationEntry)
{
DPRINT("IoUnregisterPlugPlayNotification called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/* EOF */

View file

@ -0,0 +1,91 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/pnpmgr/report.c
* PURPOSE: Device Changes Reporting functions
* PROGRAMMER: Filip Navara (xnavara@volny.cz)
* UPDATE HISTORY:
* 22/09/2003 FiN Created
*/
/* INCLUDES ******************************************************************/
#include <ddk/ntddk.h>
#include <reactos/bugcodes.h>
#include <internal/io.h>
#include <internal/po.h>
#include <internal/ldr.h>
#include <internal/registry.h>
#include <internal/module.h>
//#define NDEBUG
#include <internal/debug.h>
/* FUNCTIONS *****************************************************************/
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoReportDetectedDevice(
IN PDRIVER_OBJECT DriverObject,
IN INTERFACE_TYPE LegacyBusType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN PCM_RESOURCE_LIST ResourceList,
IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements OPTIONAL,
IN BOOLEAN ResourceAssigned,
IN OUT PDEVICE_OBJECT *DeviceObject)
{
DPRINT("IoReportDetectedDevice called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoReportResourceForDetection(
IN PDRIVER_OBJECT DriverObject,
IN PCM_RESOURCE_LIST DriverList OPTIONAL,
IN ULONG DriverListSize OPTIONAL,
IN PDEVICE_OBJECT DeviceObject OPTIONAL,
IN PCM_RESOURCE_LIST DeviceList OPTIONAL,
IN ULONG DeviceListSize OPTIONAL,
OUT PBOOLEAN ConflictDetected)
{
DPRINT("IoReportResourceForDetection called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoReportTargetDeviceChange(
IN PDEVICE_OBJECT PhysicalDeviceObject,
IN PVOID NotificationStructure)
{
DPRINT("IoReportTargetDeviceChange called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoReportTargetDeviceChangeAsynchronous(
IN PDEVICE_OBJECT PhysicalDeviceObject,
IN PVOID NotificationStructure,
IN PDEVICE_CHANGE_COMPLETE_CALLBACK Callback OPTIONAL,
IN PVOID Context OPTIONAL)
{
DPRINT("IoReportTargetDeviceChangeAsynchronous called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/* EOF */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,107 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/pnpmgr/remlock.c
* PURPOSE: Remove Lock functions
* PROGRAMMER: Filip Navara (xnavara@volny.cz)
* UPDATE HISTORY:
* 22/09/2003 FiN Created
*/
/* INCLUDES ******************************************************************/
#include <ddk/ntddk.h>
#include <reactos/bugcodes.h>
#include <internal/io.h>
#include <internal/po.h>
#include <internal/ldr.h>
#include <internal/registry.h>
#include <internal/module.h>
//#define NDEBUG
#include <internal/debug.h>
/* FUNCTIONS *****************************************************************/
/*
* @implemented
*/
VOID
STDCALL
IoInitializeRemoveLockEx(
IN PIO_REMOVE_LOCK RemoveLock,
IN ULONG AllocateTag,
IN ULONG MaxLockedMinutes,
IN ULONG HighWatermark,
IN ULONG RemlockSize)
{
DPRINT("IoInitializeRemoveLockEx called");
RtlZeroMemory(RemoveLock, RemlockSize);
RemoveLock->Common.IoCount = 1;
KeInitializeEvent(&RemoveLock->Common.RemoveEvent, NotificationEvent, FALSE);
}
/*
* @implemented
*/
NTSTATUS
STDCALL
IoAcquireRemoveLockEx(
IN PIO_REMOVE_LOCK RemoveLock,
IN OPTIONAL PVOID Tag,
IN LPCSTR File,
IN ULONG Line,
IN ULONG RemlockSize)
{
DPRINT("IoAcquireRemoveLockEx called");
InterlockedIncrement(&RemoveLock->Common.IoCount);
if (RemoveLock->Common.Removed)
{
if (InterlockedDecrement(&RemoveLock->Common.IoCount) == 0)
{
KeSetEvent(&RemoveLock->Common.RemoveEvent, IO_NO_INCREMENT, FALSE);
}
return STATUS_DELETE_PENDING;
}
return STATUS_SUCCESS;
}
/*
* @implemented
*/
VOID
STDCALL
IoReleaseRemoveLockEx(
IN PIO_REMOVE_LOCK RemoveLock,
IN PVOID Tag,
IN ULONG RemlockSize)
{
LONG IoCount;
DPRINT("IoReleaseRemoveLockEx called");
IoCount = InterlockedDecrement(&RemoveLock->Common.IoCount);
if (IoCount == 0)
{
KeSetEvent(&RemoveLock->Common.RemoveEvent, IO_NO_INCREMENT, FALSE);
}
}
/*
* @implemented
*/
VOID
STDCALL
IoReleaseRemoveLockAndWaitEx(
IN PIO_REMOVE_LOCK RemoveLock,
IN PVOID Tag,
IN ULONG RemlockSize)
{
DPRINT("IoReleaseRemoveLockAndWaitEx called");
RemoveLock->Common.Removed = TRUE;
InterlockedDecrement(&RemoveLock->Common.IoCount);
IoReleaseRemoveLockEx(RemoveLock, Tag, RemlockSize);
KeWaitForSingleObject(&RemoveLock->Common.RemoveEvent, Executive, KernelMode,
FALSE, NULL);
}
/* EOF */

23
reactos/ntoskrnl/io/wdm.c Normal file
View file

@ -0,0 +1,23 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/wdm.c
* PURPOSE: Various Windows Driver Model routines
* PROGRAMMER: Filip Navara (xnavara@volny.cz)
*/
#include <ddk/ntddk.h>
/*
* @implemented
*/
BOOLEAN STDCALL
IoIsWdmVersionAvailable(
IN UCHAR MajorVersion,
IN UCHAR MinorVersion
)
{
if (MajorVersion <= 1 && MinorVersion <= 10)
return TRUE;
return FALSE;
}

View file

@ -1,4 +1,4 @@
/* $Id: spinlock.c,v 1.18 2003/07/21 21:53:51 royce Exp $
/* $Id: spinlock.c,v 1.19 2003/09/25 15:54:42 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -69,19 +69,13 @@ KeInitializeSpinLock (PKSPIN_LOCK SpinLock)
*SpinLock = 0;
}
#undef KeAcquireSpinLockAtDpcLevel
#undef KefAcquireSpinLockAtDpcLevel
/*
* @implemented
*/
VOID STDCALL
KeAcquireSpinLockAtDpcLevel (PKSPIN_LOCK SpinLock)
/*
* FUNCTION: Acquires a spinlock when the caller is already running at
* dispatch level
* ARGUMENTS:
* SpinLock = Spinlock to acquire
*/
VOID FASTCALL
KefAcquireSpinLockAtDpcLevel(PKSPIN_LOCK SpinLock)
{
ULONG i;
@ -106,6 +100,39 @@ KeAcquireSpinLockAtDpcLevel (PKSPIN_LOCK SpinLock)
}
}
#undef KeAcquireSpinLockAtDpcLevel
/*
* @implemented
*/
VOID STDCALL
KeAcquireSpinLockAtDpcLevel (PKSPIN_LOCK SpinLock)
/*
* FUNCTION: Acquires a spinlock when the caller is already running at
* dispatch level
* ARGUMENTS:
* SpinLock = Spinlock to acquire
*/
{
KefAcquireSpinLockAtDpcLevel(SpinLock);
}
#undef KefReleaseSpinLockFromDpcLevel
/*
* @implemented
*/
VOID FASTCALL
KefReleaseSpinLockFromDpcLevel(PKSPIN_LOCK SpinLock)
{
if (*SpinLock != 1)
{
DbgPrint("Releasing unacquired spinlock %x\n", SpinLock);
KEBUGCHECK(0);
}
(void)InterlockedExchange((LONG *)SpinLock, 0);
}
#undef KeReleaseSpinLockFromDpcLevel
/*
@ -120,12 +147,7 @@ KeReleaseSpinLockFromDpcLevel (PKSPIN_LOCK SpinLock)
* SpinLock = Spinlock to release
*/
{
if (*SpinLock != 1)
{
DbgPrint("Releasing unacquired spinlock %x\n", SpinLock);
KEBUGCHECK(0);
}
(void)InterlockedExchange((LONG *)SpinLock, 0);
KefReleaseSpinLockFromDpcLevel(SpinLock);
}
/* EOF */

View file

@ -1,165 +1,175 @@
/* $Id: pool.c,v 1.22 2003/09/14 09:15:04 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/pool.c
* PURPOSE: Implements the kernel memory pool
* PROGRAMMER: David Welch (welch@mcmail.com)
*/
/* INCLUDES ****************************************************************/
#include <ddk/ntddk.h>
#include <reactos/bugcodes.h>
#include <internal/ntoskrnl.h>
#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
/* GLOBALS *****************************************************************/
#define TAG_NONE (ULONG)(('N'<<0) + ('o'<<8) + ('n'<<16) + ('e'<<24))
/* FUNCTIONS ***************************************************************/
PVOID STDCALL STATIC
EiAllocatePool(POOL_TYPE PoolType,
ULONG NumberOfBytes,
ULONG Tag,
PVOID Caller)
{
PVOID Block;
switch(PoolType)
{
case NonPagedPool:
case NonPagedPoolMustSucceed:
case NonPagedPoolCacheAligned:
case NonPagedPoolCacheAlignedMustS:
Block =
ExAllocateNonPagedPoolWithTag(PoolType,
NumberOfBytes,
Tag,
Caller);
break;
case PagedPool:
case PagedPoolCacheAligned:
Block = ExAllocatePagedPoolWithTag(PoolType,NumberOfBytes,Tag);
break;
default:
return(NULL);
};
if ((PoolType==NonPagedPoolMustSucceed ||
PoolType==NonPagedPoolCacheAlignedMustS) && Block==NULL)
{
KEBUGCHECK(MUST_SUCCEED_POOL_EMPTY);
}
return(Block);
}
/*
* @implemented
*/
PVOID STDCALL
ExAllocatePool (POOL_TYPE PoolType, ULONG NumberOfBytes)
/*
* FUNCTION: Allocates pool memory of a specified type and returns a pointer
* to the allocated block. This routine is used for general purpose allocation
* of memory
* ARGUMENTS:
* PoolType
* Specifies the type of memory to allocate which can be one
* of the following:
*
* NonPagedPool
* NonPagedPoolMustSucceed
* NonPagedPoolCacheAligned
* NonPagedPoolCacheAlignedMustS
* PagedPool
* PagedPoolCacheAligned
*
* NumberOfBytes
* Specifies the number of bytes to allocate
* RETURNS: The allocated block on success
* NULL on failure
*/
{
PVOID Block;
Block = EiAllocatePool(PoolType,
NumberOfBytes,
TAG_NONE,
(PVOID)__builtin_return_address(0));
return(Block);
}
/*
* @implemented
*/
PVOID STDCALL
ExAllocatePoolWithTag (ULONG PoolType, ULONG NumberOfBytes, ULONG Tag)
{
PVOID Block;
Block = EiAllocatePool(PoolType,
NumberOfBytes,
Tag,
(PVOID)__builtin_return_address(0));
return(Block);
}
/*
* @implemented
*/
PVOID STDCALL
ExAllocatePoolWithQuota (POOL_TYPE PoolType, ULONG NumberOfBytes)
{
return(ExAllocatePoolWithQuotaTag(PoolType, NumberOfBytes, TAG_NONE));
}
/*
* @unimplemented
*/
PVOID STDCALL
ExAllocatePoolWithQuotaTag (IN POOL_TYPE PoolType,
IN ULONG NumberOfBytes,
IN ULONG Tag)
{
#if 0
PVOID Block;
Block = EiAllocatePool(PoolType,
NumberOfBytes,
Tag,
(PVOID)__builtin_return_address(0));
return(Block);
#endif
UNIMPLEMENTED;
}
/*
* @implemented
*/
VOID STDCALL
ExFreePool(IN PVOID Block)
{
if (Block >= MmPagedPoolBase && Block < (MmPagedPoolBase + MmPagedPoolSize))
{
ExFreePagedPool(Block);
}
else
{
ExFreeNonPagedPool(Block);
}
}
/* EOF */
/* $Id: pool.c,v 1.23 2003/09/25 15:54:43 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/pool.c
* PURPOSE: Implements the kernel memory pool
* PROGRAMMER: David Welch (welch@mcmail.com)
*/
/* INCLUDES ****************************************************************/
#include <ddk/ntddk.h>
#include <reactos/bugcodes.h>
#include <internal/ntoskrnl.h>
#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
/* GLOBALS *****************************************************************/
#define TAG_NONE (ULONG)(('N'<<0) + ('o'<<8) + ('n'<<16) + ('e'<<24))
/* FUNCTIONS ***************************************************************/
PVOID STDCALL STATIC
EiAllocatePool(POOL_TYPE PoolType,
ULONG NumberOfBytes,
ULONG Tag,
PVOID Caller)
{
PVOID Block;
switch(PoolType)
{
case NonPagedPool:
case NonPagedPoolMustSucceed:
case NonPagedPoolCacheAligned:
case NonPagedPoolCacheAlignedMustS:
Block =
ExAllocateNonPagedPoolWithTag(PoolType,
NumberOfBytes,
Tag,
Caller);
break;
case PagedPool:
case PagedPoolCacheAligned:
Block = ExAllocatePagedPoolWithTag(PoolType,NumberOfBytes,Tag);
break;
default:
return(NULL);
};
if ((PoolType==NonPagedPoolMustSucceed ||
PoolType==NonPagedPoolCacheAlignedMustS) && Block==NULL)
{
KEBUGCHECK(MUST_SUCCEED_POOL_EMPTY);
}
return(Block);
}
/*
* @implemented
*/
PVOID STDCALL
ExAllocatePool (POOL_TYPE PoolType, ULONG NumberOfBytes)
/*
* FUNCTION: Allocates pool memory of a specified type and returns a pointer
* to the allocated block. This routine is used for general purpose allocation
* of memory
* ARGUMENTS:
* PoolType
* Specifies the type of memory to allocate which can be one
* of the following:
*
* NonPagedPool
* NonPagedPoolMustSucceed
* NonPagedPoolCacheAligned
* NonPagedPoolCacheAlignedMustS
* PagedPool
* PagedPoolCacheAligned
*
* NumberOfBytes
* Specifies the number of bytes to allocate
* RETURNS: The allocated block on success
* NULL on failure
*/
{
PVOID Block;
Block = EiAllocatePool(PoolType,
NumberOfBytes,
TAG_NONE,
(PVOID)__builtin_return_address(0));
return(Block);
}
/*
* @implemented
*/
PVOID STDCALL
ExAllocatePoolWithTag (ULONG PoolType, ULONG NumberOfBytes, ULONG Tag)
{
PVOID Block;
Block = EiAllocatePool(PoolType,
NumberOfBytes,
Tag,
(PVOID)__builtin_return_address(0));
return(Block);
}
/*
* @implemented
*/
PVOID STDCALL
ExAllocatePoolWithQuota (POOL_TYPE PoolType, ULONG NumberOfBytes)
{
return(ExAllocatePoolWithQuotaTag(PoolType, NumberOfBytes, TAG_NONE));
}
/*
* @unimplemented
*/
PVOID STDCALL
ExAllocatePoolWithQuotaTag (IN POOL_TYPE PoolType,
IN ULONG NumberOfBytes,
IN ULONG Tag)
{
#if 0
PVOID Block;
Block = EiAllocatePool(PoolType,
NumberOfBytes,
Tag,
(PVOID)__builtin_return_address(0));
return(Block);
#endif
UNIMPLEMENTED;
}
/*
* @implemented
*/
VOID STDCALL
ExFreePool(IN PVOID Block)
{
if (Block >= MmPagedPoolBase && Block < (MmPagedPoolBase + MmPagedPoolSize))
{
ExFreePagedPool(Block);
}
else
{
ExFreeNonPagedPool(Block);
}
}
/*
* @implemented
*/
VOID STDCALL
ExFreePoolWithTag(IN PVOID Block, IN ULONG Tag)
{
/* FIXME: Validate the tag */
ExFreePool(Block);
}
/* EOF */

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.152 2003/09/09 14:50:19 gvg Exp $
; $Id: ntoskrnl.edf,v 1.153 2003/09/25 15:54:42 navaraf Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -45,6 +45,7 @@ ExDisableResourceBoostLite=ExDisableResourceBoostLite@4
ExEventObjectType DATA
ExExtendZone=ExExtendZone@12
ExFreePool=ExFreePool@4
ExFreePoolWithTag=ExFreePoolWithTag@8
ExFreeToPagedLookasideList=ExiFreeToPagedLookasideList@8
ExGetExclusiveWaiterCount=ExGetExclusiveWaiterCount@4
ExGetPreviousMode=ExGetPreviousMode@0
@ -285,6 +286,7 @@ IoGetConfigurationInformation=IoGetConfigurationInformation@0
IoGetCurrentProcess=IoGetCurrentProcess@0
IoGetDeviceObjectPointer=IoGetDeviceObjectPointer@16
IoGetDeviceToVerify=IoGetDeviceToVerify@4
IoGetDmaAdapter=IoGetDmaAdapter@12
IoGetFileObjectGenericMapping=IoGetFileObjectGenericMapping@0
IoGetInitialStack=IoGetInitialStack@0
IoGetRelatedDeviceObject=IoGetRelatedDeviceObject@4
@ -356,6 +358,7 @@ IoWritePartitionTable=IoWritePartitionTable@20
IoWriteTransferCount DATA
IofCallDriver=@IofCallDriver@8
IofCompleteRequest=@IofCompleteRequest@8
IoIsWdmVersionAvailable=IoIsWdmVersionAvailable@8
KdDebuggerEnabled DATA
KdDebuggerNotPresent DATA
KdPollBreakIn=KdPollBreakIn@0
@ -472,8 +475,8 @@ KeTickCount DATA
KeWaitForMultipleObjects=KeWaitForMultipleObjects@32
KeWaitForMutexObject=KeWaitForMutexObject@20
KeWaitForSingleObject=KeWaitForSingleObject@20
;KefAcquireSpinLockAtDpcLevel
;KefReleaseSpinLockFromDpcLevel
KefAcquireSpinLockAtDpcLevel=@KefAcquireSpinLockAtDpcLevel@4
KefReleaseSpinLockFromDpcLevel=@KefReleaseSpinLockFromDpcLevel@4
;Kei386EoiHelper
;KiAcquireSpinLock@4
;KiBugCheckData DATA