-/* $Id: pnpdma.c,v 1.7 2004/10/18 21:07:42 navaraf Exp $
+/* $Id: pnpdma.c,v 1.8 2004/10/19 19:37:45 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
/* INCLUDES ******************************************************************/
#include <ntoskrnl.h>
+#define NDEBUG
#include <internal/debug.h>
#ifdef __USE_W32API
IN PDEVICE_DESCRIPTION DeviceDescription,
IN OUT PULONG NumberOfMapRegisters)
{
+ static DMA_OPERATIONS HalDmaOperations = {
+ sizeof(DMA_OPERATIONS),
+ IopPutDmaAdapter,
+ IopAllocateCommonBuffer,
+ IopFreeCommonBuffer,
+ IopAllocateAdapterChannel,
+ IopFlushAdapterBuffers,
+ IopFreeAdapterChannel,
+ IopFreeMapRegisters,
+ IopMapTransfer,
+ IopGetDmaAlignment,
+ IopReadDmaCounter,
+ IopGetScatterGatherList,
+ IopPutScatterGatherList
+ };
NTSTATUS Status;
ULONG ResultLength;
BUS_INTERFACE_STANDARD BusInterface;
if (DeviceDescription->InterfaceType == 0x0F /*PNPBus*/ ||
DeviceDescription->InterfaceType == 0xFFFFFFFF)
{
- memcpy(&PrivateDeviceDescription, DeviceDescription,
+ RtlCopyMemory(&PrivateDeviceDescription, DeviceDescription,
sizeof(DEVICE_DESCRIPTION));
Status = IoGetDeviceProperty(PhysicalDeviceObject,
DevicePropertyLegacyBusType, sizeof(INTERFACE_TYPE),
Stack.Parameters.QueryInterface.InterfaceType =
&GUID_BUS_INTERFACE_STANDARD;
Status = IopInitiatePnpIrp(PhysicalDeviceObject, &IoStatusBlock,
- IRP_MN_QUERY_BUS_INFORMATION, &Stack);
+ IRP_MN_QUERY_INTERFACE, &Stack);
if (NT_SUCCESS(Status))
{
Result = BusInterface.GetDmaAdapter(BusInterface.Context,
HalAdapter = HalGetAdapter(DeviceDescription, NumberOfMapRegisters);
if (HalAdapter == NULL)
- {
return NULL;
- }
- ResultInternal = ExAllocatePool(PagedPool, sizeof(DMA_ADAPTER_INTERNAL) +
- sizeof(DMA_OPERATIONS));
- if (Result == NULL)
- {
+ ResultInternal = ExAllocatePool(PagedPool, sizeof(DMA_ADAPTER_INTERNAL));
+ if (ResultInternal == 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->DmaOperations = &HalDmaOperations;
ResultInternal->HalAdapter = HalAdapter;
return (PDMA_ADAPTER)ResultInternal;
-/* $Id: pnpmgr.c,v 1.37 2004/10/11 19:07:25 ekohl Exp $
+/* $Id: pnpmgr.c,v 1.38 2004/10/19 19:37:45 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
KeInitializeEvent(
&Event,
- NotificationEvent,
- FALSE);
-
- /* PNP IRPs are always initialized with a status code of
- STATUS_NOT_IMPLEMENTED */
- IoStatusBlock->Status = STATUS_NOT_IMPLEMENTED;
- IoStatusBlock->Information = 0;
+ NotificationEvent,
+ FALSE);
Irp = IoBuildSynchronousFsdRequest(
IRP_MJ_PNP,
TopDeviceObject,
- NULL,
- 0,
- NULL,
- &Event,
- IoStatusBlock);
+ NULL,
+ 0,
+ NULL,
+ &Event,
+ IoStatusBlock);
+
+ /* PNP IRPs are always initialized with a status code of
+ STATUS_NOT_IMPLEMENTED */
+ Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
+ Irp->IoStatus.Information = 0;
IrpSp = IoGetNextIrpStackLocation(Irp);
IrpSp->MinorFunction = MinorFunction;
sizeof(ULONG));
/* Set 'UINumber' value */
- if (DeviceNode->CapabilityFlags->UINumber != (ULONG)-1)
+ if (DeviceNode->CapabilityFlags != NULL &&
+ DeviceNode->CapabilityFlags->UINumber != (ULONG)-1)
{
RtlInitUnicodeString(&KeyName,
L"UINumber");