- Hey Arch! You're displaying Major function codes, not IOCTL codes. Also, remove unnecessary casts (coming from some old code), and a use-after free.
- Add some memory helpers.

svn path=/trunk/; revision=59448
This commit is contained in:
Hermès Bélusca-Maïto 2013-07-07 15:57:48 +00:00
parent 2f99c45433
commit fd86dd4500
4 changed files with 35 additions and 10 deletions

View file

@ -40,16 +40,16 @@ CompleteRequest(IN PIRP Irp,
Irp->IoStatus.Information = Information;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Irp->IoStatus.Status;
return Status;
}
NTSTATUS NTAPI
ConDrvDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
{
#define HANDLE_CTRL_CODE(CtrlCode) \
case CtrlCode : \
{ \
DPRINT1("ConDrv: " #CtrlCode ", stack->FileObject = 0x%p\n", stack->FileObject); \
#define HANDLE_CTRL_CODE(Code) \
case Code : \
{ \
DPRINT1("ConDrv: " #Code ", stack->FileObject = 0x%p\n", stack->FileObject); \
if (stack->FileObject) \
{ \
DPRINT1("stack->FileObject->FileName = %wZ\n", &stack->FileObject->FileName); \
@ -58,10 +58,11 @@ ConDrvDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
}
PIO_STACK_LOCATION stack = IoGetCurrentIrpStackLocation(Irp);
ULONG ctrlCode = stack->Parameters.DeviceIoControl.IoControlCode;
// ULONG ctrlCode = stack->Parameters.DeviceIoControl.IoControlCode;
ULONG MajorFunction = stack->MajorFunction;
/* Just display all the IRP codes for now... */
switch (ctrlCode)
switch (MajorFunction)
{
HANDLE_CTRL_CODE(IRP_MJ_CREATE);
HANDLE_CTRL_CODE(IRP_MJ_CREATE_NAMED_PIPE);
@ -96,7 +97,7 @@ ConDrvDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
default:
{
DPRINT1("Unknown code %lu\n", ctrlCode);
DPRINT1("Unknown Major %lu\n", MajorFunction);
break;
}
}

View file

@ -10,7 +10,10 @@
#define __CONDRV_H__
/* This is needed for VisualDDK testing */
// #define __USE_VISUALDDK_AT_HOME__
#ifdef __USE_VISUALDDK_AT_HOME__
#pragma message("Disable __USE_VISUALDDK_AT_HOME__ before committing!!")
#include "VisualDDKHelpers.h"
#endif

View file

@ -44,8 +44,7 @@ ConDrvCreateController(IN PDRIVER_OBJECT DriverObject,
&Controller);
if (!NT_SUCCESS(Status)) goto Done;
Status = IoCreateSymbolicLink((PUNICODE_STRING)&SymlinkName,
(PUNICODE_STRING)&DeviceName);
Status = IoCreateSymbolicLink(&SymlinkName, &DeviceName);
if (!NT_SUCCESS(Status))
{
IoDeleteDevice(Controller);

View file

@ -0,0 +1,22 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Console Driver
* FILE: drivers/base/condrv/heap.h
* PURPOSE: Heap Helpers
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
*/
#pragma once
#define ConDrvAllocPoolNonPageable(Flags, Size, Tag) \
__pragma(message("WARNING - Flags parameter ignored. You may encounter problems!")) \
ExAllocatePoolWithTag(NonPagedPool, Size, Tag)
#define ConDrvAllocPoolPageable(Flags, Size, Tag) \
__pragma(message("WARNING - Flags parameter ignored. You may encounter problems!")) \
ExAllocatePoolWithTag(PagedPool, Size, Tag)
#define ConDrvFreePool(PoolBase, Tag) \
ExFreePoolWithTag(PoolBase, Tag)
/* EOF */